static void ExecuteCommand(string word) { //Trim the extra spacing word = word.Trim(); //Prepare the command and its body string command = word; string body = ""; //Split the command and the values. int whitespaceIndex = word.IndexOf(' '); if (whitespaceIndex >= 0) { command = word.Substring(0, whitespaceIndex); if (whitespaceIndex < word.Length) { body = word.Substring(whitespaceIndex + 1); } } //Parse the command switch (command.ToLowerInvariant()) { case "close": client.Dispose(); break; #region State & Details case "state": presence.State = body; client.SetPresence(presence); break; case "details": presence.Details = body; client.SetPresence(presence); break; #endregion #region Asset Examples case "large_key": //If we do not have a asset object already, we must create it if (!presence.HasAssets()) { presence.Assets = new Assets(); } //Set the key then send it away presence.Assets.LargeImageKey = body; client.SetPresence(presence); break; case "large_text": //If we do not have a asset object already, we must create it if (!presence.HasAssets()) { presence.Assets = new Assets(); } //Set the key then send it away presence.Assets.LargeImageText = body; client.SetPresence(presence); break; case "small_key": //If we do not have a asset object already, we must create it if (!presence.HasAssets()) { presence.Assets = new Assets(); } //Set the key then send it away presence.Assets.SmallImageKey = body; client.SetPresence(presence); break; case "small_text": //If we do not have a asset object already, we must create it if (!presence.HasAssets()) { presence.Assets = new Assets(); } //Set the key then send it away presence.Assets.SmallImageText = body; client.SetPresence(presence); break; #endregion case "help": Console.WriteLine("Available Commands: state, details, large_key, large_text, small_key, small_text"); break; default: Console.WriteLine("Unkown Command '{0}'. Try 'help' for a list of commands", command); break; } }