示例#1
0
 public BasicResponse makeRequest(BasicCommand command)
 {
     if (!Connected)
     {
         return(null);
     }
     lock (this) {
         return(new BasicResponse(command, sendMessage(command.ToString())));
     }
 }
示例#2
0
        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);
        }
示例#3
0
        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);
            }
        }
示例#4
0
 internal BasicResponse(Player player, BasicCommand command, string raw) : this(command, raw)
 {
     this.player = player;
 }