Ejemplo n.º 1
0
        public ISolution Parse(string slnFilePath)
        {
            string slnFileText = File.ReadAllText(slnFilePath);

            ISolution solution = ISolutionFactory.create();

            //solution.setLogMessageCallback(log);
            solution.setErrorMessageCallback(log);

            SolutionCallback callback = new SolutionCallback();

            callback.LoadExternalAssemblyModuleCallback = new LoadExternalAssemblyModuleDelegate(loadExternalAssemblyModule2);
            callback.LoadTextFileCallback      = new LoadTextFileDelegate(loadTextFile);
            callback.PropertyEvaluatorCallback = new PropertyEvaluatorDelegate(propertyEvaluator);
            callback.BetterAssemblyCallback    = new BetterAssemblyDelegate(betterAssembly);

            modules = new Dictionary <string, IExternalAssemblyModule>();

            solution.loadSlnFile(
                slnFilePath,
                slnFileText.ToCharArray(),
                callback,
                project_namespace.pn_project_namespace
                );

            //apply configuration
            ISlnFileConfiguration[] configs = solution.getSlnFileConfigurations();
            string configuration            = configs[0].getConfiguration();
            string platform = configs[0].getPlatform();

            solution.applyConfiguration(
                configuration,
                platform,
                callback,
                true,
                AssemblyTypeMapping.atm_default
                );

            //parse
            //solution.setParseAccessibleTypesAndMembersOnly(true);
            solution.parse();


            //modules = new Dictionary<string, IExternalAssemblyModule>();

            //string slnFileText = File.ReadAllText(slnFilePath);

            //ISolution solution = ISolutionFactory.create();
            ////solution.setLogMessageCallback(log);

            //solution.loadSlnFile(
            //    slnFilePath,
            //    slnFileText.ToCharArray(),
            //    loadTextFile,
            //    loadExternalAssemblyModule2,
            //    project_namespace.pn_project_namespace
            //    );

            ////apply configuration
            //ISlnFileConfiguration[] configs = solution.getSlnFileConfigurations();
            //string configuration = configs[0].getConfiguration();
            //string platform = configs[0].getPlatform();
            //solution.applyConfiguration(
            //    configuration,
            //    platform,
            //    loadTextFile,
            //    loadExternalAssemblyModule2,
            //    propertyEvaluator,
            //    betterAssembly,
            //    true,
            //    AssemblyTypeMapping.atm_default
            //    );

            ////parse
            ////solution.setParseAccessibleTypesAndMembersOnly(true);
            ////solution.parse();

            return(solution);
        }