private void PeriodicBackupTimerOnTick(object sender, EventArgs e) { try { // Get the newest beatmap, save a temp version, get the hash and compare it to the previous hash, backup temp file var path = IOHelper.GetCurrentBeatmap(); if (string.IsNullOrEmpty(path)) { return; } // Don't make period backup if the editor is not open if (!EditorReaderStuff.IsEditorOpen()) { return; } EditorReader reader = null; try { reader = EditorReaderStuff.GetFullEditorReader(); } catch (Exception ex) { Console.WriteLine(ex.MessageStackTrace()); } var editor = EditorReaderStuff.GetNewestVersionOrNot(path, reader); // Save temp version var tempPath = Path.Combine(MainWindow.AppDataPath, "temp.osu"); Editor.SaveFile(tempPath, editor.Beatmap.GetLines()); // Get MD5 from temp file var currentMapHash = EditorReaderStuff.GetMD5FromPath(tempPath); // Comparing with previously made periodic backup if (currentMapHash == previousPeriodicBackupHash) { return; } // Saving backup of the map BackupManager.SaveMapBackup(tempPath, true, Path.GetFileName(path), "PB"); // PB stands for Periodic Backup previousPeriodicBackupHash = currentMapHash; } catch (Exception ex) { Console.WriteLine(ex.Message); } }