예제 #1
0
        internal ScriptEngine(MetadataFileReferenceProvider metadataReferenceProvider, AssemblyLoader assemblyLoader)
        {
            if (metadataReferenceProvider == null)
            {
                metadataReferenceProvider = _options.AssemblyResolver.Provider;
            }

            if (assemblyLoader == null)
            {
                assemblyLoader = new InteractiveAssemblyLoader();
            }

            _builder = new ScriptBuilder(assemblyLoader);

            _options = _options.WithReferenceProvider(metadataReferenceProvider);

            string initialBaseDirectory;

            try
            {
                initialBaseDirectory = Directory.GetCurrentDirectory();
            }
            catch
            {
                initialBaseDirectory = null;
            }

            _options = _options.WithBaseDirectory(initialBaseDirectory);
        }
예제 #2
0
        internal ScriptEngine(ScriptOptions options, MetadataFileReferenceProvider metadataReferenceProvider)
        {
            _options = options;

            if (metadataReferenceProvider == null)
            {
                metadataReferenceProvider = _options.AssemblyResolver.Provider;
            }

            _builder = new ScriptBuilder();

            _options = _options.WithReferenceProvider(metadataReferenceProvider);

            string initialBaseDirectory;

            try
            {
                initialBaseDirectory = Directory.GetCurrentDirectory();
            }
            catch
            {
                initialBaseDirectory = null;
            }

            _options = _options.WithBaseDirectory(initialBaseDirectory);
        }