home *** CD-ROM | disk | FTP | other *** search
/ P.B. Bear's Birthday Party / DKMMPBBP.iso / dksetup / dksetup.bak < prev    next >
Text File  |  1995-05-18  |  11KB  |  353 lines

  1. '$DEFINE DEBUG
  2. '$INCLUDE 'dkgen.inc'
  3.  
  4. ' Paths and INI stuff
  5. CONST APPLICATION_INI_FILE = "PBBEAR.ini"
  6. CONST APPLICATION_EXE_FILE = "PBBEAR.exe"
  7. CONST APPLICATION_EXE2_FILE = "dksd2pc.exe"
  8. CONST APPLICATION_MENU_FILE = "custmenu.exe"
  9. CONST APPLICATION_PENGE_FILE = "PBBEAR.png"
  10.  
  11. CONST INI_FILE_SOURCE = "WinPath" ' OR "AppPath"
  12.  
  13. ' Language dependant strings
  14. CONST APPLICATION_README_FILE = "readme.wri"
  15. 'CONST APPLICATION_README_FILE2 = "readme2.txt"
  16. CONST STR_README = "PB Bear's Birthday Party Read Me"
  17. CONST STR_MSGCAPTION = "PB Bear's Birthday Party Setup"
  18.  
  19. CONST STR_PRODUCTNAME = "PB Bear's Birthday Party"
  20. CONST DEFAULT_INSTALL_PATH = "\DKMM\PBBEAR"
  21.  
  22. CONST SAMPLER_PATH = "SAMPLER"
  23.  
  24.  
  25. DECLARE SUB Install()
  26. DECLARE SUB AddFilesToCopyList(szInstallType$)
  27.  
  28. DECLARE FUNCTION IsCDROMDrive LIB "dkutils.dll" (wDrive%) As INTEGER
  29.  
  30.  
  31. Init:
  32.    Initialise STR_PRODUCTNAME, DEFAULT_INSTALL_PATH, STR_MSGCAPTION
  33.  
  34.  
  35. WelcomeDlg:
  36.     if Welcome() = NAV_BACK then
  37.         ' Don nothing - cant go back
  38.     end if
  39.  
  40.     if TestSystem() = NAV_BACK then
  41.         goto WelcomeDlg
  42.     end if
  43.  
  44.  
  45. ExpressCustomDlg:
  46.     ' defaults to Express
  47.     'if szExpressCustomChoice = "EXPRESS" then
  48.     '    SetSymbolValue "RadioDefault", "1"
  49.     'else
  50.     '    SetSymbolValue "RadioDefault", "1"
  51.     'end if
  52.  
  53. ECDlgLoop:
  54.     szButton = UIStartDlg(CUIDLL_FILENAME, IDD_SPEED, "FRadioDlgProc", IDD_WHIZZHELP, PROC_HELP)
  55.  
  56.     select case szButton
  57.     case "REACTIVATE"
  58.         goto ECDlgLoop
  59.     case "BACK"
  60.         UIPop 1
  61.         goto WelcomeDlg
  62.     case "CONTINUE" ' Install
  63.         UIPop 1
  64.         if GetSymbolValue("ButtonChecked") = "1" then
  65.             szExpressCustomChoice = "EXPRESS"
  66.             goto ExpressInstallLoop
  67.         else
  68.             szExpressCustomChoice = "CUSTOM"
  69.             goto CustomInstallLoop
  70.         end if
  71.     case "EXIT"
  72.         AskQuit
  73.         goto ECDlgLoop
  74.     end select
  75.  
  76.  
  77. CustomInstallLoop:
  78. GetPathDlg:
  79.     SetSymbolValue "EditTextIn", szDestPath
  80.     szOldDestPath = szDestPath
  81.     SetSymbolValue "EditFocus", "ALL"
  82.  
  83. GetPathDlgLoop:
  84.     szButton = UIStartDlg(CUIDLL_FILENAME, IDD_DESTPATH, "FEditDlgProc", IDD_PATHHELP, PROC_HELP)
  85.  
  86.     select case szButton
  87.     case "REACTIVATE"
  88.         goto GetPathDlgLoop
  89.  
  90.     case "BACK"
  91.         UIPop 1
  92.         szDestPath = szOldDestPath
  93.         goto ECDlgLoop
  94.  
  95.     case "CONTINUE"
  96.         UIPop 1
  97.         szDestPath = GetSymbolValue("EditTextOut")
  98.  
  99.         if mid$(szDestPath, 2, 1) = ":" and mid$(szDestPath, 3, 1) <> "\" then
  100.             szTemp$ = mid$(szDestPath, 1, 2) + "\" + mid$(szDestPath, 3, len(szDestPath)-2)
  101.             szDestPath = szTemp
  102.         end if
  103.  
  104.         if mid$(szDestPath, 2, 1) <> ":" then
  105.             if mid$(szDestPath, 1,1) <> "\" then
  106.                 szDestPath = mid$(szWinPath, 1,1) + ":\" + szDestPath
  107.             else
  108.                 szDestPath = mid$(szWinPath, 1,1) + ":" + szDestPath
  109.             end if
  110.         elseif IsDriveValid(mid$(szDestPath, 1,1)) = 0 then
  111.             szDestPath = szOldDestPath
  112.             UIPop 1
  113.             BadPath
  114.             goto GetPathDlg
  115.         end if
  116.  
  117.         ' check for "foreign" chars in path
  118.         slength% = len(szDestPath)
  119.         found% = 0
  120.         for i% = 1 to slength%
  121.             if asc(mid$(szDestPath, i%, 1)) > 126 then
  122.                 found% = 1
  123.             end if
  124.         next i%
  125.         if found% = 1 then
  126.             szDestPath = szOldDestPath
  127.             UIPop 1
  128.             BadPath
  129.             goto GetPathDlg
  130.         end if
  131.  
  132.         wDrive% = asc(mid$(szDestPath, 1,1)) - asc("A")
  133.         if IsCDROMDrive(wDrive%) > 0 then
  134.             szDestPath = szOldDestPath
  135.             UIPop 1
  136.             BadPath
  137.             goto GetPathDlg
  138.         end if
  139.  
  140.         if IsDriveNetwork(mid$(szDestPath,1,1)) = 1 then
  141.             szDestPath = szOldDestPath
  142.             UIPop 1
  143.             NetworkDrive
  144.             goto GetPathDlg
  145.         end if
  146.  
  147.         if IsDirWritable(szDestPath) = 0 then
  148.             szDestPath = szOldDestPath
  149.             UIPop 1
  150.             BadPath
  151.             goto GetPathDlg
  152.         end if
  153.  
  154.   '      if DoesDirExist(szDestPath) = 0 then
  155.   '          dButton = DoMsgBox( STR_DIRNOTEXIST, STR_MSGCAPTION, MB_OK+MB_TASKMODAL+MB_ICONHAND)
  156.   '          if dButton = 7 then
  157.   '              goto GetPathDlg
  158.   '          end if
  159.   '      end if
  160.         UIPop 1
  161.  
  162.  
  163.     case "EXIT"
  164.         AskQuit
  165.         goto GetPathDlg
  166.     end select
  167.  
  168. GetCustomChoicesDlg:
  169.     SetSymbolValue "CheckItemsState", ""
  170.     AddListItem "CheckItemsState", szMinimalInstall
  171.     AddListItem "CheckItemsState", szAddPMItem
  172. GetCustomChoicesLoop:
  173.  
  174.     ClearCopyList
  175.     if szMinimalInstall = "OFF" then
  176.         AddFilesToCopyList "FULL"
  177.     else
  178.         AddFilesToCopyList "MINIMAL"
  179.     end if
  180.  
  181.     dDestDrive = asc(mid$(szDestPath, 1,1)) - asc("A")+1
  182.     dWinDrive = asc(mid$(szWinPath, 1,1)) - asc("A")+1
  183.  
  184.     SetSymbolValue "DriveStatusText", ""
  185.     AddListItem "DriveStatusText", mid$(szDestPath, 1,1) + ":"
  186.     AddListItem "DriveStatusText", str$(GetDiskSpaceNeeded(dDestDrive) / 1024) + " K"
  187.     AddListItem "DriveStatusText", str$(GetFreeSpaceForDrive(mid$(szDestPath, 1,1))/1024) + " K"
  188.  
  189.     if dDestDrive = dWinDrive then
  190.         AddListItem "DriveStatusText", ""
  191.         AddListItem "DriveStatusText", ""
  192.         AddListItem "DriveStatusText", ""
  193.     else
  194.         AddListItem "DriveStatusText", mid$(szWinPath, 1,1) + ":"
  195.         AddListItem "DriveStatusText", str$(GetDiskSpaceNeeded(dWinDrive)/ 1024 ) + " K"
  196.         AddListItem "DriveStatusText", str$(GetFreeSpaceForDrive(mid$(szWinPath, 1,1))/1024) + " K"
  197.     end if
  198.  
  199.     AddListItem "DriveStatusText", szDestPath
  200.  
  201. ChooseInstall:
  202.  
  203.     szButton = UIStartDlg(CUIDLL_FILENAME, IDD_CUSTOM, "FCustInstDlgProc", IDD_CUSTOMHELP, PROC_HELP)
  204.  
  205.     szMinimalInstall = GetListItem("CheckItemsState", 1)
  206.     szAddPMItem = GetListItem("CheckItemsState", 2)
  207.  
  208.     select case szButton
  209.     case "REACTIVATE"
  210.         goto GetCustomChoicesLoop
  211.     case "BACK"
  212.         UIPop 1
  213.         goto GetPathDlg
  214.     case "CONTINUE"
  215.         UIPop 1
  216.     case "EXIT"
  217.         AskQuit
  218.         goto GetCustomChoicesLoop
  219.     end select
  220.  
  221.     ClearCopyList
  222.     if szMinimalInstall = "OFF" then
  223.         AddFilesToCopyList "FULL"
  224.     else
  225.         AddFilesToCopyList "MINIMAL"
  226.     end if
  227.     goto CommonInstallLoop
  228.  
  229. ExpressInstallLoop:
  230.     AddFilesToCopyList "FULL"
  231.     goto CommonInstallLoop
  232.  
  233. CommonInstallLoop:
  234.     InitCommonInstall
  235.  
  236.     if szMinimalInstall = "ON" and GetFreeSpaceForDrive(mid$(szDestPath,1,1)) < MINIMUM_DISK_SPACE then
  237.         error ERR_NODISKSPACE
  238.     elseif GetFreeSpaceForDrive(mid$(szDestPath,1,1)) < GetDiskSpaceNeeded( asc(mid$(szDestPath, 1,1))-asc("A")+1 ) then
  239.         error ERR_NODISKSPACE
  240.     end if
  241.  
  242.     UpdateIndeoAVIDrivers
  243.  
  244.     Install
  245.  
  246.     CreateProgmanGroup STR_COMPANYNAME, "", cmoNone
  247.     ShowProgmanGroup   STR_COMPANYNAME, 1, cmoNone
  248.     szReadmeTitle$ = STR_PRODUCTNAME + " " + STR_README
  249.  
  250.     szSamplerPath$ = MakePath( mid$(szSrcSetupPath, 1, (len(szSrcSetupPath) - len(SOURCE_SETUP_SUBDIR))-1), SAMPLER_PATH)
  251.     szSamplerPath$ = MakePath(szSamplerPath$, APPLICATION_EXE2_FILE)
  252.  
  253.     if szMinimalInstall = "ON" then
  254.         szInf$ = MakePath(szSrcBinPath, APPLICATION_MENU_FILE) + " " + MakePath(szSrcBinPath, APPLICATION_EXE_FILE) + " " + MakePath(szSrcBinPath, APPLICATION_PENGE_FILE) + " " + szSamplerPath$
  255.         CreateProgmanItem STR_COMPANYNAME, STR_PRODUCTNAME, szInf, szInf, cmoOverwrite
  256.         CreateProgmanItem STR_COMPANYNAME, STR_README, "write.exe " + MakePath(szSrcBinPath, APPLICATION_README_FILE), "", cmoOverwrite
  257.     else
  258.         szInf$ = MakePath(szDestPath, APPLICATION_MENU_FILE) + " " + MakePath(szDestPath, APPLICATION_EXE_FILE) + " " + MakePath(szDestPath, APPLICATION_PENGE_FILE) + " " + szSamplerPath$
  259.         CreateProgmanItem STR_COMPANYNAME, STR_PRODUCTNAME, szInf, szInf, cmoOverwrite
  260.         CreateProgmanItem STR_COMPANYNAME, STR_README, "write.exe " + MakePath(szDestPath, APPLICATION_README_FILE), "", cmoOverwrite
  261.     end if
  262.  
  263. '$IFDEF DEBUG
  264.     DumpCopyList MakePath(szDestPath, "copylist.txt")
  265. '$ENDIF ''DEBUG
  266.  
  267.     EndCommonInstall APPLICATION_README_FILE, 0
  268.  
  269. quit:
  270.     on error goto quit
  271.  
  272.     select case ERR
  273.  
  274.     case 0
  275.         hDlg = IDD_EXITSUCCESS
  276.     case STFQUIT
  277.         hDlg = IDD_EXITQUIT
  278.     case ERR_NODISKSPACE
  279.         hDlg = IDD_NODISKSPACE
  280.     case else
  281.         hDlg = IDD_EXITFAILURE
  282.     end select
  283.  
  284.     UIPop 10
  285. quit2:
  286.     szButton = UIStartDlg(CUIDLL_FILENAME, hDlg, "FInfo0DlgProc", 0, "")
  287.     select case szButton
  288.     case "REACTIVATE"
  289.         goto quit2
  290.     end select
  291.  
  292.     UIPop 1
  293.     DeInitialise
  294.     stop
  295.     end
  296.  
  297. quitError:
  298.     dButton = DoMsgBox (STR_QUITERROR, STR_MSGCAPTION, MB_OK+MB_TASKMODAL+MB_ICONHAND)
  299.     DeInitialise
  300.     stop
  301.     end
  302.  
  303.  
  304.  
  305.  
  306. Sub Install() STATIC
  307.  
  308.     cursor% = ShowWaitCursor()
  309.     CreateDir szDestPath, cmoNone
  310.     SetRestartDir szDestPath
  311.     RestoreCursor(cursor%)
  312.  
  313.     CopyFilesInCopyList
  314.  
  315.     Run ("regedit.exe /s " + MakePath(szWinPath, "mplayer.reg"))
  316.     Run ("regedit.exe /s " + MakePath(szWinSysPath, "OLE2.reg"))
  317.     Run ("regedit.exe /s " + MakePath(szWinSysPath, "cleanup.reg"))
  318.     Run ("profdisp.exe")
  319.  
  320.     if INI_FILE_SOURCE = "AppPath" then
  321.         szAppINIPath = MakePath(szDestPath, APPLICATION_INI_FILE)
  322.     else
  323.         szAppINIPath = MakePath(szWinPath, APPLICATION_INI_FILE)
  324.     end if
  325.  
  326.     szPengePath = mid$(szSrcSetupPath, 1,len(szSrcSetupPath)-len(SOURCE_SETUP_SUBDIR)-2) ' -2 removes backslash
  327.     CreateIniKeyValue szAppINIPath, PRODUCT_INI_DIR_SECTION_NAME, PRODUCT_INI_DIR_ENTRY_NAME, szPengePath, cmoOverwrite
  328. End Sub
  329.  
  330.  
  331. Sub AddFilesToCopyList(szInstallType$) STATIC
  332.     cursor% = ShowWaitCursor()
  333.  
  334.     select case szInstallType
  335.     case "FULL"
  336.         AddSectionFilesToCopyList SETUP_INI_BINARIES_SECTION_NAME, szSrcBinPath, szDestPath
  337.  
  338.     case "MINIMAL"
  339.         ' nothing
  340.     end select
  341.  
  342. '    if fSystemUpdated = 1 then
  343.         AddSectionFilesToCopyList "VfW Runtime", szSrcBinPath, szWinSysPath
  344.         AddSectionFilesToCopyList "OLE2", szSrcBinPath, szWinSysPath
  345.         AddSectionFilesToCopyList "ACM Drivers", szSrcBinPath, szWinSysPath
  346.         AddSectionFilesToCopyList "MPlayer", szSrcBinPath, szWinPath
  347.         AddSectionFilesToCopyList "AVICodecs", szSrcBinPath, szWinSysPath
  348. '    end if
  349.     RestoreCursor(cursor%)
  350. End Sub
  351.  
  352.  
  353.