ssv14
Newbie | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору [Setup] AppName=Recode AppVerName=Recode OutputDir=. OutputBaseFilename=Recode DefaultDirName={pf}\Recode AppendDefaultDirName=False DisableDirPage=True [Code] var Files: Array of String; S: String; n: Integer; function StringToArray(Text, Cut: String): array of String; var i, k: Integer; begin SetArrayLength(Result, 0); if Cut = '' then Cut:= #1310; //если шаблон пуст, считаем переводы строк Repeat k:=Pos(Cut,Text); if k = 1 then begin Delete(Text, 1, Length(Cut)); CONTINUE end; SetArrayLength(Result, GetArrayLength(Result) +1); i:=GetArrayLength(Result)-1; if k = 0 then Result[i]:=Text else begin Result[i]:= Copy(Text, 1, k -1); Delete(Text, 1, Length(Result[i]) + Length(Cut)); end; Until Length(Text) * k = 0; end; procedure FindFiles(FromDir: String; Mask: String); var FindResult: Boolean; FSR, DSR: TFindRec; begin FindResult:=FindFirst(AddBackslash(FromDir)+Mask, FSR); while FindResult do begin if FSR.Attributes and FILE_ATTRIBUTE_DIRECTORY = 0 then begin S:= S + AddBackslash(fromDir) + FSR.Name +'|'; end; FindResult:= FindNext(FSR); end; FindResult:= FindFirst(AddBackslash(FromDir)+ '*.*', DSR); while FindResult do begin if ((DSR.Attributes and FILE_ATTRIBUTE_DIRECTORY) = FILE_ATTRIBUTE_DIRECTORY) and not ((DSR.Name = '.') or (DSR.Name = '..')) then begin FindFiles(AddBackSlash(FromDir)+ DSR.Name, Mask); end; FindResult:= FindNext(DSR); end; FindClose(FSR); FindClose(DSR); end; //-------Начало----распаковка OGG------------------------------------------------ procedure RecodeOgg; var ResultCode: integer; CurFile: String; begin FindFiles(ExpandConstant('{app}\hl2\sound\'), '*.ogg'); //Находим все файлы по маске, в выбранной папке Files:= StringToArray(S, '|'); //Переводим в массив WizardForm.ProgressGauge.Max:= GetArrayLength(Files)-1; //Получаем кол-во файлов for n:=(GetArrayLength(Files)-1) downto 0 do begin CurFile:= Files[n]; StringChange(CurFile, AddBackslash(ExpandConstant('{app}\hl2\sound\')), ''); Exec(ExpandConstant('{app}\hl2\sound\oggdec.exe'), '-Q '+ AddQuotes(CurFile), '', SW_Hide, EwWaitUntilTerminated, ResultCode); //Для каждого файла запускаем декодер DeleteFile(Files[n]); //Удаляем ненужный файл WizardForm.FilenameLabel.Caption:= Files[n]; //Двигаем прогрессбар WizardForm.ProgressGauge.Position:= WizardForm.ProgressGauge.Position +1; end; DeleteFile(ExpandConstant('{app}\hl2\sound\oggdec.exe')); end; //-------Конец----распаковка OGG------------------------------------------------ //-------Начало----распаковка WV ------------------------------------------------ procedure RecodeWV; var ResultCode: integer; CurFile: String; begin FindFiles(ExpandConstant('{app}\hl2\sound\'), '*.wv'); //Находим все файлы по маске, в выбранной папке Files:= StringToArray(S, '|'); //Переводим в массив WizardForm.ProgressGauge.Max:= GetArrayLength(Files)-1; //Получаем кол-во файлов for n:=(GetArrayLength(Files)-1) downto 0 do begin CurFile:= Files[n]; StringChange(CurFile, AddBackslash(ExpandConstant('{app}\hl2\sound\')), ''); Exec(ExpandConstant('{app}\hl2\sound\wvunpack.exe'), '-t -q -y '+ AddQuotes(CurFile), '', SW_Hide, EwWaitUntilTerminated, ResultCode); //Для каждого файла запускаем декодер DeleteFile(Files[n]); //Удаляем ненужный файл WizardForm.FilenameLabel.Caption:= Files[n]; //Двигаем прогрессбар WizardForm.ProgressGauge.Position:= WizardForm.ProgressGauge.Position +1; end; DeleteFile(ExpandConstant('{app}\hl2\sound\wvunpack.exe')) end; //-------Конец----распаковка WV ------------------------------------------------ procedure CurStepChanged(CurStep: TSetupStep); begin if CurStep = ssPostInstall then begin WizardForm.ProgressGauge.Position := 0; WizardForm.StatusLabel.Caption := 'Decompressing audio files, please wait...'; RecodeOgg; RecodeWV; end; end; | Всего записей: 28 | Зарегистр. 07-09-2007 | Отправлено: 11:37 29-07-2011 | Исправлено: ssv14, 11:49 29-07-2011 |
|