3 using System.Collections.Generic;
5 namespace DirectOutput.LedControl.Loader
20 public int Number {
get;
set; }
23 private int _FirstOutputNumber;
31 public int FirstOutputNumber
33 get {
return _FirstOutputNumber; }
34 set { _FirstOutputNumber = value; }
69 public int RequiredOutputCount
73 return (this.Any(S => S.OutputType ==
OutputTypeEnum.RGBOutput) ? 3 : 1);
88 return this.Any(S => S.IsArea);
103 public bool ParseColumnData(
string ColumnData,
bool ThrowExceptions =
false)
105 bool ExceptionOccured =
false;
106 List<string> ColumnConfigs =
new List<string>(SplitSettings(ColumnData));
108 foreach (
string CC
in ColumnConfigs)
110 if (!CC.IsNullOrWhiteSpace())
122 ExceptionOccured =
true;
123 Log.
Exception(
"Could not parse setting {0} in column data {1}.".Build(CC, ColumnData), E);
126 throw new Exception(
"Could not parse setting {0} in column data {1}.".Build(CC, ColumnData), E);
131 return !ExceptionOccured;
135 private string[] SplitSettings(
string ConfigData)
137 List<string> L =
new List<string>();
139 int BracketCount = 0;
143 for (
int P = 0; P < ConfigData.Length; P++)
145 if (ConfigData[P] ==
'(')
149 else if (ConfigData[P] ==
')')
152 }
if (ConfigData[P] ==
'/' && BracketCount <= 0)
154 L.Add(ConfigData.Substring(LP, P - LP));
161 if (LP < ConfigData.Length)
163 L.Add(ConfigData.Substring(LP));
182 this.Number = ColumnNumber;
183 ParseColumnData(ColumnData, ThrowExceptions);