コード例 #1
0
        public void StartRequest(byte[] postData, string contentType)
        {
            _PostData    = postData;
            _ContentType = contentType;

            if (_Client.IsBusy)
            {
                Logger.Log("New CAPS request to " + _Client.Location +
                           " initiated, closing previous request", Helpers.LogLevel.Warning);
                _Client.CancelAsync();
            }
            else
            {
                Logger.DebugLog("New CAPS request to " + _Client.Location + " initiated");
            }

            // Proxy
            if (Proxy != null)
            {
                _Client.Proxy = Proxy;
            }

            // Content-Type
            _Client.Headers.Clear();
            if (!String.IsNullOrEmpty(contentType))
            {
                _Client.Headers.Add(HttpRequestHeader.ContentType, contentType);
            }
            else
            {
                _Client.Headers.Add(HttpRequestHeader.ContentType, "application/xml");
            }

            if (postData == null)
            {
                _Client.DownloadStringAsync(_Client.Location);
            }
            else
            {
                _Client.UploadDataAsync(_Client.Location, postData);
            }
        }
コード例 #2
0
        public void Stop(bool immediate)
        {
            _Dead = true;

            if (immediate)
            {
                _Running = false;
            }

            if (_Client.IsBusy)
            {
                SecondLife.DebugLogStatic("Stopping a running event queue");
                _Client.CancelAsync();
            }
            else
            {
                SecondLife.DebugLogStatic("Stopping an already dead event queue");
            }
        }