예제 #1
0
        public RShipCore(IModulePathResolver pathResolver, IModuleLoaderFactory loaderFactory)
        {
            engine = new V8ScriptEngine(V8ScriptEngineFlags.DisableGlobalMembers)
            {
                DefaultAccess = ScriptAccess.Full,
                SuppressExtensionMethodEnumeration = true,
                AllowReflection = true
            };

            Engine            = engine;
            this.pathResolver = pathResolver;
            NativeModules     = new Dictionary <string, Module>();
            Compilers         = new Dictionary <string, IModuleCompiler>();
            loader            = loaderFactory.Create(Engine, NativeModules, Compilers, pathResolver);

            Console = new VirtualConsole.Console(null, Engine);
            StdOut  = new StdOut.StdOut();

            var scriptCompiler = new ScriptCompiler();

            Compilers[".ship"] = scriptCompiler;
            Compilers[".js"]   = scriptCompiler;
            Compilers[".json"] = new JsonCompiler();
            Compilers[".dll"]  = new DllCompiler();
            coreModule         = new NativeModule("core", loader, this);

            NativeModules["core"]    = coreModule;
            NativeModules["console"] = new NativeModule("console", loader, Console);
            NativeModules["stdout"]  = new NativeModule("stdout", loader, StdOut);
            NativeModules["cast"]    = new NativeModule("cast", loader, new TypeCasts());
            NativeModules["timer"]   = new NativeModule("timer", loader, new TimerController(Console.ErrStream));
            NativeModules["host"]    = new NativeModule("host", loader, new HostFunctions());
            NativeModules["xhost"]   = new NativeModule("xhost", loader, new ExtendedHostFunctions());
            NativeModules["async"]   = new NativeModule("async", loader, new Async(engine));

            foreach (var script in ScriptModules.Scripts.Keys)
            {
                NativeModules.Add(script, new ScriptModule(script, loader));
            }

            engine.Script.core    = this;
            engine.Script.console = Console;
            engine.Script.EngineInternal.isVoid = new Func <object, bool>(obj => obj is VoidResult);
            ExecuteWrapped(@"
                Object.defineProperty(this, 'global', { value: this, enumerable: true });
                var engineInternal = this.EngineInternal;
                delete this.EngineInternal;
                Object.defineProperty(this, 'EngineInternal', { value: engineInternal });
            ");

            Sleeping    = true;
            disposePipe = new PipeableStream(engine);
        }
예제 #2
0
 public void CreateBlockBlobFromStream(string containerName, string blobName, ReadableStream stream, object options, AsyncResultCallback <CloudBlockBlob> callback)
 {
 }