Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public PackageDatabase Walk(string walkPath, PackageIdentity identity = null)
        {
            // Normalize WalkPath to ensure we can get a name for it
            walkPath = Path.GetFullPath(walkPath);

            if (identity == null)
            {
                identity = new PackageIdentity(Path.GetFileName(walkPath));
            }
            if (String.IsNullOrEmpty(identity.IndexFileName))
            {
                throw new ArgumentException(String.Format("ERROR: Unable to compute database name for path \"{0}\"", walkPath));
            }

            PackageDatabase db          = new PackageDatabase(identity);
            MutableSymbol   packageRoot = db.MutableRoot.AddChild(new MutableSymbol(identity.PackageName, SymbolType.Package));

            // Index the directory|file list|solution|project|binary
            string extension = Path.GetExtension(walkPath).ToLowerInvariant();

            if (Directory.Exists(walkPath))
            {
                if (this.IncludeSymbolCacheIndices)
                {
                    WalkEverythingAndSymbolCache(walkPath, packageRoot);
                }
                else
                {
                    WalkJustMyCode(walkPath, packageRoot);
                }
            }
            else if (extension.Equals(".txt"))
            {
                foreach (string itemPath in File.ReadAllLines(walkPath))
                {
                    WalkIncremental(itemPath, packageRoot);
                }
            }
            else
            {
                InnerCrawler.Walk(walkPath, packageRoot);
            }

            return(db);
        }