Skip to content
This repository has been archived by the owner on Apr 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #100 from hukz18/dev
Browse files Browse the repository at this point in the history
修复腾讯密钥bug,优化逻辑
  • Loading branch information
Sweetnow authored Apr 17, 2020
2 parents 870e959 + 7abdaa3 commit 927abde
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 340 deletions.
3 changes: 1 addition & 2 deletions installer/.gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
## Yours



installer/Downloader/Properties/
## VsCode
.vscode/

Expand Down
38 changes: 20 additions & 18 deletions installer/Downloader/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ await Task.Run(async () =>
{
if (token.IsCancellationRequested)
{ cancelled = true; tokenSource = new CancellationTokenSource(); token = tokenSource.Token; return; }
this.textBox2.AppendText(updateFile + 1 + totalupdate + ": 开始更新" + Filename + Environment.NewLine);
this.textBox2.AppendText(updateFile + 1 + "/" + totalupdate + ": 开始更新" + Filename + Environment.NewLine);
File.Delete(System.IO.Path.Combine(this.textBox1.Text, "THUAI3.0", Filename));
await Task.Run(() => { Downloader.download(System.IO.Path.Combine(this.textBox1.Text, "THUAI3.0", Filename), Filename); });
this.textBox2.AppendText(Filename + "更新完毕!" + Environment.NewLine); updateFile++;
}
Expand Down Expand Up @@ -220,12 +221,11 @@ await Task.Run(async () =>
cancelled = false;
}
else this.textBox2.AppendText("当前平台已是最新版本!" + Environment.NewLine);
SelectedNewFile.Clear(); SelectedUpdateFile.Clear();
newFileName.Clear(); updateFileName.Clear();
}
else
{
SelectedNewFile.Clear();
SelectedUpdateFile.Clear();
}


}
}

Expand All @@ -239,8 +239,11 @@ private void button1_Click(object sender, EventArgs e)
{
FolderBrowserDialog folder = new FolderBrowserDialog();
folder.ShowDialog();
this.textBox1.Text = folder.SelectedPath;
Data.ChangeData(this.textBox1.Text);
if (folder.SelectedPath != "")
{
this.textBox1.Text = folder.SelectedPath;
Data.ChangeData(this.textBox1.Text);
}
}

private void button2_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -269,6 +272,8 @@ private async void button3_Click(object sender, EventArgs e)
{
string json, MD5;
int newFile = 0, updateFile = 0;
newFileName.Clear();
updateFileName.Clear();
Tencent_cos_download Downloader = new Tencent_cos_download();
await Task.Run(() => { Downloader.download(System.IO.Path.Combine(this.textBox1.Text, "THUAI3.0", "md5list.json")); });
using (StreamReader r = new StreamReader(System.IO.Path.Combine(this.textBox1.Text, "THUAI3.0", "md5list.json")))
Expand All @@ -278,20 +283,17 @@ private async void button3_Click(object sender, EventArgs e)

foreach (KeyValuePair<string, string> pair in jsonDict)
{
MD5 = GetFileMd5Hash(System.IO.Path.Combine(this.textBox1.Text, pair.Key));
MD5 = GetFileMd5Hash(System.IO.Path.Combine(this.textBox1.Text, "THUAI3.0", pair.Key));
if (MD5.Length == 0)
{
if (!newFileName.Exists(t => t == pair.Key))
newFileName.Add(pair.Key);
}
newFileName.Add(pair.Key);
else if (MD5 != pair.Value)
{
if (!updateFileName.Exists(t => t == pair.Key))
updateFileName.Add(pair.Key);
}
updateFileName.Add(pair.Key);
}
newFile = newFileName.Count();
updateFile = updateFileName.Count();
if(this.textBox2.Text.Length!=0)
this.textBox2.AppendText("----------------------" + Environment.NewLine);

if (newFile + updateFile == 0)
{
this.textBox2.AppendText("当前平台已是最新版本!" + Environment.NewLine);
Expand All @@ -305,7 +307,7 @@ private async void button3_Click(object sender, EventArgs e)
this.textBox2.AppendText(Environment.NewLine + $"发现{updateFile}个文件更新:" + Environment.NewLine);
foreach (string filename in updateFileName)
this.textBox2.AppendText(filename + Environment.NewLine);
this.textBox2.AppendText(Environment.NewLine + "请点击下载按钮选择文件" + Environment.NewLine);
this.textBox2.AppendText(Environment.NewLine + "请点击下载按钮选择文件" + Environment.NewLine + Environment.NewLine);
}
Checked = true;
}
Expand Down
36 changes: 0 additions & 36 deletions installer/Downloader/Properties/AssemblyInfo.cs

This file was deleted.

111 changes: 0 additions & 111 deletions installer/Downloader/Properties/Resources.Designer.cs

This file was deleted.

136 changes: 0 additions & 136 deletions installer/Downloader/Properties/Resources.resx

This file was deleted.

Loading

0 comments on commit 927abde

Please sign in to comment.