Недавно добавленные исходники

•  TDictionary Custom Sort  2 344

•  Fast Watermark Sources  2 230

•  3D Designer  3 852

•  Sik Screen Capture  2 618

•  Patch Maker  2 787

•  Айболит (remote control)  2 630

•  ListBox Drag & Drop  2 224

•  Доска для игры Реверси  72 673

•  Графические эффекты  2 881

•  Рисование по маске  2 280

•  Перетаскивание изображений  1 874

•  Canvas Drawing  1 900

•  Рисование Луны  1 874

•  Поворот изображения  1 462

•  Рисование стержней  1 511

•  Paint on Shape  1 047

•  Генератор кроссвордов  1 612

•  Головоломка Paletto  1 253

•  Теорема Монжа об окружностях  1 604

•  Пазл Numbrix  1 156

•  Заборы и коммивояжеры  1 413

•  Игра HIP  984

•  Игра Go (Го)  934

•  Симулятор лифта  1 068

•  Программа укладки плитки  890

•  Генератор лабиринта  1 164

•  Проверка числового ввода  962

•  HEX View  1 128

•  Физический маятник  967

•  Задача коммивояжера  1 029

 
скрыть


Delphi FAQ - Часто задаваемые вопросы

| Базы данных | Графика и Игры | Интернет и Сети | Компоненты и Классы | Мультимедиа |
| ОС и Железо | Программа и Интерфейс | Рабочий стол | Синтаксис | Технологии | Файловая система |



BotTrade - Заработок на криптовалютах

Соединить и сжать несколько файлов в один



Оформил: DeeCo

uses
   Zlib;

 procedure CompressFiles(Files : TStrings; const Filename : String);
 var
   infile, outfile, tmpFile : TFileStream;
   compr : TCompressionStream;
   i,l : Integer;
   s : String;

 begin
   if Files.Count > 0 then
   begin
     outFile := TFileStream.Create(Filename,fmCreate);
     try
       { the number of files }
       l := Files.Count;
       outfile.Write(l,SizeOf(l));
       for i := 0 to Files.Count-1 do
       begin
         infile := TFileStream.Create(Files[i],fmOpenRead);
         try
           { the original filename }
           s := ExtractFilename(Files[i]);
           l := Length(s);
           outfile.Write(l,SizeOf(l));
           outfile.Write(s[1],l);
           { the original filesize }
           l := infile.Size;
           outfile.Write(l,SizeOf(l));
           { compress and store the file temporary}
           tmpFile := TFileStream.Create('tmp',fmCreate);
           compr := TCompressionStream.Create(clMax,tmpfile);
           try
             compr.CopyFrom(infile,l);
           finally
             compr.Free;
             tmpFile.Free;
           end;
           { append the compressed file to the destination file }
           tmpFile := TFileStream.Create('tmp',fmOpenRead);
           try
             outfile.CopyFrom(tmpFile,0);
           finally
             tmpFile.Free;
           end;
         finally
           infile.Free;
         end;
       end;
     finally
       outfile.Free;
     end;
     DeleteFile('tmp');
   end;
 end;

 procedure DecompressFiles(const Filename, DestDirectory : String);
 var
   dest,s : String;
   decompr : TDecompressionStream;
   infile, outfile : TFilestream;
   i,l,c : Integer;
 begin
   // IncludeTrailingPathDelimiter (D6/D7 only) 
  dest := IncludeTrailingPathDelimiter(DestDirectory);

   infile := TFileStream.Create(Filename,fmOpenRead);
   try
     { number of files }
     infile.Read(c,SizeOf(c));
     for i := 1 to c do
     begin
       { read filename }
       infile.Read(l,SizeOf(l));
       SetLength(s,l);
       infile.Read(s[1],l);
       { read filesize }
       infile.Read(l,SizeOf(l));
       { decompress the files and store it }
       s := dest+s; //include the path 
      outfile := TFileStream.Create(s,fmCreate);
       decompr := TDecompressionStream.Create(infile);
       try
         outfile.CopyFrom(decompr,l);
       finally
         outfile.Free;
         decompr.Free;
       end;
     end;
   finally
     infile.Free;
   end;
 end;




Похожие по теме исходники

Чтение PSD файлов

Шифратор файлов

Поиск файлов

FileMan (менеджер файлов)

 

Поиск открытых файлов




Copyright © 2004-2023 "Delphi Sources" by BrokenByte Software. Delphi World FAQ

Группа ВКонтакте