示例#1
0
        /// <summary>
        /// 获得打补丁之前 各个服务的状态
        /// </summary>
        private void GetServiceStatus()
        {
            App.dicAllServiceStatus.Clear();
            OperationReturn optReturn = null;

            for (int i = 0; i < App.lstAllServiceNames.Count; i++)
            {
                optReturn = CommonFuncs.GetComputerServiceStatus(App.lstAllServiceNames[i]);
                if (!optReturn.Result)
                {
                    App.WriteLog("Service " + App.lstAllServiceNames[i] + " not installed");
                    App.WriteLog(optReturn.Message);
                }
                else
                {
                    ServiceEnty service = optReturn.Data as ServiceEnty;
                    App.dicAllServiceStatus.Add(App.lstAllServiceNames[i], service);
                    switch (service.ServiceStatus)
                    {
                    case (int)ServiceStatusType.Not_Exit:
                        App.WriteLog("Service " + App.lstAllServiceNames[i] + " not installed");
                        break;

                    case (int)ServiceStatusType.Started:
                        App.WriteLog("Service " + App.lstAllServiceNames[i] + " installed and started");
                        break;

                    case (int)ServiceStatusType.Stoped:
                        App.WriteLog("Service " + App.lstAllServiceNames[i] + " installed and stoped");
                        break;
                    }
                }
            }
        }