private bool ProcessInput(string data) { // FFArguments string[] args = data.Substring(2).Split('\t'); switch (data.Substring(0, 2)) { case "00": // Authenticate AuthenticatedClient = (data.Substring(2).Equals(Settings.Get("MgmtPassword", "89vuhir9gvhur43u9vhiru09c9icv23ri9dfvoui34t8rgfhukq4r8"))); SendClientData("00" + ((AuthenticatedClient) ? "OK" : "BAD")); // 00OK/00BAD break; case "01": // Shut down gracefully if (!AuthenticatedClient) { return(true); } Wrapper.Stop(true); Thread.Sleep(10000); Environment.Exit(0); break; case "02": // Restart gracefully. if (!AuthenticatedClient) { return(true); } Wrapper.Stop(false); break; case "03": // Set server config value X to Y if (!AuthenticatedClient) { return(true); } Wrapper.SetConfig(args[0], args[1]); break; case "04": // Get server config value X if (!AuthenticatedClient) { return(true); } string val = Wrapper.GetConfig(args[0]); SendClientData("04" + val); break; case "05": // Get/Set wrapper settings. if (!AuthenticatedClient) { return(true); } if (args.Length == 2) { Settings.Set(args[0], args[1]); } else { string valu = Settings.Get(args[0], ""); SendClientData("05" + valu); } break; case "06": // Get Memory Usage if (!AuthenticatedClient) { return(true); } SendClientData("06" + Wrapper.GetServerMemory()); break; case "07": // Restart wrapper Wrapper.Stop(true); Listener.Stop(); // fffffffffff if (Environment.OSVersion.Platform == PlatformID.Win32NT) { Process.Start("LaunchServer.exe"); } else { Process.Start("mono", "LaunchServer.exe"); } return(false); case "08": // Raw server command if (!AuthenticatedClient) { return(true); } Wrapper.SendCommand(data.Substring(2)); return(true); case "09": // Combined stats ( # dweebs, memory usage) if (!AuthenticatedClient) { return(true); } SendClientData("09" + Wrapper.CurrentPlayers.Count.ToString() + "\t" + Wrapper.GetServerMemory().ToString()); return(true); default: if (!AuthenticatedClient) { return(true); } Wrapper.SendCommand(data); break; } return(true); }