コード例 #1
0
 private void MergeDiskNodes(HierarchyNode curParent, string dir) {
     var merger = new DiskMerger(this, curParent, dir);
     while (merger.ContinueMerge()) {
     }
 }
コード例 #2
0
        private void OnIdle(object sender, ComponentManagerEventArgs e) {
            Interlocked.Exchange(ref _idleTriggered, 0);
            do {
                BoldDeferredItems();

                using (new DebugTimer("ProcessFileChanges while Idle", 100)) {
                    if (IsClosed) {
                        return;
                    }

                    DiskMerger merger;
                    FileSystemChange change = null;
                    lock (_fileSystemChanges) {
                        merger = _currentMerger;
                        if (merger == null) {
                            if (_fileSystemChanges.Count == 0) {
                                break;
                            }

                            change = _fileSystemChanges.Dequeue();
                        }
                    }

                    if (merger != null) {
                        // we have more file merges to process, do this
                        // before reflecting any other pending updates...
                        if (!merger.ContinueMerge()) {
                            _currentMerger = null;
                        }
                        continue;
                    }
#if DEBUG
                    try {
#endif
                        if (change._type == WatcherChangeTypes.All) {
                            _currentMerger = new DiskMerger(this, this, ProjectHome);
                            continue;
                        } else {
                            change.ProcessChange();
                        }
#if DEBUG
                    } catch (Exception ex) {
                        Debug.Fail("Unexpected exception while processing change: {0}", ex.ToString());
                        throw;
                    }
#endif
                }
            } while (e.ComponentManager.FContinueIdle() != 0);
        }
コード例 #3
0
 /// <summary>
 /// When the file system watcher buffer overflows we need to scan the entire 
 /// directory for changes.
 /// </summary>
 private void WatcherError(object sender, ErrorEventArgs e) {
     lock (_fileSystemChanges) {
         _fileSystemChanges.Clear(); // none of the other changes matter now, we'll rescan the world
         _currentMerger = null;  // abort any current merge now that we have a new one
         _fileSystemChanges.Enqueue(new FileSystemChange(this, WatcherChangeTypes.All, null));
         TriggerIdle();
     }
 }