コード例 #1
0
        /// <summary>
        /// Save an object to disk
        /// </summary>
        /// <param name="obj">object to be saved</param>
        /// <param name="filename">Name of file that will be written to</param>
        /// <param name="folder">Name of the folder that should contain the file</param>
        public void Save(object obj, string filename, string folder = null)
        {
            if (string.IsNullOrEmpty(folder))
            {
                folder = defaultFolder;
            }
            var saveLoadMethod = GetSaveLoadMethod(saveMethod);

            SaveLoadUtility.Save(obj, saveLoadMethod, filename, folder, baseFolder);
        }
コード例 #2
0
        /// <summary>
        /// Save object to file and specify the method of save/load
        /// </summary>
        /// <param name="methodType">Method to be used to save the file to disk.</param>
        /// <param name="obj">Object to be written to disk.</param>
        /// <param name="filename">Name of file to write to.</param>
        /// <param name="folder">Name of folder to save to. If null the default folder will be used.</param>
        public void SaveWithMethod(SerializationMethodType methodType, object obj, string filename, string folder = null)
        {
            var saveLoadMethod = GetSaveLoadMethod(methodType);

            SaveLoadUtility.Save(obj, saveLoadMethod, filename, folder);
        }