コード例 #1
0
        private static int LocalConsole_cfg()
        {
            DebugCenter instance       = DebugCenter.GetInstance();
            int         lastStatusCode = instance.getLastStatusCode();

            if (lastStatusCode == DebugCenter.ST_Unknown)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.srvFailUnknown, new string[]
                {
                    lastStatusCode.ToString("X4")
                }));
                Program.ExitApp();
                return(-1);
            }
            if (lastStatusCode == DebugCenter.ST_DiskFull)
            {
                if (EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.srvFailDiskFull, new string[0]), MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    Program.ExitApp();
                    return(-1);
                }
                progressPopup progressPopup = new progressPopup("Service Checker", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_startsrv, new string[0]), Resources.login_background, new progressPopup.ProcessInThread(Program.StartService), null, 0);
                progressPopup.StartPosition = FormStartPosition.CenterScreen;
                progressPopup.ShowDialog();
                object return_V = progressPopup.Return_V;
                int?   num      = return_V as int?;
                if (num == -1 || num == -2)
                {
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.srvFail, new string[0]));
                    Program.ExitApp();
                    return(-1);
                }
                return(-2);
            }
            else
            {
                if ((lastStatusCode & DebugCenter.ST_fatalMask) == 0)
                {
                    ServiceController serviceController = new ServiceController(EcoGlobalVar.gl_ServiceName);
                    if (serviceController.Status.Equals(ServiceControllerStatus.Stopped))
                    {
                        progressPopup progressPopup2 = new progressPopup("Service Checker", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_startsrv, new string[0]), Resources.login_background, new progressPopup.ProcessInThread(Program.StartService), null, 0);
                        progressPopup2.StartPosition = FormStartPosition.CenterScreen;
                        progressPopup2.ShowDialog();
                        object return_V2 = progressPopup2.Return_V;
                        int?   num2      = return_V2 as int?;
                        if (num2 == -1 || num2 == -2)
                        {
                            EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.srvFail, new string[0]));
                            Program.ExitApp();
                            return(-1);
                        }
                        return(-2);
                    }
                    else
                    {
                        if (!Program.isService_initfinish())
                        {
                            int num3 = Program.waitService_initfinish();
                            if (num3 == -2)
                            {
                                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.srvFail, new string[0]));
                                Program.ExitApp();
                                return(-1);
                            }
                            return(-2);
                        }
                        else
                        {
                            if (lastStatusCode == DebugCenter.ST_Success)
                            {
                                return(0);
                            }
                            DBUrl.RUNMODE = 1;
                            DBCacheStatus.DBSyncEventInit(false);
                            DBCacheEventProcess.StartRefreshThread(false);
                            DBCache.DBCacheInit(false);
                            if ((lastStatusCode & DebugCenter.ST_MYSQLCONNECT_LOST) != 0)
                            {
                                string text = "Lost DB connection. Please check your MySQL database service.";
                                EcoMessageBox.ShowWarning(text, MessageBoxButtons.OK);
                            }
                            if (lastStatusCode == DebugCenter.ST_MYSQLCONNECT_LOST)
                            {
                                return(0);
                            }
                            registrySettings registrySettings = new registrySettings(lastStatusCode);
                            registrySettings.ShowDialog();
                            return(0);
                        }
                    }
                }
                else
                {
                    if (lastStatusCode == DebugCenter.ST_DbUpgrade || lastStatusCode == DebugCenter.ST_SysdbNotExist || lastStatusCode == DebugCenter.ST_LogdbNotExist || lastStatusCode == DebugCenter.ST_DatadbNotExist || lastStatusCode == DebugCenter.ST_SysdbNotMatch || lastStatusCode == DebugCenter.ST_ImportDatabase_ERROR)
                    {
                        restoredb    restoredb    = new restoredb(1);
                        DialogResult dialogResult = restoredb.ShowDialog();
                        if (dialogResult != DialogResult.OK)
                        {
                            commUtil.ShowInfo_DEBUG("restoredbdlg.ShowDialog() result is not DialogResult.OK!!!!!");
                        }
                    }
                    else
                    {
                        DBUrl.RUNMODE = 1;
                        registrySettings registrySettings = new registrySettings(lastStatusCode);
                        DialogResult     dialogResult2    = registrySettings.ShowDialog();
                        if (dialogResult2 != DialogResult.OK)
                        {
                            Program.ExitApp();
                            return(-1);
                        }
                    }
                    progressPopup progressPopup3 = new progressPopup("Service Checker", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_startsrv, new string[0]), Resources.login_background, new progressPopup.ProcessInThread(Program.StartService), null, 0);
                    progressPopup3.StartPosition = FormStartPosition.CenterScreen;
                    progressPopup3.ShowDialog();
                    object return_V3 = progressPopup3.Return_V;
                    int?   num4      = return_V3 as int?;
                    if (num4 == -1 || num4 == -2)
                    {
                        EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.srvFail, new string[0]));
                        Program.ExitApp();
                        return(-1);
                    }
                    return(-2);
                }
            }
        }