Removed old installers

This commit is contained in:
Radegast 2012-11-10 15:47:52 +00:00
parent 85adb94cfa
commit 2d473bbba5
4 changed files with 0 additions and 782 deletions

View file

@ -1,294 +0,0 @@
####################################################
# Wolfenstein Enemy Territory - Legacy Project #
# Auto-generated by EclipseNSIS Script Wizard #
####################################################
Name "Wolfenstein ET: Legacy"
# FIXME/TODO
#
# add etlded to windows menu (done/feedback)
# rename this "ET: L" in installer options to ET:Legacy V2.70
# add +set fs_game legacy to etl and etlded (done/feedback)
# add option to set fs_hompath
# add options to complete install (missing genuine files)
# - do a search for installed W:ET and get the files from
# -- search by key
# -- search by user input path
# --- if install is found
# ---- add option to use key
# ---- copy mp_bin.pk3, pa0.pk3, pak1.pk3, pak2.pk3 to etmain
# -- ask to download and install genuine files
# --- run installer again
# --- worst case points to http://www.etlegacy.com/projects/etlegacy/wiki/Windows
# add omnibot files to installer options (default: true)
RequestExecutionLevel admin #NOTE: You still need to check user rights with UserInfo!
# General Symbol Definitions
!define REGKEY "SOFTWARE\$(^Name)"
!define VERSION "2.70 alpha (git ${__DATE__})"
!define COMPANY "ET:L Dev Team"
!define URL http://www.etlegacy.com
!define DL_URL http://mirror.etlegacy.com/installer
# MUI Symbol Definitions
!define MUI_ICON wolfet.ico
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
!define MUI_STARTMENUPAGE_REGISTRY_KEY ${REGKEY}
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "WolfET Legacy"
!define MUI_FINISHPAGE_SHOWREADME ""
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
!define MUI_FINISHPAGE_SHOWREADME_TEXT $(^CreateDesktopShortcut)
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION finishpageaction
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\win-uninstall.ico"
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
!define MUI_LANGDLL_REGISTRY_ROOT HKLM
!define MUI_LANGDLL_REGISTRY_KEY ${REGKEY}
!define MUI_LANGDLL_REGISTRY_VALUENAME InstallerLanguage
# Included files
!include Sections.nsh
!include MUI2.nsh
# Reserved Files
!insertmacro MUI_RESERVEFILE_LANGDLL
# Variables
Var StartMenuGroup
Var FileToDownload
# Installer pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE COPYING.txt
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
# Installer languages
!insertmacro MUI_LANGUAGE English
!insertmacro MUI_LANGUAGE Czech
!insertmacro MUI_LANGUAGE German
!insertmacro MUI_LANGUAGE Polish
# Installer attributes
OutFile etlegacy-2.70-git-${__DATE__}-setup.exe
InstallDir "$PROGRAMFILES\WolfET Legacy"
CRCCheck on
XPStyle on
ShowInstDetails show
VIProductVersion 2.70.0.0
VIAddVersionKey /LANG=${LANG_ENGLISH} ProductName "Wolfenstein Enemy Territory: Legacy"
VIAddVersionKey /LANG=${LANG_ENGLISH} ProductVersion "${VERSION}"
VIAddVersionKey /LANG=${LANG_ENGLISH} CompanyName "${COMPANY}"
VIAddVersionKey /LANG=${LANG_ENGLISH} CompanyWebsite "${URL}"
VIAddVersionKey /LANG=${LANG_ENGLISH} FileVersion "${VERSION}"
VIAddVersionKey /LANG=${LANG_ENGLISH} FileDescription "Wolfenstein Enemy Territory: Legacy - best multiplayer game ever."
VIAddVersionKey /LANG=${LANG_ENGLISH} LegalCopyright "GNU GENERAL PUBLIC LICENSE V3"
InstallDirRegKey HKLM "${REGKEY}" Path
ShowUninstDetails show
# Installer sections
Section !ET:L MainProgram
SectionIn RO ;mark section as mandatory
SetOutPath $INSTDIR
SetOverwrite on
File etl.exe
File etlded.exe
File wolfet.ico
File libcurl.dll
;File libfreetype-6.dll
File README-libjpeg-8.txt
File libjpeg-8.dll
File README-SDL.txt
File SDL.dll
SetOutPath $INSTDIR\etmain
File etmain\etl_server.cfg
File etmain\lmscycle.cfg
File etmain\objectivecycle.cfg
File etmain\campaigncycle.cfg
SetOutPath $INSTDIR\legacy
File legacy\etl_bin.pk3
File legacy\pak3.pk3
File legacy\qagame_mp_x86.dll
SetOutPath $DESKTOP
WriteRegStr HKLM "${REGKEY}\Components" ET:L 1
SectionEnd
# Distributing these files is illegal
# we have to find another way.
;Section "Download required datafiles" GameData
; StrCpy $FileToDownload "pak0.pk3"
; Call Download
; StrCpy $FileToDownload "pak1.pk3"
; Call Download
; StrCpy $FileToDownload "pak2.pk3"
; Call Download
; StrCpy $FileToDownload "mp_bin.pk3"
; Call Download
;SectionEnd
Function Download
StrCpy $2 "$INSTDIR\etmain\$FileToDownload"
nsisdl::download /TIMEOUT=30000 ${DL_URL}/$FileToDownload $2
Pop $R0 ;get the return value
StrCmp $R0 "success" +3
MessageBox MB_OK "Download failed: $R0"
Quit
;MessageBox MB_OK "Download complete: $R0"
Return
FunctionEnd
Function finishpageaction
CreateShortcut "$DESKTOP\ET Legacy.lnk" "$INSTDIR\etl.exe" "+set fs_game legacy" "$INSTDIR\wolfet.ico"
CreateShortcut "$DESKTOP\ET Legacy dedicated.lnk" "$INSTDIR\etlded.exe" "+set fs_game legacy" "$INSTDIR\wolfet.ico"
FunctionEnd
Section -post PostInstall
SetShellVarContext all
WriteRegStr HKLM "${REGKEY}" Path $INSTDIR
SetOutPath $INSTDIR
WriteUninstaller $INSTDIR\uninstall.exe
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
SetOutPath $SMPROGRAMS\$StartMenuGroup
;CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$(^UninstallLink).lnk" $INSTDIR\uninstall.exe
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\ET Legacy.lnk" "$INSTDIR\etl.exe" "+set fs_game legacy" "$INSTDIR\wolfet.ico"
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\ET Legacy dedicated.lnk" "$INSTDIR\etlded.exe" "+set fs_game legacy" "$INSTDIR\wolfet.ico"
!insertmacro MUI_STARTMENU_WRITE_END
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1
SectionEnd
# Macro for selecting uninstaller sections
!macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID
Push $R0
ReadRegStr $R0 HKLM "${REGKEY}\Components" "${SECTION_NAME}"
StrCmp $R0 1 0 next${UNSECTION_ID}
!insertmacro SelectSection "${UNSECTION_ID}"
GoTo done${UNSECTION_ID}
next${UNSECTION_ID}:
!insertmacro UnselectSection "${UNSECTION_ID}"
done${UNSECTION_ID}:
Pop $R0
!macroend
# Uninstaller sections
Section /o -un.ET:L UNMainProgram
Delete /REBOOTOK "$DESKTOP\ET Legacy.lnk"
Delete /REBOOTOK "$DESKTOP\ET Legacy dedicated.lnk"
#etmain
Delete /REBOOTOK $INSTDIR\etmain\etl_server.cfg
Delete /REBOOTOK $INSTDIR\etmain\lmscycle.cfg
Delete /REBOOTOK $INSTDIR\etmain\objectivecycle.cfg
Delete /REBOOTOK $INSTDIR\etmain\campaigncycle.cfg
RmDir /r /REBOOTOK $INSTDIR\etmain ; this deletes EVERYTHING recursively! Maybe a bad idea.
#legacy
Delete /REBOOTOK $INSTDIR\legacy\pak3.pk3
Delete /REBOOTOK $INSTDIR\legacy\etl_bin.pk3
Delete /REBOOTOK $INSTDIR\legacy\qagame_mp_x86.dll
RmDir /r /REBOOTOK $INSTDIR\legacy ; this deletes EVERYTHING recursively! Maybe a bad idea.
#root
Delete /REBOOTOK $INSTDIR\SDL.dll
Delete /REBOOTOK $INSTDIR\README-SDL.txt
Delete /REBOOTOK $INSTDIR\README-libjpeg-8.txt
Delete /REBOOTOK $INSTDIR\libjpeg-8.dll
;Delete /REBOOTOK $INSTDIR\libfreetype-6.dll
Delete /REBOOTOK $INSTDIR\libcurl.dll
Delete /REBOOTOK $INSTDIR\etlded.exe
Delete /REBOOTOK $INSTDIR\etl.exe
Delete /REBOOTOK $INSTDIR\wolfet.ico
DeleteRegValue HKLM "${REGKEY}\Components" ET:L
SectionEnd
Section -un.post UNPostInstall
SetShellVarContext all
Delete "$DESKTOP\ET Legacy.lnk"
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
;Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\$(^UninstallLink).lnk"
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\ET Legacy.lnk"
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\ET Legacy dedicated.lnk"
RmDir /REBOOTOK "$SMPROGRAMS\$StartMenuGroup"
Delete /REBOOTOK $INSTDIR\uninstall.exe
DeleteRegValue HKLM "${REGKEY}" StartMenuGroup
DeleteRegValue HKLM "${REGKEY}" Path
DeleteRegKey /IfEmpty HKLM "${REGKEY}\Components"
DeleteRegKey /IfEmpty HKLM "${REGKEY}"
RmDir /REBOOTOK $INSTDIR
Push $R0
StrCpy $R0 $StartMenuGroup 1
StrCmp $R0 ">" no_smgroup
no_smgroup:
Pop $R0
SectionEnd
# Installer functions
Function .onInit
InitPluginsDir
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
# Uninstaller functions
Function un.onInit
ReadRegStr $INSTDIR HKLM "${REGKEY}" Path
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup
!insertmacro MUI_UNGETLANGUAGE
!insertmacro SELECT_UNSECTION ET:L ${UNMainProgram}
FunctionEnd
# Section Descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${MainProgram} $(MainProgram_DESC)
; !insertmacro MUI_DESCRIPTION_TEXT ${GameData} $(GameData_DESC)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
# Installer Language Strings
#
# ENGLISH
#
LangString ^UninstallLink ${LANG_ENGLISH} "Uninstall $(^Name)"
LangString MainProgram_DESC ${LANG_ENGLISH} "Game binaries"
LangString GameData_DESC ${LANG_ENGLISH} "Download game datafiles required to play, i.e. pak0.pk3, pak1.pk3, pak2.pk3 and mp_bin.pk3. You will NOT be able to play without them."
LangString ^CreateDesktopShortcut ${LANG_ENGLISH} "Create Desktop Shortcut"
#
# CZECH
#
LangString ^UninstallLink ${LANG_CZECH} "Odinstaluj $(^Name)"
LangString MainProgram_DESC ${LANG_CZECH} "Soubory se hrou"
LangString GameData_DESC ${LANG_CZECH} "Stáhnout soubory s herními daty, t.j. pak0.pk3, pak1.pk3, pak2.pk3 a mp_bin.pk3. Bez nich hru nebude možné spustit."
LangString ^CreateDesktopShortcut ${LANG_CZECH} "Vytvořit zástupce na ploše"
#
# GERMAN
#
LangString ^UninstallLink ${LANG_GERMAN} "Deinstallieren $(^Name)"
LangString MainProgram_DESC ${LANG_GERMAN} "Spiel Binaries"
LangString GameData_DESC ${LANG_GERMAN} "Lade die erforderlichen Spieledateien herunter, z.B. pak0.pk3, pak1.pk3, pak2.pk3 und mp_bin.pk3. Diese werden für das Spiel benötigt."
LangString ^CreateDesktopShortcut ${LANG_GERMAN} "Desktop Shortcut erstellen"
#
# POLISH
#
LangString ^UninstallLink ${LANG_POLISH} "Odinstaluj $(^Name)"
LangString MainProgram_DESC ${LANG_POLISH} "Pliki wykonywalne"
LangString GameData_DESC ${LANG_POLISH} "Pobierz pliki wymagane do gry. Są to pliki pak0.pk3, pak1.pk3, pak2.pk3 oraz mp_bin.pk3. Nie jest możliwe granie bez tych plików."
LangString ^CreateDesktopShortcut ${LANG_POLISH} "Create Desktop Shortcut"

View file

@ -1,170 +0,0 @@
; Script generated by the Inno Setup Script Wizard.
; TODO
; * fixme: windows text is scribbled on the Download page
; * (option) import etkey from W:ET 2.60b installation
; * (option) install omnibot files
; Inno Downloader script (had to be updated)
#include <./it_download.iss>
#define MyAppName "Enemy Territory - Legacy"
#define MyAppVersion "2.70"
#define MyAppPublisher "ET:L Team"
#define MyAppURL "http://www.etlegacy.com"
#define MyAppExeName "etl.exe"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{9695CADB-4A88-444C-9A0F-B1D27D15AE5F}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\Enemy Territory - Legacy
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
LicenseFile=files\COPYING.txt
InfoBeforeFile=intro.rtf
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "czech"; MessagesFile: "compiler:Languages\Czech.isl"
Name: "german"; MessagesFile: "compiler:Languages\German.isl"
Name: "polish"; MessagesFile: "compiler:Languages\Polish.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "files\etl.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "files\etlded.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "files\etl.ico"; DestDir: "{app}"; Flags: ignoreversion
Source: "files\legacy\*"; DestDir: "{app}\legacy\"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "files\libcurl.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "files\SDL.dll"; DestDir: "{app}"; Flags: ignoreversion
; W:ET 2.60b game data
Source: "{code:GetPakPath|pak0}"; DestDir: "{app}\etmain"; Flags: ignoreversion external
Source: "{code:GetPakPath|pak1}"; DestDir: "{app}\etmain"; Flags: ignoreversion external
Source: "{code:GetPakPath|pak2}"; DestDir: "{app}\etmain"; Flags: ignoreversion external
Source: "{code:GetPakPath|mp_bin}"; DestDir: "{app}\etmain"; Flags: ignoreversion external
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\etl.ico"
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\etl.ico"; Tasks: desktopicon
[Code]
var
pak0, pak1, pak2, mp_bin: String;
InstallDataPage: TInputOptionWizardPage;
EtmainDirPage: TInputDirWizardPage;
DownloadFiles: Boolean;
procedure InitializeWizard;
begin
InstallDataPage := CreateInputOptionPage(wpSelectDir,
'Required game data', 'You must have W:ET game datafiles in order to play ET:L',
'Do you want to download required data files (pak0.pk3, pak1.pk3, pak2.pk3, mp_bin.pk3)?'#10#10'If Wolfenstein: Enemy Territory 2.60b is already installed, select No, then click Next.',
True, False);
InstallDataPage.Add('Yes, download required files');
InstallDataPage.Add('No, copy files from W:ET installation');
// Set initial values (optional)
InstallDataPage.SelectedValueIndex := 0; // Default: Yes
// Let user choose the location of etmain directory
EtmainDirPage := CreateInputDirPage(InstallDataPage.ID,
'Select "etmain" directory inside W:ET 2.60b installation', '',
'Select the "etmain" folder inside your Wolfenstein: Enemy Territory 2.60b installation, then click Next.',
False, '');
EtmainDirPage.Add('');
// Locate W:ET 2.60b etmain directory
if RegQueryStringValue(HKLM, 'Software\Activision\Wolfenstein - Enemy Territory', 'InstallPath', InstallPath) then begin
EtmainDirPage.Values[0] := InstallPath + '\etmain'
end;
// Download W:ET data files
itd_init;
itd_downloadafter(wpReady);
end;
function ShouldSkipPage(PageID: Integer): Boolean;
begin
{ Skip pages that shouldn't be shown }
if (PageID = EtmainDirPage.ID) and not (InstallDataPage.SelectedValueIndex <> 0) then
Result := True
else
Result := False;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
if CurPageID = EtmainDirPage.ID then begin
pak0 := EtmainDirPage.Values[0] + '\pak0.pk3';
pak1 := EtmainDirPage.Values[0] + '\pak1.pk3';
pak2 := EtmainDirPage.Values[0] + '\pak2.pk3';
mp_bin := EtmainDirPage.Values[0] + '\mp_bin.pk3';
Result := False;
if not FileExists(pak0) then begin
MsgBox('Sorry, pak0.pk3 not found in ' + pak0, mbError, MB_OK)
exit;
end;
if not FileExists(pak1) then begin
MsgBox('Sorry, pak1.pk3 not found in ' + pak1, mbError, MB_OK)
exit;
end;
if not FileExists(pak2) then begin
MsgBox('Sorry, pak2.pk3 not found in ' + pak2, mbError, MB_OK)
exit;
end;
if not FileExists(mp_bin) then begin
MsgBox('Sorry, mp_bin.pk3 not found in ' + mp_bin, mbError, MB_OK)
exit;
end;
Result := True;
end else if (CurPageID = InstallDataPage.ID) and not (InstallDataPage.SelectedValueIndex <> 0) then begin
DownloadFiles := (InstallDataPage.SelectedValueIndex <> 0);
pak0 := expandconstant('{tmp}\pak0.pk3');
pak1 := expandconstant('{tmp}\pak1.pk3');
pak2 := expandconstant('{tmp}\pak2.pk3');
mp_bin := expandconstant('{tmp}\mp_bin.pk3');
itd_setstring(200, 'Downloading additional files');
itd_setstring(201, 'Please wait while setup downloads additional files...');
itd_addfile('http://mirror.etlegacy.com/etmain/pak0.pk3',pak0);
itd_addfile('http://mirror.etlegacy.com/etmain/pak1.pk3',pak1);
itd_addfile('http://mirror.etlegacy.com/etmain/pak2.pk3',pak2);
itd_addfile('http://mirror.etlegacy.com/etmain/mp_bin.pk3',mp_bin);
Result := True;
end else begin
Result := True;
end;
end;
function GetPakPath(pak: String): String;
begin
if pak = 'pak0' then begin
Result := pak0
end;
if pak = 'pak1' then begin
Result := pak1
end;
if pak = 'pak2' then begin
Result := pak2
end;
if pak = 'mp_bin' then begin
Result := mp_bin
end;
end;

Binary file not shown.

View file

@ -1,318 +0,0 @@
[Files]
Source: {#emit ReadReg(HKEY_LOCAL_MACHINE,'Software\Sherlock Software\InnoTools\Downloader','InstallPath','')}\itdownload.dll; Flags: dontcopy; DestDir: {tmp}
[Code]
(*
Inno Tools Downloader DLL
Copyright (C) Sherlock Software 2008
Version 0.3.5
Contact:
The author, Nicholas Sherlock, at nick@sherlocksoftware.org.
Comments, questions and suggestions welcome.
Website:
http://www.sherlocksoftware.org/
History:
0.3.5 - Moved strings used in the updater example to the language file, so that they
may be more easily translated.
Added event functions to support the example of integration with InnoTools tray.
Fixes bugs that could cause the download to hang until
some mouse movements were received.
Allows "detailed mode" to be turned on with ITD_SetOption
Allows the HTTP agent to be set with ITD_SetOption
0.3.4 - Added Brazilian Portuguese translation by Ronaldo Souza
0.3.3 - The "Hilbrand Edskes" release :), lots of suggestions and corrections from him, thank you!
The "Retry" button is now translated.
The "Current file" progress bar is hidden if only one file is being downloaded.
The page's title and description are updated in the case of failed downloads.
Several updates to the translations.
Several small GUI fixes.
0.3.2 - Minor tweaks to the English language file and the translation example script (example4.iss)
Added Dutch translation by Hilbrand Edskes
Added French translation by Néo
0.3.1 - Added language file examples, fixed several missing language strings
Preliminary support for proxy server autodetection
Allows the size of a file to be queried with ITD_GetFileSize
Several small bugfixes
0.3.0 - Properly supports timeouts.
Fixes bug with time remaining.
DLL is required again.
Supports localization through ITD_LoadStrings, ITD_SetString
Add mirrors for files
Post HTTP documents
Quick view and detailed view
0.2.2 - Fixed empty strings '' in calls and added timeouts
0.2.1 - Renamed identifiers to avoid name clashes
0.2.0 - Converted from DLL to pure native code
*)
procedure ITD_Cancel;
external 'itd_cancel@files:itdownload.dll stdcall';
procedure ITD_ClearFiles;
external 'itd_clearfiles@files:itdownload.dll stdcall';
function ITD_DownloadFile(url: PAnsiChar; destfilename: PAnsiChar): integer;
external 'itd_downloadfile@files:itdownload.dll stdcall';
function ITD_GetResultLen: integer;
external 'itd_getresultlen@files:itdownload.dll stdcall';
procedure ITD_GetResultString(buffer: pansichar; maxlen: integer);
external 'itd_getresultstring@files:itdownload.dll stdcall';
procedure ITD_Internal_InitUI(HostHwnd: dword);
external 'itd_initui@files:itdownload.dll stdcall';
function ITD_Internal_LoadStrings(filename: PAnsiChar): boolean;
external 'itd_loadstrings@files:itdownload.dll stdcall';
procedure ITD_Internal_SetOption(option, value: PAnsiChar);
external 'itd_setoption@files:itdownload.dll stdcall';
function ITD_Internal_GetFileSize(url: pansichar; var size: Cardinal): boolean;
external 'itd_getfilesize@files:itdownload.dll stdcall';
function ITD_Internal_GetString(index: integer): boolean;
external 'itd_getstring@files:itdownload.dll stdcall';
function ITD_Internal_GetOption(option: PAnsiChar; buffer: PAnsiChar; length: integer): integer;
external 'itd_getoption@files:itdownload.dll stdcall';
procedure ITD_Internal_SetString(index: integer; value: PAnsiChar);
external 'itd_setstring@files:itdownload.dll stdcall';
procedure ITD_Internal_AddFile(url: PAnsiChar; destfilename: PAnsiChar);
external 'itd_addfile@files:itdownload.dll stdcall';
procedure ITD_Internal_AddMirror(url: PAnsiChar; destfilename: PAnsiChar);
external 'itd_addmirror@files:itdownload.dll stdcall';
procedure ITD_Internal_AddFileSize(url: PAnsiChar; destfilename: PAnsiChar; size: integer);
external 'itd_addfilesize@files:itdownload.dll stdcall';
function ITD_Internal_DownloadFiles(surface: hwnd): integer;
external 'itd_downloadfiles@files:itdownload.dll stdcall';
function ITD_FileCount: integer;
external 'itd_filecount@files:itdownload.dll stdcall';
function ITD_Internal_PostPage(url, buffer: PAnsiChar; length: integer): boolean;
external 'itd_postpage@files:itdownload.dll stdcall';
const
ITDERR_SUCCESS = 0;
ITDERR_USERCANCEL = 1;
ITDERR_ERROR = 3;
{Constants for Language String indexes:}
ITDS_DownloadFailed = 104;
ITDS_TitleCaption = 200;
ITDS_TitleDescription = 201;
ITDS_MessageFailRetryContinue = 250;
ITDS_MessageFailRetry = 251;
ITDS_Retry = 502;
{Constants for language strings of updater example}
ITDS_Update_Caption = 600;
ITDS_Update_Description = 601;
ITDS_Update_Checking = 602;
ITDS_Update_NewAvailable = 603;
ITDS_Update_NoNewAvailable = 604;
ITDS_Update_WantToCheck = 605;
ITDS_Update_Failed = 606;
ITDS_Update_WillLaunch = 607;
ITDS_Update_WillLaunchWithPath = 608;
ITD_Event_DownloadPageEntered = 1;
ITD_Event_DownloadPageLeft = 2;
ITD_Event_DownloadFailed = 3;
var
itd_allowcontinue: boolean;
itd_retryonback: boolean;
ITD_AfterSuccess: procedure(downloadPage: TWizardPage);
ITD_EventHandler: procedure(event: integer);
procedure ITD_DownloadFiles();
begin
ITD_Internal_DownloadFiles(0);
end;
procedure ITD_AddFile(const URL, filename: string);
begin
ITD_Internal_AddFile(URL, filename);
end;
procedure ITD_AddMirror(const URL, filename: string);
begin
ITD_Internal_AddMirror(URL, filename);
end;
procedure ITD_AddFileSize(const URL, filename: string; size: integer);
begin
ITD_Internal_AddFileSize(URL, filename, size);
end;
function ITD_HandleSkipPage(sender: TWizardPage): boolean;
begin
result := (itd_filecount = 0);
end;
procedure ITD_SetString(index: integer; value: string);
begin
itd_internal_setstring(index, value);
end;
function ITD_GetFileSize(const url: string; var size: cardinal): boolean;
begin
result := itd_internal_getfilesize(PAnsiChar(url), size);
end;
function ITD_LoadStrings(const filename: string): boolean;
begin
result := itd_internal_loadstrings(filename);
end;
function ITD_GetString(index: integer): string;
begin
itd_internal_getstring(index);
setlength(result, ITD_GetResultLen);
ITD_GetResultString(PAnsiChar(result), length(result));
end;
procedure ITD_NowDoDownload(sender: TWizardPage);
var err: integer;
begin
wizardform.backbutton.enabled := false;
wizardform.nextbutton.enabled := false;
sender.caption := ITD_GetString(ITDS_TitleCaption);
sender.description := ITD_GetString(ITDS_TitleDescription);
err := ITD_Internal_DownloadFiles(sender.surface.handle);
case err of
ITDERR_SUCCESS: begin
wizardform.nextbutton.enabled := true;
wizardform.nextbutton.onclick(nil);
if itd_aftersuccess <> nil then
itd_aftersuccess(sender);
end;
ITDERR_USERCANCEL: ; //Don't show a message, this happens on setup close and cancel click
else begin
//Some unexpected error, like connection interrupted
wizardform.backbutton.caption := ITD_GetString(ITDS_Retry);
wizardform.backbutton.enabled := true;
wizardform.backbutton.show();
itd_retryonback := true;
wizardform.nextbutton.enabled := itd_allowcontinue;
if ITD_EventHandler <> nil then
ITD_EventHandler(ITD_Event_DownloadFailed);
if itd_allowcontinue then begin //Download failed, we can retry, continue, or exit
sender.caption := ITD_GetString(ITDS_DownloadFailed);
sender.description := ITD_GetString(ITDS_MessageFailRetryContinue);
MsgBox(ITD_GetString(ITDS_MessageFailRetryContinue), mbError, MB_OK)
end else begin //Download failed, we must retry or exit setup
sender.caption := ITD_GetString(ITDS_DownloadFailed);
sender.description := ITD_GetString(ITDS_MessageFailRetry);
MsgBox(ITD_GetString(ITDS_MessageFailRetry), mbError, MB_OK)
end;
end;
end;
end;
procedure ITD_HandleShowPage(sender: TWizardPage);
begin
wizardform.nextbutton.enabled := false;
wizardform.backbutton.hide();
if ITD_EventHandler <> nil then
ITD_EventHandler(ITD_Event_DownloadPageEntered);
itd_nowdodownload(sender);
end;
function ITD_HandleBackClick(sender: TWizardpage): boolean;
begin
result := false;
if itd_retryonback then begin
itd_retryonback := false;
wizardform.backbutton.hide();
itd_nowdodownload(sender);
end;
end;
function ITD_HandleNextClick(sender: TWizardpage): boolean;
begin
if ITD_EventHandler <> nil then
ITD_EventHandler(ITD_Event_DownloadPageLeft);
result := true;
end;
procedure ITD_Init;
begin
//Currently a NOP. Don't count on it in future.
end;
function ITD_PostPage(const url, data: string; out response: string): boolean;
begin
result := ITD_Internal_PostPage(PAnsiChar(url), PAnsiChar(data), length(data));
if result then begin
setlength(response, ITD_GetResultLen);
ITD_GetResultString(PAnsiChar(response), length(response));
end;
end;
function ITD_DownloadAfter(afterID: integer): TWizardPage;
var itd_downloadPage: TWizardPage;
begin
itd_downloadpage := CreateCustomPage(afterID, ITD_GetString(ITDS_TitleCaption), ITD_GetString(ITDS_TitleDescription));
itd_downloadpage.onactivate := @itd_handleshowpage;
itd_downloadpage.onshouldskippage := @itd_handleskippage;
itd_downloadpage.onbackbuttonclick := @itd_handlebackclick;
itd_downloadpage.onnextbuttonclick := @itd_handlenextclick;
itd_internal_initui(itd_downloadpage.surface.handle);
result := itd_downloadpage;
end;
procedure ITD_SetOption(const option, value: string);
begin
//The options which call ITD_SetString are depreciated, use ITD_SetString directly
if comparetext(option, 'UI_Caption') = 0 then
ITD_SetString(ITDS_TitleCaption, value)
else if comparetext(option, 'UI_Description') = 0 then
ITD_SetString(ITDS_TitleDescription, value)
else if comparetext(option, 'UI_FailMessage') = 0 then
ITD_SetString(ITDS_MessageFailRetry, value)
else if comparetext(option, 'UI_FailOrContinueMessage') = 0 then
ITD_SetString(ITDS_MessageFailRetryContinue, value)
else if comparetext(option, 'UI_AllowContinue') = 0 then
ITD_AllowContinue := (value = '1')
else
ITD_Internal_SetOption(option, value);
end;
function ITD_GetOption(const option: string): string;
begin
setlength(result, 500);
setlength(result, itd_internal_getoption(pansichar(option), pansichar(result), length(result)));
end;