internal void RuntimeSetup(TreeBaseNode newRoot, GameObject owningObject) { root = newRoot; owner = owningObject; contextWalker = new ContextWalker(); contextWalker.SetContextPointer(newRoot.context); }
private static Dictionary <string, List <CsccContextInfo> > GetContexts(string directory) { var files = Directory.GetFiles(directory, "*.cs", SearchOption.AllDirectories); var contexts = new Dictionary <string, List <CsccContextInfo> >(); foreach (var file in files) { //Console.WriteLine(file); var code = File.ReadAllText(file, Encoding.UTF8); var syntaxTree = CSharpSyntaxTree.ParseText(code); var compilation = CSharpCompilation.Create("Test") .AddReferences(MetadataReference.CreateFromFile(typeof(object).Assembly.Location)) .AddSyntaxTrees(syntaxTree); var semanticModel = compilation.GetSemanticModel(syntaxTree); var walker = new ContextWalker <CsccContextInfo>(semanticModel, contexts); walker.Visit(syntaxTree.GetRoot()); contexts = walker.Contexts; } return(contexts); }