public SMIMEFieldParser(ContentDispositionFieldParser original) : base(original) { Original = original; var pattern = PatternFactory.GetInstance().Get(typeof (ApplicationSubTypePatern)); var applicationSubtypePattern = pattern as ApplicationSubTypePatern; pattern = PatternFactory.GetInstance().Get(typeof (SMIMEApplicationSubTypePattern), new object[]{applicationSubtypePattern}); var sMIMEPattern = pattern as SMIMEApplicationSubTypePattern; if (sMIMEPattern == null) throw new ApplicationException("Could not retrive a " + typeof(SMIMEApplicationSubTypePattern).Name); sMIMEPattern.Compile(); }
public void ParseTest() { IList<MIMER.RFC822.Field> fields = new List<MIMER.RFC822.Field>(); MIMER.RFC2183.ContentDispositionFieldParser parser = new ContentDispositionFieldParser( new ExtendedFieldParser( new ContentTransferEncodingFieldParser(new ContentTypeFieldParser(new FieldParser())))); parser.CompilePattern(); IPattern unfoldPattern = PatternFactory.GetInstance().Get(typeof (UnfoldPattern)); m_Fields = unfoldPattern.RegularExpression.Replace(m_Fields, " "); parser.Parse(ref fields, ref m_Fields); Assert.AreEqual(5, fields.Count); ContentDispositionField field = fields[4] as ContentDispositionField; Assert.IsNotNull(field); Assert.AreEqual("attachment", field.Disposition); Assert.AreEqual(2, field.Parameters.Count); Assert.AreEqual("genome.jpeg", field.Parameters["filename"]); Assert.AreEqual("Wed, 12 Feb 1997 16:29:51 -0500", field.Parameters["modification-date"]); }