Beispiel #1
0
        public virtual Engine Create(TimerFactory timerFactory, ReadyEventHandler readyHandler = null)
        {
            Engine engine = null;

            Process       process = new Process();
            StringBuilder args    = new StringBuilder(100);

            foreach (string arg in EngineConfiguration.Arguments)
            {
                if (args.Length > 0)
                {
                    args.Append(' ');
                }
                args.Append(arg);
            }
            ProcessStartInfo si = new ProcessStartInfo(EngineConfiguration.Command, args.ToString());

            si.UseShellExecute        = false;
            si.RedirectStandardInput  = true;
            si.RedirectStandardOutput = true;
            si.WorkingDirectory       = EngineConfiguration.WorkingDirectory;
            si.WindowStyle            = ProcessWindowStyle.Hidden;
            si.CreateNoWindow         = true;
            process.StartInfo         = si;
            process.Start();
            process.BeginOutputReadLine();

            if (EngineConfiguration.Protocol == "xboard")
            {
                engine = new XBoardEngine(MessageLog, timerFactory, process);
            }
            else
            {
                throw new Exception("unsupported protocol");
            }

            if (readyHandler != null)
            {
                engine.Ready += readyHandler;
            }

            engine.SetupProcess();
            engine.ApplyConfiguration(EngineConfiguration);
            engine.Start();

            return(engine);
        }
 public OnReadyHostedService(DiscordSocketClient discordSocketClient, ReadyEventHandler readyEventHandler)
 {
     _discordSocketClient = discordSocketClient;
     _readyEventHandler   = readyEventHandler;
 }
Beispiel #3
0
 /// <summary>
 /// Tell the LockStep Server, you'v been ready to play the game
 /// </summary>
 /// <param name="callback">Callback.</param>
 public abstract void Ready(ReadyEventHandler callback);
Beispiel #4
0
 public override void Ready(ReadyEventHandler callback)
 {
     readyEventHandler = callback;
     hasReady          = false;
     gcloud_lockstep_ready();
 }