private void OnPackageDownloaderSendingRequest(object sender, WebRequestEventArgs e)
        {
            if (_currentOperation != null)
            {
                string operation = _currentOperation.Item1;
                string mainPackageId = _currentOperation.Item2;
                string mainPackageVersion = _currentOperation.Item3;

                if (!String.IsNullOrEmpty(mainPackageId) && !String.IsNullOrEmpty(_packageDownloader.CurrentDownloadPackageId))
                {
                    if (!mainPackageId.Equals(_packageDownloader.CurrentDownloadPackageId, StringComparison.OrdinalIgnoreCase))
                    {
                        operation = operation + "-Dependency";
                    }
                }

                e.Request.Headers[RepositoryOperationNames.OperationHeaderName] = operation;

                if (!operation.Equals(_currentOperation.Item1, StringComparison.OrdinalIgnoreCase))
                {
                    e.Request.Headers[RepositoryOperationNames.DependentPackageHeaderName] = mainPackageId;
                    if (!String.IsNullOrEmpty(mainPackageVersion))
                    {
                        e.Request.Headers[RepositoryOperationNames.DependentPackageVersionHeaderName] = mainPackageVersion;
                    }
                }

                RaiseSendingRequest(e);
            }
        }
		WebRequest FireSendingRequestEvent (FakePackageRepositoryWithHttpClientEvents clientEvents)
		{
			var request = new FakeWebRequest ();
			request.Headers = new WebHeaderCollection ();

			var eventArgs = new WebRequestEventArgs (request);
			clientEvents.RaiseSendingRequestEvent (eventArgs);

			return request;
		}
		WebRequest FireSendingRequestEvent(IHttpClientEvents clientEvents)
		{
			WebRequest request = CreateWebRequest();
			request.Headers = new WebHeaderCollection();
			
			var eventArgs = new WebRequestEventArgs(request);
			clientEvents.Raise(
				events => events.SendingRequest += null,
				clientEvents,
				eventArgs);
			
			return request;
		}
		public void RaiseSendingRequestEvent (WebRequestEventArgs e)
		{
			if (SendingRequest != null) {
				SendingRequest (this, e);
			}
		}
 void SendingRequest(object sender, WebRequestEventArgs e)
 {
     HttpUtility.SetUserAgent(e.Request, userAgent.ToString());
 }
 private void OnSendingRequest(object sender, WebRequestEventArgs webRequestArgs)
 {
     SendingRequest(this, webRequestArgs);
 }
 private void RaiseSendingRequest(WebRequestEventArgs e)
 {
     if (_sendingRequest != null)
     {
         _sendingRequest(this, e);
     }
 }
예제 #8
0
 private void OnSendingRequest(object sender, WebRequestEventArgs webRequestArgs)
 {
     SendingRequest(this, webRequestArgs);
 }
 private void OnSendingRequest(object sender, WebRequestEventArgs e)
 {
     base.DeliverEvent(sender, e);
 }
예제 #10
0
 private void SourceRepository_SendingRequest(object sender, WebRequestEventArgs e)
 {
     HttpUtility.SetUserAgent(e.Request, this.UserAgent);
 }
 private void OnSendingRequest(object sender, WebRequestEventArgs e)
 {
     base.DeliverEvent(sender, e);
 }
예제 #12
0
 void repository_sendingRequest(object sender, WebRequestEventArgs e)
 {
     this.addLog("Registro sending request " + e.Request.ToString() );
 }