You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
736 B
28 lines
736 B
|
4 weeks ago
|
using System;
|
||
|
|
using System.Text;
|
||
|
|
|
||
|
|
namespace ClassLib000.Chess
|
||
|
|
{
|
||
|
|
class ChessFileSerializer
|
||
|
|
{
|
||
|
|
public static void ChessSaveToFile(string filename, ChessGame game)
|
||
|
|
{
|
||
|
|
string content = game.AsTextString();
|
||
|
|
System.IO.File.WriteAllText(filename, content, Encoding.UTF8);
|
||
|
|
}
|
||
|
|
|
||
|
|
public static ChessGame ChessLoadFromFile(string filename)
|
||
|
|
{
|
||
|
|
ChessGame game = new ChessGame();
|
||
|
|
string content = System.IO.File.ReadAllText(filename, Encoding.UTF8);
|
||
|
|
game.FromTextString(content);
|
||
|
|
return game;
|
||
|
|
}
|
||
|
|
|
||
|
|
private static string ChessDrawFigures(Player player)
|
||
|
|
{
|
||
|
|
return player.AsString();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|