diff --git a/CreamInstaller/CreamInstaller.csproj b/CreamInstaller/CreamInstaller.csproj
index 9dd0282..937156e 100644
--- a/CreamInstaller/CreamInstaller.csproj
+++ b/CreamInstaller/CreamInstaller.csproj
@@ -6,7 +6,7 @@
true
ini.ico
true
- 1.0.2
+ 1.0.3
ini.ico
Automatically downloads and installs CreamAPI files for programs/games.
diff --git a/CreamInstaller/InstallForm.Designer.cs b/CreamInstaller/InstallForm.Designer.cs
index e440267..b62e61e 100644
--- a/CreamInstaller/InstallForm.Designer.cs
+++ b/CreamInstaller/InstallForm.Designer.cs
@@ -32,10 +32,10 @@ namespace CreamInstaller
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(InstallForm));
this.userProgressBar = new System.Windows.Forms.ProgressBar();
this.userInfoLabel = new System.Windows.Forms.Label();
- this.logTextBox = new System.Windows.Forms.TextBox();
this.acceptButton = new System.Windows.Forms.Button();
this.retryButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
+ this.logTextBox = new System.Windows.Forms.RichTextBox();
this.SuspendLayout();
//
// userProgressBar
@@ -57,22 +57,6 @@ namespace CreamInstaller
this.userInfoLabel.TabIndex = 2;
this.userInfoLabel.Text = "Loading . . . ";
//
- // logTextBox
- //
- this.logTextBox.AcceptsReturn = true;
- this.logTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.logTextBox.Location = new System.Drawing.Point(12, 56);
- this.logTextBox.Multiline = true;
- this.logTextBox.Name = "logTextBox";
- this.logTextBox.ReadOnly = true;
- this.logTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
- this.logTextBox.Size = new System.Drawing.Size(460, 164);
- this.logTextBox.TabIndex = 3;
- this.logTextBox.TabStop = false;
- this.logTextBox.WordWrap = false;
- //
// acceptButton
//
this.acceptButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
@@ -108,14 +92,30 @@ namespace CreamInstaller
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.OnCancel);
//
+ // logTextBox
+ //
+ this.logTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.logTextBox.HideSelection = false;
+ this.logTextBox.Location = new System.Drawing.Point(12, 56);
+ this.logTextBox.Name = "logTextBox";
+ this.logTextBox.ReadOnly = true;
+ this.logTextBox.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.ForcedBoth;
+ this.logTextBox.Size = new System.Drawing.Size(460, 164);
+ this.logTextBox.TabIndex = 4;
+ this.logTextBox.TabStop = false;
+ this.logTextBox.Text = "";
+ this.logTextBox.WordWrap = false;
+ //
// InstallForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(484, 261);
+ this.Controls.Add(this.logTextBox);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.retryButton);
- this.Controls.Add(this.logTextBox);
this.Controls.Add(this.acceptButton);
this.Controls.Add(this.userProgressBar);
this.Controls.Add(this.userInfoLabel);
@@ -131,17 +131,16 @@ namespace CreamInstaller
this.TopMost = true;
this.Load += new System.EventHandler(this.OnLoad);
this.ResumeLayout(false);
- this.PerformLayout();
}
#endregion
private System.Windows.Forms.ProgressBar userProgressBar;
private System.Windows.Forms.Label userInfoLabel;
- private System.Windows.Forms.TextBox logTextBox;
private System.Windows.Forms.Button acceptButton;
private System.Windows.Forms.Button retryButton;
private System.Windows.Forms.Button cancelButton;
+ private System.Windows.Forms.RichTextBox logTextBox;
}
}
diff --git a/CreamInstaller/InstallForm.cs b/CreamInstaller/InstallForm.cs
index 37848de..a1d5f3b 100644
--- a/CreamInstaller/InstallForm.cs
+++ b/CreamInstaller/InstallForm.cs
@@ -6,6 +6,7 @@ using System.Threading;
using System.IO.Compression;
using System.Collections.Generic;
using System.Linq;
+using System.Drawing;
namespace CreamInstaller
{
@@ -17,6 +18,7 @@ namespace CreamInstaller
InitializeComponent();
Program.InstallForm = this;
Text = Program.ApplicationName;
+ logTextBox.BackColor = LogColor.Background;
}
public void UpdateProgress(int progress)
@@ -24,16 +26,14 @@ namespace CreamInstaller
Program.UpdateProgressInstantly(userProgressBar, progress);
}
- public void UpdateUser(string text, bool log = true)
+ public void UpdateUser(string text, Color color, bool log = true)
{
userInfoLabel.Text = text;
if (log && !logTextBox.IsDisposed)
{
if (logTextBox.Text.Length > 0)
- {
- logTextBox.AppendText(Environment.NewLine);
- }
- logTextBox.AppendText(userInfoLabel.Text);
+ logTextBox.AppendText(Environment.NewLine, color);
+ logTextBox.AppendText(userInfoLabel.Text, color);
}
}
@@ -47,7 +47,7 @@ namespace CreamInstaller
Program.Cleanup(cancel: false, logout: false);
UpdateProgress(0);
- UpdateUser("Downloading CreamAPI files for " + selection.ProgramName + " . . . ");
+ UpdateUser("Downloading CreamAPI files for " + selection.ProgramName + " . . . ", LogColor.Operation);
Program.OutputFile = selection.ProgramDirectory + "\\" + selection.DownloadNode.Name;
if (File.Exists(Program.OutputFile))
{
@@ -64,7 +64,7 @@ namespace CreamInstaller
{
if (!Program.Canceled)
{
- UpdateUser($"Downloading CreamAPI files for {selection.ProgramName} . . . {(int)progress}%", log: false);
+ UpdateUser($"Downloading CreamAPI files for {selection.ProgramName} . . . {(int)progress}%", LogColor.Operation, log: false);
UpdateProgress((int)progress);
}
});
@@ -74,7 +74,7 @@ namespace CreamInstaller
UpdateProgress(100);
UpdateProgress(0);
- UpdateUser("Searching for CreamAPI files in downloaded archive . . . ");
+ UpdateUser("Searching for CreamAPI files in downloaded archive . . . ", LogColor.Operation);
string resourcePath = null;
List resources = new List();
Program.OutputArchive = ZipFile.OpenRead(Program.OutputFile);
@@ -85,7 +85,7 @@ namespace CreamInstaller
if (entry.Name == "steam_api64.dll")
{
resourcePath = Path.GetDirectoryName(entry.FullName);
- UpdateUser("Got CreamAPI file path: " + resourcePath);
+ UpdateUser("Got CreamAPI file path: " + resourcePath, LogColor.Resource);
}
UpdateProgress((currentEntryCount / (Program.OutputArchive.Entries.Count * 2)) * 100);
}
@@ -95,7 +95,7 @@ namespace CreamInstaller
if (!string.IsNullOrEmpty(entry.Name) && Path.GetDirectoryName(entry.FullName) == resourcePath)
{
resources.Add(entry);
- UpdateUser("Found CreamAPI file: " + entry.Name);
+ UpdateUser("Found CreamAPI file: " + entry.Name, LogColor.Resource);
}
UpdateProgress((currentEntryCount / (Program.OutputArchive.Entries.Count * 2)) * 100);
}
@@ -106,7 +106,7 @@ namespace CreamInstaller
UpdateProgress(100);
UpdateProgress(0);
- UpdateUser("Installing CreamAPI files for " + selection.ProgramName + " . . . ");
+ UpdateUser("Installing CreamAPI files for " + selection.ProgramName + " . . . ", LogColor.Operation);
int currentFileCount = 0;
foreach (string directory in selection.SteamApiDllDirectories)
{
@@ -114,7 +114,7 @@ namespace CreamInstaller
{
currentFileCount++;
string file = directory + "\\" + entry.Name;
- UpdateUser(file);
+ UpdateUser(file, LogColor.Resource);
if (File.Exists(file))
{
try
@@ -132,7 +132,7 @@ namespace CreamInstaller
}
UpdateProgress(100);
- UpdateUser("CreamAPI successfully downloaded and installed for " + selection.ProgramName);
+ UpdateUser("CreamAPI successfully downloaded and installed for " + selection.ProgramName, LogColor.Success);
Program.ProgramSelections.Remove(selection);
}
}
@@ -149,12 +149,12 @@ namespace CreamInstaller
{
await Install();
Program.Cleanup();
- UpdateUser("CreamAPI successfully downloaded and installed for " + ProgramCount + " program(s)");
+ UpdateUser("CreamAPI successfully downloaded and installed for " + ProgramCount + " program(s)", LogColor.Success);
}
catch (Exception exception)
{
Program.Cleanup(logout: false);
- UpdateUser("Operation failed: " + exception.Message);
+ UpdateUser("Operation failed: " + exception.Message, LogColor.Error);
retryButton.Enabled = true;
}
acceptButton.Enabled = true;
diff --git a/CreamInstaller/LogColor.cs b/CreamInstaller/LogColor.cs
new file mode 100644
index 0000000..7fe9bec
--- /dev/null
+++ b/CreamInstaller/LogColor.cs
@@ -0,0 +1,25 @@
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace CreamInstaller
+{
+ public static class LogColor
+ {
+ public static Color Background => Color.DarkSlateGray;
+ public static Color Operation => Color.LightGray;
+ public static Color Resource => Color.LightBlue;
+ public static Color Success => Color.LightGreen;
+ public static Color Cleanup => Color.YellowGreen;
+ public static Color Warning => Color.Yellow;
+ public static Color Error => Color.DarkOrange;
+
+ public static void AppendText(this RichTextBox logTextBox, string text, Color color)
+ {
+ logTextBox.SelectionStart = logTextBox.TextLength;
+ logTextBox.SelectionLength = 0;
+ logTextBox.SelectionColor = color;
+ logTextBox.AppendText(text);
+ logTextBox.SelectionColor = logTextBox.ForeColor;
+ }
+ }
+}
diff --git a/CreamInstaller/Program.cs b/CreamInstaller/Program.cs
index 46695c9..026a52d 100644
--- a/CreamInstaller/Program.cs
+++ b/CreamInstaller/Program.cs
@@ -75,7 +75,7 @@ namespace CreamInstaller
if (OutputArchive != null || CancellationTokenSource != null || OutputTask != null || OutputFile != null)
{
InstallForm?.UpdateProgress(0);
- InstallForm?.UpdateUser("Cleaning up . . . ");
+ InstallForm?.UpdateUser("Cleaning up . . . ", LogColor.Cleanup);
}
if (OutputArchive != null)
{
@@ -113,15 +113,16 @@ namespace CreamInstaller
}
catch (UnauthorizedAccessException)
{
- InstallForm?.UpdateUser($"WARNING: Couldn't clean up downloaded archive ({OutputFile})");
+ InstallForm?.UpdateUser($"WARNING: Couldn't clean up downloaded archive ({OutputFile})", LogColor.Warning);
}
+ InstallForm?.UpdateUser($"WARNING: Couldn't clean up downloaded archive ({OutputFile})", LogColor.Warning);
OutputFile = null;
}
InstallForm?.UpdateProgress(100);
if (logout && MegaApiClient != null && MegaApiClient.IsLoggedIn)
{
InstallForm?.UpdateProgress(0);
- InstallForm?.UpdateUser("Logging out of MEGA . . . ");
+ InstallForm?.UpdateUser("Logging out of MEGA . . . ", LogColor.Cleanup);
MegaApiClient.Logout();
InstallForm?.UpdateProgress(100);
}