提高扫描速度的最佳方法是什么?

编程入门 行业动态 更新时间:2024-10-12 01:32:47
本文介绍了提高扫描速度的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我去过几十个网站,尝试确定在程序中使用哪种最快的方法来递归地提高文件扫描速度,搜索所有目录和子目录.我已经研究过使用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 [ ^ ].
—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 msdn.microsoft/en-us/library/system.io.directory.aspx[^], msdn.microsoft/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 msdn.microsoft/en-us/library/system.io.filesystemwatcher.aspx[^].
—SA

更多推荐

提高扫描速度的最佳方法是什么?

本文发布于:2023-10-26 17:35:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1530856.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:速度   方法

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!