home *** CD-ROM | disk | FTP | other *** search
/ Hot Shareware 32 / hot34.iso / ficheros / LVB / T2W32523.ZIP / _COMPRES.FRM < prev    next >
Text File  |  1998-04-07  |  18KB  |  530 lines

  1. VERSION 5.00
  2. Object = "{0BA686C6-F7D3-101A-993E-0000C0EF6F5E}#1.0#0"; "THREED32.OCX"
  3. Begin VB.Form frmCompress 
  4.    BorderStyle     =   4  'Fixed ToolWindow
  5.    Caption         =   "Compress - Expand"
  6.    ClientHeight    =   4845
  7.    ClientLeft      =   1890
  8.    ClientTop       =   3270
  9.    ClientWidth     =   7485
  10.    MaxButton       =   0   'False
  11.    MDIChild        =   -1  'True
  12.    PaletteMode     =   1  'UseZOrder
  13.    ScaleHeight     =   4845
  14.    ScaleWidth      =   7485
  15.    ShowInTaskbar   =   0   'False
  16.    Begin VB.TextBox txt_Result 
  17.       BackColor       =   &H00C0C0C0&
  18.       BorderStyle     =   0  'None
  19.       Height          =   4110
  20.       Left            =   105
  21.       Locked          =   -1  'True
  22.       MultiLine       =   -1  'True
  23.       ScrollBars      =   2  'Vertical
  24.       TabIndex        =   0
  25.       Top             =   630
  26.       Width           =   7260
  27.    End
  28.    Begin Threed.SSPanel SSPanel1 
  29.       Align           =   1  'Align Top
  30.       Height          =   480
  31.       Left            =   0
  32.       TabIndex        =   1
  33.       Top             =   0
  34.       Width           =   7485
  35.       _Version        =   65536
  36.       _ExtentX        =   13203
  37.       _ExtentY        =   847
  38.       _StockProps     =   15
  39.       ForeColor       =   -2147483640
  40.       BackColor       =   12632256
  41.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  42.          Name            =   "MS Sans Serif"
  43.          Size            =   8.25
  44.          Charset         =   0
  45.          Weight          =   400
  46.          Underline       =   0   'False
  47.          Italic          =   0   'False
  48.          Strikethrough   =   0   'False
  49.       EndProperty
  50.       Begin VB.ComboBox cmb_Function 
  51.          Height          =   315
  52.          Left            =   1365
  53.          TabIndex        =   2
  54.          Top             =   90
  55.          Width           =   4785
  56.       End
  57.       Begin Threed.SSCommand cmdNP 
  58.          Height          =   300
  59.          Index           =   1
  60.          Left            =   7140
  61.          TabIndex        =   6
  62.          Top             =   90
  63.          Width           =   255
  64.          _Version        =   65536
  65.          _ExtentX        =   450
  66.          _ExtentY        =   529
  67.          _StockProps     =   78
  68.          Caption         =   ">"
  69.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  70.             Name            =   "MS Sans Serif"
  71.             Size            =   8.25
  72.             Charset         =   0
  73.             Weight          =   400
  74.             Underline       =   0   'False
  75.             Italic          =   0   'False
  76.             Strikethrough   =   0   'False
  77.          EndProperty
  78.          BevelWidth      =   1
  79.          Font3D          =   3
  80.          RoundedCorners  =   0   'False
  81.          Outline         =   0   'False
  82.       End
  83.       Begin Threed.SSCommand cmdNP 
  84.          Height          =   300
  85.          Index           =   0
  86.          Left            =   6300
  87.          TabIndex        =   5
  88.          Top             =   90
  89.          Width           =   255
  90.          _Version        =   65536
  91.          _ExtentX        =   450
  92.          _ExtentY        =   529
  93.          _StockProps     =   78
  94.          Caption         =   "<"
  95.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  96.             Name            =   "MS Sans Serif"
  97.             Size            =   8.25
  98.             Charset         =   0
  99.             Weight          =   400
  100.             Underline       =   0   'False
  101.             Italic          =   0   'False
  102.             Strikethrough   =   0   'False
  103.          EndProperty
  104.          BevelWidth      =   1
  105.          Font3D          =   3
  106.          RoundedCorners  =   0   'False
  107.          Outline         =   0   'False
  108.       End
  109.       Begin Threed.SSCommand SSCommand1 
  110.          Default         =   -1  'True
  111.          Height          =   300
  112.          Left            =   6615
  113.          TabIndex        =   3
  114.          Top             =   90
  115.          Width           =   465
  116.          _Version        =   65536
  117.          _ExtentX        =   820
  118.          _ExtentY        =   529
  119.          _StockProps     =   78
  120.          Caption         =   "&Go"
  121.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  122.             Name            =   "MS Sans Serif"
  123.             Size            =   8.25
  124.             Charset         =   0
  125.             Weight          =   400
  126.             Underline       =   0   'False
  127.             Italic          =   0   'False
  128.             Strikethrough   =   0   'False
  129.          EndProperty
  130.          BevelWidth      =   1
  131.          RoundedCorners  =   0   'False
  132.          Outline         =   0   'False
  133.       End
  134.       Begin VB.Label Label2 
  135.          Caption         =   "&Select a function"
  136.          Height          =   255
  137.          Left            =   90
  138.          TabIndex        =   4
  139.          Top             =   120
  140.          Width           =   1275
  141.       End
  142.    End
  143. End
  144. Attribute VB_Name = "frmCompress"
  145. Attribute VB_GlobalNameSpace = False
  146. Attribute VB_Creatable = False
  147. Attribute VB_PredeclaredId = True
  148. Attribute VB_Exposed = False
  149. Option Explicit
  150. Option Base 1
  151.  
  152. Private Const Iteration = 10
  153.  
  154. Dim IsLoaded         As Integer
  155.  
  156. Dim TimerStartOk     As Integer
  157. Dim TimerCloseOk     As Integer
  158.  
  159. Dim TimerHandle      As Integer
  160. Dim TimerValue       As Long
  161.  
  162. Private Sub cmb_Function_Click()
  163.    
  164.    If (IsLoaded = False) Then Exit Sub
  165.    
  166.    Call cDisableFI(mdiT2W.Picture1)
  167.    
  168.    txt_Result = ""
  169.    
  170.    DoEvents
  171.    
  172.    Select Case cmb_Function.ListIndex
  173.       Case 0
  174.          Call TestFileCompress
  175.       Case 1
  176.          Call TestStringCompress
  177.       Case 2
  178.          Call TestLZARIcompress
  179.       Case 3
  180.          Call TestGZIPFileCompress
  181.       Case 4
  182.          Call TestGZIPStringCompress
  183.       Case 5
  184.          Call TestASHFileCompress
  185.    End Select
  186.  
  187.    DoEvents
  188.    Call cEnableFI(mdiT2W.Picture1)
  189.    
  190. End Sub
  191.  
  192.  
  193. Private Sub cmdNP_Click(Index As Integer)
  194.  
  195.    Call sub_NextPrev(cmb_Function, Index)
  196.  
  197. End Sub
  198.  
  199. Private Sub Form_Activate()
  200.  
  201.    mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
  202.  
  203. End Sub
  204.  
  205. Private Sub Form_Load()
  206.  
  207.    IsLoaded = False
  208.    
  209.    Show
  210.  
  211.    Call sub_Load_Combo(cmb_Function, T2WDirInst + "_compres.t2w")
  212.    
  213.    IsLoaded = True
  214.    
  215. End Sub
  216.  
  217. Private Sub SSCommand1_Click()
  218.    
  219.    Call cmb_Function_Click
  220.    
  221. End Sub
  222.  
  223. Private Sub TestFileCompress()
  224.  
  225.    Dim lResult          As Long
  226.    Dim strResult        As String
  227.    Dim strDisplay       As String
  228.    
  229.    Dim i                As Integer
  230.    
  231.    Dim File1            As String
  232.    Dim File2            As String
  233.    Dim File3            As String
  234.    
  235.    strResult = ""
  236.    strDisplay = ""
  237.    
  238.    File1 = T2WFileTest
  239.    File2 = "autoexec.compressed"
  240.    File3 = "autoexec.expanded"
  241.    
  242.    strDisplay = strDisplay & "File Compress '" & File1 & "' to '" & File2 & "' is " & cFileCompress(File1, File2) & vbCrLf
  243.    strDisplay = strDisplay & "File Expand '" & File2 & "' to '" & File3 & "' is " & cFileExpand(File2, File3) & vbCrLf
  244.    strDisplay = strDisplay & "Compare File contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
  245.  
  246.    txt_Result = strDisplay
  247.  
  248.    'time the function
  249.  
  250.    TimerHandle = cTimerOpen()
  251.    TimerStartOk = cTimerStart(TimerHandle)
  252.    
  253.    For i = 1 To Iteration
  254.       lResult = cFileCompress(File1, File2)
  255.    Next i
  256.    
  257.    lResult = cFileExpand(File2, File3)
  258.    
  259.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  260.    
  261.    TimerCloseOk = cTimerClose(TimerHandle)
  262.  
  263. End Sub
  264.  
  265. Public Sub TestStringCompress()
  266.  
  267.    Dim lResult          As Long
  268.    Dim strResult        As String
  269.    Dim strDisplay       As String
  270.    
  271.    Dim i                As Integer
  272.    
  273.    Dim Str1             As String
  274.    Dim Str2             As String
  275.    Dim Str3             As String
  276.    
  277.    strResult = ""
  278.    strDisplay = ""
  279.    
  280.    Str1 = "T2WIN-32, t2win-32, T2WIN-32, t2win-32, T2WIN-32, t2win-32"
  281.    Str2 = cStringCompress(Str1)
  282.    Str3 = cStringExpand(Str2)
  283.    
  284.    strDisplay = strDisplay & "String Compress '" & Str1 & "' is " & Format$(Len(Str1)) & " to " & Format$(Len(Str2)) & " bytes." & vbCrLf
  285.    strDisplay = strDisplay & "String Expand is '" & Str3 & "'" & vbCrLf
  286.    strDisplay = strDisplay & "Compare string contents (not sensitive) is " & IIf(LCase$(Str1) = LCase$(Str3), "same", "not same") & vbCrLf & vbCrLf
  287.  
  288.    Str1 = "t2win-32, t2win-32, t2win-32, t2win-32, t2win-32, t2win-32"
  289.    Str2 = cStringCompress(Str1)
  290.    Str3 = cStringExpand(Str2)
  291.    
  292.    strDisplay = strDisplay & "String Compress '" & Str1 & "' is " & Format$(Len(Str1)) & " to " & Format$(Len(Str2)) & " bytes." & vbCrLf
  293.    strDisplay = strDisplay & "String Expand is '" & Str3 & "'" & vbCrLf
  294.    strDisplay = strDisplay & "Compare string contents (not sensitive) is " & IIf(LCase$(Str1) = LCase$(Str3), "same", "not same") & vbCrLf & vbCrLf
  295.  
  296.    Str1 = String$(13, "a") + String$(11, "b") + String$(9, "c") + String$(7, "d") + String$(5, "e") + String$(3, "f") + String$(1, "g")
  297.    Str2 = cStringCompress(Str1)
  298.    Str3 = cStringExpand(Str2)
  299.    
  300.    strDisplay = strDisplay & "String Compress '" & Str1 & "' is " & Format$(Len(Str1)) & " to " & Format$(Len(Str2)) & " bytes." & vbCrLf
  301.    strDisplay = strDisplay & "String Expand is '" & Str3 & "'" & vbCrLf
  302.    strDisplay = strDisplay & "Compare string contents (not sensitive) is " & IIf(LCase$(Str1) = LCase$(Str3), "same", "not same") & vbCrLf & vbCrLf
  303.  
  304.    txt_Result = strDisplay
  305.  
  306.    'time the function
  307.  
  308.    TimerHandle = cTimerOpen()
  309.    TimerStartOk = cTimerStart(TimerHandle)
  310.    
  311.    For i = 1 To Iteration
  312.       Str2 = cStringCompress(Str1)
  313.    Next i
  314.    
  315.    Str3 = cStringExpand(Str2)
  316.    
  317.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  318.    
  319.    TimerCloseOk = cTimerClose(TimerHandle)
  320.  
  321. End Sub
  322.  
  323. Private Sub TestLZARIcompress()
  324.  
  325.    Dim lResult          As Long
  326.    Dim strResult        As String
  327.    Dim strDisplay       As String
  328.    
  329.    Dim i                As Integer
  330.    
  331.    Dim File1            As String
  332.    Dim File2            As String
  333.    Dim File3            As String
  334.    
  335.    strResult = ""
  336.    strDisplay = ""
  337.    
  338.    File1 = T2WFileTest
  339.    File2 = "autoexec.lzaricompressed"
  340.    File3 = "autoexec.lzariexpanded"
  341.    
  342.    strDisplay = strDisplay & "LZARI Compress '" & File1 & "' to '" & File2 & "' is " & cLZARIcompress(File1, File2) & vbCrLf
  343.    strDisplay = strDisplay & "LZARI Expand '" & File2 & "' to '" & File3 & "' is " & cLZARIexpand(File2, File3) & vbCrLf
  344.    strDisplay = strDisplay & "Compare File contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
  345.  
  346.    txt_Result = strDisplay
  347.  
  348.    'time the function
  349.  
  350.    TimerHandle = cTimerOpen()
  351.    TimerStartOk = cTimerStart(TimerHandle)
  352.    
  353.    For i = 1 To Iteration
  354.       lResult = cLZARIcompress(File1, File2)
  355.    Next i
  356.    
  357.    lResult = cLZARIexpand(File2, File3)
  358.    
  359.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  360.    
  361.    TimerCloseOk = cTimerClose(TimerHandle)
  362.  
  363. End Sub
  364.  
  365. Private Sub TestGZIPFileCompress()
  366.  
  367.    Dim lResult          As Long
  368.    Dim strResult        As String
  369.    Dim strDisplay       As String
  370.    
  371.    Dim i                As Integer
  372.    
  373.    Dim File1            As String
  374.    Dim File2            As String
  375.    Dim File3            As String
  376.    
  377.    strResult = ""
  378.    strDisplay = ""
  379.    
  380.    File1 = T2WFileTest
  381.    File2 = "autoexec.gzipcompressed"
  382.    File3 = "autoexec.gzipexpanded"
  383.    
  384.    strDisplay = strDisplay & "GZIP Compress '" & File1 & "' to '" & File2 & "' is " & cGZIPFileCompress(File1, File2) & vbCrLf
  385.    strDisplay = strDisplay & "GZIP Expand '" & File2 & "' to '" & File3 & "' is " & cGZIPFileExpand(File2, File3) & vbCrLf
  386.    strDisplay = strDisplay & "Compare File contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
  387.  
  388.    txt_Result = strDisplay
  389.  
  390.    'time the function
  391.  
  392.    TimerHandle = cTimerOpen()
  393.    TimerStartOk = cTimerStart(TimerHandle)
  394.    
  395.    For i = 1 To Iteration
  396.       lResult = cGZIPFileCompress(File1, File2)
  397.    Next i
  398.    
  399.    lResult = cGZIPFileExpand(File2, File3)
  400.    
  401.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  402.    
  403.    TimerCloseOk = cTimerClose(TimerHandle)
  404.  
  405. End Sub
  406.  
  407. Private Sub TestGZIPStringCompress()
  408.  
  409.    Dim lResult          As Long
  410.    Dim strResult        As String
  411.    Dim strDisplay       As String
  412.    
  413.    Dim i                As Integer
  414.    
  415.    Dim Str1             As String
  416.    Dim Str2             As String
  417.    Dim Str3             As String
  418.    
  419.    strResult = ""
  420.    strDisplay = ""
  421.    
  422.    Str1 = "T2WIN-32, t2win-32, T2WIN-32, t2win-32, T2WIN-32, t2win-32"
  423.    Str2 = cGZIPStringCompress(Str1)
  424.    Str3 = cGZIPStringExpand(Str2)
  425.    
  426.    strDisplay = strDisplay & "String Compress '" & Str1 & "' is " & Format$(Len(Str1)) & " to " & Format$(Len(Str2)) & " bytes." & vbCrLf
  427.    strDisplay = strDisplay & "String Expand is '" & Str3 & "'" & vbCrLf
  428.    strDisplay = strDisplay & "Compare string contents (not sensitive) is " & IIf(LCase$(Str1) = LCase$(Str3), "same", "not same") & vbCrLf & vbCrLf
  429.  
  430.    Str1 = "t2win-32, t2win-32, t2win-32, t2win-32, t2win-32, t2win-32"
  431.    Str2 = cGZIPStringCompress(Str1)
  432.    Str3 = cGZIPStringExpand(Str2)
  433.    
  434.    strDisplay = strDisplay & "String Compress '" & Str1 & "' is " & Format$(Len(Str1)) & " to " & Format$(Len(Str2)) & " bytes." & vbCrLf
  435.    strDisplay = strDisplay & "String Expand is '" & Str3 & "'" & vbCrLf
  436.    strDisplay = strDisplay & "Compare string contents (not sensitive) is " & IIf(LCase$(Str1) = LCase$(Str3), "same", "not same") & vbCrLf & vbCrLf
  437.  
  438.    Str1 = String$(13, "a") + String$(11, "b") + String$(9, "c") + String$(7, "d") + String$(5, "e") + String$(3, "f") + String$(1, "g")
  439.    Str2 = cGZIPStringCompress(Str1)
  440.    Str3 = cGZIPStringExpand(Str2)
  441.    
  442.    strDisplay = strDisplay & "String Compress '" & Str1 & "' is " & Format$(Len(Str1)) & " to " & Format$(Len(Str2)) & " bytes." & vbCrLf
  443.    strDisplay = strDisplay & "String Expand is '" & Str3 & "'" & vbCrLf
  444.    strDisplay = strDisplay & "Compare string contents (not sensitive) is " & IIf(LCase$(Str1) = LCase$(Str3), "same", "not same") & vbCrLf & vbCrLf
  445.  
  446.    txt_Result = strDisplay
  447.  
  448.    'time the function
  449.  
  450.    TimerHandle = cTimerOpen()
  451.    TimerStartOk = cTimerStart(TimerHandle)
  452.    
  453.    For i = 1 To Iteration
  454.       Str2 = cGZIPStringCompress(Str1)
  455.    Next i
  456.    
  457.    Str3 = cGZIPStringExpand(Str2)
  458.    
  459.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  460.    
  461.    TimerCloseOk = cTimerClose(TimerHandle)
  462.  
  463. End Sub
  464.  
  465. Private Sub TestASHFileCompress()
  466.  
  467.    Dim lResult          As Long
  468.    Dim strResult        As String
  469.    Dim strDisplay       As String
  470.    
  471.    Dim i                As Integer
  472.    Dim order            As Integer
  473.    
  474.    Dim File1            As String
  475.    Dim File2            As String
  476.    Dim File3            As String
  477.    
  478.    strResult = ""
  479.    strDisplay = ""
  480.    
  481.    File1 = T2WFileTest
  482.    File2 = "autoexec.ashcompressed"
  483.    File3 = "autoexec.ashexpanded"
  484.    
  485.    order = 0
  486.    strDisplay = strDisplay & "ASH Compress (order " & order & ")' " & File1 & "' to '" & File2 & "' is " & cASHFileCompress(File1, File2, order) & vbCrLf
  487.    strDisplay = strDisplay & "ASH Expand (order " & order & ")' " & File2 & "' to '" & File3 & "' is " & cASHFileExpand(File2, File3, order) & vbCrLf
  488.    strDisplay = strDisplay & "Compare File contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
  489.  
  490.    order = 1
  491.    strDisplay = strDisplay & "ASH Compress (order " & order & ")' " & File1 & "' to '" & File2 & "' is " & cASHFileCompress(File1, File2, order) & vbCrLf
  492.    strDisplay = strDisplay & "ASH Expand (order " & order & ")' " & File2 & "' to '" & File3 & "' is " & cASHFileExpand(File2, File3, order) & vbCrLf
  493.    strDisplay = strDisplay & "Compare File contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
  494.  
  495.    order = 2
  496.    strDisplay = strDisplay & "ASH Compress (order " & order & ")' " & File1 & "' to '" & File2 & "' is " & cASHFileCompress(File1, File2, order) & vbCrLf
  497.    strDisplay = strDisplay & "ASH Expand (order " & order & ")' " & File2 & "' to '" & File3 & "' is " & cASHFileExpand(File2, File3, order) & vbCrLf
  498.    strDisplay = strDisplay & "Compare File contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
  499.  
  500.    order = 3
  501.    strDisplay = strDisplay & "ASH Compress (order " & order & ")' " & File1 & "' to '" & File2 & "' is " & cASHFileCompress(File1, File2, order) & vbCrLf
  502.    strDisplay = strDisplay & "ASH Expand (order " & order & ")' " & File2 & "' to '" & File3 & "' is " & cASHFileExpand(File2, File3, order) & vbCrLf
  503.    strDisplay = strDisplay & "Compare File contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
  504.  
  505.    order = 4
  506.    strDisplay = strDisplay & "ASH Compress (order " & order & ")' " & File1 & "' to '" & File2 & "' is " & cASHFileCompress(File1, File2, order) & vbCrLf
  507.    strDisplay = strDisplay & "ASH Expand (order " & order & ")' " & File2 & "' to '" & File3 & "' is " & cASHFileExpand(File2, File3, order) & vbCrLf
  508.    strDisplay = strDisplay & "Compare File contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
  509.  
  510.    txt_Result = strDisplay
  511.  
  512.    'time the function
  513.  
  514.    TimerHandle = cTimerOpen()
  515.    TimerStartOk = cTimerStart(TimerHandle)
  516.    
  517.    For i = 1 To Iteration
  518.       lResult = cASHFileCompress(File1, File2, 0)
  519.    Next i
  520.    
  521.    lResult = cASHFileExpand(File2, File3, 0)
  522.    
  523.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  524.    
  525.    TimerCloseOk = cTimerClose(TimerHandle)
  526.  
  527. End Sub
  528.  
  529.  
  530.