public static string ReadParameterAttribute(string data, ref int offset, StringBuilder builder) { if (!MailBnfHelper.SkipCFWS(data, ref offset)) { return(null); } return(MailBnfHelper.ReadToken(data, ref offset, null)); }
private void ParseValue() { if (this.parameters == null) { int num = 0; this.parameters = new Dictionary <string, string>(); this.mediaType = MailBnfHelper.ReadToken(base.Value, ref num, null); if (num >= base.Value.Length || base.Value[num++] != '/') { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new FormatException(SR.GetString("MimeContentTypeHeaderInvalid", new object[0]))); } this.subType = MailBnfHelper.ReadToken(base.Value, ref num, null); while (MailBnfHelper.SkipCFWS(base.Value, ref num)) { if (num >= base.Value.Length || base.Value[num++] != ';') { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new FormatException(SR.GetString("MimeContentTypeHeaderInvalid", new object[0]))); } if (!MailBnfHelper.SkipCFWS(base.Value, ref num)) { break; } string text = MailBnfHelper.ReadParameterAttribute(base.Value, ref num, null); if (text == null || num >= base.Value.Length || base.Value[num++] != '=') { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new FormatException(SR.GetString("MimeContentTypeHeaderInvalid", new object[0]))); } string value = MailBnfHelper.ReadParameterValue(base.Value, ref num, null); this.parameters.Add(text.ToLowerInvariant(), value); } if (this.parameters.ContainsKey(MtomGlobals.StartInfoParam)) { string text2 = this.parameters[MtomGlobals.StartInfoParam]; int num2 = text2.IndexOf(';'); if (num2 > -1) { while (MailBnfHelper.SkipCFWS(text2, ref num2)) { if (text2[num2] != ';') { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new FormatException(SR.GetString("MimeContentTypeHeaderInvalid", new object[0]))); } num2++; string text3 = MailBnfHelper.ReadParameterAttribute(text2, ref num2, null); if (text3 == null || num2 >= text2.Length || text2[num2++] != '=') { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new FormatException(SR.GetString("MimeContentTypeHeaderInvalid", new object[0]))); } string value2 = MailBnfHelper.ReadParameterValue(text2, ref num2, null); if (text3 == MtomGlobals.ActionParam) { this.parameters[MtomGlobals.ActionParam] = value2; } } } } } }
public static string ReadParameterValue(string data, ref int offset, StringBuilder builder) { if (!MailBnfHelper.SkipCFWS(data, ref offset)) { return(string.Empty); } if (offset < data.Length && data[offset] == '"') { return(MailBnfHelper.ReadQuotedString(data, ref offset, builder)); } return(MailBnfHelper.ReadToken(data, ref offset, builder)); }
private void ParseValue() { if (this.contentTransferEncodingValue == null) { int num = 0; this.contentTransferEncodingValue = ((base.Value.Length == 0) ? base.Value : ((base.Value[0] == '"') ? MailBnfHelper.ReadQuotedString(base.Value, ref num, null) : MailBnfHelper.ReadToken(base.Value, ref num, null))); string a; if ((a = this.contentTransferEncodingValue) != null) { if (a == "7bit") { this.contentTransferEncoding = ContentTransferEncoding.SevenBit; return; } if (a == "8bit") { this.contentTransferEncoding = ContentTransferEncoding.EightBit; return; } if (a == "binary") { this.contentTransferEncoding = ContentTransferEncoding.Binary; return; } } this.contentTransferEncoding = ContentTransferEncoding.Other; } }