Esempio n. 1
0
 /// <summary>
 /// Method for determining the correct encoder for this
 /// encoding type.
 /// </summary>
 /// <param name="encodingtype">Enumerated encoding type</param>
 /// <returns>Returns the proper IEncoder implementation</returns>
 /// <exception cref="ApplicationException">Throws an ApplicationException if the specified encoding is unknown.</exception>
 public static IEncoder GetEncoder(EncodingType encodingtype)
 {
     if (encodingtype == EncodingType.Base64)
     {
         return(Base64Encoder.GetInstance());
     }
     else if (encodingtype == EncodingType.QuotedPrintable)
     {
         return(QPEncoder.GetInstance());
     }
     else if (encodingtype == EncodingType.SevenBit)
     {
         return(SevenBitEncoder.GetInstance());
     }
     else if (encodingtype == EncodingType.EightBit)
     {
         return(EightBitEncoder.GetInstance());
     }
     else
     {
         throw new ApplicationException("This encoder type is not implemented");
     }
 }