5 changed files with 70 additions and 1 deletions
@ -0,0 +1,27 @@ |
|||||
|
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(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue