Пример #1
0
        public string Exec()
        {
            PcsManager pcs = PcsPool.GetByUrl(pcsUrl);
            string     serverURLs;
            bool       result;

            if (ServerList.Servers.Count > 0)
            {
                serverURLs = String.Join(",", ServerList.Servers);
                result     = pcs.StartServer(pid, serverUrl, msecPerRound, numPlayers, serverURLs);
            }
            else
            {
                result = pcs.StartServer(pid, serverUrl, msecPerRound, numPlayers, null);
            }

            if (result == true)
            {
                ServerList.AddServer(serverUrl);
                PcsPool.LinkPid(pid, pcsUrl);

                return(String.Empty);
            }
            else
            {
                return("Error - process not started");
            }
        }
Пример #2
0
        public string Exec()
        {
            PcsManager pcs = PcsPool.GetByPid(pid);

            if (pcs != null)
            {
                string localState = pcs.LocalState(pid, roundId);
                string filePath   = "../OGP/PuppetMaster/bin/Debug/LocalState/";
                string filename   = String.Format("LocalState-{0}-{1}", pid, roundId);

                string directory = Path.Combine(System.Environment.CurrentDirectory, filePath);
                Directory.CreateDirectory(directory);

                StreamWriter file = new StreamWriter(directory + filename)
                {
                    AutoFlush = true,
                    NewLine   = Environment.NewLine
                };
                using (file)
                {
                    file.Write(localState);
                    file.Close();
                }
                Console.WriteLine(String.Format("State written to {0}", directory + filename));
                return(localState);
            }

            return(String.Empty);
        }
Пример #3
0
        public string Exec()
        {
            PcsManager pcs = PcsPool.GetByPid(srcPid);

            if (pcs != null)
            {
                pcs.InjectDelay(srcPid, dstPid);
            }

            return(String.Empty);
        }
Пример #4
0
        public string Exec()
        {
            PcsManager pcs = PcsPool.GetByPid(pid);

            if (pcs != null)
            {
                pcs.Unfreeze(pid);
            }

            return(String.Empty);
        }
Пример #5
0
        public string Exec()
        {
            StringBuilder result = new StringBuilder();

            foreach (string pid in PcsPool.GetAllPids())
            {
                PcsManager pcs = PcsPool.GetByPid(pid);
                if (pcs != null)
                {
                    string globalStatus = pcs.GlobalStatus(pid);
                    result.Append(globalStatus);
                }
            }

            return(result.ToString());
        }
Пример #6
0
        public string Exec()
        {
            PcsManager pcs = PcsPool.GetByUrl(pcsUrl);

            string serverURLs = String.Join(",", ServerList.Servers);

            bool result = pcs.StartClient(pid, clientUrl, msecPerRound, numPlayers, filename, serverURLs);

            if (result == true)
            {
                PcsPool.LinkPid(pid, pcsUrl);

                return(String.Empty);
            }
            else
            {
                return("Error - process not started");
            }
        }