private void PopulateSelectedProviderInfo() { if (lvProviders.SelectedItems.Count == 0) { return; } var lvi = lvProviders.SelectedItems[0]; // Build new empty filter + data LastMetadataFilter = new ProviderMetadataFilter(); string ProviderName = lvi.Tag as string; ComputeProviderMetadata( ProviderName, out LastMetadataFilter.Nodes); GetProviderMetadataFilter(ref LastMetadataFilter); // Populate without restrictions PopulateProviderMetadata(LastMetadataFilter); // Populate keywords PopulateProviderMetadataKeywords(LastMetadataFilter.Nodes); gbProviderMetadata.Text = "Provider metadata - " + ProviderName; gbProviderFilters.Text = "Provider filters - " + ProviderName; }
private void GetProviderMetadataFilter(ref ProviderMetadataFilter Filter) { GetCbChkSelections( cbchkChannels, out Filter.Channels); GetCbChkSelections( cbchkTasks, out Filter.Tasks); GetCbChkSelections( cbchkOpcodes, out Filter.Opcodes); GetCbChkSelections( cbchkLevels, out Filter.Levels); GetCbChkSelections( cbchkTemplateFields, out Filter.TemplateFields); GetCbChkSelections( cbchkTemplateFields, out Filter.TemplateFields); Filter.TemplateFieldCondition = cbProviderMetadataTemplateFieldsMatchCondition.SelectedIndex; Filter.Message = txtProviderFilterText.Text; }
private void PopulateProviderMetadata(ProviderMetadataFilter Filter) { // // Populate the event metadata // lvProviderMetadata.BeginUpdate(); lvProviderMetadata.Items.Clear(); foreach (XmlNode xnEvent in Filter.Nodes.SelectNodes(string.Format("{0}/{1}/{2}", XML_PROVIDER, XML_EVENT_METADATA, XML_EVENT))) { string Channel = xnGetText(xnEvent, XML_CHANNEL); if (Filter.Channels != null && !Filter.Channels.Contains(Channel)) { continue; } string Level = xnGetText(xnEvent, XML_LEVEL); if (Filter.Levels != null && !Filter.Levels.Contains(Level)) { continue; } string Opcode = xnGetText(xnEvent, XML_OPCODE); if (Filter.Opcodes != null && !Filter.Opcodes.Contains(Opcode)) { continue; } string TaskName = xnGetText(xnEvent, XML_TASK); if (Filter.Tasks != null && !Filter.Tasks.Contains(TaskName)) { continue; } string Message = xnGetText(xnEvent, XML_MESSAGE); if (!string.IsNullOrEmpty(Filter.Message) && Message.IndexOf(Filter.Message, StringComparison.OrdinalIgnoreCase) == -1) { continue; } string Template = xnGetText(xnEvent, XML_TEMPLATE); var FieldsArray = GetProviderTemplateFields(Template); if (Filter.TemplateFields != null) { var AllFields = new HashSet <string>(FieldsArray); // ALL? All the fields should be a subset if (Filter.TemplateFieldCondition == 0) { if (!Filter.TemplateFields.IsSubsetOf(AllFields)) { continue; } } // ANYOF? At least one filter member belongs in AllFields else if (Filter.TemplateFieldCondition == 1) { if (!Filter.TemplateFields.Overlaps(AllFields)) { continue; } } } string Id = xnGetText(xnEvent, XML_ID); string Keyword = xnGetText(xnEvent, XML_KEYWORD); string Fields = string.Join(",", FieldsArray); var lvi = new ListViewItem(Id); lvi.Tag = xnEvent; lvi.SubItems.AddRange(new string[] { Level, Opcode, TaskName, Keyword, Channel, Message, Fields }); lvProviderMetadata.Items.Add(lvi); } lvProviderMetadata.EndUpdate(); }
private void PopulateSelectedProviderInfo() { if (lvProviders.SelectedItems.Count == 0) return; var lvi = lvProviders.SelectedItems[0]; // Build new empty filter + data LastMetadataFilter = new ProviderMetadataFilter(); string ProviderName = lvi.Tag as string; ComputeProviderMetadata( ProviderName, out LastMetadataFilter.Nodes); GetProviderMetadataFilter(ref LastMetadataFilter); // Populate without restrictions PopulateProviderMetadata(LastMetadataFilter); // Populate keywords PopulateProviderMetadataKeywords(LastMetadataFilter.Nodes); gbProviderMetadata.Text = "Provider metadata - " + ProviderName; gbProviderFilters.Text = "Provider filters - " + ProviderName; }
private void GetProviderMetadataFilter(ref ProviderMetadataFilter Filter) { GetCbChkSelections( cbchkChannels, out Filter.Channels); GetCbChkSelections( cbchkTasks, out Filter.Tasks); GetCbChkSelections( cbchkOpcodes, out Filter.Opcodes); GetCbChkSelections( cbchkLevels, out Filter.Levels); GetCbChkSelections( cbchkTemplateFields, out Filter.TemplateFields); GetCbChkSelections( cbchkTemplateFields, out Filter.TemplateFields); Filter.TemplateFieldCondition = cbProviderMetadataTemplateFieldsMatchCondition.SelectedIndex; Filter.Message = txtProviderFilterText.Text; }
private void PopulateProviderMetadata(ProviderMetadataFilter Filter) { // // Populate the event metadata // lvProviderMetadata.BeginUpdate(); lvProviderMetadata.Items.Clear(); foreach (XmlNode xnEvent in Filter.Nodes.SelectNodes(string.Format("{0}/{1}/{2}", XML_PROVIDER, XML_EVENT_METADATA, XML_EVENT))) { string Channel = xnGetText(xnEvent, XML_CHANNEL); if (Filter.Channels != null && !Filter.Channels.Contains(Channel)) continue; string Level = xnGetText(xnEvent, XML_LEVEL); if (Filter.Levels != null && !Filter.Levels.Contains(Level)) continue; string Opcode = xnGetText(xnEvent, XML_OPCODE); if (Filter.Opcodes != null && !Filter.Opcodes.Contains(Opcode)) continue; string TaskName = xnGetText(xnEvent, XML_TASK); if (Filter.Tasks != null && !Filter.Tasks.Contains(TaskName)) continue; string Message = xnGetText(xnEvent, XML_MESSAGE); if (!string.IsNullOrEmpty(Filter.Message) && Message.IndexOf(Filter.Message, StringComparison.OrdinalIgnoreCase) == -1) continue; string Template = xnGetText(xnEvent, XML_TEMPLATE); var FieldsArray = GetProviderTemplateFields(Template); if (Filter.TemplateFields != null) { var AllFields = new HashSet<string>(FieldsArray); // ALL? All the fields should be a subset if (Filter.TemplateFieldCondition == 0) { if (!Filter.TemplateFields.IsSubsetOf(AllFields)) continue; } // ANYOF? At least one filter member belongs in AllFields else if (Filter.TemplateFieldCondition == 1) { if (!Filter.TemplateFields.Overlaps(AllFields)) continue; } } string Id = xnGetText(xnEvent, XML_ID); string Keyword = xnGetText(xnEvent, XML_KEYWORD); string Fields = string.Join(",", FieldsArray); var lvi = new ListViewItem(Id); lvi.Tag = xnEvent; lvi.SubItems.AddRange(new string[] { Level, Opcode, TaskName, Keyword, Channel, Message, Fields }); lvProviderMetadata.Items.Add(lvi); } lvProviderMetadata.EndUpdate(); }