VB.Net:如何显示文件的先前卷影副本版本以允许用户选择一个
我正在使用 VB.Net 编写一个 Excel 文件恢复程序,试图成为一个方便的地方来收集和访问 Microsoft 推荐的方法。如果您对我可能笨拙、充满错误且缺乏足够的清理代码感兴趣,请访问:http://pastebin.com/v4GgDteY< /a>.尽管我还没有测试图形宏表恢复,但基本功能似乎可以工作。
我突然想到,如果卷影复制服务已打开并且存在以前的副本,Vista 和 Windows 7 用户可以受益于在我的应用程序中提供该文件以前版本的列表。我该怎么做?
我浏览了很多网页,但没有找到容易抄袭的代码。我猜想的一种可能性是通过 shell 使用 vssadmin,但这非常麻烦。我只想显示一个类似于“以前版本”属性表的对话框,并允许用户选择以前的版本之一。我想我可以通过以编程方式调用上下文菜单和“恢复以前的版本选项”来通过外壳显示以前版本的属性表,但是我也希望能够为不这样做的 Vista Home Basic 和 Premium 用户提供列表尽管显然以前的版本仍然存在,但无法访问该选项卡。另外,如果可能的话,我想为 XP 用户提供相同的功能,尽管我很确定 XP 只有系统文件位于卷影副本中。
我查看了有关卷影复制服务的 MSDN 并浏览了所有页面,还查看了 AlphaVSS 和 AlphaFS 以及所有评论。我猜测我需要使用 AlphaVss 和 AlphFS 并执行以下操作?
- 找出计算机上存在的快照/还原点列表。
- 安装这些快照。
- 在已安装的卷中导航到用户想要恢复的 Excel 文件并列出这些路径。
- 有了方便的路径列表,就可以与某种 diff 程序进行比较,将文件的卷影副本与原始文件进行比较。
- 取出那些与恢复目标不同的卷影副本的最新或最旧版本(我认为这并不重要)。
- 列出发现不同的文件的版本。
这看起来既麻烦又缓慢,但也许是最快的方法。我只需要一些确认,这就是现在要走的路。
I'm writing an Excel file recovery program with VB.Net that tries to be a convenient place to gather and access Microsoft's recommended methods. If your interested in my probably kludgy, error filled, and lacking enough cleanup code it's here: http://pastebin.com/v4GgDteY. The basic functionality seems to work although I haven't tested graph macro table recovery yet.
It occurred to me that Vista and Windows 7 users could benefit from being offered a list of previous versions of the file within my application if the Shadow Copy Service is on and there are previous copies. How do I do this?
I looked at a lot of web pages but found no easy to crib code. One possibility I guess would be to use vssadmin via the shell but that is pretty cumbersome. I just want to display a dialogue box like the Previous Versions property sheet and allow users to pick one of the previous versions. I guess I could just display the previous version property sheet via the shell by programmatically invoking the context menu and the "Restore previous versions choice", however I also want to be able to offer the list for Vista Home Basic and Premium Users who don't have access to that tab even though apparently the previous versions still exist. Additionally if it possible I would like to offer XP users the same functionality although I'm pretty sure with XP only the System files are in the shadow copies.
I looked at MSDN on the Shadow Copy Service and went through all the pages, I also looked at AlphaVSS and AlphaFS and all the comments. I'm kind of guessing that I need to use AlphaVss and AlphFS and do the following?
- Find out the list of snapshots/restore points that exist on the computer.
- Mount those snapshots.
- Navigate in the mounted volumes to the Excel file the user wants to recover and make a list of those paths.
- With the list of paths handy, compare with some kind of diff program, the shadow copies of the files with the original.
- Pull out the youngest or oldest version (I don't think it matters) of those shadow copies that differ from the recovery target.
- List those versions of the files that are found to be different.
This seems cumbersome and slow, but maybe is the fastest way to do things. I just need some confirmation that is the way to go now.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最终决定继续开始编码。请提出有关加快代码速度或如何处理发现与恢复文件目标不同的文件的建议。有没有更简单的方法来使用 AlphaVSS 和 AlphaFS 来做到这一点?
I finally decided to go ahead and start coding. Please make suggestions for speeding up the code or what do with files that are found to be different from the recovery file target. Is there a simpler way to do this with AlphaVSS and AlphaFS?