#include "hbclass.ch" #include "common.ch" #define LLDOMINUS_PREVIEW_DIAGNOSTICS 0 #define LLDOMINUS_PREVIEW_LOG_NAME "LLDominusPreview.log" FUNCTION LLPreviewDiagnosticsEnabled() RETURN LLDOMINUS_PREVIEW_DIAGNOSTICS == 1 FUNCTION LLPreviewMilliseconds() RETURN hb_TToN( hb_DateTime() ) * 86400000.0 FUNCTION LLPreviewLogPath() LOCAL cBase := hb_DirBase() IF Empty( cBase ) cBase := CurDir() ENDIF IF ! Right( cBase, 1 ) $ "/\" cBase += hb_ps() ENDIF RETURN cBase + LLDOMINUS_PREVIEW_LOG_NAME FUNCTION LLPreviewEmfMetric( oEmf, cMessage ) LOCAL uValue := 0 LOCAL oMetricError := NIL IF ! HB_ISOBJECT( oEmf ) .OR. Empty( cMessage ) .OR. ! __objHasMsg( oEmf, cMessage ) RETURN 0 ENDIF BEGIN SEQUENCE WITH {| oSequenceError | Break( oSequenceError ) } uValue := __objSendMsg( oEmf, cMessage ) RECOVER USING oMetricError END SEQUENCE RETURN iif( oMetricError == NIL .AND. HB_ISNUMERIC( uValue ), uValue, 0 ) FUNCTION LLPreviewLog( cText ) LOCAL hFile LOCAL cLine DEFAULT cText TO "" IF ! LLPreviewDiagnosticsEnabled() RETURN NIL ENDIF cLine := hb_TToC( hb_DateTime(), "YYYY-MM-DD", "HH:MM:SS.FFF" ) + " | " + cText + hb_eol() hFile := FOpen( LLPreviewLogPath(), 2 ) IF hFile < 0 hFile := FCreate( LLPreviewLogPath() ) ENDIF IF hFile >= 0 FSeek( hFile, 0, 2 ) FWrite( hFile, cLine ) FClose( hFile ) ENDIF RETURN NIL