public ICollection<AbsPath> AddAllFromFileSystem(AbsPath indexRoot) { Stack<AbsPath> directories = new Stack<AbsPath>(); Stack<DirNode> nodes = new Stack<DirNode>(); directories.Push(indexRoot); nodes.Push(_rootDirectory); List<AbsPath> filesNotFound = new List<AbsPath>(); while (directories.Count != 0) { string currentDir = directories.Pop(); DirNode currentNode = nodes.Pop(); foreach (AbsPath dir in Directory.GetDirectories(currentDir, "*")) { directories.Push(dir); DirNode node = currentNode.EnsureDirNode(dir.FileName()); nodes.Push(node); } foreach (AbsPath path in Directory.GetFiles(currentDir, "*")) { try { FsFile<AbsPath> obj = FsFile<AbsPath>.LoadFrom(path); currentNode.AddFile(obj.NewAsName()); } catch (FileNotFoundException) { filesNotFound.Add(path); } } } return filesNotFound; }
// private class SyncObject : ISynchronizeInvoke // { // public bool TimerStopped; // } public IndexingJob(AbsPath absDirPath, RelPath relDirPath, List<IndexedObjects> folderList, TimerCallback callback, long dueTime, QueingThread queue) : base(new FsFolder<RelPath>(relDirPath), callback, dueTime, Timeout.Infinite) { _absDirPath = absDirPath; _queue = queue; _indexedObjects = new IndexedObjects(relDirPath); _tokenSource = new CancellationTokenSource(); _eventQueue = new BlockingCollection<FileEvent>(); DeletedContentList = folderList; _toRemove = new Queue<RelPath>(); _startDelayTimer = new Timer(); _startDelayTimer.Elapsed += FireDeepScan; _startDelayTimer.AutoReset = false; _startDelayTimer.Interval = FinishDelay; _endingTimer = new Timer(); _endingTimer.Elapsed += Finish2; _endingTimer.AutoReset = false; _endingTimer.Interval = FinishDelay; }
public bool Equals(AbsPath other) { return Equals(other._absolutePath, _absolutePath); }