资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

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如何实现压缩和解压缩”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注创新互联行业资讯频道!


网站题目:VB.NET如何实现压缩和解压缩
分享URL:http://cdkjz.cn/article/ipcicd.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220