Ejemplo n.º 1
0
        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);
                }
            }
        }
Ejemplo n.º 2
0
        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.");
        }