#region "檔案資訊類"
public filelist as
new list(
of filevalue)
'檔案資訊列表
public
class filevalue '檔案資訊
private _filepath as
string
'檔案路徑
private _filemd5 as
string
'檔案md5
private _filesize as
string
'檔案大小
private _filesteam as io.filestream '檔案快取流
public
readonly
property filename as
string
getreturn io.path.getfilename(filepath)
'filepath.substring(filepath.lastindexof("\") + 1) '檔名
endget
endproperty
public
property filepath as
string
getreturn _filepath
endgetset
(value as
string
) _filepath = value
endsetend
property
public
property filemd5 as
string
getreturn _filemd5
endgetset
(value as
string
) _filemd5 = value
endsetend
property
public
property filesize as
string
getreturn _filesize
endgetset
(value as
string
) _filesize = value
endsetend
property
public
property filesteam as io.filestream
getreturn _filesteam
endgetset
(value as io.filestream)
_filesteam = value
endsetend
property
endclass
#end region
dim ofd as
new openfiledialog
ofd.multiselect =
true
dim filevalue as
new filevalue
if ofd.showdialog(
)= windows.forms.dialogresult.ok then
for each filename in ofd.filenames
filevalue.filesteam =
system.io.file.openread(filename)
filevalue.filepath = filename
dim md5 as security.cryptography.md5 = security.cryptography.md5.create(
)dim sbuffer as
newsystem.text.stringbuilder
for each b in md5.computehash(filevalue.filesteam)
lcase
(b.tostring(
"x2"))
)next
filevalue.filemd5 = sbuffer.tostring
filevalue.filesteam.position =
0 filevalue.filesize = filevalue.filesteam.length
filelist.add(filevalue)
next
endif
public
class filevalue '檔案資訊
'修改路徑屬性賦值set
public
property filepath as
string
getreturn _filepath
endgetset
(value as
string
) _filepath = value
autosetvalue(value)
endset
endproperty
'新增方法
private
function autosetvalue(filepath)
if fileio.filesystem.fileexists(filepath)
then
_filesteam =
system.io.file.openread(_filepath)
dim md5 as
system.security.cryptography.md5 =
system.security.cryptography.md5.create(
)dim sbuffer as
newsystem.text.stringbuilder
for each b in md5.computehash(_filesteam)
lcase
(b.tostring(
"x2"))
)next
_filesteam.position =
0 _filemd5 = sbuffer.tostring(
) _filesize = filesteam.length()
return
true
endif
return
new exception(filepath + "所在路徑的檔案不存在")
endfunction
endclass
dim ofd as
new openfiledialog
ofd.multiselect =
true
dim filevalue as
new filevalue
if ofd.showdialog(
)= windows.forms.dialogresult.ok then
for each filename in ofd.filenames
filevalue.filepath = filename
filelist.add(filevalue)
next
endif
VB寫乙個IE外掛程式
用vb編寫ie外掛程式 實現方法如下 首先需要獲得iobjectwithsite介面的定義,你下載個olelib.tlb,包含了介面定義。然後建立乙個 activex dll工程,在工程中引用這個tlb檔案,並且引用microsoft html object library mshtml.dll 和...
乙個VB陣列指標類
顧名思義了,這個 就是將指定的記憶體位址繫結到乙個vb陣列,即com中的safearray上。所謂繫結,是指在使用該記憶體位址之前,並不需要申請相應的本地記憶體緩衝區,也不需要進行記憶體複製,只是根據該位址憑空構造乙個vb陣列,並將陣列的真實資料位址指向該位址。當然,該類的功能完全可以用copyme...
C語言寫乙個類
ifndef 50 2 h define 50 2 h typedef void demo demo demo create int i,int j int demo geti demo pthis int demo getj demo pthis int demo add demo pthis,i...