Exemplo n.º 1
0
        internal RovioResponse Request(string url, int timeout = 5000, params RequestItem[] parameters)
        {
            StringBuilder sb        = new StringBuilder(url);
            bool          firstItem = true;

            foreach (RequestItem item in parameters)
            {
                if (firstItem)
                {//第一个参数
                    sb.Append("?");
                    firstItem = false;
                }
                else
                {
                    sb.Append("&");
                }

                sb.Append(item.Key);
                sb.Append("=");
                sb.Append(RovioWebClient.UrlEncode(item.Value, this.encoding));
            }

            //发起请求
            string responseString = DownloadString(sb.ToString(), timeout);

            return(new RovioResponse(responseString));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RovioAPI" /> class.
        /// </summary>
        /// <param name="settings">The settings.</param>
        public RovioAPI(string host, int port, NetworkCredential credentials)
        {
            this.rwc = new RovioWebClient(host, port, credentials);

            this.movement     = new MovementController(this);
            this.manualDriver = this.movement.ManualDriver;
            this.camera       = new CameraController(this);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RovioAPI" /> class.
        /// </summary>
        /// <param name="settings">The settings.</param>
        public RovioAPI(string host, int port, NetworkCredential credentials)
        {
            this.rwc = new RovioWebClient(host, port, credentials);

            this.movement = new MovementController(this);
            this.manualDriver = this.movement.ManualDriver;
            this.camera = new CameraController(this);
        }