コード例 #1
0
        /// <summary>
        /// Recursively calls 'coyote rewrite' on all the directories that consists of rewrite.coyote.json file.
        /// </summary>
        /// <param name="path"></param>

        private static void RewriteMany(string path)
        {
            Debug.WriteLine($"In rewrite many: {path}");

            AssemblyAnalyzer.TryLoadAssemblyFrequencyReport(path);
            foreach (var directory in Directory.GetDirectories(path))
            {
                // Presence of log.rewrite.coyote.txt file indicates that this is 'rewritten' directory and we have to
                // delete it.
                if (directory.Contains("rewritten"))
                {
                    Directory.Delete(directory);
                    Debug.WriteLine($"Deleting directory: {directory}");

                    continue;
                }

                if (!File.Exists(directory + "\\rewrite.coyote.json"))
                {
                    RewriteMany(directory);
                    continue;
                }

                Rewrite(directory);
            }
        }
コード例 #2
0
        private static void Analyze(string path, bool isAssemblyFile)
        {
            string assemblyDir;
            var    assemblyPaths = new HashSet <string>();

            if (isAssemblyFile)
            {
                Console.WriteLine($". Analyzing the '{path}' assembly");
                assemblyPaths.Add(path);
                assemblyDir = Path.GetDirectoryName(path);
            }
            else
            {
                Console.WriteLine($". Analyzing assemblies in '{path}'");
                assemblyPaths.UnionWith(Directory.GetFiles(path, "*.dll"));
                assemblyPaths.UnionWith(Directory.GetFiles(path, "*.exe"));
                assemblyDir = path;
            }

            AssemblyAnalyzer.Run(assemblyDir, assemblyPaths);

            Console.WriteLine($". Done analyzing");
        }
コード例 #3
0
 /// <summary>
 /// Runs the analyzer.
 /// </summary>
 public static void Run(string assemblyDir, HashSet<string> assemblyPaths)
 {
     var analyzer = new AssemblyAnalyzer(assemblyDir, assemblyPaths);
     analyzer.Analyze();
 }