示例#1
0
        public FSEventStream(CFAllocator allocator, NSArray pathsToWatch,
                             ulong sinceWhenId, TimeSpan latency, FSEventStreamCreateFlags flags)
        {
            if (pathsToWatch == null)
            {
                throw new ArgumentNullException("pathsToWatch");
            }

            eventsCallback = new FSEventStreamCallback(EventsCallback);

            handle = FSEventStreamCreate(
                allocator == null ? IntPtr.Zero : allocator.Handle,
                eventsCallback, IntPtr.Zero, pathsToWatch.Handle,
                sinceWhenId, latency.TotalSeconds, flags | (FSEventStreamCreateFlags)0x1 /* UseCFTypes */);

            if (handle == IntPtr.Zero)
            {
                throw new Exception("Unable to create FSEventStream");
            }
        }
示例#2
0
        void FSEventStreamInit(CFAllocator allocator, ulong deviceToWatch, NSArray pathsToWatchRelativeToDevice,
                               ulong sinceWhen, TimeSpan latency, FSEventStreamCreateFlags flags)
        {
            if (pathsToWatchRelativeToDevice == null)
            {
                throw new ArgumentNullException(nameof(pathsToWatchRelativeToDevice));
            }

            eventsCallback = new FSEventStreamCallback(EventsCallback);

            handle = FSEventStreamCreateRelativeToDevice(
                allocator.GetHandle(),
                eventsCallback, IntPtr.Zero, deviceToWatch, pathsToWatchRelativeToDevice.GetHandle(),
                sinceWhen, latency.TotalSeconds, flags | (FSEventStreamCreateFlags)0x1);

            if (handle == IntPtr.Zero)
            {
                throw new InvalidOperationException("Unable to create FSEventStream");
            }
        }
示例#3
0
 public FSEventStream(CFAllocator allocator, ulong deviceToWatch, NSArray pathsToWatchRelativeToDevice,
                      ulong sinceWhen, TimeSpan latency, FSEventStreamCreateFlags flags) => FSEventStreamInit(allocator, deviceToWatch, pathsToWatchRelativeToDevice, sinceWhen, latency, flags);