Esempio n. 1
0
        public void Install()
        {
            MsmqInstaller installer;

            switch (GetWindowsVersion())
            {
            case WindowsVersion.TooOldToCare:
            case WindowsVersion.Windows2000:
                throw new NotSupportedException("The Windows version is too old to support automatic installation");

            case WindowsVersion.WindowsXp:
            case WindowsVersion.Windows2003:
                installer = new WindowsServer2003Installer();
                break;

            case WindowsVersion.WindowsVista:
                installer = new WindowsVistaInstaller();
                break;

            case WindowsVersion.Windows2008:
                installer = new WindowsServer2008Installer();
                break;

            case WindowsVersion.Windows2008R2:
                installer = new WindowsServer2008R2Installer();
                break;

            case WindowsVersion.Windows7:
            case WindowsVersion.Windows8:
            case WindowsVersion.Windows81:
            case WindowsVersion.Windows2012:
            case WindowsVersion.Windows2012R2:
            case WindowsVersion.Unknown:             //This is probably a newer version of Windows and the last method might work
                installer = new Windows7Installer();
                break;

            default:
                throw new NotSupportedException("The Windows version was not recognized, installation cannot continue.");
            }

            using (Process process = installer.Install())
            {
                process.WaitForExit();
            }
        }
Esempio n. 2
0
		public void Install()
		{
			MsmqInstaller installer;
			switch (GetWindowsVersion())
			{
				case WindowsVersion.TooOldToCare:
				case WindowsVersion.Windows2000:
					throw new NotSupportedException("The Windows version is too old to support automatic installation");

				case WindowsVersion.WindowsXp:
				case WindowsVersion.Windows2003:
					installer = new WindowsServer2003Installer();
					break;

				case WindowsVersion.WindowsVista:
					installer = new WindowsVistaInstaller();
					break;

				case WindowsVersion.Windows2008:
					installer = new WindowsServer2008Installer();
					break;

				case WindowsVersion.Windows2008R2:
					installer = new WindowsServer2008R2Installer();
					break;

				case WindowsVersion.Windows7:
                case WindowsVersion.Windows8:
                case WindowsVersion.Windows81:
                case WindowsVersion.Windows2012:
                case WindowsVersion.Windows2012R2:
                case WindowsVersion.Unknown:         //This is probably a newer version of Windows and the last method might work
					installer = new Windows7Installer();
					break;

				default:
					throw new NotSupportedException("The Windows version was not recognized, installation cannot continue.");
			}

			using (Process process = installer.Install())
			{
				process.WaitForExit();
			}
		}