b1524 - Added Text Tranformation pipeline

This commit is contained in:
Saty 2023-12-29 23:56:40 +01:00
parent 286185bf1c
commit 256e2370a3
4 changed files with 59 additions and 12 deletions

View file

@ -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" )]

View file

@ -496,6 +496,10 @@
</ItemGroup>
<ItemGroup>
<Content Include="Console\Console Commands.txt" />
<Content Include="modinfo.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>modinfo.json</LastGenOutput>
</Content>
<Content Include="Properties\AssemblyInfo.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>AssemblyInfo.cs</LastGenOutput>
@ -513,7 +517,11 @@
<EmbeddedResource Include="srmultiplayer.dat" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="modinfo.json" />
<EmbeddedResource Include="modinfo.json">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>modinfo.tt</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
@ -521,7 +529,13 @@
</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PreBuildEvent>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"
)</PreBuildEvent>
</PropertyGroup>
</Project>

View file

@ -1,9 +1,10 @@
{
"id": "srmp",
"name": "Slime Rancher Multiplayer",
"version": "0.0.1510",
"version": "0.0.1524",
"author": "SatyPardus",
"dependencies": [
]
}

32
SRMP/modinfo.tt Normal file
View file

@ -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\\(\"(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<revision>\\d+)\\.(?<build>\\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;
#>