Exemplo n.º 1
0
        public static int Main(string[] args)
        {
            Console.Title = "Flame VM - Context: [TypeScript]";

            FlameXConfig conf = FlameXConfig.Parse(File.ReadAllText("config\\vm.fx"));

            Thread.Sleep(2000);

            EngineVM VM = new EngineVM(conf);

            VM.SetEngine(libxFile.LoadFromFile("lib\\tsc.lib"));
            VM.BindMain("main.ts");
            VM.Start();
            Console.Read();
            return(0);
        }
Exemplo n.º 2
0
        public EngineVM(FlameXConfig config)
        {
            jsEngine = new Engine(cfg =>
            {
                if (config.Is("harmony"))
                {
                    cfg.AllowClr();
                }
            });



            Edge.Func(@"
            var Flame;
            (function (Flame) {
                var Engine = (function () 
                {
                    function Engine() {}
                    Engine.Log = function (s) { exports.flameVM.VMLog(s); };
                    Engine.Error = function (s) { exports.flameVM.VMError(s); };
                    Engine.Warning = function (s) { exports.flameVM.VMWarning(s); };
                    Engine.Info = function (s) { exports.flameVM.VMInfo(s); };
                    return Engine;
                }());
                Flame.Engine = Engine;
            })(Flame || (Flame = {}));
            return function(data, callback) 
            {
                exports.flameVM = {};
                exports.flameVM.methods = [];
                exports.flameVM.Engine = Flame.Engine;
                Flame.Engine.Info('[HAL] Engine initialization is complete.')
                callback(null, null);
            }  
            ").Invoke(null).Wait();


            VMCore.Bind(this);
        }