我去过几十个网站,尝试确定在程序中使用哪种最快的方法来递归地提高文件扫描速度,搜索所有目录和子目录.我已经研究过使用Windows API来使用进程(查找第一个文件),(下一个文件),(关闭文件),甚至尝试研究那些方法的EX方法,但它会根据您只寻找的文件类型返回结果.我想为什么不给它一个带有逻辑驱动器的组合框,以便我可以选择C:\或D:\ ect并开始扫描,但是我需要在VB.Net中有一个适当的示例,并且似乎只能在VBS 6中找到大部分示例. 除非有更快的方法,否则我将快速了解如何使用此方法: 1.具有逻辑驱动器的组合框:)(完成) 2.显示所选项目的文本框或标签:)(完成) 3.开始按钮以执行递归扫描:((未完成) 4.标签或文本框以显示正在扫描的当前文件:((未完成) 我在正确的轨道上吗? 我还找到了一个网站 stackoverflow/questions/5304657/antivirus-scan-speed-优化 [ ^ ] 我当前的扫描程序使用病毒签名来查找所需的内容,因此我不确定该网站中的代码如何工作.任何对此的建议也将不胜感激. 谢谢...
I have been to several dozen websites to try and determine what is the fastest method to use in my program to increase file scanning speeds recursively, searching all directories and sub-directories. I have looked into using windows API to use the process (Find First File), (Next File), (Close File) and even tried researching the EX methods of those methods but it returns results based upon the file type your looking for only. I thought why not give it a combobox with logical drives so that I can select C:\ or D:\ ect and begin the scan but I need a proper example in VB.Net and can only seem to find examples mostly in VBS 6. Quick run down of how I would like to use this method unless there is a faster way: 1. Combobox with logical drives :) (Done) 2. Textbox or label to display selecteditem :) (Done) 3. start button to execute the recursive scan :( (Not Done) 4. label or textbox to show the current file being scanned :( (Not Done) Am i on the right track? I have also found a website stackoverflow/questions/5304657/antivirus-scan-speed-optimization[^] My current scanner uses virus signatures to find what it needs so I am unsure how this code in the website works. Any advice about this also would be very much appreciated. thank you...
推荐答案由于某些奇怪的原因,您正在混淆不同的东西:文件系统操作和UI.这适得其反,几乎没有道理.有没有听说过分离关注点?实际上,您甚至没有考虑最重要的问题:如何进行扫描;如何进行扫描?您只能比较不同的演示文稿;还有那些不能正确比较的. 毕竟,对于.NET,您只有System.IO.Directory.GetFiles或System.IO.DirectoryInfo.GetFiles,请参见 http: //msdn.microsoft/en-us/library/system.io.directory.aspx [ ^ ], msdn.microsoft/en-us/library/system.io.directoryinfo.aspx [ ^ ]. 另外,您应该知道API和解决方案的一个谬误.请查看以下讨论: Directory.Get.Files搜索模式问题 [ ^ ]. 现在,我想给您一个原则上不同的想法,它可能适合您的目标,也可能不适合您的目标.您可以进行慢速扫描,但是在添加或修改任何文件时拦截文件系统事件,并且仅扫描文件的修改部分.为此,您可以使用System.IO.FileSystemWatcher,请参见 msdn.microsoft. com/en-us/library/system.io.filesystemwatcher.aspx [ ^ ].
更多推荐
提高扫描速度的最佳方法是什么?
发布评论