Esempio n. 1
0
        public Task <bool> HostGame(HostedGame hostedGame, HostedGameSource source, string username, string password)
        {
            DebugValidate(hostedGame, true);

            var args = "-h ";

            if (CommandLineHandler.Instance.DevMode)
            {
                args += "-x ";
            }

            if (source == HostedGameSource.Lan)
            {
                new HostedGameProcess(
                    hostedGame,
                    X.Instance.Debug,
                    true
                    ).Start();
            }

            args += $"-u \"{username}\" ";
            args += "-k \"" + HostedGame.Serialize(hostedGame) + "\"";

            return(LaunchJodsEngine(args));
        }
Esempio n. 2
0
 public HostedGameData(Guid id, Guid gameguid, Version gameversion, int port, string name, User huser,
                       DateTime startTime, string gameName, string gameIconUrl, bool hasPassword, IPAddress ipAddress, HostedGameSource source, EHostedGame status, bool spectator)
 {
     ProcessId   = -1;
     Id          = id;
     GameGuid    = gameguid;
     GameVersion = gameversion;
     Port        = port;
     Name        = name;
     Username    = huser.UserName;
     GameStatus  = status;
     TimeStarted = startTime;
     HasPassword = hasPassword;
     GameName    = gameName;
     IpAddress   = ipAddress;
     Source      = source;
     Spectator   = spectator;
     GameIconUrl = gameIconUrl;
     if (huser.ApiUser != null)
     {
         UserIconUrl = huser.ApiUser.IconUrl;
     }
     if (UserIconUrl == null)
     {
         UserIconUrl = "";
     }
     if (GameIconUrl == null)
     {
         GameIconUrl = "";
     }
 }
Esempio n. 3
0
 public HostedGameData(Guid id,Guid gameguid, Version gameversion, int port, string name, User huser,
     DateTime startTime, string gameName, string gameIconUrl, bool hasPassword, IPAddress ipAddress, HostedGameSource source, EHostedGame status, bool spectator)
     : base("gameitem", "gameitem", "octgn:gameitem")
 {
     ProcessId = -1;
     Id = id;
     GameGuid = gameguid;
     GameVersion = gameversion;
     Port = port;
     Name = name;
     Username = huser.UserName;
     GameStatus = status;
     TimeStarted = startTime;
     HasPassword = hasPassword;
     GameName = gameName;
     IpAddress = ipAddress;
     Source = source;
     Spectator = spectator;
     GameIconUrl = gameIconUrl;
     if(huser.ApiUser != null)
         UserIconUrl = huser.ApiUser.IconUrl;
     if (UserIconUrl == null)
         UserIconUrl = "";
     if (GameIconUrl == null)
         GameIconUrl = "";
 }
Esempio n. 4
0
        public Task <bool> HostGame(HostedGame hostedGame, HostedGameSource source, string username, string password)
        {
            DebugValidate(hostedGame, true);

            //duct-tape fix for a game server bug where online-hosted games lose the chosen password
            //TODO: remove this check when the bug is fixed server-side (see git issue ticket #2109)
            if (!password.Equals(hostedGame.Password))
            {
                hostedGame.Password = password;
            }

            var args = "-h ";

            if (CommandLineHandler.Instance.DevMode)
            {
                args += "-x ";
            }

            if (source == HostedGameSource.Lan)
            {
                new HostedGameProcess(
                    hostedGame,
                    X.Instance.Debug,
                    true
                    ).Start();
            }

            args += $"-u \"{username}\" ";
            args += "-k \"" + HostedGame.Serialize(hostedGame) + "\"";

            return(LaunchJodsEngine(args));
        }
Esempio n. 5
0
 public HostedGameData(Guid id, Guid gameguid, Version gameversion, int port, string name, User huser,
                       DateTime startTime, string gameName, bool hasPassword, IPAddress ipAddress, HostedGameSource source, EHostedGame status, bool spectator)
     : base("gameitem", "gameitem", "octgn:gameitem")
 {
     ProcessId   = -1;
     Id          = id;
     GameGuid    = gameguid;
     GameVersion = gameversion;
     Port        = port;
     Name        = name;
     Username    = huser.UserName;
     GameStatus  = status;
     TimeStarted = startTime;
     HasPassword = hasPassword;
     GameName    = gameName;
     IpAddress   = ipAddress;
     Source      = source;
     Spectator   = spectator;
 }
Esempio n. 6
0
 public HostedGame(Guid id, Guid gameguid, Version gameversion, Version octgnVersion, string name, User huser,
                   string gameName, string gameIconUrl, string userIconUrl, bool hasPassword,
                   string hostAddress, HostedGameStatus status, HostedGameSource source, bool spectators)
 {
     Id              = id;
     Name            = name;
     HostUser        = huser;
     GameName        = gameName;
     GameId          = gameguid;
     GameVersion     = gameversion.ToString();
     OctgnVersion    = octgnVersion.ToString();
     HasPassword     = hasPassword;
     Spectators      = spectators;
     GameIconUrl     = gameIconUrl ?? string.Empty;
     HostUserIconUrl = userIconUrl ?? string.Empty;
     HostAddress     = hostAddress;
     Status          = status;
     Source          = source;
     DateCreated     = DateTimeOffset.Now;
 }
Esempio n. 7
0
 public HostedGame(HostedGame game, bool includeSensitiveData)
 {
     Id              = game.Id;
     Name            = game.Name;
     HostUser        = game.HostUser;
     GameId          = game.GameId;
     GameName        = game.GameName;
     GameVersion     = game.GameVersion;
     OctgnVersion    = game.OctgnVersion;
     HasPassword     = game.HasPassword;
     Spectators      = game.Spectators;
     GameIconUrl     = game.GameIconUrl;
     HostUserIconUrl = game.HostUserIconUrl;
     HostAddress     = game.HostAddress;
     Status          = game.Status;
     Source          = game.Source;
     DateCreated     = game.DateCreated;
     DateStarted     = game.DateStarted;
     Password        = includeSensitiveData ? game.Password : string.Empty;
     ProcessId       = includeSensitiveData ? game.ProcessId : 0;
 }