private static void Main(string[] args) { while (true) { ConsoleClient.Execute(System.Console.ReadLine().Split(' ')); } }
static void Main(string[] args) { var bootstrapper = BootStrapper.BootstrapSystem(new CoreModule()); var missionList = bootstrapper.Resolve <IMissionList>(); var missionCommander = bootstrapper.Resolve <IMissionCommander>(); var consoleLogger = bootstrapper.Resolve <IConsoleLogger>(); var consoleClient = new ConsoleClient(missionList, consoleLogger, missionCommander); consoleClient.Run(); }
public static void AddPhotoMetadata(this ConsoleClient item, string imageFile, string metadataFile) { var args = new string[] { "-overwrite_original", "-MakerNotes:all=", "-json=\"" + metadataFile + "\"", "\"" + imageFile + "\"", }; item.Run(args); }
public static async System.Threading.Tasks.Task <int> Main(string[] args) { var client = new ConsoleClient(); if (!client.ParseArguments(args)) { return(1); } await client.Run(); return(0); }
public Form1() { InitializeComponent(); _writer = new TextBoxStreamWriter(txtLogBox); Console.SetOut(_writer); client = new ConsoleClient(); client.OnConnect += Client_OnConnect; client.OnDisconnect += Client_OnDisconnect; client.OnDataReceived += Client_OnDataReceived; client.Start(); }
public static void ResizeAndWriteMainImage(this ConsoleClient item, string inputFile, string outputFile) { var args = new string[] { "convert", "\"" + inputFile + "\"" + "[0]", "-resize @1500000", "-format JPEG", "-quality 85", "\"" + outputFile + "\"", }; item.Run(args); }
public AppContext Initialise() { AtomicParsley = Environment.ExpandEnvironmentVariables(AtomicParsley); Ffmpeg = Environment.ExpandEnvironmentVariables(Ffmpeg); Ffprobe = Environment.ExpandEnvironmentVariables(Ffprobe); InputDirectory = Environment.ExpandEnvironmentVariables(InputDirectory); TempDirectory = Environment.ExpandEnvironmentVariables(TempDirectory); OutputDirectory = Environment.ExpandEnvironmentVariables(OutputDirectory); AtomicParsleyCommand = new ConsoleClient(AtomicParsley); FfmpegCommand = new ConsoleClient(Ffmpeg); FfprobeCommand = new ConsoleClient(Ffprobe); return(this); }
public AppContext Initialise() { Ffmpeg = Environment.ExpandEnvironmentVariables(Ffmpeg); Ffprobe = Environment.ExpandEnvironmentVariables(Ffprobe); InputDirectory = Environment.ExpandEnvironmentVariables(InputDirectory); OutputDirectory = Environment.ExpandEnvironmentVariables(OutputDirectory); ShowNameMapFile = Environment.ExpandEnvironmentVariables(ShowNameMapFile); FfmpegCommand = new ConsoleClient(Ffmpeg); FfprobeCommand = new ConsoleClient(Ffprobe); ShowNameMap = ShowNameMapEntry.LoadFromFile(ShowNameMapFile, optional: true); return(this); }
public static void Main(string[] args) { // Set the console title Console.Title = "Contxt Example"; // Create a console client ConsoleClient client = new ConsoleClient(); // Create a parser Parser parser = new Parser(); // Add containers to the parser parser.AddContainer("Choice", typeof(ChoiceNodeContainer)); parser.AddContainer("Text", typeof(TextNodeContainer)); parser.AddContainer("Set", typeof(SetNodeContainer)); parser.AddContainer("Value", typeof(ValueNodeContainer)); parser.AddContainer("Branch", typeof(BranchNodeContainer)); // Read the example script string[] lines = File.ReadAllLines("./example.ctxt"); // Parse the script ParseResult result = parser.Parse(lines); // If parsing failed, print the error if (result.Result != ParseResult.ResultType.Success) { Console.ForegroundColor = ConsoleColor.Red; Console.Error.WriteLine("Fatal error!"); Console.ResetColor(); Console.Error.WriteLine("{0} on line {1}: {2}", result.Message, result.LineNumber, result.Line); } // Get the first node in the parsed tree INode <string> current = parser.GetNode <INode <string> >(1); // Execute every node until the end while (current != null) { current = current.Execute(client); } // Wait for input to exit Console.WriteLine("\nPress any key to exit . . ."); Console.ReadKey(true); }
static void Main(string[] args) { ConsoleClient client; if (args.Length == 2) { var ip = args[0]; int.TryParse(args[1], out int port); client = new ConsoleClient(ip, port); } else { client = new ConsoleClient(); } client.StartClient().ConfigureAwait(true); }
public static void TestInitialize(string testName) { var workingDir = "$work/" + testName; Kit.Setup(workingDirectory: workingDir, diagnosticsDirectory: "$diagnostics"); ConsoleClient.Setup(minLevel: LogLevel.Log); var nativeWorkingDir = "../../../" + workingDir; if (Directory.Exists(nativeWorkingDir)) { foreach (var file in Directory.GetFiles(nativeWorkingDir)) { File.Delete(file); } Assert.IsTrue(Directory.GetFiles(nativeWorkingDir).Length == 0); } }
public virtual void Run(string[] args) { Console.InputEncoding = DefaultEncoding; Console.OutputEncoding = DefaultEncoding; var game = new Game(); game.Start(); var quit = false; var client = new ConsoleClient(game, () => quit = true); var connector = game.Connect(client); while (!quit) { var command = Console.ReadLine(); if (!quit) { connector.RunUserCommand(command); } } }
public void ShowStatus(string command, string[] args) { int ClientsCount = socketObj.ConnectedClients.Count; int HardwareClientsCount = 0; int ConsoleClientsCount = 0; foreach (var item in socketObj.ConnectedClients) { if (item.Value.IsBot == true) { HardwareClientsCount++; } else { ConsoleClientsCount++; } } int i = 0; IGConsole.Instance.println("Clients(" + ClientsCount + "), HardwareClients(" + HardwareClientsCount + "), ConsoleClients(" + ConsoleClientsCount + ")", false); IGConsole.Instance.println("", false); IGConsole.Instance.println("index ClientID IsBot TargetClient ViwersCount GPSPos", false); foreach (var item in socketObj.ConnectedClients) { if (item.Value.IsBot == true) { HardwareClient hc = item.Value as HardwareClient; IGConsole.Instance.println(i.ToString("D3") + " " + hc.Id.ToString("D19") + " " + hc.IsBot.ToString().ToUpper().PadRight(5) + " N/A " + hc.ViwerCount.ToString("D3") + " " + hc.gPSPosition.LocationName.ToString() + ", latitude: " + hc.gPSPosition.latitude + ", longitude: " + hc.gPSPosition.longitude, false); } else { ConsoleClient cc = item.Value as ConsoleClient; IGConsole.Instance.println(i.ToString("D3") + " " + cc.Id.ToString("D19") + " " + cc.IsBot.ToString().ToUpper().PadRight(5) + " " + cc.TargetBot.ToString("D19") + " N/A N/A", false); } i++; } }
public void OnAction(Hashtable parameters) { Console.Title = "Build by Thiago Hajjar"; Console.WriteLine("Starting GameServer ... Edit by Thiago Hajjar!"); GameServer.CreateInstance(new GameServerConfig()); GameServer.Instance.Start(); GameServer.KeepRunning = true; Console.WriteLine("Server started!"); client = new ConsoleClient(); Thread thread = new Thread(() => Application.Run(new CommandForm())); thread.SetApartmentState(ApartmentState.STA); thread.Start(); while (GameServer.KeepRunning) { try { handler = new ConsoleCtrlDelegate(ConsoleStart.ConsoleCtrHandler); SetConsoleCtrlHandler(handler, true); Console.Write("> "); string[] source = Console.ReadLine().Split(new char[] { ' ' }); List <string> list = source.ToList <string>(); list.RemoveAt(0); DoCommand(source[0], list.ToArray()); } catch (Exception exception) { Console.WriteLine(exception); } } if (GameServer.Instance != null) { GameServer.Instance.Stop(); } LogManager.Shutdown(); }
public static void Main(string[] args) { IClient client = new ConsoleClient(); client.Run(); }
public void OnAction(System.Collections.Hashtable parameters) { System.Console.WriteLine("This server GunnyII, edit and build by MrPhuong!"); System.Console.WriteLine("Starting GameServer ... please wait a moment!"); CenterServer.CreateInstance(new CenterServerConfig()); ConsoleStart.StartServer(); ConsoleClient client = new ConsoleClient(); bool flag = true; while (flag) { try { System.Console.Write("> "); string text = System.Console.ReadLine(); string[] array = text.Split(new char[] { '&' }); string key; switch (key = array[0].ToLower()) { case "exit": flag = false; continue; case "notice": if (array.Length < 2) { System.Console.WriteLine("公告需要公告内容,用&隔开!"); continue; } CenterServer.Instance.SendSystemNotice(array[1]); continue; case "reload": if (array.Length < 2) { System.Console.WriteLine("加载需要指定表,用&隔开!"); continue; } CenterServer.Instance.SendReload(array[1]); continue; case "shutdown": CenterServer.Instance.SendShutdown(); continue; case "help": System.Console.WriteLine(this.HelpStr); continue; case "AAS": if (array.Length < 2) { System.Console.WriteLine("加载需要指定状态true or false,用&隔开!"); continue; } CenterServer.Instance.SendAAS(bool.Parse(array[1])); continue; } if (text.Length > 0) { if (text[0] == '/') { text = text.Remove(0, 1); text = text.Insert(0, "&"); } try { if (!CommandMgr.HandleCommandNoPlvl(client, text)) { System.Console.WriteLine("Unknown command: " + text); } } catch (System.Exception ex) { System.Console.WriteLine(ex.ToString()); } } } catch (System.Exception ex2) { System.Console.WriteLine("Error:" + ex2.ToString()); } } if (CenterServer.Instance != null) { CenterServer.Instance.Stop(); } }
private static void Main(string[] args) { ConsoleClient.StartMain("BrotherEchoActor"); }
/// <summary> /// Defines the entry point of the application. /// </summary> /// <param name="args">The arguments.</param> private static void Main([CanBeNull][PublicAPI] string[] args) { ConsoleClient.Run("Test Client"); }
public ConsoleClientTests() { sut = new ConsoleClient(); }
/// <summary> /// Handles the server action /// </summary> /// <param name="parameters"></param> public void OnAction(Hashtable parameters) { Console.WriteLine("Starting GameServer ... please wait a moment!"); GameServer.CreateInstance(new GameServerConfig()); GameServer.Instance.Start(); GameServer.KeepRunning = true; Console.WriteLine("Server started!"); ConsoleClient client = new ConsoleClient(); while (GameServer.KeepRunning) { try { handler = ConsoleCtrHandler; SetConsoleCtrlHandler(handler, true); Console.Write("> "); string line = Console.ReadLine(); string[] para = line.Split(' '); switch (para[0]) { case "exit": GameServer.KeepRunning = false; break; case "cp": GameClient[] clients = GameServer.Instance.GetAllClients(); int clientCount = clients == null ? 0 : clients.Length; GamePlayer[] players = WorldMgr.GetAllPlayers(); int playerCount = players == null ? 0 : players.Length; List <BaseRoom> rooms = RoomMgr.GetAllUsingRoom(); int roomCount = 0; int gameCount = 0; foreach (BaseRoom r in rooms) { if (!r.IsEmpty) { roomCount++; if (r.IsPlaying) { gameCount++; } } } double memoryCount = GC.GetTotalMemory(false); Console.WriteLine(string.Format("Total Clients/Players:{0}/{1}", clientCount, playerCount)); Console.WriteLine(string.Format("Total Rooms/Games:{0}/{1}", roomCount, gameCount)); Console.WriteLine(string.Format("Total Momey Used:{0} MB", memoryCount / 1024 / 1024)); break; case "shutdown": _count = 6; //_timer = new Timer(new TimerCallback(GameServer.Instance.ShutDownCallBack), null, 0, 60 * 1000); _timer = new Timer(new TimerCallback(ShutDownCallBack), null, 0, 60 * 1000); break; case "savemap": //TODO: break; case "clear": Console.Clear(); break; case "ball&reload": if (BallMgr.ReLoad()) { Console.WriteLine("Ball info is Reload!"); } else { Console.WriteLine("Ball info is Error!"); } break; case "map&reload": if (MapMgr.ReLoadMap()) { Console.WriteLine("Map info is Reload!"); } else { Console.WriteLine("Map info is Error!"); } break; case "mapserver&reload": if (MapMgr.ReLoadMapServer()) { Console.WriteLine("mapserver info is Reload!"); } else { Console.WriteLine("mapserver info is Error!"); } break; case "prop&reload": if (PropItemMgr.Reload()) { Console.WriteLine("prop info is Reload!"); } else { Console.WriteLine("prop info is Error!"); } break; case "item&reload": if (ItemMgr.ReLoad()) { Console.WriteLine("item info is Reload!"); } else { Console.WriteLine("item info is Error!"); } break; case "shop&reload": if (ShopMgr.ReLoad()) { Console.WriteLine("shop info is Reload!"); } else { Console.WriteLine("shop info is Error!"); } break; case "quest&reload": if (QuestMgr.ReLoad()) { Console.WriteLine("quest info is Reload!"); } else { Console.WriteLine("quest info is Error!"); } break; case "fusion&reload": if (FusionMgr.ReLoad()) { Console.WriteLine("fusion info is Reload!"); } else { Console.WriteLine("fusion info is Error!"); } break; case "consortia&reload": if (ConsortiaMgr.ReLoad()) { Console.WriteLine("consortiaMgr info is Reload!"); } else { Console.WriteLine("consortiaMgr info is Error!"); } break; case "rate&reload": if (RateMgr.ReLoad()) { Console.WriteLine("Rate Rate is Reload!"); } else { Console.WriteLine("Rate Rate is Error!"); } break; case "fight&reload": if (FightRateMgr.ReLoad()) { Console.WriteLine("FightRateMgr is Reload!"); } else { Console.WriteLine("FightRateMgr is Error!"); } break; case "dailyaward&reload": if (AwardMgr.ReLoad()) { Console.WriteLine("dailyaward is Reload!"); } else { Console.WriteLine("dailyaward is Error!"); } break; case "language&reload": if (LanguageMgr.Reload("")) { Console.WriteLine("language is Reload!"); } else { Console.WriteLine("language is Error!"); } break; case "nickname": Console.WriteLine("Please enter the nickname"); string nickname = Console.ReadLine(); string state = WorldMgr.GetPlayerStringByPlayerNickName(nickname); Console.WriteLine(state); break; default: if (line.Length <= 0) { break; } if (line[0] == '/') { line = line.Remove(0, 1); line = line.Insert(0, "&"); } try { bool res = CommandMgr.HandleCommandNoPlvl(client, line); if (!res) { Console.WriteLine("Unknown command: " + line); } } catch (Exception e) { Console.WriteLine(e.ToString()); } break; } } catch (Exception ex) { Console.WriteLine(ex); } } if (GameServer.Instance != null) { GameServer.Instance.Stop(); } LogManager.Shutdown(); }
static void Main(string[] args) { Console.Title = "KLF Client " + KLFCommon.ProgramVersion; Console.WriteLine("KLF Client Copyright (C) 2013 Alfred Lam"); Console.WriteLine("This program comes with ABSOLUTELY NO WARRANTY; for details type `/show'."); Console.WriteLine("This is free software, and you are welcome to redistribute it"); Console.WriteLine("under certain conditions; type `/show' for details."); Console.WriteLine(); ConsoleClient client = new ConsoleClient(); Configuration = ClientSettings.Load(Path.Combine("./", Filename)); while(true) { Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Green; Console.Write("Username: "******"Server Address: "); Console.ResetColor(); Console.WriteLine(((Uri)Configuration.GetDefaultServer()).ToString()); Console.ForegroundColor = ConsoleColor.Green; Console.Write("Auto-Reconnect: "); Console.ResetColor(); Console.WriteLine(Configuration.Reconnect); Console.ResetColor(); Console.WriteLine(); Console.WriteLine("/name change username"); //Console.WriteLine("/auth change token"); Console.WriteLine("/add add server"); Console.WriteLine("/select select default server"); Console.WriteLine("/connect connect to default server"); Console.WriteLine("/auto toggle auto-reconnect"); Console.WriteLine("/quit quit KLFClient"); String[] MenuArgs = Console.ReadLine().Split(' '); switch(MenuArgs[0].ToLowerInvariant()) { case "/quit": case "/q": Console.Write("Closing.\n"); return; case "/name": case "/n": case "/user": case "/u": if(MenuArgs.Length > 1) Configuration.Username = MenuArgs[1]; else { Console.Write("Enter your new username: "******"/auth": //TODO auth token feature break; case "/add": case "/server": String hn; Int32 pn; Console.Write("Host name or IP Address: "); hn = Console.ReadLine(); Console.Write("Port number: "); Int32.TryParse(Console.ReadLine(), out pn); if(Configuration.AddServer(hn, pn)) Console.WriteLine("Server Added."); else Console.WriteLine("Bad input."); Configuration.Save(Filename); break; case "/auto": case "/a": Configuration.Reconnect = !Configuration.Reconnect; Configuration.Save(Filename); break; case "/select": case "/sel": case "/list": case "/default": case "/def": Int32 choice = 0; foreach(ServerProfile server in Configuration.Servers) Console.WriteLine(" {0}{1} {2}", choice++, server.Default?"*":" ", server.Uri.ToString()); Console.Write("Choose default server: "); if(!Int32.TryParse(Console.ReadLine(), out choice)) choice = -1;//invalid if(0 <= choice && choice < Configuration.Servers.Count) { Configuration.SetDefaultServer(choice); Configuration.Save(Filename); Console.WriteLine("Default saved."); } else Console.WriteLine("Invalid index. No changes."); break; case "/connect": case "/co": //TODO validate if(Configuration.ValidServer(Configuration.GetDefaultServer().Host, Configuration.GetDefaultServer().Port)) client.Connect(Configuration); else Console.WriteLine("/add a server then use /def to select default."); break; case "/show": ShowLicense(); break; default: break; } }//end while }
static void Main(string[] args) { ConsoleClient.Execute(args); }
public void BaseInitialize() { Kit.Setup(isTest: true, useFileDiagnostics: true); ConsoleClient.Setup(minLevel: LogLevel.Log); }
public MainWindow() : base(Gtk.WindowType.Toplevel) { Build(); ActionEntry[] entries = new ActionEntry[] { new ActionEntry("menu-engine", null, "_Engine", null, null, null), new ActionEntry("unpause", null, "Unpause", "<ctrl>U", null, OnUnpause), new ActionEntry("menu-script", null, "_Script", null, null, null), new ActionEntry("rebuild-and-reload", null, "Rebuild And Reload", null, null, OnRebuildAndReload), new ActionEntry("menu-connect", null, "_Connect", null, null, null), new ActionEntry("reconnect", null, "Reconnect", "<ctrl>R", null, null) }; Actions = new ActionGroup("group"); Actions.Add(entries); UI.InsertActionGroup(Actions, 0); UI.AddUiFromResource("Menu.xml"); AddAccelGroup(UI.AccelGroup); MenuBar menuBar = (MenuBar)UI.GetWidget("/MenuBar"); vbox1.PackStart(menuBar, false, false, 0); // Create tags for color-formatted text TextTag tagInfo = new Gtk.TextTag("info"); tagInfo.BackgroundGdk = new Gdk.Color(255, 255, 255); TextTag tagWarning = new Gtk.TextTag("warning"); tagWarning.BackgroundGdk = new Gdk.Color(255, 255, 153); TextTag tagError = new Gtk.TextTag("error"); tagError.BackgroundGdk = new Gdk.Color(255, 153, 153); TextTag tagDebug = new Gtk.TextTag("debug"); tagDebug.BackgroundGdk = new Gdk.Color(224, 224, 224); textview1 = new TextView(); textview1.Editable = false; textview1.CanFocus = false; TextBuffer textbuffer1 = textview1.Buffer; textbuffer1.TagTable.Add(tagInfo); textbuffer1.TagTable.Add(tagWarning); textbuffer1.TagTable.Add(tagError); textbuffer1.TagTable.Add(tagDebug); scrolledwindow1 = new ScrolledWindow(); scrolledwindow1.Add(textview1); vbox1.PackStart(scrolledwindow1, true, true, 0); entry1 = new Entry(); entry1.KeyPressEvent += new KeyPressEventHandler(OnEntryKeyPressed); entry1.Activated += new EventHandler(OnEntryActivated); vbox1.PackStart(entry1, false, true, 0); EnableMainMenu(false); Actions.GetAction("menu-script").Sensitive = false; Client = new ConsoleClient(); Client.ConnectedEvent += OnConnected; Client.DisconnectedEvent += OnDisconnected; Client.MessageReceivedEvent += OnMessageReceived; Connect(Address, Port); ShowAll(); }
public ConsoleHandle(IEditorClientProvider editorClientProvider) { _consoleHandle = editorClientProvider.GetClient <ConsoleClient>(); }
/// <summary> /// Handles the server action /// </summary> /// <param name="parameters"></param> public void OnAction(Hashtable parameters) { Console.WriteLine("Starting GameServer ... please wait a moment!"); CenterServer.CreateInstance(new CenterServerConfig()); StartServer(); ConsoleClient client = new ConsoleClient(); bool run = true; while (run) { try { Console.Write("> "); string line = Console.ReadLine(); string[] para = line.Split('&'); switch (para[0].ToLower()) { case "exit": run = false; break; case "notice": if (para.Length < 2) { Console.WriteLine("公告需要公告内容,用&隔开!"); } else { CenterServer.Instance.SendSystemNotice(para[1]); } break; case "reload": if (para.Length < 2) { Console.WriteLine("加载需要指定表,用&隔开!"); } else { CenterServer.Instance.SendReload(para[1]); } //ServerMgr.ReLoadServerList(); break; case "shutdown": CenterServer.Instance.SendShutdown(); break; case "help": Console.WriteLine(HelpStr); break; case "AAS": if (para.Length < 2) { Console.WriteLine("加载需要指定状态true or false,用&隔开!"); } else { CenterServer.Instance.SendAAS(bool.Parse(para[1])); } break; default: if (line.Length <= 0) { break; } if (line[0] == '/') { line = line.Remove(0, 1); line = line.Insert(0, "&"); } try { bool res = CommandMgr.HandleCommandNoPlvl(client, line); if (!res) { Console.WriteLine("Unknown command: " + line); } } catch (Exception e) { Console.WriteLine(e.ToString()); } break; } } catch (Exception ex) { Console.WriteLine("Error:" + ex.ToString()); } } if (CenterServer.Instance != null) { CenterServer.Instance.Stop(); } }
static void Main(string[] args) { settings = new ClientSettings(); ConsoleClient client = new ConsoleClient(); Console.Title = "KLF Client " + KLFCommon.PROGRAM_VERSION; Console.WriteLine("KLF Client version " + KLFCommon.PROGRAM_VERSION); Console.WriteLine("Created by Alfred Lam"); Console.WriteLine(); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); for (int i = 0; i < settings.favorites.Length; i++) settings.favorites[i] = String.Empty; settings.readConfigFile(CONFIG_FILENAME); if (args.Length > 0 && args.First() == "connect") { client.connect(settings); } while (true) { Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Green; Console.Write("Username: "******"Server Address: "); Console.ResetColor(); Console.WriteLine(settings.hostname); Console.ForegroundColor = ConsoleColor.Green; Console.Write("Auto-Reconnect: "); Console.ResetColor(); Console.WriteLine(settings.autoReconnect); Console.ResetColor(); Console.WriteLine(); Console.WriteLine("Enter N to change name, A to toggle auto-reconnect"); Console.WriteLine("IP to change address"); Console.WriteLine("FAV to favorite current address, LIST to pick a favorite"); Console.WriteLine("C to connect, Q to quit"); String in_string = Console.ReadLine().ToLower(); if (in_string == "q") { break; } else if (in_string == "n") { Console.Write("Enter your new username: "******"ip") { Console.Write("Enter the IP Address/Host Name: "); { settings.hostname = Console.ReadLine(); settings.writeConfigFile(CONFIG_FILENAME); } } else if (in_string == "a") { settings.autoReconnect = !settings.autoReconnect; settings.writeConfigFile(CONFIG_FILENAME); } else if (in_string == "fav") { int replace_index = -1; //Check if any favorite entries are empty for (int i = 0; i < settings.favorites.Length; i++) { if (settings.favorites[i].Length <= 0) { replace_index = i; break; } } if (replace_index < 0) { //Ask the user which favorite to replace Console.WriteLine(); listFavorites(); Console.WriteLine(); Console.Write("Enter the index of the favorite to replace: "); if (!int.TryParse(Console.ReadLine(), out replace_index)) replace_index = -1; } if (replace_index >= 0 && replace_index < settings.favorites.Length) { //Set the favorite settings.favorites[replace_index] = settings.hostname; settings.writeConfigFile(CONFIG_FILENAME); Console.WriteLine("Favorite saved."); } else Console.WriteLine("Invalid index."); settings.writeConfigFile(CONFIG_FILENAME); } else if (in_string == "list") { int index = -1; //Ask the user which favorite to choose Console.WriteLine(); listFavorites(); Console.WriteLine(); Console.Write("Enter the index of the favorite: "); if (!int.TryParse(Console.ReadLine(), out index)) index = -1; if (index >= 0 && index < settings.favorites.Length) { settings.hostname = settings.favorites[index]; settings.writeConfigFile(CONFIG_FILENAME); } else Console.WriteLine("Invalid index."); } else if (in_string == "c") client.connect(settings); } }
public void OnAction(Hashtable parameters) { Console.WriteLine("This server GunnyII, edit and build by SkelletonX!"); Console.WriteLine("Starting GameServer ... please wait a moment!"); GameServer.CreateInstance(new GameServerConfig()); GameServer.Instance.Start(); GameServer.KeepRunning = true; Console.WriteLine("Server started!"); ConsoleClient client = new ConsoleClient(); while (GameServer.KeepRunning) { try { ConsoleStart.handler = new ConsoleStart.ConsoleCtrlDelegate(ConsoleStart.ConsoleCtrHandler); ConsoleStart.SetConsoleCtrlHandler(ConsoleStart.handler, true); Console.Write("> "); string text = Console.ReadLine(); string[] array = text.Split(new char[] { ' ' }); string key; switch (key = array[0]) { case "exit": GameServer.KeepRunning = false; continue; //dragonares case "lock": Console.Clear(); Console.WriteLine("Ten tai khoan: "); string bnickname = Console.ReadLine(); Console.WriteLine("Ly do band: "); string breason = Console.ReadLine(); DateTime dt2 = new DateTime(2014, 07, 02); //Tempo de banimento using (ManageBussiness mg = new ManageBussiness()) { mg.ForbidPlayerByNickName(bnickname, dt2, false); } Console.WriteLine("Nguoi dung " + bnickname + " da bi khoa."); break; case "unlock": Console.Clear(); Console.WriteLine("Ten tai khoan: "); string bnickname2 = Console.ReadLine(); DateTime dt22 = new DateTime(2014, 07, 02); //Tempo de banimento using (ManageBussiness mg = new ManageBussiness()) { mg.ForbidPlayerByNickName(bnickname2, dt22, true); } Console.WriteLine("Nguoi dung " + bnickname2 + " da mo khoa."); break; case "thongbao": { Console.WriteLine("Thong bao: "); string value = Console.ReadLine(); Console.WriteLine(string.Format(value)); Console.WriteLine("Thong bao thanh cong ."); continue; } case "cp": { GameClient[] allClients = GameServer.Instance.GetAllClients(); int num2 = (allClients == null) ? 0 : allClients.Length; GamePlayer[] allPlayers = WorldMgr.GetAllPlayers(); int num3 = (allPlayers == null) ? 0 : allPlayers.Length; List <BaseRoom> allUsingRoom = RoomMgr.GetAllUsingRoom(); int num4 = 0; int num5 = 0; foreach (BaseRoom current in allUsingRoom) { if (!current.IsEmpty) { num4++; if (current.IsPlaying) { num5++; } } } double num6 = (double)GC.GetTotalMemory(false); Console.WriteLine(string.Format("Total Clients/Players:{0}/{1}", num2, num3)); Console.WriteLine(string.Format("Total Rooms/Games:{0}/{1}", num4, num5)); Console.WriteLine(string.Format("Total Momey Used:{0} MB", num6 / 1024.0 / 1024.0)); continue; } case "shutdown": ConsoleStart._count = 6; ConsoleStart._timer = new Timer(new TimerCallback(ConsoleStart.ShutDownCallBack), null, 0, 60000); continue; case "savemap": continue; case "clear": Console.Clear(); continue; case "ball&reload": if (BallMgr.ReLoad()) { Console.WriteLine("Ball info is Reload!"); continue; } Console.WriteLine("Ball info is Error!"); continue; case "map&reload": if (MapMgr.ReLoadMap()) { Console.WriteLine("Map info is Reload!"); continue; } Console.WriteLine("Map info is Error!"); continue; case "mapserver&reload": if (MapMgr.ReLoadMapServer()) { Console.WriteLine("mapserver info is Reload!"); continue; } Console.WriteLine("mapserver info is Error!"); continue; case "prop&reload": if (PropItemMgr.Reload()) { Console.WriteLine("prop info is Reload!"); continue; } Console.WriteLine("prop info is Error!"); continue; case "item&reload": if (ItemMgr.ReLoad()) { Console.WriteLine("item info is Reload!"); continue; } Console.WriteLine("item info is Error!"); continue; case "shop&reload": if (ShopMgr.ReLoad()) { Console.WriteLine("shop info is Reload!"); continue; } Console.WriteLine("shop info is Error!"); continue; case "quest&reload": if (QuestMgr.ReLoad()) { Console.WriteLine("quest info is Reload!"); continue; } Console.WriteLine("quest info is Error!"); continue; case "fusion&reload": if (FusionMgr.ReLoad()) { Console.WriteLine("fusion info is Reload!"); continue; } Console.WriteLine("fusion info is Error!"); continue; case "consortia&reload": if (ConsortiaMgr.ReLoad()) { Console.WriteLine("consortiaMgr info is Reload!"); continue; } Console.WriteLine("consortiaMgr info is Error!"); continue; case "rate&reload": if (RateMgr.ReLoad()) { Console.WriteLine("Rate Rate is Reload!"); continue; } Console.WriteLine("Rate Rate is Error!"); continue; case "fight&reload": if (FightRateMgr.ReLoad()) { Console.WriteLine("FightRateMgr is Reload!"); continue; } Console.WriteLine("FightRateMgr is Error!"); continue; case "dailyaward&reload": if (AwardMgr.ReLoad()) { Console.WriteLine("dailyaward is Reload!"); continue; } Console.WriteLine("dailyaward is Error!"); continue; case "language&reload": if (LanguageMgr.Reload("")) { Console.WriteLine("language is Reload!"); continue; } Console.WriteLine("language is Error!"); continue; case "nickname": { Console.WriteLine("Please enter the nickname"); string nickName = Console.ReadLine(); string playerStringByPlayerNickName = WorldMgr.GetPlayerStringByPlayerNickName(nickName); Console.WriteLine(playerStringByPlayerNickName); continue; } } if (text.Length > 0) { if (text[0] == '/') { text = text.Remove(0, 1); text = text.Insert(0, "&"); } try { if (!CommandMgr.HandleCommandNoPlvl(client, text)) { Console.WriteLine("Unknown command: " + text); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } } catch (Exception value) { Console.WriteLine(value); } } if (GameServer.Instance != null) { GameServer.Instance.Stop(); } LogManager.Shutdown(); }