public void Save() { Saving = true; Directory.CreateDirectory(storagePath); string savePath = Path.Combine(storagePath, DateTime.Today.ToString("yyyyMMdd") + ".json"); string tempPath = Path.Combine(storagePath, DateTime.Today.ToString("yyyyMMdd") + "temp.json"); string content = MyDataHelper.CoverObjectToJson(AllDays[DateTime.Today]); MyDataHelper.WriteFile(tempPath, content); MyDataHelper.RenameFile(tempPath, savePath); Saving = false; }