public static byte[] GetBytes(string name, byte[] defaultValue, bool useSlots = true) { string path = ((!useSlots) ? SaveSlotUtils.GetUserPath() : SaveSlotUtils.GetLocalSlotPath()) + name; if (!File.Exists(path)) { return(defaultValue); } return(File.ReadAllBytes(path)); }
public static string GetString(string name, string defaultValue = "", bool useSlots = true) { string path = ((!useSlots) ? SaveSlotUtils.GetUserPath() : SaveSlotUtils.GetLocalSlotPath()) + name; if (!File.Exists(path)) { return(defaultValue); } return(File.ReadAllText(path)); }
public static void DeleteKey(string name, bool useSlots = true) { string path = ((!useSlots) ? SaveSlotUtils.GetUserPath() : SaveSlotUtils.GetLocalSlotPath()) + name; string filename = ((!useSlots) ? string.Empty : SaveSlotUtils.GetCloudSlotPath()) + name; bool flag = File.Exists(path); bool flag2 = CoopSteamCloud.CloudFileExist(filename); if (flag) { File.Delete(path); } if (flag2 && CoopSteamCloud.ShouldUseCloud()) { CoopSteamCloud.CloudDelete(filename); } }
public static void SetBytes(string name, byte[] data, bool useSlots = true) { string text = (!useSlots) ? SaveSlotUtils.GetUserPath() : SaveSlotUtils.GetLocalSlotPath(); string text2 = text + name; if (!Directory.Exists(text)) { Directory.CreateDirectory(text); } if (File.Exists(text2)) { string text3 = text2 + "prev"; if (File.Exists(text3)) { File.Delete(text3); } File.Move(text2, text3); } File.WriteAllBytes(text2, data); if (CoopSteamCloud.ShouldUseCloud()) { CoopSteamCloud.CloudSave(((!useSlots) ? string.Empty : SaveSlotUtils.GetCloudSlotPath()) + name, data); } }