├── .gitignore ├── CompInstall.dpr ├── CompInstall.dproj ├── CompInstall.res ├── CompInstall_Icon.ico ├── LICENSE.md ├── README.md ├── UCmdExecBuffer.pas ├── UCommon.pas ├── UDefinitions.pas ├── UDelphiVersionCombo.pas ├── UFrm.dfm ├── UFrm.pas ├── UFrmOldFiles.dfm ├── UFrmOldFiles.pas ├── UGitHub.pas ├── UProcess.pas └── images └── app_preview.gif /.gitignore: -------------------------------------------------------------------------------- 1 | *.identcache 2 | *.local 3 | /Win32 4 | -------------------------------------------------------------------------------- /CompInstall.dpr: -------------------------------------------------------------------------------- 1 | program CompInstall; 2 | 3 | uses 4 | Vcl.Forms, 5 | UCmdExecBuffer in 'UCmdExecBuffer.pas', 6 | UCommon in 'UCommon.pas', 7 | UDefinitions in 'UDefinitions.pas', 8 | UDelphiVersionCombo in 'UDelphiVersionCombo.pas', 9 | UFrm in 'UFrm.pas' {Frm}, 10 | UGitHub in 'UGitHub.pas', 11 | UProcess in 'UProcess.pas', 12 | UFrmOldFiles in 'UFrmOldFiles.pas' {FrmOldFiles}; 13 | 14 | {$R *.res} 15 | 16 | begin 17 | Application.Initialize; 18 | Application.MainFormOnTaskbar := True; 19 | Application.CreateForm(TFrm, Frm); 20 | Application.Run; 21 | end. 22 | -------------------------------------------------------------------------------- /CompInstall.dproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | {0CAD47BE-D260-46DE-8E70-0EB57D0E9BAD} 4 | 19.5 5 | VCL 6 | True 7 | Release 8 | Win32 9 | 1 10 | Application 11 | CompInstall.dpr 12 | 13 | 14 | true 15 | 16 | 17 | true 18 | Base 19 | true 20 | 21 | 22 | true 23 | Base 24 | true 25 | 26 | 27 | true 28 | Base 29 | true 30 | 31 | 32 | true 33 | Cfg_1 34 | true 35 | true 36 | 37 | 38 | true 39 | Base 40 | true 41 | 42 | 43 | true 44 | Cfg_2 45 | true 46 | true 47 | 48 | 49 | .\$(Platform)\$(Config) 50 | .\$(Platform)\$(Config) 51 | false 52 | false 53 | false 54 | false 55 | false 56 | System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) 57 | $(BDS)\bin\delphi_PROJECTICON.ico 58 | $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png 59 | $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png 60 | CompInstall 61 | 62 | 63 | soapserver;IndySystem;vclwinx;fmx;vclie;DbxCommonDriver;bindengine;vcldb;IndyIPCommon;VCLRESTComponents;FireDACCommonODBC;FireDACCommonDriver;appanalytics;IndyProtocols;vclx;IndyIPClient;dbxcds;vcledge;vclFireDAC;bindcompvclwinx;bindcomp;FireDACCommon;IndyCore;RESTBackendComponents;bindcompfmx;bindcompdbx;inetdb;rtl;FireDACMySQLDriver;FireDACSqliteDriver;DbxClientDriver;FireDACADSDriver;RESTComponents;soapmidas;DBXSqliteDriver;vcl;vclactnband;IndyIPServer;dsnapxml;fmxFireDAC;dbexpress;dsnapcon;adortl;DBXMySQLDriver;VclSmp;inet;vclimg;vcltouch;FireDACPgDriver;FireDAC;fmxase;inetdbxpress;xmlrtl;tethering;dbrtl;bindcompvcl;dsnap;fmxdae;CloudService;FireDACMSAccDriver;CustomIPTransport;fmxobj;bindcompvclsmp;soaprtl;vcldsnap;DBXInterBaseDriver;FireDACIBDriver;$(DCC_UsePackage) 64 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) 65 | Debug 66 | true 67 | CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= 68 | 1033 69 | $(BDS)\bin\default_app.manifest 70 | 71 | 72 | soapserver;IndySystem;vclwinx;fmx;vclie;DbxCommonDriver;bindengine;vcldb;IndyIPCommon;VCLRESTComponents;FireDACCommonODBC;FireDACCommonDriver;appanalytics;IndyProtocols;vclx;IndyIPClient;dbxcds;vcledge;vclFireDAC;bindcompvclwinx;bindcomp;FireDACCommon;IndyCore;RESTBackendComponents;bindcompfmx;bindcompdbx;inetdb;rtl;FireDACMySQLDriver;FireDACSqliteDriver;DbxClientDriver;FireDACADSDriver;RESTComponents;soapmidas;DBXSqliteDriver;vcl;vclactnband;IndyIPServer;dsnapxml;fmxFireDAC;dbexpress;dsnapcon;adortl;DBXMySQLDriver;VclSmp;inet;vclimg;vcltouch;FireDACPgDriver;FireDAC;fmxase;inetdbxpress;xmlrtl;tethering;dbrtl;bindcompvcl;dsnap;fmxdae;CloudService;FireDACMSAccDriver;CustomIPTransport;fmxobj;bindcompvclsmp;soaprtl;vcldsnap;DBXInterBaseDriver;FireDACIBDriver;$(DCC_UsePackage) 73 | 74 | 75 | DEBUG;$(DCC_Define) 76 | true 77 | false 78 | true 79 | true 80 | true 81 | true 82 | true 83 | 84 | 85 | false 86 | PerMonitorV2 87 | 88 | 89 | false 90 | RELEASE;$(DCC_Define) 91 | 0 92 | 0 93 | 94 | 95 | PerMonitorV2 96 | true 97 | 1033 98 | CompInstall_Icon.ico 99 | 100 | 101 | 102 | MainSource 103 | 104 | 105 | 106 | 107 | 108 | 109 |
Frm
110 | dfm 111 |
112 | 113 | 114 | 115 |
FrmOldFiles
116 | dfm 117 |
118 | 119 | Base 120 | 121 | 122 | Cfg_1 123 | Base 124 | 125 | 126 | Cfg_2 127 | Base 128 | 129 |
130 | 131 | Delphi.Personality.12 132 | Application 133 | 134 | 135 | 136 | CompInstall.dpr 137 | 138 | 139 | Microsoft Office 2000 Sample Automation Server Wrapper Components 140 | Microsoft Office XP Sample Automation Server Wrapper Components 141 | 142 | 143 | 144 | True 145 | False 146 | 147 | 148 | 12 149 | 150 | 151 | 152 |
153 | -------------------------------------------------------------------------------- /CompInstall.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digao-dalpiaz/CompInstall/b210c8df67303c39549719f6c8ddcf4e3d3b9c31/CompInstall.res -------------------------------------------------------------------------------- /CompInstall_Icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digao-dalpiaz/CompInstall/b210c8df67303c39549719f6c8ddcf4e3d3b9c31/CompInstall_Icon.ico -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digao-dalpiaz/CompInstall/b210c8df67303c39549719f6c8ddcf4e3d3b9c31/LICENSE.md -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Preview](images/app_preview.gif) 2 | 3 | # Component Installer 4 | 5 | ## Delphi app utility to auto-install component packages into IDE. 6 | 7 | [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/C0C53LVFN) 8 | 9 | - [What's New](#whats-new) 10 | - [Description](#description) 11 | - [Features](#features) 12 | - [How to use](#how-to-use) 13 | - [CompInstall.ini structure](#compinstallini-structure) 14 | 15 | ## What's New 16 | 17 | - 02/20/2024 (Version 2.6) 18 | 19 | - Delphi 12 support. 20 | - New ini properties: IniVersion, OutputPath and Package\Path 21 | - PublishFiles now supports sub-folder. 22 | - Clear all files and sub-folders when updating from GitHub. 23 | - Detect unsupported compiler. 24 | 25 |
26 | Click here to view the entire changelog 27 | 28 | - 09/12/2021 (Version 2.5) 29 | 30 | - Delphi 11 support. 31 | 32 | - 03/25/2021 (Version 2.4) 33 | 34 | - As it is not a good practice to embed the Component Installer EXE in the GitHub component sources, the update of the GitHub repository has been modified to not update the Component Installer EXE, but only the configured component sources. 35 | - Removed backup functionality in GitHub auto-update. 36 | 37 | - 02/01/2021 (Version 2.3) 38 | 39 | - Fixed sub-folders creation (missing) when extracting files on GitHub update. 40 | - New backup folder on GitHub update (actual folder will be renamed using date and time sufix). 41 | 42 | - 12/18/2020 (Version 2.2) 43 | 44 | - Fixed call to rsvars.bat when Delphi is installed in a path containing spaces characters. 45 | 46 | - 10/31/2020 (Version 2.1) 47 | 48 | - Included Delphi 10.4 Sydney support. 49 | - Implemented verification of the 64-bit Delphi compiler existence when the 64-bit flag was set. 50 | 51 | - 10/26/2020 (Version 2.0) 52 | 53 | - Compilation process now uses thread. 54 | - GitHub auto-update supporting. 55 | 56 | - 05/03/2020 (Version 1.2) 57 | 58 | - Fixed RegisterBPL method because Delphi XE5 or below use "RAD Studio" public folder instead "Embarcadero\Studio". 59 | 60 | - 02/15/2019 (Version 1.1) 61 | 62 | - Removed Allow64bit parameter in the General section. The app will detect this parameter automatically when appears at any package parameter. 63 | 64 |
65 | 66 | ## Description 67 | 68 | This app allows you to distribute your Delphi component without having to do a long task list to manually install the component into IDE (*when you are providing component sources, of course*). 69 | 70 | In addition, if the component is hosted on GitHub, you can indicate the path of the repository and the application will check for updates directly in the repository's Releases. 71 | 72 | ## Features 73 | 74 | - Detects all Delphi versions installed and allows programmer to choose which IDE to install. 75 | - Compiles packages generating BPL files. 76 | - Installs packages into IDE. 77 | - Registers paths into Library Path. 78 | - Copies required resource files to compiled folder (.dfm, .res, ...). 79 | - Updates component hosted at GitHub automatically. 80 | - Supports 32 bits and 64 bits compilation. 81 | 82 | ## How to use 83 | 84 | You need only to create an Ini file called **CompInstall.ini** and write parameters to the app. 85 | 86 | Then put the **CompInstall.exe** and **CompInstall.ini** into your component package directory and be happy. :wink: 87 | 88 | > Note: This app requires MSBUILD, which is present at .NET Framework 2.0, 3.5 and 4.0. When the app launch, it will verify if any MSBUILD is available. 89 | 90 | ## CompInstall.ini structure 91 | 92 | **`[Template]` section** 93 | 94 | `IniVersion` (required) = Version of ini structure (**Current version = 2**) 95 | 96 | > If ini version is higher than current app supported version, the app will display an error message and block installation. 97 | 98 | **`[General]` section** 99 | 100 | `Name` (required) = Component name displayed at install form and registered into Delphi Packages. 101 | 102 | `Version` (required) = Component version displayed at install form and used by GitHub auto-update control (if enabled). 103 | 104 | `DelphiVersions` (required) = It's a list splitted by ";" with all Delphi versions supported by the component. According to Delphi versions installed in Windows and combining with this parameter, a combobox in the install form will list all possible Delphi versions. 105 | 106 | > Supported values: 2005;2006;2007;2009;2010;XE;XE2;XE3;XE4;XE5;XE6;XE7;XE8;10;10.1;10.2;10.3;10.4;11;12 107 | 108 | `Packages` (required) = It's a list splitted by ";" with packages to be compiled, in correct order. Just type the package name without the file extension. 109 | 110 | `AddLibrary` (optional) = 0 or 1. When 1, the path of release folders of component will be registered into Delphi library path. 111 | 112 | `OutputPath` (optional) = Relative folder where compiled files are stored (must be the same configured in package settings). You can use `{PLATFORM}` and `{CONFIG}` variables. Default value is: `{PLATFORM}\{CONFIG}` (By now, {CONFIG} is always "Release"). 113 | 114 | **Package section** 115 | 116 | To specify package parameters, create a section with the name of the package with the `P_` prefix, like: 117 | 118 | `[P_MyPackage]` 119 | 120 | `Path` (optional) = Relative folder where package file is. If blank, package must be at component root folder. 121 | 122 | `Allow64bit` (optional) = 0 or 1. When 1, specify this package to be compiled twice, with 32-bit and 64-bit versions. Remember to create this platform at Delphi Project Manager, otherwise the 64-bit compilation will fail. 123 | 124 | If any package has this option enabled, it will be display a checkbox allowing install 64-bit version of component (the checkbox starts checked by default). 125 | 126 | `PublishFiles` (optional) = It's a list splitted by ";" with all files you want to copy into release folders (usually DFM form files used at runtime and resource files). 127 | 128 | `Install` (optional) = 0 or 1. When 1, this package will be installed into Delphi IDE. You need to set this option for design-time packages when you want to register components into Delphi IDE. 129 | 130 | > Note: The app compiles your component using always **Release** target. 131 | 132 | **`[GitHub]` section** 133 | 134 | `Repository` (optional) = Allows you to specify a GitHub repository (syntax: `GitHub account`/`Repository name`), so when app starts, it will check for component update using GitHub API, reading the latest existing release and comparing its version with current version. If the versions don't match, a dialog will be displayed asking if you want to auto-update files. 135 | 136 | ### Example 137 | 138 | In this example, there are two Delphi packages (DamPackage and DamDesignPackage). The design-time package (DamDesignPackage) is configured to install into Delphi IDE. The runtime package (DamPackage) is configured to copy dfm form file and resource file to release folder. 139 | 140 | ``` 141 | [Template] 142 | IniVersion=2 143 | 144 | [General] 145 | Name=Dam Component 146 | Version=1.0 147 | DelphiVersions=XE2;XE3;XE4;XE5;XE6;XE7;XE8;10;10.1;10.2;10.3;10.4 148 | Packages=DamPackage;DamDesignPackage 149 | AddLibrary=1 150 | OutputPath=Library\{PLATFORM}\{CONFIG} 151 | 152 | [P_DamPackage] 153 | Path=Source\Code 154 | Allow64bit=1 155 | PublishFiles=DamDialog.dfm;Resources\Dam_Resource.res 156 | 157 | [P_DamDesignPackage] 158 | Install=1 159 | ``` 160 | 161 | **Check my Delphi components here at GitHub and find CompInstall.ini file to see others usage examples.** 162 | -------------------------------------------------------------------------------- /UCmdExecBuffer.pas: -------------------------------------------------------------------------------- 1 | unit UCmdExecBuffer; 2 | 3 | interface 4 | 5 | {The TCmdExecBuffer class executes command line programs in cmd.exe 6 | and allows to retrieve line by line output using OnLine event.} 7 | 8 | type 9 | TCmdExecBufferEvLine = procedure(const Text: string) of object; 10 | 11 | TCmdExecBuffer = class 12 | public 13 | OnLine: TCmdExecBufferEvLine; //event to retrieve line by line output 14 | 15 | CommandLine: string; 16 | WorkDir: string; 17 | 18 | Lines: string; //all output lines 19 | ExitCode: Cardinal; 20 | function Exec: Boolean; //function to execute the program 21 | end; 22 | 23 | implementation 24 | 25 | uses Winapi.Windows; 26 | 27 | function TCmdExecBuffer.Exec: Boolean; 28 | var 29 | SA: TSecurityAttributes; 30 | SI: TStartupInfo; 31 | PI: TProcessInformation; 32 | StdOutPipeRead, StdOutPipeWrite: THandle; 33 | WasOK: Boolean; 34 | Buffer: array[0..255] of AnsiChar; 35 | BytesRead: Cardinal; 36 | Handle: Boolean; 37 | aLine: string; 38 | begin 39 | Result := False; 40 | Lines := ''; 41 | //ExitCode := (-1); 42 | 43 | with SA do 44 | begin 45 | nLength := SizeOf(SA); 46 | bInheritHandle := True; 47 | lpSecurityDescriptor := nil; 48 | end; 49 | CreatePipe(StdOutPipeRead, StdOutPipeWrite, @SA, 0); 50 | try 51 | with SI do 52 | begin 53 | FillChar(SI, SizeOf(SI), 0); 54 | cb := SizeOf(SI); 55 | dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES; 56 | wShowWindow := SW_HIDE; 57 | hStdInput := GetStdHandle(STD_INPUT_HANDLE); // don't redirect stdin 58 | hStdOutput := StdOutPipeWrite; 59 | hStdError := StdOutPipeWrite; 60 | end; 61 | Handle := CreateProcess(nil, PChar('cmd.exe /C '+CommandLine), 62 | nil, nil, True, 0, nil, 63 | PChar(WorkDir), SI, PI); 64 | CloseHandle(StdOutPipeWrite); 65 | if Handle then 66 | try 67 | repeat 68 | WasOK := ReadFile(StdOutPipeRead, Buffer, 255, BytesRead, nil); 69 | if BytesRead > 0 then 70 | begin 71 | Buffer[BytesRead] := #0; 72 | 73 | OemToAnsi(Buffer, Buffer); 74 | aLine := WideString(Buffer); 75 | Lines := Lines + aLine; 76 | if Assigned(OnLine) then 77 | OnLine(aLine); 78 | end; 79 | until not WasOK or (BytesRead = 0); 80 | WaitForSingleObject(PI.hProcess, INFINITE); 81 | 82 | GetExitCodeProcess(PI.hProcess, ExitCode); 83 | Result := True; 84 | finally 85 | CloseHandle(PI.hThread); 86 | CloseHandle(PI.hProcess); 87 | end; 88 | finally 89 | CloseHandle(StdOutPipeRead); 90 | end; 91 | end; 92 | 93 | end. 94 | -------------------------------------------------------------------------------- /UCommon.pas: -------------------------------------------------------------------------------- 1 | unit UCommon; 2 | 3 | interface 4 | 5 | const BDS_KEY = 'Software\Embarcadero\BDS'; 6 | 7 | const INI_FILE_NAME = 'CompInstall.ini'; 8 | 9 | var AppDir: string; 10 | 11 | function HasInList(const Item, List: string): Boolean; 12 | function NormalizeAndRemoveFirstDir(Path: string): string; 13 | 14 | implementation 15 | 16 | uses System.SysUtils; 17 | 18 | function HasInList(const Item, List: string): Boolean; 19 | const SEP = ';'; 20 | begin 21 | //returns if Item is contained in the List splited by SEP character 22 | Result := Pos(SEP+Item+SEP, SEP+List+SEP)>0; 23 | end; 24 | 25 | function NormalizeAndRemoveFirstDir(Path: string): string; 26 | var 27 | I: Integer; 28 | begin 29 | Path := Path.Replace('/', '\'); 30 | 31 | I := Path.IndexOf('\'); 32 | if I=-1 then raise Exception.Create('First directory separator not found'); 33 | 34 | Result := Path.Remove(0, I+1); 35 | end; 36 | 37 | end. 38 | -------------------------------------------------------------------------------- /UDefinitions.pas: -------------------------------------------------------------------------------- 1 | unit UDefinitions; 2 | 3 | interface 4 | 5 | uses System.Generics.Collections, System.Classes; 6 | 7 | const DEFINITIONS_VERSION = 2; //current definitions template 8 | 9 | type 10 | TPackage = class 11 | public 12 | Name: string; 13 | Path: string; 14 | Allow64bit: Boolean; 15 | PublishFiles: TStringList; 16 | Install: Boolean; 17 | 18 | constructor Create; 19 | destructor Destroy; override; 20 | end; 21 | TPackages = class(TObjectList); 22 | 23 | TDefinitions = class 24 | public 25 | IniVersion: Integer; 26 | CompName: string; 27 | CompVersion: string; 28 | DelphiVersions: string; 29 | AddLibrary: Boolean; 30 | OutputPath: string; 31 | Packages: TPackages; 32 | 33 | GitHubRepository: string; 34 | 35 | procedure LoadIniFile(const aFile: string); 36 | 37 | function HasAny64bit: Boolean; 38 | 39 | constructor Create; 40 | destructor Destroy; override; 41 | end; 42 | 43 | implementation 44 | 45 | uses System.IniFiles, System.SysUtils; 46 | 47 | function PVToEnter(const A: string): string; 48 | begin 49 | //replaces all ";" to ENTER definition 50 | Result := StringReplace(A, ';', #13#10, [rfReplaceAll]); 51 | end; 52 | 53 | procedure TDefinitions.LoadIniFile(const aFile: string); 54 | var 55 | Ini: TIniFile; 56 | A, Sec: string; 57 | S: TStringList; 58 | P: TPackage; 59 | begin 60 | if not FileExists(aFile) then 61 | raise Exception.Create('Ini file not found'); 62 | 63 | Ini := TIniFile.Create(aFile); 64 | try 65 | IniVersion := Ini.ReadInteger('Template', 'IniVersion', 1); 66 | if IniVersion>DEFINITIONS_VERSION then 67 | raise Exception.Create('Unsupported ini version. You probably need to update Component Installer!'); 68 | 69 | CompName := Ini.ReadString('General', 'Name', ''); 70 | if CompName='' then 71 | raise Exception.Create('Component name not specifyed at ini file'); 72 | 73 | CompVersion := Ini.ReadString('General', 'Version', ''); 74 | if CompVersion='' then 75 | raise Exception.Create('Component version not specifyed at ini file'); 76 | 77 | DelphiVersions := Ini.ReadString('General', 'DelphiVersions', ''); //splitted by ";" 78 | if DelphiVersions='' then 79 | raise Exception.Create('No Delphi version specifyed at ini file'); 80 | 81 | AddLibrary := Ini.ReadBool('General', 'AddLibrary', False); 82 | OutputPath := Ini.ReadString('General', 'OutputPath', ''); 83 | 84 | S := TStringList.Create; 85 | try 86 | S.Text := PVToEnter( Ini.ReadString('General', 'Packages', '') ); 87 | if S.Count=0 then 88 | raise Exception.Create('No package found in the ini file'); 89 | 90 | for A in S do 91 | begin 92 | P := TPackage.Create; 93 | Packages.Add(P); 94 | 95 | Sec := 'P_'+A; 96 | 97 | P.Name := A; 98 | P.Path := Ini.ReadString(Sec, 'Path', ''); 99 | P.Allow64bit := Ini.ReadBool(Sec, 'Allow64bit', False); 100 | P.PublishFiles.Text := PVToEnter( Ini.ReadString(Sec, 'PublishFiles', '') ); 101 | P.Install := Ini.ReadBool(Sec, 'Install', False); 102 | end; 103 | 104 | finally 105 | S.Free; 106 | end; 107 | 108 | GitHubRepository := Ini.ReadString('GitHub', 'Repository', ''); 109 | 110 | finally 111 | Ini.Free; 112 | end; 113 | end; 114 | 115 | { TDefinitions } 116 | 117 | constructor TDefinitions.Create; 118 | begin 119 | inherited; 120 | Packages := TPackages.Create; 121 | end; 122 | 123 | destructor TDefinitions.Destroy; 124 | begin 125 | Packages.Free; 126 | inherited; 127 | end; 128 | 129 | function TDefinitions.HasAny64bit: Boolean; 130 | var 131 | P: TPackage; 132 | begin 133 | Result := False; 134 | 135 | for P in Packages do 136 | if P.Allow64bit then 137 | begin 138 | Result := True; 139 | Break; 140 | end; 141 | end; 142 | 143 | { TPackage } 144 | 145 | constructor TPackage.Create; 146 | begin 147 | inherited; 148 | PublishFiles := TStringList.Create; 149 | end; 150 | 151 | destructor TPackage.Destroy; 152 | begin 153 | PublishFiles.Free; 154 | inherited; 155 | end; 156 | 157 | end. 158 | -------------------------------------------------------------------------------- /UDelphiVersionCombo.pas: -------------------------------------------------------------------------------- 1 | unit UDelphiVersionCombo; 2 | 3 | interface 4 | 5 | uses Vcl.StdCtrls; 6 | 7 | type 8 | TDelphiVersionItem = class 9 | public 10 | InternalNumber: string; 11 | end; 12 | 13 | TDelphiVersionComboLoader = class 14 | public 15 | class procedure Load(Combo: TComboBox; const DelphiVersions: string); 16 | class procedure Clear(Combo: TComboBox); 17 | end; 18 | 19 | implementation 20 | 21 | uses System.Win.Registry, Winapi.Windows, System.SysUtils, 22 | UCommon; 23 | 24 | class procedure TDelphiVersionComboLoader.Load(Combo: TComboBox; 25 | const DelphiVersions: string); 26 | var 27 | R: TRegistry; 28 | 29 | procedure Add(const Key, IniVer, Text: string); 30 | var 31 | Item: TDelphiVersionItem; 32 | begin 33 | if R.KeyExists(Key) and HasInList(IniVer, DelphiVersions) then 34 | begin 35 | Item := TDelphiVersionItem.Create; 36 | Item.InternalNumber := Key; 37 | Combo.Items.AddObject(Text, Item); 38 | end; 39 | end; 40 | 41 | begin 42 | Clear(Combo); 43 | 44 | R := TRegistry.Create; 45 | try 46 | R.RootKey := HKEY_CURRENT_USER; 47 | if R.OpenKeyReadOnly(BDS_KEY) then 48 | begin 49 | Add('3.0', '2005', 'Delphi 2005'); 50 | Add('4.0', '2006', 'Delphi 2006'); 51 | Add('5.0', '2007', 'Delphi 2007'); 52 | Add('6.0', '2009', 'Delphi 2009'); 53 | Add('7.0', '2010', 'Delphi 2010'); 54 | Add('8.0', 'XE', 'Delphi XE'); 55 | Add('9.0', 'XE2', 'Delphi XE2'); 56 | Add('10.0', 'XE3', 'Delphi XE3'); 57 | Add('11.0', 'XE4', 'Delphi XE4'); 58 | Add('12.0', 'XE5', 'Delphi XE5'); //public folder 'RAD Studio' 59 | Add('14.0', 'XE6', 'Delphi XE6'); //public folder 'Embarcadero\Studio' 60 | Add('15.0', 'XE7', 'Delphi XE7'); 61 | Add('16.0', 'XE8', 'Delphi XE8'); 62 | Add('17.0', '10', 'Delphi 10 Seattle'); 63 | Add('18.0', '10.1', 'Delphi 10.1 Berlin'); 64 | Add('19.0', '10.2', 'Delphi 10.2 Tokyo'); 65 | Add('20.0', '10.3', 'Delphi 10.3 Rio'); 66 | Add('21.0', '10.4', 'Delphi 10.4 Sydney'); 67 | Add('22.0', '11', 'Delphi 11 Alexandria'); 68 | Add('23.0', '12', 'Delphi 12 Athens'); 69 | end; 70 | finally 71 | R.Free; 72 | end; 73 | 74 | if Combo.Items.Count=0 then 75 | raise Exception.Create('No version of Delphi installed or supported'); 76 | 77 | Combo.ItemIndex := Combo.Items.Count-1; //select last version 78 | end; 79 | 80 | class procedure TDelphiVersionComboLoader.Clear(Combo: TComboBox); 81 | var 82 | I: Integer; 83 | begin 84 | for I := 0 to Combo.Items.Count-1 do 85 | Combo.Items.Objects[I].Free; 86 | 87 | Combo.Items.Clear; 88 | end; 89 | 90 | end. 91 | -------------------------------------------------------------------------------- /UFrm.dfm: -------------------------------------------------------------------------------- 1 | object Frm: TFrm 2 | Left = 0 3 | Top = 0 4 | BorderIcons = [biSystemMenu, biMinimize] 5 | BorderStyle = bsSingle 6 | Caption = 'Component Installer' 7 | ClientHeight = 589 8 | ClientWidth = 874 9 | Color = clBtnFace 10 | Font.Charset = DEFAULT_CHARSET 11 | Font.Color = clWindowText 12 | Font.Height = -11 13 | Font.Name = 'Segoe UI' 14 | Font.Style = [] 15 | Position = poScreenCenter 16 | OnCreate = FormCreate 17 | OnDestroy = FormDestroy 18 | OnShow = FormShow 19 | TextHeight = 13 20 | object LbComponentName: TLabel 21 | Left = 16 22 | Top = 16 23 | Width = 64 24 | Height = 13 25 | Caption = 'Component:' 26 | end 27 | object LbDelphiVersion: TLabel 28 | Left = 16 29 | Top = 64 30 | Width = 110 31 | Height = 13 32 | Caption = 'Select Delphi version:' 33 | end 34 | object LbInstallLog: TLabel 35 | Left = 16 36 | Top = 112 37 | Width = 80 38 | Height = 13 39 | Caption = 'Installation Log' 40 | end 41 | object LbVersion: TLabel 42 | Left = 726 43 | Top = 16 44 | Width = 123 45 | Height = 13 46 | Caption = 'Component Installer 2.6' 47 | Font.Charset = ANSI_CHARSET 48 | Font.Color = clGreen 49 | Font.Height = -11 50 | Font.Name = 'Segoe UI' 51 | Font.Style = [] 52 | ParentFont = False 53 | end 54 | object LbComponentVersion: TLabel 55 | Left = 528 56 | Top = 16 57 | Width = 41 58 | Height = 13 59 | Caption = 'Version:' 60 | end 61 | object EdCompName: TEdit 62 | Left = 16 63 | Top = 32 64 | Width = 505 65 | Height = 21 66 | TabStop = False 67 | Color = clBtnFace 68 | Font.Charset = ANSI_CHARSET 69 | Font.Color = clWindowText 70 | Font.Height = -11 71 | Font.Name = 'Segoe UI' 72 | Font.Style = [fsBold] 73 | ParentFont = False 74 | ReadOnly = True 75 | TabOrder = 0 76 | end 77 | object EdDV: TComboBox 78 | Left = 16 79 | Top = 80 80 | Width = 225 81 | Height = 21 82 | Style = csDropDownList 83 | TabOrder = 3 84 | end 85 | object Ck64bit: TCheckBox 86 | Left = 272 87 | Top = 80 88 | Width = 137 89 | Height = 17 90 | Caption = 'Install 64-bit support' 91 | Checked = True 92 | State = cbChecked 93 | TabOrder = 4 94 | end 95 | object BtnInstall: TBitBtn 96 | Left = 320 97 | Top = 544 98 | Width = 105 99 | Height = 33 100 | Caption = 'Install' 101 | Glyph.Data = { 102 | B60D0000424DB60D000000000000360000002800000030000000180000000100 103 | 180000000000800D000000000000000000000000000000000000C080FFC080FF 104 | C080FFC080FFC080FFC080FFC080FFDDEBEFAFE0EE83D5ED57CAEC2CBFEB2CBF 105 | EB57CAEC83D5EDAFE0EEDDEBEFC080FFC080FFC080FFC080FFC080FFC080FFC0 106 | 80FFC080FFC080FFC080FFC080FFC080FFC080FFC080FF929596899396819195 107 | 788F95708C95708C95788F95819195899396929596C080FFC080FFC080FFC080 108 | FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FF83D4ED1B 109 | BBEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB1BBBEB83D5ED 110 | C080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080 111 | FFC080FF8190956C8C956B8B956B8B956B8B956B8B956B8B956B8B956B8B956B 112 | 8B956C8C95819195C080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FF 113 | C080FFC080FFC6E5EE3EC4EB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BA 114 | EB16BAEB16BAEB16BAEB16BAEB16BAEB3EC4EBC6E5EEC080FFC080FFC080FFC0 115 | 80FFC080FFC080FFC080FFC080FF8E9496738D956B8B956B8B956B8B956B8B95 116 | 6B8B956B8B956B8B956B8B956B8B956B8B956B8B956B8B95738D958E9496C080 117 | FFC080FFC080FFC080FFC080FFC080FFC080FF95D9EE1BBBEB16BAEB16BAEB16 118 | BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB 119 | 16BAEB1BBBEB95D9EEC080FFC080FFC080FFC080FFC080FFC080FF8491966C8C 120 | 956B8B956B8B956B8B956B8B956B8B956B8B956B8B956B8B956B8B956B8B956B 121 | 8B956B8B956B8B956B8B956C8C95849196C080FFC080FFC080FFC080FFC080FF 122 | C6E5EE1BBBEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BA 123 | EB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB1BBBEBC6E5EEC080FFC0 124 | 80FFC080FFC080FF8E94966C8C956B8B956B8B956B8B956B8B956B8B956B8B95 125 | 6B8B956B8B956B8B956B8B956B8B956B8B956B8B956B8B956B8B956B8B956C8C 126 | 958E9496C080FFC080FFC080FFC080FF3EC4EB16BAEB16BAEB16BAEB16BAEB16 127 | BAEB36C3EE7ED9F418BBEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB 128 | 16BAEB16BAEB16BAEB3EC4EBC080FFC080FFC080FFC080FF738D956B8B956B8B 129 | 956B8B956B8B956B8B95718D968091976C8C956B8B956B8B956B8B956B8B956B 130 | 8B956B8B956B8B956B8B956B8B956B8B95738D95C080FFC080FFC080FF83D4ED 131 | 16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB5FD0F1C080FFD5F2FB35C3EE16BA 132 | EB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB83D5EDC0 133 | 80FFC080FF8190956B8B956B8B956B8B956B8B956B8B956B8B957A9096C080FF 134 | 919698718D966B8B956B8B956B8B956B8B956B8B956B8B956B8B956B8B956B8B 135 | 956B8B95819195C080FFDDEBEF1BBBEB16BAEB16BAEB16BAEB16BAEB16BAEB16 136 | BAEB5FD0F1C080FFC080FFC080FF79D8F416BAEB16BAEB16BAEB16BAEB16BAEB 137 | 16BAEB16BAEB16BAEB16BAEB1BBBEBDDEBEF9295966C8C956B8B956B8B956B8B 138 | 956B8B956B8B956B8B957A9096C080FFC080FFC080FF7F91976B8B956B8B956B 139 | 8B956B8B956B8B956B8B956B8B956B8B956B8B956C8C95929596AFE0EE16BAEB 140 | 16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB5FD0F1C080FFC080FFC080FFC080 141 | FFCBF0FB2EC1ED16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEBAF 142 | E0EE8993966B8B956B8B956B8B956B8B956B8B956B8B956B8B957A9096C080FF 143 | C080FFC080FFC080FF8F9698708D956B8B956B8B956B8B956B8B956B8B956B8B 144 | 956B8B956B8B9589939683D5ED16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16 145 | BAEB5FD0F1C080FFC080FFC080FFC080FFC080FFC080FF6CD4F316BAEB16BAEB 146 | 16BAEB16BAEB16BAEB16BAEB16BAEB83D5ED8191956B8B956B8B956B8B956B8B 147 | 956B8B956B8B956B8B957A9096C080FFC080FFC080FFC080FFC080FFC080FF7C 148 | 90976B8B956B8B956B8B956B8B956B8B956B8B956B8B9581919557CAEC16BAEB 149 | 16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB5FD0F1C080FFC080FFC080FFC080 150 | FFC080FFC080FFC080FFC1EDFA27BFEC16BAEB16BAEB16BAEB16BAEB16BAEB57 151 | CAEC788F956B8B956B8B956B8B956B8B956B8B956B8B956B8B957A9096C080FF 152 | C080FFC080FFC080FFC080FFC080FFC080FF8D95986F8C956B8B956B8B956B8B 153 | 956B8B956B8B95788F952CBFEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16 154 | BAEB5FD0F1C080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FF 155 | 53CCF016BAEB16BAEB16BAEB16BAEB2CBFEB708C956B8B956B8B956B8B956B8B 156 | 956B8B956B8B956B8B957A9096C080FFC080FFC080FFC080FFC080FFC080FFC0 157 | 80FFC080FFC080FF778F966B8B956B8B956B8B956B8B95708C952CBFEB16BAEB 158 | 16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB5FD0F1C080FFC080FFC080FFC080 159 | FFC080FFC080FFC080FFC080FFC080FF53CCF016BAEB16BAEB16BAEB16BAEB2C 160 | BFEB708C956B8B956B8B956B8B956B8B956B8B956B8B956B8B957A9096C080FF 161 | C080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FF778F966B8B956B8B 162 | 956B8B956B8B95708C9557CAEC16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16 163 | BAEB5FD0F1C080FFC080FFC080FFC080FFC080FFC080FFC080FFC1EDFA27BFEC 164 | 16BAEB16BAEB16BAEB16BAEB16BAEB57CAEC788F956B8B956B8B956B8B956B8B 165 | 956B8B956B8B956B8B957A9096C080FFC080FFC080FFC080FFC080FFC080FFC0 166 | 80FF8D95986F8C956B8B956B8B956B8B956B8B956B8B95788F9583D5ED16BAEB 167 | 16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB5FD0F1C080FFC080FFC080FFC080 168 | FFC080FFC080FF6CD4F316BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB83 169 | D5ED8191956B8B956B8B956B8B956B8B956B8B956B8B956B8B957A9096C080FF 170 | C080FFC080FFC080FFC080FFC080FF7C90976B8B956B8B956B8B956B8B956B8B 171 | 956B8B956B8B95819195AFE0EE16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16 172 | BAEB5FD0F1C080FFC080FFC080FFC080FFCBF0FB2EC1ED16BAEB16BAEB16BAEB 173 | 16BAEB16BAEB16BAEB16BAEB16BAEBAFE0EE8993966B8B956B8B956B8B956B8B 174 | 956B8B956B8B956B8B957A9096C080FFC080FFC080FFC080FF8F9698708D956B 175 | 8B956B8B956B8B956B8B956B8B956B8B956B8B956B8B95899396DDEBEF1BBBEB 176 | 16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB5FD0F1C080FFC080FFC080FF79D8 177 | F416BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB1BBBEBDD 178 | EBEF9295966C8C956B8B956B8B956B8B956B8B956B8B956B8B957A9096C080FF 179 | C080FFC080FF7F91976B8B956B8B956B8B956B8B956B8B956B8B956B8B956B8B 180 | 956B8B956C8C95929596C080FF83D4ED16BAEB16BAEB16BAEB16BAEB16BAEB16 181 | BAEB5FD0F1C080FFD5F2FB35C3EE16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB 182 | 16BAEB16BAEB16BAEB16BAEB83D5EDC080FFC080FF8190956B8B956B8B956B8B 183 | 956B8B956B8B956B8B957A9096C080FF919698718D966B8B956B8B956B8B956B 184 | 8B956B8B956B8B956B8B956B8B956B8B956B8B95819195C080FFC080FFC080FF 185 | 3EC4EB16BAEB16BAEB16BAEB16BAEB16BAEB36C3EE7BD8F418BBEB16BAEB16BA 186 | EB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB3EC4EBC080FFC0 187 | 80FFC080FFC080FF738D956B8B956B8B956B8B956B8B956B8B95718D967F9197 188 | 6C8C956B8B956B8B956B8B956B8B956B8B956B8B956B8B956B8B956B8B956B8B 189 | 95738D95C080FFC080FFC080FFC080FFC6E5EE1BBBEB16BAEB16BAEB16BAEB16 190 | BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB 191 | 16BAEB16BAEB1BBBEBC6E5EEC080FFC080FFC080FFC080FF8E94966C8C956B8B 192 | 956B8B956B8B956B8B956B8B956B8B956B8B956B8B956B8B956B8B956B8B956B 193 | 8B956B8B956B8B956B8B956B8B956C8C958E9496C080FFC080FFC080FFC080FF 194 | C080FF95D9EE1BBBEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BA 195 | EB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB1BBBEB95D9EEC080FFC080FFC0 196 | 80FFC080FFC080FFC080FF8491966C8C956B8B956B8B956B8B956B8B956B8B95 197 | 6B8B956B8B956B8B956B8B956B8B956B8B956B8B956B8B956B8B956C8C958491 198 | 96C080FFC080FFC080FFC080FFC080FFC080FFC080FFC6E5EE3EC4EB16BAEB16 199 | BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB16BAEB 200 | 3EC4EBC6E5EEC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FF8E94 201 | 96738D956B8B956B8B956B8B956B8B956B8B956B8B956B8B956B8B956B8B956B 202 | 8B956B8B956B8B95738D958E9496C080FFC080FFC080FFC080FFC080FFC080FF 203 | C080FFC080FFC080FFC080FF83D4ED1BBBEB16BAEB16BAEB16BAEB16BAEB16BA 204 | EB16BAEB16BAEB16BAEB1BBBEB83D5EDC080FFC080FFC080FFC080FFC080FFC0 205 | 80FFC080FFC080FFC080FFC080FFC080FFC080FF8190956C8C956B8B956B8B95 206 | 6B8B956B8B956B8B956B8B956B8B956B8B956C8C95819195C080FFC080FFC080 207 | FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFDD 208 | EBEFAFE0EE83D5ED57CAEC2CBFEB2CBFEB57CAEC83D5EDAFE0EEDDEBEFC080FF 209 | C080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080 210 | FFC080FFC080FF929596899396819195788F95708C95708C95788F9581919589 211 | 9396929596C080FFC080FFC080FFC080FFC080FFC080FFC080FF} 212 | NumGlyphs = 2 213 | TabOrder = 6 214 | OnClick = BtnInstallClick 215 | end 216 | object BtnExit: TBitBtn 217 | Left = 432 218 | Top = 544 219 | Width = 105 220 | Height = 33 221 | Caption = 'Exit' 222 | Glyph.Data = { 223 | B60D0000424DB60D000000000000360000002800000030000000180000000100 224 | 180000000000800D000000000000000000000000000000000000C080FFC080FF 225 | C080FFC080FFC080FFC080FFC080FFE8E0DDD9BDB6C99A8EE6DCD9C080FFC080 226 | FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC0 227 | 80FFC080FFC080FFC080FFC080FFC080FFC080FFC080FF949392918C8B8E8583 228 | 949291C080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080 229 | FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFE6DAD7D6B7B0C89488BF 230 | 8373BF8373BF8373E6DBD8C080FFC080FFC080FFC080FFC080FFC080FFC080FF 231 | C080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FF9492 232 | 91918B898E84828C817D8C817D8C817D949291C080FFC080FFC080FFC080FFC0 233 | 80FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFE3D4D0 234 | D4B2A9C59081BF8373BF8373BF8373BF8373BF8373BF8373E6DBD8C080FFC080 235 | FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC0 236 | 80FFC080FF939090908A888E83808C817D8C817D8C817D8C817D8C817D8C817D 237 | 949291C080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFC080 238 | FFC080FFC080FFC080FFB88778BF8373BF8373BF8373BF8373BF8373BF8373BF 239 | 8373BF8373BF83739A786E91766D91766D91766D91766DB4A49EC080FFC080FF 240 | C080FFC080FFC080FFC080FFC080FFC080FF8B817E8C817D8C817D8C817D8C81 241 | 7D8C817D8C817D8C817D8C817D8C817D857E7C837E7C837E7C837E7C837E7C8A 242 | 8786C080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFB68274BF8373 243 | BF8373BF8373BF8373BF8373BF8373BF8373BF8373BF83738C675B8060558060 244 | 55806055806055AA968EC080FFC080FFC080FFC080FFC080FFC080FFC080FFC0 245 | 80FF8B807E8C817D8C817D8C817D8C817D8C817D8C817D8C817D8C817D8C817D 246 | 827B79807A78807A78807A78807A78888483C080FFC080FFC080FFC080FFC080 247 | FFC080FFC080FFC080FFB68274BF8373BF8373BF8373BF8373BF8373BF8373BF 248 | 8373BF8373BF83738C675B806055806055806055806055AA968EC080FFC080FF 249 | C080FFC080FFC080FFC080FFC080FFC080FF8B807E8C817D8C817D8C817D8C81 250 | 7D8C817D8C817D8C817D8C817D8C817D827B79807A78807A78807A78807A7888 251 | 8483C080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFB68274BF8373 252 | BF8373BF8373BF8373BF8373BF8373BF8373BF8373BF83738C675B8060558060 253 | 55806055806055AA968EC080FFC080FFC080FFC080FFC080FFC080FFC080FFC0 254 | 80FF8B807E8C817D8C817D8C817D8C817D8C817D8C817D8C817D8C817D8C817D 255 | 827B79807A78807A78807A78807A78888483C080FFC080FFC080FFC080FFC080 256 | FFC080FFC080FFC080FFB68274BF8373BF8373BF8373BF8373BF8373BF8373BF 257 | 8373BF8373BF83738C675B806055806055806055806055AA968EC080FFC080FF 258 | C080FFC080FFC080FFC080FFC080FFC080FF8B807E8C817D8C817D8C817D8C81 259 | 7D8C817D8C817D8C817D8C817D8C817D827B79807A78807A78807A78807A7888 260 | 8483C080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFB68274BF8373 261 | BF8373BF8373BF8373BF8373BF8373BF8373BF8373BF83738C675B8060558060 262 | 55806055806055AA968EC080FFD1E9EF6BD4EFE4EEF0C080FFC080FFC080FFC0 263 | 80FF8B807E8C817D8C817D8C817D8C817D8C817D8C817D8C817D8C817D8C817D 264 | 827B79807A78807A78807A78807A78888483C080FF9095967C9096949696C080 265 | FFC080FFC080FFC080FFB68274BF8373BF8373BF8373BF8373BF8373BF8373BF 266 | 8373BF8373BF83738C675B806055806055806055806055AA968EC080FFC080FF 267 | ABE2EF6AD3EFE4EDF0C080FFC080FFC080FF8B807E8C817D8C817D8C817D8C81 268 | 7D8C817D8C817D8C817D8C817D8C817D827B79807A78807A78807A78807A7888 269 | 8483C080FFC080FF8893967C9096949596C080FFC080FFC080FFB68274BF8373 270 | BF8373BF8373BF8373BF8373BF8373BF8373BF8373BF83738C675B8060558060 271 | 55806055806055AA968EC080FFC080FFC080FFABE2EF69D4EFE4EDF0C080FFC0 272 | 80FF8B807E8C817D8C817D8C817D8C817D8C817D8C817D8C817D8C817D8C817D 273 | 827B79807A78807A78807A78807A78888483C080FFC080FFC080FF8893967B90 274 | 96949596C080FFC080FFB68274BF8373BF8373BF8373BF8373BF8373BF8373BF 275 | 8373BF8373BF83738C675B806055806055806055806055AA968EC080FFC080FF 276 | C080FFC080FFABE2EF69D4EFE3EDF0C080FF8B807E8C817D8C817D8C817D8C81 277 | 7D8C817D8C817D8C817D8C817D8C817D827B79807A78807A78807A78807A7888 278 | 8483C080FFC080FFC080FFC080FF8893967B9096939596C080FFB68274BF8373 279 | BF8373BF8373BF8373BF8373BF8373BF8373BF8373BF83738C675B8060558060 280 | 55806055806055AA968EC080FFC080FFC080FFC080FFC080FFABE2EF69D4EFE3 281 | EDF08B807E8C817D8C817D8C817D8C817D8C817D8C817D8C817D8C817D8C817D 282 | 827B79807A78807A78807A78807A78888483C080FFC080FFC080FFC080FFC080 283 | FF8893967B9096939596B68274BF8373BF8373BF8373BF8373BF8373BF8373BF 284 | 8373BF8373BF83738C675B8060556596A151C1DC51C1DC57C7E35ED2EF5ED2EF 285 | 5ED2EF5ED2EF5ED2EF5ED2EF53CEEF84D9EE8B807E8C817D8C817D8C817D8C81 286 | 7D8C817D8C817D8C817D8C817D8C817D827B79807A787B8486778D92778D9278 287 | 8E93799096799096799096799096799096799096778F96819196B68274BF8373 288 | BF8373BF8373BF8373BF8373BF8373BF8373BF8373BF83738C675B8060557F62 289 | 577E635A7E635AA69891C080FFC080FFC080FFC080FFC080FFBDE5EE5ED2EFD4 290 | E9EF8B807E8C817D8C817D8C817D8C817D8C817D8C817D8C817D8C817D8C817D 291 | 827B79807A78807A78807A79807A79878583C080FFC080FFC080FFC080FFC080 292 | FF8C9496799096909596B68274BF8373BF8373BF8373BF8373BF8373BF8373BF 293 | 8373BF8373BF83738C675B806055806055806055806055AA968EC080FFC080FF 294 | C080FFC080FFC1E6EF5FD2EFD6EAEFC080FF8B807E8C817D8C817D8C817D8C81 295 | 7D8C817D8C817D8C817D8C817D8C817D827B79807A78807A78807A78807A7888 296 | 8483C080FFC080FFC080FFC080FF8D94967A9096919596C080FFB68274BF8373 297 | BF8373BF8373BF8373BF8373BF8373BF8373BF8373BF83738C675B8060558060 298 | 55806055806055AA968EC080FFC080FFC080FFC1E6EF5FD2EFD6EAEFC080FFC0 299 | 80FF8B807E8C817D8C817D8C817D8C817D8C817D8C817D8C817D8C817D8C817D 300 | 827B79807A78807A78807A78807A78888483C080FFC080FFC080FF8D94967A90 301 | 96919596C080FFC080FFB68274BF8373BF8373BF8373BF8373BF8373BF8373BF 302 | 8373BF8373BF83738C675B806055806055806055806055AA968EC080FFC080FF 303 | C1E6EF5FD2EFD6EAEFC080FFC080FFC080FF8B807E8C817D8C817D8C817D8C81 304 | 7D8C817D8C817D8C817D8C817D8C817D827B79807A78807A78807A78807A7888 305 | 8483C080FFC080FF8D94967A9096919596C080FFC080FFC080FFB68274BF8373 306 | BF8373BF8373BF8373BF8373BF8373BF8373BF8373BF83738C675B8060558060 307 | 55806055806055AA968EC080FFD1E9EF5FD2EFD6EAEFC080FFC080FFC080FFC0 308 | 80FF8B807E8C817D8C817D8C817D8C817D8C817D8C817D8C817D8C817D8C817D 309 | 827B79807A78807A78807A78807A78888483C080FF9095967A9096919596C080 310 | FFC080FFC080FFC080FFB68274BF8373BF8373BF8373BF8373BF8373BF8373BF 311 | 8373BF8373BF83738C675B806055806055806055806055AA968EC080FFC080FF 312 | DDECEFC080FFC080FFC080FFC080FFC080FF8B807E8C817D8C817D8C817D8C81 313 | 7D8C817D8C817D8C817D8C817D8C817D827B79807A78807A78807A78807A7888 314 | 8483C080FFC080FF929596C080FFC080FFC080FFC080FFC080FFB68274BF8373 315 | BF8373BF8373BF8373BF8373BF8373BF8373BF8373BE83738A665A8060558060 316 | 55806055806055AA968EC080FFC080FFC080FFC080FFC080FFC080FFC080FFC0 317 | 80FF8B807E8C817D8C817D8C817D8C817D8C817D8C817D8C817D8C817D8C817D 318 | 827B79807A78807A78807A78807A78888483C080FFC080FFC080FFC080FFC080 319 | FFC080FFC080FFC080FFB68274BF8373BF8373BF8373BF8373BF8373BD8272AC 320 | 786A986D60856357806055806055806055806055806055AA968EC080FFC080FF 321 | C080FFC080FFC080FFC080FFC080FFC080FF8B807E8C817D8C817D8C817D8C81 322 | 7D8C817D8C807D897E7C857C7A817A78807A78807A78807A78807A78807A7888 323 | 8483C080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FFB68274BF8373 324 | BF8373BB8171A97768956B5F8362568060558060558060558060558060558060 325 | 55806055806055AA968EC080FFC080FFC080FFC080FFC080FFC080FFC080FFC0 326 | 80FF8B807E8C817D8C817D8C807D887E7B847C7A817A78807A78807A78807A78 327 | 807A78807A78807A78807A78807A78888483C080FFC080FFC080FFC080FFC080 328 | FFC080FFC080FFC080FFB28174A67567926A5D81615680605580605580605580 329 | 6055806055806055806055806055806055806055806055AA968EC080FFC080FF 330 | C080FFC080FFC080FFC080FFC080FFC080FF8A807E877E7B847C79807A78807A 331 | 78807A78807A78807A78807A78807A78807A78807A78807A78807A78807A7888 332 | 8483C080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FF} 333 | NumGlyphs = 2 334 | TabOrder = 7 335 | OnClick = BtnExitClick 336 | end 337 | object M: TRichEdit 338 | Left = 16 339 | Top = 128 340 | Width = 841 341 | Height = 410 342 | TabStop = False 343 | HideScrollBars = False 344 | ReadOnly = True 345 | ScrollBars = ssVertical 346 | TabOrder = 5 347 | end 348 | object LbDigaoDalpiaz: TLinkLabel 349 | Left = 774 350 | Top = 40 351 | Width = 76 352 | Height = 17 353 | Caption = 354 | 'Dig'#227'o Dal' + 355 | 'piaz' 356 | TabOrder = 2 357 | OnLinkClick = LbDigaoDalpiazLinkClick 358 | end 359 | object EdCompVersion: TEdit 360 | Left = 528 361 | Top = 32 362 | Width = 161 363 | Height = 21 364 | TabStop = False 365 | Color = clBtnFace 366 | ReadOnly = True 367 | TabOrder = 1 368 | end 369 | end 370 | -------------------------------------------------------------------------------- /UFrm.pas: -------------------------------------------------------------------------------- 1 | {------------------------------------------------------------------------------ 2 | Component Installer app 3 | Developed by Rodrigo Depine Dalpiaz (digao dalpiaz) 4 | Delphi utility app to auto-install component packages into IDE 5 | 6 | https://github.com/digao-dalpiaz/CompInstall 7 | 8 | Please, read the documentation at GitHub link. 9 | ------------------------------------------------------------------------------} 10 | 11 | unit UFrm; 12 | 13 | interface 14 | 15 | uses Vcl.Forms, Vcl.ExtCtrls, Vcl.StdCtrls, Vcl.ComCtrls, Vcl.Buttons, 16 | Vcl.Controls, System.Classes, 17 | // 18 | Vcl.Graphics, UDefinitions; 19 | 20 | type 21 | TFrm = class(TForm) 22 | LbComponentName: TLabel; 23 | EdCompName: TEdit; 24 | LbDelphiVersion: TLabel; 25 | EdDV: TComboBox; 26 | Ck64bit: TCheckBox; 27 | LbInstallLog: TLabel; 28 | BtnInstall: TBitBtn; 29 | BtnExit: TBitBtn; 30 | M: TRichEdit; 31 | LbVersion: TLabel; 32 | LbDigaoDalpiaz: TLinkLabel; 33 | LbComponentVersion: TLabel; 34 | EdCompVersion: TEdit; 35 | procedure FormCreate(Sender: TObject); 36 | procedure FormDestroy(Sender: TObject); 37 | procedure BtnExitClick(Sender: TObject); 38 | procedure BtnInstallClick(Sender: TObject); 39 | procedure LbDigaoDalpiazLinkClick(Sender: TObject; const Link: string; 40 | LinkType: TSysLinkType); 41 | procedure FormShow(Sender: TObject); 42 | private 43 | D: TDefinitions; 44 | DefLoaded: Boolean; 45 | public 46 | procedure LoadDefinitions; 47 | 48 | procedure SetButtons(bEnabled: Boolean); 49 | procedure Log(const A: string; bBold: Boolean = True; Color: TColor = clBlack); 50 | end; 51 | 52 | var 53 | Frm: TFrm; 54 | 55 | implementation 56 | 57 | {$R *.dfm} 58 | 59 | uses System.SysUtils, Vcl.Dialogs, System.UITypes, 60 | Winapi.Windows, Winapi.Messages, Winapi.ShellAPI, 61 | UCommon, UProcess, UGitHub, UDelphiVersionCombo; 62 | 63 | procedure TFrm.Log(const A: string; bBold: Boolean = True; Color: TColor = clBlack); 64 | begin 65 | //log text at RichEdit control, with some formatted rules 66 | 67 | M.SelStart := Length(M.Text); 68 | 69 | if bBold then 70 | M.SelAttributes.Style := [fsBold] 71 | else 72 | M.SelAttributes.Style := []; 73 | 74 | M.SelAttributes.Color := Color; 75 | 76 | M.SelText := A+#13#10; 77 | 78 | SendMessage(M.Handle, WM_VSCROLL, SB_BOTTOM, 0); //scroll to bottom 79 | end; 80 | 81 | procedure TFrm.LoadDefinitions; 82 | begin 83 | if Assigned(D) then D.Free; 84 | 85 | DefLoaded := False; 86 | 87 | D := TDefinitions.Create; 88 | try 89 | D.LoadIniFile(AppDir+INI_FILE_NAME); 90 | 91 | EdCompName.Text := D.CompName; 92 | EdCompVersion.Text := D.CompVersion; 93 | 94 | TDelphiVersionComboLoader.Load(EdDV, D.DelphiVersions); 95 | 96 | Ck64bit.Visible := D.HasAny64bit; 97 | 98 | DefLoaded := True; 99 | except 100 | on E: Exception do 101 | Log('Error loading component definitions: '+E.Message, True, clRed); 102 | end; 103 | end; 104 | 105 | procedure TFrm.FormCreate(Sender: TObject); 106 | begin 107 | ReportMemoryLeaksOnShutdown := True; 108 | 109 | AppDir := ExtractFilePath(Application.ExeName); 110 | 111 | LoadDefinitions; 112 | end; 113 | 114 | procedure TFrm.FormDestroy(Sender: TObject); 115 | begin 116 | D.Free; 117 | TDelphiVersionComboLoader.Clear(EdDV); 118 | end; 119 | 120 | procedure TFrm.FormShow(Sender: TObject); 121 | begin 122 | if DefLoaded then 123 | CheckGitHubUpdate(D.GitHubRepository, D.CompVersion); 124 | end; 125 | 126 | procedure TFrm.LbDigaoDalpiazLinkClick(Sender: TObject; const Link: string; 127 | LinkType: TSysLinkType); 128 | begin 129 | ShellExecute(0, '', PChar(Link), '', '', SW_SHOWNORMAL); 130 | end; 131 | 132 | procedure TFrm.BtnExitClick(Sender: TObject); 133 | begin 134 | Close; 135 | end; 136 | 137 | procedure TFrm.BtnInstallClick(Sender: TObject); 138 | var 139 | P: TProcess; 140 | begin 141 | if not DefLoaded then 142 | raise Exception.Create('Component definitions are not loaded'); 143 | 144 | M.Clear; //clear log 145 | 146 | if EdDV.ItemIndex=-1 then 147 | begin 148 | MessageDlg('Select one Delphi version', mtError, [mbOK], 0); 149 | EdDV.SetFocus; 150 | Exit; 151 | end; 152 | 153 | //check if Delphi IDE is running 154 | if FindWindow('TAppBuilder', nil)<>0 then 155 | begin 156 | MessageDlg('Please, close Delphi IDE first!', mtError, [mbOK], 0); 157 | Exit; 158 | end; 159 | 160 | SetButtons(False); 161 | Refresh; 162 | 163 | P := TProcess.Create(D, 164 | TDelphiVersionItem(EdDV.Items.Objects[EdDV.ItemIndex]).InternalNumber, 165 | Ck64bit.Checked and Ck64bit.Visible); 166 | 167 | P.Start; 168 | end; 169 | 170 | procedure TFrm.SetButtons(bEnabled: Boolean); 171 | begin 172 | BtnInstall.Enabled := bEnabled; 173 | BtnExit.Enabled := bEnabled; 174 | end; 175 | 176 | end. 177 | -------------------------------------------------------------------------------- /UFrmOldFiles.dfm: -------------------------------------------------------------------------------- 1 | object FrmOldFiles: TFrmOldFiles 2 | Left = 0 3 | Top = 0 4 | BorderStyle = bsDialog 5 | Caption = 'Deleting old files' 6 | ClientHeight = 558 7 | ClientWidth = 618 8 | Color = clBtnFace 9 | Font.Charset = DEFAULT_CHARSET 10 | Font.Color = clWindowText 11 | Font.Height = -11 12 | Font.Name = 'Segoe UI' 13 | Font.Style = [] 14 | Position = poScreenCenter 15 | TextHeight = 13 16 | object LbBig: TLabel 17 | Left = 8 18 | Top = 8 19 | Width = 143 20 | Height = 45 21 | Caption = 'Warning!' 22 | Font.Charset = DEFAULT_CHARSET 23 | Font.Color = clRed 24 | Font.Height = -33 25 | Font.Name = 'Segoe UI' 26 | Font.Style = [fsBold] 27 | ParentFont = False 28 | end 29 | object LbInfo: TLabel 30 | Left = 8 31 | Top = 56 32 | Width = 376 33 | Height = 15 34 | Caption = 35 | 'All files and folders below will be deleted to update the compon' + 36 | 'ent.' 37 | Font.Charset = DEFAULT_CHARSET 38 | Font.Color = clWindowText 39 | Font.Height = -12 40 | Font.Name = 'Segoe UI' 41 | Font.Style = [fsBold] 42 | ParentFont = False 43 | end 44 | object LbConfirm: TLabel 45 | Left = 8 46 | Top = 456 47 | Width = 84 48 | Height = 13 49 | Caption = 'Type "CONFIRM"' 50 | end 51 | object BottomLine: TBevel 52 | Left = 8 53 | Top = 504 54 | Width = 601 55 | Height = 9 56 | Shape = bsBottomLine 57 | end 58 | object LFiles: TListView 59 | Left = 8 60 | Top = 80 61 | Width = 601 62 | Height = 369 63 | Columns = < 64 | item 65 | Caption = 'Name' 66 | Width = 565 67 | end> 68 | ReadOnly = True 69 | SmallImages = IL 70 | TabOrder = 0 71 | ViewStyle = vsReport 72 | end 73 | object BtnOK: TButton 74 | Left = 208 75 | Top = 520 76 | Width = 97 77 | Height = 33 78 | Caption = 'OK' 79 | Enabled = False 80 | ModalResult = 1 81 | TabOrder = 2 82 | end 83 | object BtnCancel: TButton 84 | Left = 312 85 | Top = 520 86 | Width = 97 87 | Height = 33 88 | Cancel = True 89 | Caption = 'Cancel' 90 | ModalResult = 2 91 | TabOrder = 3 92 | end 93 | object EdConfirm: TEdit 94 | Left = 8 95 | Top = 472 96 | Width = 601 97 | Height = 21 98 | CharCase = ecUpperCase 99 | TabOrder = 1 100 | OnChange = EdConfirmChange 101 | end 102 | object IL: TImageList 103 | Left = 392 104 | Top = 24 105 | Bitmap = { 106 | 494C010102000800040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 107 | 0000000000003600000028000000400000001000000001002000000000000010 108 | 00000000000000000000000000000000000000000000000000001F1F1FE00000 109 | 00FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000 110 | 00FF000000FF202020DF0000000000000000D0EFFF4EB2E5FF80B2E5FF80B2E5 111 | FF80B2E5FF80B2E5FF80B2E5FF80B2E5FF80B2E5FF80B2E5FF80B2E5FF80B2E5 112 | FF80B2E5FF80B2E5FF80B2E5FF80D0EFFF4E0000000000000000000000000000 113 | 0000000000000000000000000000000000000000000000000000000000000000 114 | 0000000000000000000000000000000000000000000000000000000000000000 115 | 0000000000000000000000000000000000000000000000000000000000000000 116 | 0000000000000000000000000000000000000000000000000000000000FF0000 117 | 00FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000 118 | 00FF000000FF000000FF000000000000000069CDFFF966CCFFFF66CCFFFF66CC 119 | FFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CC 120 | FFFF66CCFFFF66CCFFFF66CCFFFF69CDFFF90000000000000000000000000000 121 | 0000000000000000000000000000000000000000000000000000000000000000 122 | 0000000000000000000000000000000000000000000000000000000000000000 123 | 0000000000000000000000000000000000000000000000000000000000000000 124 | 0000000000000000000000000000000000000000000000000000000000FF0000 125 | 00FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000 126 | 00FF000000FF000000FF000000000000000066CCFFFF66CCFFFF66CCFFFF66CC 127 | FFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CC 128 | FFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF0000000000000000000000000000 129 | 0000000000000000000000000000000000000000000000000000000000000000 130 | 0000000000000000000000000000000000000000000000000000000000000000 131 | 0000000000000000000000000000000000000000000000000000000000000000 132 | 0000000000000000000000000000000000000000000000000000000000FF0000 133 | 00FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000 134 | 00FF000000FF000000FF000000000000000066CCFFFF66CCFFFF66CCFFFF66CC 135 | FFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CC 136 | FFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF0000000000000000000000000000 137 | 0000000000000000000000000000000000000000000000000000000000000000 138 | 0000000000000000000000000000000000000000000000000000000000000000 139 | 0000000000000000000000000000000000000000000000000000000000000000 140 | 0000000000000000000000000000000000000000000000000000000000FF0000 141 | 00FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000 142 | 00FF000000FF000000FF000000000000000066CCFFFF66CCFFFF66CCFFFF66CC 143 | FFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CC 144 | FFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF0000000000000000000000000000 145 | 0000000000000000000000000000000000000000000000000000000000000000 146 | 0000000000000000000000000000000000000000000000000000000000000000 147 | 0000000000000000000000000000000000000000000000000000000000000000 148 | 0000000000000000000000000000000000000000000000000000000000FF0000 149 | 00FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000 150 | 00FF000000FF000000FF000000000000000066CCFFFF66CCFFFF66CCFFFF66CC 151 | FFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CC 152 | FFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF0000000000000000000000000000 153 | 0000000000000000000000000000000000000000000000000000000000000000 154 | 0000000000000000000000000000000000000000000000000000000000000000 155 | 0000000000000000000000000000000000000000000000000000000000000000 156 | 0000000000000000000000000000000000000000000000000000000000FF0000 157 | 00FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000 158 | 00FF000000FF000000FF000000000000000066CCFFFF66CCFFFF66CCFFFF66CC 159 | FFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CC 160 | FFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF0000000000000000000000000000 161 | 0000000000000000000000000000000000000000000000000000000000000000 162 | 0000000000000000000000000000000000000000000000000000000000000000 163 | 0000000000000000000000000000000000000000000000000000000000000000 164 | 0000000000000000000000000000000000000000000000000000000000FF0000 165 | 00FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000 166 | 00FF000000FF000000FF000000000000000066CCFFFF66CCFFFF66CCFFFF66CC 167 | FFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CC 168 | FFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF0000000000000000000000000000 169 | 0000000000000000000000000000000000000000000000000000000000000000 170 | 0000000000000000000000000000000000000000000000000000000000000000 171 | 0000000000000000000000000000000000000000000000000000000000000000 172 | 0000000000000000000000000000000000000000000000000000000000FF0000 173 | 00FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000 174 | 00FF000000FF000000FF000000000000000066CCFFFF66CCFFFF66CCFFFF66CC 175 | FFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CC 176 | FFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF0000000000000000000000000000 177 | 0000000000000000000000000000000000000000000000000000000000000000 178 | 0000000000000000000000000000000000000000000000000000000000000000 179 | 0000000000000000000000000000000000000000000000000000000000000000 180 | 0000000000000000000000000000000000000000000000000000000000FF0000 181 | 00FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000 182 | 00FF000000FF000000FF000000000000000066CCFFFF66CCFFFF66CCFFFF66CC 183 | FFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CC 184 | FFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF0000000000000000000000000000 185 | 0000000000000000000000000000000000000000000000000000000000000000 186 | 0000000000000000000000000000000000000000000000000000000000000000 187 | 0000000000000000000000000000000000000000000000000000000000000000 188 | 0000000000000000000000000000000000000000000000000000000000FF0000 189 | 00FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000 190 | 00FF000000FF000000FF000000000000000066CCFFFF66CCFFFF66CCFFFF66CC 191 | FFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CC 192 | FFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF0000000000000000000000000000 193 | 0000000000000000000000000000000000000000000000000000000000000000 194 | 0000000000000000000000000000000000000000000000000000000000000000 195 | 0000000000000000000000000000000000000000000000000000000000000000 196 | 0000000000000000000000000000000000000000000000000000000000FF0000 197 | 00FF000000FF000000FF000000FF000000FF000000FFDFDFDF20000000000000 198 | 00000000000000000000000000000000000066CBFEFF66CCFFFF66CCFFFF66CC 199 | FFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CCFFFF66CC 200 | FFFF66CCFFFF66CCFFFF66CCFFFF66CBFEFF0000000000000000000000000000 201 | 0000000000000000000000000000000000000000000000000000000000000000 202 | 0000000000000000000000000000000000000000000000000000000000000000 203 | 0000000000000000000000000000000000000000000000000000000000000000 204 | 0000000000000000000000000000000000000000000000000000000000FF0000 205 | 00FF000000FF000000FF000000FF000000FF000000FF00000000000000FF0000 206 | 00FF000000FF232323DC000000000000000059B1DDFFC3E5FEFFC6E7FFFFC6E7 207 | FFFFC6E7FFFFC6E7FFFFC6E7FFFFC6E7FFFFC6E7FFFFC6E7FFFFC6E7FFFFC6E7 208 | FFFFC6E7FFFFC6E7FFFFC3E5FEFF59B1DDFF0000000000000000000000000000 209 | 0000000000000000000000000000000000000000000000000000000000000000 210 | 0000000000000000000000000000000000000000000000000000000000000000 211 | 0000000000000000000000000000000000000000000000000000000000000000 212 | 0000000000000000000000000000000000000000000000000000000000FF0000 213 | 00FF000000FF000000FF000000FF000000FF000000FF00000000000000FF0000 214 | 00FF202020DFDFDFDF20000000000000000052A3CCFFA2C5DDFFC2D7E7FFC2D7 215 | E7FFC2D7E7FFC2D7E7FFC2D7E7FFC2D7E7FFC2D7E7FFC2D7E7FFC2D7E7FFC2D7 216 | E7FFC2D7E7FFC2D7E7FFA1C5DDFF56A5CDF90000000000000000000000000000 217 | 0000000000000000000000000000000000000000000000000000000000000000 218 | 0000000000000000000000000000000000000000000000000000000000000000 219 | 0000000000000000000000000000000000000000000000000000000000000000 220 | 0000000000000000000000000000000000000000000000000000000000FF0000 221 | 00FF000000FF000000FF000000FF000000FF000000FF00000000000000FF2020 222 | 20DFDFDFDF2000000000000000000000000056A5CDF952A3CCFF52A3CCFF52A3 223 | CCFF52A3CCFF56A5CDF9A8D0E580A8D0E580A8D0E580A8D0E580A8D0E580A8D0 224 | E580A8D0E580A8D0E580A8D0E580CAE2EF4E0000000000000000000000000000 225 | 0000000000000000000000000000000000000000000000000000000000000000 226 | 0000000000000000000000000000000000000000000000000000000000000000 227 | 0000000000000000000000000000000000000000000000000000000000000000 228 | 00000000000000000000000000000000000000000000000000001F1F1FE00000 229 | 00FF000000FF000000FF000000FF000000FF000000FF00000000232323DCDFDF 230 | DF2000000000000000000000000000000000CAE2EF4EA8D0E580A8D0E580A8D0 231 | E580A8D0E580CAE2EF4EFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF 232 | FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF000000000000000000000000000000 233 | 0000000000000000000000000000000000000000000000000000000000000000 234 | 0000000000000000000000000000000000000000000000000000000000000000 235 | 0000000000000000000000000000000000000000000000000000000000000000 236 | 000000000000000000000000000000000000424D3E000000000000003E000000 237 | 2800000040000000100000000100010000000000800000000000000000000000 238 | 000000000000000000000000FFFFFF00C003000000000000C003000000000000 239 | C003000000000000C003000000000000C003000000000000C003000000000000 240 | C003000000000000C003000000000000C003000000000000C003000000000000 241 | C003000000000000C03F000000000000C043000000000000C043000000000000 242 | C047000000000000C04F00000000000000000000000000000000000000000000 243 | 000000000000} 244 | end 245 | end 246 | -------------------------------------------------------------------------------- /UFrmOldFiles.pas: -------------------------------------------------------------------------------- 1 | unit UFrmOldFiles; 2 | 3 | interface 4 | 5 | uses Vcl.Forms, Vcl.ExtCtrls, Vcl.StdCtrls, System.ImageList, Vcl.ImgList, 6 | Vcl.Controls, Vcl.ComCtrls, System.Classes; 7 | 8 | type 9 | TFrmOldFiles = class(TForm) 10 | LbBig: TLabel; 11 | LbInfo: TLabel; 12 | LFiles: TListView; 13 | IL: TImageList; 14 | BtnOK: TButton; 15 | BtnCancel: TButton; 16 | LbConfirm: TLabel; 17 | EdConfirm: TEdit; 18 | BottomLine: TBevel; 19 | procedure EdConfirmChange(Sender: TObject); 20 | end; 21 | 22 | var 23 | FrmOldFiles: TFrmOldFiles; 24 | 25 | implementation 26 | 27 | {$R *.dfm} 28 | 29 | procedure TFrmOldFiles.EdConfirmChange(Sender: TObject); 30 | begin 31 | BtnOK.Enabled := EdConfirm.Text = 'CONFIRM'; 32 | end; 33 | 34 | end. 35 | -------------------------------------------------------------------------------- /UGitHub.pas: -------------------------------------------------------------------------------- 1 | unit UGitHub; 2 | 3 | interface 4 | 5 | procedure CheckGitHubUpdate(const Repository, CurrentVersion: string); 6 | 7 | implementation 8 | 9 | uses System.Classes, System.SysUtils, System.Generics.Collections, 10 | Vcl.Forms, Vcl.Graphics, Vcl.Dialogs, 11 | System.UITypes, System.IOUtils, System.StrUtils, System.Math, 12 | System.Net.HttpClient, System.JSON, Vcl.ExtActns, System.Zip, 13 | UFrm, UFrmOldFiles, UCommon; 14 | 15 | const URL_GITHUB = 'https://api.github.com/repos/%s/releases/latest'; 16 | 17 | type 18 | TOldFile = class 19 | private 20 | Path: string; 21 | Folder: Boolean; 22 | end; 23 | TOldFiles = class(TObjectList) 24 | private 25 | procedure Add(const Path: string; Folder: Boolean); 26 | end; 27 | 28 | TThCheck = class(TThread) 29 | public 30 | constructor Create(Suspended: Boolean); 31 | destructor Destroy; override; 32 | protected 33 | procedure Execute; override; 34 | private 35 | Repository: string; 36 | CurrentVersion: string; 37 | 38 | OldFiles: TOldFiles; 39 | 40 | procedure Check; 41 | function ConfirmOldFiles: Boolean; 42 | procedure Download(const URL: string); 43 | procedure Log(const A: string; bBold: Boolean = True; Color: TColor = clBlack); 44 | procedure GetOldFiles; 45 | procedure DeleteOldFiles; 46 | end; 47 | 48 | constructor TThCheck.Create(Suspended: Boolean); 49 | begin 50 | inherited; 51 | OldFiles := TOldFiles.Create; 52 | end; 53 | 54 | destructor TThCheck.Destroy; 55 | begin 56 | OldFiles.Free; 57 | inherited; 58 | end; 59 | 60 | procedure TThCheck.Execute; 61 | begin 62 | FreeOnTerminate := True; 63 | 64 | try 65 | Check; 66 | except 67 | on E: Exception do 68 | Log('ERROR: '+E.Message, True, clRed); 69 | end; 70 | 71 | Synchronize( 72 | procedure 73 | begin 74 | Frm.SetButtons(True); 75 | end); 76 | end; 77 | 78 | procedure TThCheck.Log(const A: string; bBold: Boolean = True; Color: TColor = clBlack); 79 | begin 80 | Synchronize( 81 | procedure 82 | begin 83 | Frm.Log(A, bBold, Color); 84 | end); 85 | end; 86 | 87 | procedure TThCheck.Check; 88 | var 89 | H: THTTPClient; 90 | Res, tag_url, tag_version, tag_zip: string; 91 | data: TJSONObject; 92 | Confirm: Boolean; 93 | begin 94 | Log('Checking for component update...'); 95 | 96 | H := THTTPClient.Create; 97 | try 98 | Res := H.Get(Format(URL_GITHUB, [Repository])).ContentAsString; 99 | finally 100 | H.Free; 101 | end; 102 | 103 | data := TJSONObject.ParseJSONValue(Res) as TJSONObject; 104 | try 105 | if data.GetValue('id')=nil then 106 | raise Exception.Create('No releases found on GitHub'); 107 | 108 | tag_version := data.GetValue('tag_name').Value; 109 | tag_url := data.GetValue('html_url').Value; 110 | tag_zip := data.GetValue('zipball_url').Value; 111 | finally 112 | data.Free; 113 | end; 114 | 115 | if tag_version.StartsWith('v', True) then Delete(tag_version, 1, 1); 116 | 117 | if CurrentVersion<>tag_version then 118 | begin 119 | Log(Format('New version "%s" available.', [tag_version]), True, clPurple); 120 | 121 | Synchronize( 122 | procedure 123 | begin 124 | Confirm := MessageDlg(Format( 125 | 'There is a new version "%s" of the component available at GitHub.'+ 126 | ' Do you want to update it automatically?', 127 | [tag_version]), mtInformation, mbYesNo, 0) = mrYes; 128 | end); 129 | 130 | if Confirm and ConfirmOldFiles then 131 | Download(tag_zip); 132 | 133 | end else 134 | Log('Your version is already updated.', True, clGreen); 135 | end; 136 | 137 | function TThCheck.ConfirmOldFiles: Boolean; 138 | var 139 | Confirm: Boolean; 140 | begin 141 | GetOldFiles; 142 | if OldFiles.Count=0 then Exit(True); //nothing to delete, auto confirm 143 | 144 | Synchronize( 145 | procedure 146 | var 147 | OldFile: TOldFile; 148 | begin 149 | FrmOldFiles := TFrmOldFiles.Create(Application); 150 | for OldFile in OldFiles do 151 | with FrmOldFiles.LFiles.Items.Add do 152 | begin 153 | Caption := ExtractFileName(OldFile.Path); 154 | ImageIndex := IfThen(OldFile.Folder, 1, 0); 155 | end; 156 | Confirm := FrmOldFiles.ShowModal = mrOk; 157 | FrmOldFiles.Free; 158 | end); 159 | 160 | if Confirm then 161 | begin 162 | DeleteOldFiles; 163 | Result := True; 164 | end else 165 | Result := False; 166 | end; 167 | 168 | procedure TThCheck.GetOldFiles; 169 | var 170 | Path, FileName: string; 171 | begin 172 | //directories 173 | for Path in TDirectory.GetDirectories(AppDir) do 174 | begin 175 | {$WARN SYMBOL_PLATFORM OFF} 176 | if TFileAttribute.faHidden in TDirectory.GetAttributes(Path) then Continue; //ignore hidden folders (like .git) 177 | {$WARN SYMBOL_PLATFORM ON} 178 | 179 | OldFiles.Add(Path, True); 180 | end; 181 | 182 | //files 183 | for Path in TDirectory.GetFiles(AppDir) do 184 | begin 185 | FileName := ExtractFileName(Path); 186 | //skip self EXE and CompInstall.ini 187 | if SameText(FileName, ExtractFileName(ParamStr(0))) or 188 | SameText(FileName, INI_FILE_NAME) then Continue; 189 | 190 | OldFiles.Add(Path, False); 191 | end; 192 | end; 193 | 194 | procedure TThCheck.DeleteOldFiles; 195 | var 196 | OldFile: TOldFile; 197 | begin 198 | Log('Cleaning component folder...'); 199 | 200 | for OldFile in OldFiles do 201 | begin 202 | try 203 | if OldFile.Folder then 204 | TDirectory.Delete(OldFile.Path, True) 205 | else 206 | TFile.Delete(OldFile.Path); 207 | except 208 | on E: Exception do 209 | raise Exception.CreateFmt('Could not delete %s %s: %s', 210 | [IfThen(OldFile.Folder, 'folder', 'file'), OldFile.Path, E.Message]); 211 | end; 212 | end; 213 | end; 214 | 215 | procedure TThCheck.Download(const URL: string); 216 | var 217 | Dw: TDownLoadURL; 218 | TmpFile: string; 219 | Z: TZipFile; 220 | ZPath, ZFile, ZFileNormalized: string; 221 | begin 222 | Log('Downloading new version...'); 223 | 224 | TmpFile := TPath.GetTempFileName; 225 | 226 | Dw := TDownLoadURL.Create(nil); 227 | try 228 | Dw.URL := URL; 229 | Dw.Filename := TmpFile; 230 | Dw.ExecuteTarget(nil); 231 | finally 232 | Dw.Free; 233 | end; 234 | 235 | Log('Extracting component updates...'); 236 | 237 | Z := TZipFile.Create; 238 | try 239 | Z.Open(TmpFile, zmRead); 240 | 241 | for ZFile in Z.FileNames do 242 | begin 243 | try 244 | ZFileNormalized := NormalizeAndRemoveFirstDir(ZFile); 245 | 246 | ZPath := TPath.Combine(AppDir, ExtractFilePath(ZFileNormalized)); 247 | if not DirectoryExists(ZPath) then ForceDirectories(ZPath); 248 | 249 | Z.Extract(ZFile, ZPath, False); 250 | except 251 | on E: Exception do 252 | raise Exception.CreateFmt('Error extracting "%s": %s', [ZFile, E.Message]); 253 | end; 254 | end; 255 | finally 256 | Z.Free; 257 | end; 258 | 259 | Log('Reloading component info...'); 260 | Synchronize(Frm.LoadDefinitions); //reaload definitions 261 | 262 | Log('Update complete!', True, clGreen); 263 | end; 264 | 265 | // 266 | 267 | procedure CheckGitHubUpdate(const Repository, CurrentVersion: string); 268 | var 269 | C: TThCheck; 270 | begin 271 | if Repository.IsEmpty then Exit; 272 | 273 | Frm.SetButtons(False); 274 | 275 | C := TThCheck.Create(True); 276 | C.Repository := Repository; 277 | C.CurrentVersion := CurrentVersion; 278 | C.Start; 279 | end; 280 | 281 | { TOldFiles } 282 | 283 | procedure TOldFiles.Add(const Path: string; Folder: Boolean); 284 | var 285 | OldFile: TOldFile; 286 | begin 287 | OldFile := TOldFile.Create; 288 | OldFile.Path := Path; 289 | OldFile.Folder := Folder; 290 | inherited Add(OldFile); 291 | end; 292 | 293 | end. 294 | -------------------------------------------------------------------------------- /UProcess.pas: -------------------------------------------------------------------------------- 1 | unit UProcess; 2 | 3 | interface 4 | 5 | uses System.Classes, Vcl.Graphics, UDefinitions; 6 | 7 | type 8 | TProcess = class(TThread) 9 | public 10 | constructor Create(D: TDefinitions; 11 | const InternalDelphiVersionKey: string; Flag64bit: Boolean); 12 | protected 13 | procedure Execute; override; 14 | private 15 | D: TDefinitions; 16 | InternalDelphiVersionKey: string; 17 | Flag64bit: Boolean; 18 | 19 | MSBuildExe: string; 20 | 21 | CompilerNotSupportBuilding: Boolean; 22 | 23 | procedure Log(const A: string; bBold: Boolean = True; Color: TColor = clBlack); 24 | 25 | procedure FindMSBuild; 26 | procedure Compile; 27 | procedure CompilePackage(P: TPackage; const aBat, aPlatform: string); 28 | procedure AddLibrary; 29 | procedure PublishFiles(P: TPackage; const aPlatform: string); 30 | procedure RegisterBPL(const aPackage: string); 31 | procedure OnLine(const Text: string); 32 | 33 | function GetOutputPath(const aPlatform: string): string; 34 | function GetBplDirectory: string; 35 | end; 36 | 37 | implementation 38 | 39 | uses System.Win.Registry, Winapi.Windows, System.SysUtils, 40 | UCommon, UCmdExecBuffer, System.IOUtils, Winapi.ShlObj, 41 | UFrm; 42 | 43 | const 44 | COMPILING_ERROR_VERSION_NOT_SUPORTED = 'This version of the product does not support command line compiling'; 45 | 46 | constructor TProcess.Create(D: TDefinitions; 47 | const InternalDelphiVersionKey: string; Flag64bit: Boolean); 48 | begin 49 | inherited Create(True); 50 | FreeOnTerminate := True; 51 | 52 | Self.D := D; 53 | Self.InternalDelphiVersionKey := InternalDelphiVersionKey; 54 | Self.Flag64bit := Flag64bit; 55 | end; 56 | 57 | procedure TProcess.Execute; 58 | begin 59 | try 60 | FindMSBuild; //find MSBUILD.EXE to use for compilation 61 | 62 | Log('COMPILE COMPONENT...'); 63 | Compile; 64 | 65 | if D.AddLibrary then 66 | AddLibrary; //add library paths to Delphi 67 | 68 | Log('COMPONENT INSTALLED!', True, clGreen); 69 | except 70 | on E: Exception do 71 | Log('ERROR: '+E.Message, True, clRed); 72 | end; 73 | 74 | Synchronize( 75 | procedure 76 | begin 77 | Frm.SetButtons(True); 78 | end); 79 | end; 80 | 81 | procedure TProcess.Log(const A: string; bBold: Boolean = True; Color: TColor = clBlack); 82 | begin 83 | Synchronize( 84 | procedure 85 | begin 86 | Frm.Log(A, bBold, Color); 87 | end); 88 | end; 89 | 90 | procedure TProcess.Compile; 91 | var 92 | R: TRegistry; 93 | aRootDir: string; 94 | aBat: string; 95 | 96 | P: TPackage; 97 | begin 98 | R := TRegistry.Create; 99 | try 100 | R.RootKey := HKEY_CURRENT_USER; 101 | if not R.OpenKeyReadOnly(BDS_KEY+'\'+InternalDelphiVersionKey) then 102 | raise Exception.Create('Main registry of Delphi version not found'); 103 | 104 | aRootDir := R.ReadString('RootDir'); 105 | 106 | if aRootDir='' then 107 | raise Exception.Create('Unable to get Delphi root folder'); 108 | 109 | finally 110 | R.Free; 111 | end; 112 | 113 | if not DirectoryExists(aRootDir) then 114 | raise Exception.Create('Delphi root folder does not exist'); 115 | 116 | aBat := TPath.Combine(aRootDir, 'bin\rsvars.bat'); 117 | if not FileExists(aBat) then 118 | raise Exception.Create('Internal Delphi batch file "rsvars" not found'); 119 | 120 | if Flag64bit and not FileExists(TPath.Combine(aRootDir, 'bin\dcc64.exe')) then 121 | raise Exception.Create('Delphi 64 bit compiler not found'); 122 | 123 | for P in D.Packages do 124 | begin 125 | CompilePackage(P, aBat, 'Win32'); 126 | 127 | if Flag64bit and P.Allow64bit then 128 | CompilePackage(P, aBat, 'Win64'); 129 | 130 | if P.Install then 131 | RegisterBPL(P.Name); 132 | end; 133 | end; 134 | 135 | procedure TProcess.CompilePackage(P: TPackage; const aBat, aPlatform: string); 136 | var 137 | C: TCmdExecBuffer; 138 | aPath, aFile: string; 139 | begin 140 | Log('Compile package '+P.Name+' ('+aPlatform+')'); 141 | 142 | aPath := TPath.Combine(AppDir, P.Path); //if P.Path blank, Combine ignores automatically 143 | aFile := TPath.Combine(aPath, P.Name); 144 | 145 | C := TCmdExecBuffer.Create; 146 | try 147 | C.OnLine := OnLine; 148 | 149 | C.CommandLine := 150 | Format('""%s" & "%s" "%s.dproj" /t:build /p:config=Release /p:platform=%s"', 151 | [aBat, MSBuildExe, aFile, aPlatform]); 152 | 153 | C.WorkDir := aPath; 154 | 155 | if not C.Exec then 156 | raise Exception.Create('Could not execute MSBUILD'); 157 | 158 | if C.ExitCode<>0 then 159 | raise Exception.CreateFmt('Error compiling package %s (Exit Code %d)', [P.Name, C.ExitCode]); 160 | 161 | if CompilerNotSupportBuilding then 162 | raise Exception.Create(COMPILING_ERROR_VERSION_NOT_SUPORTED); 163 | finally 164 | C.Free; 165 | end; 166 | 167 | //publish files 168 | PublishFiles(P, aPlatform); 169 | 170 | Log(''); 171 | end; 172 | 173 | procedure TProcess.OnLine(const Text: string); 174 | begin 175 | //event for command line execution (line-by-line) 176 | Log(TrimRight(Text), False); 177 | 178 | //MSBUILD does not return error exit code when delphi compiler not supported, so here we check for string message error 179 | if Text.Contains(COMPILING_ERROR_VERSION_NOT_SUPORTED) then CompilerNotSupportBuilding := True; 180 | end; 181 | 182 | procedure TProcess.PublishFiles(P: TPackage; const aPlatform: string); 183 | var 184 | RelativeFile, aSource, aDest: string; 185 | begin 186 | for RelativeFile in P.PublishFiles do 187 | begin 188 | aSource := AppDir+RelativeFile; 189 | aDest := GetOutputPath(aPlatform)+'\'+ExtractFileName(RelativeFile); 190 | 191 | Log(Format('Copy file %s to %s', [RelativeFile{aSource}, aDest]), False, clPurple); 192 | TFile.Copy(aSource, aDest, True); 193 | end; 194 | end; 195 | 196 | procedure TProcess.AddLibrary; 197 | 198 | procedure AddKey(const aPlatform: string); 199 | var 200 | Key, A, Dir: string; 201 | R: TRegistry; 202 | const SEARCH_KEY = 'Search Path'; 203 | begin 204 | Log('Add library path to '+aPlatform); 205 | 206 | Key := BDS_KEY+'\'+InternalDelphiVersionKey+'\Library\'+aPlatform; 207 | Dir := GetOutputPath(aPlatform); 208 | 209 | R := TRegistry.Create; 210 | try 211 | R.RootKey := HKEY_CURRENT_USER; 212 | 213 | if not R.OpenKey(Key, False) then 214 | raise Exception.Create('Registry key for library '+aPlatform+' not found'); 215 | 216 | A := R.ReadString(SEARCH_KEY); 217 | if not HasInList(Dir, A) then 218 | R.WriteString(SEARCH_KEY, A+';'+Dir); 219 | 220 | finally 221 | R.Free; 222 | end; 223 | end; 224 | 225 | begin 226 | AddKey('Win32'); 227 | 228 | if Flag64bit then 229 | AddKey('Win64'); 230 | end; 231 | 232 | function GetPublicDocs: string; 233 | var 234 | Path: array[0..MAX_PATH] of Char; 235 | begin 236 | if not ShGetSpecialFolderPath(0, Path, CSIDL_COMMON_DOCUMENTS, False) then 237 | raise Exception.Create('Could not find Public Documents folder location') ; 238 | 239 | Result := Path; 240 | end; 241 | 242 | function TProcess.GetBplDirectory: string; 243 | var 244 | BplDir, PublicPrefix: string; 245 | FS: TFormatSettings; 246 | begin 247 | FS := TFormatSettings.Create; 248 | FS.DecimalSeparator := '.'; 249 | if StrToFloat(InternalDelphiVersionKey, FS)<=12 then //Delphi XE5 or below 250 | PublicPrefix := 'RAD Studio' 251 | else 252 | PublicPrefix := 'Embarcadero\Studio'; 253 | 254 | BplDir := TPath.Combine(GetPublicDocs, PublicPrefix+'\'+InternalDelphiVersionKey+'\Bpl'); 255 | 256 | if not DirectoryExists(BplDir) then 257 | raise Exception.CreateFmt('Public Delphi folder not found at: %s', [BplDir]); 258 | 259 | Result := BplDir; 260 | end; 261 | 262 | procedure TProcess.RegisterBPL(const aPackage: string); 263 | var 264 | R: TRegistry; 265 | BplDir: string; 266 | begin 267 | Log('Install BPL into IDE of '+aPackage); 268 | 269 | BplDir := GetBplDirectory; 270 | 271 | R := TRegistry.Create; 272 | try 273 | R.RootKey := HKEY_CURRENT_USER; 274 | 275 | if not R.OpenKey(BDS_KEY+'\'+InternalDelphiVersionKey+'\Known Packages', False) then 276 | raise Exception.Create('Know Packages registry section not found'); 277 | 278 | R.WriteString(TPath.Combine(BplDir, aPackage+'.bpl'), D.CompName); 279 | 280 | finally 281 | R.Free; 282 | end; 283 | end; 284 | 285 | procedure TProcess.FindMSBuild; 286 | const TOOLS_KEY = 'Software\Microsoft\MSBUILD\ToolsVersions'; 287 | var 288 | R: TRegistry; 289 | S: TStringList; 290 | I: Integer; 291 | Dir, aFile: string; 292 | Found: Boolean; 293 | begin 294 | R := TRegistry.Create; 295 | try 296 | R.RootKey := HKEY_LOCAL_MACHINE; 297 | 298 | if not R.OpenKeyReadOnly(TOOLS_KEY) then 299 | raise Exception.Create('MSBUILD not found'); 300 | 301 | S := TStringList.Create; 302 | try 303 | R.GetKeyNames(S); 304 | 305 | R.CloseKey; 306 | 307 | if S.Count=0 then 308 | raise Exception.Create('There is no .NET Framework version available'); 309 | 310 | S.Sort; //sort msbuild versions 311 | 312 | Found := False; 313 | for I := S.Count-1 downto 0 do //iterate versions from last to first 314 | begin 315 | if not R.OpenKeyReadOnly(TOOLS_KEY+'\'+S[I]) then 316 | raise Exception.Create('Internal error on reading .NET version key'); 317 | 318 | Dir := R.ReadString('MSBuildToolsPath'); 319 | R.CloseKey; 320 | 321 | if Dir<>'' then 322 | begin 323 | aFile := TPath.Combine(Dir, 'MSBUILD.EXE'); 324 | if FileExists(aFile) then 325 | begin 326 | //msbuild found 327 | Found := True; 328 | Break; 329 | end; 330 | end; 331 | end; 332 | 333 | finally 334 | S.Free; 335 | end; 336 | 337 | finally 338 | R.Free; 339 | end; 340 | 341 | if not Found then 342 | raise Exception.Create('MSBUILD not found in any .NET Framework version'); 343 | 344 | MSBuildExe := aFile; 345 | end; 346 | 347 | function TProcess.GetOutputPath(const aPlatform: string): string; 348 | begin 349 | if not D.OutputPath.IsEmpty then 350 | Result := D.OutputPath 351 | else 352 | Result := '{PLATFORM}\{CONFIG}'; 353 | 354 | Result := Result.Replace('{PLATFORM}', aPlatform); 355 | Result := Result.Replace('{CONFIG}', 'Release'); 356 | 357 | Result := AppDir + Result; 358 | end; 359 | 360 | end. 361 | -------------------------------------------------------------------------------- /images/app_preview.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digao-dalpiaz/CompInstall/b210c8df67303c39549719f6c8ddcf4e3d3b9c31/images/app_preview.gif --------------------------------------------------------------------------------