From ca298ed5beb2b1fb5f739c2e1a76f24189248258 Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Tue, 2 May 2023 16:43:15 +0200 Subject: [PATCH] Added Beta build configuration and added CommitInfo class --- PCK-Studio/MainForm.cs | 5 ++- PCK-Studio/PckStudio.csproj | 65 +++++++++++++++++++------------------ PCK-Studio/Program.cs | 34 +++++++++++++++---- PCK_Studio.sln | 21 ++++++++++++ 4 files changed, 86 insertions(+), 39 deletions(-) diff --git a/PCK-Studio/MainForm.cs b/PCK-Studio/MainForm.cs index d574bbf1..1f9f02fa 100644 --- a/PCK-Studio/MainForm.cs +++ b/PCK-Studio/MainForm.cs @@ -71,8 +71,11 @@ namespace PckStudio labelVersion.Text = "PCK Studio: " + Application.ProductVersion; ChangelogRichTextBox.Text = Resources.CHANGELOG; +#if BETA + labelVersion.Text += $"{Program.Info.BetaBuildVersion}"; +#endif #if DEBUG - labelVersion.Text += $" (Debug build: {Program.Info.BuildVersion}@{Program.Info.LastCommitHash})"; + labelVersion.Text += $" (Debug build: {CommitInfo.BranchName}@{CommitInfo.CommitHash})"; #endif pckFileTypeHandler = new Dictionary>(15) diff --git a/PCK-Studio/PckStudio.csproj b/PCK-Studio/PckStudio.csproj index a9d13698..f2d11dc7 100644 --- a/PCK-Studio/PckStudio.csproj +++ b/PCK-Studio/PckStudio.csproj @@ -18,39 +18,40 @@ false true - - - - $(IntermediateOutputPath)gitver - - - - - - - - - - @(GitVersion) - + + + + + + + + + + $(GitHash) + $(GitBranch) + - - + + $(IntermediateOutputPath)GitAssemblyInfo.cs - + - + <_Parameter1>GitHash <_Parameter2>$(BuildHash) + + <_Parameter1>GitBranch + <_Parameter2>$(BuildBranch) + - + @@ -82,14 +83,24 @@ AnyCPU - pdbonly - false + none + true bin\Release\ TRACE prompt 4 true + + AnyCPU + pdbonly + false + bin\Beta\ + BETA;TRACE + prompt + 4 + true + Resources\PCK-Studio_Logo.ico @@ -124,16 +135,6 @@ - - bin\ReleasePortable\ - TRACE - true - pdbonly - AnyCPU - preview - prompt - true - Properties\app.manifest diff --git a/PCK-Studio/Program.cs b/PCK-Studio/Program.cs index 51fce472..e84fa74f 100644 --- a/PCK-Studio/Program.cs +++ b/PCK-Studio/Program.cs @@ -15,7 +15,7 @@ namespace PckStudio private System.Globalization.Calendar BuildCalendar = new System.Globalization.CultureInfo("en-US").Calendar; private DateTime date = new FileInfo(Assembly.GetExecutingAssembly().Location).LastWriteTime; - public string BuildVersion + public string BetaBuildVersion { get { @@ -27,12 +27,34 @@ namespace PckStudio BuildType); } } + } - public string LastCommitHash => - Assembly - .GetEntryAssembly() - .GetCustomAttributes() - .FirstOrDefault(attr => attr.Key == "GitHash")?.Value; + static class CommitInfo + { + private static string _branchName = null; + private static string _commitHash = null; + + public static string BranchName + { + get + { + return _branchName ??= Assembly + .GetEntryAssembly() + .GetCustomAttributes() + .FirstOrDefault(attr => attr.Key == "GitBranch")?.Value; + } + } + + public static string CommitHash + { + get + { + return _commitHash ??= Assembly + .GetEntryAssembly() + .GetCustomAttributes() + .FirstOrDefault(attr => attr.Key == "GitHash")?.Value; + } + } } static class Program diff --git a/PCK_Studio.sln b/PCK_Studio.sln index d40bfc93..8062268c 100644 --- a/PCK_Studio.sln +++ b/PCK_Studio.sln @@ -13,6 +13,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpMss32", "Vendor\SharpM EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Beta|Any CPU = Beta|Any CPU + Beta|x64 = Beta|x64 + Beta|x86 = Beta|x86 Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 @@ -21,6 +24,12 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0ACAAEDE-93F5-4B5D-B8D7-A0C43359C0D6}.Beta|Any CPU.ActiveCfg = Beta|Any CPU + {0ACAAEDE-93F5-4B5D-B8D7-A0C43359C0D6}.Beta|Any CPU.Build.0 = Beta|Any CPU + {0ACAAEDE-93F5-4B5D-B8D7-A0C43359C0D6}.Beta|x64.ActiveCfg = Beta|Any CPU + {0ACAAEDE-93F5-4B5D-B8D7-A0C43359C0D6}.Beta|x64.Build.0 = Beta|Any CPU + {0ACAAEDE-93F5-4B5D-B8D7-A0C43359C0D6}.Beta|x86.ActiveCfg = Beta|Any CPU + {0ACAAEDE-93F5-4B5D-B8D7-A0C43359C0D6}.Beta|x86.Build.0 = Beta|Any CPU {0ACAAEDE-93F5-4B5D-B8D7-A0C43359C0D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0ACAAEDE-93F5-4B5D-B8D7-A0C43359C0D6}.Debug|Any CPU.Build.0 = Debug|Any CPU {0ACAAEDE-93F5-4B5D-B8D7-A0C43359C0D6}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -33,6 +42,12 @@ Global {0ACAAEDE-93F5-4B5D-B8D7-A0C43359C0D6}.Release|x64.Build.0 = Release|Any CPU {0ACAAEDE-93F5-4B5D-B8D7-A0C43359C0D6}.Release|x86.ActiveCfg = Release|Any CPU {0ACAAEDE-93F5-4B5D-B8D7-A0C43359C0D6}.Release|x86.Build.0 = Release|Any CPU + {693AEBC1-293D-4DF0-BCAE-26A1099FE7BB}.Beta|Any CPU.ActiveCfg = Release|Any CPU + {693AEBC1-293D-4DF0-BCAE-26A1099FE7BB}.Beta|Any CPU.Build.0 = Release|Any CPU + {693AEBC1-293D-4DF0-BCAE-26A1099FE7BB}.Beta|x64.ActiveCfg = Release|Any CPU + {693AEBC1-293D-4DF0-BCAE-26A1099FE7BB}.Beta|x64.Build.0 = Release|Any CPU + {693AEBC1-293D-4DF0-BCAE-26A1099FE7BB}.Beta|x86.ActiveCfg = Release|Any CPU + {693AEBC1-293D-4DF0-BCAE-26A1099FE7BB}.Beta|x86.Build.0 = Release|Any CPU {693AEBC1-293D-4DF0-BCAE-26A1099FE7BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {693AEBC1-293D-4DF0-BCAE-26A1099FE7BB}.Debug|Any CPU.Build.0 = Debug|Any CPU {693AEBC1-293D-4DF0-BCAE-26A1099FE7BB}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -45,6 +60,12 @@ Global {693AEBC1-293D-4DF0-BCAE-26A1099FE7BB}.Release|x64.Build.0 = Release|Any CPU {693AEBC1-293D-4DF0-BCAE-26A1099FE7BB}.Release|x86.ActiveCfg = Release|Any CPU {693AEBC1-293D-4DF0-BCAE-26A1099FE7BB}.Release|x86.Build.0 = Release|Any CPU + {E8D0B671-3AB1-48B6-A767-58DF67BD5D11}.Beta|Any CPU.ActiveCfg = Release|Any CPU + {E8D0B671-3AB1-48B6-A767-58DF67BD5D11}.Beta|Any CPU.Build.0 = Release|Any CPU + {E8D0B671-3AB1-48B6-A767-58DF67BD5D11}.Beta|x64.ActiveCfg = Release|Any CPU + {E8D0B671-3AB1-48B6-A767-58DF67BD5D11}.Beta|x64.Build.0 = Release|Any CPU + {E8D0B671-3AB1-48B6-A767-58DF67BD5D11}.Beta|x86.ActiveCfg = Release|Any CPU + {E8D0B671-3AB1-48B6-A767-58DF67BD5D11}.Beta|x86.Build.0 = Release|Any CPU {E8D0B671-3AB1-48B6-A767-58DF67BD5D11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E8D0B671-3AB1-48B6-A767-58DF67BD5D11}.Debug|Any CPU.Build.0 = Debug|Any CPU {E8D0B671-3AB1-48B6-A767-58DF67BD5D11}.Debug|x64.ActiveCfg = Debug|Any CPU