/* C R E A T E N E W W I N D O W */ /*---------------------------------------------------------------------------- * %%Function: CreateNewWindow * %%Qualified: AzLog.AzLogWindow.CreateNewWindow * %%Contact: rlittle * * ----------------------------------------------------------------------------*/ public static AzLogWindow CreateNewWindow(AzLogModel azlm, string sViewName, AzLogFilter azlf, ILogClient ilc) { AzLogWindow azlw = new AzLogWindow(); if (String.IsNullOrEmpty(sViewName)) { sViewName = "Default"; } azlw.SetView(sViewName); azlw.m_azlv = new AzLogView(azlw); azlw.m_azlv.SetFilter(azlf); // propagate the filter values we were given into the textboxes on our window AzLogFilter.AzLogFilterCondition azlfc; azlfc = azlf.Operations[0].Condition; if (azlfc.LHS.Source == AzLogFilter.AzLogFilterValue.DataSource.DttmRow && azlfc.Comparison == AzLogFilter.AzLogFilterCondition.CmpOp.Gte) { azlw.m_ebStart.Text = azlfc.RHS.Dttm(null).ToLocalTime().ToString("MM/dd/yy HH:mm"); } azlfc = azlf.Operations[1].Condition; if (azlfc.LHS.Source == AzLogFilter.AzLogFilterValue.DataSource.DttmRow && azlfc.Comparison == AzLogFilter.AzLogFilterCondition.CmpOp.Lt) { azlw.m_ebEnd.Text = azlfc.RHS.Dttm(null).ToLocalTime().ToString("MM/dd/yy HH:mm"); } azlw.m_ilc = ilc; azlw.m_azlm = azlm; azlw.m_azlv.BuildView(azlw.m_azlm, new CompareLogEntryTickCount(azlw.m_azlm)); // azlw.m_lvLog.VirtualListSize = azlw.m_azlv.Length; azlw.m_lvLog.SetVirtualListSize(azlw.m_azlv.Length); return(azlw); }
/* C R E A T E N E W W I N D O W */ /*---------------------------------------------------------------------------- %%Function: CreateNewWindow %%Qualified: AzLog.AzLogWindow.CreateNewWindow %%Contact: rlittle ----------------------------------------------------------------------------*/ public static AzLogWindow CreateNewWindow(AzLogModel azlm, string sViewName, AzLogFilter azlf, ILogClient ilc) { AzLogWindow azlw = new AzLogWindow(); azlw.SetView(sViewName); azlw.m_azlv = new AzLogView(azlw); azlw.m_azlv.SetFilter(azlf); // propagate the filter values we were given into the textboxes on our window AzLogFilter.AzLogFilterCondition azlfc; azlfc = azlf.Operations[0].Condition; if (azlfc.LHS.Source == AzLogFilter.AzLogFilterValue.DataSource.DttmRow && azlfc.Comparison == AzLogFilter.AzLogFilterCondition.CmpOp.Gte) azlw.m_ebStart.Text = azlfc.RHS.Dttm(null).ToString("MM/dd/yy HH:mm"); azlfc = azlf.Operations[1].Condition; if (azlfc.LHS.Source == AzLogFilter.AzLogFilterValue.DataSource.DttmRow && azlfc.Comparison == AzLogFilter.AzLogFilterCondition.CmpOp.Lt) azlw.m_ebEnd.Text = azlfc.RHS.Dttm(null).ToString("MM/dd/yy HH:mm"); azlw.m_ilc = ilc; azlw.m_azlm = azlm; azlw.m_azlv.BuildView(azlw.m_azlm, new CompareLogEntryTickCount(azlw.m_azlm)); azlw.m_lvLog.VirtualListSize = azlw.m_azlv.Length; return azlw; }
/* A Z E D I T F I L T E R S */ /*---------------------------------------------------------------------------- * %%Function: AzEditFilters * %%Qualified: AzLog.AzEditFilters.AzEditFilters * %%Contact: rlittle * * ----------------------------------------------------------------------------*/ public AzEditFilters(AzLogFilter azlf) { m_azlf = azlf; InitializeComponent(); PopulateListbox(); }
/* S E T F I L T E R */ /*---------------------------------------------------------------------------- * %%Function: SetFilter * %%Qualified: AzLog.AzLogView.SetFilter * %%Contact: rlittle * * ----------------------------------------------------------------------------*/ public void SetFilter(AzLogFilter azlf) { m_azlf = azlf; if (m_pliale != null && m_pliale.Count > 0) { RebuildView(); } }
/* D O E D I T R E M O V E F I L T E R S */ /*---------------------------------------------------------------------------- * %%Function: DoEditRemoveFilters * %%Qualified: AzLog.AzLogWindow.DoEditRemoveFilters * %%Contact: rlittle * * ----------------------------------------------------------------------------*/ private void DoEditRemoveFilters(object sender, EventArgs e) { AzLogFilter azlfNew = AzEditFilters.EditFilters(m_azlv.Filter.Clone()); if (azlfNew != null) { m_azlv.SetFilter(azlfNew); } }
/* C R E A T E V I E W F O R C O L L E C T I O N */ /*---------------------------------------------------------------------------- * %%Function: CreateViewForCollection * %%Qualified: AzLog.AzLog.CreateViewForCollection * %%Contact: rlittle * * Create a window with the initial query parameters from this screen * ----------------------------------------------------------------------------*/ private void CreateViewForCollection(object sender, EventArgs e) { if (m_azlm == null) { m_azlm = new AzLogModel(); // load all of our datasources and attach them foreach (IAzLogDatasource iazlds in m_azlc.Sources) { if (!iazlds.FOpen(null, s_sRegRoot)) { throw new Exception(String.Format("couldn't open datasource {0}", iazlds.ToString())); } m_azlm.AttachDatasource(iazlds); } } // figure out the timespan being requested DateTime dttmMin, dttmMac; if (m_cbAllDates.Checked) { if (!m_azlm.FGetMinMacDateRange(out dttmMin, out dttmMac)) { MessageBox.Show("Cannot automatically set date range -- this option only works when at least one datasource is a file. Setting date range to today."); dttmMin = DateTime.Today; dttmMac = dttmMin.AddDays(1); } } else { AzLogModel.FillMinMacFromStartEnd(m_ebStart.Text, m_ebEnd.Text, out dttmMin, out dttmMac); } AzLogFilter azlf = new AzLogFilter(); // create a basic filter based on the range they asked for azlf.Add(new AzLogFilter.AzLogFilterCondition(AzLogFilter.AzLogFilterValue.ValueType.DateTime, AzLogFilter.AzLogFilterValue.DataSource.DttmRow, AzLogEntry.LogColumn.Nil, AzLogFilter.AzLogFilterCondition.CmpOp.Gte, dttmMin)); azlf.Add(new AzLogFilter.AzLogFilterCondition(AzLogFilter.AzLogFilterValue.ValueType.DateTime, AzLogFilter.AzLogFilterValue.DataSource.DttmRow, AzLogEntry.LogColumn.Nil, AzLogFilter.AzLogFilterCondition.CmpOp.Lt, dttmMac)); azlf.Add(AzLogFilter.AzLogFilterOperation.OperationType.And); AzLogWindow azlw = AzLogWindow.CreateNewWindow(m_azlm, m_azlc.DefaultView, azlf, this); azlw.Show(); m_azlm.AddView(azlw.View); // we don't know what partition we're going to find this data in, so launch a query // from the first partition for this date range //m_azlm.FFetchPartitionsForDateRange(dttmMin, nHourMin, dttmMac, nHourMac); m_azlm.FFetchPartitionsForDateRange(dttmMin, dttmMac); }
public static void TestAzLogFilterSingle() { AzLogFilter azlf = new AzLogFilter(); TestAzLogFilterValueMock mock = new TestAzLogFilterValueMock(); mock.m_mpColumnValue = new Dictionary <AzLogEntry.LogColumn, string>(); mock.m_mpColumnValue.Add(AzLogEntry.LogColumn.AppName, "TestValue"); azlf.Add(new AzLogFilterCondition(AzLogFilterValue.ValueType.String, AzLogFilterValue.DataSource.Column, AzLogEntry.LogColumn.AppName, AzLogFilterCondition.CmpOp.Eq, "TestValue")); Assert.AreEqual(true, azlf.FEvaluate(mock)); }
/* C L O N E */ /*---------------------------------------------------------------------------- * %%Function: Clone * %%Qualified: AzLog.AzLogFilter.Clone * %%Contact: rlittle * * Do a deep clone of all the operations in this filter. * ----------------------------------------------------------------------------*/ public AzLogFilter Clone() { AzLogFilter azlfNew = new AzLogFilter(); foreach (AzLogFilterOperation azlfo in m_plazlfo) { azlfNew.m_plazlfo.Add(azlfo.Clone()); } return(azlfNew); }
public static void TestAzLogFilterIdChange() { AzLogFilter azlf = new AzLogFilter(); Guid idSave = azlf.ID; Assert.AreEqual(idSave, azlf.ID); azlf.Add(null); Assert.AreNotEqual(idSave, azlf.ID); idSave = azlf.ID; azlf.Add(null); Assert.AreNotEqual(idSave, azlf.ID); }
/*---------------------------------------------------------------------------- * %%Function: CreateColorContext * %%Qualified: AzLog.AzLogWindow.CreateColorContext * * we're going to get called for the color item, so the parent of this item * should have our tag * ----------------------------------------------------------------------------*/ private void CreateColorContext(object sender, EventArgs e) { ToolStripMenuItem subMenuItem = (ToolStripMenuItem)sender; ToolStripMenuItem menuItem = colorThisToolStripMenuItem; ContextMenuContext cmc = (ContextMenuContext)(menuItem).Tag; AzLogFilter filter = new AzLogFilter(); filter.Add(new AzLogFilter.AzLogFilterCondition(AzLogFilter.AzLogFilterValue.ValueType.String, AzLogFilter.AzLogFilterValue.DataSource.Column, cmc.lc, AzLogFilter.AzLogFilterCondition.CmpOp.Eq, cmc.azle.GetColumn(cmc.lc))); m_azlv.AddColorFilter(filter, subMenuItem.BackColor, subMenuItem.ForeColor); m_azlv.RebuildView(); }
public static void TestAzLogFilterDateRange(string sDttmRow, AzLogFilterCondition.CmpOp cmpop1, String sCmp1, AzLogFilterCondition.CmpOp cmpop2, string sCmp2, bool fExpected) { AzLogFilter azlf = new AzLogFilter(); TestAzLogFilterValueMock mock = new TestAzLogFilterValueMock(); mock.m_dttmRow = DateTime.Parse(sDttmRow); azlf.Add(new AzLogFilterCondition(AzLogFilterValue.ValueType.DateTime, AzLogFilterValue.DataSource.DttmRow, AzLogEntry.LogColumn.Nil, cmpop1, DateTime.Parse(sCmp1))); azlf.Add(new AzLogFilterCondition(AzLogFilterValue.ValueType.DateTime, AzLogFilterValue.DataSource.DttmRow, AzLogEntry.LogColumn.Nil, cmpop2, DateTime.Parse(sCmp2))); azlf.Add(AzLogFilterOperation.OperationType.And); Assert.AreEqual(fExpected, azlf.FEvaluate(mock)); }
public void TestMessageSplit(string sPartition, string sMessage, string[] rgsExpected) { AzLogModel azlm = new AzLogModel(); m_azlf = new AzLogFilter(); // just get a default empty one azlm.AddTestDataPartition(DateTime.Parse(sPartition), new Int64[] { 10 }, new string[] { sMessage }); BuildView(azlm, new CompareLogEntryTickCount(azlm)); AzLogEntry azle = AzleItem(0); Assert.AreEqual(rgsExpected[0], azle.Message); Assert.AreEqual(rgsExpected[1], azle.Message0); Assert.AreEqual(rgsExpected[2], azle.Message1); Assert.AreEqual(rgsExpected[3], azle.Message2); Assert.AreEqual(rgsExpected[4], azle.Message3); Assert.AreEqual(rgsExpected[5], azle.Message4); Assert.AreEqual(rgsExpected[6], azle.Message5); Assert.AreEqual(rgsExpected[7], azle.Message6); Assert.AreEqual(rgsExpected[8], azle.Message7); Assert.AreEqual(rgsExpected[9], azle.Message8); }
private void DoFetchLogEntries(object sender, EventArgs e) { // figure out the timespan being requested DateTime dttmMin, dttmMac; AzLogModel.FillMinMacFromStartEnd(m_ebStart.Text, m_ebEnd.Text, out dttmMin, out dttmMac); AzLogFilter azlf = new AzLogFilter(); // create a basic filter based on the range they asked for azlf.Add(new AzLogFilter.AzLogFilterCondition(AzLogFilter.AzLogFilterValue.ValueType.DateTime, AzLogFilter.AzLogFilterValue.DataSource.DttmRow, AzLogEntry.LogColumn.Nil, AzLogFilter.AzLogFilterCondition.CmpOp.Gte, dttmMin)); azlf.Add(new AzLogFilter.AzLogFilterCondition(AzLogFilter.AzLogFilterValue.ValueType.DateTime, AzLogFilter.AzLogFilterValue.DataSource.DttmRow, AzLogEntry.LogColumn.Nil, AzLogFilter.AzLogFilterCondition.CmpOp.Lt, dttmMac)); azlf.Add(AzLogFilter.AzLogFilterOperation.OperationType.And); AzLogWindow azlw = AzLogWindow.CreateNewWindow(m_azlm, m_sDefaultView, azlf, this); azlw.Show(); m_azlm.AddView(azlw.View); // we don't know what partition we're going to find this data in, so launch a query // from the first partition for this date range //m_azlm.FFetchPartitionsForDateRange(dttmMin, nHourMin, dttmMac, nHourMac); m_azlm.FFetchPartitionsForDateRange(dttmMin, dttmMac); }
public static void TestAzLogFilterSingle() { AzLogFilter azlf = new AzLogFilter(); TestAzLogFilterValueMock mock = new TestAzLogFilterValueMock(); mock.m_mpColumnValue = new Dictionary<AzLogEntry.LogColumn, string>(); mock.m_mpColumnValue.Add(AzLogEntry.LogColumn.AppName, "TestValue"); azlf.Add(new AzLogFilterCondition(AzLogFilterValue.ValueType.String, AzLogFilterValue.DataSource.Column, AzLogEntry.LogColumn.AppName, AzLogFilterCondition.CmpOp.Eq, "TestValue")); Assert.AreEqual(true, azlf.FEvaluate(mock)); }
/* F E D I T F I L T E R S */ /*---------------------------------------------------------------------------- * %%Function: EditFilters * %%Qualified: AzLog.AzEditFilters.EditFilters * %%Contact: rlittle * * ----------------------------------------------------------------------------*/ public static AzLogFilter EditFilters(AzLogFilter azlf) { AzEditFilters azef = new AzEditFilters(azlf.Clone()); return(azef.ShowDialog() == System.Windows.Forms.DialogResult.OK ? azef.Filters : null); }
public AzColorFilter() { Filter = new AzLogFilter(); BackColor = Color.White; ForeColor = Color.Black; }
public void AddColorFilter(AzLogFilter azlf, Color colorBack, Color colorFore) { m_colorFilters.Add(new AzColorFilter(azlf, colorBack, colorFore)); }
public AzColorFilter(AzLogFilter filter, Color colorBack, Color colorFore) { Filter = filter; BackColor = colorBack; ForeColor = colorFore; }
/* S E T F I L T E R */ /*---------------------------------------------------------------------------- %%Function: SetFilter %%Qualified: AzLog.AzLogView.SetFilter %%Contact: rlittle ----------------------------------------------------------------------------*/ public void SetFilter(AzLogFilter azlf) { m_azlf = azlf; if (m_pliale != null && m_pliale.Count > 0) RebuildView(); }