Esempio n. 1
0
 private bool registerMacro(String macro, String name, IScriptCompiler scriptCompiler, IMacroService macroService, XmlScriptExecutor executor)
 {
     ScriptedMacro scriptedMacro = new ScriptedMacro(executor);
     scriptedMacro.Name = name;
     scriptedMacro.Script = scriptCompiler.Compile(macro, name);
     return macroService.registerMacro(new XnaScrapId(name), scriptedMacro);
 }
Esempio n. 2
0
        public String Put(String data)
        {
            IScriptCompiler scriptCompiler = m_game.Services.GetService(typeof(IScriptCompiler)) as IScriptCompiler;
            IMacroService macroService = m_game.Services.GetService(typeof(IMacroService)) as IMacroService;

            if (macroService != null && scriptCompiler != null)
            {
                String name = m_elementName;
                int index = data.IndexOf(" ");
                String source = data.Substring(index);

                ScriptedMacro scriptedMacro = new ScriptedMacro(XmlScriptExecutor.GetInstance(m_game));
                scriptedMacro.Name = name;
                scriptedMacro.Script = scriptCompiler.Compile(source, name);
                if (macroService.registerMacro(new XnaScrapId(name), scriptedMacro))
                {
                    return "1";
                }

            }
            return "0";
        }