Ejemplo n.º 1
0
        private void Start()
        {
            if (System.IO.File.Exists(simulationModelTextBox.Text))
            {
                simEngine.Initialize(simulationModelTextBox.Text, Int32.Parse(serverPortTextBox.Text));
                simEngine.StartSimCore();
                hostnameTextBox.Text = simEngine.GetServerHostName();
                UpdateForm();
                bbClient = simEngine.GetBlackboardClient();



                SubscribeToObject("PhysicalObject");
                SubscribeToObject("DecisionMaker");
                SubscribeToObject("Team");
                SubscribeToObject("SensorNetwork");
                SubscribeToObject("LandRegion");
                SubscribeToObject("ScoringRegion");
                SubscribeToObject("ActiveRegion");


                simulationModelButton.Enabled  = false;
                simulationModelTextBox.Enabled = false;
                serverPortTextBox.Enabled      = false;

                //start logging thread
                if (checkBoxReplayLog.Checked)
                {
                    string logPath = "log.txt";
                    string logMode = "Detailed";
                    if (textBoxReplayLog.Text != "")
                    {
                        logPath = textBoxReplayLog.Text;
                    }
                    if (radioButtonLimited.Checked)
                    {
                        logMode = "Limited";
                    }

                    simEngine.StartReplayLogger(logPath, logMode, SimCoreServer.SimCoreServer.GetProductVersion(), SimCoreServer.SimCoreServer.GetCompileDate());
                }
                checkBoxReplayLog.Enabled = false;
                startReplayButton.Enabled = true;
            }
            else
            {
                MessageBox.Show("Must set simulation model file first");
            }
        }
Ejemplo n.º 2
0
 public SimCoreServer()
 {
     ServerOptions.ReadFile();
     WriteClientAppConfig();
     simEngine.Initialize(ServerOptions.SimulationModelPath, ServerOptions.PortNumber);
     simEngine.StartSimCore();
     simEngine.StartViewManager();
     eventClient = new SimulationEventDistributorClient();
     simEngine.simCore.distributor.RegisterClient(ref eventClient);
     eventClient.Subscribe("PauseScenarioRequest");
     eventClient.Subscribe("ResumeScenarioRequest");
     eventClient.Subscribe("LoadScenarioRequest");
     eventClient.Subscribe("StopScenarioRequest");
     eventClient.Subscribe("SimCoreReady");
     eventClient.Subscribe("ForkReplayStarted");
     eventClient.Subscribe("ForkReplayFinished");
     eventClient.Subscribe("GameSpeedRequest"); //AD: UN-Removed for now
 }