Skip to content

Commit

Permalink
Fix several bugs🐛
Browse files Browse the repository at this point in the history
  • Loading branch information
hexadecimal233 committed Feb 7, 2021
1 parent 514d5b2 commit a129f46
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 52 deletions.
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ You should download packages of your system and install them all.

Some codes are from the Internet.

Example:![image](doc/example.gif)
Example:![image](doc/example.webp)

### Features
* Download Microsoft Store Apps
Expand Down
26 changes: 1 addition & 25 deletions code/Form1.Designer.cs

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

34 changes: 19 additions & 15 deletions code/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ private void DownloadButton_Click(object sender, EventArgs e)
downloadButton.Enabled = false;//禁止重复点击
Form2.complete = false;
progressBar1.Value = 0;
if (typeBox.SelectedIndex == -1 || routeBox.SelectedIndex == -1 || attributeText.Text == "")
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;
}//参数完整

Expand Down Expand Up @@ -110,7 +112,9 @@ private void DownloadButton_Click(object sender, EventArgs e)
MessageBox.Show(Language.lang_interr, Language.lang_interr, MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}//意外

if (Form2.returnid == 2) {
Form2.ShowDialog();
}//空响应
if (Form2.returnid == 1)//浏览
{
try
Expand All @@ -120,7 +124,7 @@ private void DownloadButton_Click(object sender, EventArgs e)
{
Language.InternalErrMsgBox(ex);
}
}
}//OK



Expand Down Expand Up @@ -207,8 +211,6 @@ private void RefreshForm()//初始化窗口
{
langText.Visible = false;
langPackText.Visible = false;
debugWebsite.Visible = false;
debugWebBrowser.Visible = false;
}//调试内容
typeBox.SelectedIndex = 0;
routeBox.SelectedIndex = 2;
Expand All @@ -221,29 +223,31 @@ private void RefreshForm()//初始化窗口

}


private Rectangle rect;
private bool firstPaint = true;
private void Form1_Paint(object sender, PaintEventArgs e)
{

//防止画窗口出错
if(firstPaint == true)
{
firstPaint = false;
rect = this.ClientRectangle;
}


Graphics g = e.Graphics; //实例化Graphics 对象g
Color FColor = Color.FromArgb(0xE8, 0xF1, 0xE7); //颜色1
Color TColor = Color.FromArgb(0xCA, 0xC7, 0xC7); //颜色2
Brush b = new LinearGradientBrush(this.ClientRectangle, FColor, TColor, LinearGradientMode.BackwardDiagonal); //实例化刷子,第一个参数指示上色区域,第二个和第三个参数分别渐变颜色的开始和结束,第四个参数表示颜色的方向。
Brush b = new LinearGradientBrush(rect, FColor, TColor, LinearGradientMode.BackwardDiagonal); //实例化刷子,第一个参数指示上色区域,第二个和第三个参数分别渐变颜色的开始和结束,第四个参数表示颜色的方向。
g.FillRectangle(b, this.ClientRectangle); //进行上色




}

private void debugWebBrowser_Click(object sender, EventArgs e)
{
new Form2().Show();
//Form2.webBrowser1.Navigate(debugWebsite.Text);

}



private void button1_Click(object sender, EventArgs e)
{
Expand Down
1 change: 0 additions & 1 deletion code/Form2.Designer.cs

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

33 changes: 25 additions & 8 deletions code/Form2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ public void Browse()
string result3 = Mdui(result2);
Debug.WriteLine(result3);
string result4;
if(Language.langUsing == "global")//language
if(Language.langUsing == "global")
{
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;
}
} //language


File.WriteAllText(WriteToTemp.tmpPath + @"\" + Language.lang_tablehtm,result4);//写出合并后的文本
Expand All @@ -100,28 +100,45 @@ private string RemoveUselessContent(string old)//格式化
}
private string Mdui(string old)//加入Mdui格式
{
string new1;
string new1,new2;
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;
.Replace("style=\"background-color:rgba(188, 235, 240, 0.8)\"", "class=\"mdui-color-blue-100\"")
.Replace("1970-01-01 00:00:00 GMT","Unlimited");
if (Language.langUsing != "global")
{
new2 = new1.Replace("File:", "文件:")
.Replace("Expire:","过期时间:").
Replace("SHA-1:","SHA-1校验值:")
.Replace("Size:","文件大小:");
} else { new2 = new1; }

return new2;
}
private void Form2_Load(object sender, EventArgs e)
{
//打开网页
var urlString = new Uri(WriteToTemp.tmpPath + @"\" + Language.lang_tablehtm);
Debug.WriteLine(urlString);
if (System.Diagnostics.Debugger.IsAttached == true)
{
webBrowser1.AllowWebBrowserDrop = true;
}
if (returnid != 2)
{
webBrowser1.Navigate(urlString);
}
else
{
webBrowser1.Navigate(WriteToTemp.tmpPath + "\\" + Language.lang_errhtm);
} //打开网页




webBrowser1.Navigate(urlString);

webBrowser1.DocumentTitleChanged += DocTitleClose;
}
private void DocTitleClose(object sender, EventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion doc/cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

部分代码来自互联网。

例图:![image](example.gif)
例图:![image](cn.webp)

### Features
* 下载微软商店的原因
Expand Down
Binary file added doc/cn.webp
Binary file not shown.
Empty file removed doc/example.gif
Empty file.
Binary file added doc/example.webp
Binary file not shown.
Binary file modified resource/res.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion resource/table/table-1-cn.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<body>
<div class="mdui-panel" mdui-panel>
<div class="mdui-toolbar mdui-color-indigo">
<span class="mdui-typo-title">Download link generated!</span>
<span class="mdui-typo-title">链接已生成!</span>
<div class="mdui-toolbar-spacer"></div>

<a href="https://store.rg-adguard.net/" target="_blank" class="mdui-btn mdui-btn-icon"mdui-tooltip="{content: 'API提供:store.rp-adguard.net'}"><i class="mdui-icon material-icons">search</i></a>
Expand Down

0 comments on commit a129f46

Please sign in to comment.