public void saveDB() { foreach (GamePageData save in this.saves) { SerializeUtilities <GamePageData> .Serialize(save, this.dirPath + "\\" + save.boardPlacementData.GetStartPageData().getPlayerName() + ".ser"); } }
public void saveDB() { /* Serialize each GamePageData in this.saves */ foreach (GamePageData save in this.saves) { /* Saves the GamePageData at save's player's named file */ SerializeUtilities <GamePageData> .Serialize(save, this.dirPath + "\\" + save.boardPlacementData.GetStartPageData().getPlayerName() + ".ser"); } }
/* Instantiates a ScoreDB that will communication with the file at filePath */ private ScoreDB(string fileName) { if (fileName == null || fileName.Trim().Length == 0) { throw new ArgumentException("fileName must not be null or empty"); } this.fileName = fileName; if (File.Exists(fileName)) { records = SerializeUtilities <List <ScoreRecord> > .Deserialize(fileName); } else { records = new List <ScoreRecord>(); } }
private ScoreDB(string fileName) { if (fileName == null || fileName.Trim().Length == 0) { throw new ArgumentException("Имя файла не должно быть пустым"); } this.fileName = fileName; if (File.Exists(fileName)) { records = SerializeUtilities <List <ScoreRecord> > .Deserialize(fileName); } else { records = new List <ScoreRecord>(); } }
private PlayerDB(string dirPath) { if (dirPath == null || dirPath.Trim().Length == 0) { throw new ArgumentException(); } if (!Directory.Exists(dirPath)) { Directory.CreateDirectory(dirPath); } this.dirPath = dirPath; string[] allFiles = Directory.GetFiles(this.dirPath); this.saves = new List <GamePageData>(); foreach (string file in allFiles) { saves.Add(SerializeUtilities <GamePageData> .Deserialize(file)); } }
/* Instantiates a playerDB that will communication with the file at filePath */ private PlayerDB(string dirPath) { if (dirPath == null || dirPath.Trim().Length == 0) { throw new ArgumentException("dirPath must not be null or empty"); } /* If the directory does not exist, create it */ if (!Directory.Exists(dirPath)) { Directory.CreateDirectory(dirPath); } this.dirPath = dirPath; /* Get a listing of all the files in the directory and deserialize each */ string[] allFiles = Directory.GetFiles(this.dirPath); this.saves = new List <GamePageData>(); foreach (string file in allFiles) { saves.Add(SerializeUtilities <GamePageData> .Deserialize(file)); } }
public void saveDB() { SerializeUtilities <List <ScoreRecord> > .Serialize(this.records, this.fileName); }