コード例 #1
0
        private void m_btnLogBuilder_Click(object sender, EventArgs e)
        {
            try
            {
                if (m_loggerTypes.SelectedItem.ToString() == typeof(ContinuesBinaryFileLogger).Name)
                {
                    var fileStremProvider = new FileStreamProvider(new FileConfiguration()
                                                                   {
                                                                       FilePath = m_txtPath.Text,
                                                                   });
                    var fileLogger = new ContinuesBinaryFileLogger(fileStremProvider, ((SubmiterOption)m_submitterType.SelectedItem).SubmitLogEntryFactory, ((BufferOption)m_bufferTypes.SelectedItem).BufferAllocatorFactory);
                    fileLogger.AttachToTunnelLog(LogTunnel);

                    var tabPage = new TabPage("BinaryFile " + System.IO.Path.GetFileName(m_txtPath.Text));
                    TreeListView dataTreeListView = new TreeListView();
                    dataTreeListView.Dock = DockStyle.Fill;
                    tabPage.Controls.Add(dataTreeListView);
                    var logAppender = new TreeViewLogAppender(dataTreeListView);
                    PreviewTabControl.TabPages.Add(tabPage);
                    logAppender.OpenFile(fileStremProvider.FileName);
                }
                else if (m_loggerTypes.SelectedItem.ToString() == "In Memory")
                {
                    var fileLogger = new ContinuesBinaryFileLogger(new InMemoryStreamProvider(), ((SubmiterOption)m_submitterType.SelectedItem).SubmitLogEntryFactory, ((BufferOption)m_bufferTypes.SelectedItem).BufferAllocatorFactory);
                    fileLogger.AttachToTunnelLog(LogTunnel);
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
コード例 #2
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog();
            fileDialog.ShowDialog(this);

            try
            {
                if (!string.IsNullOrEmpty(fileDialog.FileName))
                {
                    if (m_treeViewLogAppender != null)
                    {
                        m_treeViewLogAppender.Dispose();
                    }

                    m_treeListView.Columns.Clear();
                    m_treeListView.AllColumns.Clear();
                    m_treeViewLogAppender = new TreeViewLogAppender(m_treeListView);
                    m_treeViewLogAppender.OpenFile(fileDialog.FileName);
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }