本文整理汇总了C#中System.OperatingSystem类的典型用法代码示例。如果您正苦于以下问题:C# OperatingSystem类的具体用法?C# OperatingSystem怎么用?C# OperatingSystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OperatingSystem类属于System命名空间,在下文中一共展示了OperatingSystem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetOSName
private static string GetOSName(OperatingSystem os)
{
Version version = os.Version;
// perform simple detection of OS
// TODO: more sophisticated detection; Windows 7 and Server 2008 have the same major/minor version number
string release;
if (version.Major == 5 && version.Minor == 1)
release = "XP";
else if (version.Major == 5 && version.Minor == 2)
release = "Server 2003";
else if (version.Major == 6 && version.Minor == 0)
release = "Vista";
else if (version.Major == 6 && version.Minor == 1)
release = "7";
else if (version.Major == 6 && version.Minor == 2)
release = "8";
else if (version.Major == 6 && version.Minor == 3)
release = "8.1";
else
release = version.ToString();
string servicePack = string.IsNullOrEmpty(os.ServicePack) ? "" : (" " + os.ServicePack.Replace("Service Pack ", "SP"));
return release + servicePack;
}
示例2: PopulateKillProcessThrowsExceptionForUnknownPlatform
public void PopulateKillProcessThrowsExceptionForUnknownPlatform()
{
var killProcess = new Process();
var operatingSystem = new OperatingSystem(PlatformID.Xbox, new Version(5, 0));
Assert.Throws<CruiseControlException>(
() => ProcessExecutor.PopulateKillProcess(killProcess, 1, operatingSystem));
}
示例3: CreateOSWithRoundRobin
//private static VapeTeam.Psimulex.Core.Historization.IHistory h = new Historization.History();
public static OperatingSystem CreateOSWithRoundRobin()
{
var os = new OperatingSystem(new Schedulers.RoundRobinScheduler());
os.ThreadFactory = new HistoricalThreadFactory(VapeTeam.Psimulex.Core.Historization.GlobalHistory.Instance);
os.InstallLibrary(new VapeTeam.Psimulex.Core.Libraries.StandardLibrary());
return os;
}
示例4: Test
public void Test()
{
new TestCase("", Inp, Epc, delegate(TestCase c_)
{
PlatformID pfm = (PlatformID)Enum.Parse(typeof(PlatformID), c_.Input);
Version ver;
OperatingSystem os;
try
{
ver = new Version();
os = new OperatingSystem(pfm, ver);
}
catch (Exception exver)
{
c_.Expected = exver.Message;
return exver.Message;
}
ILASMRunner r = new ILASMRunner();
string act = "";
try
{
r.DetectILASM(os);
act = r.ILASMpath;
}
catch (Exception ex)
{
c_.Expected = ex.Message;
act = ex.Message;
}
return act;
})
.Run();
}
示例5: DetectILASM
public void DetectILASM(OperatingSystem os)
{
if (ILASMpath == null)
{
ILASMpath = Environment.GetEnvironmentVariable(@"NANA_ILASM_PATH");
}
if (ILASMpath == null)
{
PlatformID pfm = os.Platform;
switch (pfm)
{
case PlatformID.MacOSX:
case PlatformID.Unix:
ILASMpath = "/usr/bin/ilasm";
break;
default:
string l = Path.DirectorySeparatorChar.ToString();
string systemRoot = Environment.GetEnvironmentVariable("SystemRoot");
string netfwdir = systemRoot + l + @"Microsoft.NET\Framework\v2.0.50727";
ILASMpath = netfwdir + l + @"ilasm.exe";
break;
}
}
if (false == File.Exists(ILASMpath))
{
throw new Exception("Could not detect ilasm.exe. You can set ilasm.exe path to environment variable 'NANA_ILASM_PATH'. Detected path:" + ILASMpath);
}
}
示例6: ClientInformation
public ClientInformation()
{
m_operatingSys = OperatingSystem.Win;
m_architecture = ProcessorArchitecture.x86;
Locale = ClientLocale.English;
TimeZone = 0x258;
IPAddress = new XmlIPAddress(System.Net.IPAddress.Loopback);
}
示例7: SystemInformation
public SystemInformation()
{
m_Operating = OperatingSystem.Win;
m_architecture = ProcessorArch.x86;
Locale = "enUS";
TimeZone = 0x258;
IPAddress = new XmlIPAddress(System.Net.IPAddress.Loopback);
}
示例8: Smartphone
// Constructor
public Smartphone(string brand, float price, OperatingSystem operatingSystem, string versionOS, short memoryCapacity)
{
this.brand = brand;
this.price = price;
this.operatingSystem = operatingSystem;
this.versionOS = versionOS;
this.memoryCapacity = memoryCapacity;
}
示例9: AddUser
public static void AddUser(TcpClient tcpUser, string strUsername, Encryption encryption, OperatingSystem operatingSystem)
{
// create new user
User user = new User(strUsername, tcpUser, encryption, DateTime.Now, operatingSystem);
ChatServer.users.Add(strUsername);
ChatServer.userInfos.Add(strUsername, user);
SendAdminMessage(strUsername + " has joined us");
}
示例10: Main
static void Main(string[] args) {
string myStr = "Hello";
OperatingSystem os = new OperatingSystem(PlatformID.Unix, new Version());
System.Data.SqlClient.SqlConnection sqlCnn = new System.Data.SqlClient.SqlConnection();
CloneMe(myStr);
CloneMe(os);
CloneMe(sqlCnn);
Console.ReadLine();
}
示例11: IsWin64BitOS
/// <summary>
/// The function determines whether the current operating system is a
/// 64-bit operating system.
/// </summary>
/// <returns>
/// The function returns true if the operating system is 64-bit;
/// otherwise, it returns false.
/// </returns>
public static bool IsWin64BitOS(OperatingSystem os)
{
if (IntPtr.Size == 8)
// 64-bit programs run only on Win64
return true;
else// 32-bit programs run on both 32-bit and 64-bit Windows
{ // Detect whether the current process is a 32-bit process
// running on a 64-bit system.
return Is64BitProc(Process.GetCurrentProcess());
}
}
示例12: SysInfo
private SysInfo(OperatingSystem os, Version clrVersion, int processorCount, int workerThreads, int ioThreads, int maxGcGeneration, bool isMono)
{
OS = os;
ProcessorCount = processorCount;
WorkerThreads = workerThreads;
IOThreads = ioThreads;
IsMono = isMono;
ClrVersion = clrVersion;
MaxGcGeneration = maxGcGeneration;
NBenchAssemblyVersion = this.GetType().Assembly.FullName;
}
示例13: Main
static void Main( string[] args)
{ Console.WriteLine("***** A First Look at Interfaces *****\ n");
// All of these classes support the ICloneable interface.
string myStr = "Hello";
OperatingSystem unixOS = new OperatingSystem( PlatformID.Unix, new Version());
System.Data.SqlClient.SqlConnection sqlCnn = new System.Data.SqlClient.SqlConnection();
// Therefore, they can all be passed into a method taking ICloneable.
CloneMe( myStr);
CloneMe( unixOS);
CloneMe( sqlCnn);
Console.ReadLine();
}
示例14: PopulateKillProcessHandlesWindows2000
public void PopulateKillProcessHandlesWindows2000()
{
var killProcess = new Process();
var operatingSystem = new OperatingSystem(PlatformID.Win32NT, new Version(5, 0));
var platform = ProcessExecutor.PopulateKillProcess(killProcess, 1, operatingSystem);
Assert.AreEqual("Windows", platform);
var expectedPath = Path.Combine(
ProcessExecutor.Win2KSupportToolsDir,
"kill.exe");
Assert.AreEqual(expectedPath, killProcess.StartInfo.FileName);
Assert.AreEqual("-f 1", killProcess.StartInfo.Arguments);
}
示例15: PopulateKillProcessHandlesWindows
public void PopulateKillProcessHandlesWindows()
{
var killProcess = new Process();
var operatingSystem = new OperatingSystem(PlatformID.Win32NT, new Version(7, 0));
var platform = ProcessExecutor.PopulateKillProcess(killProcess, 1, operatingSystem);
Assert.AreEqual("Windows", platform);
var expectedPath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.System),
"taskkill.exe");
Assert.AreEqual(expectedPath, killProcess.StartInfo.FileName);
Assert.AreEqual("/pid 1 /t /f", killProcess.StartInfo.Arguments);
}