Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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;
            }
        }
Exemplo n.º 4
0
 protected virtual void WaitWatcherData(WatcherData watcherData, string pathname, WatcherChangeTypes types, int milliseconds) {
     Assert.Fail("to be implemented in sub class");
 }
Exemplo n.º 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);
        }
Exemplo n.º 6
0
 protected virtual void WaitWatcherData(WatcherData watcherData, string pathname, WatcherChangeTypes types, int milliseconds)
 {
     Assert.Fail("to be implemented in sub class");
 }
Exemplo n.º 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);
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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;
 }