예제 #1
0
        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();
            }
        }
예제 #2
0
 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;
 }
예제 #3
0
 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);
     }
 }
예제 #4
0
        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();
        }
예제 #5
0
 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;
 }
예제 #6
0
        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);
                    }
                }
            }
        }
예제 #7
0
 private void ConfigureSerialization()
 {
     _serialization = new Serialization.Serialization(this);
 }
예제 #8
0
 public void Setup(BenchmarkContext context)
 {
     System         = ActorSystem.Create("SerializationBenchmarks");
     _serialization = new Serialization.Serialization(System.AsInstanceOf <ExtendedActorSystem>());
     _findSerializerForTypeThroughput = context.GetCounter(CreateThroughputCounter);
 }
예제 #9
0
        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);
                    }
                }
            }
        }
예제 #10
0
 public void Save(string path)
 {
     Serialization.Serialization<Game> gameSer = new Serialization.Serialization<Game>();
     gameSer.Save(path, this, Serialization.Serialization<Game>.Typ.Normal);
 }
예제 #11
0
 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);
     }
 }
예제 #12
0
파일: Game.cs 프로젝트: andyld97/Spider
 public void Save(string path)
 {
     Serialization.Serialization <Game> gameSer = new Serialization.Serialization <Game>();
     gameSer.Save(path, this, Serialization.Serialization <Game> .Typ.Normal);
 }