public static void Postfix(MainMenu __instance) { string currentSave = __instance.Button_ResumeGame.GetComponentsInChildren <LocText>()[1].text; const int not_Auto_Save = -1; if (!string.IsNullOrEmpty(currentSave)) { string latestSaveFile = SaveLoader.GetLatestSaveFile(); string auto_save_path = Path.GetDirectoryName(SaveLoader.GetAutosaveFilePath()); if (latestSaveFile.IndexOf(auto_save_path) == not_Auto_Save && latestSaveFile.IndexOf("auto_save") == not_Auto_Save) { //Debug.Log("================== MANUAL SAVE DETECTED =================== \n" + latestSaveFile); __instance.Button_ResumeGame.GetComponentsInChildren <LocText>()[1].text = "Manual Save - " + currentSave; } else { __instance.Button_ResumeGame.GetComponentsInChildren <LocText>()[1].text = "Auto Save - " + currentSave; //Debug.Log("================== AUTO SAVE DETECTED =================== \n" + latestSaveFile); }; } }
private void DoAutoSave(int day) { if (!GenericGameSettings.instance.disableAutosave) { day++; newDayMetric[NewCycleKey] = day; ThreadedHttps <KleiMetrics> .Instance.SendEvent(newDayMetric); string text = SaveLoader.GetActiveSaveFilePath(); if (text == null) { text = SaveLoader.GetAutosaveFilePath(); } int num = text.LastIndexOf("\\"); if (num > 0) { int num2 = text.IndexOf(" Cycle ", num); if (num2 > 0) { text = text.Substring(0, num2); } } text = text.Replace(".sav", string.Empty); text = text + " Cycle " + day.ToString(); text = SaveScreen.GetValidSaveFilename(text); string autoSavePrefix = SaveLoader.GetAutoSavePrefix(); text = Path.Combine(autoSavePrefix, Path.GetFileName(text)); string text2 = text; int num3 = 1; while (File.Exists(text)) { text = text2.Replace(".sav", string.Empty); text = SaveScreen.GetValidSaveFilename(text2 + " (" + num3 + ")"); num3++; } Game.Instance.StartDelayedSave(text, true, false); } }