예제 #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //  deserialization
            Stream objstreamdeserialize_SudokuGrid = new FileStream("data.bin", FileMode.Open, FileAccess.Read, FileShare.Read);
            Stream objstreamdeserialize_moveLog    = new FileStream("data1.bin", FileMode.Open, FileAccess.Read, FileShare.Read);

            try
            {
                sudokuGrid = (SudokuGrid)objBinaryFormatter.Deserialize(objstreamdeserialize_SudokuGrid);
                moveLog    = (Dictionary <Point, int>)objBinaryFormatter.Deserialize(objstreamdeserialize_moveLog);
                foreach (KeyValuePair <Point, int> kvp in moveLog)
                {
                    sudokuGrid.MakeMove(kvp.Key.X, kvp.Key.Y, kvp.Value);//y,x
                }
                gameBoard = new SudokuTableGraphic(sudokuGrid);
                this.Controls.Add(gameBoard);
            }
            catch (Exception ea)
            {
                DrawBoard();
            }
            finally
            {
                objstreamdeserialize_SudokuGrid.Close();
                objstreamdeserialize_moveLog.Close();
            }
        }