/// <summary>
        /// Create Host for MA environment
        /// </summary>
        /// <returns></returns>
        private IHost CreateHost()
        {
            string modelCachePath = PlatformManager.DefaultModelCompilationCacheDirectory;
            string codecCachePath = Path.Combine(PlatformManager.BaseDirectory, "CodecCache");
            //Create and register a host
            var host = new SimpleHost();
            SimpleModelManager modelManager = new SimpleModelManager(modelCachePath);

            host.SetModelManager(modelManager);
            new RuntimeTechnology().Register(host);
            new CoreTechnology().Register(host);
            new OPNTechnology().Register(host);
            new CompilerTechnology().Register(host);
            // host.RegisterService(new CertificateStore());

            var ext = new ExtensionContainer(PlatformManager.ExtensionsDirectory);

            foreach (var tech in ext.technologies)
            {
                tech.Register(host);
            }

            var runtimeProps = host.GetService <RuntimeProperties>();

            runtimeProps.AssemblyCachePath = modelCachePath;
            var compilerProps = host.GetService <CompilerProperties>();

            compilerProps.CodecCacheFolder = codecCachePath;

            host.EndRegistration();
            return(host);
        }
示例#2
0
        /// <summary>
        /// Create Host for MA environment when MA has been installed
        /// </summary>
        /// <returns></returns>
        private IHost CreateHostForMAInstalled()
        {
            var compilationCachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft", "MessageAnalyzer", "CompilationCache");
            var codecCachePath       = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft", "MessageAnalyzer", "CodecCache");

            //Create and register a host
            SimpleHost         host         = new SimpleHost();
            SimpleModelManager modelManager = new SimpleModelManager(compilationCachePath);

            host.SetModelManager(modelManager);

            new CoreTechnology(StandardStages.Runtime).Register(host);
            new RuntimeTechnology().Register(host);
            new OPNTechnology().Register(host);
            new CompilerTechnology().Register(host);

            var ext = new ExtensionContainer(PlatformManager.ExtensionsDirectory);

            foreach (var tech in ext.technologies)
            {
                tech.Register(host);
            }

            var runtimeProps = host.GetService <RuntimeProperties>();

            runtimeProps.AssemblyCachePath = compilationCachePath;

            var compilerProps = host.GetService <CompilerProperties>();

            compilerProps.CodecCacheFolder = codecCachePath;

            host.EndRegistration();
            return(host);
        }