public Entre_chiffre(Plateau p, int choix) { this.tb1 = new TextBox(); this.l1 = new Label(); this.l1.Location = new System.Drawing.Point(0, 10); this.l1.Size = new System.Drawing.Size(45, 20); this.b1 = new Button(); this.Size = new System.Drawing.Size(200, 100); this.Text = "entrez un chiffre :"; this.tb1.Text = ""; this.tb1.Size = new System.Drawing.Size(100, 20); this.tb1.Location = new System.Drawing.Point(50, 10); this.b1.Size = new System.Drawing.Size(50, 20); this.b1.Location = new System.Drawing.Point(10, 31); this.b1.Text = "OK"; this.b1.Click += new EventHandler(cliquez); this.pl = p; this.Controls.Add(b1); this.Controls.Add(l1); this.Controls.Add(tb1); this.choix = choix; }
public int[] charger_partie(Plateau pj) { int[] sauvegarde = null; String dossierAppli = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase); String cheminFichier = Path.Combine(dossierAppli, "save.sv"); if (File.Exists(Directory.GetCurrentDirectory() + @"\save.sv")) { IFormatter formatRestaure = new BinaryFormatter(); Stream streamRestaure = new FileStream("save.sv", FileMode.Open, FileAccess.Read, FileShare.Read); sauvegarde = (int[])formatRestaure.Deserialize(streamRestaure); PlateauJ pJ = new PlateauJ(sauvegarde); streamRestaure.Close(); pJ.Show(); } else { MessageBox.Show("Fichier de sauvegarde inexistant..."); } pj.Close(); return(sauvegarde); }