Exemplo n.º 1
0
        void Import(string file, HashSet <string> files)
        {
            var bestMatchedFile = _assemblyPaths.FindBestMatchFor(file);

            try
            {  
              var filesToImport = GetFilesFor(_assemblyPaths, bestMatchedFile);
              foreach (var fileToAdd in filesToImport)
              {
                  if (!files.Add(fileToAdd))
                  {
                      return;
                  }
              }

              var module = ModuleDefinition.ReadModule(bestMatchedFile);
              foreach (var assemblyReference in module.AssemblyReferences)
              {
                  var referenceFile = $"{assemblyReference.Name}.dll";
                  Import(referenceFile, files);
              }
            }  
            catch
            {
                Console.WriteLine($"Skipping references for {file} - {bestMatchedFile}");
            }
        }
Exemplo n.º 2
0
        IEnumerable <string> GetFilesFor(AssemblyPaths paths, string path)
        {
            var files = new List <string>();

            path = paths.FindBestMatchFor(path);
            if (File.Exists(path))
            {
                files.Add(path);

                var pdbFile = Path.ChangeExtension(path, ".pdb");
                if (File.Exists(pdbFile))
                {
                    files.Add(pdbFile);
                }
            }
            return(files);
        }