SirCmpwn

Untitled

May 5th, 2012
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.IO;
  6. using System.Diagnostics;
  7.  
  8. namespace DcpuDevDE
  9. {
  10. public static class RuntimeInfo
  11. {
  12. public static bool IsMono { get; private set; }
  13. public static bool IsWindows { get; private set; }
  14. public static bool IsUnix { get; private set; }
  15. public static bool IsMacOSX { get; private set; }
  16.  
  17. internal static void GatherInfo()
  18. {
  19. IsMono = Type.GetType("Mono.Runtime") != null;
  20. int p = (int)Environment.OSVersion.Platform;
  21. IsUnix = (p == 4) || (p == 6) || (p == 128);
  22. IsWindows = Path.DirectorySeparatorChar == '\\';
  23. if (IsUnix)
  24. {
  25. Process uname = Process.Start("uname");
  26. string output = uname.StandardOutput.ReadToEnd();
  27. uname.WaitForExit();
  28. IsMacOSX = output.ToUpper().Replace("\n", "").Trim() == "DARWIN";
  29. }
  30. else
  31. IsMacOSX = false;
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment