Click here to Skip to main content
12,457,259 members (55,439 online)
Click here to Skip to main content
Articles » Languages » C# » General » Downloads


38 bookmarked

A C# Implementation of Mime De/encode

, 21 Aug 2005 CPOL
A C# implementation of Mime de/encode
using System;
using System.Collections;

namespace MIME
	/// <summary>
	/// </summary>
	public class MimeCodeManager
		private MimeCodeManager()
			// TODO: Add constructor logic here

		private static Hashtable codeHT = new Hashtable();

		private static readonly MimeCodeManager instance = new MimeCodeManager();

		public static MimeCodeManager Instance
			get{ return instance;}

		private void InitialCode()
			MimeCode aFieldCode = new MimeFieldCodeBase();
			SetCode("Subject", aFieldCode);
			SetCode("Comments", aFieldCode);
			SetCode("Content-Description", aFieldCode);

			aFieldCode = new MimeFieldCodeAddress();
			SetCode("From", aFieldCode);
			SetCode("To", aFieldCode);
			SetCode("Resent-To", aFieldCode);
			SetCode("Cc", aFieldCode);
			SetCode("Resent-Cc", aFieldCode);
			SetCode("Bcc", aFieldCode);
			SetCode("Resent-Bcc", aFieldCode);
			SetCode("Reply-To", aFieldCode);
			SetCode("Resent-Reply-To", aFieldCode);
			aFieldCode = new MimeFieldCodeParameter();
			SetCode("Content-Type", aFieldCode);
			SetCode("Content-Disposition", aFieldCode);

			MimeCode aCode = new MimeCode();
			SetCode("7bit", aCode);
			SetCode("8bit", aCode);

			aCode = new MimeCodeBase64();
			SetCode("base64", aCode);

			aCode = new MimeCodeQP();
			SetCode("quoted-printable", aCode);


		public void SetCode(string name, MimeCode code)
			codeHT.Add(name.ToLower(), code);

		public MimeCode GetCode(string name)
			return (MimeCode)codeHT[name.ToLower()];

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.


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


About the Author

Web Developer
China China
I think I have to start coding my life now...Smile | :)

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160826.1 | Last Updated 22 Aug 2005
Article Copyright 2005 by tauyoung
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid