コード例 #1
0
 private static extern SafeEventStreamHandle FSEventStreamCreate(
     IntPtr allocator,
     FSEventStreamCallback cb,
     IntPtr context,
     SafeCreateHandle pathsToWatch,
     FSEventStreamEventId sinceWhen,
     CFTimeInterval latency,
     FSEventStreamCreateFlags flags);
コード例 #2
0
 private static extern FSEventStreamRef FSEventStreamCreate(
     IntPtr allocator,
     FSEventStreamCallback cb,
     IntPtr context,
     CFArrayRef pathsToWatch,
     FSEventStreamEventId sinceWhen,
     CFTimeInterval latency,
     FSEventStreamCreateFlags flags);
コード例 #3
0
 private extern static IntPtr FSEventStreamCreate(
     IntPtr allocator,
     FSEventStreamCallback callback,
     IntPtr context,
     IntPtr pathsToWatch,
     ulong sinceWhen,
     double latency,
     FSEventStreamCreateFlags flags);
コード例 #4
0
 /// <summary>
 /// Creates a new EventStream to listen to events from the core OS (such as File System events).
 /// </summary>
 /// <param name="cb">A callback instance that will be called for every event batch.</param>
 /// <param name="pathsToWatch">A CFArray of the path(s) to watch for events.</param>
 /// <param name="sinceWhen">
 /// The start point to receive events from. This can be to retrieve historical events or only new events.
 /// To get historical events, pass in the corresponding ID of the event you want to start from.
 /// To get only new events, pass in kFSEventStreamEventIdSinceNow.
 /// </param>
 /// <param name="latency">Coalescing period to wait before sending events.</param>
 /// <param name="flags">Flags to say what kind of events should be sent through this stream.</param>
 /// <returns>On success, returns a valid SafeCreateHandle to an FSEventStream object; otherwise, returns an invalid SafeCreateHandle</returns>
 internal static SafeEventStreamHandle FSEventStreamCreate(
     FSEventStreamCallback cb,
     SafeCreateHandle pathsToWatch,
     FSEventStreamEventId sinceWhen,
     CFTimeInterval latency,
     FSEventStreamCreateFlags flags)
 {
     return(FSEventStreamCreate(IntPtr.Zero, cb, IntPtr.Zero, pathsToWatch, sinceWhen, latency, flags));
 }
コード例 #5
0
 /// <summary>
 /// Creates a new EventStream to listen to events from the core OS (such as File System events).
 /// </summary>
 /// <param name="cb">A callback instance that will be called for every event batch.</param>
 /// <param name="pathsToWatch">A CFArray of the path(s) to watch for events.</param>
 /// <param name="sinceWhen">
 /// The start point to receive events from. This can be to retrieve historical events or only new events.
 /// To get historical events, pass in the corresponding ID of the event you want to start from.
 /// To get only new events, pass in kFSEventStreamEventIdSinceNow.
 /// </param>
 /// <param name="latency">Coalescing period to wait before sending events.</param>
 /// <param name="flags">Flags to say what kind of events should be sent through this stream.</param>
 /// <returns>On success, returns a pointer to an FSEventStream object; otherwise, returns IntPtr.Zero</returns>
 public static FSEventStreamRef FSEventStreamCreate(
     FSEventStreamCallback cb,
     CFArrayRef pathsToWatch,
     FSEventStreamEventId sinceWhen,
     CFTimeInterval latency,
     FSEventStreamCreateFlags flags)
 {
     return(FSEventStreamCreate(IntPtr.Zero, cb, IntPtr.Zero, pathsToWatch, sinceWhen, latency, flags));
 }
コード例 #6
0
ファイル: FSEvents.cs プロジェクト: tondat/xamarin-macios
        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");
            }
        }
コード例 #7
0
ファイル: FSEvents.cs プロジェクト: prmallic/xamarin-macios
        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");
            }
        }
コード例 #8
0
 static extern IntPtr FSEventStreamCreate(IntPtr allocator, FSEventStreamCallback callback, IntPtr context, IntPtr pathsToWatch, ulong sinceWhen, double latency, FSEventStreamCreateFlags flags);
コード例 #9
0
ファイル: FSEvents.cs プロジェクト: tondat/xamarin-macios
 public FSEventStream(string [] pathsToWatch, TimeSpan latency, FSEventStreamCreateFlags flags)
     : this(null, NSArray.FromStrings(pathsToWatch), FSEvent.SinceNowId, latency, flags)
 {
 }
コード例 #10
0
 /// <summary>
 /// Creates a new EventStream to listen to events from the core OS (such as File System events).
 /// </summary>
 /// <param name="cb">A callback instance that will be called for every event batch.</param>
 /// <param name="pathsToWatch">A CFArray of the path(s) to watch for events.</param>
 /// <param name="sinceWhen">
 /// The start point to receive events from. This can be to retrieve historical events or only new events. 
 /// To get historical events, pass in the corresponding ID of the event you want to start from.
 /// To get only new events, pass in kFSEventStreamEventIdSinceNow.
 /// </param>
 /// <param name="latency">Coalescing period to wait before sending events.</param>
 /// <param name="flags">Flags to say what kind of events should be sent through this stream.</param>
 /// <returns>On success, returns a valid SafeCreateHandle to an FSEventStream object; otherwise, returns an invalid SafeCreateHandle</returns>
 internal static SafeEventStreamHandle FSEventStreamCreate(
     FSEventStreamCallback       cb,
     SafeCreateHandle            pathsToWatch,
     FSEventStreamEventId        sinceWhen,
     CFTimeInterval              latency,
     FSEventStreamCreateFlags    flags)
 {
     return FSEventStreamCreate(IntPtr.Zero, cb, IntPtr.Zero, pathsToWatch, sinceWhen, latency, flags);
 }
コード例 #11
0
 private static extern SafeEventStreamHandle FSEventStreamCreate(
     IntPtr                      allocator,
     FSEventStreamCallback       cb,
     IntPtr                      context,
     SafeCreateHandle            pathsToWatch,
     FSEventStreamEventId        sinceWhen,
     CFTimeInterval              latency,
     FSEventStreamCreateFlags    flags);
コード例 #12
0
 static void RunTest(FSEventStreamCreateFlags createFlags)
 => new TestFSMonitor(
     Xamarin.Cache.CreateTemporaryDirectory(),
     createFlags,
     maxFilesToCreate: 256).Run();
コード例 #13
0
 public FSEventStream(string [] pathsToWatch, TimeSpan latency, FSEventStreamCreateFlags flags)
     : this(null, NSArray.FromStrings (pathsToWatch), FSEvent.SinceNowId, latency, flags)
 {
 }
コード例 #14
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");
            }
        }
コード例 #15
0
ファイル: FSEvents.cs プロジェクト: prmallic/xamarin-macios
 public FSEventStream(ulong deviceToWatch, NSArray pathsToWatchRelativeToDevice,
                      ulong sinceWhen, TimeSpan latency, FSEventStreamCreateFlags flags) => FSEventStreamInit(null, deviceToWatch, pathsToWatchRelativeToDevice, sinceWhen, latency, flags);
コード例 #16
0
ファイル: FSEvents.cs プロジェクト: prmallic/xamarin-macios
 static extern IntPtr FSEventStreamCreateRelativeToDevice(IntPtr allocator, FSEventStreamCallback callback,
                                                          IntPtr context, ulong deviceToWatch, IntPtr pathsToWatchRelativeToDevice,
                                                          ulong sinceWhen, double latency, FSEventStreamCreateFlags flags);