예제 #1
0
        public static SyntaxTree MoveNamesToCorrectNamespaces(SyntaxTree tree, Dictionary <string, string> namesToNamespaces)
        {
            if (tree.FilePath.EndsWith("manual.cs"))
            {
                return(tree);
            }

            var nameFixer = new NameFixer(namesToNamespaces);
            var newTree   = nameFixer.FixNames(tree);

            return(CSharpSyntaxTree.ParseText(newTree.GetText(), null, tree.FilePath));
        }
예제 #2
0
        public static List <SyntaxTree> MoveNamesToCorrectNamespaces(List <SyntaxTree> trees, Dictionary <string, string> namesToNamespaces)
        {
            List <SyntaxTree> ret = new List <SyntaxTree>();

            var nameFixer = new NameFixer(namesToNamespaces);

            foreach (SyntaxTree tree in trees)
            {
                if (tree.FilePath.EndsWith("manual.cs"))
                {
                    ret.Add(tree);
                }
                else
                {
                    var newTree = nameFixer.FixNames(tree);
                    newTree = CSharpSyntaxTree.ParseText(newTree.GetText().ToString(), null, tree.FilePath);
                    ret.Add(newTree);
                }
            }

            return(ret);
        }