Esempio n. 1
0
        public async void ProcessQueueItem(HttpQueueItem item)
        {
				object data = new object();
                
				// Wait for pre-defined time.
				Thread.Sleep(item.PreDelay);
			
				switch (item.Type)
                {
                    case HttpRequestType.Get:
                        data = await _wrapper.Get(item.Url.ToString(), item.Referer.ToString());
                        break;
                    case HttpRequestType.Post:
                        data = await _wrapper.Post(item.Url.ToString(), item.Referer.ToString(), item.PostData);
                        break;
                    case HttpRequestType.Binary:
                        data = await _wrapper.GetBinary(item.Url.ToString(), item.Referer.ToString());
                        break;
                }
                item.Callback.Invoke(data);

				if(item.Type == HttpRequestType.Get || item.Type == HttpRequestType.Post)
					_processors.ForEach(processor => processor.Process((string)data));
        }
Esempio n. 2
0
 public void AddQueueItem(HttpQueueItem item)
 {
     Collection.Add(item);
 }