private void frmSettings_Load(object sender, EventArgs e) { if (File.Exists(this.filePath)) { Serialization.Serialization <Class.Save> s = new Serialization.Serialization <Class.Save>(); this.saveInstance = s.Read(this.filePath, Serialization.Serialization <Class.Save> .Typ.Normal) as Class.Save; if (string.IsNullOrWhiteSpace(saveInstance.Background)) { txtBackground.Text = "Standard"; } else { txtBackground.Text = saveInstance.Background; } this.refresh(false); } else { txtBackground.Text = "Standard"; } if (saveInstance == null) { saveInstance = new Class.Save(); } }
public void ReadSettings() { if (File.Exists(this.filePath)) { Serialization.Serialization <Class.Save> s = new Serialization.Serialization <Class.Save>(); this.info = s.Read(this.filePath, Serialization.Serialization <Class.Save> .Typ.Normal); try { if (this.info.Background != string.Empty) { this.currentRenderer.BackgroundImage = Image.FromFile(this.info.Background); } else { this.currentRenderer.BackgroundImage = Image.FromFile(System.IO.Path.Combine(Application.StartupPath, "Images", "Image.jpg")); } this.currentRenderer.OnDraw(); } catch { } } else { this.info = new Class.Save(); } Class.Structure.test = this.info; }
private void Save() { try { Serialization.Serialization <Class.Save> s = new Serialization.Serialization <Class.Save>(); s.Save(this.filePath, this.saveInstance, Serialization.Serialization <Class.Save> .Typ.Normal); MessageBox.Show(this, "Die Einstellungen wurden erfolgreich gespeichert!", "Erfolg!", MessageBoxButtons.OK, MessageBoxIcon.Information); if (this.owner != null) { this.owner.ReadSettings(); } } catch (Exception es) { MessageBox.Show("Leider ist der folgende Fehler aufgetreten: " + es.Message); } }
private void frmSettings_Load(object sender, EventArgs e) { if (File.Exists(this.filePath)) { Serialization.Serialization<Class.Save> s = new Serialization.Serialization<Class.Save>(); this.saveInstance = s.Read(this.filePath, Serialization.Serialization<Class.Save>.Typ.Normal) as Class.Save; if (string.IsNullOrWhiteSpace(saveInstance.Background)) txtBackground.Text = "Standard"; else txtBackground.Text = saveInstance.Background; this.refresh(false); } else txtBackground.Text = "Standard"; if (saveInstance == null) saveInstance = new Class.Save(); }
public void ReadSettings() { if (File.Exists(this.filePath)) { Serialization.Serialization<Class.Save> s = new Serialization.Serialization<Class.Save>(); this.info = s.Read(this.filePath, Serialization.Serialization<Class.Save>.Typ.Normal); try { if (this.info.Background != string.Empty) this.currentRenderer.BackgroundImage = Image.FromFile(this.info.Background); else this.currentRenderer.BackgroundImage = Image.FromFile(System.IO.Path.Combine(Application.StartupPath, "Images", "Image.jpg")); this.currentRenderer.OnDraw(); } catch { } } else this.info = new Class.Save(); Class.Structure.test = this.info; }
private void spielLadenToolStripMenuItem_Click(object sender, EventArgs e) { using (OpenFileDialog ofd = new OpenFileDialog() { Filter = ".xml|" }) { if (ofd.ShowDialog(this) == DialogResult.OK) { try { Serialization.Serialization <Class.Game> gameSer = new Serialization.Serialization <Class.Game>(); this.currentGame.MStructures.Clear(); this.currentGame.OtherCards.Clear(); this.Controls.Remove(this.currentRenderer); this.currentGame = gameSer.Read(ofd.FileName, Serialization.Serialization <Class.Game> .Typ.Normal); this.currentGame.ReDraw += CurrentGame_ReDraw; this.currentGame.Refresh += CurrentGame_Refresh; this.Invalidate(); if (this.info.HW_ACC) { this.currentRenderer = new Spider.Class.Render.SlimDXRenderer(); } else { this.currentRenderer = new Spider.Class.Render.GDIRenderer(); } this.currentRenderer.MouseDown += CurrentRenderer_MouseDown; currentRenderer.OnInit(this.currentGame, this, this.info); currentRenderer.OnDraw(); this.currentRenderer.OnDraw(); } catch (Exception) { MessageBox.Show(this, "Die Datei ist ungültig! Bitte wählen Sie eine gültige Datei aus!", "Gültige Datei auswählen!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private void ConfigureSerialization() { _serialization = new Serialization.Serialization(this); }
public void Setup(BenchmarkContext context) { System = ActorSystem.Create("SerializationBenchmarks"); _serialization = new Serialization.Serialization(System.AsInstanceOf <ExtendedActorSystem>()); _findSerializerForTypeThroughput = context.GetCounter(CreateThroughputCounter); }
private void spielLadenToolStripMenuItem_Click(object sender, EventArgs e) { using (OpenFileDialog ofd = new OpenFileDialog() { Filter = ".xml|" }) { if (ofd.ShowDialog(this) == DialogResult.OK) { try { Serialization.Serialization<Class.Game> gameSer = new Serialization.Serialization<Class.Game>(); this.currentGame.MStructures.Clear(); this.currentGame.OtherCards.Clear(); this.Controls.Remove(this.currentRenderer); this.currentGame = gameSer.Read(ofd.FileName, Serialization.Serialization<Class.Game>.Typ.Normal); this.currentGame.ReDraw += CurrentGame_ReDraw; this.currentGame.Refresh += CurrentGame_Refresh; this.Invalidate(); if (this.info.HW_ACC) this.currentRenderer = new Spider.Class.Render.SlimDXRenderer(); else this.currentRenderer = new Spider.Class.Render.GDIRenderer(); this.currentRenderer.MouseDown += CurrentRenderer_MouseDown; currentRenderer.OnInit(this.currentGame, this, this.info); currentRenderer.OnDraw(); this.currentRenderer.OnDraw(); } catch (Exception) { MessageBox.Show(this, "Die Datei ist ungültig! Bitte wählen Sie eine gültige Datei aus!", "Gültige Datei auswählen!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
public void Save(string path) { Serialization.Serialization<Game> gameSer = new Serialization.Serialization<Game>(); gameSer.Save(path, this, Serialization.Serialization<Game>.Typ.Normal); }
private void Save() { try { Serialization.Serialization<Class.Save> s = new Serialization.Serialization<Class.Save>(); s.Save(this.filePath, this.saveInstance, Serialization.Serialization<Class.Save>.Typ.Normal); MessageBox.Show(this, "Die Einstellungen wurden erfolgreich gespeichert!", "Erfolg!", MessageBoxButtons.OK, MessageBoxIcon.Information); if (this.owner != null) this.owner.ReadSettings(); } catch (Exception es) { MessageBox.Show("Leider ist der folgende Fehler aufgetreten: " + es.Message); } }
public void Save(string path) { Serialization.Serialization <Game> gameSer = new Serialization.Serialization <Game>(); gameSer.Save(path, this, Serialization.Serialization <Game> .Typ.Normal); }