/// <summary> ///如果升级程序存在,则启动升级程序,否则告诉控制端更新失败 /// </summary> private void builtUpdateServer() { string path = Directory.GetCurrentDirectory() + "\\Update.exe"; //如果Update程序已经启动,先关闭它. ServerUpdater.CloseApplication("update"); if (!File.Exists(path)) { BaseCode code = new BaseCode(); code.Head = CodeHead.UPDATE_FAIL; mainServer.SendCode(code); } else { Thread.Sleep(300); //启动Update程序 Thread updateThread = new Thread(new ThreadStart(runUpdateApp)); updateThread.Start(); //告诉控制端Update程序已经启动. Thread.Sleep(100); PortCode code = new PortCode(); code.Head = CodeHead.UPDATE_READY; code.Port = Constant.Port_Update; mainServer.SendCode(code); } }
private static void Main(string[] args) { Updater = new ServerUpdater(); Updater.OnUpdate += SyncMissionHandler.Update; string ip = "127.0.0.1"; string configPath = Path.Combine(Directory.GetCurrentDirectory(), "config.ini"); if (File.Exists(configPath)) { FileStream fs = new FileStream(configPath, FileMode.Open); StreamReader sr = new StreamReader(fs); ip = sr.ReadLine(); sr.Close(); fs.Close(); } SKServer = new SwiftKernelServer(); SKServer.Setup(IPAddress.Parse(ip), 6000, "pkillers"); SKServer.OnPeerConnected += Server_OnPeerConnected; SKServer.OnPeerDisconnected += Server_OnPeerDisconnected; SKServer.OnRequestReceived += Server_OnRequestReceived; RoomControllers.Add(new RoomController(new Room("Test Room", null))); SKServer.Start(); }
/// <summary> ///如果升级程序存在,则启动升级程序,否则告诉控制端更新失败 /// </summary> private void builtUpdateServer() { string path = Directory.GetCurrentDirectory() + "\\Update.exe"; // string path = @"D:\My Documents\Visual Studio 2005\Projects\程序设计大赛\ICANSEEYOU\Update\bin\Debug\Update.exe"; //如果Update程序已经启动,先关闭它. ServerUpdater.CloseApplication("update"); if (!File.Exists(path)) { BaseCode code = new BaseCode(); code.Head = CodeHead.UPDATE_FAIL; mainChick.SendCode(code); } else { Thread.Sleep(300); //启动Update程序 Thread updateThread = new Thread(new ThreadStart(runUpdateApp)); updateThread.Start(); //告诉控制端Update程序已经启动. Thread.Sleep(100); PortCode code = new PortCode(); code.Head = CodeHead.UPDATE_READY; code.Port = Constant.Port_Update; mainChick.SendCode(code); } }
public async Task DownloadAndExtractSteamCmdToTempPath() { // Arrange var updater = new ServerUpdater(_settings); // Act if (Directory.Exists(_settings.SteamCmdInstallDir)) { Directory.Delete(_settings.SteamCmdInstallDir, true); } await updater.EnsureSteamCmdExistsAsync(_cts.Token); // Assert Assert.True(File.Exists(_settings.SteamCmdPath)); }
public async Task RunSteamCmdUpdaterAndInstallToTempPath() { // Arrange var updater = new ServerUpdater(_settings); // Act if (Directory.Exists(_settings.SteamCmdInstallDir)) { Directory.Delete(_settings.SteamCmdInstallDir, true); } await updater.EnsureSteamCmdExistsAsync(_cts.Token); await updater.RunSteamCmdUpdaterAsync(_cts.Token); // Assert Assert.True(File.Exists(Path.Combine(_settings.ServerInstallDir, "StartServer.bat"))); }
private static async Task <int> Execute(string[] args, CancellationToken token) { var settings = SettingsParser.ParseArgs(CesxSettings.Default, args); Console.WriteLine("CESX: starting with settings"); Console.WriteLine(settings); if (!settings.SkipBackup) { Console.WriteLine("CESX: Creating backup..."); var backuper = new ServerBackuper(settings); backuper.DoBackup(); Console.WriteLine("CESX: Done!"); } if (!settings.SkipUpdate) { Console.WriteLine("CESX: Try updating server files"); _updater = new ServerUpdater(settings); Console.WriteLine("CESX: Downloading SteamCmd..."); await _updater.EnsureSteamCmdExistsAsync(token); Console.WriteLine("CESX: Done!"); Console.WriteLine("CESX: Running steamcmd..."); await _updater.RunSteamCmdUpdaterAsync(token); Console.WriteLine("CESX: Done!"); //_updater.Dispose(); } Console.WriteLine("CESX: Starting the server instance"); _server = new ServerRunner(settings); _server.Run(); return((int)ExitCode.Success); }
public CleverbotService(Cleverbot cleverbot, ServerUpdater <string> console, DiscordSocketClient client) : base(console, client) { CleverbotConnect = cleverbot; CommandName = "chat"; }
public TVroom(SocketVoiceChannel TvChannel, ServerUpdater <string> console) { Console = console; _TvChannel = TvChannel; started = DateTime.Now; }
public TvModeService(ServerUpdater <string> console, DiscordSocketClient client) : base(console, client) { client.UserVoiceStateUpdated += ProcessVoiceChannelChange; CommandName = "tvroom"; }
public TestService(string prefix, ServerUpdater <string> console) { this.prefix = prefix; this.console = console; }
public APIConnectionScheduled(ServerUpdater <string> console, DiscordSocketClient client, ScheduleMaker scheduleMaker) : base(console, client) { ScheduleMaker = scheduleMaker; }
public APIconnection(ServerUpdater <string> console, DiscordSocketClient client) : base(console, client) { }
public GWCService(ServerUpdater <string> console, DiscordSocketClient client) { Console = console; Client = client; }
public WeatherUndergroundService(WeatherUnderground weatherUndergroundConnection, ServerUpdater <string> console, DiscordSocketClient client, ScheduleMaker scheduleMaker) : base(console, client, scheduleMaker) { WeatherUndergroundConnection = weatherUndergroundConnection; CommandName = "weather"; }
public ImgurService(Imgur imgurConnection, ServerUpdater <string> console, DiscordSocketClient client, ScheduleMaker scheduleMaker) : base(console, client, scheduleMaker) { ImgurConnection = imgurConnection; CommandName = "imgur"; }