当前位置: 首页>>代码示例>>C#>>正文


C# System.OperatingSystem类代码示例

本文整理汇总了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;
        }
开发者ID:vidstige,项目名称:Bugsense.WPF,代码行数:26,代码来源:CrashInformationCollector.cs

示例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));
 }
开发者ID:BiYiTuan,项目名称:CruiseControl.NET,代码行数:7,代码来源:ProcessExecutorTests.cs

示例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;
        }
开发者ID:hunpody,项目名称:psimulex,代码行数:9,代码来源:OperatingSystemBuilder.cs

示例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();
        }
开发者ID:quwahara,项目名称:Nana,代码行数:34,代码来源:ILASMRunnerFxt.cs

示例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);
            }
        }
开发者ID:quwahara,项目名称:Nana,代码行数:30,代码来源:ILASMRunner.cs

示例6: ClientInformation

		public ClientInformation()
		{
			m_operatingSys = OperatingSystem.Win;
			m_architecture = ProcessorArchitecture.x86;
			Locale = ClientLocale.English;
			TimeZone = 0x258;
			IPAddress = new XmlIPAddress(System.Net.IPAddress.Loopback);
		}
开发者ID:Jeroz,项目名称:WCell,代码行数:8,代码来源:ClientInformation.cs

示例7: SystemInformation

 public SystemInformation()
 {
     m_Operating = OperatingSystem.Win;
     m_architecture = ProcessorArch.x86;
     Locale = "enUS";
     TimeZone = 0x258;
     IPAddress = new XmlIPAddress(System.Net.IPAddress.Loopback);
 }
开发者ID:KroneckerX,项目名称:WCell,代码行数:8,代码来源:SystemInformation.cs

示例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;
 }
开发者ID:rra-am1b-2015,项目名称:C-sharpTutorial,代码行数:9,代码来源:Smartphone.cs

示例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");
        }
开发者ID:toniertl1988,项目名称:cuddychat,代码行数:10,代码来源:ChatServer.cs

示例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();
        }
开发者ID:Geronimobile,项目名称:DotNetExamIntro,代码行数:10,代码来源:Program.cs

示例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());
     }
 }
开发者ID:MaMic,项目名称:IVI.C.NET.Adapter,代码行数:19,代码来源:Win32LibInterop.cs

示例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;
 }
开发者ID:ThomasBombadil,项目名称:NBench,代码行数:11,代码来源:SysInfo.cs

示例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(); 
		}
开发者ID:nicolasxu,项目名称:cSharp-knowledge,代码行数:12,代码来源:Interface_basic.cs

示例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);
 }
开发者ID:BiYiTuan,项目名称:CruiseControl.NET,代码行数:12,代码来源:ProcessExecutorTests.cs

示例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);
 }
开发者ID:BiYiTuan,项目名称:CruiseControl.NET,代码行数:12,代码来源:ProcessExecutorTests.cs


注:本文中的System.OperatingSystem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。