WIP
DirectOutput framework for virtual pinball cabinets WIP
Go to:
Overview 
TableConfig.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 
4 namespace DirectOutput.LedControl.Loader
5 {
9  public class TableConfig
10  {
17  public string ShortRomName
18  {
19  get;
20  set;
21  }
22 
23 
24 
31  public TableConfigColumnList Columns { get; set; }
32 
46  public void ParseLedControlDataLine(string LedControlData, bool ThrowExceptions)
47  {
48  //mm,L88 Blink I44,L87,ON Red,S37,S7,S48,S46/S1/S2,S10/S8,S11,S4 300 I32/S8 300 I32/W15 300 2/W25 300 2,S3/S4/S8/S33,S4/S9/S14/S26/S35,S4/S5/S12/S13/S34/S36,S4/S16/S27/S28,S7 300/S4 1500/S8 300/S33 300/S35 300,S7 White/S17 Red/S18 Red/S19 Red/W26 Magenta,S7 White/S24 Green/S25 Green/W15 Lime/W44 Green,S7 White/S22 Red/S24 Green,S7 White/S21 Red/S12 Magenta/S13 Magenta/W25 Lime,S7 White/S20 Red/S23 Red/S14 Magenta/W17 Magenta
49 
50  //Split columns
51  List<string> DataColumns = new List<string>(LedControlData.Split(new char[] { ',' }, StringSplitOptions.None));
52  if (DataColumns.Count < 1)
53  {
54  Log.Warning("No data found in line {0}".Build(LedControlData));
55  if (ThrowExceptions)
56  {
57  throw new Exception("No usable data found in line {0}".Build(LedControlData));
58  }
59  return;
60  }
61  //Check if first column contains data (Romname)
62  if (DataColumns[0].IsNullOrWhiteSpace())
63  {
64  Log.Warning("No short Rom name found in line {0}".Build(LedControlData));
65  if (ThrowExceptions)
66  {
67  throw new Exception("No short Rom name found in line {0}".Build(LedControlData));
68  }
69  return;
70  }
71  //Assign Romname from first column
72  ShortRomName = DataColumns[0];
73 
74  Columns = new TableConfigColumnList();
75 
76  Columns.ParseControlData(LedControlData, ThrowExceptions);
77 
78  }
79 
80 
84  public TableConfig()
85  {
86  Columns = new TableConfigColumnList();
87  }
88 
89 
105  public TableConfig(string LedControlData, bool ThrowExceptions)
106  : this()
107  {
108  ParseLedControlDataLine(LedControlData, ThrowExceptions);
109  }
110 
111 
112 
113 
114  }
115 }
A table config from a ini file.
Definition: TableConfig.cs:9
TableConfig(string LedControlData, bool ThrowExceptions)
Initializes a new instance of the TableConfig class. Gets the table config from led control data...
Definition: TableConfig.cs:105
static void Warning(string Message)
Writes a warning message to the log.
Definition: Log.cs:134
void ParseLedControlDataLine(string LedControlData, bool ThrowExceptions)
Gets the table config from led control data. Parses one line of a Ledcontrol.ini file...
Definition: TableConfig.cs:46
A simple logger used to record important events and exceptions.
Definition: Log.cs:14
List of columns of a LedCOntrol.ini file. Inherits List>T<.
TableConfig()
Initializes a new instance of the TableConfig class.
Definition: TableConfig.cs:84