Ejemplo n.º 1
0
        public override XmlDocument transform(XmlDocument data, IParameters parameters)
        {
            base.transform(data, parameters);
            DataPool pool = new DataPool(data);

            switch (ScriptingManager.GetScriptName(pool))
            {
            case ScriptingManager.prepareImportName: return(getSchema(pool));

            case ScriptingManager.importName: break;

            case ScriptingManager.separationName: break;

            case ScriptingManager.classificationName: break;

            case ScriptingManager.indexingName: return(indexingSequence(pool));

            case ScriptingManager.exportName: break;

            case ScriptingManager.afterPDFGenerationName: return(pdfCompression(pool));

            case ScriptingManager.afterExportName: break;
            }
            return(data);
        }
Ejemplo n.º 2
0
 private void Awake()
 {
     scriptingManager = Locator.Get <ScriptingManager>();
     enableCustomSeed.onValueChanged.AddListener(ChangeEnableCustomSeed);
     startButton.onClick.AddListener(RequestStart);
     quitButton.onClick.AddListener(RequestQuit);
 }
        public override XmlDocument transform(XmlDocument data, IParameters parameters)
        {
            base.transform(data, parameters);
            DataPool pool = new DataPool(data);

            switch (ScriptingManager.GetScriptName(pool))
            {
            case ScriptingManager.prepareImportName: return(setGUID(pool));

            case ScriptingManager.importName: break;

            case ScriptingManager.separationName: break;

            case ScriptingManager.classificationName: break;

            case ScriptingManager.indexingName: break;

            case ScriptingManager.exportName: break;

            case ScriptingManager.afterPDFGenerationName: break;

            case ScriptingManager.afterExportName: return(countLicenses(pool));
            }
            return(data);
        }
        public VariablesMethodProvider(JObject variables, List <IGlobalMethodProvider> scopedMethodProviders)
        {
            _globalMethod = new GlobalMethod
            {
                Name   = _globalMethodName,
                Method = serviceProvider => (Func <string, object>)(name =>
                {
                    var variable = variables[name];

                    if (variable == null)
                    {
                        var S = serviceProvider.GetService <IStringLocalizer <VariablesMethodProvider> >();

                        throw new ValidationException(S["The variable '{0}' was used in the recipe but not defined. Make sure you add the '{0}' variable in the '{1}' section of the recipe.", name, _globalMethodName]);
                    }

                    var value = variable.Value <string>();

                    // Replace variable value while the result returns another script
                    while (value.StartsWith('[') && value.EndsWith(']'))
                    {
                        value           = value.Trim('[', ']');
                        value           = (ScriptingManager.Evaluate(value, null, null, scopedMethodProviders) ?? "").ToString();
                        variables[name] = new JValue(value);
                    }

                    return(value);
                })
            };
        }
Ejemplo n.º 5
0
 protected virtual void CreateManagers()
 {
     TimeManager.Create(ManagersContainer);
     AudioManager.CreateFromPrefab(_audioManagerPrefab, ManagersContainer);
     ObjectPoolManager.CreateFromPrefab(_objectPoolManagerPrefab, ManagersContainer);
     ViewerManager.CreateFromPrefab(_viewerManagerPrefab, ManagersContainer);
     InputManager.CreateFromPrefab(_inputManagerPrefab, ManagersContainer);
     SceneManager.CreateFromPrefab(_sceneManagerPrefab, ManagersContainer);
     TerrainManager.Create(ManagersContainer);
     ScriptingManager.Create(ManagersContainer);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Set up scripting support by creating and initializing the DiagramScriptSite and ScriptingManager
        /// </summary>
        private void InitializeScriptingManager()
        {
            this.scriptingMgr = new ScriptingManager(new DiagramScriptSite(this.diagram1), new DiagramScript());
            string exepath        = Application.ExecutablePath.ToLower();
            string testscriptpath = exepath.Substring(0, exepath.IndexOf("scripting\\cs"))
                                    + "scripting\\cs\\_TESTSCRIPT\\testscript.cs";

            this.scriptingMgr.Script.Language = ScriptLanguages.CSharp;
            this.scriptingMgr.LoadScript(testscriptpath);
            this.scriptingMgr.CompileError += new VsaErrorEventHandler(this.scriptingMgr_CompileError);
        }
Ejemplo n.º 7
0
        public void ScriptCanBeExecutedAndScopeProvidesContextIsolation()
        {
            var scriptManager1 = new ScriptingManager(_scriptingRuntime);
            var scriptManager2 = new ScriptingManager(_scriptingRuntime);

            scriptManager1.SetVariable("foo", 1);
            scriptManager2.SetVariable("foo", 2);

            var result1 = scriptManager1.ExecuteExpression("3 + foo");
            var result2 = scriptManager2.ExecuteExpression("3 + foo");

            Assert.That(result1, Is.EqualTo(4));
            Assert.That(result2, Is.EqualTo(5));
        }
Ejemplo n.º 8
0
        public VariablesMethodProvider(JObject variables)
        {
            _globalMethod = new GlobalMethod
            {
                Name   = "variables",
                Method = serviceprovider => (Func <string, object>)(name =>
                {
                    var value = variables[name].Value <string>();

                    // Replace variable value while the result returns another script
                    while (value.StartsWith("[") && value.EndsWith("]"))
                    {
                        value           = value.Trim('[', ']');
                        value           = (ScriptingManager.Evaluate(value, null, null, null) ?? "").ToString();
                        variables[name] = new JValue(value);
                    }

                    return(value);
                })
            };
        }
Ejemplo n.º 9
0
        protected override void Initialize()
        {
            Console.Initialise();
            CoroutineManager.Initialise();

            Graphics.PreferredBackBufferWidth  = GAME_WIDTH * 3;
            Graphics.PreferredBackBufferHeight = GAME_HEIGHT * 3;
            Graphics.ApplyChanges();
            UpdateScaleViewport();

            entityManager = new EntityManager(this);
            Audio         = new AudioManager(this);
            Input         = new InputManager(this);

            KeyInput = new TextInput(this);

            Player = new Entity(entityManager, "player");
            Player.AddComponents(new List <Component>()
            {
                new InputTransformComponent(),
                new PositionComponent(),
                new PlayerComponent(),
                new CollisionComponent(new Resolve.RectangleF(-6, -20, 12, 24))
            });

            Camera = new Camera(this);
            Camera.SetTarget(Player);
            MapManager = new MapManager(this, Player);

            ScriptingManager = new ScriptingManager(this);
            Transition       = new TransitionManager(this);

            renderTarget1 = new RenderTarget2D(this.GraphicsDevice, GAME_WIDTH, GAME_HEIGHT);
            renderTarget2 = new RenderTarget2D(this.GraphicsDevice, GAME_WIDTH, GAME_HEIGHT);

            //IEnumerator t = Test();
            //CoroutineManager.StartCoroutine(t);

            base.Initialize();
        }
Ejemplo n.º 10
0
        private async void OnScriptEditorTextChanged(object sender, EventArgs e)
        {
            _model.Script = ScriptEditor.Text;

            await ScriptingManager.ExecuteScript(ScriptEditor.Text, false);
        }
Ejemplo n.º 11
0
 public Command(ScriptingManager manager, Engine engine)
 {
     _manager = manager;
     engine.SetValue(Name, new Func <object[], object>(Action));
 }
Ejemplo n.º 12
0
 public WaitCommand(ScriptingManager manager, Engine engine) : base(manager, engine)
 {
 }