Example #1
0
 public void GetNamedPropertiesTest()
 {
     parser = new MsgParser(@"TestFiles\TestMessage-default.msg");
     msgFile = parser.Parse();
     var namedProperties = msgFile.NamedProperties;
     Assert.That(namedProperties.Count, Is.EqualTo(1));
     Assert.That(namedProperties[0].GUID, Is.EqualTo(new Guid("{86030200-0000-0000-c000-000000000046}")));
     Assert.That(namedProperties[0].ID, Is.EqualTo(32772));
     Assert.That((namedProperties[0].Entry as VariableLengthPropertyEntry).VariableLengthData, Is.EqualTo("en-US").IgnoreCase);
 }
Example #2
0
 public void ReadPropertyStreamUnicodeTest()
 {
     parser = new MsgParser(@"TestFiles\TestMessage-unicode.msg");
     msgFile = parser.Parse();
     PropertyStream ps = msgFile.PropertyStream;
     Assert.That(ps.Header, Is.Not.Null);
     Assert.That(ps.Header.NextRecipientId, Is.EqualTo(3));
     Assert.That(ps.Header.NextAttachmentId, Is.EqualTo(1));
     Assert.That(ps.Header.RecipientCount, Is.EqualTo(3));
     Assert.That(ps.Header.AttachmentCount, Is.EqualTo(1));
     Assert.That(ps.NumberOfProperties, Is.EqualTo(24));
 }
Example #3
0
 /// <summary>
 /// This method will create a raw MSG structure
 /// </summary>
 internal Message Parse()
 {
     Message message = new Message();
     var propertyStream = _propStreamReader.ReadPropertyStream();
     message.PropertyStream = propertyStream;
     message.NamedProperties = ParseNamedProperties(propertyStream);
     for (short i = 0; i < message.PropertyStream.Header.RecipientCount; i++)
     {
         var recipient = new Recipient() { PropertyStream = _recipientReader.ReadPropertyStream(i) };
         message.Recipients.Add(recipient);
     }
     for (short i = 0; i < message.PropertyStream.Header.AttachmentCount; i++)
     {
         var attachment = new Attachment() { PropertyStream = _attachmentReader.ReadPropertyStream(i) };
         message.Attachments.Add(attachment);
     }
     return message;
 }
Example #4
0
 /// <summary>
 /// Loads a .MSG file
 /// </summary>
 /// <param name="filePath">The path to the .MSG file</param>
 public void Load(string filePath)
 {
     var msgParser = new MsgParser(filePath);
     _message = msgParser.Parse();
 }