1
Dim zipname As String = Path.Combine(Me.zipdir, (Me.txtZipFile.Text.ToString & ".zip"))
2
Dim crc1 As New Crc32
3
Dim s As ZipOutputStream = New ZipOutputStream(File.Create(zipname))
4
s.SetLevel(6)
5
Dim i As Integer
6
Dim flename As String() = {Server.MapPath("temp\index.htm"), Server.MapPath("temp\regriter.htm")}
7
8
For i = 0 To flename.Length - 1
9
Dim name As String = flename(i)
10
Dim stratem As FileStream = File.OpenRead(name)
11
Dim buffer As Byte() = New Byte(stratem.Length - 1) {}
12
stratem.Read(buffer, 0, buffer.Length)
13
Dim filename1 As String = name.Replace((Me.timpdir & "\"), "")
14
Dim entry As New ZipEntry(filename1)
15
entry.DateTime = DateTime.Now
16
entry.Size = stratem.Length
17
stratem.Close()
18
crc1.Reset()
19
crc1.Update(buffer)
20
entry.Crc = crc1.Value
21
s.PutNextEntry(entry)
22
s.Write(buffer, 0, buffer.Length)
23
Next
24
s.Finish()
25
s.Close()

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

1
Imports System.IO
2
3
Public Class utilClass util
4
5
Public Shared Function GetDirecotry()Function GetDirecotry(ByVal DirecotryName As String) As String
6
Dim dir As String = HttpContext.Current.Request.PhysicalApplicationPath
7
dir = Path.Combine(dir, DirecotryName)
8
If Directory.Exists(dir) = True Then
9
Directory.CreateDirectory(dir)
10
End If
11
Return dir
12
End Function
13
14
End Class

2

3


4

5


6

7

8

9

10

11

12

13

14
