无为清净楼资源网 Design By www.qnjia.com
<%
On Error Resume Next
Dim r
Set r = New Rar
r.Add Server.MapPath("a.gIf")
r.Add Server.MapPath("a.txt")
r.Add Server.MapPath("test")
r.Add Server.MapPath("file.asp")
r.packname = Server.MapPath("xxx.dat")
r.Pack
r.rootpath = Server.MapPath("xxx")
r.packname = Server.MapPath("xxx.dat")
r.UnPack
Response.Write(Err.Description)
Set r = Nothing
%>
<script Language="Vbscript" Runat="server">
'-----------------------------------------------------
' 描述: Asp打包类
' 作者: 小灰(quxiaohui_0@163.com)
' 链接: http://asp2004.net http://blog.csdn.net/iuhxq http://bbs.asp2004.net
' 版本: 1.0 Beta
' 版权: 本作品可免费使用,但是请勿移除版权信息
'-----------------------------------------------------
Class Rar
Dim files,packname,s,s1,s2,rootpath,fso,f,buf
Private Sub Class_Initialize
Randomize
Dim ranNum
ranNum = Int(90000 * Rnd) + 10000
packname = Year(Now)&Month(Now)&Day(Now)&Hour(Now)&Minute(Now)&Second(Now)&ranNum&".asp2004"
rootpath = Server.MapPath("./")
Set files = server.CreateObject("Scripting.Dictionary")
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set s = server.CreateObject("ADODB.Stream"):s.Open:s.Type = 1
Set s1 = server.CreateObject("ADODB.Stream"):s1.Open:s1.Type = 1
Set s2 = server.CreateObject("ADODB.Stream"):s2.Open:s2.Type = 2
End Sub
Private Sub Class_Terminate
s.Close:Set s = Nothing
s1.Close:Set s1 = Nothing
s2.Close:Set s2 = Nothing
Set fso = Nothing
End Sub
Public Sub Add(obj)
If fso.FileExists(obj) Then
Set f = fso.GetFile(obj)
files.Add obj,f.Size
ElseIf fso.FolderExists(obj) Then
files.Add obj,-1
Set f = fso.GetFolder(obj)
Set fc = f.Files
For Each f1 in fc
Add(LCase(f1.Path))
Next
End If
End Sub
Public Sub Pack
Dim str
a = files.Keys
b = files.Items
for i=0 to files.count-1
If b(i)>=0 Then
s.LoadFromFile(a(i))
buf = s.Read
If Not IsNull(buf) Then s1.Write(buf)
End If
str = str & b(i)&">"&Replace(a(i),rootpath,"")&vbCrLf
next
str = CStr(Right("000000000"&len(str),10)) & str
buf = TextToStream(str)
s.Position = 0
s.Write buf
s1.Position = 0
s.Write s1.Read
s.SetEOS
s.SaveToFile(packname)
End Sub
Public Sub UnPack
If Not fso.FolderExists(rootpath) Then
fso.CreateFolder(rootpath)
End If
Dim size
'转换文件大小
s.LoadFromFile(packname)
size = CInt(StreamToText(s.Read(10)))
str = StreamToText(s.Read(size))
arr = Split(str,vbCrLf)
for i=0 to Ubound(arr)-1
arrFile = Split(arr(i),">")
If arrFile(0) < 0 Then
If Not fso.FolderExists(rootpath&arrFile(1)) Then
fso.CreateFolder(rootpath&arrFile(1))
End If
ElseIf arrFile(0) >= 0 Then
If fso.FileExists(rootpath&arrFile(1)) Then
fso.DeleteFile(rootpath&arrFile(1))
End If
s1.Position = 0
buf = s.Read(arrFile(0))
If Not IsNull(buf) Then s1.Write(buf)
s1.SetEOS
s1.SaveToFile(rootpath&arrFile(1))
End If
Next
End Sub
Public Function StreamToText(stream)
If IsNull(stream) Then
StreamToText = ""
Else
Set sm = server.CreateObject("ADODB.Stream"):sm.Open:sm.Type = 1
sm.Write(stream)
sm.Position = 0
sm.Type = 2
sm.charset = "gb2312"
sm.Position = 0
StreamToText = sm.ReadText()
sm.Close:Set sm = Nothing
End If
End Function
Public Function TextToStream(text)
If text="" Then
TextToStream = "" '这里该如何写?空流?
Else
Set sm = server.CreateObject("ADODB.Stream"):sm.Open:sm.Type = 2:sm.charset = "gb2312"
sm.WriteText(text)
sm.Position = 0
sm.Type = 1
sm.Position = 0
TextToStream = sm.Read
sm.Close:Set sm = Nothing
End If
End Function
End Class
</script>
On Error Resume Next
Dim r
Set r = New Rar
r.Add Server.MapPath("a.gIf")
r.Add Server.MapPath("a.txt")
r.Add Server.MapPath("test")
r.Add Server.MapPath("file.asp")
r.packname = Server.MapPath("xxx.dat")
r.Pack
r.rootpath = Server.MapPath("xxx")
r.packname = Server.MapPath("xxx.dat")
r.UnPack
Response.Write(Err.Description)
Set r = Nothing
%>
<script Language="Vbscript" Runat="server">
'-----------------------------------------------------
' 描述: Asp打包类
' 作者: 小灰(quxiaohui_0@163.com)
' 链接: http://asp2004.net http://blog.csdn.net/iuhxq http://bbs.asp2004.net
' 版本: 1.0 Beta
' 版权: 本作品可免费使用,但是请勿移除版权信息
'-----------------------------------------------------
Class Rar
Dim files,packname,s,s1,s2,rootpath,fso,f,buf
Private Sub Class_Initialize
Randomize
Dim ranNum
ranNum = Int(90000 * Rnd) + 10000
packname = Year(Now)&Month(Now)&Day(Now)&Hour(Now)&Minute(Now)&Second(Now)&ranNum&".asp2004"
rootpath = Server.MapPath("./")
Set files = server.CreateObject("Scripting.Dictionary")
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set s = server.CreateObject("ADODB.Stream"):s.Open:s.Type = 1
Set s1 = server.CreateObject("ADODB.Stream"):s1.Open:s1.Type = 1
Set s2 = server.CreateObject("ADODB.Stream"):s2.Open:s2.Type = 2
End Sub
Private Sub Class_Terminate
s.Close:Set s = Nothing
s1.Close:Set s1 = Nothing
s2.Close:Set s2 = Nothing
Set fso = Nothing
End Sub
Public Sub Add(obj)
If fso.FileExists(obj) Then
Set f = fso.GetFile(obj)
files.Add obj,f.Size
ElseIf fso.FolderExists(obj) Then
files.Add obj,-1
Set f = fso.GetFolder(obj)
Set fc = f.Files
For Each f1 in fc
Add(LCase(f1.Path))
Next
End If
End Sub
Public Sub Pack
Dim str
a = files.Keys
b = files.Items
for i=0 to files.count-1
If b(i)>=0 Then
s.LoadFromFile(a(i))
buf = s.Read
If Not IsNull(buf) Then s1.Write(buf)
End If
str = str & b(i)&">"&Replace(a(i),rootpath,"")&vbCrLf
next
str = CStr(Right("000000000"&len(str),10)) & str
buf = TextToStream(str)
s.Position = 0
s.Write buf
s1.Position = 0
s.Write s1.Read
s.SetEOS
s.SaveToFile(packname)
End Sub
Public Sub UnPack
If Not fso.FolderExists(rootpath) Then
fso.CreateFolder(rootpath)
End If
Dim size
'转换文件大小
s.LoadFromFile(packname)
size = CInt(StreamToText(s.Read(10)))
str = StreamToText(s.Read(size))
arr = Split(str,vbCrLf)
for i=0 to Ubound(arr)-1
arrFile = Split(arr(i),">")
If arrFile(0) < 0 Then
If Not fso.FolderExists(rootpath&arrFile(1)) Then
fso.CreateFolder(rootpath&arrFile(1))
End If
ElseIf arrFile(0) >= 0 Then
If fso.FileExists(rootpath&arrFile(1)) Then
fso.DeleteFile(rootpath&arrFile(1))
End If
s1.Position = 0
buf = s.Read(arrFile(0))
If Not IsNull(buf) Then s1.Write(buf)
s1.SetEOS
s1.SaveToFile(rootpath&arrFile(1))
End If
Next
End Sub
Public Function StreamToText(stream)
If IsNull(stream) Then
StreamToText = ""
Else
Set sm = server.CreateObject("ADODB.Stream"):sm.Open:sm.Type = 1
sm.Write(stream)
sm.Position = 0
sm.Type = 2
sm.charset = "gb2312"
sm.Position = 0
StreamToText = sm.ReadText()
sm.Close:Set sm = Nothing
End If
End Function
Public Function TextToStream(text)
If text="" Then
TextToStream = "" '这里该如何写?空流?
Else
Set sm = server.CreateObject("ADODB.Stream"):sm.Open:sm.Type = 2:sm.charset = "gb2312"
sm.WriteText(text)
sm.Position = 0
sm.Type = 1
sm.Position = 0
TextToStream = sm.Read
sm.Close:Set sm = Nothing
End If
End Function
End Class
</script>
标签:
asp打包类
无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com
暂无评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新日志
2024年11月16日
2024年11月16日
- 魔兽世界wlk恶魔术士一键输出宏是什么 wlk恶魔术士一键输出宏介绍
- 医学爱好者狂喜:UP主把医学史做成了格斗游戏!
- PS5 Pro评分解禁!准备升级入手吗?
- 我们盘点了近期火热的国产单机游戏!《琉隐神渡》等 你期待哪款?
- 2019年第12届广州影音展双碟纪念版ADMS2CD[MP3/WAV]
- 黄安《救姻缘》台首版[WAV+CUE]
- 模拟之声慢刻CD《柏林之声4》[正版CD低速原抓WAV+CUE]
- 李宗盛 《李宗盛经典金曲》[WAV+CUE][1G]
- 周华健《粤语精选》[WAV+CUE][1G]
- 蔡婧2024《天空》HQCDII头版限量编号[WAV+CUE][1G]
- 陈奂仁.2011-谁是陈奂仁【BBS】【FLAC分轨】
- 群星.2024-幻乐森林影视原声带【韶愔音乐】【FLAC分轨】
- 黎明.1999-向往金色的黎明新歌+精选2CD【环球】【WAV+CUE】
- 发烧女声Méav《美芙的祈祷》发烧女声 [WAV+CUE][820M]
- 雷婷 《我的爱回不来》紫银合金AQCD [WAV+CUE][1G]