1.0.0.2 Improved DarkUI and update logic.

This commit is contained in:
STAM 2022-04-02 21:27:17 +05:00
parent 22ac8e9af3
commit 4b2e3ff5a2
Signed by: stam
GPG Key ID: E149C3760CFA3C7E
6 changed files with 268 additions and 84 deletions

View File

@ -1,3 +1,5 @@
# CHANGELOG # CHANGELOG
* `1.0.0.0.` - First release. * `1.0.0.0.` - First release.
* `1.0.0.1.` - Switched to DarkUI, implemented simple updates from github.
* `1.0.0.2.` - Improved DarkUI and update logic.

View File

@ -9,9 +9,9 @@
<StartupObject>SourceSDK.ENV.Editor.Program</StartupObject> <StartupObject>SourceSDK.ENV.Editor.Program</StartupObject>
<ApplicationIcon>crowbar.ico</ApplicationIcon> <ApplicationIcon>crowbar.ico</ApplicationIcon>
<SignAssembly>False</SignAssembly> <SignAssembly>False</SignAssembly>
<AssemblyVersion>1.0.0.1</AssemblyVersion> <AssemblyVersion>1.0.0.2</AssemblyVersion>
<FileVersion>1.0.0.1</FileVersion> <FileVersion>1.0.0.2</FileVersion>
<Version>1.0.0.1</Version> <Version>1.0.0.2</Version>
<Company>EpicMorg</Company> <Company>EpicMorg</Company>
<Copyright>EpicMorg</Copyright> <Copyright>EpicMorg</Copyright>
<PackageProjectUrl>https://github.com/EpicMorg/SourceSDK.ENV.Editor</PackageProjectUrl> <PackageProjectUrl>https://github.com/EpicMorg/SourceSDK.ENV.Editor</PackageProjectUrl>

View File

@ -34,7 +34,13 @@
this.darkButtonOK = new DarkUI.Controls.DarkButton(); this.darkButtonOK = new DarkUI.Controls.DarkButton();
this.darkLabelCopyright = new DarkUI.Controls.DarkLabel(); this.darkLabelCopyright = new DarkUI.Controls.DarkLabel();
this.darkButtonDonate = new DarkUI.Controls.DarkButton(); this.darkButtonDonate = new DarkUI.Controls.DarkButton();
this.groupBoxAddons = new DarkUI.Controls.DarkGroupBox();
this.darkTextBoxDUV = new DarkUI.Controls.DarkTextBox();
this.textBoxOKitV = new DarkUI.Controls.DarkTextBox();
this.darkTextBoxDU = new DarkUI.Controls.DarkTextBox();
this.textBoxOKit = new DarkUI.Controls.DarkTextBox();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.groupBoxAddons.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// pictureBox1 // pictureBox1
@ -60,10 +66,11 @@
// //
// darkButtonOK // darkButtonOK
// //
this.darkButtonOK.Location = new System.Drawing.Point(262, 64); this.darkButtonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.darkButtonOK.Location = new System.Drawing.Point(12, 114);
this.darkButtonOK.Name = "darkButtonOK"; this.darkButtonOK.Name = "darkButtonOK";
this.darkButtonOK.Padding = new System.Windows.Forms.Padding(5); this.darkButtonOK.Padding = new System.Windows.Forms.Padding(5);
this.darkButtonOK.Size = new System.Drawing.Size(75, 23); this.darkButtonOK.Size = new System.Drawing.Size(64, 23);
this.darkButtonOK.TabIndex = 3; this.darkButtonOK.TabIndex = 3;
this.darkButtonOK.Text = "OK"; this.darkButtonOK.Text = "OK";
this.darkButtonOK.Click += new System.EventHandler(this.darkButtonOK_Click); this.darkButtonOK.Click += new System.EventHandler(this.darkButtonOK_Click);
@ -71,30 +78,95 @@
// darkLabelCopyright // darkLabelCopyright
// //
this.darkLabelCopyright.AutoSize = true; this.darkLabelCopyright.AutoSize = true;
this.darkLabelCopyright.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); this.darkLabelCopyright.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.darkLabelCopyright.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); this.darkLabelCopyright.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.darkLabelCopyright.Location = new System.Drawing.Point(82, 37); this.darkLabelCopyright.Location = new System.Drawing.Point(82, 28);
this.darkLabelCopyright.Name = "darkLabelCopyright"; this.darkLabelCopyright.Name = "darkLabelCopyright";
this.darkLabelCopyright.Size = new System.Drawing.Size(194, 15); this.darkLabelCopyright.Size = new System.Drawing.Size(166, 15);
this.darkLabelCopyright.TabIndex = 2; this.darkLabelCopyright.TabIndex = 2;
this.darkLabelCopyright.Text = "Copyright (Company) (c) Year"; this.darkLabelCopyright.Text = "Copyright (Company) (c) Year";
// //
// darkButtonDonate // darkButtonDonate
// //
this.darkButtonDonate.Location = new System.Drawing.Point(82, 64); this.darkButtonDonate.Location = new System.Drawing.Point(12, 82);
this.darkButtonDonate.Name = "darkButtonDonate"; this.darkButtonDonate.Name = "darkButtonDonate";
this.darkButtonDonate.Padding = new System.Windows.Forms.Padding(5); this.darkButtonDonate.Padding = new System.Windows.Forms.Padding(5);
this.darkButtonDonate.Size = new System.Drawing.Size(75, 23); this.darkButtonDonate.Size = new System.Drawing.Size(64, 23);
this.darkButtonDonate.TabIndex = 3; this.darkButtonDonate.TabIndex = 3;
this.darkButtonDonate.Text = "Donate"; this.darkButtonDonate.Text = "Donate";
this.darkButtonDonate.Click += new System.EventHandler(this.darkButtonDonate_Click); this.darkButtonDonate.Click += new System.EventHandler(this.darkButtonDonate_Click);
// //
// groupBoxAddons
//
this.groupBoxAddons.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51)))));
this.groupBoxAddons.Controls.Add(this.darkTextBoxDUV);
this.groupBoxAddons.Controls.Add(this.textBoxOKitV);
this.groupBoxAddons.Controls.Add(this.darkTextBoxDU);
this.groupBoxAddons.Controls.Add(this.textBoxOKit);
this.groupBoxAddons.Location = new System.Drawing.Point(82, 50);
this.groupBoxAddons.Name = "groupBoxAddons";
this.groupBoxAddons.Size = new System.Drawing.Size(318, 87);
this.groupBoxAddons.TabIndex = 5;
this.groupBoxAddons.TabStop = false;
this.groupBoxAddons.Text = "Addons:";
//
// darkTextBoxDUV
//
this.darkTextBoxDUV.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(69)))), ((int)(((byte)(73)))), ((int)(((byte)(74)))));
this.darkTextBoxDUV.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.darkTextBoxDUV.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.darkTextBoxDUV.Location = new System.Drawing.Point(159, 22);
this.darkTextBoxDUV.Name = "darkTextBoxDUV";
this.darkTextBoxDUV.PlaceholderText = "0.0.0.0";
this.darkTextBoxDUV.ReadOnly = true;
this.darkTextBoxDUV.Size = new System.Drawing.Size(147, 23);
this.darkTextBoxDUV.TabIndex = 0;
//
// textBoxOKitV
//
this.textBoxOKitV.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(69)))), ((int)(((byte)(73)))), ((int)(((byte)(74)))));
this.textBoxOKitV.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBoxOKitV.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.textBoxOKitV.Location = new System.Drawing.Point(159, 51);
this.textBoxOKitV.Name = "textBoxOKitV";
this.textBoxOKitV.PlaceholderText = "0.0.0.0";
this.textBoxOKitV.ReadOnly = true;
this.textBoxOKitV.Size = new System.Drawing.Size(147, 23);
this.textBoxOKitV.TabIndex = 0;
//
// darkTextBoxDU
//
this.darkTextBoxDU.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(69)))), ((int)(((byte)(73)))), ((int)(((byte)(74)))));
this.darkTextBoxDU.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.darkTextBoxDU.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.darkTextBoxDU.Location = new System.Drawing.Point(6, 22);
this.darkTextBoxDU.Name = "darkTextBoxDU";
this.darkTextBoxDU.PlaceholderText = "custom.dll";
this.darkTextBoxDU.ReadOnly = true;
this.darkTextBoxDU.Size = new System.Drawing.Size(147, 23);
this.darkTextBoxDU.TabIndex = 0;
this.darkTextBoxDU.Text = "DarkUI.dll";
//
// textBoxOKit
//
this.textBoxOKit.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(69)))), ((int)(((byte)(73)))), ((int)(((byte)(74)))));
this.textBoxOKit.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBoxOKit.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.textBoxOKit.Location = new System.Drawing.Point(6, 51);
this.textBoxOKit.Name = "textBoxOKit";
this.textBoxOKit.PlaceholderText = "custom.dll";
this.textBoxOKit.ReadOnly = true;
this.textBoxOKit.Size = new System.Drawing.Size(147, 23);
this.textBoxOKit.TabIndex = 0;
this.textBoxOKit.Text = "Ocktokit.dll";
//
// FormAbout // FormAbout
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65))))); this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.ClientSize = new System.Drawing.Size(349, 99); this.ClientSize = new System.Drawing.Size(409, 149);
this.Controls.Add(this.groupBoxAddons);
this.Controls.Add(this.darkButtonDonate); this.Controls.Add(this.darkButtonDonate);
this.Controls.Add(this.darkButtonOK); this.Controls.Add(this.darkButtonOK);
this.Controls.Add(this.darkLabelCopyright); this.Controls.Add(this.darkLabelCopyright);
@ -110,6 +182,8 @@
this.Text = "About"; this.Text = "About";
this.Load += new System.EventHandler(this.FormAbout_Load); this.Load += new System.EventHandler(this.FormAbout_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.groupBoxAddons.ResumeLayout(false);
this.groupBoxAddons.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -122,5 +196,10 @@
private DarkUI.Controls.DarkButton darkButtonOK; private DarkUI.Controls.DarkButton darkButtonOK;
private DarkUI.Controls.DarkLabel darkLabelCopyright; private DarkUI.Controls.DarkLabel darkLabelCopyright;
private DarkUI.Controls.DarkButton darkButtonDonate; private DarkUI.Controls.DarkButton darkButtonDonate;
private DarkUI.Controls.DarkGroupBox groupBoxAddons;
private DarkUI.Controls.DarkTextBox darkTextBoxDUV;
private DarkUI.Controls.DarkTextBox textBoxOKitV;
private DarkUI.Controls.DarkTextBox darkTextBoxDU;
private DarkUI.Controls.DarkTextBox textBoxOKit;
} }
} }

View File

@ -1,55 +1,35 @@
using System.Diagnostics; using System.Diagnostics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using DarkUI.Forms;
using Octokit;
namespace SourceSDK.ENV.Editor.UI namespace SourceSDK.ENV.Editor.UI
{ {
public partial class FormAbout : Form public partial class FormAbout : Form
{ {
string verDarkUI = "Unknown";
string verOctokit = "Unknown";
public FormAbout() public FormAbout()
{ {
InitializeComponent(); InitializeComponent();
this.Text = String.Format("{0} {1} ({2})", "About ::", System.Windows.Forms.Application.ProductName, System.Windows.Forms.Application.ProductVersion); this.Text = String.Format("{0} {1} ({2})", "About ::", System.Windows.Forms.Application.ProductName, System.Windows.Forms.Application.ProductVersion);
darkLabelProductVersion.Text = String.Format("{0} ({1})", System.Windows.Forms.Application.ProductName, System.Windows.Forms.Application.ProductVersion); darkLabelProductVersion.Text = String.Format("{0} ({1})", System.Windows.Forms.Application.ProductName, System.Windows.Forms.Application.ProductVersion);
darkLabelCopyright.Text = String.Format(" Copyright {1} \u00a9 {0}", System.Windows.Forms.Application.CompanyName, DateTime.Now.Year); darkLabelCopyright.Text = String.Format(" Copyright {1} \u00a9 {0}", System.Windows.Forms.Application.CompanyName, DateTime.Now.Year);
try
{
verDarkUI = System.Reflection.AssemblyName.GetAssemblyName(Path.Combine(Application.StartupPath,"DarkUI.dll")).Version.ToString();
verOctokit = System.Reflection.AssemblyName.GetAssemblyName(Path.Combine(Application.StartupPath, "Octokit.dll")).Version.ToString();
}
catch
{
verDarkUI = "Unknown";
verOctokit = "Unknown";
}
darkTextBoxDUV.Text = verDarkUI;
textBoxOKitV.Text = verOctokit;
} }
private void FormAbout_Load(object sender, EventArgs e) private void FormAbout_Load(object sender, EventArgs e)
{ {
CheckGitHubNewerVersion();
}
private async System.Threading.Tasks.Task CheckGitHubNewerVersion()
{
//Get all releases from GitHub
//Source: https://octokitnet.readthedocs.io/en/latest/getting-started/
GitHubClient client = new GitHubClient(new ProductHeaderValue("SourceSDK.ENV.Editor"));
IReadOnlyList<Release> releases = await client.Repository.Release.GetAll("EpicMorg", "SourceSDK.ENV.Editor");
//Setup the versions
Version latestGitHubVersion = new Version(releases[0].TagName);
Version localVersion = new Version(System.Windows.Forms.Application.ProductVersion); //Replace this with your local version.
//Only tested with numeric values.
//Compare the Versions
//Source: https://stackoverflow.com/questions/7568147/compare-version-numbers-without-using-split-function
int versionComparison = localVersion.CompareTo(latestGitHubVersion);
if (versionComparison < 0)
{
DarkUI.Forms.DarkMessageBox.ShowInformation("The version on GitHub is more up to date than this local release.", "Information", DarkDialogButton.Ok);
//The version on GitHub is more up to date than this local release.
}
else if (versionComparison > 0)
{
DarkUI.Forms.DarkMessageBox.ShowInformation("This local version is greater than the release version on GitHub.", "Information", DarkDialogButton.Ok);
//This local version is greater than the release version on GitHub.
}
else
{
DarkUI.Forms.DarkMessageBox.ShowInformation("This local Version and the Version on GitHub are equal.", "Information", DarkDialogButton.Ok);
//This local Version and the Version on GitHub are equal.
}
} }
private void darkButtonDonate_Click(object sender, EventArgs e) private void darkButtonDonate_Click(object sender, EventArgs e)

View File

@ -70,6 +70,7 @@
this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog(); this.folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
this.darkStatusStrip = new DarkUI.Controls.DarkStatusStrip(); this.darkStatusStrip = new DarkUI.Controls.DarkStatusStrip();
this.toolStripStatusLabelUpdateStatus = new System.Windows.Forms.ToolStripStatusLabel();
this.menuStrip.SuspendLayout(); this.menuStrip.SuspendLayout();
this.groupBoxVMod.SuspendLayout(); this.groupBoxVMod.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxVMod)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxVMod)).BeginInit();
@ -81,6 +82,7 @@
((System.ComponentModel.ISupportInitialize)(this.pictureBoxVContent)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxVContent)).BeginInit();
this.groupBoxVTools.SuspendLayout(); this.groupBoxVTools.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxVTools)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxVTools)).BeginInit();
this.darkStatusStrip.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// menuStrip // menuStrip
@ -505,6 +507,10 @@
this.pictureBoxVTools.TabIndex = 0; this.pictureBoxVTools.TabIndex = 0;
this.pictureBoxVTools.TabStop = false; this.pictureBoxVTools.TabStop = false;
// //
// toolTip
//
this.toolTip.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Info;
//
// folderBrowserDialog // folderBrowserDialog
// //
this.folderBrowserDialog.UseDescriptionForTitle = true; this.folderBrowserDialog.UseDescriptionForTitle = true;
@ -514,20 +520,35 @@
this.darkStatusStrip.AutoSize = false; this.darkStatusStrip.AutoSize = false;
this.darkStatusStrip.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65))))); this.darkStatusStrip.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.darkStatusStrip.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); this.darkStatusStrip.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.darkStatusStrip.Location = new System.Drawing.Point(0, 496); this.darkStatusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripStatusLabelUpdateStatus});
this.darkStatusStrip.Location = new System.Drawing.Point(0, 502);
this.darkStatusStrip.Name = "darkStatusStrip"; this.darkStatusStrip.Name = "darkStatusStrip";
this.darkStatusStrip.Padding = new System.Windows.Forms.Padding(0, 5, 0, 3); this.darkStatusStrip.Padding = new System.Windows.Forms.Padding(0, 5, 0, 3);
this.darkStatusStrip.Size = new System.Drawing.Size(653, 24); this.darkStatusStrip.Size = new System.Drawing.Size(653, 30);
this.darkStatusStrip.SizingGrip = false; this.darkStatusStrip.SizingGrip = false;
this.darkStatusStrip.TabIndex = 2; this.darkStatusStrip.TabIndex = 2;
this.darkStatusStrip.Text = "darkStatusStrip1"; this.darkStatusStrip.Text = "darkStatusStrip";
//
// toolStripStatusLabelUpdateStatus
//
this.toolStripStatusLabelUpdateStatus.ActiveLinkColor = System.Drawing.Color.LightCoral;
this.toolStripStatusLabelUpdateStatus.DoubleClickEnabled = true;
this.toolStripStatusLabelUpdateStatus.Image = global::SourceSDK.ENV.Editor.Properties.Resources.done;
this.toolStripStatusLabelUpdateStatus.IsLink = true;
this.toolStripStatusLabelUpdateStatus.LinkColor = System.Drawing.Color.WhiteSmoke;
this.toolStripStatusLabelUpdateStatus.Name = "toolStripStatusLabelUpdateStatus";
this.toolStripStatusLabelUpdateStatus.Size = new System.Drawing.Size(114, 17);
this.toolStripStatusLabelUpdateStatus.Text = "Check for update";
this.toolStripStatusLabelUpdateStatus.ToolTipText = "Update check";
this.toolStripStatusLabelUpdateStatus.Click += new System.EventHandler(this.toolStripStatusLabelUpdateStatus_Click);
// //
// FormMain // FormMain
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65))))); this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.ClientSize = new System.Drawing.Size(653, 520); this.ClientSize = new System.Drawing.Size(653, 532);
this.Controls.Add(this.darkStatusStrip); this.Controls.Add(this.darkStatusStrip);
this.Controls.Add(this.groupBoxVTools); this.Controls.Add(this.groupBoxVTools);
this.Controls.Add(this.groupBoxVContent); this.Controls.Add(this.groupBoxVContent);
@ -535,6 +556,7 @@
this.Controls.Add(this.groupBoxVProject); this.Controls.Add(this.groupBoxVProject);
this.Controls.Add(this.groupBoxVMod); this.Controls.Add(this.groupBoxVMod);
this.Controls.Add(this.menuStrip); this.Controls.Add(this.menuStrip);
this.DoubleBuffered = true;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip; this.MainMenuStrip = this.menuStrip;
@ -561,6 +583,8 @@
this.groupBoxVTools.ResumeLayout(false); this.groupBoxVTools.ResumeLayout(false);
this.groupBoxVTools.PerformLayout(); this.groupBoxVTools.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxVTools)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxVTools)).EndInit();
this.darkStatusStrip.ResumeLayout(false);
this.darkStatusStrip.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -607,5 +631,6 @@
private FolderBrowserDialog folderBrowserDialog; private FolderBrowserDialog folderBrowserDialog;
private DarkUI.Controls.DarkMenuStrip menuStrip; private DarkUI.Controls.DarkMenuStrip menuStrip;
private DarkUI.Controls.DarkStatusStrip darkStatusStrip; private DarkUI.Controls.DarkStatusStrip darkStatusStrip;
private ToolStripStatusLabel toolStripStatusLabelUpdateStatus;
} }
} }

View File

@ -7,11 +7,19 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using Octokit;
using DarkUI.Forms;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace SourceSDK.ENV.Editor.UI namespace SourceSDK.ENV.Editor.UI
{ {
public partial class FormMain : Form public partial class FormMain : Form
{ {
GitHubClient client = new GitHubClient(new ProductHeaderValue("SourceSDK.ENV.Editor"));
Version localVersion = new Version(System.Windows.Forms.Application.ProductVersion); //Replace this with your local version. Only tested with numeric values.
public FormMain() public FormMain()
{ {
InitializeComponent(); InitializeComponent();
@ -21,16 +29,17 @@ namespace SourceSDK.ENV.Editor.UI
private void FormMain_Load(object sender, EventArgs e) private void FormMain_Load(object sender, EventArgs e)
{ {
checkAll(); checkAll();
try { SilentCheckGitHubNewerVersion(); } catch { }
folderBrowserDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); //set defaut directory folderBrowserDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); //set defaut directory
} }
private void refreshToolStripMenuItem_Click(object sender, EventArgs e) private void refreshToolStripMenuItem_Click(object sender, EventArgs e)
{ {
checkAll(); checkAll();
MessageBox.Show("Information updated!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); DarkUI.Forms.DarkMessageBox.ShowInformation("Information updated!", "Information", DarkDialogButton.Ok);
} }
private void exitToolStripMenuItem_Click(object sender, EventArgs e) private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{ {
Application.Exit(); System.Windows.Forms.Application.Exit();
} }
private void aboutToolStripMenuItem_Click(object sender, EventArgs e) private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{ {
@ -38,6 +47,90 @@ namespace SourceSDK.ENV.Editor.UI
frmAbout.ShowDialog(); frmAbout.ShowDialog();
} }
#region update check
private async System.Threading.Tasks.Task SilentCheckGitHubNewerVersion()
{
IReadOnlyList<Release> releases = await client.Repository.Release.GetAll("EpicMorg", "SourceSDK.ENV.Editor");
Version latestGitHubVersion = new Version(releases[0].TagName);
int versionComparison = localVersion.CompareTo(latestGitHubVersion);
if (versionComparison < 0)
{
toolStripStatusLabelUpdateStatus.Image = Properties.Resources.cancel;
toolStripStatusLabelUpdateStatus.Text = "New version avalible";
toolStripStatusLabelUpdateStatus.ToolTipText = "The version on GitHub is more up to date than this local release.";
}
else if (versionComparison > 0)
{
toolStripStatusLabelUpdateStatus.Image = Properties.Resources.wait;
toolStripStatusLabelUpdateStatus.Text = "This local version is greater";
toolStripStatusLabelUpdateStatus.ToolTipText ="This local version is greater than the release version on GitHub.";
}
else
{
toolStripStatusLabelUpdateStatus.Image = Properties.Resources.done;
toolStripStatusLabelUpdateStatus.Text = "This version is up to date";
toolStripStatusLabelUpdateStatus.ToolTipText = "This local Version and the Version on GitHub are equal.";
}
}
private async System.Threading.Tasks.Task CheckGitHubNewerVersion()
{
//Get all releases from GitHub
//Source: https://octokitnet.readthedocs.io/en/latest/getting-started/
IReadOnlyList<Release> releases = await client.Repository.Release.GetAll("EpicMorg", "SourceSDK.ENV.Editor");
//Setup the versions
Version latestGitHubVersion = new Version(releases[0].TagName);
//Compare the Versions
//Source: https://stackoverflow.com/questions/7568147/compare-version-numbers-without-using-split-function
int versionComparison = localVersion.CompareTo(latestGitHubVersion);
if (versionComparison < 0)
{
if (DarkUI.Forms.DarkMessageBox.ShowWarning("The version on GitHub is more up to date than this local release. Do you want to update it?", "Information", DarkDialogButton.YesNo) == DialogResult.Yes)
{
var url = "https://github.com/EpicMorg/SourceSDK.ENV.Editor/releases/latest";
try
{
Process.Start(url);
}
catch
{
// hack because of this: https://github.com/dotnet/corefx/issues/10361
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
url = url.Replace("&", "^&");
Process.Start(new ProcessStartInfo(url) { UseShellExecute = true });
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
Process.Start("xdg-open", url);
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
Process.Start("open", url);
}
else
{
throw;
}
}
}
}
else if (versionComparison > 0)
{
DarkUI.Forms.DarkMessageBox.ShowInformation("This local version is greater than the release version on GitHub.", "Information", DarkDialogButton.Ok);
//This local version is greater than the release version on GitHub.
}
else
{
DarkUI.Forms.DarkMessageBox.ShowInformation("This local Version and the Version on GitHub are equal.", "Information", DarkDialogButton.Ok);
//This local Version and the Version on GitHub are equal.
}
}
#endregion
#region checks #region checks
private void checkAll() private void checkAll()
{ {
@ -145,12 +238,12 @@ namespace SourceSDK.ENV.Editor.UI
checkVMod(); checkVMod();
} }
MessageBox.Show("VMod successfully cleared and Information updated!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); DarkUI.Forms.DarkMessageBox.ShowInformation("VMod successfully cleared and Information updated!", "Information", DarkDialogButton.Ok);
Cursor.Current = Cursors.Default; Cursor.Current = Cursors.Default;
} }
catch catch
{ {
MessageBox.Show("Something went wrong and VMod was not successfully deleted", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DarkUI.Forms.DarkMessageBox.ShowError("Something went wrong and VMod was not successfully deleted", "Error", DarkDialogButton.Ok);
Cursor.Current = Cursors.Default; Cursor.Current = Cursors.Default;
} }
} }
@ -171,12 +264,12 @@ namespace SourceSDK.ENV.Editor.UI
checkVProject(); checkVProject();
} }
MessageBox.Show("VProject successfully cleared and Information updated!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); DarkUI.Forms.DarkMessageBox.ShowInformation("VProject successfully cleared and Information updated!", "Information", DarkDialogButton.Ok);
Cursor.Current = Cursors.Default; Cursor.Current = Cursors.Default;
} }
catch catch
{ {
MessageBox.Show("Something went wrong and VProject was not successfully deleted", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DarkUI.Forms.DarkMessageBox.ShowError("Something went wrong and VProject was not successfully deleted", "Error", DarkDialogButton.Ok);
Cursor.Current = Cursors.Default; Cursor.Current = Cursors.Default;
} }
} }
@ -197,12 +290,12 @@ namespace SourceSDK.ENV.Editor.UI
checkVGame(); checkVGame();
} }
MessageBox.Show("VGame successfully cleared and Information updated!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); DarkUI.Forms.DarkMessageBox.ShowInformation("VGame successfully cleared and Information updated!", "Information", DarkDialogButton.Ok);
Cursor.Current = Cursors.Default; Cursor.Current = Cursors.Default;
} }
catch catch
{ {
MessageBox.Show("Something went wrong and VGame was not successfully deleted", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DarkUI.Forms.DarkMessageBox.ShowError("Something went wrong and VGame was not successfully deleted", "Error", DarkDialogButton.Ok);
Cursor.Current = Cursors.Default; Cursor.Current = Cursors.Default;
} }
} }
@ -223,12 +316,12 @@ namespace SourceSDK.ENV.Editor.UI
checkVContent(); checkVContent();
} }
MessageBox.Show("VContent successfully cleared and Information updated!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); DarkUI.Forms.DarkMessageBox.ShowInformation("VContent successfully cleared and Information updated!", "Information", DarkDialogButton.Ok);
Cursor.Current = Cursors.Default; Cursor.Current = Cursors.Default;
} }
catch catch
{ {
MessageBox.Show("Something went wrong and VContent was not successfully deleted", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DarkUI.Forms.DarkMessageBox.ShowError("Something went wrong and VContent was not successfully deleted", "Error", DarkDialogButton.Ok);
Cursor.Current = Cursors.Default; Cursor.Current = Cursors.Default;
} }
} }
@ -249,12 +342,12 @@ namespace SourceSDK.ENV.Editor.UI
checkVTools(); checkVTools();
} }
MessageBox.Show("VTools successfully cleared and Information updated!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); DarkUI.Forms.DarkMessageBox.ShowInformation("VTools successfully cleared and Information updated!", "Information", DarkDialogButton.Ok);
Cursor.Current = Cursors.Default; Cursor.Current = Cursors.Default;
} }
catch catch
{ {
MessageBox.Show("Something went wrong and VTools was not successfully deleted", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DarkUI.Forms.DarkMessageBox.ShowError("Something went wrong and VTools was not successfully deleted", "Error", DarkDialogButton.Ok);
Cursor.Current = Cursors.Default; Cursor.Current = Cursors.Default;
} }
} }
@ -278,12 +371,12 @@ namespace SourceSDK.ENV.Editor.UI
checkVMod(); checkVMod();
} }
MessageBox.Show("VMod successfully updated!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); DarkUI.Forms.DarkMessageBox.ShowInformation("VMod successfully updated!", "Information", DarkDialogButton.Ok);
Cursor.Current = Cursors.Default; Cursor.Current = Cursors.Default;
} }
catch catch
{ {
MessageBox.Show("Something went wrong and VMod was not successfully updated", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DarkUI.Forms.DarkMessageBox.ShowError("Something went wrong and VMod was not successfully updated", "Error", DarkDialogButton.Ok);
Cursor.Current = Cursors.Default; Cursor.Current = Cursors.Default;
} }
} }
@ -304,12 +397,12 @@ namespace SourceSDK.ENV.Editor.UI
checkVProject(); checkVProject();
} }
MessageBox.Show("VProject successfully updated!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); DarkUI.Forms.DarkMessageBox.ShowInformation("VProject successfully updated!", "Information", DarkDialogButton.Ok);
Cursor.Current = Cursors.Default; Cursor.Current = Cursors.Default;
} }
catch catch
{ {
MessageBox.Show("Something went wrong and VProject was not successfully updated", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DarkUI.Forms.DarkMessageBox.ShowError("Something went wrong and VProject was not successfully updated", "Error", DarkDialogButton.Ok);
Cursor.Current = Cursors.Default; Cursor.Current = Cursors.Default;
} }
} }
@ -330,12 +423,12 @@ namespace SourceSDK.ENV.Editor.UI
checkVGame(); checkVGame();
} }
MessageBox.Show("VGame successfully cleared updated!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); DarkUI.Forms.DarkMessageBox.ShowInformation("VGame successfully cleared updated!", "Information", DarkDialogButton.Ok);
Cursor.Current = Cursors.Default; Cursor.Current = Cursors.Default;
} }
catch catch
{ {
MessageBox.Show("Something went wrong and VGame was not successfully updated", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DarkUI.Forms.DarkMessageBox.ShowError("Something went wrong and VGame was not successfully updated", "Error", DarkDialogButton.Ok);
Cursor.Current = Cursors.Default; Cursor.Current = Cursors.Default;
} }
} }
@ -356,12 +449,12 @@ namespace SourceSDK.ENV.Editor.UI
checkVContent(); checkVContent();
} }
MessageBox.Show("VContent successfully updated!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); DarkUI.Forms.DarkMessageBox.ShowInformation("VContent successfully updated!", "Information", DarkDialogButton.Ok);
Cursor.Current = Cursors.Default; Cursor.Current = Cursors.Default;
} }
catch catch
{ {
MessageBox.Show("Something went wrong and VContent was not successfully updated", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DarkUI.Forms.DarkMessageBox.ShowError("Something went wrong and VContent was not successfully updated", "Error", DarkDialogButton.Ok);
Cursor.Current = Cursors.Default; Cursor.Current = Cursors.Default;
} }
} }
@ -382,12 +475,12 @@ namespace SourceSDK.ENV.Editor.UI
checkVTools(); checkVTools();
} }
MessageBox.Show("VTools successfully cleared updated!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); DarkUI.Forms.DarkMessageBox.ShowInformation("VTools successfully cleared updated!", "Information", DarkDialogButton.Ok);
Cursor.Current = Cursors.Default; Cursor.Current = Cursors.Default;
} }
catch catch
{ {
MessageBox.Show("Something went wrong and VTools was not successfully updated", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DarkUI.Forms.DarkMessageBox.ShowError("Something went wrong and VTools was not successfully updated", "Error", DarkDialogButton.Ok);
Cursor.Current = Cursors.Default; Cursor.Current = Cursors.Default;
} }
} }
@ -396,14 +489,14 @@ namespace SourceSDK.ENV.Editor.UI
#region btn-reset #region btn-reset
private void resetAllToolStripMenuItem_Click(object sender, EventArgs e) private void resetAllToolStripMenuItem_Click(object sender, EventArgs e)
{ {
if (MessageBox.Show("Are you sure?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) if (DarkUI.Forms.DarkMessageBox.ShowWarning("Are you sure?", "Warning", DarkDialogButton.YesNo) == DialogResult.Yes)
{ {
resetAll(); resetAll();
} }
} }
private void buttonResetVMod_Click(object sender, EventArgs e) private void buttonResetVMod_Click(object sender, EventArgs e)
{ {
if (MessageBox.Show("Are you sure?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) if (DarkUI.Forms.DarkMessageBox.ShowWarning("Are you sure?", "Warning", DarkDialogButton.YesNo) == DialogResult.Yes)
{ {
resetVMod(); resetVMod();
} }
@ -412,7 +505,7 @@ namespace SourceSDK.ENV.Editor.UI
private void buttonResetVProject_Click(object sender, EventArgs e) private void buttonResetVProject_Click(object sender, EventArgs e)
{ {
if (MessageBox.Show("Are you sure?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) if (DarkUI.Forms.DarkMessageBox.ShowWarning("Are you sure?", "Warning", DarkDialogButton.YesNo) == DialogResult.Yes)
{ {
resetVProject(); resetVProject();
} }
@ -420,7 +513,7 @@ namespace SourceSDK.ENV.Editor.UI
private void buttonResetVGame_Click(object sender, EventArgs e) private void buttonResetVGame_Click(object sender, EventArgs e)
{ {
if (MessageBox.Show("Are you sure?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) if (DarkUI.Forms.DarkMessageBox.ShowWarning("Are you sure?", "Warning", DarkDialogButton.YesNo) == DialogResult.Yes)
{ {
resetVGame(); resetVGame();
} }
@ -428,7 +521,7 @@ namespace SourceSDK.ENV.Editor.UI
private void buttonResetVContent_Click(object sender, EventArgs e) private void buttonResetVContent_Click(object sender, EventArgs e)
{ {
if (MessageBox.Show("Are you sure?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) if (DarkUI.Forms.DarkMessageBox.ShowWarning("Are you sure?", "Warning", DarkDialogButton.YesNo) == DialogResult.Yes)
{ {
resetVContent(); resetVContent();
} }
@ -436,7 +529,7 @@ namespace SourceSDK.ENV.Editor.UI
private void buttonResetVTools_Click(object sender, EventArgs e) private void buttonResetVTools_Click(object sender, EventArgs e)
{ {
if (MessageBox.Show("Are you sure?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) if (DarkUI.Forms.DarkMessageBox.ShowWarning("Are you sure?", "Warning", DarkDialogButton.YesNo) == DialogResult.Yes)
{ {
resetVTools(); resetVTools();
} }
@ -480,7 +573,7 @@ namespace SourceSDK.ENV.Editor.UI
#region btn-apply #region btn-apply
private void buttonApplyVMod_Click(object sender, EventArgs e) private void buttonApplyVMod_Click(object sender, EventArgs e)
{ {
if (MessageBox.Show("Are you sure?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) if (DarkUI.Forms.DarkMessageBox.ShowWarning("Are you sure?", "Warning", DarkDialogButton.YesNo) == DialogResult.Yes)
{ {
applyVMod(); applyVMod();
} }
@ -488,7 +581,7 @@ namespace SourceSDK.ENV.Editor.UI
private void buttonApplyVProject_Click(object sender, EventArgs e) private void buttonApplyVProject_Click(object sender, EventArgs e)
{ {
if (MessageBox.Show("Are you sure?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) if (DarkUI.Forms.DarkMessageBox.ShowWarning("Are you sure?", "Warning", DarkDialogButton.YesNo) == DialogResult.Yes)
{ {
applyVProject(); applyVProject();
} }
@ -496,7 +589,7 @@ namespace SourceSDK.ENV.Editor.UI
private void buttonApplyVGame_Click(object sender, EventArgs e) private void buttonApplyVGame_Click(object sender, EventArgs e)
{ {
if (MessageBox.Show("Are you sure?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) if (DarkUI.Forms.DarkMessageBox.ShowWarning("Are you sure?", "Warning", DarkDialogButton.YesNo) == DialogResult.Yes)
{ {
applyVGame(); applyVGame();
} }
@ -504,7 +597,7 @@ namespace SourceSDK.ENV.Editor.UI
private void buttonApplyVContent_Click(object sender, EventArgs e) private void buttonApplyVContent_Click(object sender, EventArgs e)
{ {
if (MessageBox.Show("Are you sure?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) if (DarkUI.Forms.DarkMessageBox.ShowWarning("Are you sure?", "Warning", DarkDialogButton.YesNo) == DialogResult.Yes)
{ {
applyVContent(); applyVContent();
} }
@ -512,12 +605,17 @@ namespace SourceSDK.ENV.Editor.UI
private void buttonApplyVTools_Click(object sender, EventArgs e) private void buttonApplyVTools_Click(object sender, EventArgs e)
{ {
if (MessageBox.Show("Are you sure?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) if (DarkUI.Forms.DarkMessageBox.ShowWarning("Are you sure?", "Warning", DarkDialogButton.YesNo) == DialogResult.Yes)
{ {
applyVTools(); applyVTools();
} }
} }
#endregion #endregion
private void toolStripStatusLabelUpdateStatus_Click(object sender, EventArgs e)
{
try { CheckGitHubNewerVersion(); } catch { }
}
} }
} }