예제 #1
0
파일: SlimCli.cs 프로젝트: reeve/SlimCliLib
 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;
 }