Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Monitor()

unsafe void System.IO.FileSystemWatcher.Monitor ( AsyncReadState state)
inlineprivate

Definition at line 782 of file FileSystemWatcher.cs.

783 {
784 NativeOverlapped* ptr = null;
785 bool flag = false;
786 try
787 {
788 if (_enabled && !IsHandleInvalid(state.DirectoryHandle))
789 {
790 ptr = state.ThreadPoolBinding.AllocateNativeOverlapped(state.PreAllocatedOverlapped);
791 flag = global::Interop.Kernel32.ReadDirectoryChangesW(state.DirectoryHandle, state.Buffer, _internalBufferSize, _includeSubdirectories, (uint)_notifyFilters, null, ptr, null);
792 }
793 }
794 catch (ObjectDisposedException)
795 {
796 }
797 catch (ArgumentNullException)
798 {
799 }
800 finally
801 {
802 if (!flag)
803 {
804 if (ptr != null)
805 {
806 state.ThreadPoolBinding.FreeNativeOverlapped(ptr);
807 }
808 state.PreAllocatedOverlapped.Dispose();
809 state.ThreadPoolBinding.Dispose();
810 if (!IsHandleInvalid(state.DirectoryHandle))
811 {
812 OnError(new ErrorEventArgs(new Win32Exception()));
813 }
814 }
815 }
816 }
void OnError(ErrorEventArgs e)
static bool IsHandleInvalid([NotNullWhen(false)] SafeFileHandle handle)

References System.IO.FileSystemWatcher._enabled, System.IO.FileSystemWatcher._includeSubdirectories, System.IO.FileSystemWatcher._internalBufferSize, System.IO.FileSystemWatcher._notifyFilters, System.IO.FileSystemWatcher.IsHandleInvalid(), System.IO.FileSystemWatcher.OnError(), and System.state.

Referenced by System.IO.FileSystemWatcher.ReadDirectoryChangesCallback(), and System.IO.FileSystemWatcher.StartRaisingEvents().