示例#1
0
        public static void SaveAsBinary <T>(Mod mod, string file_name_has_ext, bool is_cloud, T data) where T : class
        {
            DataFileHelpers.PrepareDir(mod);

            string full_path = DataFileHelpers.GetFullPath(mod, file_name_has_ext);

            try {
                FileHelpers.SaveBinaryFile <T>(data, full_path, is_cloud, false);
            } catch (IOException e) {
                string full_dir = DataFileHelpers.GetFullDirectoryPath(mod);
                throw new IOException("Failed to save binary file " + file_name_has_ext + " at " + full_dir, e);
            }
        }
示例#2
0
        public static T LoadBinary <T>(Mod mod, string file_name_has_ext, bool is_cloud) where T : class
        {
            DataFileHelpers.PrepareDir(mod);

            string full_path = DataFileHelpers.GetFullPath(mod, file_name_has_ext);

            try {
                return(FileHelpers.LoadBinaryFile <T>(full_path, is_cloud));
            } catch (IOException e) {
                string full_dir = DataFileHelpers.GetFullDirectoryPath(mod);
                throw new IOException("Failed to load binary file " + file_name_has_ext + " at " + full_dir, e);
            }
        }