Esempio n. 1
0
        public ScriptDomainManager(DynamicRuntimeHostingProvider hostingProvider, DlrConfiguration configuration) {
            ContractUtils.RequiresNotNull(hostingProvider, "hostingProvider");
            ContractUtils.RequiresNotNull(configuration, "configuration");

            configuration.Freeze();

            _hostingProvider = hostingProvider;
            _configuration = configuration;

            _sharedIO = new SharedIO();

            // create the initial default scope
            _globals = new Scope();
        }
Esempio n. 2
0
        public ScriptDomainManager(DynamicRuntimeHostingProvider hostingProvider, DlrConfiguration configuration)
        {
            ContractUtils.RequiresNotNull(hostingProvider, nameof(hostingProvider));
            ContractUtils.RequiresNotNull(configuration, nameof(configuration));

            configuration.Freeze();

            Host          = hostingProvider;
            Configuration = configuration;

            SharedIO = new SharedIO();

            // create the initial default scope
            Globals = new Scope();
        }
Esempio n. 3
0
        public ScriptDomainManager(DynamicRuntimeHostingProvider hostingProvider, DlrConfiguration configuration)
        {
            ContractUtils.RequiresNotNull(hostingProvider, "hostingProvider");
            ContractUtils.RequiresNotNull(configuration, "configuration");

            configuration.Freeze();

            _hostingProvider = hostingProvider;
            _configuration   = configuration;

            _sharedIO = new SharedIO();

            // create the initial default scope
            _globals = new Scope();
        }
        internal DlrConfiguration ToConfiguration() {
            ContractUtils.Requires(_languageSetups.Count > 0, "ScriptRuntimeSetup must have at least one LanguageSetup");

            // prepare
            ReadOnlyCollection<LanguageSetup> setups = new ReadOnlyCollection<LanguageSetup>(ArrayUtils.MakeArray(_languageSetups));
            var hostArguments = new ReadOnlyCollection<object>(ArrayUtils.MakeArray(_hostArguments));
            var options = new Scripting.Utils.ReadOnlyDictionary<string, object>(new Dictionary<string, object>(_options));            
            var config = new DlrConfiguration(_debugMode, _privateBinding, options);

            // validate
            foreach (var language in setups) {
                config.AddLanguage(
                    language.TypeName,
                    language.DisplayName,
                    language.Names,
                    language.FileExtensions,
                    language.Options
                );
            }

            // commit
            _languageSetups = setups;
            _options = options;
            _hostArguments = hostArguments;

            Freeze(setups);

            return config;
        }
Esempio n. 5
0
 public bool TryGetLanguageByFileExtension(string fileExtension, out LanguageContext language)
 {
     ContractUtils.RequiresNotEmpty(fileExtension, nameof(fileExtension));
     return(Configuration.TryLoadLanguage(this, DlrConfiguration.NormalizeExtension(fileExtension), true, out language));
 }