9using System.Reflection;
32 Version vi = Assembly.GetExecutingAssembly().GetName().Version;
38 private string applicationVersion;
52 get {
return applicationVersion; }
55 applicationVersion = value;
98 public string Title {
get;
set; }
117 private void CheckVersion()
119 if (
string.IsNullOrEmpty(applicationVersion))
121 string[] split = applicationVersion.Split(
'.');
123 if (split.Length != 2)
127 if (split[1].Length < 1 || split[1].Length > 5)
129 if (split[0].Length < 1 || split[0].Length > 5)
134 throw new FormatException(
"The format of the version in the metadata is wrong (" + applicationVersion +
"). Should be in the format and a range from '0.0' to '99999.99999'");
139 #region staticMethods
151 public static string ParseVersion(
int major,
int minor,
int build,
int revision)
153 if (major < 0 || minor < 0 || build < 0 || revision < 0)
155 throw new FormatException(
"The format of the passed version is wrong. No negative number allowed.");
159 throw new FormatException(
"The major number may not be bigger than 99999. The passed value is " + major);
163 rightPart = rightPart.TrimEnd(
'0');
168 if (rightPart.Length > 5)
170 rightPart = rightPart.Substring(0, 5);
173 return leftPart +
"." + rightPart;
Class providing static methods to parse string values to specific types or to print object as languag...
static string ToString(int input)
Transforms an integer to an invariant sting.