home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hot Shareware 35
/
hot35.iso
/
ficheros
/
LVB
/
T2W32543.ZIP
/
_COMPRES.FRM
< prev
next >
Wrap
Text File
|
1998-05-21
|
16KB
|
463 lines
VERSION 5.00
Begin VB.Form frmCompress
BorderStyle = 4 'Fixed ToolWindow
Caption = "Compress - Expand"
ClientHeight = 4845
ClientLeft = 1890
ClientTop = 3270
ClientWidth = 7485
MaxButton = 0 'False
MDIChild = -1 'True
PaletteMode = 1 'UseZOrder
ScaleHeight = 4845
ScaleWidth = 7485
ShowInTaskbar = 0 'False
Begin VB.Frame Frame1
Height = 570
Left = 0
TabIndex = 1
Top = -90
Width = 7485
Begin VB.CommandButton cmdNP
Caption = ">"
Height = 285
Index = 1
Left = 7110
TabIndex = 6
Top = 195
Width = 285
End
Begin VB.CommandButton cmdNP
Caption = "<"
Height = 285
Index = 0
Left = 6210
TabIndex = 5
Top = 195
Width = 285
End
Begin VB.CommandButton Command1
Caption = "&Go"
Default = -1 'True
Height = 285
Left = 6570
TabIndex = 4
Top = 195
Width = 465
End
Begin VB.ComboBox cmb_Function
Height = 315
Left = 1365
TabIndex = 2
Top = 180
Width = 4755
End
Begin VB.Label Label2
Caption = "&Select a function"
Height = 255
Left = 90
TabIndex = 3
Top = 210
Width = 1275
End
End
Begin VB.TextBox txt_Result
BackColor = &H00C0C0C0&
BorderStyle = 0 'None
Height = 4110
Left = 105
Locked = -1 'True
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Top = 630
Width = 7260
End
End
Attribute VB_Name = "frmCompress"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Option Base 1
Private Const Iteration = 10
Dim IsLoaded As Integer
Dim TimerStartOk As Integer
Dim TimerCloseOk As Integer
Dim TimerHandle As Integer
Dim TimerValue As Long
Private Sub cmb_Function_Click()
If (IsLoaded = False) Then Exit Sub
Call cDisableFI(mdiT2W.Picture1)
txt_Result = ""
DoEvents
Select Case cmb_Function.ListIndex
Case 0
Call TestFileCompress
Case 1
Call TestStringCompress
Case 2
Call TestLZARIcompress
Case 3
Call TestGZIPFileCompress
Case 4
Call TestGZIPStringCompress
Case 5
Call TestASHFileCompress
End Select
DoEvents
Call cEnableFI(mdiT2W.Picture1)
End Sub
Private Sub cmdNP_Click(Index As Integer)
Call sub_NextPrev(cmb_Function, Index)
End Sub
Private Sub Form_Activate()
mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
End Sub
Private Sub Form_Load()
IsLoaded = False
Show
Call sub_Load_Combo(cmb_Function, T2WDirInst + "_compres.t2w")
IsLoaded = True
End Sub
Private Sub Command1_Click()
Call cmb_Function_Click
End Sub
Private Sub TestFileCompress()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
Dim File2 As String
Dim File3 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
File2 = "autoexec.compressed"
File3 = "autoexec.expanded"
strDisplay = strDisplay & "File Compress '" & File1 & "' to '" & File2 & "' is " & cFileCompress(File1, File2) & vbCrLf
strDisplay = strDisplay & "File Expand '" & File2 & "' to '" & File3 & "' is " & cFileExpand(File2, File3) & vbCrLf
strDisplay = strDisplay & "Compare File contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cFileCompress(File1, File2)
Next i
lResult = cFileExpand(File2, File3)
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Public Sub TestStringCompress()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim Str1 As String
Dim Str2 As String
Dim Str3 As String
strResult = ""
strDisplay = ""
Str1 = "T2WIN-32, t2win-32, T2WIN-32, t2win-32, T2WIN-32, t2win-32"
Str2 = cStringCompress(Str1)
Str3 = cStringExpand(Str2)
strDisplay = strDisplay & "String Compress '" & Str1 & "' is " & Format$(Len(Str1)) & " to " & Format$(Len(Str2)) & " bytes." & vbCrLf
strDisplay = strDisplay & "String Expand is '" & Str3 & "'" & vbCrLf
strDisplay = strDisplay & "Compare string contents (not sensitive) is " & IIf(LCase$(Str1) = LCase$(Str3), "same", "not same") & vbCrLf & vbCrLf
Str1 = "t2win-32, t2win-32, t2win-32, t2win-32, t2win-32, t2win-32"
Str2 = cStringCompress(Str1)
Str3 = cStringExpand(Str2)
strDisplay = strDisplay & "String Compress '" & Str1 & "' is " & Format$(Len(Str1)) & " to " & Format$(Len(Str2)) & " bytes." & vbCrLf
strDisplay = strDisplay & "String Expand is '" & Str3 & "'" & vbCrLf
strDisplay = strDisplay & "Compare string contents (not sensitive) is " & IIf(LCase$(Str1) = LCase$(Str3), "same", "not same") & vbCrLf & vbCrLf
Str1 = String$(13, "a") + String$(11, "b") + String$(9, "c") + String$(7, "d") + String$(5, "e") + String$(3, "f") + String$(1, "g")
Str2 = cStringCompress(Str1)
Str3 = cStringExpand(Str2)
strDisplay = strDisplay & "String Compress '" & Str1 & "' is " & Format$(Len(Str1)) & " to " & Format$(Len(Str2)) & " bytes." & vbCrLf
strDisplay = strDisplay & "String Expand is '" & Str3 & "'" & vbCrLf
strDisplay = strDisplay & "Compare string contents (not sensitive) is " & IIf(LCase$(Str1) = LCase$(Str3), "same", "not same") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
Str2 = cStringCompress(Str1)
Next i
Str3 = cStringExpand(Str2)
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestLZARIcompress()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
Dim File2 As String
Dim File3 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
File2 = "autoexec.lzaricompressed"
File3 = "autoexec.lzariexpanded"
strDisplay = strDisplay & "LZARI Compress '" & File1 & "' to '" & File2 & "' is " & cLZARIcompress(File1, File2) & vbCrLf
strDisplay = strDisplay & "LZARI Expand '" & File2 & "' to '" & File3 & "' is " & cLZARIexpand(File2, File3) & vbCrLf
strDisplay = strDisplay & "Compare File contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cLZARIcompress(File1, File2)
Next i
lResult = cLZARIexpand(File2, File3)
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestGZIPFileCompress()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
Dim File2 As String
Dim File3 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
File2 = "autoexec.gzipcompressed"
File3 = "autoexec.gzipexpanded"
strDisplay = strDisplay & "GZIP Compress '" & File1 & "' to '" & File2 & "' is " & cGZIPFileCompress(File1, File2) & vbCrLf
strDisplay = strDisplay & "GZIP Expand '" & File2 & "' to '" & File3 & "' is " & cGZIPFileExpand(File2, File3) & vbCrLf
strDisplay = strDisplay & "Compare File contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cGZIPFileCompress(File1, File2)
Next i
lResult = cGZIPFileExpand(File2, File3)
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestGZIPStringCompress()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim Str1 As String
Dim Str2 As String
Dim Str3 As String
strResult = ""
strDisplay = ""
Str1 = "T2WIN-32, t2win-32, T2WIN-32, t2win-32, T2WIN-32, t2win-32"
Str2 = cGZIPStringCompress(Str1)
Str3 = cGZIPStringExpand(Str2)
strDisplay = strDisplay & "String Compress '" & Str1 & "' is " & Format$(Len(Str1)) & " to " & Format$(Len(Str2)) & " bytes." & vbCrLf
strDisplay = strDisplay & "String Expand is '" & Str3 & "'" & vbCrLf
strDisplay = strDisplay & "Compare string contents (not sensitive) is " & IIf(LCase$(Str1) = LCase$(Str3), "same", "not same") & vbCrLf & vbCrLf
Str1 = "t2win-32, t2win-32, t2win-32, t2win-32, t2win-32, t2win-32"
Str2 = cGZIPStringCompress(Str1)
Str3 = cGZIPStringExpand(Str2)
strDisplay = strDisplay & "String Compress '" & Str1 & "' is " & Format$(Len(Str1)) & " to " & Format$(Len(Str2)) & " bytes." & vbCrLf
strDisplay = strDisplay & "String Expand is '" & Str3 & "'" & vbCrLf
strDisplay = strDisplay & "Compare string contents (not sensitive) is " & IIf(LCase$(Str1) = LCase$(Str3), "same", "not same") & vbCrLf & vbCrLf
Str1 = String$(13, "a") + String$(11, "b") + String$(9, "c") + String$(7, "d") + String$(5, "e") + String$(3, "f") + String$(1, "g")
Str2 = cGZIPStringCompress(Str1)
Str3 = cGZIPStringExpand(Str2)
strDisplay = strDisplay & "String Compress '" & Str1 & "' is " & Format$(Len(Str1)) & " to " & Format$(Len(Str2)) & " bytes." & vbCrLf
strDisplay = strDisplay & "String Expand is '" & Str3 & "'" & vbCrLf
strDisplay = strDisplay & "Compare string contents (not sensitive) is " & IIf(LCase$(Str1) = LCase$(Str3), "same", "not same") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
Str2 = cGZIPStringCompress(Str1)
Next i
Str3 = cGZIPStringExpand(Str2)
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestASHFileCompress()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim order As Integer
Dim File1 As String
Dim File2 As String
Dim File3 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
File2 = "autoexec.ashcompressed"
File3 = "autoexec.ashexpanded"
order = 0
strDisplay = strDisplay & "ASH Compress (order " & order & ")' " & File1 & "' to '" & File2 & "' is " & cASHFileCompress(File1, File2, order) & vbCrLf
strDisplay = strDisplay & "ASH Expand (order " & order & ")' " & File2 & "' to '" & File3 & "' is " & cASHFileExpand(File2, File3, order) & vbCrLf
strDisplay = strDisplay & "Compare File contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
order = 1
strDisplay = strDisplay & "ASH Compress (order " & order & ")' " & File1 & "' to '" & File2 & "' is " & cASHFileCompress(File1, File2, order) & vbCrLf
strDisplay = strDisplay & "ASH Expand (order " & order & ")' " & File2 & "' to '" & File3 & "' is " & cASHFileExpand(File2, File3, order) & vbCrLf
strDisplay = strDisplay & "Compare File contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
order = 2
strDisplay = strDisplay & "ASH Compress (order " & order & ")' " & File1 & "' to '" & File2 & "' is " & cASHFileCompress(File1, File2, order) & vbCrLf
strDisplay = strDisplay & "ASH Expand (order " & order & ")' " & File2 & "' to '" & File3 & "' is " & cASHFileExpand(File2, File3, order) & vbCrLf
strDisplay = strDisplay & "Compare File contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
order = 3
strDisplay = strDisplay & "ASH Compress (order " & order & ")' " & File1 & "' to '" & File2 & "' is " & cASHFileCompress(File1, File2, order) & vbCrLf
strDisplay = strDisplay & "ASH Expand (order " & order & ")' " & File2 & "' to '" & File3 & "' is " & cASHFileExpand(File2, File3, order) & vbCrLf
strDisplay = strDisplay & "Compare File contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
order = 4
strDisplay = strDisplay & "ASH Compress (order " & order & ")' " & File1 & "' to '" & File2 & "' is " & cASHFileCompress(File1, File2, order) & vbCrLf
strDisplay = strDisplay & "ASH Expand (order " & order & ")' " & File2 & "' to '" & File3 & "' is " & cASHFileExpand(File2, File3, order) & vbCrLf
strDisplay = strDisplay & "Compare File contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cASHFileCompress(File1, File2, 0)
Next i
lResult = cASHFileExpand(File2, File3, 0)
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub