\d+))?(-(?[0-9A-Za-z-]+))?");
+
+ public static bool ParseVersion(string version, out Version v)
+ {
+ var match = VersionSpec.Match(version);
+ if (!match.Success)
+ {
+ v = new Version();
+ return false;
+ }
+
+ v = new Version();
try
{
- var major = int.Parse(splited[0]);
- var minor = int.Parse(splited[1]);
+ v.Major = int.Parse(match.Groups["major"].Value);
+ v.Minor = int.Parse(match.Groups["minor"].Value);
+ v.Patch = match.Groups["patch"].Success ? int.Parse(match.Groups["patch"].Value) : 0;
+ v.Pre = match.Groups["pre"].Success ? match.Groups["pre"].Value : "";
- if (major < MAJOR)
- {
- return false;
- }
- else if (major > MAJOR)
- {
- return true;
- }
- else
- {
- return minor > MINOR;
- }
+ return true;
}
- catch (Exception)
+ catch (Exception e)
{
return false;
}
}
+ public struct Version
+ {
+ public int Major;
+ public int Minor;
+ public int Patch;
+ public string Pre;
+ }
+
public const string VRM_VERSION = "UniVRM-" + VERSION;
public const string MENU = "VRM/" + VRM_VERSION;
}