當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。