From 256e2370a320b480c597e50354586b930375f53e Mon Sep 17 00:00:00 2001 From: Saty <5752427+SatyPardus@users.noreply.github.com> Date: Fri, 29 Dec 2023 23:56:40 +0100 Subject: [PATCH] b1524 - Added Text Tranformation pipeline --- SRMP/Properties/AssemblyInfo.cs | 4 ++-- SRMP/SRMP.csproj | 20 +++++++++++++++++--- SRMP/modinfo.json | 15 ++++++++------- SRMP/modinfo.tt | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+), 12 deletions(-) create mode 100644 SRMP/modinfo.tt diff --git a/SRMP/Properties/AssemblyInfo.cs b/SRMP/Properties/AssemblyInfo.cs index 00d781b..81d723d 100644 --- a/SRMP/Properties/AssemblyInfo.cs +++ b/SRMP/Properties/AssemblyInfo.cs @@ -15,7 +15,7 @@ using System.Resources; [assembly: AssemblyCulture("")] // Version informationr( -[assembly: AssemblyVersion("0.0.0.1510")] -[assembly: AssemblyFileVersion("0.0.0.1510")] +[assembly: AssemblyVersion("0.0.0.1524")] +[assembly: AssemblyFileVersion("0.0.0.1524")] [assembly: NeutralResourcesLanguageAttribute( "en-US" )] diff --git a/SRMP/SRMP.csproj b/SRMP/SRMP.csproj index bbc4bc6..bd436f7 100644 --- a/SRMP/SRMP.csproj +++ b/SRMP/SRMP.csproj @@ -496,6 +496,10 @@ + + TextTemplatingFileGenerator + modinfo.json + TextTemplatingFileGenerator AssemblyInfo.cs @@ -513,7 +517,11 @@ - + + True + True + modinfo.tt + @@ -521,7 +529,13 @@ - - + if "$(ConfigurationName)" == "Standalone" ( +"$(DevEnvDir)TextTransform.exe" "$(ProjectDir)Properties\AssemblyInfo.tt" +"$(DevEnvDir)TextTransform.exe" "$(ProjectDir)modinfo.tt" +) +if "$(ConfigurationName)" == "SRML" ( +"$(DevEnvDir)TextTransform.exe" "$(ProjectDir)Properties\AssemblyInfo.tt" +"$(DevEnvDir)TextTransform.exe" "$(ProjectDir)modinfo.tt" +) \ No newline at end of file diff --git a/SRMP/modinfo.json b/SRMP/modinfo.json index 4f5b233..d8f5ec1 100644 --- a/SRMP/modinfo.json +++ b/SRMP/modinfo.json @@ -1,9 +1,10 @@ { - "id": "srmp", - "name": "Slime Rancher Multiplayer", - "version": "0.0.1510", - "author": "SatyPardus", - "dependencies": [ + "id": "srmp", + "name": "Slime Rancher Multiplayer", + "version": "0.0.1524", + "author": "SatyPardus", + "dependencies": [ + + ] +} - ] -} \ No newline at end of file diff --git a/SRMP/modinfo.tt b/SRMP/modinfo.tt new file mode 100644 index 0000000..5606eb7 --- /dev/null +++ b/SRMP/modinfo.tt @@ -0,0 +1,32 @@ +<#@ template debug="true" hostspecific="true" language="C#" #> +<#@ output extension=".json" #> +<#@ import namespace="System.IO" #> +<#@ import namespace="System.Text.RegularExpressions" #> +<# + string output = File.ReadAllText(this.Host.ResolvePath("Properties/AssemblyInfo.cs")); + Regex pattern = new Regex("AssemblyVersion\\(\"(?\\d+)\\.(?\\d+)\\.(?\\d+)\\.(?\\d+)\"\\)"); + MatchCollection matches = pattern.Matches(output); + if( matches.Count == 1 ) + { + major = Convert.ToInt32(matches[0].Groups["major"].Value); + minor = Convert.ToInt32(matches[0].Groups["minor"].Value); + build = Convert.ToInt32(matches[0].Groups["build"].Value); + revision = Convert.ToInt32(matches[0].Groups["revision"].Value); + } +#> +{ + "id": "srmp", + "name": "Slime Rancher Multiplayer", + "version": "0.0.<#= this.build #>", + "author": "SatyPardus", + "dependencies": [ + + ] +} + +<#+ + int major = 0; + int minor = 0; + int revision = 0; + int build = 0; +#> \ No newline at end of file