private void WalkIncremental(string filePath, MutableSymbol parent) { // Copy the old database for this binary if it is older than the old index and we find it if (this.Previous != null) { DateTime binaryModifiedUtc = File.GetLastWriteTimeUtc(filePath); if (binaryModifiedUtc <= this.PreviousWriteUtc) { Symbol oldAssembly; if (TryFindAssembly(Path.GetFileName(filePath), out oldAssembly)) { parent.AddTree(oldAssembly); return; } else if (TryFindAssembly(Path.GetFileNameWithoutExtension(filePath), out oldAssembly)) { parent.AddTree(oldAssembly); return; } } } // Otherwise, recrawl InnerCrawler.Walk(filePath, parent); }
private void WalkEverythingAndSymbolCache(string rootPath, MutableSymbol parent) { List <string> binariesToIndex = new List <string>(); List <string> indicesToMerge = new List <string>(); using (new TraceWatch("Finding Binaries to Index...")) { foreach (string filePath in Directory.GetFiles(rootPath)) { // Skip VsHost.exe binary if (filePath.Contains(".vshost.")) { continue; } if (FileIO.IsManagedBinary(filePath)) { // If the binary has symbols next to it, index it string pdbPath = Path.ChangeExtension(filePath, ".pdb"); if (File.Exists(pdbPath)) { binariesToIndex.Add(filePath); } // If the binary has symbols and an IDX in the SymbolCache, merge it string pdbPathInSymbolCache = Assembly.GetSymbolCachePdbPath(filePath); if (!String.IsNullOrEmpty(pdbPathInSymbolCache) && File.Exists(pdbPathInSymbolCache)) { string indexInSymbolCache = Path.ChangeExtension(pdbPathInSymbolCache, ".dll.idx"); if (File.Exists(indexInSymbolCache)) { indicesToMerge.Add(indexInSymbolCache); } } } } } // Index each binary ProgressWriter p = new ProgressWriter(binariesToIndex.Count); using (new TraceWatch("Indexing {0:n0} binaries...", binariesToIndex.Count)) { foreach (string binaryPath in binariesToIndex) { WalkIncremental(binaryPath, parent); p.IncrementProgress(); } } p = new ProgressWriter(indicesToMerge.Count); using (new TraceWatch("Merging {0:n0} dependency indices...", indicesToMerge.Count)) { foreach (string indexPath in indicesToMerge) { PackageDatabase dependency = new PackageDatabase(); dependency.FileRead(indexPath); parent.AddTree(dependency.QueryRoot.FirstChild()); p.IncrementProgress(); } } }