コード例 #1
0
        public static bool Init_Server(string configFilename, string name)
        {
            MOG_Main.SetName(name);

            // Make sure we have a valid config filename?
            if (configFilename.Length == 0)
            {
                configFilename = MOG_Main.BuildDefaultConfigFile();
            }

            // Check our bootup precautions
            if (MOG_Main.CheckInitPrecautions(configFilename))
            {
                // Initialize MOG_REPORT for the server
                MOG_Time time = new MOG_Time();
                // MOG is really stable now so I am shutting off the log files so things will run faster
                //		MOG_Prompt.SetMode(MOG_PROMPT_MODE_TYPE.MOG_PROMPT_FILE);
                MOG_Report.SetLogFileName(String.Concat(Application.StartupPath, "\\Logs\\Server\\Server.", time.FormatString(String.Concat("{Day.2}", "-", "{Month.2}", "-", "{Year.2}", " ", "{Hour.2}", ".", "{Minute.2}", "{ampm}")), ".log"));

                // Create a new system
                MOG_CommandServerCS server = new MOG_CommandServerCS();
                return(MOG_ControllerSystemCS.InitializeServer(configFilename, server));
            }

            return(false);
        }
コード例 #2
0
ファイル: guiStartup.cs プロジェクト: MOGwareSupport/MOG
        public static bool SetOffline(MogMainForm mainForm, bool offline)
        {
            if (offline)
            {
                // TODO KIER How do we go offline now?

//				string targetPath = string.Concat(MOG_ControllerProject.GetGameData().GetGameDataPath(), "\\MOG\\Offline");
//				if (MOG_ControllerProject.GetProject().Offline(targetPath))
//				{
//					// Disconnect from the server
//					MOG_ControllerSystem.GoOffline();
//
//					if (MOG_ControllerSystem.GetSystem().Load(MOG_Main.BuildDefaultConfigFile(targetPath, "", "")))
//					{
//						// Reload the project
//						MOG_ControllerProject.LoginProject(MOG_ControllerProject.GetProjectName(), MOG_ControllerProject.GetBranchName());
//
//						// Set our gui
//						guiStartup.ConnectionStatus(mainForm, false);
//					}
//				}
            }
            else
            {
                // Connect to the server
                MOG_ControllerSystem.GoOnline();

                if (MOG_ControllerSystem.GetSystem().Load(MOG_Main.BuildDefaultConfigFile()))
                {
                    // Reload the project
                    MOG_ControllerProject.LoginProject(MOG_ControllerProject.GetProjectName(), MOG_ControllerProject.GetBranchName());

                    // Login user
                    MOG_ControllerProject.LoginUser(MOG_ControllerProject.GetUser().GetUserName());

                    // Set our gui
                    guiStartup.ConnectionStatus(mainForm, true);
                }
            }

            return(true);
        }