提高扫描速度的最佳方法是什么? [英] What is the best method for increasing scan speeds?

查看:261
本文介绍了提高扫描速度的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我去过几十个网站,尝试确定在程序中使用哪种最快的方法来递归地提高文件扫描速度,搜索所有目录和子目录.我已经研究过使用Windows API来使用进程(查找第一个文件),(下一个文件),(关闭文件),甚至尝试研究那些方法的EX方法,但它会根据您只寻找的文件类型返回结果.我想为什么不给它一个带有逻辑驱动器的组合框,以便我可以选择C:\或D:\ ect并开始扫描,但是我需要在VB.Net中有一个适当的示例,并且似乎只能在VBS 6中找到大部分示例.

除非有更快的方法,否则我将快速了解如何使用此方法:

1.具有逻辑驱动器的组合框:)(完成)
2.显示所选项目的文本框或标签:)(完成)
3.开始按钮以执行递归扫描:((未完成)
4.标签或文本框以显示正在扫描的当前文件:((未完成)


我在正确的轨道上吗?
我还找到了一个网站 http://stackoverflow.com/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 http://stackoverflow.com/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.GetFilesSystem.IO.DirectoryInfo.GetFiles,请参见 http: //msdn.microsoft.com/en-us/library/system.io.directory.aspx [ http://msdn.microsoft.com/en-us/library/system.io.directoryinfo.aspx [ Directory.Get.Files搜索模式问题 [ ^ ].

现在,我想给您一个原则上不同的想法,它可能适合您的目标,也可能不适合您的目标.您可以进行慢速扫描,但是在添加或修改任何文件时拦截文件系统事件,并且仅扫描文件的修改部分.为此,您可以使用System.IO.FileSystemWatcher,请参见 http://msdn.microsoft. com/en-us/library/system.io.filesystemwatcher.aspx [ ^ ].

—SA
By some strange reason, you''re mixing up different things: file system operation and UI. This is counter-productive and makes very little sense. Ever heard of separation of concerns? Actually, you don''t even consider the most important question: how to scan; you only compare different presentations; also those which do not correctly compare.

After all, with .NET you only have System.IO.Directory.GetFiles or System.IO.DirectoryInfo.GetFiles, see http://msdn.microsoft.com/en-us/library/system.io.directory.aspx[^], http://msdn.microsoft.com/en-us/library/system.io.directoryinfo.aspx[^].

Also, you should know one fallacy of the API and the solution. Please look at this discussion: Directory.Get.Files search pattern problem[^].

Now, I would like to give you a principally different idea which may or may not be suitable for your goals. You can go with slow scanning but intercept file system events when any file is added or modified and only scan the modified part of the files. For this purpose, you can use System.IO.FileSystemWatcher, see http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx[^].

—SA


这篇关于提高扫描速度的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆