diff --git a/Novetus/Novetus.ReleasePreparer/Novetus.ReleasePreparer.csproj b/Novetus/Novetus.ReleasePreparer/Novetus.ReleasePreparer.csproj new file mode 100644 index 0000000..820c233 --- /dev/null +++ b/Novetus/Novetus.ReleasePreparer/Novetus.ReleasePreparer.csproj @@ -0,0 +1,69 @@ + + + + + Debug + AnyCPU + {64A99062-3C1C-4D2E-99E4-D6D92443AC98} + Exe + Novetus.ReleasePreparer + ReleasePreparer + v4.0 + 512 + false + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + NovetusIcon.ico + + + + ..\packages\Trove.Nini.1.1.0.0\lib\net20\Nini.dll + + + + + + + + + + + + + + + + + + + + + + SET path=$(SolutionDir)build +if not exist "%25path%25" mkdir "%25path%25" +copy $(ProjectDir)$(OutDir) "%25path%25"\* +del "%25path%25"\*.vshost.exe +del "%25path%25"\*.vshost.exe.config +del "%25path%25"\*.vshost.exe.manifest +del "%25path%25"\*.xml + + \ No newline at end of file diff --git a/Novetus/Novetus.ReleasePreparer/NovetusIcon.ico b/Novetus/Novetus.ReleasePreparer/NovetusIcon.ico new file mode 100644 index 0000000..2b0c776 Binary files /dev/null and b/Novetus/Novetus.ReleasePreparer/NovetusIcon.ico differ diff --git a/Novetus/Novetus.ReleasePreparer/Properties/AssemblyInfo.cs b/Novetus/Novetus.ReleasePreparer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..daa9b41 --- /dev/null +++ b/Novetus/Novetus.ReleasePreparer/Properties/AssemblyInfo.cs @@ -0,0 +1,34 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ReleasePreparer")] +[assembly: AssemblyDescription("A utility designed for faster releases.")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Bitl")] +[assembly: AssemblyProduct("ReleasePreparer")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("64a99062-3c1c-4d2e-99e4-d6d92443ac98")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.*")] diff --git a/Novetus/Novetus.ReleasePreparer/ReleasePreparer.cs b/Novetus/Novetus.ReleasePreparer/ReleasePreparer.cs new file mode 100644 index 0000000..2aa777e --- /dev/null +++ b/Novetus/Novetus.ReleasePreparer/ReleasePreparer.cs @@ -0,0 +1,173 @@ +#region Usings +using Nini.Config; +using System; +using System.IO; +using System.Linq; +using System.Reflection; +#endregion + +namespace Novetus.ReleasePreparer +{ + #region ReleasePreparer + class ReleasePreparer + { + static void Main(string[] args) + { + if (args.Length > 0) + { + if (args.Contains("-lite")) + { + string novpath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\\Novetus"; + string litepath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\\Novetus-Lite"; + + if (!Directory.Exists(litepath)) + { + Console.WriteLine("Novetus Lite does not exist. Creating " + litepath); + Directory.CreateDirectory(litepath); + + //https://stackoverflow.com/questions/58744/copy-the-entire-contents-of-a-directory-in-c-sharp + + Console.WriteLine("Creating directories..."); + //Now Create all of the directories + foreach (string dirPath in Directory.GetDirectories(novpath, "*", + SearchOption.AllDirectories) + .Where(m => !m.Contains("Maps released by year")) + .Where(c06 => !c06.Contains("2006S")) + .Where(c07s => !c07s.Contains("2007M-Shaders")) + .Where(c06s => !c06s.Contains("2006S-Shaders")) + .Where(c09e => !c09e.Contains("2009E")) + .Where(music => !music.Contains("OldSoundtrack")) + ) + Directory.CreateDirectory(dirPath.Replace(novpath, litepath)); + + Console.WriteLine("Copying files..."); + //Copy all the files & Replaces any files with the same name + foreach (string newPath in Directory.GetFiles(novpath, "*.*", + SearchOption.AllDirectories) + .Where(m => !m.Contains("Maps released by year")) + .Where(c06 => !c06.Contains("2006S")) + .Where(c07s => !c07s.Contains("2007M-Shaders")) + .Where(c06s => !c06s.Contains("2006S-Shaders")) + .Where(c09e => !c09e.Contains("2009E")) + .Where(music => !music.Contains("OldSoundtrack")) + .Where(php => !php.Contains("php")) + ) + FixedFileCopy(newPath, newPath.Replace(novpath, litepath), true); + + Console.WriteLine("Overwriting files with lite alternatives..."); + string litefiles = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\\litefiles"; + + foreach (string newPath in Directory.GetFiles(litefiles, "*.*", + SearchOption.AllDirectories)) + FixedFileCopy(newPath, newPath.Replace(litefiles, litepath), true); + } + + string infopathlite = litepath + @"\\config\\info.ini"; + Console.WriteLine("Editing " + infopathlite); + SetBranch(infopathlite); + string currbranchlite = GetBranch(infopathlite); + + string pathlite = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\\releasenomapsversion.txt"; + Console.WriteLine("Creating " + pathlite); + if (!File.Exists(pathlite)) + { + // Create a file to write to. + using (StreamWriter sw = File.CreateText(pathlite)) + { + sw.Write(currbranchlite); + } + } + } + else if (args.Contains("-snapshot")) + { + string novbetapath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\\Novetus"; + string infopath = novbetapath + @"\\changelog.txt"; + string currver = File.ReadLines(infopath).First(); + + string pathbeta = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\\betaversion.txt"; + Console.WriteLine("Creating " + pathbeta); + if (!File.Exists(pathbeta)) + { + // Create a file to write to. + using (StreamWriter sw = File.CreateText(pathbeta)) + { + sw.Write(currver); + } + } + } + else if (args.Contains("-release")) + { + string novpath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\\Novetus"; + string infopath = novpath + @"\\config\\info.ini"; + string currbranch = GetBranch(infopath); + + string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\\releaseversion.txt"; + Console.WriteLine("Creating " + path); + if (!File.Exists(path)) + { + // Create a file to write to. + using (StreamWriter sw = File.CreateText(path)) + { + sw.Write(currbranch); + } + } + } + } + } + + public static void FixedFileCopy(string src, string dest, bool overwrite) + { + if (File.Exists(dest)) + { + File.SetAttributes(dest, FileAttributes.Normal); + } + + File.Copy(src, dest, overwrite); + } + + public static void FixedFileDelete(string src) + { + if (File.Exists(src)) + { + File.SetAttributes(src, FileAttributes.Normal); + File.Delete(src); + } + } + + public static string GetBranch(string infopath) + { + //READ + string versionbranch; + IniConfigSource ini = new IniConfigSource(infopath); + string section = "ProgramInfo"; + versionbranch = ini.Configs[section].Get("Branch", "0.0"); + return versionbranch; + } + + public static void SetBranch(string infopath) + { + //READ + string versionbranch; + + IniConfigSource ini = new IniConfigSource(infopath); + + string section = "ProgramInfo"; + + versionbranch = ini.Configs[section].Get("Branch", "0.0"); + + try + { + if (!versionbranch.Contains("(Lite)")) + { + ini.Configs[section].Set("Branch", versionbranch + " (Lite)"); + ini.Save(); + } + } + catch (Exception) + { + SetBranch(infopath); + } + } + } + #endregion +} diff --git a/Novetus/Novetus.ReleasePreparer/Resources/NovetusIcon.ico b/Novetus/Novetus.ReleasePreparer/Resources/NovetusIcon.ico new file mode 100644 index 0000000..2b0c776 Binary files /dev/null and b/Novetus/Novetus.ReleasePreparer/Resources/NovetusIcon.ico differ diff --git a/Novetus/Novetus.ReleasePreparer/packages.config b/Novetus/Novetus.ReleasePreparer/packages.config new file mode 100644 index 0000000..15d45a7 --- /dev/null +++ b/Novetus/Novetus.ReleasePreparer/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Novetus/Novetus.sln b/Novetus/Novetus.sln index dae2569..a974c72 100644 --- a/Novetus/Novetus.sln +++ b/Novetus/Novetus.sln @@ -13,6 +13,8 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Novetus.Core", "NovetusCore EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Novetus.ClientScriptTester", "Novetus.ClientScriptTester\Novetus.ClientScriptTester.csproj", "{83B08607-65B8-4F9C-8D0F-AB1C8EEFFAE0}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Novetus.ReleasePreparer", "Novetus.ReleasePreparer\Novetus.ReleasePreparer.csproj", "{64A99062-3C1C-4D2E-99E4-D6D92443AC98}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution NovetusCore\NovetusCore.projitems*{2070eaa6-7606-4006-a628-5705c24a3644}*SharedItemsImports = 4 @@ -41,6 +43,10 @@ Global {83B08607-65B8-4F9C-8D0F-AB1C8EEFFAE0}.Debug|Any CPU.Build.0 = Debug|Any CPU {83B08607-65B8-4F9C-8D0F-AB1C8EEFFAE0}.Release|Any CPU.ActiveCfg = Release|Any CPU {83B08607-65B8-4F9C-8D0F-AB1C8EEFFAE0}.Release|Any CPU.Build.0 = Release|Any CPU + {64A99062-3C1C-4D2E-99E4-D6D92443AC98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {64A99062-3C1C-4D2E-99E4-D6D92443AC98}.Debug|Any CPU.Build.0 = Debug|Any CPU + {64A99062-3C1C-4D2E-99E4-D6D92443AC98}.Release|Any CPU.ActiveCfg = Release|Any CPU + {64A99062-3C1C-4D2E-99E4-D6D92443AC98}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/batch/dev_menu.bat b/batch/dev_menu.bat index e86d33b..80d5080 100644 --- a/batch/dev_menu.bat +++ b/batch/dev_menu.bat @@ -166,66 +166,52 @@ IF %checkoption%==3 GOTO RELEASENOMAPS_DRY :RELEASE CLS +ReleasePreparer.exe -release butler push Novetus bitl/novetus:windows --if-changed --userversion-file releaseversion.txt pause +del releaseversion.txt GOTO MENU :RELEASENOMAPS CLS -robocopy Novetus Novetus-lite /E -rmdir /s /q "Novetus-Lite\maps\Maps released by year" -rmdir /s /q "Novetus-Lite\clients\2006S" -rmdir /s /q "Novetus-Lite\clients\2006S-Shaders" -rmdir /s /q "Novetus-Lite\clients\2007M-Shaders" -rmdir /s /q "Novetus-Lite\clients\2009E" -del /s /q Novetus-Lite\config\clients\GlobalSettings_4_2009E_default.xml -del /s /q Novetus-Lite\config\clients\GlobalSettings4_2006S_default.xml -del /s /q Novetus-Lite\config\clients\GlobalSettings4_2006S-Shaders_default.xml -del /s /q Novetus-Lite\config\clients\GlobalSettings4_2007M-Shaders_default.xml -rmdir /s /q "Novetus-Lite\shareddata\music\ROBLOX\OldSoundtrack" -rmdir /s /q "Novetus-Lite\bin\data\php" -robocopy litefiles Novetus-lite /E +ReleasePreparer.exe -lite butler push Novetus-Lite bitl/novetus:windows-lite --if-changed --userversion-file releasenomapsversion.txt pause rmdir /s /q "Novetus-Lite" +del releasenomapsversion.txt GOTO MENU :BETA CLS +ReleasePreparer.exe -snapshot butler push Novetus bitl/novetus:windows-beta --if-changed --userversion-file betaversion.txt pause +del betaversion.txt GOTO MENU :RELEASE_DRY CLS +ReleasePreparer.exe -release butler push Novetus bitl/novetus:windows --if-changed --userversion-file releaseversion.txt --dry-run pause +del releaseversion.txt GOTO MENU :RELEASENOMAPS_DRY CLS -robocopy Novetus Novetus-lite /E -rmdir /s /q "Novetus-Lite\maps\Maps released by year" -rmdir /s /q "Novetus-Lite\clients\2006S" -rmdir /s /q "Novetus-Lite\clients\2006S-Shaders" -rmdir /s /q "Novetus-Lite\clients\2007M-Shaders" -rmdir /s /q "Novetus-Lite\clients\2009E" -del /s /q Novetus-Lite\config\clients\GlobalSettings_4_2009E_default.xml -del /s /q Novetus-Lite\config\clients\GlobalSettings4_2006S_default.xml -del /s /q Novetus-Lite\config\clients\GlobalSettings4_2006S-Shaders_default.xml -del /s /q Novetus-Lite\config\clients\GlobalSettings4_2007M-Shaders_default.xml -rmdir /s /q "Novetus-Lite\shareddata\music\ROBLOX\OldSoundtrack" -rmdir /s /q "Novetus-Lite\bin\data\php" -robocopy litefiles Novetus-lite /E +ReleasePreparer.exe -lite butler push Novetus-Lite bitl/novetus:windows-lite --if-changed --userversion-file releasenomapsversion.txt --dry-run pause rmdir /s /q "Novetus-Lite" +del releasenomapsversion.txt GOTO MENU :BETA_DRY CLS +ReleasePreparer.exe -snapshot butler push Novetus bitl/novetus:windows-beta --if-changed --userversion-file betaversion.txt --dry-run pause +del betaversion.txt GOTO MENU :VALIDATE