protected override void LoadStorage(NativeMethods.IStorage storage)
{
base.LoadStorage(storage);
foreach (ComTypes.STATSTG storageStat in this.subStorageStatistics.Values)
{
//element is a storage. get it and add its statistics object to the sub storage dictionary
NativeMethods.IStorage subStorage = this.storage.OpenStorage(storageStat.pwcsName, IntPtr.Zero, NativeMethods.STGM.READ | NativeMethods.STGM.SHARE_EXCLUSIVE, IntPtr.Zero, 0);
//run specific load method depending on sub storage name prefix
if (storageStat.pwcsName.StartsWith(OutlookStorage.RECIP_STORAGE_PREFIX))
{
Recipient recipient = new Recipient(new OutlookStorage(subStorage));
this.recipients.Add(recipient);
}
else if (storageStat.pwcsName.StartsWith(OutlookStorage.ATTACH_STORAGE_PREFIX))
{
this.LoadAttachmentStorage(subStorage);
}
else
{
//release sub storage
Marshal.ReleaseComObject(subStorage);
}
}
}