public void SaveFiltersToRegistry(LogFilterCollection filters) { foreach (LogFilter filter in filters) { SaveFilter(filter); } }
public LogFilterCollection GetFiltersFromRegistry() { LogFilterCollection filters = new LogFilterCollection(); RegistryKey SoftwareKey = Registry.CurrentUser.CreateSubKey("Software"); RegistryKey ManufacturerKey = SoftwareKey.CreateSubKey("MattiasC"); RegistryKey SuiteKey = ManufacturerKey.CreateSubKey("T7SuitePro"); try { using (RegistryKey Settings = SuiteKey.CreateSubKey("LogFilters")) { if (Settings != null) { string[] vals = Settings.GetSubKeyNames(); foreach (string a in vals) { try { LogFilter filter = LoadFilter(a); filters.Add(filter); } catch (Exception E) { logger.Debug(E.Message); } } } } } catch (Exception E2) { logger.Debug(E2.Message); } return(filters); }
/// <summary> /// Initializes a new instance of the <see cref="LogConfiguration"/> class. /// </summary> public LogConfiguration() { _sinks = new LogSinkCollection(); _assemblies = new AssemblyCollection(); _filters = new LogFilterCollection(); _internalLogger = new InternalLogger(); }
private void simpleButton3_Click(object sender, EventArgs e) { // setup the export filters LogFilters filterhelper = new LogFilters(); frmLogFilters frmfilters = new frmLogFilters(); LogFilterCollection filters = filterhelper.GetFiltersFromRegistry(); logger.Debug("filters: " + filters.Count); frmfilters.SetFilters(filters); if (gridControl1.DataSource != null) { DataTable dt = (DataTable)gridControl1.DataSource; int[] selrows = gridView1.GetSelectedRows(); foreach (int rowhandle in selrows) { DataRowView dv = (DataRowView)gridView1.GetRow(rowhandle); if (dv != null) { SymbolHelper sh = new SymbolHelper(); sh.Varname = dv.Row["SYMBOLNAME"].ToString(); sh.Color = Color.FromArgb(Convert.ToInt32(dv.Row["COLOR"])); _sc.Add(sh); } } } frmfilters.SetSymbols(_sc); if (frmfilters.ShowDialog() == DialogResult.OK) { DialogResult = DialogResult.None; filterhelper.SaveFiltersToRegistry(frmfilters.GetFilters()); } }
public void SetFilters(LogFilterCollection filters) { if (filters == null) { Console.WriteLine("setting filters as null"); } gridControl1.DataSource = filters; gridView1.BestFitColumns(); }
private void simpleButton1_Click(object sender, EventArgs e) { LogFilterCollection filters = (LogFilterCollection)gridControl1.DataSource; if (filters == null) { filters = new LogFilterCollection(); } LogFilter newfilter = new LogFilter(); newfilter.Index = filters.Count; filters.Add(newfilter); gridControl1.DataSource = filters; gridView1.RefreshData(); gridView1.BestFitColumns(); //gridView1.AddNewRow(); }
/// <summary> /// Initializes a new instance of the <see cref="LogSink"/> class. /// </summary> protected LogSink() { _filters = new LogFilterCollection(); }
/// <summary> /// Initializes LogEvents. /// </summary> /// <param name="endPoint">server EndPoint.</param> protected internal LogEvents(IPEndPoint endPoint) { ServerEndPoint = endPoint; Filters = new LogFilterCollection(); }
private void SerializeFilters(XmlWriter writer, LogFilterCollection filters) { if (filters.Count > 0) { foreach (LogFilter filter in filters) { LogFilterTypeAttribute attribute = filter.GetFilterType(); if (attribute == null) { string message = "Cannot serialize type '{0}' since it's missing a log filter type attribute."; throw new BlackBoxException(string.Format(CultureInfo.InvariantCulture, message, filter.GetType().FullName)); } writer.WriteStartElement("Filter"); writer.WriteAttributeString("Type", attribute.Name); this.SerializeProperties(writer, filter); writer.WriteEndElement(); } } }