Browse Source

Cleanup/split CompTypes unit.

Martijn Laan 1 year ago
parent
commit
0dae69edd5

+ 2 - 1
Projects/Compil32.dpr

@@ -52,7 +52,8 @@ uses
   Shared.LangOptionsSectionDirectives in 'Src\Shared.LangOptionsSectionDirectives.pas',
   Shared.SetupMessageIDs in 'Src\Shared.SetupMessageIDs.pas',
   Shared.SetupSectionDirectives in 'Src\Shared.SetupSectionDirectives.pas',
-  Shared.CompTypes in 'Src\Shared.CompTypes.pas',
+  Shared.ConfigIniFile in 'Src\Shared.ConfigIniFile.pas',
+  Shared.SignToolsFunc in 'Src\Shared.SignToolsFunc.pas',
   Shared.FileClass in 'Src\Shared.FileClass.pas',
   Shared.Int64Em in 'Src\Shared.Int64Em.pas',
   Shared.Compress in 'Src\Shared.Compress.pas',

+ 2 - 1
Projects/Compil32.dproj

@@ -130,7 +130,8 @@
         <DCCReference Include="Src\Shared.LangOptionsSectionDirectives.pas"/>
         <DCCReference Include="Src\Shared.SetupMessageIDs.pas"/>
         <DCCReference Include="Src\Shared.SetupSectionDirectives.pas"/>
-        <DCCReference Include="Src\Shared.CompTypes.pas"/>
+        <DCCReference Include="Src\Shared.ConfigIniFile.pas"/>
+        <DCCReference Include="Src\Shared.SignToolsFunc.pas"/>
         <DCCReference Include="Src\Shared.FileClass.pas"/>
         <DCCReference Include="Src\Shared.Int64Em.pas"/>
         <DCCReference Include="Src\Shared.Compress.pas"/>

+ 2 - 1
Projects/ISCC.dpr

@@ -24,7 +24,8 @@ uses
   Shared.CommonFunc in 'Src\Shared.CommonFunc.pas',
   Shared.CompilerInt in 'Src\Shared.CompilerInt.pas',
   Shared.FileClass in 'Src\Shared.FileClass.pas',
-  Shared.CompTypes in 'Src\Shared.CompTypes.pas',
+  Shared.ConfigIniFile in 'Src\Shared.ConfigIniFile.pas',
+  Shared.SignToolsFunc in 'Src\Shared.SignToolsFunc.pas',
   Shared.Int64Em in 'Src\Shared.Int64Em.pas';
 
 {$SETPEOSVERSION 6.1}

+ 2 - 1
Projects/ISCC.dproj

@@ -80,7 +80,8 @@
         <DCCReference Include="Src\Shared.CommonFunc.pas"/>
         <DCCReference Include="Src\Shared.CompilerInt.pas"/>
         <DCCReference Include="Src\Shared.FileClass.pas"/>
-        <DCCReference Include="Src\Shared.CompTypes.pas"/>
+        <DCCReference Include="Src\Shared.ConfigIniFile.pas"/>
+        <DCCReference Include="Src\Shared.SignToolsFunc.pas"/>
         <DCCReference Include="Src\Shared.Int64Em.pas"/>
         <BuildConfiguration Include="Base">
             <Key>Base</Key>

+ 2 - 1
Projects/Src/Compil32/IDE.CompileForm.pas

@@ -654,7 +654,8 @@ uses
   PathFunc, Shared.CommonFunc.Vcl, Shared.CommonFunc, Shared.FileClass, IDE.Messages, TmSchema, Shared.BrowseFunc,
   IDE.HtmlHelpFunc, Shared.TaskbarProgressFunc,
   {$IFDEF STATICCOMPILER} Compile, {$ENDIF}
-  IDE.OptionsForm, IDE.StartupForm, IDE.Wizard.WizardForm, IDE.SignToolsForm, Shared.CompTypes, IDE.InputQueryComboForm, IDE.MsgBoxDesignerForm,
+  IDE.OptionsForm, IDE.StartupForm, IDE.Wizard.WizardForm, IDE.SignToolsForm,
+  Shared.ConfigIniFile, Shared.SignToolsFunc, IDE.InputQueryComboForm, IDE.MsgBoxDesignerForm,
   IDE.FilesDesignerForm, IDE.RegistryDesignerForm, IDE.Wizard.WizardFormRegistryHelper;
 
 {$R *.DFM}

+ 1 - 1
Projects/Src/Compil32/IDE.HelpFunc.pas

@@ -87,7 +87,7 @@ uses
   ActiveX, ShlObj, ShellApi, CommDlg, SysUtils, IOUtils, StrUtils,
   Messages, DwmApi, Consts,
   Shared.CommonFunc, PathFunc, Shared.FileClass, NewUxTheme,
-  IDE.CompileForm, IDE.Messages, Shared.CompTypes;
+  IDE.CompileForm, IDE.Messages, Shared.ConfigIniFile;
 
 procedure InitFormFont(Form: TForm);
 var

+ 4 - 34
Projects/Src/Shared.CompTypes.pas → Projects/Src/Shared.ConfigIniFile.pas

@@ -1,18 +1,18 @@
-unit Shared.CompTypes;
+unit Shared.ConfigIniFile;
 
 {
   Inno Setup
-  Copyright (C) 1997-2014 Jordan Russell
+  Copyright (C) 1997-2024 Jordan Russell
   Portions by Martijn Laan
   For conditions of distribution and use, see LICENSE.TXT.
 
-  Types and functions used by both IDE and ISCC units
+  ConfigIniFile class used by both IDE and ISCC units
 }
 
 interface
 
 uses
-  Windows, SysUtils, Registry, Classes;
+  Windows, Registry;
 
 type
   TConfigIniFile = class(TRegIniFile)
@@ -24,38 +24,8 @@ type
     destructor Destroy; override;
   end;
 
-procedure ReadSignTools(SignTools: TStringList);
-function AddSignToolParam(Sign: string): string;
-
 implementation
 
-procedure ReadSignTools(SignTools: TStringList);
-var
-  Ini: TConfigIniFile;
-  I: Integer;
-  S: String;
-begin
-  Ini := TConfigIniFile.Create;
-  try
-    { Sign tools }
-    SignTools.Clear();
-    I := 0;
-    repeat
-      S := Ini.ReadString('SignTools', 'SignTool' + IntToStr(I), '');
-      if S <> '' then
-        SignTools.Add(S);
-      Inc(I);
-    until S = '';
-  finally
-    Ini.Free;
-  end;
-end;
-
-function AddSignToolParam(Sign: string): string;
-begin
-  Result := 'SignTool-' + Sign + #0;
-end;
-
 { TConfigIniFile }
 
 constructor TConfigIniFile.Create;

+ 49 - 0
Projects/Src/Shared.SignToolsFunc.pas

@@ -0,0 +1,49 @@
+unit Shared.SignToolsFunc;
+
+{
+  Inno Setup
+  Copyright (C) 1997-2024 Jordan Russell
+  Portions by Martijn Laan
+  For conditions of distribution and use, see LICENSE.TXT.
+
+  SignTools functions used by both IDE and ISCC units
+}
+
+interface
+
+uses
+  SysUtils, Classes, Shared.ConfigIniFile;
+
+procedure ReadSignTools(SignTools: TStringList);
+function AddSignToolParam(Sign: string): string;
+
+implementation
+
+procedure ReadSignTools(SignTools: TStringList);
+var
+  Ini: TConfigIniFile;
+  I: Integer;
+  S: String;
+begin
+  Ini := TConfigIniFile.Create;
+  try
+    { Sign tools }
+    SignTools.Clear();
+    I := 0;
+    repeat
+      S := Ini.ReadString('SignTools', 'SignTool' + IntToStr(I), '');
+      if S <> '' then
+        SignTools.Add(S);
+      Inc(I);
+    until S = '';
+  finally
+    Ini.Free;
+  end;
+end;
+
+function AddSignToolParam(Sign: string): string;
+begin
+  Result := 'SignTool-' + Sign + #0;
+end;
+
+end.