コード例 #1
0
 private void ParseValue()
 {
     if (base.Value == "1.0")
     {
         this.version = "1.0";
     }
     else
     {
         int offset = 0;
         if (!MailBnfHelper.SkipCFWS(base.Value, ref offset))
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new FormatException(System.Runtime.Serialization.SR.GetString("MimeVersionHeaderInvalid")));
         }
         StringBuilder builder = new StringBuilder();
         MailBnfHelper.ReadDigits(base.Value, ref offset, builder);
         if ((!MailBnfHelper.SkipCFWS(base.Value, ref offset) || (offset >= base.Value.Length)) || ((base.Value[offset++] != '.') || !MailBnfHelper.SkipCFWS(base.Value, ref offset)))
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new FormatException(System.Runtime.Serialization.SR.GetString("MimeVersionHeaderInvalid")));
         }
         builder.Append('.');
         MailBnfHelper.ReadDigits(base.Value, ref offset, builder);
         this.version = builder.ToString();
     }
 }
        private void ParseValue()
        {
            if (this.contentTransferEncodingValue == null)
            {
                int offset = 0;
                this.contentTransferEncodingValue = (base.Value.Length == 0) ? base.Value : ((base.Value[0] == '"') ? MailBnfHelper.ReadQuotedString(base.Value, ref offset, null) : MailBnfHelper.ReadToken(base.Value, ref offset, null));
                switch (this.contentTransferEncodingValue)
                {
                case "7bit":
                    this.contentTransferEncoding = System.Xml.ContentTransferEncoding.SevenBit;
                    return;

                case "8bit":
                    this.contentTransferEncoding = System.Xml.ContentTransferEncoding.EightBit;
                    return;

                case "binary":
                    this.contentTransferEncoding = System.Xml.ContentTransferEncoding.Binary;
                    return;
                }
                this.contentTransferEncoding = System.Xml.ContentTransferEncoding.Other;
            }
        }