예제 #1
0
        static void Main(string[] args)
        {
            if (!setConfigFileAtRuntime(args))
            {
                return;
            }

            if (args.Length < 2)
            {
                Console.WriteLine("Please specify a solultion (.sln) file:");
                Console.WriteLine("Usage: <tool> <config-file> <solution-file>");
                return;
            }
            var    dir            = Environment.CurrentDirectory;
            string pathToSolution = args[1];

            Console.WriteLine("path to solution: {0}", pathToSolution);

            IEnumerable <Project> projects = null;

            try
            {
                projects = VisualStudioSolutionHandler.GetProjects(pathToSolution);
            }
            catch (Exception e)
            {
                Console.WriteLine("INVALID path to solution: {0}", pathToSolution);
                return;
            }

            foreach (var project in projects)
            {
                var compilation = VisualStudioSolutionHandler.GetProjectCompilation(project);

                var syntaxTrees = compilation.SyntaxTrees;
                foreach (var syntaxTree in syntaxTrees)
                {
                    var      model = compilation.GetSemanticModel(syntaxTree, true);
                    Document doc   = project.GetDocument(syntaxTree);

                    var virtualizationContext = new VirtualizationContext();
                    virtualizationContext.semanticModel = model;
                    virtualizationContext.project       = project;
                    virtualizationContext.document      = doc;
                    virtualizationContext.compilation   = compilation;
                    virtualizationContext.workspace     = VisualStudioSolutionHandler.workspace;

                    var virtualizationHandler = new VirtualizationHandler(virtualizationContext);
                    virtualizationHandler.VirtualizeProject();
                }
            }

            Console.WriteLine();
            Console.WriteLine(">>OK: Virtualization Complete!");
            Console.ReadKey();
        }
 public VirtualizationHandler(VirtualizationContext _virtualizationContext)
 {
     this._virtualizationContext = _virtualizationContext;
 }
예제 #3
0
 public LocalDeclarationExtractorVisitor(VirtualizationContext _virtualizationContext)
 {
     this._virtualizationContext = _virtualizationContext;
 }
예제 #4
0
 public MethodParamsExtractorVisitor(VirtualizationContext _virtualizationContext)
 {
     this._virtualizationContext = _virtualizationContext;
 }