示例#1
0
        protected override WatcherData GetWatcherData(string pathname, ISyncEventQueue queue)
        {
            WatcherData watcherData = new WatcherData();

            watcherData.Data    = new EventQueue(queue);
            watcherData.Watcher = new MacWatcher(pathname, watcherData.Data as ISyncEventQueue, TimeSpan.FromMilliseconds(100));
            return(watcherData);
        }
示例#2
0
        protected override WatcherData GetWatcherData(string pathname, ISyncEventQueue queue)
        {
            WatcherData watcherData = new WatcherData();

            watcherData.Data    = new Tuple <FileSystemWatcher, IMetaDataStorage>(new FileSystemWatcher(pathname), this.storage.Object);
            watcherData.Watcher = new NetWatcher((watcherData.Data as Tuple <FileSystemWatcher, IMetaDataStorage>).Item1, queue, this.storage.Object);
            return(watcherData);
        }
示例#3
0
        protected override void WaitWatcherData(WatcherData watcherData, string pathname, WatcherChangeTypes types, int milliseconds)
        {
            EventQueue queue = watcherData.Data as EventQueue;

            while (milliseconds >= 0)
            {
                FSEvent[] events;
                lock (queue.Events) {
                    events = queue.Events.ToArray();
                }
                foreach (FSEvent fsEvent in events)
                {
                    if (fsEvent.LocalPath == pathname && fsEvent.Type == types)
                    {
                        return;
                    }
                }
                Thread.Sleep(10);
                milliseconds -= 10;
            }
        }
 protected virtual void WaitWatcherData(WatcherData watcherData, string pathname, WatcherChangeTypes types, int milliseconds) {
     Assert.Fail("to be implemented in sub class");
 }
示例#5
0
        protected override void WaitWatcherData(WatcherData watcherData, string pathname, WatcherChangeTypes types, int milliseconds)
        {
            FileSystemWatcher watcher = (watcherData.Data as Tuple <FileSystemWatcher, IMetaDataStorage>).Item1;

            watcher.WaitForChanged(types, milliseconds);
        }
示例#6
0
 protected virtual void WaitWatcherData(WatcherData watcherData, string pathname, WatcherChangeTypes types, int milliseconds)
 {
     Assert.Fail("to be implemented in sub class");
 }
示例#7
0
 protected override void WaitWatcherData(WatcherData watcherData, string pathname, WatcherChangeTypes types, int milliseconds) {
     FileSystemWatcher watcher = (watcherData.Data as Tuple<FileSystemWatcher, IMetaDataStorage>).Item1;
     watcher.WaitForChanged(types, milliseconds);
 }
示例#8
0
 protected override WatcherData GetWatcherData(string pathname, ISyncEventQueue queue) {
     WatcherData watcherData = new WatcherData();
     watcherData.Data = new Tuple<FileSystemWatcher, IMetaDataStorage>(new FileSystemWatcher(pathname), this.storage.Object);
     watcherData.Watcher = new NetWatcher((watcherData.Data as Tuple<FileSystemWatcher, IMetaDataStorage>).Item1, queue, this.storage.Object);
     return watcherData;
 }
示例#9
0
 protected override void WaitWatcherData(WatcherData watcherData, string pathname, WatcherChangeTypes types, int milliseconds) {
     EventQueue queue = watcherData.Data as EventQueue;
     while (milliseconds >= 0) {
         FSEvent[] events;
         lock (queue.Events) {
             events = queue.Events.ToArray();
         }
         foreach (FSEvent fsEvent in events) {
             if (fsEvent.LocalPath == pathname && fsEvent.Type == types) {
                 return;
             }
         }
         Thread.Sleep(10);
         milliseconds -= 10;
     }
 }
示例#10
0
 protected override WatcherData GetWatcherData(string pathname, ISyncEventQueue queue) {
     WatcherData watcherData = new WatcherData();
     watcherData.Data = new EventQueue(queue);
     watcherData.Watcher = new MacWatcher(pathname, watcherData.Data as ISyncEventQueue, TimeSpan.FromMilliseconds(100));
     return watcherData;
 }