ASP 압축 풀기(온라인 압축 풀기 클래스)

4731 단어
 
  
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
'\\
'\\ 1. c:\windows\system32\cmd.exe
'\\ 
'\\
'\\ 2.   c:\program\winrar\rar.exe
'\\    WinRAR.exe
'\\
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
'\\
'\\ compressPath(byVal s)
'\\   | 
'\\
'\\ decompressPath(byVal s)
'\\   | 
'\\
'\\ compress
'\\ 
'\\
'\\ decompress
'\\ 
'\\
'\\ POWER BY never-online
'\\
'\\ EMAIL : Bluedestiny[at]126.com
'\\
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

OPTION EXPLICIT

class COMPRESS_DECOMPRESS_FILES

 private version, copyright
 private oWshShell, oFso
 private sCompressPath, sDecompressPath 

 private sub class_initialize
 version="COMPRESS_DECOMPRESS_FILES BUILDER 20051015"
 copyright="POWER BY MIRACLE (BLUEDESTINY)"
 Set oFso=server.CreateObject("scripting.FileSystemObject")
 Set oWshShell=server.CreateObject("Wscript.Shell")
 writeLn(version+"
"+copyright)
 end Sub
 private sub class_terminate
 if isobject(oWshShell) then set oWshShell=nothing
 if isobject(oFso) then set oFso=nothing
 end Sub
 private function physicalPath(byVal s)
 physicalPath=server.mappath(s)
 end Function
 private sub validateFile(byVal s)
 if oFso.FileExists(s) then exit sub
 if oFso.FolderExists(s) then exit sub
 callErr "file(folder) not exists!"
 end Sub
 private sub createFolder(byVal s)
 if oFso.FolderExists(s) then exit Sub
 oFso.createFolder(s)
 end Sub
 private sub writeLn(byVal s)
 response.write "

" + s + "

" + vbCrlf
 end Sub
 private sub callErr(byVal s)
 writeLn "

ERROR:

" + s
 response.End
 end sub
 private sub callSucc(byVal s)
 writeLn "

SUCCESS:

" + s
 end Sub

 public sub compress
 validateFile(sCompressPath)
 oWshShell.run("WinRAR A " + sCompressPath + " " + sDecompressPath & "")
 if Err.number>0 then callErr("compress lost!")
 callSucc("compress " + sDecompressPath + " to " + sCompressPath + ".rar successfully!")
 end Sub
 public sub decompress
 validateFile(sCompressPath)
 createFolder(sDecompressPath)
 oWshShell.run("WinRAR X " + sCompressPath + " " + sDecompressPath & "")
 if Err.number>0 then callErr("decompress lost!")
 callSucc("decompress " + sCompressPath + ".rar to " + sDecompressPath + " successfully!")
 end sub

 public property Let compressPath(byVal s)
 sCompressPath=physicalPath(s)
 end property
 public property Let decompressPath(byVal s)
 sDecompressPath=physicalPath(s)
 end property

End class
%>
HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">


 asp  








'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
'\\
'\\   compress.rar
'\\   decompressFolder 
'\\
'\\   compress.rar   1 
'\\   decompressFolder     2.rar 
'\\
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

dim oExample

set oExample=new COMPRESS_DECOMPRESS_FILES
oExample.compressPath="decompressFolder"
oExample.decompresspath="1"
oExample.compress

oExample.compressPath="compress"
oExample.decompresspath="2"
oExample.decompress

set oExample=nothing
%>


좋은 웹페이지 즐겨찾기