예제 #1
0
        void EventsCallback(IntPtr handle, IntPtr userData, nint numEvents,
                            IntPtr eventPaths, IntPtr eventFlags, IntPtr eventIds)
        {
            if (numEvents == 0)
            {
                return;
            }

            var events    = new FSEvent[numEvents];
            var pathArray = new CFArray(eventPaths);

            for (int i = 0; i < events.Length; i++)
            {
                events[i].Flags = (FSEventStreamEventFlags)(uint)Marshal.ReadInt32(eventFlags, i * 4);
                events[i].Id    = (uint)Marshal.ReadInt64(eventIds, i * 8);
                using (var cfstr = new CFString(pathArray.GetValue(i))) {
                    events[i].Path = cfstr.ToString();
                }
            }

            OnEvents(events);
        }
예제 #2
0
 internal FSEventStreamEventsArgs(FSEvent [] events)
 {
     Events = events;
 }
예제 #3
0
        void EventsCallback(IntPtr handle, IntPtr userData, nint numEvents,
            IntPtr eventPaths, IntPtr eventFlags, IntPtr eventIds)
        {
            if (numEvents == 0) {
                return;
            }

            var events = new FSEvent[numEvents];
            var pathArray = new CFArray (eventPaths);

            for (int i = 0; i < events.Length; i++) {
                events[i].Flags = (FSEventStreamEventFlags)(uint)Marshal.ReadInt32 (eventFlags, i * 4);
                events[i].Id = (uint)Marshal.ReadInt64 (eventIds, i * 8);
                using (var cfstr = new CFString (pathArray.GetValue (i))) {
                    events[i].Path = cfstr.ToString ();
                }
            }

            OnEvents (events);
        }
예제 #4
0
 protected virtual void OnEvents(FSEvent [] events)
 {
     var handler = Events;
     if (handler != null) {
         handler (this, new FSEventStreamEventsArgs (events));
     }
 }