コード例 #1
0
ファイル: RegisterMacro.cs プロジェクト: DelBero/XnaScrap
 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);
 }
コード例 #2
0
ファイル: MacroNode.cs プロジェクト: DelBero/XnaScrap
        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";
        }