Skip to content

Commit

Permalink
fixed minor errors
Browse files Browse the repository at this point in the history
  • Loading branch information
LIPtoH committed Jan 20, 2020
1 parent 20499ab commit 4365c72
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 19 deletions.
14 changes: 7 additions & 7 deletions TS SE Tool/Forms/FormCheckUpdates.Designer.cs

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

18 changes: 10 additions & 8 deletions TS SE Tool/Forms/FormCheckUpdates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ public partial class FormCheckUpdates : Form
public FormCheckUpdates()
{
InitializeComponent();
this.Size = new Size(300, 140);
this.Size = new Size(300, 130);
}

private void FormCheckUpdates_Load(object sender, EventArgs e)
{
CheckLatestVersion();
buttonDownload.Text = "Download && Update";
}

//Buttons
private void buttonOk_Click(object sender, EventArgs e)
{
this.Close();
Expand Down Expand Up @@ -71,7 +72,7 @@ private void buttonDownload_Click(object sender, EventArgs e)
if (properFileDownloaded)
{
buttonDownload.Click -= new EventHandler(this.buttonDownload_Click);
buttonDownload.Text = "Update";
//buttonDownload.Text = "Update";
buttonDownload.Click += new EventHandler(this.buttonUpdate_Click);
buttonDownload.Enabled = true;
if (true)
Expand All @@ -86,8 +87,9 @@ private void buttonDownload_Click(object sender, EventArgs e)
private void buttonUpdate_Click(object sender, EventArgs e)
{
//Close Start updater and TSSET
buttonDownload.Enabled = false;
buttonDownload.Visible = false;
labelStatus.Text = "Starting Updater";
buttonOK.Text = "OK";
//copy updater
if (File.Exists(Directory.GetCurrentDirectory() + @"\updater\updater.exe"))
{
Expand All @@ -97,26 +99,26 @@ private void buttonUpdate_Click(object sender, EventArgs e)
{
MessageBox.Show("Unable to find Updater.exe. Please update manually. New version located in Updater folder.", "File not exist");
labelStatus.Text = "Updater.exe doesn't exist";
buttonOK.Text = "OK";
return;
}

if (File.Exists(Directory.GetCurrentDirectory() + @"\updater.exe"))
{
this.Size = new Size(300, 130);
Process.Start(Directory.GetCurrentDirectory() + @"\updater.exe", "true " + NewVersion[1] + " " + Process.GetCurrentProcess().Id.ToString());
labelStatus.Text = "You can now finish your work.\r\nUpdate will start on exit.";

Application.Exit();
buttonOK.Text = "Close";
}
else
{
MessageBox.Show("Unable to find Updater.exe. Please update manually. New version located in Updater folder.", "File not exist");
labelStatus.Text = "Updater.exe doesn't exist";
buttonOK.Text = "OK";
}

buttonOK.Enabled = true;
}

//Events
private async void CheckLatestVersion()
{
labelStatus.Text = "Checking for updates";
Expand Down
1 change: 1 addition & 0 deletions TS SET Updater/FormMain.Designer.cs

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

7 changes: 3 additions & 4 deletions TS SET Updater/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ private void FormMain_Shown(object sender, EventArgs e)
Rectangle wpR = wp.GetExtWinRectangle(ProcessID);
this.Location = new Point(wpR.X + (wpR.Width - this.Width) / 2, wpR.Y + (wpR.Height - this.Height) / 2);

MessageBox.Show(Location.ToString());

Updater();
}
else
Expand All @@ -57,10 +55,11 @@ private void FormMain_Shown(object sender, EventArgs e)
private async void Updater()
{
Process tsset = Process.GetProcessById(ProcessID);

string SourceFileName = tsset.MainModule.FileName;

this.Text = "Updater Waiting for " + Path.GetFileName(SourceFileName) + " exit";
tsset.WaitForExit();
this.Text = "Updater";
this.WindowState = FormWindowState.Normal;

string updFilePath = @".\updater\ts.set.newversion.zip";

Expand Down

0 comments on commit 4365c72

Please sign in to comment.