Esempio n. 1
0
 public HostedGameViewModel(IHostedGameData data)
 {
     Data = data;
     var game = GameManager.Get().GetById(data.GameGuid);
     this.Id = data.Id;
     this.GameId = data.GameGuid;
     this.GameVersion = data.GameVersion;
     this.Name = data.Name;
     this.User = data.Username;
     this.Port = data.Port;
     this.Status = data.GameStatus;
     this.StartTime = data.TimeStarted;
     this.GameName = data.GameName;
     this.HasPassword = data.HasPassword;
     this.Visible = true;
     UpdateVisibility();
     switch (data.Source)
     {
         case HostedGameSource.Online:
             GameSource = "Online";
             break;
         case HostedGameSource.Lan:
             GameSource = "Lan";
             break;
     }
     if (game == null) return;
     this.CanPlay = true;
     this.GameName = game.Name;
     this.IPAddress = data.IpAddress;
 }
Esempio n. 2
0
 public static bool TryKillGame(this IHostedGameData game)
 {
     try
     {
         using (var p = Process.GetProcessById(game.ProcessId))
         {
             p.Kill();
             return(p.WaitForExit(10000));
         }
     }
     catch (Exception e)
     {
         Log.Error("TryKillGame Error", e);
     }
     return(false);
 }
Esempio n. 3
0
        public HostedGameViewModel(IHostedGameData data)
        {
            //Data = data;
            var game = GameManager.Get().GetById(data.GameGuid);

            this.Id          = data.Id;
            this.GameId      = data.GameGuid;
            this.GameVersion = data.GameVersion;
            this.Name        = data.Name;
            this.User        = data.Username;
            this.Port        = data.Port;
            this.Status      = data.GameStatus;
            this.StartTime   = data.TimeStarted;
            this.GameName    = data.GameName;
            this.HasPassword = data.HasPassword;
            this.Visible     = true;
            this.Spectator   = data.Spectator;
            UpdateVisibility();
            switch (data.Source)
            {
            case HostedGameSource.Online:
                GameSource = "Online";
                break;

            case HostedGameSource.Lan:
                GameSource = "Lan";
                break;
            }
            if (game == null)
            {
                return;
            }
            this.CanPlay   = true;
            this.GameName  = game.Name;
            this.IPAddress = data.IpAddress;
        }