4 using System.Xml.Serialization;
7 using DirectOutput.General.BitmapHandling;
49 get {
return _Bitmaps; }
50 private set { _Bitmaps = value; }
55 private string _TableName;
60 public string TableName
62 get {
return _TableName; }
65 if (_TableName != value)
68 if (TableNameChanged != null)
70 TableNameChanged(
this,
new EventArgs());
82 private string _RomName;
90 get {
return _RomName; }
93 if (_RomName != value)
96 if (RomNameChanged != null)
98 RomNameChanged(
this,
new EventArgs());
116 public string TableFilename {
get;
set; }
125 public string TableConfigurationFilename {
get;
set; }
128 private bool _AddLedControlConfig=
false;
136 public bool AddLedControlConfig
138 get {
return _AddLedControlConfig; }
139 set { _AddLedControlConfig = value; }
154 get {
return _ConfigurationSource; }
155 set { _ConfigurationSource = value; }
167 get {
return _Effects; }
168 set { _Effects = value; }
183 return _AssignedStaticEffects;
187 _AssignedStaticEffects = value;
205 public void TriggerStaticEffects()
216 this.Pinball = Pinball;
219 TableElements.InitAssignedEffects(
this);
220 AssignedStaticEffects.Init(
this);
228 AssignedStaticEffects.Finish();
229 TableElements.FinishAssignedEffects();
235 #region Serialization
241 public string GetConfigXml()
244 using (MemoryStream ms =
new MemoryStream())
246 new XmlSerializer(typeof(
Table)).Serialize(ms,
this);
249 using (StreamReader sr =
new StreamReader(ms, Encoding.Default))
251 Xml = sr.ReadToEnd();
264 public void SaveConfigXmlFile(
string FileName)
266 GetConfigXml().WriteToFile(FileName);
275 public static Table GetTableFromConfigXmlFile(
string FileName)
281 Xml = General.FileReader.ReadFileToString(FileName);
288 Log.
Exception(
"Could not read Table Config file {0}".Build(FileName), E);
289 throw new Exception(
"Could not read Table Config file {0}".Build(FileName), E);
291 return GetTableFromConfigXml(Xml);
299 public static Table GetTableFromConfigXmlFile(FileInfo TableConfigFile)
301 return GetTableFromConfigXmlFile(TableConfigFile.FullName);
309 public static Table GetTableFromConfigXml(
string ConfigXml)
314 byte[] xmlBytes = Encoding.Default.GetBytes(ConfigXml);
315 using (MemoryStream ms =
new MemoryStream(xmlBytes))
325 Exception Ex=
new Exception(
"Could not deserialize Table config from XML Data",E);
326 Ex.Data.Add(
"XMLData", ConfigXml);
340 Effects =
new FX.EffectList();