احسب عدد خطوط رمز JS ورمز ASP في المجلد الحالي ، ويمكن أيضًا حساب عدد البايتات الرمز
هناك نموذج رمز
نسخة الكود كما يلي:
<٪
'///////////////////////////////////////////////////////////////////////////2
'//
'// من codeproject.com
'// حساب رمز JS و ASP
'// تعديل bluedestiny
'//mail:bluedestinyat126.com
'//
'///////////////////////////////////////////////////////////////////////////2
OptionExplicit
استجابة. buffer = خطأ
classcount_code
Privatefso ، Spath
privateasplines ، jslines ، aspbytes ، jsbytes ، aspwords
privatesubclass_initialize
setfso = createObject ("scripting.filesystemObject")
ينتهي
privatesubclass_terminate
setfso = لا شيء
ينتهي
PrivateFunctionaterate (المسار)
dimfolder ، المجلدات ، الملفات ، الملف ، ts ، txt ، arr ، f
setfolder = fso.getfolder (المسار)
setFiles = folder.files
Dimrx ، ج
setRx = NewRegexp
rx.ignorecase = صحيح
rx.global = صحيح
rx.pattern = "+"
foreachfileinfiles
ifright (file.name ، 4) = ". asp" orright (file.name ، 3) = ". JS" ثم
setTs = file.openastextstream
ifts.atendofstreamthentxt = "" elsetxt = ts.readall
Ts.close
txt = rx.replace (txt ، "")
txt = استبدال (txt ، vbcrlf & vbcrlf ، vbcrlf)
arr = split (استبدال (txt ، vbcrlf ، "") ، "")
aspwords = aspwords+ubund (arr)
arr = انقسام (txt ، vbcrlf)
ifright (file.name ، 4) = ". asp" ثم
asplines = asplines+ubund (ARR)
aspbytes = aspbytes+len (txt)
آخر
JSlines = JSlines+Ubund (ARR)
jsbytes = jsbytes+len (txt)
Endif
Endif
التالي
setfolders = folder.subfolders
foreachfinfolders
ITERYF.PATH
التالي
الوظيفية
publicpropertyletpath (s)