From 02d726d43f9d6fb40c1bb63d0d1e75653be89ba5 Mon Sep 17 00:00:00 2001 From: Bitl Date: Wed, 10 Nov 2021 10:18:50 -0700 Subject: [PATCH] more pre-release changes --- .../ReleasePreparer.cs | 54 +++++++++++++------ .../StorageAndFunctions/GlobalFuncs.cs | 9 ++-- scripts/batch/clean_junk.bat | 1 + scripts/batch/create_lite.bat | 3 ++ scripts/batch/github_sync.bat | 1 + scripts/launcher/info.ini | 5 +- 6 files changed, 51 insertions(+), 22 deletions(-) create mode 100644 scripts/batch/create_lite.bat diff --git a/Novetus/Novetus.ReleasePreparer/ReleasePreparer.cs b/Novetus/Novetus.ReleasePreparer/ReleasePreparer.cs index 3441b84..fe42941 100644 --- a/Novetus/Novetus.ReleasePreparer/ReleasePreparer.cs +++ b/Novetus/Novetus.ReleasePreparer/ReleasePreparer.cs @@ -1,5 +1,6 @@ #region Usings using System; +using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; @@ -72,7 +73,7 @@ namespace Novetus.ReleasePreparer string infopathlite = litepath + @"\\config\\info.ini"; Console.WriteLine("Editing " + infopathlite); - SetBranch(infopathlite); + SetToLite(infopathlite); string currbranchlite = GetBranch(infopathlite); string pathlite = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\\releasenomapsversion.txt"; @@ -89,8 +90,8 @@ namespace Novetus.ReleasePreparer } else if (args.Contains("-snapshot")) { - string infopath = novpath + @"\\changelog.txt"; - string currver = File.ReadLines(infopath).First(); + string infopath = novpath + @"\\config\\info.ini"; + string currver = GetBranch(infopath); string pathbeta = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\\betaversion.txt"; Console.WriteLine("Creating " + pathbeta); @@ -146,35 +147,54 @@ namespace Novetus.ReleasePreparer public static string GetBranch(string infopath) { - //READ - string versionbranch; INIFile ini = new INIFile(infopath); - string section = "ProgramInfo"; - versionbranch = ini.IniReadValue(section, "Branch", "0.0"); - return versionbranch; + return GetBranch(ini, infopath); } - public static void SetBranch(string infopath) + public static string GetBranch(INIFile ini, string infopath) { //READ - string versionbranch; - - INIFile ini = new INIFile(infopath); - + string versionbranch, extendedVersionNumber, extendedVersionTemplate, extendedVersionRevision, isLite; string section = "ProgramInfo"; - versionbranch = ini.IniReadValue(section, "Branch", "0.0"); + extendedVersionNumber = ini.IniReadValue(section, "ExtendedVersionNumber", "False"); + extendedVersionTemplate = ini.IniReadValue(section, "ExtendedVersionTemplate", "%version%"); + extendedVersionRevision = ini.IniReadValue(section, "ExtendedVersionRevision", "-1"); + isLite = ini.IniReadValue(section, "IsLite", "False"); + + string novpath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\\Novetus\\bin\\Novetus.exe"; + + if (!extendedVersionNumber.Equals("False")) + { + var versionInfo = FileVersionInfo.GetVersionInfo(novpath); + return extendedVersionTemplate.Replace("%version%", versionbranch) + .Replace("%build%", versionInfo.ProductBuildPart.ToString()) + .Replace("%revision%", versionInfo.FilePrivatePart.ToString()) + .Replace("%extended-revision%", (!extendedVersionRevision.Equals("-1") ? extendedVersionRevision : "")) + .Replace("%lite%", (!isLite.Equals("False") ? " (Lite)" : "")); + } + else + { + return versionbranch; + } + } + + public static void SetToLite(string infopath) + { + INIFile ini = new INIFile(infopath); + string section = "ProgramInfo"; + string isLite = ini.IniReadValue(section, "IsLite", "False"); try { - if (!versionbranch.Contains("(Lite)")) + if (!isLite.Equals("True")) { - ini.IniWriteValue(section, "Branch", versionbranch + " (Lite)"); + ini.IniWriteValue(section, "IsLite", "True"); } } catch (Exception) { - SetBranch(infopath); + SetToLite(infopath); } } } diff --git a/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs b/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs index 1f684d8..3cacba0 100644 --- a/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs +++ b/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs @@ -27,7 +27,7 @@ public class GlobalFuncs //READ string versionbranch, defaultclient, defaultmap, regclient1, regclient2, extendedversionnumber, extendedversiontemplate, - extendedversionrevision, extendedversioneditchangelog; + extendedversionrevision, extendedversioneditchangelog, isLite; INIFile ini = new INIFile(infopath); @@ -43,6 +43,7 @@ public class GlobalFuncs extendedversioneditchangelog = ini.IniReadValue(section, "ExtendedVersionEditChangelog", "False"); extendedversiontemplate = ini.IniReadValue(section, "ExtendedVersionTemplate", "%version%"); extendedversionrevision = ini.IniReadValue(section, "ExtendedVersionRevision", "-1"); + isLite = ini.IniReadValue(section, "IsLite", "False"); try { @@ -57,7 +58,8 @@ public class GlobalFuncs GlobalVars.ProgramInformation.Version = extendedversiontemplate.Replace("%version%", versionbranch) .Replace("%build%", versionInfo.ProductBuildPart.ToString()) .Replace("%revision%", versionInfo.FilePrivatePart.ToString()) - .Replace("%extended-revision%", (!extendedversionrevision.Equals("-1") ? extendedversionrevision : "")); + .Replace("%extended-revision%", (!extendedversionrevision.Equals("-1") ? extendedversionrevision : "")) + .Replace("%lite%", (!isLite.Equals("False") ? " (Lite)" : "")); } else { @@ -69,7 +71,8 @@ public class GlobalFuncs GlobalVars.ProgramInformation.Version = extendedversiontemplate.Replace("%version%", versionbranch) .Replace("%build%", Assembly.GetExecutingAssembly().GetName().Version.Build.ToString()) .Replace("%revision%", Assembly.GetExecutingAssembly().GetName().Version.Revision.ToString()) - .Replace("%extended-revision%", (!extendedversionrevision.Equals("-1") ? extendedversionrevision : "")); + .Replace("%extended-revision%", (!extendedversionrevision.Equals("-1") ? extendedversionrevision : "")) + .Replace("%lite%", (!extendedversionrevision.Equals("False") ? " (Lite)" : "")); } bool changelogedit = Convert.ToBoolean(extendedversioneditchangelog); diff --git a/scripts/batch/clean_junk.bat b/scripts/batch/clean_junk.bat index c807e76..9ffd71e 100644 --- a/scripts/batch/clean_junk.bat +++ b/scripts/batch/clean_junk.bat @@ -1,6 +1,7 @@ @ECHO OFF del /S Novetus\*.pdb del /S Novetus\*.log +del /S Novetus\*.bak del /s /q Novetus\clients\2007E\content\scripts\CSMPBoot.lua del /s /q Novetus\clients\2007E-Shaders\content\scripts\CSMPBoot.lua diff --git a/scripts/batch/create_lite.bat b/scripts/batch/create_lite.bat new file mode 100644 index 0000000..9e858b7 --- /dev/null +++ b/scripts/batch/create_lite.bat @@ -0,0 +1,3 @@ +@ECHO OFF +call clean_junk.bat +ReleasePreparer.exe -lite \ No newline at end of file diff --git a/scripts/batch/github_sync.bat b/scripts/batch/github_sync.bat index 04a0ec5..85d4380 100644 --- a/scripts/batch/github_sync.bat +++ b/scripts/batch/github_sync.bat @@ -128,6 +128,7 @@ if not exist "%dest%\scripts\batch" mkdir "%scriptsdir%\batch" XCOPY "%cd%\dev_menu.bat" "%scriptsdir%\batch" /y XCOPY "%cd%\clean_junk.bat" "%scriptsdir%\batch" /y XCOPY "%cd%\github_sync.bat" "%scriptsdir%\batch" /y +XCOPY "%cd%\create_lite.bat" "%scriptsdir%\batch" /y XCOPY "%cd%\Novetus\Novetus_dependency_installer.bat" "%scriptsdir%\batch" /y XCOPY "%cd%\Novetus\Novetus_launcher_legacy.bat" "%scriptsdir%\batch" /y XCOPY "%cd%\Novetus\documentation.txt" "%dest%" /y diff --git a/scripts/launcher/info.ini b/scripts/launcher/info.ini index f796b3d..ecdad58 100644 --- a/scripts/launcher/info.ini +++ b/scripts/launcher/info.ini @@ -6,5 +6,6 @@ UserAgentRegisterClient1=2007M UserAgentRegisterClient2=2010L ExtendedVersionNumber=True ExtendedVersionEditChangelog=False -ExtendedVersionTemplate=%version% v11.2021.%extended-revision% -ExtendedVersionRevision=1 \ No newline at end of file +ExtendedVersionTemplate=%version% v11.2021.%extended-revision%%lite% +ExtendedVersionRevision=1 +IsLite=False \ No newline at end of file