internal virtual IPst CreateIPst() { // TODO: Instantiate an appropriate concrete class. IPst target = null; return(target); }
protected override PSTProcessingResult ProcessQueueObjectImplementation() { IPst rdopststore = null; try { Logger.NLogger.Info("PSTFile: {0} EntryID: {1}", this.PSTFile, this.EntryID); #if USE_PSTSTORE rdopststore = this.PstStore; #else rdopststore = new Pst(this.PSTFile); #endif Message rdomail = null; try { rdomail = (Message)rdopststore.OpenMessage(this.EntryID); rdomail.Pst = (Pst)rdopststore; Logger.NLogger.Info("EntryID: {0}", rdomail.EntryID.ToString()); } catch (Exception ex) { Logger.NLogger.ErrorException("ERROR: ProcessQueueObjectImplementation", ex); } if (rdomail != null) { try { } catch (Exception ex) { Logger.NLogger.ErrorException("ERROR: HandleMessage", ex); } rdomail.Dispose(); rdomail = null; } } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); } finally { #if !USE_PSTSTORE if (rdopststore != null) { rdopststore.Dispose(); rdopststore = null; } #endif } PSTProcessingResult result = new PSTProcessingResult() { IsSuccessful = true, Filename = string.Empty }; result.SetProcessingObject <PSTFolderParser>(this); return(result); }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog() { Filter = @"PST/OST Files|*.pst;*.ost", CheckFileExists = true }; if (ofd.ShowDialog() == DialogResult.OK) { try { if (_pst != null) { _pst.Dispose(); GC.Collect(); } _pst = new Pst(ofd.FileName); } catch (Exception ex) { var sb = new StringBuilder(); sb.AppendLine(ex.Message); sb.AppendLine(ex.StackTrace); var innerExcep = ex.InnerException; while (innerExcep != null) { sb.AppendLine(innerExcep.Message); sb.AppendLine(innerExcep.StackTrace); innerExcep = innerExcep.InnerException; } File.WriteAllText(Guid.NewGuid() + ".txt", sb.ToString()); MessageBox.Show("There was an error opening the file. It may be corrupt."); return; } // clear form.. foldersTreeView.Nodes.Clear(); messagesListBox.Items.Clear(); attachmentListBox.Items.Clear(); recipientsListBox.Items.Clear(); webBrowser1.DocumentText = string.Empty; messageBodyTextBox.Text = string.Empty; recipientCountLabel.Text = "Recipients"; attachCountLabel.Text = "Attachments"; messagesHeaderLabel.Text = "Messages"; TreeNode rootNode = GetAllFolders(_pst.OpenRootFolder()); foreach (TreeNode node in rootNode.Nodes) { foldersTreeView.Nodes.Add(node); } } }
public void MessagesTest() { IPst target = CreateIPst(); // TODO: Initialize to an appropriate value IEnumerable <IMessage> actual; actual = target.Messages; Assert.Inconclusive("Verify the correctness of this test method."); }
public void NameTest() { IPst target = CreateIPst(); // TODO: Initialize to an appropriate value string actual; actual = target.Name; Assert.Inconclusive("Verify the correctness of this test method."); }
public void DatabaseAccessorTest() { IPst target = CreateIPst(); // TODO: Initialize to an appropriate value IDBAccessor actual; actual = target.DatabaseAccessor; Assert.Inconclusive("Verify the correctness of this test method."); }
public void OpenRootFolderTest() { IPst target = CreateIPst(); // TODO: Initialize to an appropriate value IFolder expected = null; // TODO: Initialize to an appropriate value IFolder actual; actual = target.OpenRootFolder(); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
public void OpenMessageTest() { IPst target = CreateIPst(); // TODO: Initialize to an appropriate value NodeID nodeID = new NodeID(); // TODO: Initialize to an appropriate value IMessage expected = null; // TODO: Initialize to an appropriate value IMessage actual; actual = target.OpenMessage(nodeID); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
static void traverseAllMessages(IPst pstFile) { // Iterate through all the folders in the given PST object. foreach (var currentFolder in pstFile.Folders) { // Process all messages in the current folder. if (currentFolder.MessageCount > 0) { foreach (var message in currentFolder.Messages) { processMessage(message); } } } }
public override WFState Run() { WFState retval = new WFState(); IPst rdopststore = null; try { retval.Value = WFState.WFStateFail; WFLogger.NLogger.Info("PSTFile={0} NodeID={1}", this.PSTFile, this.FileToProcess); rdopststore = new Pst(this.PSTFile); Message rdomail = null; try { NodeID msgid = Convert.ToUInt32(this.FileToProcess); if (this.ParentMsg != "0") { msgid = Convert.ToUInt32(this.ParentMsg); } rdomail = (Message)rdopststore.OpenMessage(msgid); //this.EntryID); rdomail.Pst = (Pst)rdopststore; rdomail.FolderPath = this.FolderPath; WFLogger.NLogger.Info("EntryID={0}", rdomail.EntryID.ToString()); } catch (Exception ex) { WFLogger.NLogger.ErrorException("ERROR: ProcessQueueObjectImplementation", ex); } if (rdomail != null) { try { HandleMessage(rdomail, this.ExportDirectory); this.ExportDirectory = this.ExportDirectory + @"\" + this.FileToProcess; retval.Value = WFState.WFStateSuccess; } catch (Exception ex) { WFLogger.NLogger.ErrorException("ERROR: HandleMessage", ex); } rdomail.Dispose(); } } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); } finally { if (rdopststore != null) { rdopststore.Dispose(); } } return(retval); }
protected override PSTProcessingResult ProcessQueueObjectImplementation() //List<InputOutputThreadObjectHandler<PSTMsgParser>> outputobjects, InputOutputMessageQueue<PSTMsgParser> inqueue, InputOutputMessageQueue<PSTMsgParser> outqueue) { IPst rdopststore = null; try { Logger.NLogger.Info("PSTFile: {0} EntryID: {1}", this.PSTFile, this.EntryID); #if USE_PSTSTORE rdopststore = this.PstStore; #else rdopststore = new Pst(this.PSTFile); #endif Message rdomail = null; try { rdomail = (Message)rdopststore.OpenMessage(this.EntryID); rdomail.Pst = (Pst)rdopststore; Logger.NLogger.Info("EntryID: {0}", rdomail.EntryID.ToString()); } catch (Exception ex) { Logger.NLogger.ErrorException("ERROR: ProcessQueueObjectImplementation", ex); } if (rdomail != null) { try { HandleMessage(rdomail, this.ExportDirectory); //, outputobjects, inqueue, outqueue); } catch (Exception ex) { Logger.NLogger.ErrorException("ERROR: HandleMessage", ex); } rdomail.Dispose(); rdomail = null; } } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); } finally { #if !USE_PSTSTORE if (rdopststore != null) { rdopststore.Dispose(); rdopststore = null; } #endif } foreach (string file in this.OutputFiles) { Console.WriteLine(file); } PSTProcessingResult result = new PSTProcessingResult() { IsSuccessful = true, Filename = string.Empty }; result.SetProcessingObject <PSTMsgParser>(this); return(result); }
public override void Process(PSTMsgParserData data) { this.PSTFile = data.PSTFile; // GetProperty<string>("PSTFile", "PSTFileParserData"); this.PSTFile = data.PSTFile; // GetProperty<string>("PSTFile", "PSTFileParserData"); this.ProcessedMsgs.Clear(); this.ParentMsg = "0"; this.SaveAsTypes = data.SaveAsTypes; this.SaveAttachments = data.SaveAttachments; this.SaveEmbeddedMsgs = data.SaveEmbeddedMsgs; this.Pst2MsgCompatible = data.Pst2MsgCompatible; this.OutputFiles = data.OutputDocuments; this.FileToProcess = data.DocumentToProcess; data.WFState.Value = "Fail"; IPst rdopststore = null; try { WFLogger.NLogger.Info("PSTFile={0} NodeID={1}", PSTFile, this.FileToProcess); rdopststore = new Pst(PSTFile); Message rdomail = null; try { NodeID msgid = Convert.ToUInt32(this.FileToProcess); if (this.ParentMsg != "0") { msgid = Convert.ToUInt32(this.ParentMsg); } rdomail = (Message)rdopststore.OpenMessage(msgid); //this.EntryID); rdomail.Pst = (Pst)rdopststore; rdomail.FolderPath = data.FolderPath; WFLogger.NLogger.Info("EntryID={0}", rdomail.EntryID.ToString()); } catch (Exception ex) { WFLogger.NLogger.ErrorException("ERROR: ProcessQueueObjectImplementation", ex); } if (rdomail != null) { try { HandleMessage(rdomail, data.ExportDirectory); data.ExportDirectory = data.ExportDirectory + @"\" + this.FileToProcess; } catch (Exception ex) { WFLogger.NLogger.ErrorException("ERROR: HandleMessage", ex); } rdomail.Dispose(); } } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); } finally { if (rdopststore != null) { rdopststore.Dispose(); } } data.WFState.Value = "Succcess"; }