void SaveFile(ref WholeStageData data)
 {
     using (var output = File.Create(m_filePath + m_fileName))
     {
         data.WriteTo(output);
     }
 }
        public void ShowSaveDialogBox(ref WholeStageData data)
        {
            SaveWindow saveDialog = new SaveWindow();

            // Show testDialog as a modal dialog and determine if DialogResult = OK.
            if (saveDialog.ShowDialog(this) == DialogResult.OK)
            {
                // Read the contents of testDialog's TextBox.
                SaveFile(ref data);
                MessageBox.Show("파일을 저장했습니다.");
            }
            saveDialog.Dispose();
        }
        public void ClickSaveMenu(object sender, EventArgs e)
        {
            Int32[,] canvasData = new Int32[25, 30];
            MapPalette.GetMapCanvasInfo(ref canvasData);

            WholeStageData wholeStageData = new WholeStageData
            {
                StageLevel = 1,
            };

            for (int i = 0; i < 25; i++)
            {
                WholeStageData.Types.MapLine mapLine = new MapLine();
                for (int j = 0; j < 30; j++)
                {
                    mapLine.Block.Add(canvasData[i, j]);
                }
                wholeStageData.Map.Add(mapLine);
            }



            foreach (MonsterData monData in m_StageMonsters)
            {
                Monster monster = new Monster();
                monster.Type      = (Int32)monData.type;
                monster.StartXPos = monData.startPos.X;
                monster.StartYPos = monData.startPos.Y;

                foreach (MonsterAICommand monDtCmd in monData.Commands)
                {
                    monster.Commands.Add((Int32)monDtCmd);
                }

                wholeStageData.Monsters.Add(monster);
            }

            // wholeStageData.ToString();
            if (m_isNewFile == false)
            {
                m_fileName = "";
                ShowSaveDialogBox(ref wholeStageData);
            }
            else
            {
                m_fileStream = File.Create(m_filePath + m_fileName);
                SaveFile(ref wholeStageData);
            }
        }