From 45d3b258b94d1eb3ed8fb452f54b2d422a6c65f9 Mon Sep 17 00:00:00 2001 From: Berserker Date: Sat, 25 May 2019 17:33:08 +0300 Subject: [PATCH] v1.0 Cleaned garbage from code --- Tests/VfsIntegratedTest.pas | 1 - VfsControl.pas | 16 +------------ VfsHooks.pas | 3 +-- VfsWatching.pas | 46 ++----------------------------------- 4 files changed, 4 insertions(+), 62 deletions(-) diff --git a/Tests/VfsIntegratedTest.pas b/Tests/VfsIntegratedTest.pas index 5608adf..170f965 100644 --- a/Tests/VfsIntegratedTest.pas +++ b/Tests/VfsIntegratedTest.pas @@ -56,7 +56,6 @@ begin VfsBase.MapDir(RootDir, VfsUtils.MakePath([RootDir, 'Mods\Apache']), DONT_OVERWRITE_EXISTING); VfsDebug.SetLoggingProc(LogSomething); VfsControl.RunVfs(VfsBase.SORT_FIFO); - //Windows.MessageBoxA(0, '', '', 0); FIXME DELETEME end; procedure TestIntegrated.TearDown; diff --git a/VfsControl.pas b/VfsControl.pas index 47cf003..7335b52 100644 --- a/VfsControl.pas +++ b/VfsControl.pas @@ -9,7 +9,7 @@ unit VfsControl; uses Windows, SysUtils, Utils, WinUtils, TypeWrappers, DataLib, Files, StrLib, - VfsBase, VfsUtils, VfsHooks, VfsWatching, DlgMes, FilesEx {FIXME DELETEME}; + VfsBase, VfsUtils, VfsHooks, VfsWatching; type (* Import *) @@ -176,18 +176,4 @@ begin SysUtils.FreeAndNil(ModList); end; // .function MapModsFromList -var s: string; -begin - // MapModsFromList('D:\Heroes 3', 'D:\heroes 3\Mods', 'd:\heroes 3\mods\list.txt'); - // RunVfs(SORT_FIFO); - // ReadFileContents('D:\heroes 3\data\s\__T.erm', s); - // s := copy(s, 1, 100); - // VarDump([s]); - // VfsBase.PauseVfs; - // VfsBase.RefreshVfs; - // VfsBase.RunVfs(SORT_FIFO); - // ReadFileContents('D:\heroes 3\data\s\__T.erm', s); - // s := copy(s, 1, 100); - // VarDump([s]); - // exit; end. \ No newline at end of file diff --git a/VfsHooks.pas b/VfsHooks.pas index d34f09d..46b3c61 100644 --- a/VfsHooks.pas +++ b/VfsHooks.pas @@ -11,8 +11,7 @@ uses Utils, WinNative, Concur, StrLib, Alg, VfsBase, VfsUtils, VfsPatching, - VfsDebug, VfsApiDigger, VfsOpenFiles, - {FIXME DELETEME} DlgMes; + VfsDebug, VfsApiDigger, VfsOpenFiles; (* Installs VFS hooks, if not already installed, in a thread-safe manner *) diff --git a/VfsWatching.pas b/VfsWatching.pas index 739c31b..be4bfc8 100644 --- a/VfsWatching.pas +++ b/VfsWatching.pas @@ -1,6 +1,6 @@ unit VfsWatching; (* - Description: provides means to watch for mapped directories changes and refresh VFS. + Description: Provides means to watch for mapped directories changes and refresh VFS. Works unreliably when trying to watch the whole logical drive. *) @@ -10,7 +10,7 @@ unit VfsWatching; uses Windows, SysUtils, Math, Utils, Concur, WinUtils, StrLib, WinNative, - VfsBase, VfsUtils, DlgMes, Files {FIXME DELETEME}; + VfsBase, VfsUtils; (***) implementation (***) @@ -216,22 +216,6 @@ begin result := TDirChangesIterator.Create(DirPath); end; -// function ReadNotification (const DirPath: WideString; var NotificationHandle: THandle): boolean; -// begin -// if IsValidHandle(NotificationHandle) then begin -// result := FindNextChangeNotification(NotificationHandle); - -// if not result then begin -// Windows.FindCloseChangeNotification(NotificationHandle); -// NotificationHandle := INVALID_HANDLE_VALUE; -// end; -// end else begin -// NotificationHandle := FindFirstChangeNotificationW(PWideChar(DirPath), true, FILE_NOTIFY_CHANGE_FILE_NAME or FILE_NOTIFY_CHANGE_DIR_NAME or FILE_NOTIFY_CHANGE_ATTRIBUTES or -// FILE_NOTIFY_CHANGE_SIZE or FILE_NOTIFY_CHANGE_LAST_WRITE); -// result := IsValidHandle(NotificationHandle); -// end; -// end; // .function ReadNotification - function WatcherThreadProc (Arg: integer): integer; stdcall; var IsEnd: LONGBOOL; @@ -244,8 +228,6 @@ var DirChangesScanner: IDirChangesIterator; DirChange: TDirChange; - filesize: integer; - begin DirChangesScanner := nil; // * * * * * // @@ -265,7 +247,6 @@ begin if NeedFullRescan and (PlannedRescanTime <= CurrentTime) then begin VfsBase.RefreshVfs; NeedFullRescan := false; - VarDump(['Rescaned']); end; if DirChangesScanner = nil then begin @@ -274,7 +255,6 @@ begin // Failed to start watching directory if not DirChangesScanner.IterNext(DirChange, WatcherStopEvent, Utils.IfThen(boolean(NeedFullRescan), integer(PlannedRescanTime - CurrentTime), integer(Windows.INFINITE))) then begin - VarDump([':(', AbsWatcherDir]); // Force scanner recreation later DirChangesScanner := nil; @@ -286,7 +266,6 @@ begin end; // Ok, got some signal end else begin - VarDump([ord(DirChange.Action), DirChange.FilePath]); if DirChange.Action = NOTIFY_STOP_EVENT then begin IsEnd := true; end else if DirChange.Action = NOTIFY_TIMEOUT then begin @@ -297,13 +276,6 @@ begin end else if DirChange.Action = NOTIFY_FILE_MODIFIED then begin if not NeedFullRescan then begin VfsBase.RefreshMappedFile(DirChange.FilePath); - with VfsBase.GetThreadVfsDisabler do begin - EnableVfsForThread; - Files.GetFileSize(DirChange.FilePath, FileSize); - RestoreVfsForThread; - end; - - VarDump([DirChange.FilePath, 'New size is', FileSize], 'Updated'); end; LastChangeTime := WinUtils.GetMicroTime; @@ -344,18 +316,4 @@ begin end; end; // .function RunWatcher -var - DirChange: TDirChange; - -begin - // WatcherCritSection.Init; - // RunWatcher(GetCurrentDir + '\Tests\', 250); - - // with ReadDirChanges('D:') do begin - // while IterNext(DirChange, 0) do begin - // VarDump([ord(DirChange.Action), DirChange.FilePath]); - // end; - // end; - - // exit; end. \ No newline at end of file