public static bool ProcessCommandLine(bool testForShellExec) { string[] cmdLineArgs = Environment.GetCommandLineArgs(); if (testForShellExec && cmdLineArgs.Length > 1 && cmdLineArgs[1].ToLowerInvariant() == "launch") { List <string> files = new List <string>(); for (int i = 2; i < cmdLineArgs.Length; i++) { files.Add(cmdLineArgs[i]); } try { CommandType cmdType = (CommandType)Enum.Parse(typeof(CommandType), ProTONEConfig.ExplorerLaunchType); if (SuiteRegistrationSupport.IsContextMenuHandlerRegistered() && (cmdType == CommandType.PlayFiles || cmdType == CommandType.EnqueueFiles)) { if (RemoteControlHelper.IsPlayerRunning()) { // There is another player instance that is running. // Just pass the command to that instance and exit. RemoteControlHelper.SendPlayerCommand(cmdType, files.ToArray()); } else { // There is no other player instance. // This instance needs to process the command itself. // Note: when player is launched like this - clear previous playlist first. _commandQueue.Add(BasicCommand.Create(CommandType.ClearPlaylist)); _commandQueue.Add(BasicCommand.Create(cmdType, files.ToArray())); return(false); // Don't exit } } } catch (Exception ex) { ErrorDispatcher.DispatchError(ex, false); } return(true); } return(false); }
protected override void SendRequestInternal(string request) { try { BasicCommand cmd = BasicCommand.Create(request); if (cmd != null) { RemoteControlHelper.SendPlayerCommand(cmd, true); } } catch (Exception ex) { Logger.LogException(ex); } }
public static string SendServiceCommand(string serverMachineName, CommandType cmdType, string[] args) { try { BasicCommand command = BasicCommand.Create(cmdType, args); return(SendServiceData(serverMachineName, command.ToString())); } catch (Exception ex) { Logger.LogException(ex); } return("NAK\r\n"); }
public static void SendPlayerCommand(CommandType cmdType, string[] args, bool useIpc = false) { SendPlayerCommand(BasicCommand.Create(cmdType, args), useIpc); }