Hitung berapa banyak baris kode JS dan kode ASP di folder saat ini, dan juga dapat menghitung berapa banyak byte kode tersebut
Ada kode sampel
Salinan kode adalah sebagai berikut:
<%
'///////////////////////////////////////////////////////////
'//
'// dari codeproject.com
'// Hitung JS dan kode ASP
'// Modifikasi bluedestiny
'//mail:bluedestinyat126.com
'//
'///////////////////////////////////////////////////////////
OptionExplicit
response.buffer = false
classcount_code
Privatefso, Spath
PrivateAsplines, jslines, aspbytes, jsbytes, aspwords
privatesubclass_initialize
setFSO = createObject ("Scripting.FilesystemObject")
endsub
privatesubclass_terminate
setfso = tidak ada
endsub
PrivateFunctionIterate (Path)
dimfolder, folder, file, file, ts, txt, arr, f
setFolder = fso.getFolder (path)
setFiles = folder.files
Dimrx, c
setRx = newregexp
rx.ignorecase = true
rx.global = true
rx.pattern = "+"
foreachfileInfiles
ifright (file.name, 4) = ". asp" orright (file.name, 3) = ". js" lalu
setts = file.openastextStream
ifts.atendOfStreamThentXt = "" elsetxt = ts.readall
ts.close
txt = rx.replace (txt, "")
txt = ganti (txt, vbcrlf & vbcrlf, vbcrlf)
arr = split (ganti (txt, vbcrlf, ""), "")
aspwords = aspwords+ubund (arr)
ARR = split (txt, vbcrlf)
ifright (file.name, 4) = ". Asp" lalu
asplines = asplines+ubund (arr)
aspbytes = aspbytes+len (txt)
kalau tidak
jslines = jslines+ubund (arr)
jsbytes = jsbytes+len (txt)
endif
endif
Berikutnya
setFolders = folder.subfolders
foreachfinFolders
iterate.path
Berikutnya
fungsi endfungsi
publicpropertyletpath (s)