4 using System.Xml.Serialization;
38 private string _TableName;
43 public string TableName
45 get {
return _TableName; }
48 if (_TableName != value)
51 if (TableNameChanged != null)
53 TableNameChanged(
this,
new EventArgs());
65 private string _RomName;
73 get {
return _RomName; }
76 if (_RomName != value)
79 if (RomNameChanged != null)
81 RomNameChanged(
this,
new EventArgs());
99 public string TableFilename {
get;
set; }
108 public string TableConfigurationFilename {
get;
set; }
111 private bool _AddLedControlConfig=
false;
119 public bool AddLedControlConfig
121 get {
return _AddLedControlConfig; }
122 set { _AddLedControlConfig = value; }
137 get {
return _ConfigurationSource; }
138 set { _ConfigurationSource = value; }
150 get {
return _Effects; }
151 set { _Effects = value; }
166 return _AssignedStaticEffects;
170 _AssignedStaticEffects = value;
188 public void TriggerStaticEffects()
199 this.Pinball = Pinball;
202 TableElements.InitAssignedEffects(
this);
203 AssignedStaticEffects.Init(
this);
211 AssignedStaticEffects.Finish();
212 TableElements.FinishAssignedEffects();
218 #region Serialization
224 public string GetConfigXml()
227 using (MemoryStream ms =
new MemoryStream())
229 new XmlSerializer(typeof(
Table)).Serialize(ms,
this);
232 using (StreamReader sr =
new StreamReader(ms, Encoding.Default))
234 Xml = sr.ReadToEnd();
247 public void SaveConfigXmlFile(
string FileName)
249 GetConfigXml().WriteToFile(FileName);
258 public static Table GetTableFromConfigXmlFile(
string FileName)
264 Xml = General.FileReader.ReadFileToString(FileName);
271 Log.
Exception(
"Could not read Table Config file {0}".Build(FileName), E);
272 throw new Exception(
"Could not read Table Config file {0}".Build(FileName), E);
274 return GetTableFromConfigXml(Xml);
282 public static Table GetTableFromConfigXmlFile(FileInfo TableConfigFile)
284 return GetTableFromConfigXmlFile(TableConfigFile.FullName);
292 public static Table GetTableFromConfigXml(
string ConfigXml)
297 byte[] xmlBytes = Encoding.Default.GetBytes(ConfigXml);
298 using (MemoryStream ms =
new MemoryStream(xmlBytes))
308 Exception Ex=
new Exception(
"Could not deserialize Table config from XML Data",E);
309 Ex.Data.Add(
"XMLData", ConfigXml);
323 Effects =
new FX.EffectList();