VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Virtual Hypnotist Package Installer"
   ClientHeight    =   2925
   ClientLeft      =   4215
   ClientTop       =   2925
   ClientWidth     =   4665
   Icon            =   "Form1.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   2925
   ScaleWidth      =   4665
   Begin VB.TextBox Text2 
      Height          =   1335
      Left            =   840
      Locked          =   -1  'True
      MultiLine       =   -1  'True
      ScrollBars      =   3  'Both
      TabIndex        =   4
      Top             =   1440
      Width           =   3135
   End
   Begin VB.TextBox Text1 
      Height          =   525
      Left            =   600
      Locked          =   -1  'True
      MultiLine       =   -1  'True
      ScrollBars      =   1  'Horizontal
      TabIndex        =   3
      Top             =   240
      Width           =   3615
   End
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   120
      Top             =   720
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Install Package"
      Enabled         =   0   'False
      Height          =   375
      Left            =   840
      TabIndex        =   2
      Top             =   960
      Width           =   1455
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Select File"
      Height          =   375
      Left            =   2640
      TabIndex        =   1
      Top             =   960
      Width           =   1335
   End
   Begin VB.Label Label1 
      Caption         =   "File:"
      Height          =   255
      Left            =   120
      TabIndex        =   0
      Top             =   240
      Width           =   495
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Virtual Hypnotist Package Installer
'©2005 FollowTheWatch Software
'http://vhypno.sourceforge.net
'http://sourceforge.net/projects/vhypno
'Contact - followthewatch55@yahoo.com

'This program is free software; you can redistribute it and/or
'modify it under the terms of the GNU General Public License
'as published by the Free Software Foundation; either version 2
'of the License, or (at your option) any later version.

'This program is distributed in the hope that it will be useful,
'but WITHOUT ANY WARRANTY; without even the implied warranty of
'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'GNU General Public License for more details.

'You should have received a copy of the GNU General Public License
'along with this program; if not, write to the Free Software
'Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

Private WithEvents m_cUnzip As cUnzip
Attribute m_cUnzip.VB_VarHelpID = -1
Option Explicit

Private Sub Command1_Click()
'CommonDialog1.FileName = ""

On Error GoTo 323
CommonDialog1.InitDir = App.Path
CommonDialog1.CancelError = True
CommonDialog1.DefaultExt = ".vhpack"
CommonDialog1.Filter = "Virtual Hypnotist Package (*.vhpack)|*.vhpack|"
'CommonDialog1.DefaultExt = ".zip"
'CommonDialog1.Filter = "Virtual Hypnotist Package (*.zip)|*.zip|"
CommonDialog1.DialogTitle = "Select Package"
CommonDialog1.Action = 1

Text1.Text = CommonDialog1.Filename
m_cUnzip.ZipFile = CommonDialog1.Filename

323 Exit Sub
End Sub

Private Sub Command2_Click()
Text2.Text = ""
 
 ' Set the zip file:
   m_cUnzip.UseFolderNames = True
   m_cUnzip.PromptToOverwrite = True
   
   ' Set the base folder to unzip to:
   m_cUnzip.UnzipFolder = App.Path

   ' Unzip the file!
   m_cUnzip.Unzip
   
   Text2.Text = Text2.Text + vbCrLf + vbCrLf + "-Package Extracted-"
End Sub

Private Sub Form_Load()
Me.Left = (Screen.Width / 2) - (Me.Width / 2)
Me.Top = (Screen.Height / 2) - (Me.Height / 2)
Set m_cUnzip = New cUnzip

'Process command line parameters
    If InStr(1, LCase$(Command$), "vhpack") <> 0 Then
        Text1.Text = Replace(Command$, """", "")
        m_cUnzip.ZipFile = Text1.Text
    End If
End Sub

Private Sub Text1_Change()
Command2.Enabled = True
End Sub

Private Sub m_cUnzip_OverWritePrompt(ByVal sFIle As String, eResponse As EUZOverWriteResponse)
   Dim fO As New frmOverwrite
   With fO
      .TheCaption = "Do you want to overwrite the existing copy of " & sFIle & "?"
      fO.Show vbModal, Me
      If fO.Response = vbYes Then
         If fO.ApplyToAll Then
            eResponse = euzOverwriteAllFiles
         Else
            eResponse = euzOverwriteThisFile
         End If
      ElseIf fO.Response = vbNo Then
         If fO.ApplyToAll Then
            eResponse = euzOverwriteNone
         Else
            eResponse = euzDoNotOverwrite
         End If
      Else
         ' Hmmm...
         eResponse = euzOverwriteNone
      End If
   End With
   
End Sub

Private Sub m_cUnzip_Progress(ByVal lCount As Long, ByVal sMsg As String)
   sMsg = Replace(sMsg, App.Path + "\", "")
   Text2.Text = Text2.Text + vbCrLf + sMsg
End Sub

