public void copyValuesTo(HearthstoneBoard board) { board.printPriority = printPriority; board.turnbyturn = turnbyturn; board.illidanPlayer = illidanPlayer; board.NefarianPlayer = NefarianPlayer; board.DeathwingPlayer = DeathwingPlayer; foreach (int i in stockedRandomValues) { board.stockedRandomValues.Add(i); } board.p1Board = p1Board.copy(); board.p2Board = p2Board.copy(); }
public static void autoSave(BoardSide b, int round) { BoardSide save = b.copy(); IFormatter formatter = new BinaryFormatter(); string directory = @"BoardSides\Round" + round; Directory.CreateDirectory(directory); string filename = directory + @"\board.boardside"; int suffix = 1; while (File.Exists(filename)) { suffix++; filename = directory + @"\board" + suffix + ".boardside"; } //Dont save board if its already saved BoardSide lastBoard = null; if (suffix == 2) { lastBoard = loadBoardSide(directory + @"\board.boardside"); } else if (suffix != 1) { lastBoard = loadBoardSide(directory + @"\board" + (suffix - 1) + ".boardside"); } if (lastBoard != null && lastBoard.Compare(b, null, null)) { return; } Stream stream = new FileStream(filename, FileMode.Create, FileAccess.Write); formatter.Serialize(stream, b); stream.Close(); }