public void Execute(JukeClient client, CommandOutput output, string[] arguments) { if (arguments.Length < 1) { output.WriteError("Missing song title param"); return; } output.WriteMessage("Enqueueing " + arguments[0]); client.Play(arguments[0]); }
public void Execute(JukeClient client, CommandOutput output, string[] arguments) { var info = client.GetInfo(); Console.WriteLine("J.U.K.E. Info:"); foreach (var key in info.Keys) { Console.WriteLine(key + ": " + info[key]); } Console.WriteLine("------------------"); }
public CommandInterpreter(JukeClient client) { this.client = client; var currentAssembly = Assembly.GetAssembly(GetType()); var types = currentAssembly.GetTypes(); foreach (var type in types) { if (!type.IsAbstract && type.IsClass && type.GetInterfaces().Contains(typeof(Command))) { var instance = (Command)Activator.CreateInstance(type);; commands.Add(instance); } } }
public void Execute(JukeClient client, CommandOutput output, string[] arguments) { if (arguments.Length < 1) { output.WriteError("Missing query argument"); return; } var response = client.Search(arguments[0]); output.WriteMessage("Found:"); foreach (var info in response) { output.WriteMessage(info); } output.WriteMessage("--------------"); }
public void Execute(JukeClient client, CommandOutput output, string[] arguments) { if (arguments.Length < 1) { output.WriteError("Missing argument filename"); return; } var response = client.LoadLibrary(arguments[0]); if (response) { output.WriteMessage("Command completed."); } else { output.WriteError("Command failed"); } }
public void Execute(JukeClient client, CommandOutput output, string[] arguments) { var processes = Process.GetProcessesByName("GrpcJukeServer"); if (processes.Length > 0) { output.WriteError("Service already started"); client.StreamOutput(); return; } string path = "./GrpcJukeServer"; if (arguments.Length > 0) { path = arguments[0]; } output.WriteMessage("Starting from " + path); if (!File.Exists(path)) { output.WriteError("File doesn't exist."); return; } var result = client.Startup(path, arguments.Length > 1); if (result) { output.WriteMessage("Service started"); client.StreamOutput(); } else { output.WriteError("Service NOT started"); } }
public void Execute(JukeClient client, CommandOutput output, string[] arguments) { var info = client.PlayRandom(); output.WriteMessage("Added random"); }
public void Execute(JukeClient client, CommandOutput output, string[] arguments) { client.AddSongs(arguments[0]); }
public void Execute(JukeClient client, CommandOutput output, string[] arguments) { client.Shutdown(); }