/// <summary> /// Updates the user environment. /// </summary> protected void UpdateUserEnvironment() { OperatingSystem system = Environment.OSVersion; PlatformID platformID = system.Platform; if (platformID.Equals(PlatformID.Win32NT)) { this.UserEnvironment = AppEnvironment.Windows; } else if (platformID.Equals(PlatformID.MacOSX)) { this.UserEnvironment = AppEnvironment.Mac; } else { this.UserEnvironment = AppEnvironment.Linux; } }
internal static bool IsWin8AndAbove() { bool flag = false; OperatingSystem oSVersion = Environment.OSVersion; PlatformID platform = oSVersion.Platform; Version version = oSVersion.Version; if (platform.Equals(PlatformID.Win32NT) && (version.Major > 6 || version.Major == 6 && version.Minor >= 2)) { flag = true; } return(flag); }
protected override void BeginProcessing() { OperatingSystem oSVersion = Environment.OSVersion; PlatformID platform = oSVersion.Platform; Version version = oSVersion.Version; if (!platform.Equals(PlatformID.Win32NT) || version.Major >= 6 && (version.Major != 6 || version.Minor >= 2)) { return; } else { object[] name = new object[1]; name[0] = base.CommandInfo.Name; string str = string.Format(CultureInfo.InvariantCulture, ControlPanelResources.ControlPanelItemCmdletNotSupported, name); throw new PSNotSupportedException(str); } }
/// <summary> /// Does the preprocessing for ControlPanelItem cmdlets /// </summary> protected override void BeginProcessing() { System.OperatingSystem osInfo = System.Environment.OSVersion; PlatformID platform = osInfo.Platform; Version version = osInfo.Version; if (platform.Equals(PlatformID.Win32NT) && ((version.Major < 6) || ((version.Major == 6) && (version.Minor < 2)) )) { // Below Win8, this cmdlet is not supported because of Win8:794135 // throw terminating string message = string.Format(CultureInfo.InvariantCulture, ControlPanelResources.ControlPanelItemCmdletNotSupported, this.CommandInfo.Name); throw new PSNotSupportedException(message); } }
static mac_stuff() { PlatformID my_plat = Environment.OSVersion.Platform; isMac = my_plat.Equals(PlatformID.MacOSX) || my_plat.Equals(PlatformID.Unix); }