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
| procedure TMonitoringInputThread.DirChange(Sender: TObject; Action: TDirectoryAction; FileName: String);
var
ext, CurrentFilename: string;
processStart, processEnd : TDateTime;
begin
if (Action = daFileAdded) then
begin
ext := LowerCase(ExtractFileExt(FileName));
if (ext = '.eat') then
begin
processStart := now;
CurrentFilename := ExtractFileName(FileName);
PostMessage(Self.FParentHandle, WM_UPDATE_UI, 0, 0);
processEnd := now;
FStatus := 'File added: ' + CurrentFilename + ' in ' + Format('%.3f', [SecondSpan(processStart, processEnd)]) + ' seconds';
WaitForSingleObject(FSemaphoreLog, INFINITE);
Log(FStatus);
ReleaseSemaphore(FSemaphoreLog, 1, nil);
FReadConsoleOutput := TReadConsoleThread.Create(true, 'ReadC');
FReadConsoleOutput.AppPath := 'C:\Program Files\Eppendorf\epQuantPrime\epQuantPrime.exe';
FReadConsoleOutput.Args := '"' + FInputFolderToMonitor + '" "' + FOutputFolderToMonitor + '" "' + CurrentFilename + '"';
FReadConsoleOutput.Priority := tpLower;
FReadConsoleOutput.Execute;
//frmMain.SetStatusText(FStatus, false);
end else
begin
if (ext <> '.grd') then
begin
FStatus := 'Incorrect file extension, the file was not processed (' + FileName + ')';
WaitForSingleObject(FSemaphoreLog, INFINITE);
Log(FStatus);
ReleaseSemaphore(FSemaphoreLog, 1, nil);
//SetStatusText(FStatus, false);
end;
end;
end;
end; |
Partager