home *** CD-ROM | disk | FTP | other *** search
/ Cómo funcionan las cosas / DKMMTWTW.iso / dksetup / dksetup.bak < prev    next >
Text File  |  1995-07-27  |  8KB  |  287 lines

  1. ''$DEFINE DEBUG
  2. '$INCLUDE 'dkgen.inc'
  3.  
  4. ' Paths and INI stuff
  5. CONST APPLICATION_INI_FILE = "twtw.ini"
  6. CONST APPLICATION_EXE_FILE = "twtw.exe"
  7. CONST APPLICATION_PENGE_FILE = "twtw.png"
  8.  
  9. CONST INI_FILE_SOURCE = "WinPath" ' OR "AppPath"
  10.  
  11. ' Language dependant strings
  12. CONST APPLICATION_README_FILE = "leame.txt"
  13. CONST STR_README = "LΘame"
  14. CONST STR_MSGCAPTION = "Instalaci≤n de C≤mo Funcionan Las Cosas"
  15.  
  16. CONST STR_PRODUCTNAME = "C≤mo Funcionan Las Cosas"
  17. CONST DEFAULT_INSTALL_PATH = "\DKMM\TWTW"
  18.  
  19. DECLARE SUB Install()
  20. DECLARE SUB AddFilesToCopyList(szInstallType$)
  21.  
  22. DECLARE FUNCTION IsCDROMDrive Lib "dkutils.dll" (wDrive%) AS INTEGER
  23.  
  24.  
  25. Init:
  26.     Initialise STR_PRODUCTNAME, DEFAULT_INSTALL_PATH, STR_MSGCAPTION
  27.  
  28. WelcomeDlg:
  29.     if Welcome() = NAV_BACK then
  30.         ' Don nothing - cant go back
  31.     end if
  32.  
  33.     if TestSystem() = NAV_BACK then
  34.         goto WelcomeDlg
  35.     end if
  36.  
  37. ExpressCustomDlg:
  38.     ' defaults to Express
  39.     'if szExpressCustomChoice = "EXPRESS" then
  40.     '    SetSymbolValue "RadioDefault", "1"
  41.     'else
  42.     '    SetSymbolValue "RadioDefault", "1"
  43.     'end if
  44.  
  45. ECDlgLoop:
  46.     szButton = UIStartDlg(CUIDLL_FILENAME, IDD_SPEED, "FRadioDlgProc", IDD_WHIZZHELP, PROC_HELP)
  47.  
  48.     select case szButton
  49.     case "REACTIVATE"
  50.         goto ECDlgLoop
  51.     case "BACK"
  52.         UIPop 1
  53.         goto WelcomeDlg
  54.     case "CONTINUE" ' Install
  55.         UIPop 1
  56.         if GetSymbolValue("ButtonChecked") = "1" then
  57.             szExpressCustomChoice = "EXPRESS"
  58.             goto ExpressInstallLoop
  59.         else
  60.             szExpressCustomChoice = "CUSTOM"
  61.             goto CustomInstallLoop
  62.         end if
  63.     case "EXIT"
  64.         AskQuit
  65.         goto ECDlgLoop
  66.     end select
  67.  
  68.  
  69. CustomInstallLoop:
  70. GetPathDlg:
  71.     SetSymbolValue "EditTextIn", szDestPath
  72.     szOldDestPath = szDestPath
  73.     SetSymbolValue "EditFocus", "ALL"
  74.  
  75. GetPathDlgLoop:
  76.     szButton = UIStartDlg(CUIDLL_FILENAME, IDD_DESTPATH, "FEditDlgProc", IDD_PATHHELP, PROC_HELP)
  77.  
  78.     select case szButton
  79.     case "REACTIVATE"
  80.         goto GetPathDlgLoop
  81.  
  82.     case "BACK"
  83.         UIPop 1
  84.         szDestPath = szOldDestPath
  85.         goto ECDlgLoop
  86.  
  87.     case "CONTINUE"
  88.         UIPop 1
  89.         szDestPath = GetSymbolValue("EditTextOut")
  90.         if mid$(szDestPath, 2, 1) <> ":" then
  91.             if mid$(szDestPath, 1,1) <> "\" then
  92.                 szDestPath = mid$(szWinPath, 1,1) + ":\" + szDestPath
  93.             else
  94.                 szDestPath = mid$(szWinPath, 1,1) + ":" + szDestPath
  95.             end if
  96.         elseif IsDriveValid(mid$(szDestPath, 1,1)) = 0 then
  97.             szDestPath = szOldDestPath
  98.             UIPop 1
  99.             BadPath
  100.             goto GetPathDlg
  101.         end if
  102.  
  103.         wDrive% = asc(mid$(szDestPath, 1,1)) - asc("A")
  104.         if IsCDROMDrive(wDrive%) = 1 then
  105.         'if IsDirWritable(szDestPath) = 0 then
  106.             szDestPath = szOldDestPath
  107.             UIPop 1
  108.             BadPath
  109.             goto GetPathDlg
  110.         end if
  111.  
  112.         if IsDriveNetwork(mid$(szDestPath,1,1)) = 1 then
  113.             szDestPath = szOldDestPath
  114.             UIPop 1
  115.             NetworkDrive
  116.             goto GetPathDlg
  117.         end if
  118.  
  119.         if DoesDirExist(szDestPath) = 0 then
  120.             dButton = DoMsgBox( STR_DIRNOTEXIST, STR_MSGCAPTION, MB_OK+MB_TASKMODAL+MB_ICONHAND)
  121.             if dButton = 7 then
  122.                 goto GetPathDlg
  123.             end if
  124.         end if
  125.         UIPop 1
  126.  
  127.     case "EXIT"
  128.         AskQuit
  129.         goto GetPathDlg
  130.     end select
  131.  
  132. GetCustomChoicesDlg:
  133.     SetSymbolValue "CheckItemsState", ""
  134.     AddListItem "CheckItemsState", szMinimalInstall
  135.     AddListItem "CheckItemsState", szAddPMItem
  136.  
  137. GetCustomChoicesLoop:
  138.  
  139.     ClearCopyList
  140.     if szMinimalInstall = "OFF" then
  141.         AddFilesToCopyList "FULL"
  142.     else
  143.         AddFilesToCopyList "MINIMAL"
  144.     end if
  145.  
  146.     dDestDrive = asc(mid$(szDestPath, 1,1)) - asc("A")+1
  147.     dWinDrive = asc(mid$(szWinPath, 1,1)) - asc("A")+1
  148.  
  149.     SetSymbolValue "DriveStatusText", ""
  150.     AddListItem "DriveStatusText", mid$(szDestPath, 1,1) + ":"
  151.     AddListItem "DriveStatusText", str$(GetDiskSpaceNeeded(dDestDrive) / 1024) + " K"
  152.     AddListItem "DriveStatusText", str$(GetFreeSpaceForDrive(mid$(szDestPath, 1,1))/1024) + " K"
  153.  
  154.     if dDestDrive = dWinDrive then
  155.         AddListItem "DriveStatusText", ""
  156.         AddListItem "DriveStatusText", ""
  157.         AddListItem "DriveStatusText", ""
  158.     else
  159.         AddListItem "DriveStatusText", mid$(szWinPath, 1,1) + ":"
  160.         AddListItem "DriveStatusText", str$(GetDiskSpaceNeeded(dWinDrive)/ 1024 ) + " K"
  161.         AddListItem "DriveStatusText", str$(GetFreeSpaceForDrive(mid$(szWinPath, 1,1))/1024) + " K"
  162.     end if
  163.  
  164.     AddListItem "DriveStatusText", szDestPath
  165.  
  166.     szButton = UIStartDlg(CUIDLL_FILENAME, IDD_CUSTOM, "FCustInstDlgProc", IDD_CUSTOMHELP, PROC_HELP)
  167.  
  168.     szMinimalInstall = GetListItem("CheckItemsState", 1)
  169.     szAddPMItem = GetListItem("CheckItemsState", 2)
  170.  
  171.     select case szButton
  172.     case "REACTIVATE"
  173.         goto GetCustomChoicesLoop
  174.     case "BACK"
  175.         UIPop 1
  176.         goto GetPathDlg
  177.     case "CONTINUE"
  178.         UIPop 1
  179.     case "EXIT"
  180.         AskQuit
  181.         goto GetCustomChoicesLoop
  182.     end select
  183.  
  184.     ClearCopyList
  185.     if szMinimalInstall = "OFF" then
  186.         AddFilesToCopyList "FULL"
  187.     else
  188.         AddFilesToCopyList "MINIMAL"
  189.     end if
  190.  
  191.  
  192. ExpressInstallLoop:
  193.     AddFilesToCopyList "FULL"
  194.     goto CommonInstallLoop
  195.  
  196. CommonInstallLoop:
  197.     InitCommonInstall
  198.  
  199.     if szMinimalInstall = "ON" and GetFreeSpaceForDrive(mid$(szDestPath,1,1)) < MINIMUM_DISK_SPACE then
  200.         error ERR_NODISKSPACE
  201.     elseif GetFreeSpaceForDrive(mid$(szDestPath,1,1)) < GetDiskSpaceNeeded( asc(mid$(szDestPath, 1,1))-asc("A")+1 ) then
  202.         error ERR_NODISKSPACE
  203.     end if
  204.  
  205.     UpdateADPCMDrivers
  206.     Install
  207.     UpdateProgramManager STR_PRODUCTNAME, APPLICATION_EXE_FILE, APPLICATION_PENGE_FILE, APPLICATION_README_FILE, STR_README, FALSE
  208.  
  209. '$IFDEF DEBUG
  210.     DumpCopyList MakePath(szDestPath, "copylist.txt")
  211. '$ENDIF ''DEBUG
  212.  
  213.     EndCommonInstall APPLICATION_README_FILE, 0
  214.  
  215. quit:
  216.     on error goto quit
  217.  
  218.     select case ERR
  219.  
  220.     case 0
  221.         hDlg = IDD_EXITSUCCESS
  222.     case STFQUIT
  223.         hDlg = IDD_EXITQUIT
  224.     case ERR_NODISKSPACE
  225.         hDlg = IDD_NODISKSPACE
  226.     case else
  227.         hDlg = IDD_EXITFAILURE
  228.     end select
  229.  
  230.     UIPop 10
  231. quit2:
  232.     szButton = UIStartDlg(CUIDLL_FILENAME, hDlg, "FInfo0DlgProc", 0, "")
  233.     select case szButton
  234.     case "REACTIVATE"
  235.         goto quit2
  236.     end select
  237.  
  238.     UIPop 1
  239.     stop
  240.     end
  241.  
  242. quitError:
  243.     dButton = DoMsgBox (STR_QUITERROR, STR_MSGCAPTION, MB_OK+MB_TASKMODAL+MB_ICONHAND)
  244.     end
  245.  
  246. Finish:
  247.     DeInitialise
  248.     stop
  249.     end
  250.  
  251.  
  252.  
  253. Sub Install() STATIC
  254.  
  255.     cursor% = ShowWaitCursor()
  256.     CreateDir szDestPath, cmoNone
  257.     SetRestartDir szDestPath
  258.     RestoreCursor(cursor%)
  259.  
  260.     CopyFilesInCopyList
  261.  
  262.     if INI_FILE_SOURCE = "AppPath" then
  263.         szAppINIPath = MakePath(szDestPath, APPLICATION_INI_FILE)
  264.     else
  265.         szAppINIPath = MakePath(szWinPath, APPLICATION_INI_FILE)
  266.     end if
  267.  
  268.     szPengePath = mid$(szSrcSetupPath, 1,len(szSrcSetupPath)-len(SOURCE_SETUP_SUBDIR)-2) ' -2 removes backslash
  269.     CreateIniKeyValue szAppINIPath, PRODUCT_INI_DIR_SECTION_NAME, PRODUCT_INI_DIR_ENTRY_NAME, szPengePath, cmoOverwrite
  270. End Sub
  271.  
  272.  
  273. Sub AddFilesToCopyList(szInstallType$) STATIC
  274.     cursor% = ShowWaitCursor()
  275.  
  276.     select case szInstallType
  277.     case "FULL"
  278.         AddSectionFilesToCopyList SETUP_INI_BINARIES_SECTION_NAME, szSrcBinPath, szDestPath
  279.     case "MINIMAL"
  280.         rem
  281.     end select
  282.     AddSectionFilesToCopyList "ACM Drivers", szSrcBinPath, szWinSysPath
  283.     RestoreCursor(cursor%)
  284. End Sub
  285.  
  286.  
  287.