实现 XML 的自动保存功能
为了给我的应用程序提供自动保存功能,我正在寻找可以优化以下 3 个要求的最佳实现:
- 安全性:为了降低数据损坏的风险
- 用户友好:用户不是计算机专家,因此解决方案必须直观、友好、
- 快速开发:我不想在这个实现上花费数周时间,
我从来没有三个解决方案不符合这 3 个标准,我正在寻找替代方案:
- 创建一个简单的影子文件,以便当应用程序崩溃或电脑意外关闭应用程序尝试恢复它的
- 工作方式与上面相同,但在不同时间将文件的多个版本存储在临时文件夹中
- 实现真正的回滚系统,允许扩展撤消/重做功能,即使应用程序重新启动,也可以通过在文件中跟踪修改来重新启动。临时文件夹。
有人有什么建议吗?
In order to give my application an autosave functionality, I'm looking at the best implementation that would optimise the 3 followings requirements:
- safety: in order to reduce the risk of data corruption
- user friendly: the user is not computer expert so the solution must be intuitive and friendly
- quick to develop: I don't want to spend weeks over this implementation never
I have three solutions witch doesn't fit the 3 criteria and I'm looking for an alternative:
- creating a simple shadow file so when the application crashes or the PC shutdown unexpectedly the application try to restore it
- working the same way than above but storing several version of the file at different time in a temp folder
- implement a true roll back system allowing the extend the undo/redo functionnality even the the application is restarted by keeping trace of the modification in a temp folder.
Does someone have anything to suggest?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于自动保存,我只需有一个后台运行线程,它将静默(无弹出窗口)运行您的 Save() 方法到临时位置(AppData 系统文件夹)。您可能应该为每个会话保留一个单独的文件,以便您始终可以返回到先前崩溃的会话。正常退出时,您应该删除该文件以指示会话已成功完成。
我什至会为每个会话保留 2 个文件,每个文件都有一个备用保存,这样如果在自动保存期间发生崩溃,它就不会损坏之前的自动保存。
For autosave, I'd simply have a background running thread that would run your Save() method silently (no popups) to a temp location (AppData system folder). You should probably keep a separate file for each session, so that you can always offer to return to a previous crashed session. On normal exit, you should delete the file to indicate the session has completed successfully.
I'd even keep 2 files for every session an alternate saving to each, so that if a crash happens during an autosave, it won't corrupt the previous autosave.