示例#1
0
        /// <summary>
        /// Saves the save file
        /// </summary>
        /// <param name="fileLocation">File Path</param>
        /// <param name="saveFile">Savefile object</param>
        /// <param name="saveFileFormat">Savefile format</param>
        /// <returns>True if success saving, false otherwise</returns>
        public static bool SaveTumblrFile(string fileLocation, SaveFile saveFile, SaveFileFormat saveFileFormat)
        {
            try
            {
                saveFile.AddDate();
                switch (saveFileFormat)
                {
                case SaveFileFormat.Bin:
                    return(BinaryHelper.SaveObjectToFile(fileLocation, saveFile));

                case SaveFileFormat.Xml:
                    return(XmlHelper.SaveObjectToFile(fileLocation, saveFile));

                case SaveFileFormat.JsonCompressed:
                    return(JsonHelper.SaveObjectToFileCompressed(fileLocation, saveFile));

                case SaveFileFormat.Json:
                    return(JsonHelper.SaveObjectToFile(fileLocation, saveFile));

                default:
                    return(false);
                }
            }
            catch
            {
                return(false);
            }
        }