VB.NET如何实现压缩和解压缩
发表于:2024-10-06 作者:千家信息网编辑
千家信息网最后更新 2024年10月06日,这篇文章主要为大家展示了"VB.NET如何实现压缩和解压缩",内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下"VB.NET如何实现压缩和解压缩"这篇文章吧。VB
千家信息网最后更新 2024年10月06日VB.NET如何实现压缩和解压缩
这篇文章主要为大家展示了"VB.NET如何实现压缩和解压缩",内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下"VB.NET如何实现压缩和解压缩"这篇文章吧。
VB.NET压缩和解压缩实现代码:
PublicEnumZip Zip=0'压缩 UnZip=1'解压缩 EndEnum '压缩、解压缩 PublicFunctionZipFile(ByValinDirPathAsString,OptionalByVal_zipAsZip=Zip.Zip,_ OptionalByValstrFileNameAsString="C:\BACKUP")AsBoolean DimInfoAsNewInformation DimPrintMessageAsNewErrorinf DimstrCommandAsString If_zip=Zip.ZipThen DimdirectoryEntriesAsString() directoryEntries=System.IO.Directory.GetFileSystemEntries(inDirPath) DimstrFileAsString,strFileAllAsString ForEachstrFileIndirectoryEntries strFileAllstrFileAll=strFileAll&"-ep1"&strFile Next DimstrPassAsString=InputBox(Info.NOR_InputPassword,Info.NOR_PasswordInput) IfstrPass.Length>0Then strCommand="winrarA-hp"+strPass+"-ep1" Else strCommand="winrarA-ep1" EndIf strCommandstrCommand=strCommand&Space(1)&strFileName&Space(1)&strFileAll Try IfSystem.IO.File.Exists(strFileName)Then IfMsgBox(Info.NOR_ReplaceFile,_ MsgBoxStyle.OKCancel+_ MsgBoxStyle.Information,Info.NOR_Prompt)=MsgBoxResult.CancelThen ReturnFalse Else Shell(strCommand,AppWinStyle.NormalFocus,True) EndIf Else Shell(strCommand,AppWinStyle.NormalFocus,True) EndIf MsgBox(Info.SUC_ZipBackSuccess,MsgBoxStyle.OKOnly+MsgBoxStyle.Information,Info.NOR_Prompt) ReturnTrue Catch PrintMessage.WriteErr("Cls_Common->ZipFile",Info.ERR_ZipBackError) MsgBox(Info.ERR_ZipBackError,MsgBoxStyle.OKOnly+MsgBoxStyle.Information,Info.NOR_Prompt) ReturnFalse EndTry Else DimOpenDialogAsNewOpenFileDialog OpenDialog.Filter="还原压缩数据*.rar|*.rar" IfOpenDialog.ShowDialog=DialogResult.CancelThen OpenDialog.Dispose() ReturnFalse EndIf strFileName=OpenDialog.FileName DimstrRePassAsString=InputBox(Info.NOR_InputPassword,Info.NOR_PasswordInput) IfstrRePass.Trim.Length>0Then strCommand="winrarX-hp"+strRePass.Trim+"-o+-inul-ep2" Else strCommand="winrarX-o+-inul-ep2" EndIf strCommandstrCommand=strCommand&Space(1)&strFileName&Space(1)&Application.StartupPath OpenDialog.Dispose() Try Shell(strCommand,AppWinStyle.NormalFocus,True) MsgBox(Info.SUC_ZipRevertSuccess,MsgBoxStyle.OKOnly+MsgBoxStyle.Information,Info.NOR_Prompt) ReturnTrue Catch PrintMessage.WriteErr("Cls_Common->ZipFile",Info.ERR_ZipRevertError) MsgBox(Info.ERR_ZipRevertError,MsgBoxStyle.OKOnly+MsgBoxStyle.Information,Info.NOR_Prompt) ReturnFalse EndTry EndIf 'Debug.Write(strCommand) EndFunction
你的应用程序的bin下要有一个winrar的可执行文件.
以上是"VB.NET如何实现压缩和解压缩"这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注行业资讯频道!
和解
内容
篇文章
学习
帮助
代码
应用程序
数据
文件
易懂
更多
条理
知识
程序
编带
行业
资讯
资讯频道
频道
应用
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
小孩想学游戏软件开发
通过数据库怎样找后台网址
软件开发常用的模型
台湾电子期刊数据库
天水同盟软件开发有限公司
读懂数据库
软件开发方式的特征
福建计算机网络技术试卷
军事网络安全规定由谁规定
软件开发减少发版频率的影响
石景山网络安全认证
网络安全相关工作年限证明
amd的服务器
如何登录l服务器
小学生网络安全小报图片
网络安全宣传片大学
华为5g网络技术高校
网络安全设置win10
网络安全画画好看的 百度网盘
2020中国网络安全年会召开
vbs脚本读写查找数据库
图书馆数据库系统的改进地方
浙江省网络安全测评
软件开发工程师工作要保密吗
数据库初始化失败什么意思
建设网络安全教育基地
网络技术基础教程答案
中国移动2022年招标 服务器
周村物流竞价软件开发
武汉城市宿客互联网科技有限公司