public GameserverViewModel(Gameserver gameserver) { _gameserver = gameserver; ViewModelLoopTask(() => { OnPropertyChanged(nameof(Status)); OnPropertyChanged(nameof(IsRunning)); OnPropertyChanged(nameof(IsInstalled)); Console.WriteLine("test"); }, 250); StartCommand = new CommandImplementation(o => Start()); StopCommand = new CommandImplementation(o => Stop()); RestartCommand = new CommandImplementation(o => Restart()); KillCommand = new CommandImplementation(o => Kill()); DeleteCommand = new CommandImplementation(o => Delete()); InstallCommand = new CommandImplementation(o => Install()); UninstallCommand = new CommandImplementation(o => Uninstall()); ReinstallCommand = new CommandImplementation(o => Reinstall()); WipeMapCommand = new CommandImplementation(o => WipeMap()); WipeBPCommand = new CommandImplementation(o => WipeMapAndBP()); }
internal static void DownloadUmod(Gameserver gameserver) { try { using (WebClient webClient = new WebClient()) { webClient.DownloadFile(_UMOD_INFO_URL, gameserver.WorkingDirectory); } } catch (WebException) { return; } }
internal static bool IsRCONPortOpen(Gameserver gameserver) { using (System.Net.Sockets.UdpClient udpClient = new System.Net.Sockets.UdpClient()) { try { udpClient.Connect(gameserver.RCON_IP, gameserver.RCON_Port); udpClient.Close(); return(true); } catch (Exception) { return(false); } } }
internal static bool IsGamePortOpen(Gameserver gameserver) { using (System.Net.Sockets.TcpClient tcpClient = new System.Net.Sockets.TcpClient()) { try { tcpClient.Connect(gameserver.Server_IP, gameserver.Server_Port); tcpClient.Close(); return(true); } catch (Exception) { return(false); } } }
public GameserverViewModel() { _gameserver = new Gameserver(); StartCommand = new CommandImplementation(o => Start()); StopCommand = new CommandImplementation(o => Stop()); RestartCommand = new CommandImplementation(o => Restart()); KillCommand = new CommandImplementation(o => Kill()); DeleteCommand = new CommandImplementation(o => Delete()); InstallCommand = new CommandImplementation(o => Install()); UninstallCommand = new CommandImplementation(o => Uninstall()); ReinstallCommand = new CommandImplementation(o => Reinstall()); WipeMapCommand = new CommandImplementation(o => WipeMap()); WipeBPCommand = new CommandImplementation(o => WipeMapAndBP()); }
/// <summary> /// get a server name /// </summary> /// <param name="server"></param> /// <returns></returns> private string GetserverStr(Gameserver server) { switch (server) { case Gameserver.android01: return("gf_android"); case Gameserver.bb01: return("bilibili"); case Gameserver.hun01: return("oppo"); case Gameserver.hun02: return("xiaomi"); case Gameserver.ios01: return("gf_ios"); case Gameserver.yyb01: return("tencent"); default: return("gf_android"); } }
public Server_modinfo(Gameserver sser) { server = sser; }