Ejemplo n.º 1
0
        /// <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;
            }
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
        /// <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);
            }
        }
Ejemplo n.º 5
0
        static mac_stuff()
        {
            PlatformID my_plat = Environment.OSVersion.Platform;

            isMac = my_plat.Equals(PlatformID.MacOSX) || my_plat.Equals(PlatformID.Unix);
        }