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()); } }
public static void RunSection(EngineState s, SectionAddress addr, Dictionary <int, string> paramDict, 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; // Must copy ParamDict by value, not reference RunCommands(s, addr, codes, new Dictionary <int, string>(paramDict), depth, callback); // Increase only if cmd resides is CurrentPlugin if (s.CurrentPlugin.Equals(addr.Plugin)) { s.ProcessedSectionHashes.Add(addr.Section.GetHashCode()); } }