コード例 #1
0
        public IDisposable TrackActions(AsyncQueue <DynamicJsonValue> notificationsQueue, IWebsocketWriter webSocketWriter)
        {
            var watcher = new ConnectedWatcher
            {
                NotificationsQueue = notificationsQueue,
                Writer             = webSocketWriter
            };

            lock (_watchersLock)
            {
                Watchers.TryAdd(watcher);

                if (Watchers.Count == 1)
                {
                    StartBackgroundWorkers();
                }
            }

            return(new DisposableAction(() =>
            {
                lock (_watchersLock)
                {
                    Watchers.TryRemove(watcher);

                    if (Watchers.Count == 0)
                    {
                        StopBackgroundWorkers();
                    }
                }
            }));
        }
コード例 #2
0
 public static void AddDocumentToWatcher(DocumentWatcher d)
 {
     if (!Watchers.Contains(d))
     {
         Watchers.Add(d);
     }
 }
コード例 #3
0
        private static Watchers GetWatchersFromMsBuildFileSystemWatcher(IFileSystem fileSystem)
        {
            var watchers = new Watchers();

            fileSystem.CreateFileSystemWatcher(ProjectDirectory, "*")
            .Returns(ci =>
            {
                var watcher          = Substitute.For <IFileSystemWatcher>();
                watcher.NotifyFilter = Arg.Do <NotifyFilters>(nf =>
                {
                    switch (nf)
                    {
                    case NotifyFilters.FileName:
                        watchers.FileWatcher = watcher;
                        return;

                    case NotifyFilters.DirectoryName:
                        watchers.DirectoryWatcher = watcher;
                        return;

                    case NotifyFilters.Attributes:
                        watchers.AttributesWatcher = watcher;
                        return;

                    default:
                        return;
                    }
                });
                return(watcher);
            });
            return(watchers);
        }
コード例 #4
0
        public NativeExecution(ref WebBrowser browser)
        {
            this.webBrowser = browser;

            this.commands = new Dictionary<string, PhoneGapCommand>
                                {
                                    // TODO: These need to be included based on plugin configuration
                                    { "Accelerometer.GetCurrentAcceleration", new Plugins.Accelerometer.GetCurrentAccelerationCommand() },
                                    { "Camera.GetPicture", new Plugins.Camera.GetPictureCommand() },
                                    { "DebugConsole.debug", new Plugins.DebugConsole.DebugCommand() },
                                    { "Device.GetAll", new Plugins.Device.GetAllCommand() },
                                    { "Geolocation.GetCurrentPosition", new Plugins.Geolocation.GetCurrentPositionCommand() },
                                    { "Network.IsReachable", new Plugins.Network.IsReachableCommand() },
                                    { "Notification.Alert", new Plugins.Notification.AlertCommand() },
                                    { "Notification.Beep", new Plugins.Notification.BeepCommand() },
                                    { "Notification.Vibrate", new Plugins.Notification.VibrateCommand() },
                                    { "Orientation.GetCurrentOrientation", new Plugins.Orientation.GetCurrentOrientationCommand() },
                                    { "Orientation.ClearWatch", new Plugins.Orientation.ClearWatchCommmand() },
                                    { "Orientation.WatchOrientation", new Plugins.Orientation.WatchOrientationCommmand() },
                                    { "Send.Sms", new Plugins.Sms.SendCommand() },
                                    { "Telephony.CallNumber", new Plugins.Telephony.CallCommand() }
                                };

            this.watchers = new Watchers();
        }
コード例 #5
0
        public IDisposable TrackActions(AsyncQueue <DynamicJsonValue> notificationsQueue, IWebsocketWriter webSocketWriter)
        {
            var watcher = new ConnectedWatcher
            {
                NotificationsQueue = notificationsQueue,
                Writer             = webSocketWriter
            };

            lock (_watchersLock)
            {
                Watchers.TryAdd(watcher);

                if (Watchers.Count == 1)
                {
                    StartBackgroundWorkers();
                }

                if (watcher.Writer is NotificationCenterWebSocketWriter)
                {
                    if (_state.NumberOfClients == 0)
                    {
                        var copy = _state;
                        // we use interlocked here to make sure that other threads
                        // are immediately exposed to this
                        Interlocked.Exchange(ref _state, new State
                        {
                            NumberOfClients = 1
                        });
                        copy.NewWebSocket.TrySetResult(null);
                    }
                    else
                    {
                        Interlocked.Increment(ref _state.NumberOfClients);
                    }
                }
            }

            return(new DisposableAction(() =>
            {
                lock (_watchersLock)
                {
                    Watchers.TryRemove(watcher);

                    if (Watchers.Count == 0)
                    {
                        StopBackgroundWorkers();
                    }

                    if (watcher.Writer is NotificationCenterWebSocketWriter)
                    {
                        var copy = _state;
                        if (Interlocked.Decrement(ref copy.NumberOfClients) == 0)
                        {
                            Interlocked.Exchange(ref _state, new State());
                            copy.AllWebSocketsRemoved.TrySetResult(null);
                        }
                    }
                }
            }));
        }
コード例 #6
0
        public IDisposable Subscribe(IObserver <Tuple <object, string, object> > observer)
        {
            var disposable = observer as IDisposable;

            Watchers.Add(observer);
            return(disposable);
        }
コード例 #7
0
ファイル: WMIInstanceWatcher.cs プロジェクト: rafntor/bdhero
        /// <summary>
        /// Creates a new WMIInstanceWatcher with the specified poll interval.
        /// </summary>
        /// <param name="pollInterval">Polling interval between checks for new events</param>
        public WMIInstanceWatcher(TimeSpan pollInterval)
        {
            var wmiClassName = WMIUtils.GetWMIClassName <T>();
            var condition    = string.Format("(TargetInstance ISA '{0}')", wmiClassName);

            var createEventQuery = new WqlEventQuery
            {
                EventClassName = "__InstanceCreationEvent",
                WithinInterval = pollInterval,
                Condition      = condition
            };

            var deleteEventQuery = new WqlEventQuery
            {
                EventClassName = "__InstanceDeletionEvent",
                WithinInterval = pollInterval,
                Condition      = condition
            };

            var createWatcher = new ManagementEventWatcher();

            createWatcher.EventArrived += HandleCreateEvent;
            createWatcher.Query         = createEventQuery;

            var deleteWatcher = new ManagementEventWatcher();

            deleteWatcher.EventArrived += HandleDeleteEvent;
            deleteWatcher.Query         = deleteEventQuery;

            Watchers.Add(createWatcher);
            Watchers.Add(deleteWatcher);
        }
コード例 #8
0
        private void AddWatcher()
        {
            var watcher = TabController.ConfigurationService.GetEmptyObject <WatcherData>(TabController.Configuration);

            watcher.Code = "New watcher";
            Watchers.Add(new Watcher(TabController.Configuration, watcher));
        }
コード例 #9
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public override bool Equals(Issue other)
 {
     if (other == null)
     {
         return(false);
     }
     return(Id == other.Id &&
            Project == other.Project &&
            Tracker == other.Tracker &&
            Status == other.Status &&
            Priority == other.Priority &&
            Author == other.Author &&
            Category == other.Category &&
            Subject == other.Subject &&
            Description == other.Description &&
            StartDate == other.StartDate &&
            DueDate == other.DueDate &&
            DoneRatio == other.DoneRatio &&
            EstimatedHours == other.EstimatedHours &&
            (CustomFields != null ? CustomFields.Equals <IssueCustomField>(other.CustomFields) : other.CustomFields == null) &&
            CreatedOn == other.CreatedOn &&
            UpdatedOn == other.UpdatedOn &&
            AssignedTo == other.AssignedTo &&
            FixedVersion == other.FixedVersion &&
            Notes == other.Notes &&
            (Watchers != null ? Watchers.Equals <Watcher>(other.Watchers) : other.Watchers == null) &&
            ClosedOn == other.ClosedOn &&
            SpentHours == other.SpentHours &&
            PrivateNotes == other.PrivateNotes &&
            (Attachments != null ? Attachments.Equals <Attachment>(other.Attachments) : other.Attachments == null) &&
            (ChangeSets != null ? ChangeSets.Equals <ChangeSet>(other.ChangeSets) : other.ChangeSets == null) &&
            (Children != null ? Children.Equals <IssueChild>(other.Children) : other.Children == null) &&
            (Journals != null ? Journals.Equals <Journal>(other.Journals) : other.Journals == null) &&
            (Relations != null ? Relations.Equals <IssueRelation>(other.Relations) : other.Relations == null));
 }
コード例 #10
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public object Clone()
        {
            var issue = new Issue
            {
                AssignedTo     = AssignedTo,
                Author         = Author,
                Category       = Category,
                CustomFields   = CustomFields.Clone(),
                Description    = Description,
                DoneRatio      = DoneRatio,
                DueDate        = DueDate,
                SpentHours     = SpentHours,
                EstimatedHours = EstimatedHours,
                Priority       = Priority,
                StartDate      = StartDate,
                Status         = Status,
                Subject        = Subject,
                Tracker        = Tracker,
                Project        = Project,
                FixedVersion   = FixedVersion,
                Notes          = Notes,
                Watchers       = Watchers.Clone()
            };

            return(issue);
        }
コード例 #11
0
        public void RefreshWatchers()
        {
            //unsubscribe and dispose old watchers.
            try
            {
                if (Watchers != null)
                {
                    foreach (FileSystemWatcher fsw in Watchers)
                    {
                        fsw.EnableRaisingEvents = false;
                        fsw.Created            -= new System.IO.FileSystemEventHandler(fileSystemWatcher_Created);
                        fsw.Changed            -= new System.IO.FileSystemEventHandler(fileSystemWatcher_Changed);
                        fsw.Deleted            -= new System.IO.FileSystemEventHandler(fileSystemWatcher_Deleted);
                        fsw.Renamed            -= new System.IO.RenamedEventHandler(fileSystemWatcher_Renamed);
                        fsw.Dispose();
                    }
                    Watchers.Clear();
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }

            Watchers = new List <FileSystemWatcher>();
        }
コード例 #12
0
 private void DoRemoveWatcher(Watchers watchers)
 {
     m_Watched.Remove(watchers.watchedObject);
     m_Scheduler.Unschedule(watchers.scheduledItem);
     watchers.scheduledItem = null;
     watchers.tracker.ReleaseTracker();
 }
コード例 #13
0
 public Focus()
 {
     this.currentFocus   = 30;
     this.focusPerUpdate = 10;
     this.endTurnFocus   = false;
     this.watcher        = null;
     updateCurrentThreshold();
 }
コード例 #14
0
 public Focus(FocalPoints focalPoints, Watchers watcher)
 {
     this.currentFocus   = 30;
     this.focusPerUpdate = 10;
     endTurnFocus        = false;
     updateCurrentThreshold();
     this.focalPoints = focalPoints;
     subscribe(watcher.turnPhaseWatcher);
 }
コード例 #15
0
ファイル: Watcher.cs プロジェクト: yonglehou/Symbiote
 public void Dispose()
 {
     SystemObservers.Clear();
     Watchers.ForEach(x =>
     {
         x.EnableRaisingEvents = false;
         x.Dispose();
     });
     Watchers.Clear();
 }
コード例 #16
0
        public void Stop()
        {
            Listener.Stop();
            IObserver <HttpContext> watcher = null;

            while (Watchers.TryTake(out watcher))
            {
                watcher.OnCompleted();
            }
        }
コード例 #17
0
ファイル: ClusterTopology.cs プロジェクト: otgoo0603/ravendb
 public string GetUrlFromTag(string tag)
 {
     if (Members.TryGetValue(tag, out string url) ||
         Promotables.TryGetValue(tag, out url) ||
         Watchers.TryGetValue(tag, out url))
     {
         return(url);
     }
     return(null);
 }
コード例 #18
0
ファイル: LspManager.cs プロジェクト: Nucs/Autocad-Utilities
 /// <summary>
 ///     Clears all listeners.. also, dispose but reusable.
 /// </summary>
 public void Wipe()
 {
     lock (LockRoot) {
         foreach (var w in Watchers)
         {
             w.Value.Dispose();
         }
         Watchers.Clear();
         Files.Clear();
     }
 }
コード例 #19
0
        public void UpdateShortcuts(Watcher watcher, Keys keys, bool global)
        {
            var foundWatcher = Watchers.Find(watcher.Id);

            if (foundWatcher == null)
            {
                return;
            }
            foundWatcher.ShortcutKeys   = keys;
            foundWatcher.GlobalShortcut = global;
            SaveChanges();
        }
コード例 #20
0
ファイル: WMIEventWatcher.cs プロジェクト: rafntor/bdhero
        /// <summary>
        /// Constructs a new WMIWatcher that watches for WMI events related to the WMI class specified by the type parameter.
        /// </summary>
        public WMIEventWatcher()
        {
            var wmiClassName = WMIUtils.GetWMIClassName <T>();
            var query        = string.Format("SELECT * FROM {0}", wmiClassName);

            var watcher = new ManagementEventWatcher();

            watcher.EventArrived += HandleEvent;
            watcher.Query         = new WqlEventQuery(query);

            Watchers.Add(watcher);
        }
コード例 #21
0
        public async Task <ConnectedWatcher> EnsureWatcher()
        {
            while (true)
            {
                if (Watchers.Count >= 1)
                {
                    return(Watchers.First());
                }

                await Task.Delay(200, _shutdown);
            }
        }
コード例 #22
0
        public void UpdateWatcherForm(int id, string name, string whitelist, bool generateVideoThumbnails, bool scanSubdirectories)
        {
            var foundWatcher = Watchers.Find(id);

            if (foundWatcher == null)
            {
                return;
            }
            foundWatcher.Name      = name;
            foundWatcher.Whitelist = Watcher.ExtensionStringToHash(whitelist);
            foundWatcher.GenerateVideoThumbnails = generateVideoThumbnails;
            foundWatcher.ScanSubdirectories      = scanSubdirectories;
            SaveChanges();
        }
コード例 #23
0
        private void ConfigureWatchers(Dictionary <string, string> Pathes)
        {
            foreach (var path in Pathes)
            {
                var dirPath = Path.GetDirectoryName(path.Value);
                var watcher = Watchers.FirstOrDefault(x => x.Path == dirPath);
                if (watcher == null)
                {
                    AddWatcher(path.Value);
                }

                InsertFileName(Path.GetFileName(path.Value));
            }
        }
コード例 #24
0
 protected void AuthenticationFinished(bool success, HttpContext context)
 {
     Watchers.AsParallel().ForAll(x =>
     {
         if (success)
         {
             x.OnNext(context);
         }
         else
         {
             x.OnError(new HttpServerException("Exception occurred authenticating client"));
         }
     });
 }
コード例 #25
0
        public void testMoveManagerGetListOfHighestPrio()
        {
            Watchers testWatchers = new Watchers();

            CreatureStats  cs1 = new CreatureStats(1, 1, 1, 10);
            CreatureForm   bf1 = new CreatureForm(new HashSet <CreatureType>(new CreatureType[] { CreatureType.VITAL }), null, null);
            FocusPoint     f1  = new FocusPoint(null, null, null, null);
            FocalPoints    fp1 = new FocalPoints(f1, f1, f1, f1);
            Creature       c1  = new Creature(0, "", null, fp1, null, cs1, bf1, null);
            BattleCreature bc1 = new BattleCreature(c1, Owner.ALLY, testWatchers);

            CreatureStats  cs2 = new CreatureStats(1, 1, 1, 20);
            CreatureForm   bf2 = new CreatureForm(new HashSet <CreatureType>(new CreatureType[] { CreatureType.VITAL }), null, null);
            FocusPoint     f2  = new FocusPoint(null, null, null, null);
            FocalPoints    fp2 = new FocalPoints(f2, f2, f2, f2);
            Creature       c2  = new Creature(0, "", null, fp2, null, cs2, bf2, null);
            BattleCreature bc2 = new BattleCreature(c2, Owner.ALLY, testWatchers);

            Move move1 = new Move(0, "TestMove1", "", Move.MoveClass.ATTACK, TargetClass.ENEMY_SINGLE, null, CreatureType.VITAL, 0, 0, 0);
            Move move2 = new Move(1, "TestMove2", "", Move.MoveClass.ATTACK, TargetClass.ENEMY_SINGLE, null, CreatureType.VITAL, 1, 0, 0);
            Move move3 = new Move(2, "TestMove3", "", Move.MoveClass.ATTACK, TargetClass.ENEMY_SINGLE, null, CreatureType.VITAL, -3, 0, 0);

            MoveContext context1 = new MoveContext(move1, bc1, null, null, null);
            MoveContext context2 = new MoveContext(move2, bc2, null, null, null);
            MoveContext context3 = new MoveContext(move3, bc1, null, null, null);
            MoveContext context4 = new MoveContext(move1, bc2, null, null, null);

            //bc2 moves faster than bc1
            //Order of prio: move3, move1, move2
            //Resulting move order should then be: context3, context4, context1, context2
            HashSet <MoveContext> contexts    = new HashSet <MoveContext>(new MoveContext[] { context1, context2, context3, context4 });
            MoveManager           moveManager = new MoveManager(null, null, contexts);

            MoveContext actual1 = moveManager.getNextMove();
            MoveContext actual2 = moveManager.getNextMove();

            Assert.That(moveManager.getMovesRemaining() == 2);
            Assert.That(moveManager.isTurnOver() == false);

            MoveContext actual3 = moveManager.getNextMove();
            MoveContext actual4 = moveManager.getNextMove();

            Assert.That(moveManager.getMovesRemaining() == 0);
            Assert.That(moveManager.isTurnOver());

            Assert.That(actual1.Equals(context3));
            Assert.That(actual2.Equals(context4));
            Assert.That(actual3.Equals(context1));
            Assert.That(actual4.Equals(context2));
        }
コード例 #26
0
        /// <summary>
        /// 新建文件监视
        /// </summary>
        /// <param name="seconds">超时检测秒数</param>
        /// <param name="onTimeout">超时处理</param>
        /// <param name="onTimeoutType">超时处理类型</param>
        /// <param name="log">日志处理</param>
        internal CreateFlieTimeoutWatcher(int seconds, object onTimeout, CreateFlieTimeoutType onTimeoutType, ILog log = null)
        {
            timeoutSeconds = Math.Max(seconds, 2);
            this.onTimeout = onTimeout;
            this.log       = log ?? AutoCSer.Log.Pub.Log;
            switch (this.onTimeoutType = onTimeoutType)
            {
            case CreateFlieTimeoutType.HttpServerRegister: onCreatedHandle = onCreatedHttpServerRegister; break;

            default: onCreatedHandle = onCreated; break;
            }
            watchers = DictionaryCreator.CreateHashString <CreateFlieTimeoutCounter>();
            Watchers.PushNotNull(this);
        }
コード例 #27
0
        public IDisposable TrackActions(AsyncQueue <DynamicJsonValue> notificationsQueue, IWebsocketWriter webSocketWriter)
        {
            var watcher = new ConnectedWatcher
            {
                NotificationsQueue = notificationsQueue,
                Writer             = webSocketWriter
            };

            lock (_watchersLock)
            {
                Watchers.TryAdd(watcher);

                if (Watchers.Count == 1)
                {
                    StartBackgroundWorkers();
                }

                if (watcher.Writer is NotificationCenterWebSocketWriter)
                {
                    if (_websocketClients == 0)
                    {
                        TaskExecutor.CompleteAndReplace(ref _newWebSocket);
                    }
                    _websocketClients++;
                }
            }

            return(new DisposableAction(() =>
            {
                lock (_watchersLock)
                {
                    Watchers.TryRemove(watcher);

                    if (Watchers.Count == 0)
                    {
                        StopBackgroundWorkers();
                    }

                    if (watcher.Writer is NotificationCenterWebSocketWriter)
                    {
                        _websocketClients--;
                        if (_websocketClients == 0)
                        {
                            TaskExecutor.CompleteAndReplace(ref _allWebSocketsRemoved);
                        }
                    }
                }
            }));
        }
コード例 #28
0
        private void NotifyDataChanged(Watchers w)
        {
            notificationTmpSpies.Clear();
            notificationTmpSpies.AddRange(w.spyList);

            foreach (Spy spy in notificationTmpSpies)
            {
                spy.onDataChanged(w.watchedObject);
            }

            if (w.watchedObject == null && w.scheduledItem != null)
            {
                DoRemoveWatcher(w);
            }
        }
コード例 #29
0
        public Watcher AddWatcherForm(string name, string dir, string whitelist, bool generateVideoThumbnails, bool scanSubdirectories)
        {
            var watcher = new Watcher
            {
                Name      = name,
                Directory = dir,
                Whitelist = Watcher.ExtensionStringToHash(whitelist),
                GenerateVideoThumbnails = generateVideoThumbnails,
                ScanSubdirectories      = scanSubdirectories
            };

            Watchers.Add(watcher);
            SaveChanges();
            return(watcher);
        }
コード例 #30
0
ファイル: AutomationUploader.cs プロジェクト: StrohiZock/STFU
        private void EndUpload()
        {
            IsActive = false;

            while (Watchers.Count > 0)
            {
                Watchers.First().Created -= ReactOnFileChanges;
                Watchers.First().Changed -= ReactOnFileChanges;
                Watchers.First().Renamed -= ReactOnFileChanges;

                Watchers.First().Dispose();
                Watchers.RemoveAt(0);
            }

            ProcessWatcher.AllProcessesCompleted -= AllProcessesCompleted;
        }
コード例 #31
0
        public void ConfigureFileWatcher(List <string> folders)
        {
            //enabling file watcher on selected folders.
            try
            {
                if (folders == null)
                {
                    return;
                }

                FolderList = folders;

                foreach (string folder in FolderList)
                {
                    System.IO.FileSystemWatcher fileSystemWatcher = new System.IO.FileSystemWatcher();

                    // Set folder path to watch
                    fileSystemWatcher.Path = folder;

                    // Gets or sets the type of changes to watch for.
                    // In this case we will watch change of filename, last modified time, size and directory name
                    fileSystemWatcher.NotifyFilter = System.IO.NotifyFilters.FileName |
                                                     System.IO.NotifyFilters.LastWrite |
                                                     System.IO.NotifyFilters.Size |
                                                     System.IO.NotifyFilters.DirectoryName;

                    // Event handlers that are watching for specific event
                    fileSystemWatcher.Created += new System.IO.FileSystemEventHandler(fileSystemWatcher_Created);
                    fileSystemWatcher.Changed += new System.IO.FileSystemEventHandler(fileSystemWatcher_Changed);
                    fileSystemWatcher.Deleted += new System.IO.FileSystemEventHandler(fileSystemWatcher_Deleted);
                    fileSystemWatcher.Renamed += new System.IO.RenamedEventHandler(fileSystemWatcher_Renamed);

                    // NOTE: If you want to monitor specified files in folder, you can use this filter
                    // fileSystemWatcher.Filter

                    // START watching
                    fileSystemWatcher.EnableRaisingEvents = true;
                    Watchers.Add(fileSystemWatcher);
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }
        }
コード例 #32
0
        public NativeExecution(ref WebBrowser browser)
        {
            this.webBrowser = browser;

            this.commands = new Dictionary<string, PhoneGapCommand>
                                {
                                    { "Notification.Alert", new NotificationAlertCommand() },
                                    { "Notification.Beep", new NotificationBeepCommand() },
                                    { "Notification.Vibrate", new NotificationVibrateCommand() },
                                    { "Camera.GetPicture", new CameraGetPictureCommand() },
                                    { "Send.Sms", new SmsSendCommand() },
                                    { "Orientation.GetCurrentOrientation", new OrientationGetCurrentOrientationCommand() },
                                    { "Orientation.ClearWatch", new OrientationClearWatchCommmand() },
                                    { "Orientation.WatchOrientation", new OrientationWatchOrientationCommmand() },
                                    { "Telephony.CallNumber", new TelephonyCallCommand() },
                                    { "Device.GetAll", new DeviceGetAllCommand() },
                                    { "Network.IsReachable", new NetworkIsReachableCommand() },
                                    { "Geolocation.GetCurrentPosition", new GeolocationGetCurrentPositionCommand() },
                                    { "Accelerometer.GetCurrentAcceleration", new AccelerometergetCurrentAccelerationCommand() },
                                    { "DebugConsole.debug", new DebugConsoleDebugCommand() }
                                };

            this.watchers = new Watchers();
        }
コード例 #33
0
 private static Watchers GetWatchersFromMsBuildFileSystemWatcher(IFileSystem fileSystem)
 {
     var watchers = new Watchers();
     fileSystem.CreateFileSystemWatcher(ProjectDirectory, "*")
             .Returns(ci =>
             {
                 var watcher = Substitute.For<IFileSystemWatcher>();
                 watcher.NotifyFilter = Arg.Do<NotifyFilters>(nf =>
                 {
                     switch (nf)
                     {
                         case NotifyFilters.FileName:
                             watchers.FileWatcher = watcher;
                             return;
                         case NotifyFilters.DirectoryName:
                             watchers.DirectoryWatcher = watcher;
                             return;
                         case NotifyFilters.Attributes:
                             watchers.AttributesWatcher = watcher;
                             return;
                         default:
                             return;
                     }
                 });
                 return watcher;
             });
     return watchers;
 }
コード例 #34
0
 public void WatcherExecute(ref Watchers native, params string[] args)
 {
     native.AddOrientationWatcher(args[1], args[0]);
 }
コード例 #35
0
 public void WatcherExecute(ref Watchers native, params string[] args)
 {
     native.ClearOrientationWatch(args[0]);
 }