실패한 zip 파일 만들기.
*
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.Cancel Then
Exit Sub
End If
Dim FileName = OpenFileDialog1.FileName

Try

Dim Z As System.IO.ZipPackage
Z = System.IO.Packaping.Package.Open(FileName & ".Zip", IO.FileMode.Create)

Dim B = System.IO.File.ReadAllBytes(FileName)

Dim partUriDocument As Uri = System.IO.Packaping.PackUriHelper.CreatePartUri(New Uri(System.IO.Path.GetFileName(FileName), UriKind.Relative))

Dim P = Z.CreatePart(partUriDocument, System.Net.Mime.MediaTypeNames.Application.Zip, IO.Packaging.CompressionOption.Maximum)

P.GetStream.Write(B, O, B.Length)

Z.Close()

Catch ex As Exception
MsgBox(ex.Message)

End Try
End Sub
End Class

코드창 하나를 참조하는 법을 모르겠네여..

 

이 게시물을

공유하기

SEARCH

MENU NAVIGATION