2 using System.Collections.Generic;
26 string[] Cols = SplitColumns(LedControlData);
29 Log.
Warning(
"No data to parse found in LedControlData: {0}".Build(LedControlData));
32 throw new Exception(
"No data to parse found in LedControlData: {0}".Build(LedControlData));
36 int FirstOutputNumber = 1;
37 int LastColumnWithData = -1;
38 for (
int i = 1; i < Cols.Length; i++)
40 if (!Cols[i].IsNullOrWhiteSpace())
42 LastColumnWithData = i;
45 for (
int i = 1; i <= LastColumnWithData; i++)
53 Log.
Warning(
"Previous exceptions occured in the line {0} of the ledcontrol file".Build(LedControlData));
56 throw new Exception(
"Exception(s) occured when parsing {0}".Build(LedControlData));
71 private string[] SplitColumns(
string ConfigData)
73 List<string> L =
new List<string>();
79 for (
int P = 0; P < ConfigData.Length; P++)
81 if (ConfigData[P] ==
'(')
85 else if (ConfigData[P] ==
')')
88 }
if (ConfigData[P] ==
',' && BracketCount <= 0)
90 L.Add(ConfigData.Substring(LP, P - LP));
97 if (LP < ConfigData.Length)
99 L.Add(ConfigData.Substring(LP));
111 base.Sort((a, b) => a.Number.CompareTo(b.Number));
126 ParseControlData(LedControlData, ThrowExceptions);
static void Warning(string Message)
Writes a warning message to the log.
new void Sort()
Sorts the elements in the list on the column number.
Column in a LedControl.ini file. Is a list of TableConfigSettingObjects for that column...
A simple logger used to record important events and exceptions.
bool ParseColumnData(string ColumnData, bool ThrowExceptions=false)
Parses data for a column from a LedControl.ini file.
TableConfigColumnList()
Initializes a new instance of the TableConfigColumnList class.
void ParseControlData(string LedControlData, bool ThrowExceptions=false)
Parses a line of LedControl data.
List of columns of a LedCOntrol.ini file. Inherits List>T<.
int FirstOutputNumber
Gets or sets the number of the first ouput for this column.
int Number
Gets or sets the number of the column.
int RequiredOutputCount
Gets the number of required outputs for the column.
TableConfigColumnList(string LedControlData, bool ThrowExceptions=false)
Initializes a new instance of the TableConfigColumnList class and parses a line of LedCOntrolData...