Update 1.0.2
Multiple aesthetic changes Added extra warnings Fixed tabbing Fixed cleanup when canceling download/installation Removed automatic focusing on buttons Fixed cancel button closing entire program during download/installation Removed unnecessary download progress clutter from the log
This commit is contained in:
parent
a666f34634
commit
149c1ea696
6 changed files with 55 additions and 48 deletions
|
@ -6,7 +6,7 @@
|
|||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ApplicationIcon>ini.ico</ApplicationIcon>
|
||||
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
|
||||
<Version>1.0.1</Version>
|
||||
<Version>1.0.2</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
|
|
10
CreamInstaller/InstallForm.Designer.cs
generated
10
CreamInstaller/InstallForm.Designer.cs
generated
|
@ -70,7 +70,7 @@ namespace CreamInstaller
|
|||
this.logTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||
this.logTextBox.Size = new System.Drawing.Size(460, 164);
|
||||
this.logTextBox.TabIndex = 3;
|
||||
this.logTextBox.Text = "Loading . . . ";
|
||||
this.logTextBox.TabStop = false;
|
||||
this.logTextBox.WordWrap = false;
|
||||
//
|
||||
// acceptButton
|
||||
|
@ -80,7 +80,7 @@ namespace CreamInstaller
|
|||
this.acceptButton.Location = new System.Drawing.Point(397, 226);
|
||||
this.acceptButton.Name = "acceptButton";
|
||||
this.acceptButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.acceptButton.TabIndex = 0;
|
||||
this.acceptButton.TabIndex = 3;
|
||||
this.acceptButton.Text = "OK";
|
||||
this.acceptButton.UseVisualStyleBackColor = true;
|
||||
this.acceptButton.Click += new System.EventHandler(this.OnAccept);
|
||||
|
@ -92,7 +92,7 @@ namespace CreamInstaller
|
|||
this.retryButton.Location = new System.Drawing.Point(316, 226);
|
||||
this.retryButton.Name = "retryButton";
|
||||
this.retryButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.retryButton.TabIndex = 4;
|
||||
this.retryButton.TabIndex = 2;
|
||||
this.retryButton.Text = "Retry";
|
||||
this.retryButton.UseVisualStyleBackColor = true;
|
||||
this.retryButton.Click += new System.EventHandler(this.OnRetry);
|
||||
|
@ -103,17 +103,15 @@ namespace CreamInstaller
|
|||
this.cancelButton.Location = new System.Drawing.Point(12, 226);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.cancelButton.TabIndex = 5;
|
||||
this.cancelButton.TabIndex = 1;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.OnCancel);
|
||||
//
|
||||
// InstallForm
|
||||
//
|
||||
this.AcceptButton = this.acceptButton;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.cancelButton;
|
||||
this.ClientSize = new System.Drawing.Size(484, 261);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.retryButton);
|
||||
|
|
|
@ -23,24 +23,27 @@ namespace CreamInstaller
|
|||
userProgressBar.Value = progress;
|
||||
}
|
||||
|
||||
public void UpdateUser(string text)
|
||||
public void UpdateUser(string text, bool log = true)
|
||||
{
|
||||
userInfoLabel.Text = text;
|
||||
if (logTextBox.IsDisposed == false)
|
||||
if (log && !logTextBox.IsDisposed)
|
||||
{
|
||||
if (logTextBox.Text.Length > 0)
|
||||
{
|
||||
logTextBox.AppendText(Environment.NewLine);
|
||||
}
|
||||
logTextBox.AppendText(userInfoLabel.Text);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task Install()
|
||||
{
|
||||
foreach (ProgramSelection selection in Program.ProgramSelections)
|
||||
foreach (ProgramSelection selection in Program.ProgramSelections.ToList())
|
||||
{
|
||||
if (Program.Canceled)
|
||||
return;
|
||||
break;
|
||||
|
||||
Program.Cleanup(false, false);
|
||||
Program.Cleanup(cancel: false, logout: false);
|
||||
|
||||
UpdateProgress(0);
|
||||
UpdateUser("Downloading CreamAPI files for " + selection.ProgramName + " . . . ");
|
||||
|
@ -53,14 +56,14 @@ namespace CreamInstaller
|
|||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
throw new Exception("Unable to delete old CreamAPI archive file for " + selection.ProgramName + "!");
|
||||
throw new Exception("Unable to delete old archive file for " + selection.ProgramName);
|
||||
}
|
||||
}
|
||||
Progress<double> progress = new Progress<double>(delegate (double progress)
|
||||
{
|
||||
if (!Program.Canceled)
|
||||
{
|
||||
UpdateUser($"Downloading CreamAPI files from MEGA . . . {(int)progress}%");
|
||||
UpdateUser($"Downloading CreamAPI files for {selection.ProgramName} . . . {(int)progress}%", log: false);
|
||||
UpdateProgress((int)progress);
|
||||
}
|
||||
});
|
||||
|
@ -81,7 +84,7 @@ namespace CreamInstaller
|
|||
if (entry.Name == "steam_api64.dll")
|
||||
{
|
||||
resourcePath = Path.GetDirectoryName(entry.FullName);
|
||||
UpdateUser("CreamAPI file path: " + resourcePath);
|
||||
UpdateUser("Got CreamAPI file path: " + resourcePath);
|
||||
}
|
||||
UpdateProgress((currentEntryCount / (Program.OutputArchive.Entries.Count * 2)) * 100);
|
||||
}
|
||||
|
@ -97,12 +100,12 @@ namespace CreamInstaller
|
|||
}
|
||||
if (resources.Count < 1)
|
||||
{
|
||||
throw new Exception("Unable to find CreamAPI files in downloaded archive for " + selection.ProgramName + "!");
|
||||
throw new Exception("Unable to find CreamAPI files in downloaded archive for " + selection.ProgramName);
|
||||
}
|
||||
UpdateProgress(100);
|
||||
|
||||
UpdateProgress(0);
|
||||
UpdateUser("Extracting CreamAPI files for " + selection.ProgramName + " . . . ");
|
||||
UpdateUser("Installing CreamAPI files for " + selection.ProgramName + " . . . ");
|
||||
int currentFileCount = 0;
|
||||
foreach (string directory in selection.SteamApiDllDirectories)
|
||||
{
|
||||
|
@ -119,7 +122,7 @@ namespace CreamInstaller
|
|||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
throw new Exception(selection.ProgramName + " is currently running!");
|
||||
throw new Exception("Unable to delete Steam API files for " + selection.ProgramName);
|
||||
}
|
||||
}
|
||||
entry.ExtractToFile(file);
|
||||
|
@ -127,9 +130,14 @@ namespace CreamInstaller
|
|||
}
|
||||
}
|
||||
UpdateProgress(100);
|
||||
|
||||
UpdateUser("CreamAPI successfully downloaded and installed for " + selection.ProgramName);
|
||||
Program.ProgramSelections.Remove(selection);
|
||||
}
|
||||
}
|
||||
|
||||
private int ProgramCount = Program.ProgramSelections.Count;
|
||||
|
||||
private async void Start()
|
||||
{
|
||||
Program.Canceled = false;
|
||||
|
@ -137,23 +145,19 @@ namespace CreamInstaller
|
|||
retryButton.Enabled = false;
|
||||
cancelButton.Enabled = true;
|
||||
userInfoLabel.Text = "Loading . . . ";
|
||||
logTextBox.Text = "Loading . . . ";
|
||||
string output;
|
||||
logTextBox.Text = string.Empty;
|
||||
try
|
||||
{
|
||||
await Install();
|
||||
if (Program.ProgramSelections.Count > 1)
|
||||
output = "CreamAPI successfully installed for " + Program.ProgramSelections.Count + " programs!";
|
||||
else
|
||||
output = "CreamAPI successfully installed for " + Program.ProgramSelections.First().ProgramName + "!";
|
||||
Program.Cleanup();
|
||||
UpdateUser("CreamAPI successfully downloaded and installed for " + ProgramCount + " program(s)");
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
output = "Installation failed: " + exception.Message;
|
||||
Program.Cleanup(logout: false);
|
||||
UpdateUser("Operation failed: " + exception.Message);
|
||||
retryButton.Enabled = true;
|
||||
}
|
||||
Program.Cleanup();
|
||||
UpdateUser(output);
|
||||
acceptButton.Enabled = true;
|
||||
cancelButton.Enabled = false;
|
||||
}
|
||||
|
@ -170,13 +174,13 @@ namespace CreamInstaller
|
|||
|
||||
private void OnRetry(object sender, EventArgs e)
|
||||
{
|
||||
Program.Cleanup(true, false);
|
||||
Program.Cleanup(logout: false);
|
||||
Start();
|
||||
}
|
||||
|
||||
private void OnCancel(object sender, EventArgs e)
|
||||
{
|
||||
Program.Cleanup(true, false);
|
||||
Program.Cleanup(logout: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,7 +109,10 @@ namespace CreamInstaller
|
|||
{
|
||||
File.Delete(OutputFile);
|
||||
}
|
||||
catch (UnauthorizedAccessException) { }
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
UpdateUser($"WARNING: Couldn't clean up downloaded archive ({OutputFile})");
|
||||
}
|
||||
OutputFile = null;
|
||||
}
|
||||
UpdateProgress(100);
|
||||
|
|
11
CreamInstaller/SelectForm.Designer.cs
generated
11
CreamInstaller/SelectForm.Designer.cs
generated
|
@ -1,4 +1,5 @@
|
|||
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CreamInstaller
|
||||
|
@ -50,7 +51,7 @@ namespace CreamInstaller
|
|||
this.acceptButton.Location = new System.Drawing.Point(322, 254);
|
||||
this.acceptButton.Name = "acceptButton";
|
||||
this.acceptButton.Size = new System.Drawing.Size(150, 23);
|
||||
this.acceptButton.TabIndex = 0;
|
||||
this.acceptButton.TabIndex = 101;
|
||||
this.acceptButton.Text = "Download and Install";
|
||||
this.acceptButton.UseVisualStyleBackColor = true;
|
||||
this.acceptButton.Click += new System.EventHandler(this.OnAccept);
|
||||
|
@ -61,7 +62,7 @@ namespace CreamInstaller
|
|||
this.cancelButton.Location = new System.Drawing.Point(12, 254);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.cancelButton.TabIndex = 5;
|
||||
this.cancelButton.TabIndex = 100;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.OnCancel);
|
||||
|
@ -97,10 +98,10 @@ namespace CreamInstaller
|
|||
this.allCheckBox.Location = new System.Drawing.Point(414, 0);
|
||||
this.allCheckBox.Name = "allCheckBox";
|
||||
this.allCheckBox.Size = new System.Drawing.Size(40, 19);
|
||||
this.allCheckBox.TabIndex = 0;
|
||||
this.allCheckBox.TabIndex = 1;
|
||||
this.allCheckBox.Text = "All";
|
||||
this.allCheckBox.UseVisualStyleBackColor = true;
|
||||
this.allCheckBox.MouseClick += new System.Windows.Forms.MouseEventHandler(this.OnAllCheckBoxMouseClick);
|
||||
this.allCheckBox.CheckedChanged += new System.EventHandler(this.OnAllCheckBoxChanged);
|
||||
//
|
||||
// flowLayoutPanel1
|
||||
//
|
||||
|
@ -128,7 +129,7 @@ namespace CreamInstaller
|
|||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(460, 15);
|
||||
this.label2.TabIndex = 10;
|
||||
this.label2.Text = "Finding CreamAPI-applicable programs . . .";
|
||||
this.label2.Text = "Loading . . .";
|
||||
//
|
||||
// SelectForm
|
||||
//
|
||||
|
|
|
@ -158,6 +158,8 @@ namespace CreamInstaller
|
|||
checkBox.Text = node.Name;
|
||||
checkBox.Checked = true;
|
||||
checkBox.Enabled = false;
|
||||
checkBox.TabStop = true;
|
||||
checkBox.TabIndex = 1 + checkBoxes.Count;
|
||||
|
||||
checkBox.CheckedChanged += (sender, e) =>
|
||||
{
|
||||
|
@ -171,12 +173,10 @@ namespace CreamInstaller
|
|||
}
|
||||
|
||||
acceptButton.Enabled = Program.ProgramSelections.Count > 0;
|
||||
if (acceptButton.Enabled)
|
||||
acceptButton.Focus();
|
||||
else
|
||||
cancelButton.Focus();
|
||||
|
||||
allCheckBox.CheckedChanged -= OnAllCheckBoxChanged;
|
||||
allCheckBox.Checked = checkBoxes.TrueForAll(checkBox => checkBox.Checked);
|
||||
allCheckBox.CheckedChanged += OnAllCheckBoxChanged;
|
||||
};
|
||||
});
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ namespace CreamInstaller
|
|||
|
||||
private async void OnLoad(object sender, EventArgs e)
|
||||
{
|
||||
label2.Text = "Finding CreamAPI-applicable programs . . . 0%";
|
||||
label2.Text = "Finding CreamAPI-applicable programs on your computer . . . ";
|
||||
int maxProgress = 0;
|
||||
Progress<int> progress = new();
|
||||
progress.ProgressChanged += (sender, _progress) =>
|
||||
|
@ -199,7 +199,7 @@ namespace CreamInstaller
|
|||
else
|
||||
{
|
||||
int p = (int)((float)((float)_progress / (float)maxProgress) * 100);
|
||||
label2.Text = "Finding CreamAPI-applicable programs . . . " + p + "% (" + _progress + "/" + maxProgress + ")";
|
||||
label2.Text = "Finding CreamAPI-applicable programs on your computer . . . " + p + "% (" + _progress + "/" + maxProgress + ")";
|
||||
progressBar1.Value = p;
|
||||
}
|
||||
};
|
||||
|
@ -215,7 +215,6 @@ namespace CreamInstaller
|
|||
checkBox.Enabled = true;
|
||||
|
||||
acceptButton.Enabled = true;
|
||||
acceptButton.Focus();
|
||||
}
|
||||
|
||||
private void OnAccept(object sender, EventArgs e)
|
||||
|
@ -233,13 +232,15 @@ namespace CreamInstaller
|
|||
Close();
|
||||
}
|
||||
|
||||
private bool allCheckBoxChecked = true;
|
||||
private void OnAllCheckBoxMouseClick(object sender, EventArgs e)
|
||||
private void OnAllCheckBoxChanged(object sender, EventArgs e)
|
||||
{
|
||||
allCheckBoxChecked = !allCheckBoxChecked;
|
||||
allCheckBox.Checked = allCheckBoxChecked;
|
||||
bool shouldCheck = false;
|
||||
foreach (CheckBox checkBox in checkBoxes)
|
||||
checkBox.Checked = allCheckBoxChecked;
|
||||
if (!checkBox.Checked)
|
||||
shouldCheck = true;
|
||||
foreach (CheckBox checkBox in checkBoxes)
|
||||
checkBox.Checked = shouldCheck;
|
||||
allCheckBox.Checked = shouldCheck;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue