Jump to content
Korean Random

Создание инсталляторов для модпаков на базе Inno Setup


Recommended Posts

Всем Доброго Времени Суток!!!

... помогите со скриптом для BackUpPage ...

 

мне нужно чтобы не папки удалились ("бекапились") а файлы...

 

'сам скрипт'

#include "SHFileOperation.iss"

[Code]
var
  BackupPage: TWizardPage;
  DeleteRadioButton, MoveRadioButton, NoneRadioButton: TNewRadioButton;

const
  BackupDescText =
    'Выберите необходимый пункт из представленных.' #13#13 'Во избежание проблем совместимости и конфликтов между модами, рекомендуется удалить ваш старый XVM.';
  DeleteDescText =
    'Установщик удалит ваш старый XVM, который был установлен ранее';
  MoveDescText =
    'Установщик сделает резервную копию старого XVM, востановить его сможите из папки res_mods\backup.';
  NoneDescText =
    'Установщик установит XVM поверх старого.';

function BackupCheck_1(): Boolean;
var
  BackupDescLabel, DeleteDescLabel, MoveDescLabel, NoneDescLabel: TLabel;
begin
  BackupPage:=CreateCustomPage(wpWelcome, 'Создание резервных копий файлов перед установкой', 'Пожалуйста, прочтите следующую важную информацию перед тем, как продолжить.');
  BackupDescLabel:=TLabel.Create(WizardForm);
  BackupDescLabel.Parent:=BackupPage.Surface;
  BackupDescLabel.Left:=110;
  BackupDescLabel.Top:=10;
  BackupDescLabel.Width:=BackupPage.SurfaceWidth; 
  BackupDescLabel.Height:=90;
  BackupDescLabel.AutoSize:=False;
  BackupDescLabel.Wordwrap:=True;
  BackupDescLabel.Caption:=BackupDescText;

  DeleteRadioButton:=TNewRadioButton.Create(WizardForm);
  DeleteRadioButton.Parent:=BackupPage.Surface;
  DeleteRadioButton.Checked:=True;
  DeleteRadioButton.Top:=105;
  DeleteRadioButton.Left:=110;
  DeleteRadioButton.Width:=BackupPage.SurfaceWidth;
  DeleteRadioButton.Font.Style:=[fsBold];
  DeleteRadioButton.Font.Size:=9;
  DeleteRadioButton.Caption:='Удалить старый XVM'
  DeleteDescLabel:=TLabel.Create(WizardForm);
  DeleteDescLabel.Parent:=BackupPage.Surface;
  DeleteDescLabel.Left:=110;
  DeleteDescLabel.Top:=DeleteRadioButton.Top + DeleteRadioButton.Height + 4;
  DeleteDescLabel.Width:=BackupPage.SurfaceWidth; 
  DeleteDescLabel.Height:=40;
  DeleteDescLabel.AutoSize:=False;
  DeleteDescLabel.Wordwrap:=True;
  DeleteDescLabel.Caption:=DeleteDescText;

  MoveRadioButton:=TNewRadioButton.Create(WizardForm);
  MoveRadioButton.Parent:=BackupPage.Surface;
  MoveRadioButton.Checked:=False;
  MoveRadioButton.Top:=180;
  MoveRadioButton.Left:=110;
  MoveRadioButton.Width:=BackupPage.SurfaceWidth;
  MoveRadioButton.Font.Style:=[fsBold];
  MoveRadioButton.Font.Size:=9;
  MoveRadioButton.Caption:='Сделать резервную копию XVM'
  MoveDescLabel:=TLabel.Create(WizardForm);
  MoveDescLabel.Parent:=BackupPage.Surface;
  MoveDescLabel.Left:=110;
  MoveDescLabel.Top:=MoveRadioButton.Top + MoveRadioButton.Height + 4;
  MoveDescLabel.Width:=BackupPage.SurfaceWidth; 
  MoveDescLabel.Height:=40;
  MoveDescLabel.AutoSize:=False;
  MoveDescLabel.Wordwrap:=True;
  MoveDescLabel.Caption:=MoveDescText;

  NoneRadioButton:=TNewRadioButton.Create(WizardForm);
  NoneRadioButton.Parent:=BackupPage.Surface;
  NoneRadioButton.Checked:=False;
  NoneRadioButton.Top:=255;
  NoneRadioButton.Left:=110;
  NoneRadioButton.Width:=BackupPage.SurfaceWidth;
  NoneRadioButton.Font.Style:=[fsBold];
  NoneRadioButton.Font.Size:=9;
  NoneRadioButton.Caption:='Установить поверх старого XVMa'
  NoneDescLabel:=TLabel.Create(WizardForm);
  NoneDescLabel.Parent:=BackupPage.Surface;
  NoneDescLabel.Left:=110;
  NoneDescLabel.Top:=NoneRadioButton.Top + NoneRadioButton.Height + 4;
  NoneDescLabel.Width:=BackupPage.SurfaceWidth; 
  NoneDescLabel.Height:=40;
  NoneDescLabel.AutoSize:=False;
  NoneDescLabel.Wordwrap:=True;
  NoneDescLabel.Caption:=NoneDescText;
end;

function BackupCheck_2(): Boolean;
begin
  If DeleteRadioButton.Checked then
begin
  DelTree(ExpandConstant('{app}\res_mods\{#Patch}\gui\flash\Application.swf'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\battle.swf'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\Minimap.swf'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\PlayersPanel.swf'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\StatisticForm.swf'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\TeamBasesPanel.swf'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\VehicleMarkersManager.swf'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\xvm.swf'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\configs'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\mods'), True, True, True);
  CreateDir(ExpandConstant('{app}\res_mods\{#Patch}'));
end;
end;

function BackupCheck_3(): Boolean;
begin
  If MoveRadioButton.Checked then
begin
  MoveDir(ExpandConstant('{app}\res_mods\{#Patch}\gui\flash\Application.swf'),ExpandConstant('{app}\res_mods\backup\{#Patch}'));
  MoveDir(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\battle.swf'),ExpandConstant('{app}\res_mods\backup\{#Patch}'));
  MoveDir(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\Minimap.swf'),ExpandConstant('{app}\res_mods\backup\{#Patch}'));
  MoveDir(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\PlayersPanel.swf'),ExpandConstant('{app}\res_mods\backup\{#Patch}'));
  MoveDir(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\StatisticForm.swf'),ExpandConstant('{app}\res_mods\backup\{#Patch}'));
  MoveDir(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\TeamBasesPanel.swf'),ExpandConstant('{app}\res_mods\backup\{#Patch}'));
  MoveDir(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\VehicleMarkersManager.swf'),ExpandConstant('{app}\res_mods\backup\{#Patch}'));
  MoveDir(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\xvm.swf'),ExpandConstant('{app}\res_mods\backup\{#Patch}'));
  MoveDir(ExpandConstant('{app}\res_mods\configs\'),ExpandConstant('{app}\res_mods\backup\configs'));
  MoveDir(ExpandConstant('{app}\res_mods\mods\'),ExpandConstant('{app}\res_mods\backup\mods'));
  CreateDir(ExpandConstant('{app}\res_mods\{#Patch}'));
  DelTree(ExpandConstant('{app}\res_mods\{#Patch}\gui\flash\Application.swf'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\battle.swf'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\Minimap.swf'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\PlayersPanel.swf'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\StatisticForm.swf'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\TeamBasesPanel.swf'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\VehicleMarkersManager.swf'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\xvm.swf'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\configs'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\mods'), True, True, True);
end;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
  If CurStep=ssInstall then
begin
  BackupCheck_2();
  BackupCheck_3();
end;
end;

procedure InitializeWizard1();
begin
  BackupCheck_1();
end;

 

я походу что то не так делаю (((

Edited by MS_RAMIS
Link to comment
Short link
Share on other sites

@voin_123, по скрину можно сказать только одно: отсутствует директива препроцессора Patch.

В начале скрипта объявите:

#define Patch "0.9.6"
я походу что то не так делаю (((

Для начала, непонятно объясняете.

Edited by Kotyarko_O
Link to comment
Short link
Share on other sites

#define Patch "0.9.6" 

 

у меня прописано это ...

 

сне нужно чтобы при удалении , удалялись не папки с их содержимым , а именно конкретные файлы ... 

 

вот указал я в скрипте 

 

'кусок скрипта '

 DelTree(ExpandConstant('{app}\res_mods\{#Patch}\gui\flash\Application.swf'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\battle.swf'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\Minimap.swf'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\PlayersPanel.swf'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\StatisticForm.swf'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\TeamBasesPanel.swf'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\VehicleMarkersManager.swf'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\xvm.swf'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\configs'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\mods'), True, True, True);
  CreateDir(ExpandConstant('{app}\res_mods\{#Patch}'));

при резервном копирование вроде все работает ....   а при удаление файлы остаются ((( 

Link to comment
Short link
Share on other sites

как сделать так что бы  при нажатии на картинку окно закрывалось

В ботве это BtnSetEvent. А если изображение на панели, то через свойство OnClick.

 

а при удаление файлы остаются

Потому что DelTree - функция для удаления каталогов. Для удаления файлов есть функции DeleteFile, DelFiles

Edited by Kotyarko_O
Link to comment
Short link
Share on other sites

 

 

Потому что DelTree - функция для удаления каталогов. Для удаления файлов есть функции DeleteFile, DelFiles

 

с написал так но выдает ошибку(((

  DeleteFile(ExpandConstant('{app}\res_mods\{#Patch}\gui\flash\Application.swf'), True, True, True);
  DeleteFile(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\battle.swf'), True, True, True);
  DeleteFile(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\Minimap.swf'), True, True, True);
  DeleteFile(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\PlayersPanel.swf'), True, True, True);
  DeleteFile(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\StatisticForm.swf'), True, True, True);
  DeleteFile(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\TeamBasesPanel.swf'), True, True, True);
  DeleteFile(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\VehicleMarkersManager.swf'), True, True, True);
  DeleteFile(ExpandConstant('{app}\res_mods\{#Patch}\gui\scaleform\xvm.swf'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\configs'), True, True, True);
  DelTree(ExpandConstant('{app}\res_mods\mods'), True, True, True);
  CreateDir(ExpandConstant('{app}\res_mods\{#Patch}')); 

и через DelFiles пробовал  ... результат ошибка (((

 

Kotyarko_O если тебя не затруднит подскажи как эта функция должна быть написана правильно!?!?!?

Link to comment
Short link
Share on other sites

 

 

с написал так но выдает ошибку(((
Конечно, здесь простого копипаста не хватит.

Здесь много лишних параметров:

DeleteFile(ExpandConstant('{app}\res_mods\{#Patch}\gui\flash\Application.swf'), True, True, True);

Нужно так:

DeleteFile(ExpandConstant('{app}\res_mods\{#Patch}\gui\flash\Application.swf'));

OnClick := ?

Вопрос в чём?
Правильно ли приведённое тобой свойство, или что там должно быть дальше?

  • Upvote 1
Link to comment
Short link
Share on other sites

Вопрос в чём?

Правильно ли приведённое тобой свойство, или что там должно быть дальше?

[Code]
procedure information(Sender:Tobject);
var
  informationrtf: ansiString;
  informationForm: TSetupForm;
  informationEdit: TRichEditViewer;
  informationImage: TBitmapImage;
begin
  ExtractTemporaryFile('Информация.rtf');
  LoadStringFromFile(ExpandConstant('{tmp}')+'\Информация.rtf', informationrtf);
//""""""""""""""""""""""""""""""""""""""""""""""//
informationForm := CreateCustomForm();
with informationForm do
begin
  ClientWidth:=ScaleX(700);
  ClientHeight:=ScaleY(570);
  Caption := 'Информация о Модпаке';
  CenterInsideControl(WizardForm, False);
//""""""""""""""""""""""""""""""""""""""""""""""//
informationEdit := TRichEditViewer.Create(informationForm);
with informationEdit do
begin
  SetBounds(ScaleX(10),ScaleY(10),ScaleX(680),ScaleY(510));
  Parent := informationForm;
  Font.Size := 8;
  RTFText:= informationrtf;
  ScrollBars := ssVertical;
end;
//""""""""""""""""""""""""""""""""""""""""""""""//
informationImage := TBitmapImage.Create(informationForm);
with informationImage do
begin
  SetBounds(ScaleX(310),ScaleY(530),ScaleX(100),ScaleY(32));
  Parent := informationForm;
  ExtractTemporaryFile('WizardForm.MenuImage.bmp');
  MenuImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\WizardForm.MenuImage.bmp'));
  ModalResult:= mrOk;
  Cursor := crHand;
end;
  ShowModal;
  Free;
end;
end;

Link to comment
Short link
Share on other sites

еще есть вопрос .... а можно сделать так чтобы при выборе "родительского" компонента не выбирались "дочернии" 

 

извините за мой русский. Может на скрине будет понятнее ...

 

3e5499e94dbe.png

Link to comment
Short link
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...