public BasicResponse makeRequest(BasicCommand command) { if (!Connected) { return(null); } lock (this) { return(new BasicResponse(command, sendMessage(command.ToString()))); } }
public void rescan(bool playlistsOnly) { string[] param = null; if (playlistsOnly) { param = new string[] { "playlists" }; } BasicCommand command = new BasicCommand(CommandString.RESCAN, null, param); BasicResponse result = client.makeRequest(command); }
internal BasicResponse(BasicCommand command, string raw) { this.command = command; this.raw = raw; this.decoded = HttpUtility.UrlDecode(raw); string commandBase = command.Base; valid = raw.StartsWith(commandBase, StringComparison.CurrentCultureIgnoreCase); if (valid) { responseParams = raw.Substring(commandBase.Length).Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < responseParams.Length; i++) { responseParams[i] = HttpUtility.UrlDecode(responseParams[i]); } } else { throw new InvalidResponseException("Response appears invalid", this); } }
internal BasicResponse(Player player, BasicCommand command, string raw) : this(command, raw) { this.player = player; }