Войти

Показать полную графическую версию : Скрипты Inno Setup. Помощь и советы [часть 5]


Страниц : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 [60] 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100

Johny777
24-10-2012, 13:45
Respin, спасибо за ответ :)
первое
модуль для распаковки 7-zip архивов (с отображением прогрессбара) »
is7z v1.01от ExpeditorR сильно устарело. Переходить на древние версии архиватора - не катит. Можно забить/забыть
FreeArc - не то что нужно
Также где-то видел скрипт для запаковки в 7-zip архивы... »
нет прогрессбара - не то :(


переоформлю вопрос
архиватор и есть библиотека, те все что делается через гуи делается через функции и импортированные из библиотеки. Мне хотелось бы импортировать основные возможности библиотеки и юзать их не прыгая с ветки на ветку (читай от левой библиотеки к левой)
важны
1: Проресс
2: Параметры
3: Запаковка(не в большей мере)
4: возможность распаковки отдельного файла
5: вывод имени извлекаемого файла.
короче то что мы делаем в архиваторе

===================================================================

посоны
помогите пожалуйста портировать код
http://sendfile.su/695878

El Sanchez
26-10-2012, 17:01
помогите пожалуйста портировать код »
Johny777, у тебя в архиве устаревшая версия библиотеки 7-zip.dll - 4.42. Скачай отсюда (http://www.madobe.net/archiver/lib/7-zip32.html#download) версию поновее, там прогресс доработан. Тепер, собственно порт:


[Setup]
AppName=My Program
AppVerName=My Program v.1.2
DefaultDirName={pf}\My Program

[Files]
Source: 7-zip32.dll; Flags: dontcopy

[Code]
#define A = (Defined UNICODE) ? "W" : "A"

const
SZ_ERROR = 1;
SZ_DLLERROR = 3;
ARCEXTRACT_INPROCESS = 1;
WM_USER = $400;
PBM_SETPOS = (WM_USER + 2);
PBM_SETRANGE32 = (WM_USER + 6);

type
EXTRACTINGINFO = record
dwFileSize: DWORD;
dwWriteSize: DWORD;
szSourceFileName: array [0..512] of Char;
dummy1: array [0..2] of Byte;
szDestFileName: array [0..512] of Char;
dummy: array [0..2] of Byte;
end;

function SevenZip(const hwnd: HWND; szCmdLine: PAnsiChar; szOutput: AnsiString; const dwSize: DWORD): Integer; external 'SevenZip@files:7-zip32.dll stdcall';
function SevenZipSetOwnerWindowEx(_hwnd: HWND; _lpArcProc: Longint): BOOL; external 'SevenZipSetOwnerWindowEx@files:7-zip32.dll stdcall';
function SevenZipKillOwnerWindowEx(_hwnd: HWND): BOOL; external 'SevenZipKillOwnerWindowEx@files:7-zip32.dll stdcall';
//
function RtlMoveMemory(var Destination: EXTRACTINGINFO; const Source: Longint; len: Integer): Integer; external 'RtlMoveMemory@kernel32.dll stdcall';
function SetWindowText(hWnd: HWND; lpString: String): BOOL; external 'SetWindowText{#A}@user32.dll stdcall';
function StrFormatByteSize64(qdw: Currency; var pszBuf: Char; cchBuf: UINT): PAnsiChar; external 'StrFormatByteSize64A@shlwapi.dll stdcall';
function MultiByteToWideChar(CodePage: UINT; dwFlags: DWORD; lpMultiByteStr: String; cbMultiByte: Integer; lpWideCharStr: String; cchWideChar: Integer): Integer; external 'MultiByteToWideChar@kernel32.dll stdcall';


var
ei: EXTRACTINGINFO;
ProgressPage: TOutputProgressWizardPage;
hProgress, hMsg1Label, hMsg2Label: HWND;

//////////////////////////////////////////////////////////
function CharArrayToString(cArray: array of Char): String;
begin
Result := '';
while cArray[Length(Result)] <> #0 do Insert(cArray[Length(Result)], Result, Length(Result)+1);
end;

//////////////////////////////////////////////
function BytesToSize(Bytes: Extended): String;
var
pszBuf: array [0..15] of Char;
begin
try
Result := StrFormatByteSize64(Abs(Bytes div 1E4), pszBuf[0], SizeOf(pszBuf));
except end;
end;

////////////////////////////////////////////////////////////////////////////////////////
function ArchiverCallbackProc(hwnd: HWND; uMsg, nState: UINT; lpEis: Longint): BOOL;
begin
Result := True;
case nState of
ARCEXTRACT_INPROCESS: begin
RtlMoveMemory(ei, lpEis, SizeOf(ei));
PostMessage(hwnd, PBM_SETRANGE32, 0, 100);
PostMessage(hwnd, PBM_SETPOS, Round(ei.dwWriteSize*100/ei.dwFileSize), 0);
SetWindowText(hMsg1Label, Format('Файл: %s'#13#10'Общий размер: %s'#13#10'Текущий размер: %s', [CharArrayToString(ei.szSourceFileName), BytesToSize(ei.dwFileSize), BytesToSize(ei.dwWriteSize)]));
SetWindowText(hMsg2Label, FormatFloat('Прогресс: 0.#0 %', (ei.dwWriteSize*100)/ei.dwFileSize));
end;
end;
end;

/////////////////////////////////////
procedure CreateSevenZipProgressPage;
begin
ProgressPage := CreateOutputProgressPage('7-zip', '');
ProgressPage.Msg1Label.Height := ScaleY(50);
ProgressPage.Msg2Label.Top := ProgressPage.Msg1Label.Top + ProgressPage.Msg1Label.Height + ScaleY(5);
ProgressPage.ProgressBar.Top := ProgressPage.Msg2Label.Top + ProgressPage.Msg2Label.Height + ScaleY(5);
end;

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function SevenZipCommand(const hWnd: HWND; szParams: String; const lpArchiverCallback: Longint): Longint;
begin
Result := SZ_ERROR;
case szParams[1] of
'a': ProgressPage.Description := 'Создание архива';
'b': ProgressPage.Description := 'Тестирование производительности';
'd': ProgressPage.Description := 'Удаление файлов из архива';
'e': ProgressPage.Description := 'Извлечение файлов из архива';
'l': ProgressPage.Description := 'Список файлов архива';
't': ProgressPage.Description := 'Тестирование файлов архива';
'u': ProgressPage.Description := 'Обновление файлов в архиве';
'x': ProgressPage.Description := 'Извлечение файлов из архива с полными путями';
end;
if lpArchiverCallback <> 0 then szParams := Format('%s -hide', [szParams]);
CharToOemBuff(szParams);
try
if lpArchiverCallback <> 0 then
begin
hMsg1Label := ProgressPage.Msg1Label.Handle;
hMsg2Label := ProgressPage.Msg2Label.Handle;
//show progress page
ProgressPage.Show;
ProgressPage.ProgressBar.Show;
//set callback
SevenZipSetOwnerWindowEx(hWnd, lpArchiverCallback);
end;
Result := SevenZip(hWnd, szParams, '', 0);
finally
if lpArchiverCallback <> 0 then
begin
ProgressPage.Hide;
SevenZipKillOwnerWindowEx(hWnd);
end;
except
Result := SZ_DLLERROR;
end;
end;

/////////////////////////////
procedure InitializeWizard();
begin
CreateSevenZipProgressPage;
end;

//////////////////////////////////////////////////////
function NextButtonClick(CurPageID: Integer): Boolean;
begin
if CurPageID = wpWelcome then
begin
// compress with callback
SevenZipCommand(ProgressPage.ProgressBar.Handle, Format('a "%s" "%s"', ['d:\123.7z', 'd:\Firefox Setup 19.0.2.exe']), CallbackAddr('ArchiverCallbackProc'));

// compress without callback
//SevenZipCommand(ProgressPage.ProgressBar.Handle, Format('a "%s" "%s"', ['d:\123.7z', 'd:\Firefox Setup 19.0.2.exe']), 0);

// extract with callback
//SevenZipCommand(ProgressPage.ProgressBar.Handle, Format('x "%s" "%s" -y', ['d:\123.7z', 'd:\']), CallbackAddr('ArchiverCallbackProc'));

// extract without callback
//SevenZipCommand(ProgressPage.ProgressBar.Handle, Format('x "%s" "%s" -y', ['d:\123.7z', 'd:\']), 0);
Result := True;
end;
end;


P.S. С функцией обратного вызова для отрисовки своего прогресса пока ничего, обходись пока встроенным в библиотеку прогрессом.
UPD: Реализовал callback. Мусор удален.
UPD2: No problemo с кириллицей.
UPD3: к черту неиспользуемые функции

Johny777
26-10-2012, 22:14
El Sanchez, Слов нет, Спасибо! :)
думаю коду прямая дорога в шапку к остальным кодам
С функцией обратного вызова для отрисовки своего прогресса пока ничего, обходись пока встроенным в библиотеку прогрессом. »
не проблема и так уже супер
Но всёж есть ли шанс реализовать в будущем?

И кстати. Маленькая инфа
функция SevenZipExtractArchive возвращает:
32800 - нажали на "отмену"
0 - распаковка завершена

insombia
29-10-2012, 23:56
можно ли сделать так,чтобы установщик запускался лишь на 7 и висте?

R.i.m.s.k.y.
30-10-2012, 03:58
insombia,
[CODE]
var
Version: TWindowsVersion;

Function InitializeSetup: Boolean;
Begin
GetWindowsVersionEx (version);
if (Version.Major=6) then Result := True
else begin
MsgBox('Для установки требуется Windows Vista или Se7en', mbInformation, MB_OK);
Result := False;
end;
end;

SoulSide
30-10-2012, 05:07
insombia,
[Setup]
MinVersion=0,6.0
OnlyBelowVersion=0,6.1

El Sanchez
30-10-2012, 17:27
не проблема и так уже супер
Но всёж есть ли шанс реализовать в будущем? »
Johny777, реализовал. Работает на ANSI/Unicode (Restools).

El Sanchez
30-10-2012, 21:18
а как отменить например распаковку? »
Johny777,

Создаешь глобальную булеву переменную, например, bWork, инициализируешь в True;
Создаешь свою кнопку отмены на ProgressPage.
В ее обработчике OnClick пишешь bWork := False;
В callback-функции ArchiverCallbackProc в теле выбора ARCEXTRACT_INPROCESS последней строкой пишешь Result := bWork;

Gugle
31-10-2012, 12:53
Доброго времени суток!

В первой процедуре создаю xml документ:


oXMLDoc:= CreateOleObject('MSXML2.DOMDocument');
oXMLDoc.appendChild(oXMLDoc.createProcessingInstruction('xml', 'version="1.0" encoding="UTF-8"'));
rootNode:= oXMLDoc.appendChild(oXMLDoc.createElement("CONFIG"));
oXMLDoc.save("C:\test.xml");


В следующей процедуре мне надо добавить туда элементы:

xmlParser := CreateOleObject('Microsoft.XMLDOM');
xmlParser.async := False;
xmlParser.load(fileName);
rootElement:= xmlParser.getElementsByTagName("CONFIG");
for i := 0 to rootElement.length-1 do
addElement:= rootElement.item[i].appendChild(xmlParser.createElement("Name"));

xmlParser.save(fileName);


Открываю файл, а там все в одну строку кроме заголовка.
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG><Name>/<Name></CONFIG>

Подскажите можно как нить указать парсеру, что надо расставить переносы?

Johny777
31-10-2012, 16:35
El Sanchez, ещё раз спасибо за код!
в общем добавил входной параметр OverwriteExistingFiles
Извиняюсь за свой поспешный вывод о внесённых мной изменениях. всё работает!
в функции SevenZipExtractArchive заменил TStringList на динамичный массив записей
касательно куска кода if FileList = '' then FileList := '*.*';
как-то странно работало, те если мы указываем '' , то извлекаться должно все, но каталоги и файлы в них не извлекались, поэтому справил:

if FileList[0] <> '' then
for i := 0 to GetArrayLength(FileList)-1 do
begin
s7cmd := s7cmd + ' -i';
if RecurseFolders then s7cmd := s7cmd + 'r';
s7cmd := s7cmd + '!"' + RemoveQuotes(FileList[i]) + '"';
end;

а теперь о неприятном:
с тех пор как добавил "Отмену" (еще до внесения мной изменений) часто вылетает ошибка без выделения строки в дебаггере "Out Of Range"
Я не знаю как исправить :(. Прошу помочь (хочу весь свой инсталл перевести на внешние архивы 7зип), а невозможность отменить распаковку от 4 до 16 гигив (в зависимости от выбора "компонентов") - это жесть :)

И ещё просьба!
есть вывод ei.dwFileSize, ei.dwWriteSize
их ведь можно использовать для вывода второго прогрессбара, на котором будет отображаться прогресс распаковки текущего файла
было бы здорово реализовать. В общем прошу помочь мне и в этом.
Всё это мне не к спеху :)
вот модифицированный код:

;El Sanchez, Реализовал callback. Мусор удален. Работает на ANSI/Unicode (Restools).

[Setup]
AppName=My Program
AppVerName=My Program v.1.2
DefaultDirName={pf}\My Program

[Files]
Source: 7-zip32.dll; Flags: ignoreversion dontcopy nocompression solidbreak sortfilesbyextension

[ code]
#ifdef UNICODE
#define A "W"
#else
#define A "A"
#endif
const
// codes returned by SevenZipCreateArchive and SevenZipExtractArchive
SZ_OK = 0;
SZ_ERROR = 1;
SZ_CANCELLED = 2;
SZ_DLLERROR = 3;

FNAME_MAX32 = 512;

// these get returned as nState in the Callback function
ARCEXTRACT_BEGIN = 0;
ARCEXTRACT_INPROCESS = 1;
ARCEXTRACT_END = 2;
ARCEXTRACT_OPEN = 3;
ARCEXTRACT_COPY = 4;

// Errors
ERROR_START = $8000;

// WARNING
ERROR_DISK_SPACE = $8005;
ERROR_READ_ONLY = $8006;
ERROR_USER_SKIP = $8007;
ERROR_UNKNOWN_TYPE = $8008;
ERROR_METHOD = $8009;
ERROR_PASSWORD_FILE = $800A;
ERROR_VERSION = $800B;
ERROR_FILE_CRC = $800C;
ERROR_FILE_OPEN = $800D;
ERROR_MORE_FRESH = $800E;
ERROR_NOT_EXIST = $800F;
ERROR_ALREADY_EXIST = $8010;
ERROR_TOO_MANY_FILES = $8011;

// ERROR
ERROR_MAKEDIRECTORY = $8012;
ERROR_CANNOT_WRITE = $8013;
ERROR_HUFFMAN_CODE = $8014;
ERROR_COMMENT_HEADER = $8015;
ERROR_HEADER_CRC = $8016;
ERROR_HEADER_BROKEN = $8017;
ERROR_ARC_FILE_OPEN = $8018;
ERROR_NOT_ARC_FILE = $8019;
ERROR_CANNOT_READ = $801A;
ERROR_FILE_STYLE = $801B;
ERROR_COMMAND_NAME = $801C;
ERROR_MORE_HEAP_MEMORY = $801D;
ERROR_ENOUGH_MEMORY = $801E;
ERROR_ALREADY_RUNNING = $801F;
ERROR_USER_CANCEL = $8020;
ERROR_HARC_ISNOT_OPENED = $8021;
ERROR_NOT_SEARCH_MODE = $8022;
ERROR_NOT_SUPPORT = $8023;
ERROR_TIME_STAMP = $8024;
ERROR_TMP_OPEN = $8025;
ERROR_LONG_FILE_NAME = $8026;
ERROR_ARC_READ_ONLY = $8027;
ERROR_SAME_NAME_FILE = $8028;
ERROR_NOT_FIND_ARC_FILE = $8029;
ERROR_RESPONSE_READ = $802A;
ERROR_NOT_FILENAME = $802B;
ERROR_TMP_COPY = $802C;
ERROR_EOF = $802D;
ERROR_ADD_TO_LARC = $802E;
ERROR_TMP_BACK_SPACE = $802F;
ERROR_SHARING = $8030;
ERROR_NOT_FIND_FILE = $8031;
ERROR_LOG_FILE = $8032;
ERROR_NO_DEVICE = $8033;
ERROR_GET_ATTRIBUTES = $8034;
ERROR_SET_ATTRIBUTES = $8035;
ERROR_GET_INFORMATION = $8036;
ERROR_GET_POINT = $8037;
ERROR_SET_POINT = $8038;
ERROR_CONVERT_TIME = $8039;
ERROR_GET_TIME = $803A;
ERROR_SET_TIME = $803B;
ERROR_CLOSE_FILE = $803C;
ERROR_HEAP_MEMORY = $803D;
ERROR_HANDLE = $803E;
ERROR_TIME_STAMP_RANGE = $803F;
ERROR_MAKE_ARCHIVE = $8040;
ERROR_NOT_CONFIRM_NAME = $8041;
ERROR_UNEXPECTED_EOF = $8042;
ERROR_INVALID_END_MARK = $8043;
ERROR_INVOLVED_LZH = $8044;
ERROR_NO_END_MARK = $8045;
ERROR_HDR_INVALID_SIZE = $8046;
ERROR_UNKNOWN_LEVEL = $8047;
ERROR_BROKEN_DATA = $8048;
ERROR_7ZIP_START = $8100;
ERROR_WARNING = $8101;
ERROR_FATAL = $8102;
ERROR_DURING_DECOMPRESSION = $8103;
ERROR_DIR_FILE_WITH_64BIT_SIZE = $8104;
ERROR_FILE_CHANGED_DURING_OPERATION = $8105;

FA_RDONLY = $01;
FA_HIDDEN = $02;
FA_SYSTEM = $04;
FA_LABEL = $08;
FA_DIREC = $10;
FA_ARCH = $20;
FA_ENCRYPTED = $40;

ARCHIVETYPE_ZIP = 1;
ARCHIVETYPE_7Z = 2;

WM_USER = $400;
PBM_SETPOS = (WM_USER + 2);


type
HARC = Longint;

INDIVIDUALINFO = record
dwOriginalSize: DWORD; // Size of file.
dwCompressedSize: DWORD; // Size after the compressing.
dwCRC: DWORD; // For checksum CRC of file.
uFlag: UINT; // With 7-zip32.dll always 0.
uOSType: UINT; // OS which was used the occasion where the file is housed. Under present conditions always 0.
wRatio: WORD; // Permill (thousand minute ratio) with the bulk compressibility which is displayed. In case of solid book room always 0.
wDate: WORD; // Renewal date of file (DOS type).
wTime: WORD; // Renewal time of file (DOS type).
szFileName: array [0..FNAME_MAX32] of Byte; // Archive file name.
dummy1: array [0..2] of Byte;
szAttribute: array [0..7] of Byte; // Attribute of file.
szMode: array [0..7] of Byte; // With 7-zip32.dll the character string of compressed system houses.
end;

EXTRACTINGINFO = record
dwFileSize: DWORD; // Size of all the housing files. When entire size 0xFFFFFFFF (-1) it is above, 0xFFFFFFFF (-1) it houses.
dwWriteSize: DWORD; // The entire size which processed with compression thawing processing. When dwFileSize 0xFFFFFFFF (-1) is, entire processing ratio (permill) it houses.
szSourceFileName: array [0..FNAME_MAX32] of Byte; // The housing file name which processes.
dummy1: array [0..2] of Byte;
szDestFileName: array [0..FNAME_MAX32] of Byte; // The path name which actually is written.
dummy: array [0..2] of Byte;
end;

EXTRACTINGINFOEX = record
exinfo: EXTRACTINGINFO; //The EXTRACTINGINFO structure is housed.
dwCompressedSize: DWORD; //Compressed size of housing file. When compressed size 0xFFFFFFFF (-1) it is above, 0xFFFFFFFF (-1) it houses.
dwCRC: DWORD; //Checksum of housing file.
uOSType: UINT; //OS which was used the occasion where the file is housed. Under present conditions always 0.
wRatio: WORD; //Permill (thousand minute ratio) with the bulk compressibility which is displayed. In case of solid book room always 0.
wDate: WORD; //Renewal date of housing file (DOS type).
wTime: WORD; //Renewal time of housing file (DOS type).
szAttribute: array [0..7] of Byte; //Attribute of housing file.
szMode: array [0..7] of Byte; //With 7-zip32.dll the character string of compressed system houses.
end;

EXTRACTINGINFOEX32 = record
dwStructSize: DWORD; //Size of structure.
exinfo: EXTRACTINGINFO; //The EXTRACTINGINFO structure is housed. It just is left because of compatibility
dwFileSize: DWORD; //Size of all the housing files. When entire size 0xFFFFFFFF (-1) it is above, 0xFFFFFFFF (-1) it houses.
dwCompressedSize: DWORD; //Compressed size of housing file. When compressed size 0xFFFFFFFF (-1) it is above, 0xFFFFFFFF (-1) it houses.
dwWriteSize: DWORD; //The entire size which processed with compression thawing processing. When dwFileSize 0xFFFFFFFF (-1) is, entire processing ratio (permill) it houses.
dwAttributes: DWORD; //Attribute of housing file.
dwCRC: DWORD; //Checksum of housing file.
uOSType: UINT; //OS which was used the occasion where the file is housed. Under present conditions always 0.
wRatio: WORD; //Permill (thousand minute ratio) with the bulk compressibility which is displayed. In case of solid book room always 0.
ftCreateTime: TFileTime; //Compilation day and time of the file due to FILETIME type.
ftAccessTime: TFileTime; //Reference day and time of the file due to FILETIME type.
ftWriteTime: TFileTime; //Renewal day and time of the file due to FILETIME type.
szMode: array [0..7] of Byte; //With 7-zip32.dll the character string of compressed system houses.
szSourceFileName: array [0..FNAME_MAX32] of Byte; //The housing file name which processes.
dummy1: array [0..2] of Byte;
szDestFileName: array [0..FNAME_MAX32] of Byte; //The path name which actually is written.
dummy2: array [0..2] of Byte;
end;

EXTRACTINGINFOEX64 = record
dwStructSize: DWORD; //Size of structure
exinfo: EXTRACTINGINFO; //The EXTRACTINGINFO structure is housed. It just is left because of compatibility.
llFileSize: Extended; //Size of all the housing files.
llCompressedSize: Extended; //Compressed size of housing file.
llWriteSize: Extended; //The entire size which processed with compression thawing processing.
dwAttributes: DWORD; //Attribute of housing file.
dwCRC: DWORD; //Checksum of housing file.
uOSType: UINT; //OS which was used the occasion where the file is housed. Under present conditions always 0.
wRatio: WORD; //Permill (thousand minute ratio) with the bulk compressibility which is displayed. In case of solid book room always 0.
ftCreateTime: TFileTime; //Compilation day and time of the file due to FILETIME type.
ftAccessTime: TFileTime; //Reference day and time of the file due to FILETIME type.
ftWriteTime: TFileTime; //Renewal day and time of the file due to FILETIME type.
szMode: array [0..7] of Byte; //With 7-zip32.dll the character string of compressed system houses.
szSourceFileName: array [0..FNAME_MAX32] of Byte; //The housing file name which processes.
dummy1: array [0..2] of Byte;
szDestFileName: array [0..FNAME_MAX32] of Byte; //The path name which actually is written.
dummy2: array [0..2] of Byte;
end;

// Callback func should return FALSE to cancel the archiving process, else TRUE
ARCHIVERPROC = function(_hwnd: HWND; _uMsg: UINT; _nState: UINT; _lpEis: Longint): BOOL;

function SevenZip(const _hwnd: HWND; _szCmdLine: PAnsiChar; _szOutput: AnsiString; const _dwSize: DWORD): Integer; external 'SevenZip@files:7-zip32.dll stdcall';
function SevenZipGetVersion(): WORD; external 'SevenZipGetVersion@files:7-zip32.dll stdcall';
function SevenZipGetCursorMode(): BOOL; external 'SevenZipGetCursorMode@files:7-zip32.dll stdcall';
function SevenZipSetCursorMode(const _CursorMode: BOOL ): BOOL; external 'SevenZipSetCursorMode@files:7-zip32.dll stdcall';
//function SevenZipGetBackgroundMode(): BOOL; external 'SevenZipGetBackgroundMode@files:7-zip32.dll stdcall';
//function SevenZipSetBackgroundMode(const _BackGroundMode: BOOL): BOOL; external 'SevenZipSetBackgroundMode@files:7-zip32.dll stdcall';
function SevenZipGetCursorInterval(): WORD; external 'SevenZipGetCursorInterval@files:7-zip32.dll stdcall';
function SevenZipSetCursorInterval(const _CursorInterval: WORD): BOOL; external 'SevenZipSetCursorInterval@files:7-zip32.dll stdcall';
function SevenZipGetRunning(): BOOL; external 'SevenZipGetRunning@files:7-zip32.dll stdcall';
function SevenZipConfigDialog(const _hwnd: HWND; _szOptionBuffer: AnsiString; const _iMode: Integer): BOOL; external 'SevenZipConfigDialog@files:7-zip32.dll stdcall';
function SevenZipCheckArchive(_szFileName: PAnsiChar; const _iMode: Integer): BOOL; external 'SevenZipCheckArchive@files:7-zip32.dll stdcall';
function SevenZipGetArchiveType(_szFileName: PAnsiChar): Integer; external 'SevenZipGetArchiveType@files:7-zip32.dll stdcall';
function SevenZipGetFileCount(_szArcFile: PAnsiChar): Integer; external 'SevenZipGetFileCount@files:7-zip32.dll stdcall';
function SevenZipQueryFunctionList(const _iFunction: Integer): BOOL; external 'SevenZipQueryFunctionList@files:7-zip32.dll stdcall';
function SevenZipOpenArchive(const _hwnd: HWND; _szFileName: PAnsiChar; const _dwMode: DWORD): HARC; external 'SevenZipOpenArchive@files:7-zip32.dll stdcall';
function SevenZipCloseArchive(_harc: HARC): Integer; external 'SevenZipCloseArchive@files:7-zip32.dll stdcall';
function SevenZipFindFirst(_harc: HARC; _szWildName: PAnsiChar; var _lpSubInfo: INDIVIDUALINFO): Integer; external 'SevenZipFindFirst@files:7-zip32.dll stdcall';
function SevenZipFindNext(_harc: HARC; var _lpSubInfo: INDIVIDUALINFO): Integer; external 'SevenZipFindNext@files:7-zip32.dll stdcall';
function SevenZipGetArcFileName(_harc: HARC; _lpBuffer: PAnsiChar; _nSize: Integer): Integer; external 'SevenZipGetArcFileName@files:7-zip32.dll stdcall';
function SevenZipGetArcFileSize(_harc: HARC): DWORD; external 'SevenZipGetArcFileSize@files:7-zip32.dll stdcall';
function SevenZipGetArcOriginalSize(_harc: HARC): DWORD; external 'SevenZipGetArcOriginalSize@files:7-zip32.dll stdcall';
function SevenZipGetArcCompressedSize(_harc: HARC): DWORD; external 'SevenZipGetArcCompressedSize@files:7-zip32.dll stdcall';
function SevenZipGetArcRatio(_harc: HARC): WORD; external 'SevenZipGetArcRatio@files:7-zip32.dll stdcall';
function SevenZipGetArcDate(_harc: HARC): WORD; external 'SevenZipGetArcDate@files:7-zip32.dll stdcall';
function SevenZipGetArcTime(_harc: HARC): WORD; external 'SevenZipGetArcTime@files:7-zip32.dll stdcall';
function SevenZipGetArcOSType(_harc: HARC): UINT; external 'SevenZipGetArcOSType@files:7-zip32.dll stdcall';
function SevenZipIsSFXFile(_harc: HARC): Integer; external 'SevenZipIsSFXFile@files:7-zip32.dll stdcall';
function SevenZipGetFileName(_harc: HARC; _lpBuffer: PAnsiChar; _nSize: Integer): Integer; external 'SevenZipGetFileName@files:7-zip32.dll stdcall';
function SevenZipGetOriginalSize(_harc: HARC): DWORD; external 'SevenZipGetOriginalSize@files:7-zip32.dll stdcall';
function SevenZipGetCompressedSize(_harc: HARC): DWORD; external 'SevenZipGetCompressedSize@files:7-zip32.dll stdcall';
function SevenZipGetRatio(_harc: HARC): WORD; external 'SevenZipGetRatio@files:7-zip32.dll stdcall';
function SevenZipGetDate(_harc: HARC): WORD; external 'SevenZipGetDate@files:7-zip32.dll stdcall';
function SevenZipGetTime(_harc: HARC): WORD; external 'SevenZipGetTime@files:7-zip32.dll stdcall';
function SevenZipGetCRC(_harc: HARC): DWORD; external 'SevenZipGetCRC@files:7-zip32.dll stdcall';
function SevenZipGetAttribute(_harc: HARC): Integer; external 'SevenZipGetAttribute@files:7-zip32.dll stdcall';
function SevenZipGetOSType(_harc: HARC): UINT; external 'SevenZipGetOSType@files:7-zip32.dll stdcall';
function SevenZipGetMethod(_harc: HARC; _lpBuffer: AnsiString; const _nSize: Integer): Integer; external 'SevenZipGetMethod@files:7-zip32.dll stdcall';
function SevenZipGetWriteTime(_harc: HARC): DWORD; external 'SevenZipGetWriteTime@files:7-zip32.dll stdcall';
function SevenZipGetWriteTimeEx(_harc: HARC; var _lpftLastWriteTime: TFileTime): BOOL; external 'SevenZipGetWriteTimeEx@files:7-zip32.dll stdcall';
function SevenZipGetArcCreateTimeEx(_harc: HARC; var _lpftCreationTime: TFileTime): BOOL; external 'SevenZipGetArcCreateTimeEx@files:7-zip32.dll stdcall';
function SevenZipGetArcAccessTimeEx(_harc: HARC; var _lpftLastAccessTime: TFileTime): BOOL; external 'SevenZipGetArcAccessTimeEx@files:7-zip32.dll stdcall';
function SevenZipGetArcWriteTimeEx(_harc: HARC; var _lpftLastWriteTime: TFileTime): BOOL; external 'SevenZipGetArcWriteTimeEx@files:7-zip32.dll stdcall';
function SevenZipSetOwnerWindow(_hwnd: HWND): BOOL; external 'SevenZipSetOwnerWindow@files:7-zip32.dll stdcall';
function SevenZipClearOwnerWindow(): BOOL; external 'SevenZipClearOwnerWindow@files:7-zip32.dll stdcall';
function SevenZipSetOwnerWindowEx(_hwnd: HWND; _lpArcProc: Longint): BOOL; external 'SevenZipSetOwnerWindowEx@files:7-zip32.dll stdcall';
function SevenZipKillOwnerWindowEx(_hwnd: HWND): BOOL; external 'SevenZipKillOwnerWindowEx@files:7-zip32.dll stdcall';
function SevenZipSetOwnerWindowEx64(_hwnd: HWND; _lpArcProc: Longint; _dwStructSize: DWORD): BOOL; external 'SevenZipSetOwnerWindowEx64@files:7-zip32.dll stdcall';
function SevenZipKillOwnerWindowEx64(_hwnd: HWND): BOOL; external 'SevenZipKillOwnerWindowEx@files:7-zip32.dll stdcall';
function SevenZipGetSubVersion(): WORD; external 'SevenZipKillOwnerWindowEx64@files:7-zip32.dll stdcall';
function SevenZipGetArcFileSizeEx(_harc: HARC; var _lpllSize: Extended): BOOL; external 'SevenZipGetArcFileSizeEx@files:7-zip32.dll stdcall';
function SevenZipGetArcOriginalSizeEx(_harc: HARC; var _lpllSize: Extended): BOOL; external 'SevenZipGetArcOriginalSizeEx@files:7-zip32.dll stdcall';
function SevenZipGetArcCompressedSizeEx(_harc: HARC; var _lpllSize: Extended): BOOL; external 'SevenZipGetArcCompressedSizeEx@files:7-zip32.dll stdcall';
function SevenZipGetOriginalSizeEx(_harc: HARC; var _lpllSize: Extended): BOOL; external 'SevenZipGetOriginalSizeEx@files:7-zip32.dll stdcall';
function SevenZipGetCompressedSizeEx(_harc: HARC; var _lpllSize: Extended): BOOL; external 'SevenZipGetCompressedSizeEx@files:7-zip32.dll stdcall';
function SevenZipSetUnicodeMode(_bUnicode: BOOL): BOOL; external 'SevenZipSetUnicodeMode@files:7-zip32.dll stdcall';
//
function RtlMoveMemory(var Destination: EXTRACTINGINFO; const Source: Longint; len: Integer): Integer; external 'RtlMoveMemory@kernel32.dll stdcall';
function SetWindowText(hWnd: HWND; lpString: String): BOOL; external 'SetWindowText{#A}@user32.dll stdcall';
function StrFormatByteSize64(qdw: Currency; var pszBuf: Char; cchBuf: UINT): PAnsiChar; external 'StrFormatByteSize64A@shlwapi.dll stdcall';


var
szStatus: TNewStaticText;
ei: EXTRACTINGINFO;
ProgressPage: TOutputProgressWizardPage;
hProgress, hMsg1Label, hMsg2Label: HWND;
Cancel: boolean;

function ByteArrayToString(cArray: array of Byte): String;
begin
Result := '';
while cArray[Length(Result)] <> 0 do Insert(Chr(cArray[Length(Result)]), Result, Length(Result)+1);
end;

function BytesToSize(Bytes: Extended): String;
var
pszBuf: array [0..15] of Char;
begin
try
Result := StrFormatByteSize64(Abs(Bytes div 1E4), pszBuf[0], SizeOf(pszBuf));
except end;
end;

function ArchiverCallbackProc(_hwnd: HWND; _uMsg, _nState: UINT; _lpEis: Longint): BOOL;
var
dwCurrentSize: Single;
begin
Result := True;
case _nState of
ARCEXTRACT_BEGIN: SetWindowText(hMsg1Label, 'Status: scanning');
ARCEXTRACT_INPROCESS:
begin
// if Cancel then Exit;
RtlMoveMemory(ei, _lpEis, SizeOf(ei));
dwCurrentSize := ei.dwWriteSize;
PostMessage(hProgress, PBM_SETPOS, Round(65535*(dwCurrentSize/ei.dwFileSize)), 0);
SetWindowText(hMsg1Label, 'Status: compressing');
SetWindowText(hMsg2Label, FormatFloat('Progress: 0.#0 %', (dwCurrentSize*100)/ei.dwFileSize));
SetWindowText(_hwnd, 'File: ' + ByteArrayToString(ei.szSourceFileName) + #13#10 +
'Total size: ' + BytesToSize(ei.dwFileSize) + #13#10 +
'Current size: ' + BytesToSize(ei.dwWriteSize));
Result := not Cancel;
end;
ARCEXTRACT_END: Result := False;
ARCEXTRACT_OPEN: SetWindowText(hMsg1Label, 'Status: open archive');
end;
end;

procedure Cancel7ZipWork(Sender: TObject);
begin
Cancel := True;
end;

/////////////////////
procedure CreateSevenZipProgressPage;
begin
ProgressPage := CreateOutputProgressPage('7-zip', '');
szStatus := TNewStaticText.Create(ProgressPage);
with szStatus do
begin
Parent := ProgressPage.Surface;
WordWrap := True;
SetBounds(ScaleX(0), ProgressPage.ProgressBar.Top + ScaleY(30), ProgressPage.Surface.Width, ScaleY(300));
end;
with TButton.Create(nil) do
begin
Parent := ProgressPage.Surface;
Caption := 'Cancel';
SetBounds(ScaleX(0), ProgressPage.ProgressBar.Top + ScaleY(90), ScaleX(75), ScaleY(25));
OnClick := @Cancel7ZipWork;
end;
end;


//////////////////////////////////////////////////////
function SevenZipCreateArchive(hWnd: HWND; ArchiveFilename, BaseDirectory, FileList : String; CompressionLevel: Integer; CreateSolidArchive: Boolean; RecurseFolders: Boolean; Password, Sfx: String; ShowProgress: Boolean; Callback: Longint): Integer;
var
flist : TStringList;
S7ResultOutput, s7cmd, cwd: AnsiString;
i: Integer;
begin
Result := SZ_ERROR;
if not SetCurrentDir(BaseDirectory) then Exit;
//
cwd := GetCurrentDir;
flist := TStringList.Create;
flist.CommaText := FileList;
if Callback <> 0 then ShowProgress := False;
try
s7cmd := 'a "' + ArchiveFilename + '" "' + RemoveQuotes(flist.Strings[0]) + '"';
for i := 1 to flist.Count - 1 do
begin
s7cmd := s7cmd + ' -i';
if RecurseFolders then s7cmd := s7cmd + 'r';
s7cmd := s7cmd + '!"' + RemoveQuotes(flist.Strings[i]) + '"';
end;
s7cmd := s7cmd + ' -mx' + IntToStr(CompressionLevel);
if RecurseFolders then s7Cmd := s7cmd + ' -r';
if Password <> '' then s7Cmd := s7Cmd + ' -p' + Password;
if CreateSolidArchive then s7cmd := s7cmd + ' -ms=on' else s7cmd := s7cmd + ' -ms=off';
if not ShowProgress then s7cmd := s7cmd + ' -hide';
if Length(Sfx) > 0 then s7cmd := s7cmd + ' -sfx' + Sfx;
try
s7ResultOutput := StringOfChar(#0, 10240);
if Callback <> 0 then
begin
//get handles for 7-zip callback thread
hProgress := ProgressPage.ProgressBar.Handle;
hMsg1Label := ProgressPage.Msg1Label.Handle;
hMsg2Label := ProgressPage.Msg2Label.Handle;
//show progress page
ProgressPage.Show;
ProgressPage.ProgressBar.Show;
ProgressPage.Description := 'Compress';
//set callback
SevenZipSetOwnerWindowEx(hWnd, Callback);
end;
Result := SevenZip(hWnd, s7cmd, s7ResultOutput, Length(s7ResultOutput)-1);
finally
if Callback <> 0 then
begin
ProgressPage.Hide;
SevenZipKillOwnerWindowEx(hWnd);
end;
//MsgBox(S7ResultOutput, mbInformation, MB_OK);
except
Result := SZ_DLLERROR;
end;
finally
flist.Free;
SetCurrentDir(cwd);
end;
end;

//////////////////////////////////////////////////////
function SevenZipExtractArchive(hWnd: HWND; ArchiveFilename: String; FileList: TArrayOfString;
RecurseFolders: Boolean; OverwriteExistingFiles: Boolean; Password: String; ExtractFullPaths: Boolean; ExtractBaseDir: String; ShowProgress: Boolean; Callback: Longint): Integer;
var
S7ResultOutput, s7cmd: AnsiString;
i: Integer;
begin
Result := SZ_ERROR;
if not FileExists(ArchiveFilename) then Exit;
//
//if FileList[0] = '' then FileList[0] := '*.*';
if Callback <> 0 then ShowProgress := False;
if ExtractFullPaths then s7cmd := 'x' else s7cmd := 'e';
s7cmd := s7cmd + ' "' + ArchiveFilename + '" -o"' + ExtractBaseDir + '"';
// s7cmd := s7cmd + ' "' + FileList[0] + '"';
//
if FileList[0] <> '' then
for i := 0 to GetArrayLength(FileList)-1 do
begin
s7cmd := s7cmd + ' -i';
if RecurseFolders then s7cmd := s7cmd + 'r';
s7cmd := s7cmd + '!"' + RemoveQuotes(FileList[i]) + '"';
end;
//
if RecurseFolders then s7cmd := s7cmd + ' -r';
if Password <> '' then s7Cmd := s7Cmd + ' -p' + Password;
if OverwriteExistingFiles then s7cmd := s7cmd + ' -aoa' else s7cmd := s7cmd + ' -aos';
if not ShowProgress then s7cmd := s7cmd + ' -hide';
s7cmd := s7cmd + ' -y';
try
s7ResultOutput := StringOfChar(#0, 10240);
if Callback <> 0 then
begin
//get handles for 7-zip callback thread
hProgress := ProgressPage.ProgressBar.Handle;
hMsg1Label := ProgressPage.Msg1Label.Handle;
hMsg2Label := ProgressPage.Msg2Label.Handle;
//show progress page
ProgressPage.Show;
ProgressPage.ProgressBar.Show;
ProgressPage.Description := 'Extract';
//set callback
SevenZipSetOwnerWindowEx(hWnd, Callback);
end;
Result := SevenZip(hWnd, s7cmd, S7ResultOutput, Length(s7ResultOutput)-1);
finally
if Callback <> 0 then
begin
ProgressPage.Hide;
SevenZipKillOwnerWindowEx(hWnd);
end;
//MsgBox(S7ResultOutput, mbInformation, MB_OK);
except
Result := SZ_DLLERROR;
end;
end;

procedure InitializeWizard();
begin
Cancel := True;
CreateSevenZipProgressPage;
end;

function NextButtonClick(CurPageID: Integer): Boolean;
begin
if CurPageID = wpWelcome then
begin
Cancel := False;
// compress with callback
//SevenZipCreateArchive(szStatus.Handle, 'C:\123.7z', 'c:\setup\se15', 'counter-strike.gcf', 1, True, False, '', '', False, CallbackAddr('ArchiverCallbackProc'));
// compress without callback
//SevenZipCreateArchive(szStatus.Handle, 'd:\123.7z', 'd:\', 'SkypeSetupFull.exe', 1, True, False, '', '', True, 0);

// extract with callback
SevenZipExtractArchive(szStatus.Handle, 'C:\hl1.VALVE', ['half-life high definition.gcf', 'se15\counter-strike.gcf'], False, True, '', True, 'c:\setup', False, CallbackAddr('ArchiverCallbackProc'));
// extract with callback
//SevenZipExtractArchive(szStatus.Handle, 'd:\123.7z', '', False, '', True, 'c:\', True, 0);
Result := True;
end;
end;

insombia
31-10-2012, 21:36
как в isdone сделать разбивку на тома?

Gnom_aka_Lexander
01-11-2012, 15:36
insombia, как человек вроде-бы уже опытный, мог-бы и знать, что библиотека isdone не предназначена ни для сжатия, ни для разбития на тома. Она используется исключительно для распаковки архивов, упакованных внешними архиваторами, не более. И там есть функция, которая выводит диалог запроса следующего диска, если ты об этом. Один из параметров этой функции - любой файл, который должен лежать на запрошеном диске, и если этот файл уже есть в наличии, то соответственно, запроса следующего диска не будет, ввиду отсутствия таковой необходимости.
Хотя, чего сильно распинаться? Вместе с этой библиотекой распространяется справка, в которой все ее функции удивительно подробно и понятно расписаны.

El Sanchez
01-11-2012, 18:07
с тех пор как добавил "Отмену" (еще до внесения мной изменений) часто вылетает ошибка без выделения строки в дебаггере "Out Of Range" »
Johny777, ты уверен, что массив FileList существует и в нем есть хотя бы 1 элемент?
Так нельзя:

if FileList[0] = '' then FileList[0] := '*.*';
...
if FileList[0] <> '' then
for i := 0 to GetArrayLength(FileList)-1 do

Нужно:

if GetArrayLength(FileList) = 0 then
begin
SetArrayLength(FileList, 1);
FileList[0] := '*.*';
end;
...
if GetArrayLength(FileList) > 0 then
for i := 1 to GetArrayLength(FileList)-1 do


библиотека isdone не предназначена ни для сжатия, ни для разбития на тома »
Gnom_aka_Lexander, хоть буду знать для чего она.

insombia
01-11-2012, 18:08
Gnom_aka_Lexander да я уже нашел,просто забыл удалить сообщение,но все равно спс

Johny777
01-11-2012, 21:12
El Sanchez, спасибо за правку! я понял своё косячище
теперь ошибка не вылезает! :)
вот только с этой строкой ( for i := 1 to GetArrayLength(FileList)-1 do ... ) попытаться извлечь 2 файла из архива ['half-life high definition.gcf', 'se15\counter-strike.gcf'], то извлечётся только второй фаил
'se15\counter-strike.gcf' с индексом 1,
поэтому ( for i := 0 to GetArrayLength(FileList)-1 do ... ) приводит к нужному результату
======
с FileList[0] := '*.*' извлекаются только файлы лежащие в корне архива. Те, напимер, 'se15\counter-strike.gcf' не распакуется
получается если массив пустой то делать вообще ничего не надо (в смысле никакие параметры архиватору не нужны)
только если не пустой нужен код:

if GetArrayLength(FileList) > 0 then
for i := 0 to GetArrayLength(FileList)-1 do
begin
s7cmd := s7cmd + ' -i';
if RecurseFolders then s7cmd := s7cmd + 'r';
s7cmd := s7cmd + '!"' + RemoveQuotes(FileList[i]) + '"';
end;

вывод:
извлекаем все файлы с подкаталогами. Те реально всё - SevenZipExtractArchive(szStatus.Handle, 'C:\hl1.VALVE', [], False, True, '', True, 'c:\setup', False, CallbackAddr('ArchiverCallbackProc'));
извлекаем нужные файлы : SevenZipExtractArchive(szStatus.Handle, 'C:\hl1.VALVE', ['half-life high definition.gcf', 'se15\counter-strike.gcf'], False, True, '', True, 'c:\setup', False, CallbackAddr('ArchiverCallbackProc'));

Проверено. Работает. :)
хотя прошу желающих на всякий случай потестить
вот тестовый архив: http://sendfile.su/700617
========
функция целиком:

function SevenZipExtractArchive(hWnd: HWND; ArchiveFilename: String; FileList: TArrayOfString;
RecurseFolders: Boolean; OverwriteExistingFiles: Boolean; Password: String; ExtractFullPaths: Boolean; ExtractBaseDir: String; ShowProgress: Boolean; Callback: Longint): Integer;
var
S7ResultOutput, s7cmd: AnsiString;
i: Integer;
begin
Result := SZ_ERROR;
if not FileExists(ArchiveFilename) then Exit;
//
//if FileList[0] = '' then FileList[0] := '*.*';
if Callback <> 0 then ShowProgress := False;
if ExtractFullPaths then s7cmd := 'x' else s7cmd := 'e';
s7cmd := s7cmd + ' "' + ArchiveFilename + '" -o"' + ExtractBaseDir + '"';
// s7cmd := s7cmd + ' "' + FileList[0] + '"';
//
// if GetArrayLength(FileList) = 0 then
// begin
// SetArrayLength(FileList, 1);
// MsgBox('0',mbError, MB_OK);
// FileList[0] := '*.*';
// end;
if GetArrayLength(FileList) > 0 then
for i := 0 to GetArrayLength(FileList)-1 do
begin
s7cmd := s7cmd + ' -i';
if RecurseFolders then s7cmd := s7cmd + 'r';
s7cmd := s7cmd + '!"' + RemoveQuotes(FileList[i]) + '"';
end;
//
if RecurseFolders then s7cmd := s7cmd + ' -r';
if Password <> '' then s7Cmd := s7Cmd + ' -p' + Password;
if OverwriteExistingFiles then s7cmd := s7cmd + ' -aoa' else s7cmd := s7cmd + ' -aos';
if not ShowProgress then s7cmd := s7cmd + ' -hide';
s7cmd := s7cmd + ' -y';
try
s7ResultOutput := StringOfChar(#0, 10240);
if Callback <> 0 then
begin
//get handles for 7-zip callback thread
hProgress := ProgressPage.ProgressBar.Handle;
hMsg1Label := ProgressPage.Msg1Label.Handle;
hMsg2Label := ProgressPage.Msg2Label.Handle;
//show progress page
ProgressPage.Show;
ProgressPage.ProgressBar.Show;
ProgressPage.Description := 'Extract';
//set callback
SevenZipSetOwnerWindowEx(hWnd, Callback);
end;
Result := SevenZip(hWnd, s7cmd, S7ResultOutput, Length(s7ResultOutput)-1);
finally
if Callback <> 0 then
begin
ProgressPage.Hide;
SevenZipKillOwnerWindowEx(hWnd);
end;
//MsgBox(S7ResultOutput, mbInformation, MB_OK);
except
Result := SZ_DLLERROR;
end;
end;


PS:
блин
возможности у кода суперские
любой параметр ком.строки можно загнать в функцию (при необходимости настраивать через входные параметры)
и ещё куча функций (типа SevenZipGetArchiveType или SevenZipCheckArchive)

hl1.VALVE есть 7зип архив(не sfx). я только поменял расширение "7z" на имя всем известной конторы (для понта)

El Sanchez
01-11-2012, 22:44
вот только с этой строкой ( for i := 1 to GetArrayLength(FileList)-1 do ... ) попытаться извлечь 2 файла из архива ['half-life high definition.gcf', 'se15\counter-strike.gcf'], то извлечётся только второй фаил »
Johny777, ну, дык, первый файл должен (хотя и не обязательно) в комстроке писаться без параметра -i. Извлечение первого файла описано в строке s7cmd := s7cmd + ' "' + FileList[0] + '"', следующие файлы идут через цикл через параметр -i, поэтому цикл начинается со второго элемента (for i=1...). Но параметр -i можно применить и к первому извлекаемому файлу, это не ошибка, поэтому вот эту часть можно выбросить, да и не нужно маску указывать, если извлекаются все файлы:
// if GetArrayLength(FileList) = 0 then
// begin
// SetArrayLength(FileList, 1);
// MsgBox('0',mbError, MB_OK);
// FileList[0] := '*.*';
// end; »
...и оставить, как ты предложил

if GetArrayLength(FileList) > 0 then
for i := 0 to GetArrayLength(FileList)-1 do
begin
s7cmd := s7cmd + ' -i';
if RecurseFolders then s7cmd := s7cmd + 'r';
s7cmd := s7cmd + '!"' + RemoveQuotes(FileList[i]) + '"';
end;

Johny777
03-11-2012, 20:26
El Sanchez, если в пути есть русские символы, то 7зип архив не извлекается. Можно ли это исправить?

R.i.m.s.k.y.
03-11-2012, 20:32
Johny777, комстрока? возможна проблема в кодировке, установщик работает с системной СР1251, а комстрока с ДОС кодировкой СР866

R.i.m.s.k.y.
03-11-2012, 21:11
Johny777, вот уж не думал что тебя, камрад, придется отправлять в шапку темы (http://forum.oszone.net/post-1643707-1144.html)
Твой случай function AnsiToDos

R.i.m.s.k.y.
03-11-2012, 21:32
Johny777, дык одмин одмину друг, товарисч и мануал! :)
кстати даже если прогу поставить корректно в путь с пробелами и русскими буквами то не факт что она будет работать - тот же самый косяк может оказаться внутри проги
Формат 8.3 жив и здоров (8 символов на имя, 3 на расширение, толькр 10 цифр и 26 англ букв)




© OSzone.net 2001-2012