private void ParseValue() { if (this.parameters == null) { int offset = 0; this.parameters = new Dictionary <string, string>(); this.mediaType = MailBnfHelper.ReadToken(base.Value, ref offset, null); if ((offset >= base.Value.Length) || (base.Value[offset++] != '/')) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new FormatException(System.Runtime.Serialization.SR.GetString("MimeContentTypeHeaderInvalid"))); } this.subType = MailBnfHelper.ReadToken(base.Value, ref offset, null); while (MailBnfHelper.SkipCFWS(base.Value, ref offset)) { if ((offset >= base.Value.Length) || (base.Value[offset++] != ';')) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new FormatException(System.Runtime.Serialization.SR.GetString("MimeContentTypeHeaderInvalid"))); } if (!MailBnfHelper.SkipCFWS(base.Value, ref offset)) { break; } string str = MailBnfHelper.ReadParameterAttribute(base.Value, ref offset, null); if (((str == null) || (offset >= base.Value.Length)) || (base.Value[offset++] != '=')) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new FormatException(System.Runtime.Serialization.SR.GetString("MimeContentTypeHeaderInvalid"))); } string str2 = MailBnfHelper.ReadParameterValue(base.Value, ref offset, null); this.parameters.Add(str.ToLowerInvariant(), str2); } if (this.parameters.ContainsKey(MtomGlobals.StartInfoParam)) { string data = this.parameters[MtomGlobals.StartInfoParam]; int index = data.IndexOf(';'); if (index > -1) { while (MailBnfHelper.SkipCFWS(data, ref index)) { if (data[index] != ';') { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new FormatException(System.Runtime.Serialization.SR.GetString("MimeContentTypeHeaderInvalid"))); } index++; string str4 = MailBnfHelper.ReadParameterAttribute(data, ref index, null); if (((str4 == null) || (index >= data.Length)) || (data[index++] != '=')) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new FormatException(System.Runtime.Serialization.SR.GetString("MimeContentTypeHeaderInvalid"))); } string str5 = MailBnfHelper.ReadParameterValue(data, ref index, null); if (str4 == MtomGlobals.ActionParam) { this.parameters[MtomGlobals.ActionParam] = str5; } } } } } }
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; } }