Skip to content

Commit

Permalink
Auto update
Browse files Browse the repository at this point in the history
  • Loading branch information
you committed Dec 11, 2020
1 parent 33fb9ca commit 95bbe9d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 3 additions & 1 deletion Update/Update.Designer.cs

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

11 changes: 8 additions & 3 deletions Update/Update.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public Update()

int lasterVersion = int.Parse(updater.GetVersion(baseUrl + "version"));
int currentVersion = int.Parse(File.ReadAllText(Directory.GetCurrentDirectory() + "/version"));

if (lasterVersion - currentVersion > 0)
{
if (DialogResult.Yes == MessageBox.Show("检查到新版本,是否更新?", "更新", MessageBoxButtons.YesNo))
Expand All @@ -39,8 +39,8 @@ public Update()
else updater.Download(baseUrl + "Build/devcpp_i.zip", DownloadProgressCallback, DownloadCompletedCallback);
}
}

Application.Exit();
System.Environment.Exit(0);
//Application.Exit();
}

private void Update_Load(object sender, EventArgs e) { }
Expand Down Expand Up @@ -77,5 +77,10 @@ private void DownloadCompletedCallback(object sender, AsyncCompletedEventArgs e)
Application.Exit();
}
}

private void progressBar_Click(object sender, EventArgs e)
{

}
}
}
2 changes: 1 addition & 1 deletion Update/UpdateLite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Update
{
public class UpdateLite
{
const string downloadPath = @"C:\Users\Blinking\AppData\Local\Temp\devcpp.zip";
private string downloadPath = System.Environment.GetEnvironmentVariable("TEMP") + @"\devcpp.zip";

public WebClient webClient = new WebClient();

Expand Down

0 comments on commit 95bbe9d

Please sign in to comment.