160 lines
6.1 KiB
C#
160 lines
6.1 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using System.Runtime.Serialization;
|
|
|
|
namespace System
|
|
{
|
|
/// <summary>Represents information about an operating system, such as the version and platform identifier. This class cannot be inherited.</summary>
|
|
/// <filterpriority>2</filterpriority>
|
|
// Token: 0x0200069B RID: 1691
|
|
[ComVisible(true)]
|
|
[Serializable]
|
|
public sealed class OperatingSystem : ICloneable, ISerializable
|
|
{
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.OperatingSystem" /> class, using the specified platform identifier value and version object.</summary>
|
|
/// <param name="platform">One of the <see cref="T:System.PlatformID" /> values that indicates the operating system platform. </param>
|
|
/// <param name="version">A <see cref="T:System.Version" /> object that indicates the version of the operating system. </param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="version" /> is null. </exception>
|
|
/// <exception cref="T:System.ArgumentException">
|
|
/// <paramref name="platform" /> is not a <see cref="T:System.PlatformID" /> enumeration value.</exception>
|
|
// Token: 0x06004054 RID: 16468 RVA: 0x000DB6A8 File Offset: 0x000D98A8
|
|
public OperatingSystem(PlatformID platform, Version version)
|
|
{
|
|
if (version == null)
|
|
{
|
|
throw new ArgumentNullException("version");
|
|
}
|
|
this._platform = platform;
|
|
this._version = version;
|
|
}
|
|
|
|
/// <summary>Gets a <see cref="T:System.PlatformID" /> enumeration value that identifies the operating system platform.</summary>
|
|
/// <returns>One of the <see cref="T:System.PlatformID" /> values.</returns>
|
|
/// <filterpriority>2</filterpriority>
|
|
// Token: 0x17000BE2 RID: 3042
|
|
// (get) Token: 0x06004055 RID: 16469 RVA: 0x000DB6EC File Offset: 0x000D98EC
|
|
public PlatformID Platform
|
|
{
|
|
get
|
|
{
|
|
return this._platform;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets a <see cref="T:System.Version" /> object that identifies the operating system.</summary>
|
|
/// <returns>A <see cref="T:System.Version" /> object that describes the major version, minor version, build, and revision numbers for the operating system.</returns>
|
|
/// <filterpriority>2</filterpriority>
|
|
// Token: 0x17000BE3 RID: 3043
|
|
// (get) Token: 0x06004056 RID: 16470 RVA: 0x000DB6F4 File Offset: 0x000D98F4
|
|
public Version Version
|
|
{
|
|
get
|
|
{
|
|
return this._version;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets the service pack version represented by this <see cref="T:System.OperatingSystem" /> object.</summary>
|
|
/// <returns>The service pack version, if service packs are supported and at least one is installed; otherwise, an empty string (""). </returns>
|
|
/// <filterpriority>2</filterpriority>
|
|
// Token: 0x17000BE4 RID: 3044
|
|
// (get) Token: 0x06004057 RID: 16471 RVA: 0x000DB6FC File Offset: 0x000D98FC
|
|
public string ServicePack
|
|
{
|
|
get
|
|
{
|
|
return this._servicePack;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets the concatenated string representation of the platform identifier, version, and service pack that are currently installed on the operating system. </summary>
|
|
/// <returns>The string representation of the values returned by the <see cref="P:System.OperatingSystem.Platform" />, <see cref="P:System.OperatingSystem.Version" />, and <see cref="P:System.OperatingSystem.ServicePack" /> properties.</returns>
|
|
/// <filterpriority>2</filterpriority>
|
|
// Token: 0x17000BE5 RID: 3045
|
|
// (get) Token: 0x06004058 RID: 16472 RVA: 0x000DB704 File Offset: 0x000D9904
|
|
public string VersionString
|
|
{
|
|
get
|
|
{
|
|
return this.ToString();
|
|
}
|
|
}
|
|
|
|
/// <summary>Creates an <see cref="T:System.OperatingSystem" /> object that is identical to this instance.</summary>
|
|
/// <returns>An <see cref="T:System.OperatingSystem" /> object that is a copy of this instance.</returns>
|
|
/// <filterpriority>2</filterpriority>
|
|
// Token: 0x06004059 RID: 16473 RVA: 0x000DB70C File Offset: 0x000D990C
|
|
public object Clone()
|
|
{
|
|
return new OperatingSystem(this._platform, this._version);
|
|
}
|
|
|
|
/// <summary>Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object with the data necessary to deserialize this instance.</summary>
|
|
/// <param name="info">The object to populate with serialization information.</param>
|
|
/// <param name="context">The place to store and retrieve serialized data. Reserved for future use.</param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="info" /> is null. </exception>
|
|
/// <filterpriority>2</filterpriority>
|
|
// Token: 0x0600405A RID: 16474 RVA: 0x000DB720 File Offset: 0x000D9920
|
|
public void GetObjectData(SerializationInfo info, StreamingContext context)
|
|
{
|
|
info.AddValue("_platform", this._platform);
|
|
info.AddValue("_version", this._version);
|
|
info.AddValue("_servicePack", this._servicePack);
|
|
}
|
|
|
|
/// <summary>Converts the value of this <see cref="T:System.OperatingSystem" /> object to its equivalent string representation.</summary>
|
|
/// <returns>The string representation of the values returned by the <see cref="P:System.OperatingSystem.Platform" />, <see cref="P:System.OperatingSystem.Version" />, and <see cref="P:System.OperatingSystem.ServicePack" /> properties.</returns>
|
|
/// <filterpriority>2</filterpriority>
|
|
// Token: 0x0600405B RID: 16475 RVA: 0x000DB768 File Offset: 0x000D9968
|
|
public override string ToString()
|
|
{
|
|
int platform = (int)this._platform;
|
|
string text;
|
|
switch (platform)
|
|
{
|
|
case 0:
|
|
text = "Microsoft Win32S";
|
|
goto IL_96;
|
|
case 1:
|
|
text = "Microsoft Windows 98";
|
|
goto IL_96;
|
|
case 2:
|
|
text = "Microsoft Windows NT";
|
|
goto IL_96;
|
|
case 3:
|
|
text = "Microsoft Windows CE";
|
|
goto IL_96;
|
|
case 4:
|
|
break;
|
|
case 5:
|
|
text = "XBox";
|
|
goto IL_96;
|
|
case 6:
|
|
text = "OSX";
|
|
goto IL_96;
|
|
default:
|
|
if (platform != 128)
|
|
{
|
|
text = Locale.GetText("<unknown>");
|
|
goto IL_96;
|
|
}
|
|
break;
|
|
}
|
|
text = "Unix";
|
|
IL_96:
|
|
return text + " " + this._version.ToString();
|
|
}
|
|
|
|
// Token: 0x04001991 RID: 6545
|
|
private PlatformID _platform;
|
|
|
|
// Token: 0x04001992 RID: 6546
|
|
private Version _version;
|
|
|
|
// Token: 0x04001993 RID: 6547
|
|
private string _servicePack = string.Empty;
|
|
}
|
|
}
|