千家信息网

VB.NET如何实现压缩和解压缩

发表于:2026-11-01 作者:千家信息网编辑
千家信息网最后更新 2026年11月01日,这篇文章主要为大家展示了"VB.NET如何实现压缩和解压缩",内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下"VB.NET如何实现压缩和解压缩"这篇文章吧。VB
千家信息网最后更新 2026年11月01日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安全错误 数据库的锁怎样保障安全 花魁咖啡 亿人帮互联网科技有限公司 哈尔滨大商圈互联网科技有限公司 广州万易互联网科技有限公司 朗新科技与工业互联网 上海挚品互联网科技 哈尔滨秒房互联网科技有限公司 现代科技和互联网有关系吗 中国的互联网科技企业的崛起 互联网大会黑科技排名 湖南一路畅行互联网科技 美国互联网科技实力 南通创西澳互联网科技有限公司 从那以后互联网科技有限公司 广州互联网高科技取餐柜 互联网科技手机排行榜 湖北辰鑫科技互联网 好易买互联网科技 科技互联网公司两年变化 北京瑞云互联网科技有限公司 圆梦互联网科技 疫情对互联网科技公司影响 互联网品科技 杭州互联网科技公司 太原新华互联网科技学校怎么样 温州喔噻互联网科技有限公司 来此购互联网科技有限公司 华夏互联网科技业 互联网营销推广黑科技 陕西云淼互联网科技公司
0