• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# System.OperatingSystem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.OperatingSystem的典型用法代码示例。如果您正苦于以下问题:C# OperatingSystem类的具体用法?C# OperatingSystem怎么用?C# OperatingSystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



OperatingSystem类属于System命名空间,在下文中一共展示了OperatingSystem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: Main

        static void Main(string[] args)
        {
            string myString = "Hello";
            OperatingSystem unixOS = new OperatingSystem(PlatformID.Unix, new Version());
            SqlConnection sqlConn = new SqlConnection();

            CloneMe(myString);
            CloneMe(unixOS);
            CloneMe(sqlConn);

            Console.ReadLine();
        }
开发者ID:Shevstudy,项目名称:ShevStudy,代码行数:12,代码来源:Program.cs


示例17: Main

        static void Main(string[] args)
        {
            Console.WriteLine("***** A First Look at Interfaces *****\n");
            string myStr = "Hello";
            OperatingSystem unixOS = new OperatingSystem(PlatformID.Unix, new Version());
            SqlConnection sqlCnn = new SqlConnection();

            CloneMe(myStr);
            CloneMe(unixOS);
            CloneMe(sqlCnn);

            Console.ReadLine();
        }
开发者ID:volkoff-pro,项目名称:Troelsen.CSharp,代码行数:13,代码来源:Program.cs


示例18: AppliesTo

 public bool AppliesTo(OperatingSystem os)
 {
     if (OSType != os.Platform) return false;
     switch (Rule)
     {
         case FilterRules.Any:
             return true;
         case FilterRules.Equals:
             return os.Version == new Version(Version);
         case FilterRules.LessThan:
             return os.Version < new Version(Version);
         case FilterRules.GreaterThan:
             return os.Version > new Version(Version);
     }
     return false;
 }
开发者ID:CHOUAiB,项目名称:ModularFramework,代码行数:16,代码来源:OSFilterAttribute.cs


示例19: Main

        static void Main(string[] args)
        {
            string myStr = "Hello";
            OperatingSystem unixOS = new OperatingSystem(PlatformID.Unix, new Version());
            System.Data.SqlClient.SqlConnection sqlCnn = new System.Data.SqlClient.SqlConnection();

            CloneMe(myStr);
            CloneMe(unixOS);
            CloneMe(sqlCnn);

            InterfaceCloneable[] ainterface = { new CloneA(), new CloneB() };

            var file = @"C:\Users\sn01396\Desktop\柱温箱发送方法失败.txt";
            using (FileStream fs = new FileStream(file, FileMode.Open))
            {
                using (StreamReader sr = new StreamReader(fs))
                {
                    var num = 0;
                    while (!sr.EndOfStream)
                    {
                        num++;
                        var str = sr.ReadLine();
                        var key = "7F FE 00 01 00 ";
                        var len = key.Length;
                        var index = str.IndexOf(key);
                        if (index != -1 && index + len + 2 <= str.Length)
                        {
                            var next = str.Substring(index + len, 2);
                            Console.WriteLine("源地址:" + next);
                            if (next != "28")
                            {
                                Console.WriteLine("出错在:" + num);
                            }
                        }
                    }
                }
            }



            Console.ReadLine();
        }
开发者ID:newhuaszh,项目名称:WPF,代码行数:42,代码来源:Program.cs


示例20: tsWeaponAccessoryAddGear_Click

        private void tsWeaponAccessoryAddGear_Click(object sender, EventArgs e)
        {
            WeaponAccessory objAccessory = (WeaponAccessory)_objFunctions.FindEquipment(treWeapons.SelectedNode.Tag.ToString(), _objCharacter.Weapons, typeof(WeaponAccessory));

            // Make sure the Weapon Accessory is allowed to accept Gear.
            if (objAccessory.AllowGear == null)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_WeaponGear"), LanguageManager.Instance.GetString("MessageTitle_CyberwareGear"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            frmSelectGear frmPickGear = new frmSelectGear(_objCharacter, false);
            string strCategories = "";
            foreach (XmlNode objXmlCategory in objAccessory.AllowGear)
                strCategories += objXmlCategory.InnerText + ",";
            frmPickGear.AllowedCategories = strCategories;
            frmPickGear.ShowDialog(this);

            if (frmPickGear.DialogResult == DialogResult.Cancel)
                return;

            TreeNode objNode = new TreeNode();

            // Open the Gear XML file and locate the selected piece.
            XmlDocument objXmlDocument = XmlManager.Instance.Load("gear.xml");
            XmlNode objXmlGear = objXmlDocument.SelectSingleNode("/chummer/gears/gear[id = \"" + frmPickGear.SelectedGear + "\"]");

            // Create the new piece of Gear.
            List<Weapon> objWeapons = new List<Weapon>();
            List<TreeNode> objWeaponNodes = new List<TreeNode>();
            Gear objNewGear = new Gear(_objCharacter);
            switch (frmPickGear.SelectedCategory)
            {
                case "Commlink":
                case "Commlink Upgrade":
                    Commlink objCommlink = new Commlink(_objCharacter);
                    objCommlink.Create(objXmlGear, _objCharacter, objNode, frmPickGear.SelectedRating);
                    objCommlink.Quantity = frmPickGear.SelectedQty;
                    try
                    {
                        _blnSkipRefresh = true;
                        nudGearQty.Increment = objCommlink.CostFor;
                        //nudGearQty.Minimum = nudGearQty.Increment;
                        _blnSkipRefresh = false;
                    }
                    catch
                    {
                    }
                    objNode.Text = objCommlink.DisplayName;

                    objNewGear = objCommlink;
                    break;
                case "Commlink Operating System":
                case "Commlink Operating System Upgrade":
                    OperatingSystem objOperatingSystem = new OperatingSystem(_objCharacter);
                    objOperatingSystem.Create(objXmlGear, _objCharacter, objNode, frmPickGear.SelectedRating);
                    objOperatingSystem.Quantity = frmPickGear.SelectedQty;
                    try
                    {
                        _blnSkipRefresh = true;
                        nudGearQty.Increment = objOperatingSystem.CostFor;
                        //nudGearQty.Minimum = nudGearQty.Increment;
                        _blnSkipRefresh = false;
                    }
                    catch
                    {
                    }
                    objNode.Text = objOperatingSystem.DisplayName;

                    objNewGear = objOperatingSystem;
                    break;
                default:
                    Gear objGear = new Gear(_objCharacter);
                    objGear.Create(objXmlGear, _objCharacter, objNode, frmPickGear.SelectedRating, objWeapons, objWeaponNodes, "", frmPickGear.Hacked, frmPickGear.InherentProgram, true, true, frmPickGear.Aerodynamic);
                    objGear.Quantity = frmPickGear.SelectedQty;
                    try
                    {
                        _blnSkipRefresh = true;
                        nudGearQty.Increment = objGear.CostFor;
                        //nudGearQty.Minimum = nudGearQty.Increment;
                        _blnSkipRefresh = false;
                    }
                    catch
                    {
                    }
                    objNode.Text = objGear.DisplayName;

                    objNewGear = objGear;
                    break;
            }

            if (objNewGear.InternalId == Guid.Empty.ToString())
                return;

            // Reduce the cost for Do It Yourself components.
            if (frmPickGear.DoItYourself)
                objNewGear.Cost = (Convert.ToDouble(objNewGear.Cost, GlobalOptions.Instance.CultureInfo) * 0.5).ToString();
            // Reduce the cost to 10% for Hacked programs.
            if (frmPickGear.Hacked)
            {
//.........这里部分代码省略.........
开发者ID:janhelke,项目名称:chummer2,代码行数:101,代码来源:frmCreate.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# System.Operation类代码示例发布时间:2022-05-26
下一篇:
C# System.Objects类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap