public static void DeleteSlot(TitleScreen.GameSetup.PlayerModes mode, TitleScreen.GameSetup.Slots slot) { string localSlotPath = SaveSlotUtils.GetLocalSlotPath(mode, slot); if (Directory.Exists(localSlotPath)) { SaveSlotUtils.DeleteDirectory(localSlotPath); } string[] array = CoopSteamCloud.ListFiles(); string cloudSlotPath = SaveSlotUtils.GetCloudSlotPath(mode, slot); for (int i = 0; i < array.Length; i++) { if (array[i].StartsWith(cloudSlotPath)) { CoopSteamCloud.CloudDelete(array[i]); } } }
public static void SyncWithCloud(string name, TitleScreen.GameSetup.PlayerModes mode, TitleScreen.GameSetup.Slots slot) { string localSlotPath = SaveSlotUtils.GetLocalSlotPath(mode, slot); string path = localSlotPath + name; string filename = SaveSlotUtils.GetCloudSlotPath(mode, slot) + name; bool flag = File.Exists(path); bool flag2 = CoopSteamCloud.CloudFileExist(filename); long num = 0L; long num2 = 0L; if (flag2 && flag) { num = CoopSteamCloud.CloudTimestamp(filename); num2 = File.GetCreationTime(path).ToUnixTimestamp(); flag2 = (num > num2); flag = (num < num2); } if (flag2) { Debug.Log(string.Concat(new object[] { "Syncing ", mode, "/", slot, "/", name, " from cloud(", num, ") to local(", num2, ")" })); if (!Directory.Exists(localSlotPath)) { Directory.CreateDirectory(localSlotPath); } File.WriteAllBytes(path, CoopSteamCloud.CloudLoad(filename)); File.SetCreationTime(path, DateEx.UnixTimeStampToDateTime(num)); Debug.Log(string.Concat(new object[] { "Local file (", name, ") Creation Time: ", File.GetCreationTime(path).ToUnixTimestamp(), " - ", num, " = ", File.GetCreationTime(path).ToUnixTimestamp() - num, "?" })); } else if (flag) { byte[] buffer = File.ReadAllBytes(path); bool flag3 = CoopSteamCloud.CloudSave(filename, buffer); Debug.Log(string.Concat(new object[] { "Cloud file (", name, ") Creation time: ", CoopSteamCloud.CloudTimestamp(filename), " - ", File.GetCreationTime(path).ToUnixTimestamp(), " = ", CoopSteamCloud.CloudTimestamp(filename) - File.GetCreationTime(path).ToUnixTimestamp(), "?" })); } }
public static string GetCloudSlotPath(TitleScreen.GameSetup.PlayerModes mode, TitleScreen.GameSetup.Slots slot) { return(string.Concat(new object[] { mode, "_", slot, "_" })); }
public static string GetCloudSlotPath(TitleScreen.GameSetup.Slots slot) { return(SaveSlotUtils.GetCloudSlotPath(TitleScreen.StartGameSetup.Mode, slot)); }
public static string GetLocalSlotPath(TitleScreen.GameSetup.PlayerModes mode, TitleScreen.GameSetup.Slots slot) { return(string.Concat(new object[] { SaveSlotUtils.GetUserPath(), mode, "/", slot, "/" })); }
public void OnSlotSelection(TitleScreen.GameSetup.Slots slotNum) { TitleScreen.StartGameSetup.Type = TitleScreen.GameSetup.InitTypes.Continue; TitleScreen.StartGameSetup.Slot = slotNum; SaveSlotSelectionScreen.OnSlotSelected.Invoke(); }