Skip to content

Commit

Permalink
1.0.0.2 Improved DarkUI and update logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
stamepicmorg committed Apr 2, 2022
1 parent 22ac8e9 commit 4b2e3ff
Show file tree
Hide file tree
Showing 6 changed files with 268 additions and 84 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# 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.
6 changes: 3 additions & 3 deletions src/SourceSDK.ENV.Editor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
<StartupObject>SourceSDK.ENV.Editor.Program</StartupObject>
<ApplicationIcon>crowbar.ico</ApplicationIcon>
<SignAssembly>False</SignAssembly>
<AssemblyVersion>1.0.0.1</AssemblyVersion>
<FileVersion>1.0.0.1</FileVersion>
<Version>1.0.0.1</Version>
<AssemblyVersion>1.0.0.2</AssemblyVersion>
<FileVersion>1.0.0.2</FileVersion>
<Version>1.0.0.2</Version>
<Company>EpicMorg</Company>
<Copyright>EpicMorg</Copyright>
<PackageProjectUrl>https://github.com/EpicMorg/SourceSDK.ENV.Editor</PackageProjectUrl>
Expand Down
95 changes: 87 additions & 8 deletions src/UI/FormAbout.Designer.cs

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

50 changes: 15 additions & 35 deletions src/UI/FormAbout.cs
Original file line number Diff line number Diff line change
@@ -1,55 +1,35 @@
using System.Diagnostics;
using System.Runtime.InteropServices;
using DarkUI.Forms;
using Octokit;
using System.Runtime.InteropServices;

namespace SourceSDK.ENV.Editor.UI
{
public partial class FormAbout : Form
{
string verDarkUI = "Unknown";
string verOctokit = "Unknown";
public FormAbout()
{
InitializeComponent();
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);
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)
{
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)
Expand Down
33 changes: 29 additions & 4 deletions src/UI/FormMain.Designer.cs

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

Loading

0 comments on commit 4b2e3ff

Please sign in to comment.