public PSTFile(string path) { if (new FileInfo(path).Length < MinFileSizeBytes) { throw new Exception($"Failed opening PST, file size must be greater than {MinFileSizeBytes} bytes"); } Path = path ?? throw new ArgumentNullException(nameof(path)); PSTMMF = MemoryMappedFile.CreateFromFile(path, FileMode.Open); Header = new PSTHeader(this); if (!Header.IsUNICODE && !Header.IsANSI) { throw new InvalidDataException("PST is not a valid data file"); } if (!Header.IsUNICODE) { throw new InvalidDataException("PST Parser currently only supports UNICODE"); } /*var messageStoreData = BlockBO.GetNodeData(SpecialNIDs.NID_MESSAGE_STORE); * var temp = BlockBO.GetNodeData(SpecialNIDs.NID_ROOT_FOLDER);*/ MailStore = new MailStore(this); TopOfPST = new MailFolder(MailStore.RootFolder.NID, new List <string>(), this); //NamedPropertyLookup = new NamedToPropertyLookup(this); //var temp = new TableContext(rootEntryID.NID); //PasswordReset.ResetPassword(); }
public PSTFile(string path) { if (new FileInfo(path).Length < MinFileSizeBytes) { throw new Exception($"Failed opening PST, file size must be greater than {MinFileSizeBytes} bytes"); } Path = path ?? throw new ArgumentNullException(nameof(path)); PSTMMF = MemoryMappedFile.CreateFromFile(path, FileMode.Open); Header = new PSTHeader(this); /*var messageStoreData = BlockBO.GetNodeData(SpecialNIDs.NID_MESSAGE_STORE); * var temp = BlockBO.GetNodeData(SpecialNIDs.NID_ROOT_FOLDER);*/ MailStore = new MailStore(this); TopOfPST = new MailFolder(MailStore.RootFolder.NID, new List <string>(), this); //NamedPropertyLookup = new NamedToPropertyLookup(this); //var temp = new TableContext(rootEntryID.NID); }
public PSTFile(string path) { Path = path; PSTMMF = MemoryMappedFile.CreateFromFile(path, FileMode.Open); try { Header = new PSTHeader(this); /*var messageStoreData = BlockBO.GetNodeData(SpecialNIDs.NID_MESSAGE_STORE); * var temp = BlockBO.GetNodeData(SpecialNIDs.NID_ROOT_FOLDER);*/ MailStore = new MailStore(this); TopOfPST = new MailFolder(MailStore.RootFolder.NID, new List <string>(), this); NamedPropertyLookup = new NamedToPropertyLookup(this); //var temp = new TableContext(rootEntryID.NID); //PasswordReset.ResetPassword(); } catch (Exception) { // don't hold the MMF open if something failed here. PSTMMF.Dispose(); throw; } }