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); } }
public void ActivateLog() { byte[] buffer = new byte[1024 * 1024 * 10]; LogTunnel tunnelLog; m_log = tunnelLog = CreateLog(); m_cfl = new ContinuesBinaryFileLogger(new InMemoryStreamProvider(new MemoryStream(buffer)), new SyncSubmitLogEntryFactory(), BufferPoolFactory.Instance); m_cfl.AttachToTunnelLog(tunnelLog); var readerFactory = new WhitelogBinaryReaderFactory(); readerFactory.RegisterReaderFactory(new ExpandableLogReaderFactory()); m_testConsumer = new TestConsumer(); m_logReader = readerFactory.GetLogReader(new MemoryStream(buffer), m_testConsumer); }