Skip to content

Commit

Permalink
Fix bugs and enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
hexadecimal233 committed Feb 7, 2021
1 parent 996bd5d commit 66dc3de
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 71 deletions.
8 changes: 4 additions & 4 deletions Properties/Resources.Designer.cs

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

16 changes: 8 additions & 8 deletions Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,20 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="res" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resource\res.zip;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<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_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_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 name="res" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resource\res.zip;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<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_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>
Expand Down
1 change: 0 additions & 1 deletion Windows Store Downloader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@
<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>
Expand Down
30 changes: 15 additions & 15 deletions code/Form1.Designer.cs

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

58 changes: 34 additions & 24 deletions code/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Drawing.Drawing2D;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Windows_Store_Downloader
Expand All @@ -20,6 +21,7 @@ public Form1()

private bool textBoxHasText = false;
Form2 Form2 = new Form2();

WriteToTemp WriteToTemp = new WriteToTemp();
public static string postContent;
private void AttributeInputReady(object sender, EventArgs e)
Expand Down Expand Up @@ -71,53 +73,61 @@ private string SetAttributeText() {
return Language.lang_attributes[typeBox.SelectedIndex];
}//获取当前项的本地化文本


private void DownloadButton_Click(object sender, EventArgs e)
{
progressBar1.Value = 0;
downloadButton.Enabled = false;//禁止重复点击
Form2.complete = false;
progressBar1.Value = 0;
HasText();
if (typeBox.SelectedIndex == -1 || routeBox.SelectedIndex == -1 || textBoxHasText == false)
{

MessageBox.Show(Language.lang_baddown,Language.lang_baddowninfo,MessageBoxButtons.OK,MessageBoxIcon.Error);
downloadButton.Enabled = true;
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;

Thread post = new Thread(Form2.Browse);

Thread post = new Thread(Form2.Browse);
post.SetApartmentState(ApartmentState.STA);
post.Start(); //POST线程
while (Form2.complete == false)


while (Form2.complete == false)
{
if (progressBar1.Value <= 99)
{
if(progressBar1.Value <= 99)
{
Random random = new Random(new Guid().GetHashCode());
Thread.Sleep(random.Next(67, 101));
progressBar1.PerformStep();
}
}//伪装进度条
progressBar1.Value = 100;
downloadButton.Enabled = true;
if (Form2.returnid == -1)
Random random = new Random(new Guid().GetHashCode());
Thread.Sleep(random.Next(67, 101));
progressBar1.PerformStep();

}

}//伪装进度条
progressBar1.Value = 100;
downloadButton.Enabled = true;



if (Form2.returnid == -1)
{
MessageBox.Show(Language.lang_interr, Language.lang_interr, MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
MessageBox.Show(Language.lang_interr, Language.lang_interr, MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}//意外
if (Form2.returnid == 2) {

Form2.ShowDialog();
}//空响应
if (Form2.returnid == 1)//浏览
{
try
try
{
new Form2().ShowDialog();
} catch (Exception ex)
Expand Down Expand Up @@ -247,12 +257,8 @@ private void Form1_Paint(object sender, PaintEventArgs e)
}




private void button1_Click(object sender, EventArgs e)
{
Debug.WriteLine(Form2.webBrowser1.Url);
}


}
class User32
Expand All @@ -266,6 +272,10 @@ class User32
/// <returns></returns>
[DllImport("user32")]
public static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags);
[DllImport("user32")]
public static extern IntPtr FindWindow(string a, string b);
[DllImport("user32")]
public static extern IntPtr PostMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp);

//下面是可用的常量,根据不同的动画效果声明自己需要的
public const int AW_HOR_POSITIVE = 0x0001;//自左向右显示窗口,该标志可以在滚动动画和滑动动画中使用。使用AW_CENTER标志时忽略该标志
Expand Down
Loading

0 comments on commit 66dc3de

Please sign in to comment.