private void ParseValue() { int offset = 0; this.parameters = new StringDictionary(); try { this.dispositionType = MailBnfHelper.ReadToken(this.disposition, ref offset, null); if ((this.dispositionType == null) || (this.dispositionType.Length == 0)) { throw new FormatException(SR.GetString("MailHeaderFieldInvalidCharacter")); } while (MailBnfHelper.SkipCFWS(this.disposition, ref offset)) { string str2; if (this.disposition[offset++] != ';') { throw new FormatException(SR.GetString("MailHeaderFieldInvalidCharacter")); } if (MailBnfHelper.SkipCFWS(this.disposition, ref offset)) { string strA = MailBnfHelper.ReadParameterAttribute(this.disposition, ref offset, null); if (this.disposition[offset++] != '=') { throw new FormatException(SR.GetString("MailHeaderFieldMalformedHeader")); } if (!MailBnfHelper.SkipCFWS(this.disposition, ref offset)) { str2 = string.Empty; } else if (this.disposition[offset] == '"') { str2 = MailBnfHelper.ReadQuotedString(this.disposition, ref offset, null); } else { str2 = MailBnfHelper.ReadToken(this.disposition, ref offset, null); } if (((strA == null) || (str2 == null)) || ((strA.Length == 0) || (str2.Length == 0))) { throw new FormatException(SR.GetString("ContentDispositionInvalid")); } if (((string.Compare(strA, "creation-date", StringComparison.OrdinalIgnoreCase) == 0) || (string.Compare(strA, "modification-date", StringComparison.OrdinalIgnoreCase) == 0)) || (string.Compare(strA, "read-date", StringComparison.OrdinalIgnoreCase) == 0)) { int num2 = 0; MailBnfHelper.ReadDateTime(str2, ref num2); } this.parameters.Add(strA, str2); } } } catch (FormatException) { throw new FormatException(SR.GetString("ContentDispositionInvalid")); } }
private void ParseValue() { int offset = 0; Exception exception = null; this.parameters = new StringDictionary(); try { this.mediaType = MailBnfHelper.ReadToken(this.type, ref offset, null); if (((this.mediaType == null) || (this.mediaType.Length == 0)) || ((offset >= this.type.Length) || (this.type[offset++] != '/'))) { exception = new FormatException(SR.GetString("ContentTypeInvalid")); } if (exception == null) { this.subType = MailBnfHelper.ReadToken(this.type, ref offset, null); if ((this.subType == null) || (this.subType.Length == 0)) { exception = new FormatException(SR.GetString("ContentTypeInvalid")); } } if (exception == null) { while (MailBnfHelper.SkipCFWS(this.type, ref offset)) { string str2; if (this.type[offset++] != ';') { exception = new FormatException(SR.GetString("ContentTypeInvalid")); break; } if (!MailBnfHelper.SkipCFWS(this.type, ref offset)) { break; } string key = MailBnfHelper.ReadParameterAttribute(this.type, ref offset, null); if ((key == null) || (key.Length == 0)) { exception = new FormatException(SR.GetString("ContentTypeInvalid")); break; } if ((offset >= this.type.Length) || (this.type[offset++] != '=')) { exception = new FormatException(SR.GetString("ContentTypeInvalid")); break; } if (!MailBnfHelper.SkipCFWS(this.type, ref offset)) { exception = new FormatException(SR.GetString("ContentTypeInvalid")); break; } if (this.type[offset] == '"') { str2 = MailBnfHelper.ReadQuotedString(this.type, ref offset, null); } else { str2 = MailBnfHelper.ReadToken(this.type, ref offset, null); } if (str2 == null) { exception = new FormatException(SR.GetString("ContentTypeInvalid")); break; } this.parameters.Add(key, str2); } } } catch (FormatException) { throw new FormatException(SR.GetString("ContentTypeInvalid")); } if (exception != null) { throw new FormatException(SR.GetString("ContentTypeInvalid")); } }