SRMP-Public/SRMP/modinfo.tt

32 lines
No EOL
1,019 B
Text

<#@ 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;
#>