UniVRM/Scripts/Format/VRMVersionPartial.cs
2018-05-25 16:44:42 +09:00

52 lines
1.1 KiB
C#

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;
}
}
}
}