Ejemplo n.º 1
0
        /// <summary>
        ///   Host a game.
        /// </summary>
        /// <param name="port"> Port we are hosting on. </param>
        /// <param name="gameguid"> GUID of the game </param>
        /// <param name="gameversion"> Version of the game </param>
        /// <param name="name"> Name of the room </param>
        /// <param name="password"> Password for the game </param>
        /// <param name="hoster"> User hosting the game </param>
        public HostedGame(int port, Guid gameguid, Version gameversion, string name, string password, NewUser hoster, bool localGame = false)
        {
            GameLog       = "";
            GameGuid      = gameguid;
            GameVersion   = gameversion;
            Name          = name;
            Password      = password;
            Hoster        = hoster;
            Status        = Lobby.EHostedGame.StoppedHosting;
            Port          = port;
            TimeStarted   = new DateTime(0);
            LocalGame     = localGame;
            StandAloneApp = new Process();
            StandAloneApp.StartInfo.FileName  = Directory.GetCurrentDirectory() + "\\Octgn.StandAloneServer.exe";
            StandAloneApp.StartInfo.Arguments = "-g=" + GameGuid + " -v=" + GameVersion + " -p=" +
                                                Port.ToString(CultureInfo.InvariantCulture);
#if (DEBUG || TestServer)
#else
            if (!LocalGame)
            {
                StandAloneApp.StartInfo.FileName  = Directory.GetCurrentDirectory() + "\\Octgn.StandAloneServer.exe";
                StandAloneApp.StartInfo.Arguments = "-g=" + GameGuid + " -v=" + GameVersion + " -p=" +
                                                    Port.ToString(CultureInfo.InvariantCulture);
            }
#endif

            StandAloneApp.StartInfo.RedirectStandardOutput = true;
            StandAloneApp.StartInfo.RedirectStandardInput  = true;
            StandAloneApp.StartInfo.RedirectStandardError  = true;
            StandAloneApp.StartInfo.UseShellExecute        = false;
            StandAloneApp.StartInfo.CreateNoWindow         = true;
            StandAloneApp.Exited             += StandAloneAppExited;
            StandAloneApp.ErrorDataReceived  += new DataReceivedEventHandler(StandAloneAppOnErrorDataReceived);
            StandAloneApp.OutputDataReceived += new DataReceivedEventHandler(StandAloneAppOnOutputDataReceived);
            StandAloneApp.EnableRaisingEvents = true;
        }
Ejemplo n.º 2
0
 public void MakeGroupChat(NewUser gcu)
 {
     IsGroupChat = true;
     GroupUser   = gcu;
 }
Ejemplo n.º 3
0
 public HostedGameData(Guid gameguid, Version gameversion, int port, string name, NewUser huser,
                       DateTime startTime)
     : base("gameitem", "gameitem", "octgn:gameitem")
 {
     GameGuid    = gameguid;
     GameVersion = gameversion;
     Port        = port;
     Name        = name;
     UserHosting = huser;
     GameStatus  = EHostedGame.StartedHosting;
     TimeStarted = startTime;
 }