如何扫描文本文件? [英] How to scan with text files?

查看:87
本文介绍了如何扫描文本文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Function RepeatFiles(ByVal dirs As DirectoryInfo)        
  Dim fileListing() As FileInfo = dirs.GetFiles()       
  If fileListing.Length > 0 Then
    For Each fl As FileInfo In fileListing               
      If searchButton.Enabled = False Then
       currentPath.Text = fl.FullName                    
       Application.DoEvents()                
      End If
    Next
  End If
End Function


这段代码是作为扫描仪的一部分提供给我的,但是它似乎只能扫描计算机中的文件,而不会检查文本文件(my.resources.viruslist)中的名称.我建议将文本文件保存在计算机中. if块并将其放置在CurrentPath.text = fl.FullName之后,但需要一个示例来说明如何编写代码以及将代码确切放置在何处.....

有人可以写这段代码来显示在哪里以及如何添加
(my.resources.viruslist)做以上?

预先谢谢您
注意:任何好的回答都会得到5分(满分5分)......


This code was supplied to me as part of my scanner but it only seems to scan through the files in my computer and does not check against the names in the text file (my.resources.viruslist) I have been advised to keep my text file in the If block and to place it after the CurrentPath.text = fl.FullName but need an example of how to write the code and exactly where to place the code.....

Can someone write this section of the code to show where and how to add
(my.resources.viruslist) to do the above?

Thank you in advance
Note: any good response will get a 5 out of 5 score......

推荐答案

"它似乎只扫描了我的文件计算机,并且不检查文本文件中的名称(my.resources.viruslist )"

没有理由这样做.它只是通过dirs参数传递到函数中的目录中文件列表的循环.您绝对不会打开,读取或遍历my.resources.viruslist(无论是嵌入式资源,数组,List< T> ??)是什么.


"有人可以编写这段代码来显示在哪里以及如何添加
(my.resources.viruslist)做上面的事情?
"
是的-有人应该是你.这要么是您的家庭作业项目,要么是您为此而获得报酬.另外,我们不知道应用程序的用途或设计方式,因此我们不能为您做出这类设计决策.打开文本文件并从中读取信息很简单.有多种方法可以执行此操作,例如对象序列化,CSV文件,同样,我们知道哪种方法最好.如果您正在编写专业的防病毒软件,则不应使用这些方法,因为病毒程序可以很高兴地更改您的定义文件,因此永远不会对其进行搜索.
"it only seems to scan through the files in my computer and does not check against the names in the text file (my.resources.viruslist)"

There is no reason why it should. It just gets loops through the list of files in the directory passed into the function through the dirs parameter. At no point to you open, read from or loop across my.resources.viruslist (whatever that is, embedded resource, array, List<T>??)


"Can someone write this section of the code to show where and how to add
(my.resources.viruslist) to do the above?
"
Yes - and that someone should be you. It is either your homework project, or you are getting paid to do this. Additonally we don''t know what the application is for, or how it is designed, so we can''t make these sort of design decisions for you. It is a simple matter of opening the text file and reading the information from it. There are various ways to do this, object serialization, CSV file, again we can''t know which is best. If you are writing a professional antivirus software none of these methods should be used as a virus program can happily alter your definition file so it is never searched.


这篇关于如何扫描文本文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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