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

◆ StartRaisingEvents()

unsafe void System.IO.FileSystemWatcher.StartRaisingEvents ( )
inlineprivate

Definition at line 709 of file FileSystemWatcher.cs.

710 {
711 if (IsSuspended())
712 {
713 _enabled = true;
714 }
715 else
716 {
718 {
719 return;
720 }
721 _directoryHandle = global::Interop.Kernel32.CreateFile(_directory, 1, FileShare.ReadWrite | FileShare.Delete, FileMode.Open, 1107296256);
723 {
724 _directoryHandle = null;
725 throw new FileNotFoundException(System.SR.Format(System.SR.FSW_IOError, _directory));
726 }
727 AsyncReadState asyncReadState;
728 try
729 {
731 byte[] array = AllocateBuffer();
733 asyncReadState.PreAllocatedOverlapped = new PreAllocatedOverlapped(delegate(uint errorCode, uint numBytes, NativeOverlapped* overlappedPointer)
734 {
736 asyncReadState2.ThreadPoolBinding.FreeNativeOverlapped(overlappedPointer);
737 if (asyncReadState2.WeakWatcher.TryGetTarget(out var target))
738 {
739 target.ReadDirectoryChangesCallback(errorCode, numBytes, asyncReadState2);
740 }
742 }
743 catch
744 {
746 _directoryHandle = null;
747 throw;
748 }
749 _enabled = true;
751 }
752 }
static unsafe SafeFileHandle CreateFile(string fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
unsafe void Monitor(AsyncReadState state)
static bool IsHandleInvalid([NotNullWhen(false)] SafeFileHandle handle)
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string FSW_IOError
Definition SR.cs:16
Definition SR.cs:7
static int Increment(ref int location)
static ThreadPoolBoundHandle BindHandle(SafeHandle handle)
static unsafe? object GetNativeOverlappedState(NativeOverlapped *overlapped)

References System.IO.FileSystemWatcher._currentSession, System.IO.FileSystemWatcher._directory, System.IO.FileSystemWatcher._directoryHandle, System.IO.FileSystemWatcher._enabled, System.IO.FileSystemWatcher.AllocateBuffer(), System.array, System.Threading.ThreadPoolBoundHandle.BindHandle(), Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(), System.Runtime.InteropServices.SafeHandle.Dispose(), System.SR.Format(), System.SR.FSW_IOError, System.Threading.ThreadPoolBoundHandle.GetNativeOverlappedState(), System.Threading.Interlocked.Increment(), System.IO.FileSystemWatcher.IsHandleInvalid(), System.IO.FileSystemWatcher.IsSuspended(), and System.IO.FileSystemWatcher.Monitor().

Referenced by System.IO.FileSystemWatcher.EndInit(), and System.IO.FileSystemWatcher.StartRaisingEventsIfNotDisposed().