using System; using Systemm = System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Text; using System.Windows.Forms; using System.Diagnostics; namespace Trigger.Status { /// /// Provides methods to examine the status of the system /// static class System { #region Properties #region Fonts /// /// Gets a list with all installed s /// public static List InstalledFonts { get { InstalledFontCollection fonts = new InstalledFontCollection(); return new List(fonts.Families); } } #endregion #region User /// /// Gets the name of the domain the user belongs to /// public static string UserDomainName { get { return SystemInformation.UserDomainName; } } /// /// Gets the user name associated with the current thread /// public static string UserName { get { return SystemInformation.UserName; } } #endregion #region OSVersion /// /// Information about the that we are running on /// public static OperatingSystem OperatingSystem { get { return Environment.OSVersion; } } /// /// The of this OS /// public static Version WindowsVersion { get { return Environment.OSVersion.Version; } } /// /// Whether this is Windows 8.1 /// public static bool IsWindows81 { get { return WindowsVersion.Major == 6 && WindowsVersion.Minor == 3; } } /// /// Whether this is Windows 8 /// public static bool IsWindows8 { get { return WindowsVersion.Major == 6 && WindowsVersion.Minor == 2; } } /// /// Whether this is Windows 7 /// public static bool IsWindows7 { get { return WindowsVersion.Major == 6 && WindowsVersion.Minor == 1; } } /// /// Whether this is Windows Vista /// public static bool IsWindowsVista { get { return WindowsVersion.Major == 6 && WindowsVersion.Minor == 0; } } /// /// Whether this is Windows XP /// public static bool IsWindowsXP { get { return WindowsVersion.Major == 5 && WindowsVersion.Minor == 1; } } /// /// Whether this is Windows 2000 /// public static bool IsWindows2000 { get { return WindowsVersion.Major == 5 && WindowsVersion.Minor == 0; } } /// /// Whether the current process is running as 32bit process /// public static bool Is64BitProcess { get { return Environment.Is64BitProcess; } } /// /// Checks whether the operating system is 64bit /// public static bool Is64BitOS { get { return Environment.Is64BitOperatingSystem; } } #endregion #endregion #region Methods /// /// Returns the current System status /// /// public static TreeNode GetStatus() { TreeNode tnMain = new TreeNode("System"); tnMain.Nodes.Add("Windows version: " + WindowsVersion.ToString()); tnMain.Nodes.Add("Is 64bit OS: " + Is64BitOS.ToString()); tnMain.Nodes.Add("Fonts installed: " + InstalledFonts.Count); tnMain.Nodes.Add("User name: " + UserName); tnMain.Nodes.Add("User domain name: " + UserDomainName); return tnMain; } #endregion } }