Skip to content

Commit

Permalink
Complete 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hexadecimal233 committed Feb 6, 2021
1 parent 46b3bfd commit 5465ef9
Show file tree
Hide file tree
Showing 14 changed files with 337 additions and 281 deletions.
82 changes: 82 additions & 0 deletions Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,16 @@
<data name="store" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\store.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="table_1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resource\table\table-1.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;gb2312</value>
</data>
<data name="table_1_cn" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resource\table\table-1-cn.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="table_2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resource\table\table-2.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;gb2312</value>
</data>
<data name="table_2_cn" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resource\table\table-2-cn.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
</root>
8 changes: 5 additions & 3 deletions Windows Store Downloader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@
<Compile Include="code\Language.cs" />
<Compile Include="code\Post.cs" />
<Compile Include="code\Program.cs" />
<Compile Include="code\ShapeButton.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="code\global.cs" />
<Compile Include="code\zh-CN.cs" />
Expand Down Expand Up @@ -163,6 +160,11 @@
</ItemGroup>
<ItemGroup>
<Content Include="resources\icon.ico" />
<None Include="resource\table\table-2-cn.txt" />
<None Include="resource\table\table-1-cn.txt" />
<None Include="resource\table\table-2.txt" />
<None Include="resources\table_2.txt" />
<None Include="resource\table\table-1.txt" />
<None Include="resources\store.png" />
</ItemGroup>
<ItemGroup />
Expand Down
40 changes: 18 additions & 22 deletions code/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private void AttributeInputReady(object sender, EventArgs e)
}


}
}//灰色文本
private void HasText()
{

Expand All @@ -52,7 +52,7 @@ private void HasText()
}


}
}//编辑框是否有文字
private void AttributeInputDeselect(object sender, EventArgs e)
{
HasText();
Expand All @@ -66,33 +66,34 @@ private void AttributeInputDeselect(object sender, EventArgs e)
{
textBoxHasText = true;
}
}
}//灰色文本
private string SetAttributeText() {
return Language.lang_attributes[typeBox.SelectedIndex];
}
}//获取当前项的本地化文本


private void DownloadButton_Click(object sender, EventArgs e)
{
downloadButton.Enabled = false;
downloadButton.Enabled = false;//禁止重复点击
Form2.complete = false;
progressBar1.Value = 0;
if (typeBox.SelectedIndex == -1 || routeBox.SelectedIndex == -1 || attributeText.Text == "")
{
MessageBox.Show(Language.lang_baddown,Language.lang_baddowninfo,MessageBoxButtons.OK,MessageBoxIcon.Error);
}
else
{
return;
}//参数完整


if (langText.Text == "")
{
langText.Text = Thread.CurrentThread.CurrentCulture.Name;
}//提交语言
postContent = "type=" + Http_Post.type[typeBox.SelectedIndex] + "&url=" + attributeText.Text + "&ring=" +
Http_Post.ring[routeBox.SelectedIndex] + "&lang=" + langText.Text;
Http_Post.ring[routeBox.SelectedIndex] + "&lang=" + langText.Text;

Thread post = new Thread(Form2.Browse);
post.SetApartmentState(ApartmentState.STA);
post.Start();
post.Start(); //POST线程
while (Form2.complete == false)
{
if(progressBar1.Value <= 99)
Expand All @@ -109,26 +110,21 @@ private void DownloadButton_Click(object sender, EventArgs e)
MessageBox.Show(Language.lang_interr, Language.lang_interr, MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}//意外
new Form2().ShowDialog();
if (Form2.returnid == 1)

if (Form2.returnid == 1)//浏览
{
try
{




}
catch (InvalidComObjectException) { }
catch (Exception ex)
new Form2().ShowDialog();
} catch (Exception ex)
{
Language.InternalErrMsgBox(ex);
}
}

}

}

}//下载&浏览

private void ChangeLanguage(object sender, EventArgs e)//更改语言
{
Expand Down Expand Up @@ -156,7 +152,7 @@ private void Form1_Load(object sender, EventArgs e)

User32.AnimateWindow(this.Handle, 200, User32.AW_BLEND | User32.AW_ACTIVE | User32.AW_VER_NEGATIVE);
RefreshForm();
this.Opacity = 0.9;
this.Opacity = 0.95;


}
Expand Down
5 changes: 3 additions & 2 deletions code/Form2.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 38 additions & 6 deletions code/Form2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Text;
using System.Threading;
using System.Windows.Forms;
Expand All @@ -29,7 +30,18 @@ public Form2()
Http_Post Http_Post = new Http_Post();
public void Browse()
{
zh_CN zh_CN = new zh_CN();
global global = new global();
WriteToTemp WriteToTemp = new WriteToTemp();
if (File.Exists(WriteToTemp.tmpPath + @"\" + zh_CN.lang_tablehtm))
{
File.Delete(WriteToTemp.tmpPath + @"\" + zh_CN.lang_tablehtm);
}
else if (File.Exists(WriteToTemp.tmpPath + @"\" + global.lang_tablehtm))
{
File.Delete(WriteToTemp.tmpPath + @"\" + global.lang_tablehtm);
}//去除文件缓存

complete = false;
result = "";
string content = Form1.postContent;
Expand All @@ -54,11 +66,22 @@ public void Browse()
complete = true;
return;
} // 处理错误-1
string result3 = Mdui(result2);
Debug.WriteLine(result3);
string result4;
if(Language.langUsing == "global")//language
{
result4 = Properties.Resources.table_1 + "\n" + result3 + "\n" + Properties.Resources.table_2;
} else {
result4 = Properties.Resources.table_1_cn + "\n" + result3 + "\n" + Properties.Resources.table_2_cn;
}


File.WriteAllText(WriteToTemp.tmpPath + @"\" + Language.lang_tablehtm,result4);//写出合并后的文本
returnid = 1; //成功
complete = true;
Debug.WriteLine(result2);
complete = true;
return;
}
}//POST和格式化等
private string RemoveUselessContent(string old)//格式化
{
try
Expand All @@ -77,19 +100,28 @@ private string RemoveUselessContent(string old)//格式化
}
private string Mdui(string old)//加入Mdui格式
{

return old;
string new1;
new1 = old.Replace("class=\"tftable\" border=\"1\" align=\"center\"",
"class=\"mdui-table\" style=\"margin-left: 20px;margin-right: 20px;margin-top: 20px;\"")
.Replace("style=\"width:180px;\"", "")
.Replace("style=\"width:300px;\"", "")
.Replace("style=\"width:60px;\"", "")
.Replace("style=\"background-color:rgba(255, 255, 255, 0.8)\"", "")
.Replace("style=\"background-color:rgba(188, 235, 240, 0.8)\"", "class=\"mdui-color-blue-100\"");
return new1;
}
private void Form2_Load(object sender, EventArgs e)
{
var urlString = new Uri(WriteToTemp.tmpPath + @"\" + Language.lang_errhtm);
//打开网页
var urlString = new Uri(WriteToTemp.tmpPath + @"\" + Language.lang_tablehtm);
Debug.WriteLine(urlString);
if (System.Diagnostics.Debugger.IsAttached == true)
{
webBrowser1.AllowWebBrowserDrop = true;
}

webBrowser1.Navigate(urlString);

webBrowser1.DocumentTitleChanged += DocTitleClose;
}
private void DocTitleClose(object sender, EventArgs e)
Expand Down
Loading

0 comments on commit 5465ef9

Please sign in to comment.