Click here to Skip to main content
15,894,539 members
Articles / Programming Languages / C#

The Razor Framework :: Part 1 :: Plugins/Extensibility

Rate me:
Please Sign up or sign in to vote.
4.93/5 (127 votes)
11 Mar 2005CPOL36 min read 351.8K   1.4K   446  
An extensible dependency based plugin framework for .NET Applications.
using System;
using System.Diagnostics;
using System.Collections;

namespace Razor.Networking.Http
{
	/// <summary>
	/// Summary description for HttpMessageProgressEventArgs.
	/// </summary>
	public class HttpMessageProgressEventArgs
	{
		protected HttpMessage _message;
		protected bool _justHeaders;
		protected byte[] _bytes;			
		protected int _totalBytes;
		protected object _stateObject;

		/// <summary>
		/// Initializes a new instance of the X class
		/// </summary>
		/// <param name="message">The message being processed</param>
		/// <param name="justHeaders">A flag to indicated that only the message headers have been processed</param>
		/// <param name="bytes">The bytes that were just processed</param>
		/// <param name="totalBytes">The total number of bytes that have been processed</param>
		public HttpMessageProgressEventArgs(HttpMessage message, bool justHeaders, byte[] bytes, int totalBytes)
		{
			_message = message;
			_justHeaders = justHeaders;
			_bytes = bytes;
			_totalBytes = totalBytes;
		}

		/// <summary>
		/// Initializes a new instance of the HttpMessageProgressEventArgs class
		/// </summary>
		/// <param name="message">The message being processed</param>
		/// <param name="justHeaders">A flag to indicated that only the message headers have been processed</param>
		/// <param name="bytes">The bytes that were just processed</param>
		/// <param name="totalBytes">The total number of bytes that have been processed</param>
		/// <param name="stateObject">A user defined object that can be used to hold state information about the event</param>
		public HttpMessageProgressEventArgs(HttpMessage message, bool justHeaders, byte[] bytes, int totalBytes, object stateObject)
		{
			_message = message;
			_justHeaders = justHeaders;
			_bytes = bytes;
			_totalBytes = totalBytes;
			_stateObject = stateObject;
		}

		/// <summary>
		/// Returns the message that is being received
		/// </summary>
		public HttpMessage Message
		{
			get
			{
				return _message;				
			}
		}

		/// <summary>
		/// Returns a flag that indicates the progress just reflects upon the headers
		/// </summary>
		public bool JustHeaders
		{
			get
			{
				return _justHeaders;
			}
		}

		/// <summary>
		/// Returns the array of bytes that have just been received from the connection, but not yet processed
		/// </summary>
		public byte[] Bytes
		{
			get
			{
				return _bytes;
			}
		}

		/// <summary>
		/// Returns the total number of bytes that have been processed thus far
		/// </summary>
		public int TotalBytes
		{
			get
			{
				return _totalBytes;
			}
		}		

		/// <summary>
		/// Returns a user defined state object that can be used to determine the context of the event
		/// </summary>
		public object StateObject
		{
			get
			{
				return _stateObject;
			}
		}
	}

	public delegate void HttpMessageProgressEventHandler(object sender, HttpMessageProgressEventArgs e);
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
Senior Application Developer specializing in Windows desktop and network development.

Professional Experience
- B.S. of Computer Science (Graduated 2001 - PSU)
- Senior Application Developer (8+ yrs)
- Microsoft Certified Professional

Primary Interests
- C#, C++, HTML, Javascript
- XML, ASP.NET, Web Services, SOAP, UDDI
- Socket programming and anything network related
- Reflection, Serialization, and Plugin Frameworks
- Owner-drawn controls and GDI+ goodness

Comments and Discussions