
Модератор: Модераторы



...
uses ...,httpsend,...;
....
var
 f: TFileStream;
begin
  f:=TFileStream.Create('бла-бла',fmCreate);
  HttpGetBinary('http://бла-бла',f);
 f.free;
...
...
uses ...,md5,...;
...
begin
  if hash_file=MD5Print(MD5File('бла-бла')) then
   ....
  else
   ...
...
просто не совсем понимаю как это реализовать


pztrn писал(а):Задача следующая - слить с сервера файл, генерируемый "find . ! -type d -print0 | xargs -0 md5sum", взять оттуда данные и сравнить с md5 локального файла.
<?php
$hash = md5_file($_GET["filename"]);
print $hash
?>var param,response:tstringlist; i:integer;
begin
param := TStringList.Create;
IdHTTP1.HandleRedirects:=true;
response := TStringList.Create;
response.Text := idhttp1.Post('http://localhost/hesh/index.php?filename='+Edit1.text, param);
 //передаем параметр пхп скрипту и получаем хеш(edit1.text = Файл на удаленном сервере хеш которого надо получить)
param.Free;
form1.Memo1.Lines := response; //собственно выводим
procedure TForm1.Button2Click(Sender: TObject);
begin
  Index := 0;
    fn := TStringList.Create;
  md5s := TStringList.Create;
  fn.LoadFromFile(ExtractFilePath(Application.EXEName) + 'hashes.name');
  try repeat
  MD5Print(MD5File(fn.Strings[Index]));
  Form1.Memo1.Lines.Append('File ' + IntToStr(Index) + ': ' + fn.Strings[Index] + ' Created (Hash: ' +  MD5Print(MD5File(fn.Strings[Index])) + ')');
  md5s.Add(MD5Print(MD5File(fn.Strings[Index])));
  Index := Index + 1;
  until Index = fn.Count;
  finally
    Form1.Memo1.Lines.Append('Files count: ' + IntToStr(fn.Count));
    md5s.SaveToFile(ExtractFilePath(Application.EXEName) + 'hashes.md5');
    fn.Free;
    md5s.Free;
  end;
end;  LFileName := fn.Strings.String[Index];
  ...
Application.ProcessMessages
CompProc := TProcess.Create(nil);
          with TProcess.Create(nil) do
          begin
            CommandLine := cmdl;
            {$IFDEF WIN32}CommandLine := cmdlw;{$ENDIF}
            Execute;
            repeat
              Application.ProcessMessages;
              Sleep(10);
            until not Running;
            Free;
          end;
Сейчас этот форум просматривают: Yandex [Bot] и гости: 1