public ToggleFilter(Form aOwner, Filters[] aFilterList) { this.Owner = aOwner; myFilters = aFilterList; InitializeComponent(); if (myFilters != null) { ToggleFilter_CreateFilterCheckBoxes(); } }
public void RefreshLogText(Filters[] aFilterList) { myFilters = aFilterList; string[] lines = File.ReadAllLines(myCurrentFileInfo.FullName); string[] filteredLogText = new string[lines.GetLength(0)]; int numberOfFilteredLines = 0; for (int i = 0; i < lines.GetLength(0); ++i) { string currentFilterTag = ""; bool allowedLine = false; int amountOfFoundTagStarts = 0; for (int j = 0; j < lines[i].Length; ++j) { if (lines[i][j] == '[') { ++amountOfFoundTagStarts; } if (amountOfFoundTagStarts == 2) { if (lines[i][j] == ']') { break; } currentFilterTag += lines[i][j]; } } for (int k = 0; k < myNumberOfFiltes; ++k) { if (myFilters[k].myFilterName == currentFilterTag) { allowedLine = myFilters[k].myActiveBool; break; } } if (allowedLine == true) { filteredLogText[numberOfFilteredLines] = lines[i] + "\n"; ++numberOfFilteredLines; } } LogFileTextWindow.ReadOnly = false; LogFileTextWindow.Text = ""; for (int i = 0; i < numberOfFilteredLines; ++i) { LogFileTextWindow.Text += filteredLogText[i]; } LogFileTextWindow.ReadOnly = true; }