Untitled
Lekkie poprawkiuser_6919294
pascal
a year ago
3.1 kB
12
Indexable
// Hej Daria, ponieważ w INS nie można zmieniać wartości zdefiniowane przy użyciu dyrektywy #define
// To dodaj takie uproszczenie, bez wydziwień. Jak się za dużo kombinuje, później można pogubić się w kodzie ^_-
// Np coś takiego:
// ----------------------------------------------------------------------------------------------------------
const
MaxIcons = 10;
#ifdef DeleteGameSetings
MaxDelSettingsFolder = 5;
#endif
var
DesktopIconNames: array[1..MaxIcons] of string;
#ifdef DeleteGameSetings
DelSettings: array[1..MaxDelSettingsFolder] of string;
#endif
// Inicjalizacja tablic
procedure InitializeArrays;
begin
DesktopIconNames[1] := '{#DesktopIconName1}';
DesktopIconNames[2] := '{#DesktopIconName2}';
DesktopIconNames[3] := '{#DesktopIconName3}';
DesktopIconNames[4] := '{#DesktopIconName4}';
DesktopIconNames[5] := '{#DesktopIconName5}';
DesktopIconNames[6] := '{#DesktopIconName6}';
DesktopIconNames[7] := '{#DesktopIconName7}';
DesktopIconNames[8] := '{#DesktopIconName8}';
DesktopIconNames[9] := '{#DesktopIconName9}';
DesktopIconNames[10] := '{#DesktopIconName10}';
// ... inicjalizacja pozostałych elementów w razie potrzeby
#ifdef DeleteGameSetings
DelSettings[1] := ExpandConstant('{#DelSetings1}');
DelSettings[2] := ExpandConstant('{#DelSetings2}');
DelSettings[3] := ExpandConstant('{#DelSetings3}');
DelSettings[4] := ExpandConstant('{#DelSetings4}');
DelSettings[5] := ExpandConstant('{#DelSetings5}');
// ... inicjalizacja pozostałych elementów w razie potrzeby
#endif
end;
function GetIconNamePatchValue(Index: Integer): string;
begin
if (Index > 0) and (Index <= MaxIcons) then
Result := ExpandConstant('{commondesktop}\' + DesktopIconNames[Index] + '.lnk')
else
Result := '';
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
IconIndex: Integer;
IconPath: string;
SettingIndex: Integer;
DelSaveConfig: string;
begin
// Usuwanie ikon z pulpitu
for IconIndex := 1 to MaxIcons do
begin
IconPath := GetIconNamePatchValue(IconIndex);
if (IconPath <> '') and FileExists(IconPath) then
begin
if not DeleteFile(IconPath) then
Log('Cannot be removed icon: ' + IconPath);
end;
end;
// usuwanie ustawien, zapisow
#ifdef DeleteGameSetings
if MsgBox('Do You Want To DELETE {#GameName} SAVE and CONFIGURATION Files?',
mbConfirmation, MB_YESNO or MB_DEFBUTTON2) = IDYES then
begin
for SettingIndex := 1 to MaxDelSettingsFolder do
begin
DelSaveConfig := ExpandConstant(DelSettings[SettingIndex]);
if DelSaveConfig = '' then
// przerywamy, jezeli nazwa folderu jest NULL
Break;
if DirExists(DelSaveConfig) then
begin
if not DelTree(DelSaveConfig, True, True, True) then
Log('Cannot be delete folder: ' + DelSaveConfig);
end;
end;
end;
#endif
end;
// ----------------------------------------------------------------------------------------------------------Editor is loading...
Leave a Comment