From 53a9291dbf932c5963a6ec7b0bca1a28e11091e5 Mon Sep 17 00:00:00 2001 From: pointfeev Date: Sat, 11 Jun 2022 22:37:32 -0500 Subject: [PATCH] debug versioning --- CreamInstaller.sln | 19 +++++++++++++++++-- CreamInstaller/CreamInstaller.csproj | 7 +++++-- CreamInstaller/Forms/MainForm.cs | 28 ++++++++++++++++++++++++++-- CreamInstaller/Program.cs | 5 +++++ 4 files changed, 53 insertions(+), 6 deletions(-) diff --git a/CreamInstaller.sln b/CreamInstaller.sln index 046e083..9ac4cc5 100644 --- a/CreamInstaller.sln +++ b/CreamInstaller.sln @@ -1,12 +1,17 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31025.194 +# Visual Studio Version 17 +VisualStudioVersion = 17.2.32516.85 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CreamInstaller", "CreamInstaller\CreamInstaller.csproj", "{6C94C882-7168-435E-B9E3-B4B9222BBF68}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|ARM = Debug|ARM + Debug|ARM64 = Debug|ARM64 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU Release|ARM = Release|ARM Release|ARM64 = Release|ARM64 @@ -14,6 +19,16 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6C94C882-7168-435E-B9E3-B4B9222BBF68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6C94C882-7168-435E-B9E3-B4B9222BBF68}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6C94C882-7168-435E-B9E3-B4B9222BBF68}.Debug|ARM.ActiveCfg = Debug|Any CPU + {6C94C882-7168-435E-B9E3-B4B9222BBF68}.Debug|ARM.Build.0 = Debug|Any CPU + {6C94C882-7168-435E-B9E3-B4B9222BBF68}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {6C94C882-7168-435E-B9E3-B4B9222BBF68}.Debug|ARM64.Build.0 = Debug|Any CPU + {6C94C882-7168-435E-B9E3-B4B9222BBF68}.Debug|x64.ActiveCfg = Debug|Any CPU + {6C94C882-7168-435E-B9E3-B4B9222BBF68}.Debug|x64.Build.0 = Debug|Any CPU + {6C94C882-7168-435E-B9E3-B4B9222BBF68}.Debug|x86.ActiveCfg = Debug|Any CPU + {6C94C882-7168-435E-B9E3-B4B9222BBF68}.Debug|x86.Build.0 = Debug|Any CPU {6C94C882-7168-435E-B9E3-B4B9222BBF68}.Release|Any CPU.ActiveCfg = Release|Any CPU {6C94C882-7168-435E-B9E3-B4B9222BBF68}.Release|Any CPU.Build.0 = Release|Any CPU {6C94C882-7168-435E-B9E3-B4B9222BBF68}.Release|ARM.ActiveCfg = Release|Any CPU diff --git a/CreamInstaller/CreamInstaller.csproj b/CreamInstaller/CreamInstaller.csproj index 0be31fa..ab841dc 100644 --- a/CreamInstaller/CreamInstaller.csproj +++ b/CreamInstaller/CreamInstaller.csproj @@ -5,7 +5,7 @@ True Resources\ini.ico true - 3.5.2.0 + 3.5.2.1 Resources\ini.ico LICENSE 2021, pointfeev (https://github.com/pointfeev) @@ -29,11 +29,14 @@ embedded true - TRACE + $(DefineConstants) True True + True + embedded + $(DefineConstants) diff --git a/CreamInstaller/Forms/MainForm.cs b/CreamInstaller/Forms/MainForm.cs index 7dff60e..dc89d45 100644 --- a/CreamInstaller/Forms/MainForm.cs +++ b/CreamInstaller/Forms/MainForm.cs @@ -70,13 +70,24 @@ internal partial class MainForm : CustomForm checkForUpdatesResult = await updateManager.CheckForUpdatesAsync(cancellationTokenSource.Token); cancellationTokenSource.Dispose(); cancellationTokenSource = null; +#if !DEBUG if (checkForUpdatesResult.CanUpdate) { +#endif latestVersion = checkForUpdatesResult.LastVersion; versions = checkForUpdatesResult.Versions; +#if !DEBUG } +#endif } +#if DEBUG + catch (Exception e) + { + e.HandleException(form: this, caption: "Debug exception", acceptButtonText: "OK", cancelButtonText: null); + } +#else catch { } +#endif } if (latestVersion is null) { @@ -92,14 +103,19 @@ internal partial class MainForm : CustomForm updateButton.Click += new(OnUpdate); changelogTreeView.Visible = true; Version currentVersion = new(Application.ProductVersion); +#if DEBUG + foreach (Version version in versions.Where(v => (v > currentVersion || v == latestVersion) && !changelogTreeView.Nodes.ContainsKey(v.ToString()))) +#else foreach (Version version in versions.Where(v => v > currentVersion && !changelogTreeView.Nodes.ContainsKey(v.ToString()))) +#endif { TreeNode root = new($"v{version}") { Name = version.ToString() }; changelogTreeView.Nodes.Add(root); - if (changelogTreeView.Nodes.Count > 0) changelogTreeView.Nodes[0].EnsureVisible(); + if (changelogTreeView.Nodes.Count > 0) + changelogTreeView.Nodes[0].EnsureVisible(); _ = Task.Run(async () => { HtmlNodeCollection nodes = await HttpClientManager.GetDocumentNodes( @@ -116,7 +132,8 @@ internal partial class MainForm : CustomForm }; root.Nodes.Add(change); root.Expand(); - if (changelogTreeView.Nodes.Count > 0) changelogTreeView.Nodes[0].EnsureVisible(); + if (changelogTreeView.Nodes.Count > 0) + changelogTreeView.Nodes[0].EnsureVisible(); }); } }); @@ -178,7 +195,14 @@ internal partial class MainForm : CustomForm cancellationTokenSource.Dispose(); cancellationTokenSource = null; } +#if DEBUG + catch (Exception ex) + { + ex.HandleException(form: this, caption: "Debug exception", acceptButtonText: "OK", cancelButtonText: null); + } +#else catch { } +#endif if (updateManager is not null && updateManager.IsUpdatePrepared(latestVersion)) { diff --git a/CreamInstaller/Program.cs b/CreamInstaller/Program.cs index 4e8290f..26a9406 100644 --- a/CreamInstaller/Program.cs +++ b/CreamInstaller/Program.cs @@ -14,8 +14,13 @@ namespace CreamInstaller; internal static class Program { +#if DEBUG + internal static readonly string ApplicationName = Application.CompanyName + " v" + Application.ProductVersion + "-debug: " + Application.ProductName; + internal static readonly string ApplicationNameShort = Application.CompanyName + " v" + Application.ProductVersion + "-debug"; +#else internal static readonly string ApplicationName = Application.CompanyName + " v" + Application.ProductVersion + ": " + Application.ProductName; internal static readonly string ApplicationNameShort = Application.CompanyName + " v" + Application.ProductVersion; +#endif internal static readonly Assembly EntryAssembly = Assembly.GetEntryAssembly(); internal static readonly Process CurrentProcess = Process.GetCurrentProcess();