using System;
using System.Runtime.InteropServices;
namespace System
{
/// Represents the version number for an assembly, operating system, or the common language runtime. This class cannot be inherited.
/// 1
// Token: 0x020006C0 RID: 1728
[ComVisible(true)]
[Serializable]
public sealed class Version : IComparable, ICloneable, IComparable, IEquatable
{
/// Initializes a new instance of the class.
// Token: 0x0600411B RID: 16667 RVA: 0x000DDE1C File Offset: 0x000DC01C
public Version()
{
this.CheckedSet(2, 0, 0, -1, -1);
}
/// Initializes a new instance of the class using the specified string.
/// A string containing the major, minor, build, and revision numbers, where each number is delimited with a period character ('.').
///
/// has fewer than two components or more than four components.
///
/// is null.
/// A major, minor, build, or revision component is less than zero.
/// At least one component of does not parse to an integer.
/// At least one component of represents a number greater than .
// Token: 0x0600411C RID: 16668 RVA: 0x000DDE3C File Offset: 0x000DC03C
public Version(string version)
{
int num = -1;
int num2 = -1;
int num3 = -1;
int num4 = -1;
if (version == null)
{
throw new ArgumentNullException("version");
}
string[] array = version.Split(new char[] { '.' });
int num5 = array.Length;
if (num5 < 2 || num5 > 4)
{
throw new ArgumentException(Locale.GetText("There must be 2, 3 or 4 components in the version string."));
}
if (num5 > 0)
{
num = int.Parse(array[0]);
}
if (num5 > 1)
{
num2 = int.Parse(array[1]);
}
if (num5 > 2)
{
num3 = int.Parse(array[2]);
}
if (num5 > 3)
{
num4 = int.Parse(array[3]);
}
this.CheckedSet(num5, num, num2, num3, num4);
}
/// Initializes a new instance of the class using the specified major and minor values.
/// The major version number.
/// The minor version number.
///
/// or is less than zero.
// Token: 0x0600411D RID: 16669 RVA: 0x000DDEF0 File Offset: 0x000DC0F0
public Version(int major, int minor)
{
this.CheckedSet(2, major, minor, 0, 0);
}
/// Initializes a new instance of the class using the specified major, minor, and build values.
/// The major version number.
/// The minor version number.
/// The build number.
///
/// , , or is less than zero.
// Token: 0x0600411E RID: 16670 RVA: 0x000DDF10 File Offset: 0x000DC110
public Version(int major, int minor, int build)
{
this.CheckedSet(3, major, minor, build, 0);
}
/// Initializes a new instance of the class with the specified major, minor, build, and revision numbers.
/// The major version number.
/// The minor version number.
/// The build number.
/// The revision number.
///
/// , , , or is less than zero.
// Token: 0x0600411F RID: 16671 RVA: 0x000DDF30 File Offset: 0x000DC130
public Version(int major, int minor, int build, int revision)
{
this.CheckedSet(4, major, minor, build, revision);
}
// Token: 0x06004120 RID: 16672 RVA: 0x000DDF50 File Offset: 0x000DC150
private void CheckedSet(int defined, int major, int minor, int build, int revision)
{
if (major < 0)
{
throw new ArgumentOutOfRangeException("major");
}
this._Major = major;
if (minor < 0)
{
throw new ArgumentOutOfRangeException("minor");
}
this._Minor = minor;
if (defined == 2)
{
this._Build = -1;
this._Revision = -1;
return;
}
if (build < 0)
{
throw new ArgumentOutOfRangeException("build");
}
this._Build = build;
if (defined == 3)
{
this._Revision = -1;
return;
}
if (revision < 0)
{
throw new ArgumentOutOfRangeException("revision");
}
this._Revision = revision;
}
/// Gets the value of the build component of the version number for the current object.
/// The build number, or -1 if the build number is undefined.
/// 1
// Token: 0x17000C04 RID: 3076
// (get) Token: 0x06004121 RID: 16673 RVA: 0x000DDFEC File Offset: 0x000DC1EC
public int Build
{
get
{
return this._Build;
}
}
/// Gets the value of the major component of the version number for the current object.
/// The major version number.
/// 1
// Token: 0x17000C05 RID: 3077
// (get) Token: 0x06004122 RID: 16674 RVA: 0x000DDFF4 File Offset: 0x000DC1F4
public int Major
{
get
{
return this._Major;
}
}
/// Gets the value of the minor component of the version number for the current object.
/// The minor version number.
/// 1
// Token: 0x17000C06 RID: 3078
// (get) Token: 0x06004123 RID: 16675 RVA: 0x000DDFFC File Offset: 0x000DC1FC
public int Minor
{
get
{
return this._Minor;
}
}
/// Gets the value of the revision component of the version number for the current object.
/// The revision number, or -1 if the revision number is undefined.
/// 1
// Token: 0x17000C07 RID: 3079
// (get) Token: 0x06004124 RID: 16676 RVA: 0x000DE004 File Offset: 0x000DC204
public int Revision
{
get
{
return this._Revision;
}
}
/// Gets the high 16 bits of the revision number.
/// A 16-bit signed integer.
// Token: 0x17000C08 RID: 3080
// (get) Token: 0x06004125 RID: 16677 RVA: 0x000DE00C File Offset: 0x000DC20C
public short MajorRevision
{
get
{
return (short)(this._Revision >> 16);
}
}
/// Gets the low 16 bits of the revision number.
/// A 16-bit signed integer.
// Token: 0x17000C09 RID: 3081
// (get) Token: 0x06004126 RID: 16678 RVA: 0x000DE018 File Offset: 0x000DC218
public short MinorRevision
{
get
{
return (short)this._Revision;
}
}
/// Returns a new object whose value is the same as the current object.
/// A new whose values are a copy of the current object.
/// 2
// Token: 0x06004127 RID: 16679 RVA: 0x000DE024 File Offset: 0x000DC224
public object Clone()
{
if (this._Build == -1)
{
return new Version(this._Major, this._Minor);
}
if (this._Revision == -1)
{
return new Version(this._Major, this._Minor, this._Build);
}
return new Version(this._Major, this._Minor, this._Build, this._Revision);
}
/// Compares the current object to a specified object and returns an indication of their relative values.
/// Return Value Description Less than zero The current object is a version before . Zero The current object is the same version as . Greater than zero The current object is a version subsequent to .-or- is null.
/// An object to compare, or null.
///
/// is not of type .
/// 1
// Token: 0x06004128 RID: 16680 RVA: 0x000DE090 File Offset: 0x000DC290
public int CompareTo(object version)
{
if (version == null)
{
return 1;
}
if (!(version is Version))
{
throw new ArgumentException(Locale.GetText("Argument to Version.CompareTo must be a Version."));
}
return this.CompareTo((Version)version);
}
/// Returns a value indicating whether the current object is equal to a specified object.
/// true if the current object and are both objects, and every component of the current object matches the corresponding component of ; otherwise, false.
/// An object to compare with the current object, or null.
/// 1
// Token: 0x06004129 RID: 16681 RVA: 0x000DE0C4 File Offset: 0x000DC2C4
public override bool Equals(object obj)
{
return this.Equals(obj as Version);
}
/// Compares the current object to a specified object and returns an indication of their relative values.
/// Return Value Description Less than zero The current object is a version before . Zero The current object is the same version as . Greater than zero The current object is a version subsequent to . -or- is null.
/// A object to compare to the current object, or null.
/// 1
// Token: 0x0600412A RID: 16682 RVA: 0x000DE0D4 File Offset: 0x000DC2D4
public int CompareTo(Version value)
{
if (value == null)
{
return 1;
}
if (this._Major > value._Major)
{
return 1;
}
if (this._Major < value._Major)
{
return -1;
}
if (this._Minor > value._Minor)
{
return 1;
}
if (this._Minor < value._Minor)
{
return -1;
}
if (this._Build > value._Build)
{
return 1;
}
if (this._Build < value._Build)
{
return -1;
}
if (this._Revision > value._Revision)
{
return 1;
}
if (this._Revision < value._Revision)
{
return -1;
}
return 0;
}
/// Returns a value indicating whether the current object and a specified object represent the same value.
/// true if every component of the current object matches the corresponding component of the parameter; otherwise, false.
/// A object to compare to the current object, or null.
/// 1
// Token: 0x0600412B RID: 16683 RVA: 0x000DE188 File Offset: 0x000DC388
public bool Equals(Version obj)
{
return obj != null && obj._Major == this._Major && obj._Minor == this._Minor && obj._Build == this._Build && obj._Revision == this._Revision;
}
/// Returns a hash code for the current object.
/// A 32-bit signed integer hash code.
/// 2
// Token: 0x0600412C RID: 16684 RVA: 0x000DE1E8 File Offset: 0x000DC3E8
public override int GetHashCode()
{
return (this._Revision << 24) | (this._Build << 16) | (this._Minor << 8) | this._Major;
}
/// Converts the value of the current object to its equivalent representation.
/// The representation of the values of the major, minor, build, and revision components of the current object, as depicted in the following format. Each component is separated by a period character ('.'). Square brackets ('[' and ']') indicate a component that will not appear in the return value if the component is not defined: major.minor[.build[.revision]] For example, if you create a object using the constructor Version(1,1), the returned string is "1.1". If you create a object using the constructor Version(1,3,4,2), the returned string is "1.3.4.2".
/// 1
// Token: 0x0600412D RID: 16685 RVA: 0x000DE210 File Offset: 0x000DC410
public override string ToString()
{
string text = this._Major.ToString() + "." + this._Minor.ToString();
if (this._Build != -1)
{
text = text + "." + this._Build.ToString();
}
if (this._Revision != -1)
{
text = text + "." + this._Revision.ToString();
}
return text;
}
/// Converts the value of the current object to its equivalent representation. A specified count indicates the number of components to return.
/// The representation of the values of the major, minor, build, and revision components of the current object, each separated by a period character ('.'). The parameter determines how many components are returned.fieldCount Return Value 0 An empty string (""). 1 major 2 major.minor 3 major.minor.build 4 major.minor.build.revision For example, if you create object using the constructor Version(1,3,5), ToString(2) returns "1.3" and ToString(4) throws an exception.
/// The number of components to return. The ranges from 0 to 4.
///
/// is less than 0, or more than 4.-or- is more than the number of components defined in the current object.
/// 1
// Token: 0x0600412E RID: 16686 RVA: 0x000DE288 File Offset: 0x000DC488
public string ToString(int fieldCount)
{
if (fieldCount == 0)
{
return string.Empty;
}
if (fieldCount == 1)
{
return this._Major.ToString();
}
if (fieldCount == 2)
{
return this._Major.ToString() + "." + this._Minor.ToString();
}
if (fieldCount == 3)
{
if (this._Build == -1)
{
throw new ArgumentException(Locale.GetText("fieldCount is larger than the number of components defined in this instance."));
}
return string.Concat(new string[]
{
this._Major.ToString(),
".",
this._Minor.ToString(),
".",
this._Build.ToString()
});
}
else
{
if (fieldCount != 4)
{
throw new ArgumentException(Locale.GetText("Invalid fieldCount parameter: ") + fieldCount.ToString());
}
if (this._Build == -1 || this._Revision == -1)
{
throw new ArgumentException(Locale.GetText("fieldCount is larger than the number of components defined in this instance."));
}
return string.Concat(new string[]
{
this._Major.ToString(),
".",
this._Minor.ToString(),
".",
this._Build.ToString(),
".",
this._Revision.ToString()
});
}
}
// Token: 0x0600412F RID: 16687 RVA: 0x000DE3EC File Offset: 0x000DC5EC
internal static Version CreateFromString(string info)
{
int num = 0;
int num2 = 0;
int num3 = 0;
int num4 = 0;
int num5 = 1;
int num6 = -1;
if (info == null)
{
return new Version(0, 0, 0, 0);
}
foreach (char c in info)
{
if (char.IsDigit(c))
{
if (num6 < 0)
{
num6 = (int)(c - '0');
}
else
{
num6 = num6 * 10 + (int)(c - '0');
}
}
else if (num6 >= 0)
{
switch (num5)
{
case 1:
num = num6;
break;
case 2:
num2 = num6;
break;
case 3:
num3 = num6;
break;
case 4:
num4 = num6;
break;
}
num6 = -1;
num5++;
}
if (num5 == 5)
{
break;
}
}
if (num6 >= 0)
{
switch (num5)
{
case 1:
num = num6;
break;
case 2:
num2 = num6;
break;
case 3:
num3 = num6;
break;
case 4:
num4 = num6;
break;
}
}
return new Version(num, num2, num3, num4);
}
/// Determines whether two specified objects are equal.
/// true if equals ; otherwise, false.
/// The first object.
/// The second object.
/// 3
// Token: 0x06004130 RID: 16688 RVA: 0x000DE524 File Offset: 0x000DC724
public static bool operator ==(Version v1, Version v2)
{
return object.Equals(v1, v2);
}
/// Determines whether two specified objects are not equal.
/// true if does not equal ; otherwise, false.
/// The first object.
/// The second object.
/// 3
// Token: 0x06004131 RID: 16689 RVA: 0x000DE530 File Offset: 0x000DC730
public static bool operator !=(Version v1, Version v2)
{
return !object.Equals(v1, v2);
}
/// Determines whether the first specified object is greater than the second specified object.
/// true if is greater than ; otherwise, false.
/// The first object.
/// The second object.
/// 3
// Token: 0x06004132 RID: 16690 RVA: 0x000DE53C File Offset: 0x000DC73C
public static bool operator >(Version v1, Version v2)
{
return v1.CompareTo(v2) > 0;
}
/// Determines whether the first specified object is greater than or equal to the second specified object.
/// true if is greater than or equal to ; otherwise, false.
/// The first object.
/// The second object.
/// 3
// Token: 0x06004133 RID: 16691 RVA: 0x000DE548 File Offset: 0x000DC748
public static bool operator >=(Version v1, Version v2)
{
return v1.CompareTo(v2) >= 0;
}
/// Determines whether the first specified object is less than the second specified object.
/// true if is less than ; otherwise, false.
/// The first object.
/// The second object.
///
/// is null.
/// 3
// Token: 0x06004134 RID: 16692 RVA: 0x000DE558 File Offset: 0x000DC758
public static bool operator <(Version v1, Version v2)
{
return v1.CompareTo(v2) < 0;
}
/// Determines whether the first specified object is less than or equal to the second object.
/// true if is less than or equal to ; otherwise, false.
/// The first object.
/// The second object.
///
/// is null.
/// 3
// Token: 0x06004135 RID: 16693 RVA: 0x000DE564 File Offset: 0x000DC764
public static bool operator <=(Version v1, Version v2)
{
return v1.CompareTo(v2) <= 0;
}
// Token: 0x04001A3B RID: 6715
private const int UNDEFINED = -1;
// Token: 0x04001A3C RID: 6716
private int _Major;
// Token: 0x04001A3D RID: 6717
private int _Minor;
// Token: 0x04001A3E RID: 6718
private int _Build;
// Token: 0x04001A3F RID: 6719
private int _Revision;
}
}