public Service()
            {
                // TODO (tomat): we should share the copied files with the host
                _metadataFileProvider = new MetadataShadowCopyProvider(
                    Path.Combine(Path.GetTempPath(), "InteractiveHostShadow"),
                    noShadowCopyDirectories: s_systemNoShadowCopyDirectories);

                _assemblyLoader = new InteractiveAssemblyLoader(_metadataFileProvider);

                _formattingOptions = new ObjectFormattingOptions(
                    memberFormat: MemberDisplayFormat.Inline,
                    quoteStrings: true,
                    useHexadecimalNumbers: false,
                    maxOutputLength: 200,
                    memberIndentation: "  ");

                _hostObject = new InteractiveHostObject();

                var initialState = new EvaluationState(
                    scriptState: null,
                    scriptOptions: ScriptOptions.Default,
                    sourceSearchPaths: ImmutableArray <string> .Empty,
                    referenceSearchPaths: ImmutableArray <string> .Empty,
                    workingDirectory: Directory.GetCurrentDirectory());

                _lastTask = Task.FromResult(initialState);

                Console.OutputEncoding = Encoding.UTF8;

                // We want to be sure to delete the shadow-copied files when the process goes away. Frankly
                // there's nothing we can do if the process is forcefully quit or goes down in a completely
                // uncontrolled manner (like a stack overflow). When the process goes down in a controlled
                // manned, we should generally expect this event to be called.
                AppDomain.CurrentDomain.ProcessExit += HandleProcessExit;
            }
Beispiel #2
0
            public void Initialize(Type replType)
            {
                Contract.ThrowIfNull(replType);

                _repl            = (IRepl)Activator.CreateInstance(replType);
                _objectFormatter = _repl.CreateObjectFormatter();

                _hostObject = new InteractiveHostObject();

                _options = _options
                           .WithBaseDirectory(Environment.CurrentDirectory)
                           .AddReferences(_hostObject.GetType().Assembly);

                _hostObject.ReferencePaths.AddRange(_options.SearchPaths);
                _hostObject.SourcePaths.AddRange(_sourceSearchPaths);

                Console.OutputEncoding = Encoding.UTF8;
            }
            public void Initialize(Type replServiceProviderType)
            {
                Contract.ThrowIfNull(replServiceProviderType);

                _replServiceProvider = (ReplServiceProvider)Activator.CreateInstance(replServiceProviderType);

                _hostObject = new InteractiveHostObject();

                var options = ScriptOptions.Default
                              .WithSearchPaths(DefaultReferenceSearchPaths)
                              .WithBaseDirectory(Directory.GetCurrentDirectory())
                              .AddReferences(_hostObject.GetType().Assembly);

                _sourceSearchPaths = DefaultSourceSearchPaths;

                _hostObject.ReferencePaths.AddRange(options.SearchPaths);
                _hostObject.SourcePaths.AddRange(_sourceSearchPaths);
                _lastTask = Task.FromResult(new TaskResult(options, null));

                Console.OutputEncoding = Encoding.UTF8;
            }
            public Service()
            {
                // TODO (tomat): we should share the copied files with the host
                _metadataFileProvider = new MetadataShadowCopyProvider(
                    Path.Combine(Path.GetTempPath(), "InteractiveHostShadow"),
                    noShadowCopyDirectories: s_systemNoShadowCopyDirectories);

                _assemblyLoader = new InteractiveAssemblyLoader(_metadataFileProvider);

                _formattingOptions = new ObjectFormattingOptions(
                    memberFormat: MemberDisplayFormat.Inline,
                    quoteStrings: true,
                    useHexadecimalNumbers: false,
                    maxOutputLength: 200,
                    memberIndentation: "  ");

                _hostObject = new InteractiveHostObject();

                var initialState = new EvaluationState(
                    scriptState: null,
                    scriptOptions: ScriptOptions.Default,
                    sourceSearchPaths: ImmutableArray<string>.Empty,
                    referenceSearchPaths: ImmutableArray<string>.Empty,
                    workingDirectory: Directory.GetCurrentDirectory());

                _lastTask = Task.FromResult(initialState);

                Console.OutputEncoding = Encoding.UTF8;
              
                // We want to be sure to delete the shadow-copied files when the process goes away. Frankly
                // there's nothing we can do if the process is forcefully quit or goes down in a completely
                // uncontrolled manner (like a stack overflow). When the process goes down in a controlled
                // manned, we should generally expect this event to be called.
                AppDomain.CurrentDomain.ProcessExit += HandleProcessExit;
            }
            public void Initialize(Type replType)
            {
                Contract.ThrowIfNull(replType);

                _repl = (IRepl)Activator.CreateInstance(replType);
                _objectFormatter = _repl.CreateObjectFormatter();

                _hostObject = new InteractiveHostObject();

                _options = _options
                                   .WithBaseDirectory(Directory.GetCurrentDirectory())
                                   .AddReferences(_hostObject.GetType().Assembly);

                _hostObject.ReferencePaths.AddRange(_options.SearchPaths);
                _hostObject.SourcePaths.AddRange(_sourceSearchPaths);

                Console.OutputEncoding = Encoding.UTF8;
            }
            public void Initialize(Type replType)
            {
                Contract.ThrowIfNull(replType);

                _repl = (IRepl)Activator.CreateInstance(replType);
                _objectFormatter = _repl.CreateObjectFormatter();

                _hostObject = new InteractiveHostObject();

                var options = ScriptOptions.Default
                    .WithSearchPaths(DefaultReferenceSearchPaths)
                    .WithBaseDirectory(Directory.GetCurrentDirectory())
                    .AddReferences(_hostObject.GetType().Assembly);
                _sourceSearchPaths = DefaultSourceSearchPaths;

                _hostObject.ReferencePaths.AddRange(options.SearchPaths);
                _hostObject.SourcePaths.AddRange(_sourceSearchPaths);
                _lastTask = Task.FromResult(new TaskResult(options, null));

                Console.OutputEncoding = Encoding.UTF8;
            }