@@ -17,8 +17,9 @@ TC4DWizardOpenExternalModel = class(TInterfacedObject, IC4DWizardOpenExternalM
1717 protected
1818 function WriteInIniFile (AC4DWizardOpenExternal: TC4DWizardOpenExternal): IC4DWizardOpenExternalModel;
1919 function SaveIconInFolder (const AGuid, APathIcon: string): IC4DWizardOpenExternalModel;
20- function ReadGuidInIniFile (AGuid: string): TC4DWizardOpenExternal;
20+ // function ReadGuidInIniFile(AGuid: string): TC4DWizardOpenExternal;
2121 procedure ReadIniFile (AProc: TProc<TC4DWizardOpenExternal>);
22+ function ExistGuidInIniFile (const AGuid: string): Boolean;
2223 procedure RemoveGuidInIniFile (const AGuid: string);
2324 public
2425 class function New : IC4DWizardOpenExternalModel;
@@ -87,7 +88,40 @@ function TC4DWizardOpenExternalModel.SaveIconInFolder(const AGuid, APathIcon: st
8788 TC4DWizardUtils.FileCopy(APathIcon, LFileNameToSave);
8889end ;
8990
90- function TC4DWizardOpenExternalModel.ReadGuidInIniFile (AGuid: string): TC4DWizardOpenExternal;
91+ function TC4DWizardOpenExternalModel.ExistGuidInIniFile (const AGuid: string): Boolean;
92+ var
93+ LIniFile: TIniFile;
94+ LSections: TStrings;
95+ LSessaoStr: string;
96+ i: Integer;
97+ LGuid: string;
98+ begin
99+ Result := False;
100+
101+ if (AGuid.Trim.ISEmpty)then
102+ Exit;
103+
104+ LIniFile := Self.GetIniFile;
105+ try
106+ LSections := TStringList.Create;
107+ try
108+ LIniFile.ReadSections(LSections);
109+ for i := 0 to Pred(LSections.Count) do
110+ begin
111+ LSessaoStr := LSections[i];
112+ LGuid := LIniFile.Readstring(LSessaoStr, TC4DConsts.OPEN_EXTERNAL_INI_GuidMenuMaster, ' ' );
113+ if (LGuid = AGuid)then
114+ Exit(True);
115+ end ;
116+ finally
117+ LSections.Free;
118+ end ;
119+ finally
120+ LIniFile.Free;
121+ end ;
122+ end ;
123+
124+ { function TC4DWizardOpenExternalModel.ReadGuidInIniFile(AGuid: string): TC4DWizardOpenExternal;
91125var
92126 LIniFile: TIniFile;
93127begin
@@ -111,7 +145,7 @@ function TC4DWizardOpenExternalModel.ReadGuidInIniFile(AGuid: string): TC4DWizar
111145 finally
112146 LIniFile.Free;
113147 end;
114- end ;
148+ end; }
115149
116150procedure TC4DWizardOpenExternalModel.ReadIniFile (AProc: TProc<TC4DWizardOpenExternal>);
117151var
0 commit comments