public static T LoadBinary <T>(Mod mod, string fileNameHasExt, bool isCloud, JsonSerializerSettings jsonSettings) where T : class { DataFileHelpers.PrepareDir(mod); string fullPath = DataFileHelpers.GetFullPath(mod, fileNameHasExt); try { return(FileHelpers.LoadBinaryFile <T>(fullPath, isCloud, jsonSettings)); } catch (IOException e) { string fullDir = DataFileHelpers.GetFullDirectoryPath(mod); LogHelpers.Warn("Failed to load binary file " + fileNameHasExt + " at " + fullDir + " - " + e.ToString()); throw new IOException("Failed to load binary file " + fileNameHasExt + " at " + fullDir, e); } }
public static void SaveAsBinary <T>(Mod mod, string fileNameHasExt, bool isCloud, JsonSerializerSettings jsonSettings, T data) where T : class { DataFileHelpers.PrepareDir(mod); string fullPath = DataFileHelpers.GetFullPath(mod, fileNameHasExt); try { FileHelpers.SaveBinaryFile <T>(data, fullPath, isCloud, false, jsonSettings); } catch (IOException e) { string fullDir = DataFileHelpers.GetFullDirectoryPath(mod); LogHelpers.Warn("Failed to save binary file " + fileNameHasExt + " at " + fullDir + " - " + e.ToString()); throw new IOException("Failed to save binary file " + fileNameHasExt + " at " + fullDir, e); } }