Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 网站建设 > PHP > asp实现在线压缩和解压缩
【标  题】:asp实现在线压缩和解压缩
【关键字】:asp
【来  源】:BLOG.CSDN.NET

asp实现在线压缩和解压缩

Your Ad Here

好久没来看看blog了,写了个简单的东西,希望对大家有用

附带实例

<%
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
'\\
'\\    1. c:\windows\system32\cmd.exe
'\\       拷贝把本文件所在的路径
'\\
'\\    2. 把 c:\program\winrar\rar.exe
'\\       拷贝把本文件所在的路径 并改名为WinRAR.exe
'\\
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
'\\
'\\    compressPath(byVal s)
'\\    压缩文件的路径 | 字符串变体
'\\
'\\    decompressPath(byVal s)
'\\    解压缩文件的文件夹 | 字符串变体
'\\
'\\    compress
'\\    在线压缩
'\\
'\\    decompress
'\\    在线解压缩
'\\
'\\    POWER BY MIRACLE (BLUEDESTINY)
'\\
'\\    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+"<br>"+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 "<p>" + s + "</p>" + vbCrlf
 end Sub
 private sub callErr(byVal s)
  writeLn "<p><b>ERROR:</b></p>" + s
  response.End
 end sub
 private sub callSucc(byVal s)
  writeLn "<p><b>SUCCESS:</b></p>" + s
 end Sub

 public sub compress
  validateFile(sCompressPath)
  oWshShell.run("WinRAR A " + sCompressPath + " " + sDecompressPath & "")
  if Err.number>0 then callErr("compress lost!")
  callSucc("compress <b>" + sDecompressPath + "</b> to <b>" + sCompressPath + ".rar</b> 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 <b>" + sCompressPath + ".rar</b> to <b>" + sDecompressPath + "</b> 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
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<style>
* {
 font-size:10.2pt;
 font-family:tahoma;
}
</style>
</HEAD>

<BODY>
<%
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
'\\
'\\    设有压缩文件 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
%>
</BODY>
</HTML>

玩了一天的Linux:【上一篇】
快下班了,随笔....:【下一篇】
【相关文章】
  • ASP.NET中DataGrid控件的使用
  • 请教ASP.net中文本框的数据绑定问题
  • ASP.NET连接sqlserver数据库问题
  • ASP.NET中 WebControls 命名规则
  • ASP.NET 取得客户端信息
  • 解决ASPX网页另类load两次
  • ASP.NET的几个技巧
  • asp.net 2.0中使用sql server 2005的clr存储过程经验与教训
  • asp.net 学习笔记
  • .NET之ASP Web Services 快速入门
  • 【随机文章】
  • Windows XP SP2防火墙设置详细讲解(1)
  • 使用 Visual FoxPro 的Calendar 控件
  • 中港之站
  • SQL Server 2000 学习笔记(一)
  • 回溯算法的一些知识
  • ISDN路由器的高级设置(上)
  • cisco 限制BT的几种方法
  • 网管基础:做一个合格网管员所需的基本素质
  • Linux图形界面知多少?--序言
  • 3ds Max 入门视频(20)扭曲喇叭
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 bbb软讯网络 All Rigths Reserved.