Пример #1
0
 //Save as
 private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     SaveFileDialog sfd = new SaveFileDialog();
     if (sfd.ShowDialog() == DialogResult.OK)
     {
         LevelSerializor serializor = new LevelSerializor();
         serializor.Serialize(this.level, sfd.OpenFile());
         fileName = sfd.FileName;
     }
 }
Пример #2
0
 //save
 private void saveToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (fileName == null)
     {
         saveAsToolStripMenuItem_Click(sender, e);
     }
     else
     {
         FileStream currentStream = File.Open(fileName, FileMode.Open);
         LevelSerializor serializor = new LevelSerializor();
         serializor.Serialize(this.level, currentStream);
     }
 }
Пример #3
0
 //open
 private void kkkToolStripMenuItem_Click(object sender, EventArgs e)
 {
     OpenFileDialog ofd = new OpenFileDialog();
     if (ofd.ShowDialog() == DialogResult.OK)
     {
         LevelSerializor serializor = new LevelSerializor();
         this.level = serializor.DeSerialize(ofd.OpenFile());
     }
     init();
     fileName = ofd.FileName;
     paintBoard.Visible = true;
     paintBoard.Invalidate();
 }