Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.IO;
- using System.Diagnostics;
- namespace DcpuDevDE
- {
- public static class RuntimeInfo
- {
- public static bool IsMono { get; private set; }
- public static bool IsWindows { get; private set; }
- public static bool IsLinux { get; private set; }
- public static bool IsMacOSX { get; private set; }
- internal static void GatherInfo()
- {
- IsMono = Type.GetType("Mono.Runtime") != null;
- int p = (int)Environment.OSVersion.Platform;
- IsLinux = (p == 4) || (p == 6) || (p == 128);
- IsWindows = Path.DirectorySeparatorChar == '\\';
- if (IsLinux)
- {
- Process uname = Process.Start("uname");
- string output = uname.StandardOutput.ReadToEnd();
- uname.WaitForExit();
- IsMacOSX = output == "Darwin";
- }
- else
- IsMacOSX = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment