コード例 #1
0
        private int AddOSService(int serverId)
        {
            try
            {
                Log.WriteStart("Adding OS service");
                ServiceInfo serviceInfo = new ServiceInfo();
                serviceInfo.ServerId    = serverId;
                serviceInfo.ServiceName = "OS";
                serviceInfo.Comments    = string.Empty;

                //check OS version
                OS.WindowsVersion version = OS.GetVersion();
                if (version == OS.WindowsVersion.WindowsServer2003)
                {
                    serviceInfo.ProviderId = 1;
                }
                else if (version == OS.WindowsVersion.WindowsServer2008 ||
                         version == OS.WindowsVersion.WindowsServer2008R2 ||
                         version == OS.WindowsVersion.Windows7)
                {
                    serviceInfo.ProviderId = 100;
                }
                else if (version == OS.WindowsVersion.WindowsServer2012 ||
                         version == OS.WindowsVersion.Windows8)
                {
                    serviceInfo.ProviderId = 104;
                }
                else if (version == OS.WindowsVersion.WindowsServer2016 ||
                         version == OS.WindowsVersion.Windows10)
                {
                    serviceInfo.ProviderId = 111;
                }
                int serviceId = ES.Services.Servers.AddService(serviceInfo);
                if (serviceId > 0)
                {
                    InstallService(serviceId);
                    Log.WriteEnd("Added OS service");
                }
                else
                {
                    Log.WriteError(string.Format("Enterprise Server error: {0}", serviceId));
                }
                return(serviceId);
            }
            catch (Exception ex)
            {
                if (!Utils.IsThreadAbortException(ex))
                {
                    Log.WriteError("OS service configuration error", ex);
                }
                return(-1);
            }
        }
コード例 #2
0
        internal static CheckStatuses CheckOS(SetupVariables setupVariables, out string details)
        {
            details = string.Empty;
            try
            {
                //check OS version
                OS.WindowsVersion version = OS.GetVersion();
                details = OS.GetName(version);
                if (Utils.IsWin64())
                {
                    details += " x64";
                }
                Log.WriteInfo(string.Format("OS check: {0}", details));

                if (!(version == OS.WindowsVersion.WindowsServer2003 ||
                      version == OS.WindowsVersion.WindowsServer2008 ||
                      version == OS.WindowsVersion.WindowsServer2008R2 ||
                      version == OS.WindowsVersion.WindowsServer2012 ||
                      version == OS.WindowsVersion.WindowsServer2012R2 ||
                      version == OS.WindowsVersion.WindowsVista ||
                      version == OS.WindowsVersion.Windows7 ||
                      version == OS.WindowsVersion.Windows8 ||
                      version == OS.WindowsVersion.Win32NTServer ||
                      version == OS.WindowsVersion.Win32NTWorkstation
                      ))
                {
                    details = "OS required: Windows Server 2008/2008 R2/2012 or Windows Vista/7/8.";
                    Log.WriteError(string.Format("OS check: {0}", details), null);
#if DEBUG
                    return(CheckStatuses.Warning);
#endif
#if !DEBUG
                    return(CheckStatuses.Error);
#endif
                }
                return(CheckStatuses.Success);
            }
            catch (Exception ex)
            {
                if (!Utils.IsThreadAbortException(ex))
                {
                    Log.WriteError("Check error", ex);
                }
                details = "Unexpected error";
                return(CheckStatuses.Error);
            }
        }
コード例 #3
0
        private CheckStatuses CheckOS(out string details)
        {
            details = string.Empty;
            try
            {
                //check OS version
                OS.WindowsVersion version = OS.GetVersion();
                details = OS.GetName(version);
                if (Utils.IsWin64())
                {
                    details += " x64";
                }
                Log.WriteInfo(string.Format("OS check: {0}", details));

                if (!(version == OS.WindowsVersion.WindowsServer2003 ||
                      version == OS.WindowsVersion.WindowsServer2008))
                {
                    details = "Windows Server 2003 or Windows Server 2008 required.";
                    Log.WriteError(string.Format("OS check: {0}", details), null);
#if DEBUG
                    return(CheckStatuses.Warning);
#endif
#if !DEBUG
                    return(CheckStatuses.Error);
#endif
                }
                return(CheckStatuses.Success);
            }
            catch (Exception ex)
            {
                if (!Utils.IsThreadAbortException(ex))
                {
                    Log.WriteError("Check error", ex);
                }
                details = "Unexpected error";
                return(CheckStatuses.Error);
            }
        }
コード例 #4
0
        static void Main()
        {
            //check security permissions
            if (!Utils.CheckSecurity())
            {
                ShowSecurityError();
                return;
            }

            //check administrator permissions
            if (!Utils.IsAdministrator())
            {
                ShowSecurityError();
                return;
            }

            //check for running instance
            if (!Utils.IsNewInstance())
            {
                Utils.ShowRunningInstance();
                return;
            }

            Log.WriteApplicationStart();
            //AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(OnUnhandledException);
            Application.ApplicationExit += new EventHandler(OnApplicationExit);
            Application.ThreadException += new ThreadExceptionEventHandler(OnThreadException);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //check OS version
            OS.WindowsVersion version = OS.GetVersion();
            Global.OSVersion = version;
            Log.WriteInfo(string.Format("{0} detected", version));

            //check IIS version
            Version iisVersion = RegistryUtils.GetIISVersion();

            if (iisVersion.Major == 0)
            {
                Log.WriteError("IIS not found.");
            }
            else
            {
                Log.WriteInfo(string.Format("IIS {0} detected", iisVersion));
            }

            Global.IISVersion = iisVersion;

            ApplicationForm mainForm = new ApplicationForm();

            if (!CheckCommandLineArgument("/nocheck"))
            {
                //Check for new versions
                if (CheckForUpdate(mainForm))
                {
                    return;
                }
                ////x64 support
                //try
                //{
                //    Utils.CheckWin64(mainForm);
                //}
                //catch (Exception ex)
                //{
                //    Log.WriteError("IIS x64 error", ex);
                //}
            }

            LoadSetupXmlFile();

            //start application
            mainForm.InitializeApplication();
            Application.Run(mainForm);
            Utils.SaveMutex();
        }
コード例 #5
0
 public static string GetQuickOsid()
 {
     OS.WindowsVersion windowsVersion = OS.GetWindowsVersion();
     return(Enum.GetName(windowsVersion.GetType(), windowsVersion));
 }