Пример #1
0
 public void saveDB()
 {
     foreach (GamePageData save in this.saves)
     {
         SerializeUtilities <GamePageData> .Serialize(save, this.dirPath + "\\" + save.boardPlacementData.GetStartPageData().getPlayerName() + ".ser");
     }
 }
Пример #2
0
 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");
     }
 }
Пример #3
0
        /* 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>();
            }
        }
Пример #4
0
        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>();
            }
        }
Пример #5
0
        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));
            }
        }
Пример #6
0
        /* 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));
            }
        }
Пример #7
0
 public void saveDB()
 {
     SerializeUtilities <List <ScoreRecord> > .Serialize(this.records, this.fileName);
 }