在我们运用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压缩和解压缩实例全面分析
                
                文章地址:http://www.csdahua.cn/qtweb/news4/110554.html
            
网站建设、网络推广公司-快上网,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 快上网