VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmPackage 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Package Maker"
   ClientHeight    =   6330
   ClientLeft      =   4500
   ClientTop       =   2175
   ClientWidth     =   7095
   Icon            =   "frmPackage.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   6330
   ScaleWidth      =   7095
   Begin VB.CommandButton Command5 
      Caption         =   "Help"
      Height          =   375
      Left            =   1680
      TabIndex        =   14
      ToolTipText     =   "Package maker help"
      Top             =   5760
      Width           =   855
   End
   Begin VB.CommandButton Command4 
      Caption         =   "Exit"
      Height          =   375
      Left            =   2640
      TabIndex        =   13
      ToolTipText     =   "Exit the Package Maker"
      Top             =   5760
      Width           =   975
   End
   Begin VB.TextBox lstLog 
      Height          =   2415
      Left            =   3840
      Locked          =   -1  'True
      MultiLine       =   -1  'True
      ScrollBars      =   3  'Both
      TabIndex        =   12
      Top             =   480
      Width           =   2655
   End
   Begin VB.CommandButton Command3 
      Caption         =   "Remove File"
      Height          =   375
      Left            =   5280
      TabIndex        =   8
      ToolTipText     =   "Remove selected file from package"
      Top             =   5640
      Width           =   1215
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Add File"
      Height          =   375
      Left            =   4080
      TabIndex        =   7
      ToolTipText     =   "Add file to package"
      Top             =   5640
      Width           =   1215
   End
   Begin VB.ListBox List2 
      Height          =   1620
      ItemData        =   "frmPackage.frx":08CA
      Left            =   3600
      List            =   "frmPackage.frx":08CC
      TabIndex        =   5
      ToolTipText     =   "These are the files to include in the package"
      Top             =   3720
      Width           =   3375
   End
   Begin VB.ListBox List1 
      Height          =   1620
      ItemData        =   "frmPackage.frx":08CE
      Left            =   120
      List            =   "frmPackage.frx":08D0
      TabIndex        =   3
      ToolTipText     =   "These are the files to not include in the package"
      Top             =   3720
      Width           =   3375
   End
   Begin VB.FileListBox File1 
      Height          =   2430
      Left            =   600
      TabIndex        =   1
      ToolTipText     =   "Select a saved session to package up"
      Top             =   480
      Width           =   2535
   End
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   0
      Top             =   0
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Create Package"
      Enabled         =   0   'False
      Height          =   375
      Left            =   120
      TabIndex        =   0
      ToolTipText     =   "Create a package file for distribution"
      Top             =   5760
      Width           =   1455
   End
   Begin VB.Label Label6 
      Alignment       =   2  'Center
      Caption         =   "Log:"
      Height          =   255
      Left            =   3960
      TabIndex        =   11
      Top             =   120
      Width           =   2415
   End
   Begin VB.Label Label5 
      Alignment       =   2  'Center
      Caption         =   "Name:"
      Height          =   255
      Left            =   3600
      TabIndex        =   10
      Top             =   3120
      Width           =   855
   End
   Begin VB.Label Label4 
      Height          =   255
      Left            =   4560
      TabIndex        =   9
      Top             =   3120
      Width           =   2175
   End
   Begin VB.Label Label3 
      Alignment       =   2  'Center
      Caption         =   "Package these files:"
      Height          =   255
      Left            =   4080
      TabIndex        =   6
      Top             =   3480
      Width           =   2415
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      Caption         =   "Files to not package:"
      Height          =   255
      Left            =   600
      TabIndex        =   4
      Top             =   3480
      Width           =   2415
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Caption         =   "Choose a session to package:"
      Height          =   255
      Left            =   600
      TabIndex        =   2
      Top             =   120
      Width           =   2535
   End
End
Attribute VB_Name = "frmPackage"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Virtual Hypnotist
'©2003-2008 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_cZip As cZip
Attribute m_cZip.VB_VarHelpID = -1
Private SessionName As String
Private SessionAuthor As String
Private SessionComments As String
Option Explicit

Private Sub AddFileToList(FileName As String)
If IsCustomFile(FileName) = False Then
    List1.AddItem FileName
Else
    List2.AddItem FileName
End If
End Sub

Private Sub Command1_Click()
CommonDialog1.FileName = ""

If ExceptionHandlers = True Then 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 = "Save Package"
CommonDialog1.action = 2
If ExceptionHandlers = True Then On Error GoTo 325
Dim FileExists As Boolean

Dim i As Integer
i = Len(Dir$(CommonDialog1.FileName))
If err Or i = 0 Then
    FileExists = False
    Else
        FileExists = True
End If
If FileExists = True Then
    If MsgBox("Replace existing file?", vbYesNo + vbQuestion + vbDefaultButton2, "Virtual Hypnotist") = vbNo Then Exit Sub
End If

Dim FileName As String

' Set the zip file:
m_cZip.ZipFile = CommonDialog1.FileName

m_cZip.Delete

m_cZip.StoreFolderNames = True

m_cZip.BasePath = App.path

' Make sure any previously zipped files are cleared:
m_cZip.ClearFileSpecs

'm_cZip.StoreDirectories = True

'Add comment
m_cZip.AddComment = True

' Add the name of the file you want to zip:
For i = 0 To List2.ListCount - 1
If InStr(1, List2.List(i), App.path) = 0 Then m_cZip.AddFileSpec List2.List(i)
Next i

' Create the zip!
m_cZip.Zip

' Check for success failure:
If Not (m_cZip.Success) Then GoTo 325

CommonDialog1.FileName = ""

323 Exit Sub
325 Call ErrorReport("An error occurred while saving the file.", vbExclamation)
End Sub

Private Sub Command2_Click()
Dim FileName As String
CommonDialog1.FileName = ""

If ExceptionHandlers = True Then On Error GoTo ErrorHandler
CommonDialog1.InitDir = App.path
CommonDialog1.CancelError = True
CommonDialog1.DefaultExt = ".*"
CommonDialog1.Filter = "All Files (*.*)|*.*|"
CommonDialog1.DialogTitle = "Add File"
CommonDialog1.action = 2
If InStr(1, CommonDialog1.FileName, App.path, vbTextCompare) > 0 Then
    FileName = Mid$(CommonDialog1.FileName, Len(App.path) + 2)
Else
    FileName = CommonDialog1.FileName
End If

List2.AddItem FileName

ErrorHandler:
Exit Sub
End Sub

Private Sub Command3_Click()
If List2.ListIndex <> -1 Then List2.RemoveItem (List2.ListIndex)
End Sub

Private Sub Command4_Click()
Me.Hide
End Sub

Private Sub Command5_Click()
If ExceptionHandlers = True Then On Error GoTo ErrorHandler

Shell "hh " + App.path + "\vh.chm::/packages.html", vbNormalFocus
Exit Sub

ErrorHandler:
err.Source = "Package Maker - Command5"
   Call ErrorReport("An error occurred while loading Windows HTML Help.", vbExclamation)
  
End Sub

Private Sub File1_Click()
Dim TempString As String
List1.Clear
List2.Clear
Open App.path + "\sessions\" + File1.FileName For Random As #1
Get #1, 2, TempString
If TempString <> "" Then AddFileToList ("inductions\" + TempString)
Get #1, 3, TempString
If TempString <> "" Then AddFileToList ("deepeners\" + TempString)
Get #1, 4, TempString
If TempString <> "" Then AddFileToList ("suggestions\" + TempString)
Get #1, 5, TempString
If TempString <> "" Then AddFileToList ("wakenings\" + TempString)
Get #1, 6, TempString
If TempString <> "" Then AddFileToList ("videos\" + TempString)
Get #1, 8, TempString
If TempString <> "" Then AddFileToList ("subliminals\" + TempString)
Get #1, 9, TempString
If TempString <> "" Then AddFileToList ("audio\" + TempString)
Get #1, 51, SessionName
Label4.Caption = SessionName
Get #1, 52, SessionAuthor
Get #1, 53, SessionComments
Close #1

Command1.Enabled = True
AddFileToList ("sessions\" + File1.FileName)
End Sub

Private Sub Form_Load()
Me.Left = (ScreenX / 2) - (Me.Width / 2)
Me.top = (ScreenY / 2) - (Me.Height / 2)
File1.path = App.path + "\sessions"
File1.Pattern = "*.hyp"
Set m_cZip = New cZip
End Sub

Private Function IsCustomFile(FileName As String) As Boolean
IsCustomFile = True
Select Case FileName
Case "audio\1.mp3"
    IsCustomFile = False
Case "audio\6.mp3"
    IsCustomFile = False
Case "audio\5.mp3"
    IsCustomFile = False
Case "audio\3.mp3"
    IsCustomFile = False
Case "audio\2.mp3"
    IsCustomFile = False
Case "audio\8.mp3"
    IsCustomFile = False
Case "videos\spurt.gif"
    IsCustomFile = False
Case "videos\spiral2.swf"
    IsCustomFile = False
Case "videos\pendulum1.gif"
    IsCustomFile = False
Case "videos\kscope.gif"
    IsCustomFile = False
Case "videos\illusion.avi"
    IsCustomFile = False
Case "videos\hypnovideo.m1v"
    IsCustomFile = False
Case "videos\hypnospiral.m1v"
    IsCustomFile = False
Case "videos\coolspiral.m1v"
    IsCustomFile = False
Case "videos\colors.m1v"
    IsCustomFile = False
Case "videos\watch.gif"
    IsCustomFile = False
Case "videos\christmas.gif"
    IsCustomFile = False
Case "videos\twirlingstars.gif"
    IsCustomFile = False
Case "videos\vortecmovesmall.gif"
    IsCustomFile = False
Case "videos\spurt2.gif"
    IsCustomFile = False
Case "videos\strange.gif"
    IsCustomFile = False
Case "videos\watch.gif"
    IsCustomFile = False
Case "videos\candle.avi"
    IsCustomFile = False
Case "videos\kaa.avi"
    IsCustomFile = False
Case "inductions\trigger.txt"
    IsCustomFile = False
Case "inductions\Seven_Plus_or_Minus_Two.txt"
    IsCustomFile = False
Case "inductions\longinduction.txt"
    IsCustomFile = False
Case "inductions\featuretest.txt"
    IsCustomFile = False
Case "inductions\eyeballs up.txt"
    IsCustomFile = False
Case "inductions\defaultinduct.txt"
    IsCustomFile = False
Case "inductions\confusion.txt"
    IsCustomFile = False
Case "inductions\association method.txt"
    IsCustomFile = False
Case "inductions\basic.txt"
    IsCustomFile = False
Case "inductions\spiral induction.txt"
    IsCustomFile = False
Case "deepeners\anesthesia.txt"
    IsCustomFile = False
Case "deepeners\longislanddeepener.txt"
    IsCustomFile = False
Case "deepeners\defaultdeep.txt"
    IsCustomFile = False
Case "deepeners\defaultdeep with question.txt"
    IsCustomFile = False
Case "deepeners\room of nothingness.txt"
    IsCustomFile = False
Case "suggestions\defaultsuggest.txt"
    IsCustomFile = False
Case "suggestions\triggersugg-voice.txt"
    IsCustomFile = False
Case "suggestions\triggersugg-indirect.txt"
    IsCustomFile = False
Case "suggestions\triggersugg.txt"
    IsCustomFile = False
Case "suggestions\successloop.txt"
    IsCustomFile = False
Case "suggestions\success.txt"
    IsCustomFile = False
Case "suggestions\Number Press.txt"
    IsCustomFile = False
Case "suggestions\Number Press 2.txt"
    IsCustomFile = False
Case "suggestions\Hand Drop-voice.txt"
    IsCustomFile = False
Case "suggestions\Hand Drop.txt"
    IsCustomFile = False
Case "wakenings\defaultwake.txt"
    IsCustomFile = False
Case "subliminals\defaultsub.txt"
    IsCustomFile = False
Case "inductions\SlaveTest.txt"
    IsCustomFile = False
Case "inductions\FreezeTest.txt"
    IsCustomFile = False
Case "inductions\DominantInduction.txt"
    IsCustomFile = False
Case "inductions\kaa induction.txt"
    IsCustomFile = False
Case "suggestions\TrigRobot.txt"
    IsCustomFile = False
Case "suggestions\TrigFreeze2.txt"
    IsCustomFile = False
Case "suggestions\stagehyp-all.txt"
    IsCustomFile = False
Case "suggestions\stagehyp6 - gender.txt"
    IsCustomFile = False
Case "suggestions\stagehyp5 - president.txt"
    IsCustomFile = False
Case "suggestions\stagehyp4 - alphabet.txt"
    IsCustomFile = False
Case "suggestions\stagehyp3 - age.txt"
    IsCustomFile = False
Case "suggestions\stagehyp2 - coldwarm.txt"
    IsCustomFile = False
Case "suggestions\stagehyp1 - arms.txt"
    IsCustomFile = False
Case "suggestions\hypnoslave-voice.txt"
    IsCustomFile = False
Case "suggestions\hypnoslave-snap.txt"
    IsCustomFile = False
Case "suggestions\hypnoslave.txt"
    IsCustomFile = False
Case "suggestions\TrigRobot-voice.txt"
    IsCustomFile = False
Case "suggestions\mindfrag.txt"
    IsCustomFile = False
Case "suggestions\mindfrag-fx.txt"
    IsCustomFile = False
Case "wakenings\forget.txt"
    IsCustomFile = False
Case "wakenings\obey.txt"
    IsCustomFile = False
End Select
   
End Function

Private Sub Form_Unload(Cancel As Integer)
Set m_cZip = Nothing
End Sub

Private Sub m_cZip_CommentRequest(sComment As String, bCancel As Boolean)
sComment = "Virtual Hypnotist Session Package" + vbCrLf + vbCrLf + "Session Name: " + SessionName + vbCrLf + "Author: " + SessionAuthor + vbCrLf + "Comments: " + SessionComments
End Sub

Private Sub m_cZip_Progress(ByVal lCount As Long, ByVal sMsg As String)
   lstLog.Text = lstLog.Text + vbCrLf + sMsg
End Sub

