예제 #1
0
 /// <summary>
 /// This will decode a single value of the form: %3D%3DIamHere
 /// Which is basically a <see cref="EncodedWord"/> form just using % instead of =
 /// </summary>
 /// <param name="valueToDecode">The value to decode</param>
 /// <param name="encoding">The encoding used to decode with</param>
 /// <returns>The decoded value that corresponds to <paramref name="valueToDecode"/></returns>
 private static string DecodeSingleValue(string valueToDecode, string encoding)
 {
     // The encoding used is the same as QuotedPrintable, we only
     // need to change % to =
     // And otherwise make it look like the correct EncodedWord encoding
     valueToDecode = "=?" + encoding + "?Q?" + valueToDecode.Replace("%", "=") + "?=";
     return(EncodedWord.Decode(valueToDecode));
 }
예제 #2
0
        /// <summary>
        /// This will decode a single value of the form: %3D%3DIamHere
        /// Which is basically a <see cref="EncodedWord"/> form just using % instead of =
        /// </summary>
        /// <param name="valueToDecode">The value to decode</param>
        /// <param name="encoding">The encoding used to decode with</param>
        /// <returns>The decoded value that corresponds to <paramref name="valueToDecode"/></returns>
        /// <exception cref="ArgumentNullException">If <paramref name="valueToDecode"/> is <see langword="null"/></exception>
        /// <exception cref="ArgumentNullException">If <paramref name="encoding"/> is <see langword="null"/></exception>
        private static string DecodeSingleValue(string valueToDecode, string encoding)
        {
            if (valueToDecode == null)
            {
                throw new ArgumentNullException("valueToDecode");
            }

            if (encoding == null)
            {
                throw new ArgumentNullException("encoding");
            }

            // The encoding used is the same as QuotedPrintable, we only
            // need to change % to =
            // And otherwise make it look like the correct EncodedWord encoding
            valueToDecode = "=?" + encoding + "?Q?" + valueToDecode.Replace("%", "=") + "?=";
            return(EncodedWord.Decode(valueToDecode));
        }