Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Script generated by the Inno Setup Script Wizard.
- ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
- #define MyAppName "Deimog"
- #define MyAppVersion "1.0.69"
- #define MyAppPublisher "BethesdaGameStudios"
- #define MyAppURL "https://creations.bethesda.net/en/starfield/details/e3295393-57db-47ba-91e4-2ba74133856a/Deimog"
- #define MyAppExeName "DeimogVehicle.exe"
- [Setup]
- AppId={{D954578E-053C-4D28-A5E2-111D12D6C704}
- AppName={#MyAppName}
- AppVersion={#MyAppVersion}
- AppPublisher={#MyAppPublisher}
- AppPublisherURL={#MyAppURL}
- AppSupportURL={#MyAppURL}
- AppUpdatesURL={#MyAppURL}
- DefaultDirName=C:\Games\Starfield.Digital.Premium.Edition-InsaneRamZes\Data
- ArchitecturesAllowed=x64compatible
- ArchitecturesInstallIn64BitMode=x64compatible
- DefaultGroupName={#MyAppName}
- DisableProgramGroupPage=yes
- InfoBeforeFile=D:\media\!Downloads\Deimog v1.0.69\Description_eng.txt
- PrivilegesRequiredOverridesAllowed=dialog
- OutputDir=D:\media\!Downloads\Deimog v1.0.69
- OutputBaseFilename=DeimogVehicle
- Compression=lzma
- SolidCompression=yes
- WizardStyle=modern
- LanguageDetectionMethod=UILanguage
- LicenseFile=D:\media\!Downloads\Deimog v1.0.69\mit_eng.txt
- [Languages]
- Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
- Name: "english"; MessagesFile: "compiler:Default.isl"
- [CustomMessages]
- russian.DescriptionFile=Описание на русском.
- russian.LicenseFile=Лицензия на русском.
- english.DescriptionFile=Описание на английском.
- english.LicenseFile=Лицензия на английском.
- [Files]
- Source: "D:\media\!Downloads\Deimog v1.0.69\Deimog v1.0.69\sfbgs019 - main.ba2"; DestDir: "{app}"; Flags: ignoreversion
- Source: "D:\media\!Downloads\Deimog v1.0.69\Deimog v1.0.69\sfbgs019 - textures.ba2"; DestDir: "{app}"; Flags: ignoreversion
- Source: "D:\media\!Downloads\Deimog v1.0.69\Deimog v1.0.69\sfbgs019.esm"; DestDir: "{app}"; Flags: ignoreversion
- [Icons]
- Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
- Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
- [Code]
- var
- LicenseFile: String;
- InfoBeforeFile: String;
- TargetFolder: string;
- TargetFile: string;
- PluginEntry: string;
- //Проверяем наличие каталога и создаём, если нет
- procedure EnsureDirectoryExists(Dir: string);
- begin
- if not DirExists(Dir) then
- begin
- if not CreateDir(Dir) then
- MsgBox('Ошибка: не удалось создать каталог: ' + Dir, mbError, MB_OK);
- end;
- end;
- //Проверяем наличие файла и создаём, если нет
- procedure EnsureFileExists(FileName: string);
- var
- FileList: TStringList;
- begin
- if not FileExists(FileName) then
- begin
- FileList := TStringList.Create;
- try
- FileList.SaveToFile(FileName);
- finally
- FileList.Free;
- end;
- end;
- end;
- //Считываем содержимое файла и добавляем необходимую строку
- procedure AddPluginEntry;
- var
- FileList: TStringList;
- LineExists: Boolean;
- i: Integer;
- begin
- EnsureDirectoryExists(TargetFolder);
- EnsureFileExists(TargetFile);
- FileList := TStringList.Create;
- try
- //Загружаем и ищем
- FileList.LoadFromFile(TargetFile);
- LineExists := False;
- for i := 0 to FileList.Count - 1 do
- begin
- if CompareText(FileList[i], PluginEntry) = 0 then
- begin
- LineExists := True;
- Break;
- end;
- end;
- //Если строки нет, то добавляем
- if not LineExists then
- begin
- FileList.Add(PluginEntry);
- FileList.SaveToFile(TargetFile);
- end;
- finally
- FileList.Free;
- end;
- end;
- //При удалении мода удаляем добавленную строку
- procedure RemovePluginEntry;
- var
- FileList: TStringList;
- i: Integer;
- begin
- if not FileExists(TargetFile) then
- Exit;
- FileList := TStringList.Create;
- try
- FileList.LoadFromFile(TargetFile);
- for i := FileList.Count - 1 downto 0 do
- begin
- if CompareText(FileList[i], PluginEntry) = 0 then
- FileList.Delete(i);
- end;
- FileList.SaveToFile(TargetFile);
- finally
- FileList.Free;
- end;
- end;
- //При установке проверяем наличие файла и каталога, в файле ищем строку, добавляем, если нет
- function InitializeSetup: Boolean;
- begin
- TargetFolder := ExpandConstant('{localappdata}\starfield');
- TargetFile := TargetFolder + '\plugins.txt';
- PluginEntry := '*sfbgs019.esm';
- AddPluginEntry;
- Result := True;
- end;
- //При удалении отменяем внесённые изменения (кроме создания файла)
- procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
- begin
- if CurUninstallStep = usPostUninstall then
- begin
- TargetFolder := ExpandConstant('{localappdata}\starfield');
- TargetFile := TargetFolder + '\plugins.txt';
- PluginEntry := '*sfbgs019.esm';
- RemovePluginEntry;
- end;
- end;
- //Поддержка русского и английского лицензий/описаний
- procedure InitializeWizard;
- begin
- if ActiveLanguage = 'russian' then
- begin
- LicenseFile := ExpandConstant('D:\media\!Downloads\Deimog v1.0.69\mit_rus.txt');
- InfoBeforeFile := ExpandConstant('D:\media\!Downloads\Deimog v1.0.69\Description_rus.txt');
- end
- else
- begin
- LicenseFile := ExpandConstant('D:\media\!Downloads\Deimog v1.0.69\mit_eng.txt');
- InfoBeforeFile := ExpandConstant('D:\media\!Downloads\Deimog v1.0.69\Description_eng.txt');
- end;
- WizardForm.LicenseMemo.Lines.LoadFromFile(LicenseFile);
- WizardForm.InfoBeforeMemo.Lines.LoadFromFile(InfoBeforeFile);
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement