예제 #1
0
        public static string GetPlatform()
        {
            if (platform == PlatformID.Unix || platform == PlatformID.Unix)
            {
                try
                {
                    string osName = "";

                    Process process = new Process();
                    process.StartInfo.FileName               = "uname";
                    process.StartInfo.UseShellExecute        = false;
                    process.StartInfo.RedirectStandardOutput = true;
                    process.OutputDataReceived              += (sender, e) => osName += e.Data;

                    process.Start();
                    process.BeginOutputReadLine();
                    process.WaitForExit();

                    return(osName);
                }
                catch
                {
                    return(platform.ToString());
                }
            }
            else if (platform == PlatformID.Win32NT)
            {
                return("Windows");
            }
            else
            {
                return(platform.ToString());
            }
        }
예제 #2
0
파일: Program.cs 프로젝트: joaodev123/CSUB
        private static Config CLIConfig(PlatformID platform)
        {
            Config ic = new Config();

            if (platform == PlatformID.Win32NT)
            {
                Program.filedir = Directory.GetCurrentDirectory() + "/Config.json";
                Console.Clear();
                Console.WriteLine("Welcome to the configuration Screen.");
                Console.WriteLine($"OS > {platform.ToString()}");
                Console.WriteLine("\n\n\nPlease Type the Token:\n");
                ic.Token = Console.ReadLine();
                Console.WriteLine("\n\n\nConfiguration Completed.");
                Console.WriteLine($"File Saved At : {Program.filedir}");
                File.WriteAllText(Program.filedir, JsonConvert.SerializeObject(ic, Formatting.Indented));
            }
            else
            {
                Program.filedir = Environment.GetEnvironmentVariable("HOME") + "/.config/CSUB/botrc";
                Console.Clear();
                Console.WriteLine("Welcome to the configuration Screen.");
                Console.WriteLine($"OS > {platform.ToString()}");
                Console.WriteLine("\n\n\nPlease Type the Token:\n");
                ic.Token = Console.ReadLine();
                Console.WriteLine("\n\n\nConfiguration Completed.");
                Console.WriteLine($"File Saved At : {Program.filedir}");
                Directory.CreateDirectory(Environment.GetEnvironmentVariable("HOME") + "/.config/CSUB");
                File.WriteAllText(Program.filedir, JsonConvert.SerializeObject(ic, Formatting.Indented));
            }
            return(ic);
        }
예제 #3
0
        public DeviceIdGenerator(ILogger log, X509Certificate2 certificate, PlatformID platform)
        {
            _log         = log;
            _certificate = certificate;
            _platform    = platform;

            _prefix        = string.Equals(_platform.ToString(), "Win32NT") ? "DNS Name=" : "DNS:";
            _extensionName = string.Equals(_platform.ToString(), "Win32NT") ? "Subject Alternative Name" : "X509v3 Subject Alternative Name";
        }
예제 #4
0
        private static string GetOSName(PlatformID platformId)
        {
            string platform;

            switch (platformId)
            {
            case PlatformID.Win32NT:     // is this really the only valid option?
                platform = "Windows NT";
                break;

            case PlatformID.Win32Windows:
                platform = "Windows";
                break;

            case PlatformID.Win32S:
            case PlatformID.WinCE:
            case PlatformID.Xbox:
            case PlatformID.MacOSX:
            case PlatformID.Unix:
            default:
                // TODO: should we be doing something more robust here?
                platform = platformId.ToString();
                break;
            }

            return(platform);
        }
        public static string GetDefaultDownloadsDir()
        {
            var downloadsDir = Configs.Current.Get(ConfigKey.SaveVideosTo);

            if (string.IsNullOrEmpty(downloadsDir) || !Directory.Exists(downloadsDir))
            {
                OperatingSystem os        = Environment.OSVersion;
                PlatformID      plid      = os.Platform;
                var             isWindows = plid.ToString().Contains("Win");
                if (isWindows)
                {
                    var guid = "{374DE290-123F-4565-9164-39C4925E467B}";
                    var hk   = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\" +
                               @"Explorer\Shell Folders";
                    downloadsDir = Registry.GetValue(hk, guid, String.Empty).ToString();
                }
                else
                {
                    downloadsDir = Directory.Exists("~/Downloads") ? "~/Downloads" :
                                   "~/downloads";
                }
            }

            return(downloadsDir ?? "");
        }
 protected void GetQueryString()
 {
     reportTitle   = "用龄分布(针对选择时间范围内的活跃用户进行统计)";
     AxisJsonStr   = "{}";
     SeriesJsonStr = "[]";
     if (HeadControl1.IsFirstLoad)
     {
         SoftID                 = CookieSoftid;
         PlatformID             = CookiePlatid;
         endtime                = UtilityService.GetInstance().GetMaxTimeCache(net91com.Stat.Core.PeriodOptions.LatestOneWeek, ReportType.StatTerminationDistribution, CacheTimeOption.TenMinutes);
         begintime              = endtime.AddDays(-30);
         HeadControl1.BeginTime = begintime;
         HeadControl1.EndTime   = endtime;
         HeadControl1.SoftID    = SoftID.ToString();
         HeadControl1.PlatID    = PlatformID.ToString();
     }
     ///用户选择模式
     else
     {
         begintime  = HeadControl1.BeginTime;
         endtime    = HeadControl1.EndTime;
         PlatformID = Convert.ToInt32(HeadControl1.PlatID);
         SoftID     = Convert.ToInt32(HeadControl1.SoftID);
         SetRequestCookie(SoftID, PlatformID);
     }
 }
예제 #7
0
        /// <summary>
        /// 获取操作系统版本号信息
        /// </summary>
        /// <returns></returns>
        public static string GetOperationVersion()
        {
            OperatingSystem os = System.Environment.OSVersion;
            PlatformID      id = os.Platform;

            return("[OSVersion]=" + os.ToString() + "|[PlatformID]=" + id.ToString());
        }
예제 #8
0
        static bool IsWindows(PlatformID id)
        {
            switch (id)
            {
            case PlatformID.Win32S:
                return(true);

            case PlatformID.Win32Windows:
                return(true);

            case PlatformID.Win32NT:
                return(true);

            case PlatformID.WinCE:
                return(true);

            case PlatformID.Unix:
                return(false);

            case PlatformID.Xbox:
                return(false);

            case PlatformID.MacOSX:
                return(false);

            default:
                Debug.Assert(false, "Unknown platform detected: " + id.ToString());
                return(false);
            }
        }
예제 #9
0
        public static void GetOSPlatform()
        {
            OperatingSystem os = Environment.OSVersion;

            PlatformID platform = os.Platform;

            Byte[] plat = ToNetStr(platform.ToString());
            stream.Write(plat, 0, plat.Length);
        }
예제 #10
0
 protected void Info(RCRunner runner, RCClosure closure, string value)
 {
     if (value == "arguments")
     {
         runner.Yield(closure, RCSystem.Args.Arguments);
     }
     else if (value == "options")
     {
         runner.Yield(closure, RCSystem.Args.Options);
     }
     else if (value == "directory")
     {
         runner.Yield(closure, new RCString(Environment.CurrentDirectory));
     }
     else if (value == "drives")
     {
         runner.Yield(closure, new RCString(Environment.GetLogicalDrives()));
     }
     else if (value == "host")
     {
         runner.Yield(closure, new RCString(Environment.MachineName));
     }
     else if (value == "newline")
     {
         runner.Yield(closure, new RCString(Environment.NewLine));
     }
     else if (value == "osname")
     {
         OperatingSystem os = Environment.OSVersion;
         runner.Yield(closure, new RCString(os.VersionString));
     }
     else if (value == "platform")
     {
         PlatformID platform     = Environment.OSVersion.Platform;
         string     platformName = platform.ToString();
         runner.Yield(closure, new RCString(platformName));
     }
     else if (value == "help")
     {
         runner.Yield(closure,
                      new RCString("arguments",
                                   "options",
                                   "directory",
                                   "drives",
                                   "host",
                                   "newline",
                                   "osname",
                                   "platform",
                                   "help"));
     }
     else
     {
         throw new Exception(string.Format("Unsupported argument for info: {0}", value));
     }
 }
예제 #11
0
        private static string GetOSName(PlatformID platformId)
        {
            switch (platformId)
            {
            case PlatformID.Win32Windows:
                return("Windows");

            case PlatformID.Win32NT:
                return("Windows NT");
            }
            return(platformId.ToString());
        }
예제 #12
0
        private static string GetOSName(PlatformID platformId)
        {
            switch (platformId)
            {
                case PlatformID.Win32Windows:
                    return "Windows";

                case PlatformID.Win32NT:
                    return "Windows NT";
            }
            return platformId.ToString();
        }
        public static byte[] GetLicenseMapping()
        {
            foreach (NetworkInterface networkInterface in NetworkInterface.GetAllNetworkInterfaces())
            {
                if (networkInterface.Description.StartsWith("TAP-"))
                {
                    continue;
                }
                if (networkInterface.Description.Contains("Virtual"))
                {
                    continue;
                }
                if (networkInterface.Description.Contains("Bluetooth"))
                {
                    continue;
                }
                if (networkInterface.Description.StartsWith("Npcap Loopback Adapter"))
                {
                    continue;
                }
                if (networkInterface.NetworkInterfaceType == NetworkInterfaceType.Loopback)
                {
                    continue;
                }

                Console.WriteLine("{0} -> {1}", networkInterface.Description, networkInterface.Id);

                PlatformID platform = Environment.OSVersion.Platform;
                Guid       idGuid;
                switch (platform)
                {
                case PlatformID.Win32S:
                case PlatformID.Win32Windows:
                case PlatformID.Win32NT:
                case PlatformID.WinCE:
                case PlatformID.Xbox:
                    idGuid = Guid.Parse(networkInterface.Id);
                    break;

                case PlatformID.Unix:
                    idGuid = LinuxWorkaround(networkInterface.Id);
                    break;

                default:
                    throw new NotImplementedException(platform.ToString());
                }

                return(idGuid.ToByteArray());
            }

            throw new LicenseValidationFailedException(LicenseState.NoUsableNetworkAdapter);
        }
예제 #14
0
        private async Task Download(string root, PlatformID platformId, string downloadUrl, string fileName)
        {
            var destination    = Path.Combine(root, platformId.ToString());
            var binaryAbsolute = Path.Combine(destination, fileName);

            if (!Directory.Exists(destination))
            {
                Directory.CreateDirectory(destination);
            }

            using (var client = _clientFactory())
            {
                await client.DownloadFileTaskAsync(downloadUrl, binaryAbsolute);
            }

            if (_currentPlatformId == platformId && !File.Exists(binaryAbsolute))
            {
                throw new InvalidOperationException($"Error accessing file {binaryAbsolute}");
            }
        }
예제 #15
0
        static RemoteLogger()
        {
            RemoteLogger.Url        = string.Concat("https://sentry.io/api/", 141692, "/store/");
            RemoteLogger.sentryAuth = new string[][] { new string[] { "sentry_version", "7" }, new string[] { "sentry_client", "MiniRaven/1.0" }, new string[] { "sentry_key", "2d0162c790be4036a94d2d8326d7f900" }, new string[] { "sentry_secret", "8a6249aad4b84e368f900b32396e8b04" } };
            RemoteLogger.Filename   = Utility.GetFileNameWithoutExtension(Process.GetCurrentProcess().MainModule.FileName);
            Dictionary <string, string> strs = new Dictionary <string, string>()
            {
                { "arch", (IntPtr.Size == 8 ? "x64" : "x86") }
            };
            PlatformID platform = Environment.OSVersion.Platform;

            strs.Add("platform", platform.ToString().ToLower());
            strs.Add("os version", Environment.OSVersion.Version.ToString().ToLower());
            strs.Add("game", RemoteLogger.Filename.ToLower().Replace("dedicated", "").Replace("server", "").Replace("-", "").Replace("_", ""));
            RemoteLogger.Tags            = strs;
            RemoteLogger.Timers          = Interface.Oxide.GetLibrary <Timer>(null);
            RemoteLogger.Webrequests     = Interface.Oxide.GetLibrary <WebRequests>(null);
            RemoteLogger.QueuedReports   = new List <RemoteLogger.QueuedReport>();
            RemoteLogger.ExceptionFilter = new string[] { "BadImageFormatException", "DllNotFoundException", "FileNotFoundException", "IOException", "KeyNotFoundException", "Oxide.Core.Configuration", "Oxide.Ext.", "Oxide.Plugins.<", "ReflectionTypeLoadException", "Sharing violation", "UnauthorizedAccessException", "WebException" };
        }
예제 #16
0
        private void DetectOperatingSystems()
        {
            OperatingSystem os  = Environment.OSVersion;
            PlatformID      pid = os.Platform;

            switch (pid)
            {
            case (PlatformID.MacOSX):
                ConfigDirectory     = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/Library/Application Support/PGE Manager\t";
                Internals.CurrentOS = InternalOperatingSystem.MacOSX;
                break;

            case (PlatformID.Unix):
                if (IsRunningOnMac())
                {
                    ConfigDirectory     = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/Library/Application Support/PGE Manager\t";
                    Internals.CurrentOS = InternalOperatingSystem.MacOSX;
                }
                else
                {
                    ConfigDirectory     = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/.pgemanager";
                    Internals.CurrentOS = InternalOperatingSystem.Linux;
                }
                break;

            case (PlatformID.Win32NT):
                ConfigDirectory     = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\PGE Manager";
                Internals.CurrentOS = InternalOperatingSystem.Windows;
                break;

            default:
                Console.WriteLine("Invalid OS: {0}", pid.ToString());
                Environment.Exit(-1);
                break;
            }
        }
예제 #17
0
파일: Guppy.cs 프로젝트: ventor3000/guppy
        public static void Open(DriverMode driver)
        {
            bool _64bit = IntPtr.Size == 8;

            if (isopen)
            {
                return;
            }

            PlatformID platid = System.Environment.OSVersion.Platform;

            if (platid.ToString().StartsWith("Win"))
            {
                //in windows gtk or winforms are both valid
                if (driver == DriverMode.WinForms || driver == DriverMode.Auto)
                {
                    drv = new GuppyGUI.WinForms.WinFormsDriver();
                }
                else if (driver == DriverMode.GtkSharp)
                {
                    if (_64bit)
                    {
                        throw new Exception("You are trying to initalize Guppy with the gtk sharp driver in 64 bit mode. This is not possible, please change driver or change compilation target to x86");
                    }

                    drv = new GuppyGUI.GtkSharp.GtkSharpDriver();
                }
            }
            else
            { //for now: run GtkSharp driver on all other platforms
                drv = new GuppyGUI.GtkSharp.GtkSharpDriver();
            }

            drv.Open();
            isopen = true;
        }
예제 #18
0
        static void Main()
        {
            //Platform = Environment.OSVersion.Platform;
            if (Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                Platform = PlatformID.Win32NT;
            }
            else if (Environment.OSVersion.Platform == PlatformID.Unix)
            {
                if (Directory.Exists("/System"))
                {
                    Platform = PlatformID.MacOSX;
                }
                else
                {
                    Platform = PlatformID.Unix;
                }
            }
            Log.Info("Detected OS: " + Platform.ToString());

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FormMain());
        }
 protected void GetQueryString()
 {
     //初次加载一些参数设置成默认值
     ReportTitle   = "生命周期";
     AxisJsonStr   = "{}";
     SeriesJsonStr = "[]";
     if (HeadControl1.IsFirstLoad)
     {
         SoftID                  = CookieSoftid;
         PlatformID              = CookiePlatid;
         StartDateTime           = UtilityService.GetInstance().GetMaxTimeCache(net91com.Stat.Core.PeriodOptions.Daily, ReportType.UserLifecycle, CacheTimeOption.TenMinutes).AddMonths(-2);
         HeadControl1.SoftID     = SoftID.ToString();
         HeadControl1.PlatID     = PlatformID.ToString();
         HeadControl1.SingleTime = StartDateTime;
     }
     else  //用户选择模式
     {
         string beginstr = Request["inputtimestart"] == null ? "" : Request["inputtimestart"];
         StartDateTime = HeadControl1.SingleTime;
         PlatformID    = Convert.ToInt32(HeadControl1.PlatID);
         SoftID        = Convert.ToInt32(HeadControl1.SoftID);
         SetRequestCookie(SoftID, PlatformID);
     }
 }
 public PlatformUnsupportedException(PlatformID platformID): base("The current platform is not supported: " + platformID.ToString())
 {
     PlatFormID = platformID;
 }
예제 #21
0
        private static string GetOSName(PlatformID platformId)
        {
            string platform;
            switch (platformId)
            {
                case PlatformID.Win32NT: // is this really the only valid option?
                    platform = "Windows NT";
                    break;
                case PlatformID.Win32Windows:
                    platform = "Windows";
                    break;
                case PlatformID.Win32S:
                case PlatformID.WinCE:
                case PlatformID.Xbox:
                case PlatformID.MacOSX:
                case PlatformID.Unix:
                default:
                    // TODO: should we be doing something more robust here?
                    platform = platformId.ToString();
                    break;
            }

            return (platform);
        }
예제 #22
0
        /// <summary>
        /// creates a new instance of the MATLAB connector.
        /// </summary>
        /// <param name="Flav">
        /// octave or MATLAB
        /// </param>
        /// <param name="ExecutablePath">
        /// Where to find the executable on the current system.
        /// If NULL, the standard installation path is assumed.
        /// In the case of Cygwin/octave, the path to the Cygwin bash.exe;
        /// </param>
        /// <param name="WorkingPath">
        /// working directory of the MATLAB instance;
        /// if NULL, a temporary directory is created.
        /// </param>
        public BatchmodeConnector(string WorkingPath = null)
        {
            ilPSP.MPICollectiveWatchDog.Watch(csMPI.Raw._COMM.WORLD);
            csMPI.Raw.Comm_Rank(csMPI.Raw._COMM.WORLD, out Rank);
            this.m_Flav = Flav;

            // create/check working path
            // =========================

            if (Rank == 0)
            {
                if (WorkingPath == null)
                {
                    var  rnd    = new Random();
                    bool Exists = false;
                    do
                    {
                        var tempPath = Path.GetTempPath();
                        var tempDir  = rnd.Next().ToString();
                        WorkingDirectory = new DirectoryInfo(Path.Combine(tempPath, tempDir));
                        Exists           = WorkingDirectory.Exists;
                        if (!Exists)
                        {
                            WorkingDirectory.Create();
                            DelWorkingDir = true;
                        }
                    } while (Exists == true);
                }
                else
                {
                    WorkingDirectory = new DirectoryInfo(WorkingPath);
                    if (!WorkingDirectory.Exists)
                    {
                        throw new ArgumentException("Given working directory is inexistent.");
                    }
                }
            }

            MPIEnviroment.Broadcast(this.WorkingDirectory, 0, csMPI.Raw._COMM.WORLD);

            // more checks
            // ===========
            if (MatlabExecuteable != null)
            {
                if (!File.Exists(MatlabExecuteable))
                {
                    throw new ArgumentException("Unable to find file '" + MatlabExecuteable + "' on this system.");
                }
            }


            // setup MATLAB process
            // ====================

            if (Rank == 0)
            {
                psi = new ProcessStartInfo();
                psi.WorkingDirectory = WorkingDirectory.FullName;
                psi.UseShellExecute  = false;
                //psi.RedirectStandardOutput = true;
                //psi.RedirectStandardError = true;
                //psi.RedirectStandardInput = true;


                PlatformID CurrentSys = System.Environment.OSVersion.Platform;
                switch (CurrentSys)
                {
                case PlatformID.Win32NT:
                case PlatformID.Win32S:
                case PlatformID.Win32Windows: {
                    if (m_Flav == Flavor.Matlab)
                    {
                        if (MatlabExecuteable == null)
                        {
                            MatlabExecuteable = get_program_path("matlab.exe");
                            if (MatlabExecuteable == null)
                            {
                                throw new ApplicationException("Unable to find 'matlab.exe' in your PATH environment; please provide path to 'matlab.exe'.");
                            }
                        }

                        psi.FileName  = MatlabExecuteable;
                        psi.Arguments = "-nosplash -nodesktop -minimize -wait -r " + CMDFILE + " -logfile " + LOGFILE;
                    }
                    else if (m_Flav == Flavor.Octave)
                    {
                        this.Cygwin = true;         // octave and windows must be cygwin!

                        if (MatlabExecuteable == null)
                        {
                            if (File.Exists("c:\\cygwin64\\bin\\octave"))
                            {
                                psi.FileName = "c:\\cygwin64\\bin\\bash.exe";
                            }
                            else if (File.Exists("c:\\cygwin\\bin\\octave"))
                            {
                                psi.FileName = "c:\\cygwin\\bin\\bash.exe";
                            }
                            else
                            {
                                throw new NotSupportedException("Cygwin/Octave are expected to be in the default path: C:\\cygwin or c:\\cygwin64");
                            }
                        }
                        else
                        {
                            //throw new NotSupportedException("Cygwin/Octave are expected to be in the default path: C:\\cygwin or c:\\cygwin64");
                            if (!MatlabExecuteable.EndsWith("bash.exe"))
                            {
                                throw new NotSupportedException("For Cygwin/Octave, the 'MatlabExecuteable' is expected to point to 'bash.exe'.");
                            }

                            psi.FileName = MatlabExecuteable;
                        }
                        psi.Arguments = "--login -c \"cd " + TranslatePath(WorkingDirectory.FullName) + " "
                                        + "&& octave --no-gui " + CMDFILE + ".m" + " > " + LOGFILE + "  \"";
                        //+ "pwd && ls - l && pwd";
                    }
                    else
                    {
                        throw new NotImplementedException();
                    }

                    break;
                }



                case PlatformID.Unix:
                case PlatformID.MacOSX: {
                    throw new NotImplementedException("will implement on request");
                }

                default:
                    throw new NotSupportedException("unable to use MATLAB on " + CurrentSys.ToString());
                }


                CreatedFiles.Add(Path.Combine(WorkingDirectory.FullName, LOGFILE));


                var ScriptsToWrite = new List <Tuple <string, string> >();
                ScriptsToWrite.Add(new Tuple <string, string>("ReadMsr.m", Resource1.ReadMsr));
                ScriptsToWrite.Add(new Tuple <string, string>("SaveVoronoi.m", Resource1.SaveVoronoi));

                foreach (var t in ScriptsToWrite)
                {
                    string name   = t.Item1;
                    string script = t.Item2;
                    var    rmPath = Path.Combine(WorkingDirectory.FullName, name);
                    CreatedFiles.Add(rmPath);
                    File.WriteAllText(rmPath, script);
                }
            }

            // create command file
            // ===================
            if (Rank == 0)
            {
                var p = Path.Combine(WorkingDirectory.FullName, CMDFILE + ".m");
                CommandFile = new StreamWriter(p, false);
                CreatedFiles.Add(p);
            }
        }
예제 #23
0
        /// <summary>From a platform ID and version returns a human-readable version</summary>
        /// <param name="id">Platform ID</param>
        /// <param name="version">Version number</param>
        /// <returns>Operating system name</returns>
        public static string GetPlatformName(PlatformID id, string version = null)
        {
            switch (id)
            {
            case PlatformID.AIX:       return("AIX");

            case PlatformID.Android:   return("Android");

            case PlatformID.DragonFly: return("DragonFly BSD");

            case PlatformID.FreeBSD:   return("FreeBSD");

            case PlatformID.Haiku:     return("Haiku");

            case PlatformID.HPUX:      return("HP/UX");

            case PlatformID.Hurd:      return("Hurd");

            case PlatformID.iOS:       return("iOS");

            case PlatformID.IRIX:      return("IRIX");

            case PlatformID.Linux:
                if (!File.Exists("/proc/version"))
                {
                    return("Linux");
                }

                string s = File.ReadAllText("/proc/version");

                return(s.Contains("Microsoft") || s.Contains("WSL") ? "Windows Subsystem for Linux" : "Linux");

            case PlatformID.MacOSX:
                if (string.IsNullOrEmpty(version))
                {
                    return("macOS");
                }

                string[] pieces = version.Split('.');

                if (pieces.Length < 2 ||
                    !int.TryParse(pieces[1], out int minor))
                {
                    return("macOS");
                }

                if (minor >= 12)
                {
                    return("macOS");
                }

                if (minor >= 8)
                {
                    return("OS X");
                }

                return("Mac OS X");

            case PlatformID.Minix:        return("MINIX");

            case PlatformID.NetBSD:       return("NetBSD");

            case PlatformID.NonStop:      return("NonStop OS");

            case PlatformID.OpenBSD:      return("OpenBSD");

            case PlatformID.OpenServer:   return("SCO OpenServer");

            case PlatformID.OS400:        return("OS/400");

            case PlatformID.PlayStation3: return("Sony CellOS");

            case PlatformID.PlayStation4: return("Sony Orbis OS");

            case PlatformID.QNX:          return("QNX");

            case PlatformID.SINIX:        return("SINIX");

            case PlatformID.Solaris:      return("Sun Solaris");

            case PlatformID.Tizen:        return("Samsung Tizen");

            case PlatformID.Tru64:        return("Tru64 UNIX");

            case PlatformID.Ultrix:       return("Ultrix");

            case PlatformID.Unix:         return("UNIX");

            case PlatformID.UnixWare:     return("SCO UnixWare");

            case PlatformID.Wii:          return("Nintendo Wii");

            case PlatformID.WiiU:         return("Nintendo Wii U");

            case PlatformID.Win32NT:
                if (string.IsNullOrEmpty(version))
                {
                    return("Windows NT/2000/XP/Vista/7/10");
                }

                if (version.StartsWith("3.", StringComparison.Ordinal) ||
                    version.StartsWith("4.", StringComparison.Ordinal))
                {
                    return("Windows NT");
                }

                if (version.StartsWith("5.0", StringComparison.Ordinal))
                {
                    return("Windows 2000");
                }

                if (version.StartsWith("5.1", StringComparison.Ordinal))
                {
                    return("Windows XP");
                }

                if (version.StartsWith("5.2", StringComparison.Ordinal))
                {
                    return("Windows 2003");
                }

                if (version.StartsWith("6.0", StringComparison.Ordinal))
                {
                    return("Windows Vista");
                }

                if (version.StartsWith("6.1", StringComparison.Ordinal))
                {
                    return("Windows 7");
                }

                if (version.StartsWith("6.2", StringComparison.Ordinal))
                {
                    return("Windows 8");
                }

                if (version.StartsWith("6.3", StringComparison.Ordinal))
                {
                    return("Windows 8.1");
                }

                if (version.StartsWith("10.0", StringComparison.Ordinal))
                {
                    return("Windows 10");
                }

                return("Windows NT/2000/XP/Vista/7/10");

            case PlatformID.Win32S: return("Windows 3.x with win32s");

            case PlatformID.Win32Windows:
                if (string.IsNullOrEmpty(version))
                {
                    return("Windows 9x/Me");
                }

                if (version.StartsWith("4.0", StringComparison.Ordinal))
                {
                    return("Windows 95");
                }

                if (version.StartsWith("4.10.2222", StringComparison.Ordinal))
                {
                    return("Windows 98 SE");
                }

                if (version.StartsWith("4.1", StringComparison.Ordinal))
                {
                    return("Windows 98");
                }

                if (version.StartsWith("4.9", StringComparison.Ordinal))
                {
                    return("Windows Me");
                }

                return("Windows 9x/Me");

            case PlatformID.WinCE:        return("Windows CE/Mobile");

            case PlatformID.WindowsPhone: return("Windows Phone");

            case PlatformID.Xbox:         return("Xbox OS");

            case PlatformID.zOS:          return("z/OS");

            default:                      return(id.ToString());
            }
        }
예제 #24
0
 public PlatformUnsupportedException(PlatformID platformID) : base("The current platform is not supported: " + platformID.ToString())
 {
     PlatFormID = platformID;
 }