Перейти из форума на сайт.

НовостиФайловые архивы
ПоискАктивные темыТоп лист
ПравилаКто в on-line?
Вход Забыли пароль? Первый раз на этом сайте? Регистрация
Компьютерный форум Ru.Board » Компьютеры » Программы » Inno Setup (создание инсталяционных пакетов)

Модерирует : gyra, Maz

articlebot (13-10-2013 23:33): продолжение темы - №15
 Версия для печати • ПодписатьсяДобавить в закладки
На первую страницук этому сообщениюк последнему сообщению

   

viktor9



Junior Member
Редактировать | Профиль | Сообщение | ICQ | Цитировать | Сообщить модератору

Код:
#include 'it_download.iss'
#define public version "1.6.4.0"
#define siteUrl "http://mysite.ru"
#define updateUrl "http://mysite.ru"
#define supportUrl "http://mysite.ru/forum/"
#define brend "mysite.ru"
#define updateSiteURL "http://mysite.ru/files/"
#define updateFileName "version_myAC.txt"
 
[Setup]
AppName=myAC.Client
VersionInfoVersion={#version}
AppVersion={#version}
AppVerName=myAC.Client {#version}
AppPublisher=RIP
AppPublisherURL={#siteUrl}
AppSupportURL={#supportUrl}
AppUpdatesURL={#updateUrl}
AppCopyright=Copyright (C) http://myac.msk.ru
DefaultDirName={pf32}\myAC_{#brend}
DefaultGroupName=myAC.Client {#brend}
OutputDir=..\
OutputBaseFilename=myAC.Client_{#brend}
Compression=lzma2/Max
SolidCompression=true
DirExistsWarning=no
ShowTasksTreeLines=false
AppID={{082E6F6E-EB2E-4E3C-A02F-A38B834F06CE}}
 
[Languages]
Name: ru; MessagesFile: compiler:Languages\Russian.isl
Name: en; MessagesFile: compiler:Default.isl
;Name: fr; MessagesFile: compiler:Languages\French.isl
;Name: nl; MessagesFile: compiler:Languages\Dutch.isl
;Name: ptbr; MessagesFile: compiler:Languages\BrazilianPortuguese.isl
 
[Tasks]
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: checkablealone
Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
;Name: chek_x64; Description: {cm:W_testMode}; GroupDescription: {cm:TestModeCaption}; Flags: checkablealone restart exclusive; Check: "not TestModeCheck and IsWin64";
 
[Files]
Source: D:\Program Files\cs_proekt\Plusnet_AntiCheat\config.ini; DestDir: {app}; Flags: 32bit IgnoreVersion
Source: D:\Program Files\cs_proekt\Plusnet_AntiCheat\myAC.ex; DestDir: {app}; Flags: 32bit IgnoreVersion
Source: D:\Program Files\cs_proekt\Plusnet_AntiCheat\myAC.exe; DestDir: {app}; Flags: 32bit IgnoreVersion
;Source: ..\additional\onTestMode.lnk; DestDir: {app}; Flags: 64bit ignoreversion; Check: IsWin64;
;Source: ..\additional\offTestMode.lnk; DestDir: {app}; Flags: 64bit ignoreversion; Check: IsWin64;
 
Source: languages\*.ini; Flags: dontcopy
 
[INI]
Filename: {app}\myac.url; Section: InternetShortcut; Key: URL; String: {#supportUrl}
 
[Icons]
Name: {group}\{cm:ProgramOnTheWeb,myAC.Client}; Filename: {app}\myac.url
Name: {group}\{cm:UninstallProgram,myAC.Client}; Filename: {uninstallexe}
Name: {group}\myAC.Client {#brend}; Filename: {app}\myAC.exe; WorkingDir: {app}; Tasks:  
Name: {userdesktop}\myAC.Client {#brend}; Filename: {app}\myAC.exe; WorkingDir: {app}; Tasks: desktopicon
Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\myAC.Client {#brend}; Filename: {app}\myAC.exe; WorkingDir: {app}; Tasks: quicklaunchicon
;Name: {group}\{cm:W_testMode}; Filename: {app}\onTestMode.lnk;Check: IsWin64;
;Name: {group}\{cm:W_testModeOff}; Filename: {app}\offTestMode.lnk;Check: IsWin64;
 
[Run]
Filename: {app}\myAC.exe; Parameters: ; WorkingDir: {app}; Description: {cm:LaunchProgram,myAC.Client}; Flags: nowait postinstall skipifsilent
;MinVersion: ,6.0.6000; Filename: bcdedit.exe; Parameters: -set TESTSIGNING ON; Flags: NoWait RunHidden; Tasks: chek_x64;
 
;[UninstallRun]
;MinVersion: ,6.0.6000; Filename: bcdedit.exe; Parameters: -set TESTSIGNING OFF; Flags: NoWait RunHidden; Check: IsWin64;
 
[UninstallDelete]
Type: files; Name: {app}
 
 
;[CustomMessages]
;Russian.W_testMode=Включает тестовый режим для x64 версии Windows
;English.W_testMode=Enable test mode for x64 versions of Windows
;Russian.W_testModeOff=Отключить тестовый режим для x64 версии Windows
;English.W_testModeOff=Disable  test mode for x64 versions of Windows
;Russian.TestModeCaption=Тестовый режим
;English.TestModeCaption=Test Mode
 
 
[Code]
{ This demo performs two downloads, one without ITD's GUI, and one with. It checks a website to
  find out what the most recent version of the installer is, and offers to download the new installer
  for the user.
}
 
procedure ExitProcess(exitCode:integer);
  external 'ExitProcess@kernel32.dll stdcall';
 
var progress:TOutputProgressWizardPage;
 
var
 NewInstallerPath:string;
 
procedure DownloadFinished(downloadPage:TWizardPage);
var ErrorCode:integer;
 (* text:string; *)
begin
 (*
     Tell the user about the new installer. The message is pretty ugly if
     NewInstallerPath is left at the default (The {tmp} directory)
 
     text:=ITD_GetString(ITDS_Update_WillLaunchWithPath);
 
     StringChangeEx(text, '%1', NewInstallerPath, true);
 
     MsgBox(text, mbInformation, MB_OK);
 *)
 
 MsgBox(ITD_GetString(ITDS_Update_WillLaunch), mbInformation, MB_OK);
 
 if ShellExec('open', NewInstallerPath, '/updated',
   ExtractFilePath(NewInstallerPath), SW_SHOW, ewNoWait, ErrorCode) then
   ExitProcess(1);
end;
 
{ Compare the version string 'this' against the version string 'that'. A version
  string looks like: 1.3.2.100. Or possibly truncated: 1.3.
 
  Returns a positive number if this>that, 0 if this=that and a negative number
  if this<that.
}
function CompareVersions(this, that:string):integer;
var thisField, thatField:integer;
begin
 while (length(this)>0) or (length(that)>0) do begin
   if (pos('.',this)>0) then begin
     //Read the first field from the string
     thisField:=StrToIntDef(Copy(this, 1, pos('.',this)-1),0);
     //Remove the first field from the string
     this:=Copy(this, pos('.',this)+1, length(this));
   end else begin
     thisField:=StrToIntDef(this, 0);
     this:='';
   end;
 
   if (pos('.',that)>0) then begin
     //Read the first field from the string
     thatField:=StrToIntDef(Copy(that, 1, pos('.',that)-1),0);
     //Remove the first field from the string
     that:=Copy(that, pos('.',that)+1, length(that));
   end else begin
     thatField:=StrToIntDef(that, 0);
     that:='';
   end;
 
   if thisField>thatField then begin
    result:=1;
    exit;
   end else if thisField<thatField then begin
    result:=-1;
    exit;
   end;
 end;
 
 result:=0;
end;
 
procedure LoadITDLang;
var lang:string;
begin
 lang:=ExpandConstant('{language}');
 
 try
   ExtractTemporaryFile('itd_'+lang+'.ini');
 
   ITD_LoadStrings(expandconstant('{tmp}\itd_'+lang+'.ini'));
 except
   {We get here if the selected language wasn't included in the
    set of ITD translation files. In this case, just use ITD's
    built in translation file (English), by not loading anything.
 
    Note that the exception will still appear while debugging -
    you can turn this off in Inno Setup Compiler options
    ("Pause on exceptions"), or just ignore it. It doesn't appear
    at runtime.}
 end;
end;
 
procedure InitializeWizard();
var
  downloadPage:TWizardpage;
begin
 itd_init;
 LoadITDLang;
 //Where the new installer should be saved to, can be anywhere.
 NewInstallerPath:=ExpandConstant('{tmp}\New_myAC.exe');
 
 {Create our own progress page for the initial download of a small
  textfile from the server which says what the latest version is}
 progress:=CreateOutputProgressPage(ITD_GetString(ITDS_Update_Caption),
    ITD_GetString(ITDS_Update_Description));
 
 //Create the ITD GUI so that we have it if we decide to download a new intaller version
 downloadPage:=itd_downloadafter(wpWelcome);
 
 {If the download succeeds, we will need to launch the new installer. The
 callback is called if the download is successful.}
 itd_afterSuccess:=@downloadfinished;
 
 {If the download of the new installer fails, we still want to give the
  user the option of continuing with the original installation}
 itd_setoption('UI_AllowContinue','1');
end;
 
function NextButtonClick(curPageID:integer):boolean;
var
 list, line:TStringList;
 newavail:boolean;
 i:integer;
 ourVersion:string;
 checkedSuccessfully:boolean;
 text:string;
begin
 result:=true;
 if curPageID=wpWelcome then begin
 
   //Are we being called by an updating setup? If so, don't ask to check for updates again!
   for i:=1 to ParamCount do begin
    if uppercase(ParamStr(i))='/UPDATED' then begin
     exit;
    end;
   end;
 
   //Offer to check for a new version for the user..
//   if MsgBox(ITD_GetString(ITDS_Update_WantToCheck), mbConfirmation, MB_YESNO) = IDYES then
    begin
      wizardform.show;
      progress.Show;
      progress.SetText(ITD_GetString(ITDS_Update_Checking),'');
      progress.SetProgress(2,10);
      try
        newavail:=false;
 
        checkedSuccessfully:=false;
        GetVersionNumbersString(expandconstant('{srcexe}'), ourVersion);
 
        if itd_downloadfile('{#updateSiteURL}{#updateFileName}',expandconstant('{tmp}\{#updateFileName}'))=ITDERR_SUCCESS then begin
          { Now read the version from that file and see if it is newer.
            The file has a really simple format:
 
            2.0,"http://www.sherlocksoftware.org/innotools/example3%202.0.exe"
 
            The installer version, a comma, and the URL where the new version can be downloaded.
          }
          list:=TStringList.create;
          try
            list.loadfromfile(expandconstant('{tmp}\{#updateFileName}'));
 
            if list.count>0 then begin
              line:=TStringList.create;
              try
                line.commatext:=list[0]; //Break down the line into its components
 
                if line.count>=2 then begin
                checkedSuccessfully:=true;
                if CompareVersions(trim(line[0]), trim(ourVersion))>0 then begin
                  //Version is newer
                    text:=ITD_GetString(ITDS_Update_NewAvailable);
 
                    StringChangeEx(text, '%1', ourVersion, true); //"Current version" part of the string
                    StringChangeEx(text, '%2', line[0], true); //"New version" part of the string
 
                    if MsgBox(text, mbConfirmation, MB_YESNO)=IDYES then begin
                      itd_addFile(trim(line[1]), NewInstallerPath);
                    end;
                end else begin
//                  MsgBox(ITD_GetString(ITDS_Update_NoNewAvailable), mbInformation, MB_OK);
                end;
                end;
              finally
                line.free;
              end;
            end;
          finally
            list.free;
          end;
        end;
 
        if not checkedSuccessfully then begin
          text:=ITD_GetString(ITDS_Update_Failed);
          StringChangeEx(text, '%1', ourVersion, true);
//          MsgBox(text, mbInformation, MB_OK);
        end;
      finally
        progress.Hide;
      end;
    end;
  end;
 end;
 


Всего записей: 120 | Зарегистр. 24-08-2007 | Отправлено: 23:40 16-02-2012 | Исправлено: viktor9, 23:41 16-02-2012
   

На первую страницук этому сообщениюк последнему сообщению

Компьютерный форум Ru.Board » Компьютеры » Программы » Inno Setup (создание инсталяционных пакетов)
articlebot (13-10-2013 23:33): продолжение темы - №15


Реклама на форуме Ru.Board.

Powered by Ikonboard "v2.1.7b" © 2000 Ikonboard.com
Modified by Ru.B0ard
© Ru.B0ard 2000-2024

BitCoin: 1NGG1chHtUvrtEqjeerQCKDMUi6S6CG4iC

Рейтинг.ru