<%
onerrorresumenext
dimr
setr = newrar
R.Addserver.Mappath( "A.Gif")
r.addserver.mappath( "a.txt")
r.addserver.mappath( "テスト")
r.addserver.mappath( "file.asp")
r.packname = server.mappath( "xxx.dat")
R.Pack
r.rootpath = server.mappath( "xxx")
r.packname = server.mappath( "xxx.dat")
R.Unpack
respons.write(err.description)
setr =何もない
%>
<scriptlanguage = "vbscript" runat = "server">
'-------------------------------------------------------------------
'説明:ASPパッケージングクラス
著者:Xiaohui([email protected])
'リンク:http://asp2004.nethttp://blog.csdn.net/iuhxqhttp://bbs.asp.asp.net
'バージョン:1.0beta
'著作権:この作業は自由に使用できますが、著作権情報を削除しないでください
'-------------------------------------------------------------------
Classrar
dimfiles、packname、s、s1、s2、rootpath、fso、f、buf
privatesubclass_initialize
ランダム化
dimrannum
rannum = int(90000*rnd)+10000
packname = year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&rannum& "。ASP2004"
rootpath = server.mappath( "./")
setFiles = server.createObject( "Scripting.Dictionary")
setFSO = server.createObject( "Scripting.filesystemObject")
sets = server.createObject( "adodb.stream"):s.open:s.type = 1
sets1 = server.createobject( "adodb.stream"):s1.open:s1.type=1
sets2 = server.createObject( "adodb.stream"):s2.open:s2.type=2
Endingub
privatesubclass_terminate
S.Close:sets = Nothing
s1.close:sets1 = Nothing
s2.close:sets2 = Nothing
setfso =何もない
Endingub
publicsubadd(obj)
ifffso.fileexists(obj)then
setf = fso.getfile(obj)
files.addobj、f.size
else folderexists(obj)その後
files.addobj、-1
setf = fso.getfolder(obj)
setfc = f.files
foreachf1infc
追加(lcase(f1.path))
次
endif
Endingub
publicsubpack
Dimstr
a = files.keys
b = files.items
fori = 0tofiles.count-1
ifb(i)> = 0then
S.LoadFromFile(A(i))
buf = s.read
ifnotisnull(buf)thens1.write(buf)
endif