\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
{
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 : "";
return true;
}
catch (Exception)
{
return false;
}
}
public struct Version
{
public int Major;
public int Minor;
public int Patch;
public string Pre;
}
public const string MENU = "VRM1";
}
}