fix test problem (F*** Mouyon)
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
parent
15e512aa86
commit
74b8c70420
File diff suppressed because one or more lines are too long
@ -0,0 +1,6 @@
|
|||||||
|
namespace QwirkleClassLibrary.Persistences;
|
||||||
|
|
||||||
|
public class GamePersistence
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
using System.Runtime.Serialization;
|
||||||
|
using QwirkleClassLibrary.Players;
|
||||||
|
|
||||||
|
namespace QwirkleClassLibrary.Persistences;
|
||||||
|
|
||||||
|
public class LeaderboardPersistence
|
||||||
|
{
|
||||||
|
public void SaveLeaderboard(Leaderboard leaderboard)
|
||||||
|
{
|
||||||
|
var leaderboardSerializer = new DataContractSerializer(typeof(Leaderboard));
|
||||||
|
|
||||||
|
using (Stream s = File.Create("LeaderBoard.json "))
|
||||||
|
{
|
||||||
|
leaderboardSerializer.WriteObject(s, leaderboard);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Leaderboard LoadLeaderboard()
|
||||||
|
{
|
||||||
|
var leaderboardSerializer = new DataContractSerializer(typeof(Leaderboard));
|
||||||
|
|
||||||
|
using (Stream s = File.OpenRead("LeaderBoard.json"))
|
||||||
|
{
|
||||||
|
return leaderboardSerializer.ReadObject(s) as Leaderboard ?? throw new NullReferenceException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue