ExpandSectionParams() публичный статический Метод

public static ExpandSectionParams ( PEBakery.Core.EngineState s, IEnumerable strs ) : List
s PEBakery.Core.EngineState
strs IEnumerable
Результат List
Пример #1
0
        public static void RunSection(EngineState s, SectionAddress addr, List <string> sectionParams, int depth, bool callback)
        {
            List <CodeCommand> codes = addr.Section.GetCodes(true);

            s.Logger.Build_Write(s, LogInfo.AddDepth(addr.Section.LogInfos, s.CurDepth + 1));

            // Set CurrentSection
            s.CurrentSection = addr.Section;

            // Set SectionReturnValue to empty string
            s.SectionReturnValue = string.Empty;

            Dictionary <int, string> paramDict = new Dictionary <int, string>();

            for (int i = 0; i < sectionParams.Count; i++)
            {
                paramDict[i + 1] = StringEscaper.ExpandSectionParams(s, sectionParams[i]);
            }

            RunCommands(s, addr, codes, paramDict, depth, callback);

            // Increase only if cmd resides in CurrentPlugin
            if (s.CurrentPlugin.Equals(addr.Plugin))
            {
                s.ProcessedSectionHashes.Add(addr.Section.GetHashCode());
            }
        }
Пример #2
0
        public static void Macro(EngineState s, CodeCommand cmd)
        {
            CodeInfo_Macro info = cmd.Info as CodeInfo_Macro;

            if (info == null)
            {
                throw new InvalidCodeCommandException("Command [Macro] should have [CodeInfo_Macro]", cmd);
            }

            CodeCommand macroCmd;

            if (s.Macro.MacroDict.ContainsKey(info.MacroType))
            {
                macroCmd         = s.Macro.MacroDict[info.MacroType];
                macroCmd.RawCode = cmd.RawCode;
            }
            else if (s.Macro.LocalDict.ContainsKey(info.MacroType))
            { // Try to find [infoMacroType] in [Variables] <- I hate undocumented behaviors!
                macroCmd         = s.Macro.LocalDict[info.MacroType];
                macroCmd.RawCode = cmd.RawCode;
            }
            else
            {
                throw new CodeCommandException($"Invalid Command [{info.MacroType}]", cmd);
            }

            Dictionary <int, string> paramDict = new Dictionary <int, string>();

            for (int i = 0; i < info.Args.Count; i++)
            {
                paramDict[i + 1] = StringEscaper.ExpandSectionParams(s, info.Args[i]);
            }

            s.CurSectionParams = paramDict;

            if (s.LogMacro)
            {
                s.InMacro = true;
                CommandBranch.RunExec(s, macroCmd, true);
                s.InMacro = false;
            }
            else // Do not log macro
            {
                s.Logger.Build_Write(s, new LogInfo(LogState.Info, $"Macro [{info.MacroType}] ({cmd.RawCode})", s.CurDepth + 1));
                s.Logger.TurnOff.Push(true);
                CommandBranch.RunExec(s, macroCmd, true);
                s.Logger.TurnOff.TryPop(out bool dummy);
            }
        }