Beispiel #1
0
        private CompendiumRecord AssembleCompendiumRecord(Compendium compendium)
        {
            CompendiumRecord compendiumRecord = new CompendiumRecord();



            return(compendiumRecord);
        }
Beispiel #2
0
        /// <summary>
        /// Loads the compendium at the specified location (or default location if not provided).
        /// </summary>
        public Compendium LoadCompendium(string fileLocation = null)
        {
            Compendium compendium = null;

            if (String.IsNullOrWhiteSpace(fileLocation))
            {
                fileLocation = Path.Combine(_saveDataFolder, _compendiumSaveFileName);
            }

            if (File.Exists(fileLocation))
            {
                byte[]           bytes            = File.ReadAllBytes(fileLocation);
                CompendiumRecord compendiumRecord = _binarySerializer.Deserialize <CompendiumRecord>(bytes);
                compendium = AssembleCompendium(compendiumRecord);
            }

            return(compendium);
        }
Beispiel #3
0
        /// <summary>
        /// Saves the compendium to the specified location (or default location if not provided).
        /// </summary>
        public bool SaveCompendium(Compendium compendium, string fileLocation = null)
        {
            if (compendium == null)
            {
                throw new ArgumentNullException(nameof(compendium));
            }

            if (String.IsNullOrWhiteSpace(fileLocation))
            {
                fileLocation = Path.Combine(_saveDataFolder, _compendiumSaveFileName);
            }

            CompendiumRecord compendiumRecord = AssembleCompendiumRecord(compendium);

            byte[] bytes = _binarySerializer.Serialize(compendiumRecord);
            File.WriteAllBytes(fileLocation, bytes);

            return(bytes.Length > 0 && File.Exists(fileLocation));
        }