mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-11 04:54:17 -05:00
IncrementVersion
This commit is contained in:
parent
553dd75e50
commit
689fbe3ca9
|
|
@ -10,7 +10,7 @@ namespace VRM
|
|||
const string template = @"
|
||||
namespace VRM
|
||||
{{
|
||||
public static class VRMVersion
|
||||
public static partial class VRMVersion
|
||||
{{
|
||||
public const int MAJOR = {0};
|
||||
public const int MINOR = {1};
|
||||
|
|
|
|||
|
|
@ -1,59 +1,14 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace VRM
|
||||
{
|
||||
public static class VRMVersion
|
||||
public static partial class VRMVersion
|
||||
{
|
||||
public const int MAJOR = 0;
|
||||
public const int MINOR = 36;
|
||||
public const int MINOR = 37;
|
||||
|
||||
public const string VERSION = "0.36";
|
||||
public const string VERSION = "0.37";
|
||||
|
||||
public const string DecrementMenuName = "VRM/Version(0.36) Decrement";
|
||||
public const string IncrementMenuName = "VRM/Version(0.36) Increment";
|
||||
|
||||
public static bool IsNewer(string version)
|
||||
{
|
||||
if (string.IsNullOrEmpty(version))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var prefix = "UniVRM-";
|
||||
if (version.StartsWith(prefix))
|
||||
{
|
||||
version = version.Substring(prefix.Length);
|
||||
}
|
||||
|
||||
var splited = version.Split('.');
|
||||
if (splited.Length < 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var major = int.Parse(splited[0]);
|
||||
var minor = int.Parse(splited[1]);
|
||||
|
||||
if (major < MAJOR)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (major > MAJOR)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return minor > MINOR;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public const string DecrementMenuName = "VRM/Version(0.37) Decrement";
|
||||
public const string IncrementMenuName = "VRM/Version(0.37) Increment";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
51
Scripts/Format/VRMVersionPartial.cs
Normal file
51
Scripts/Format/VRMVersionPartial.cs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace VRM
|
||||
{
|
||||
public static partial class VRMVersion
|
||||
{
|
||||
public static bool IsNewer(string version)
|
||||
{
|
||||
if (string.IsNullOrEmpty(version))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var prefix = "UniVRM-";
|
||||
if (version.StartsWith(prefix))
|
||||
{
|
||||
version = version.Substring(prefix.Length);
|
||||
}
|
||||
|
||||
var splited = version.Split('.');
|
||||
if (splited.Length < 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var major = int.Parse(splited[0]);
|
||||
var minor = int.Parse(splited[1]);
|
||||
|
||||
if (major < MAJOR)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (major > MAJOR)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return minor > MINOR;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Scripts/Format/VRMVersionPartial.cs.meta
Normal file
13
Scripts/Format/VRMVersionPartial.cs.meta
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4ab9ac9856a4d4c4aa652c07c5b496e6
|
||||
timeCreated: 1522130257
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Reference in New Issue
Block a user