コード例 #1
0
        private void ParseSection()
        {
            try
            {
                // Match sections using regex
                MatchCollection matches = Regex.Matches(rawData, @"^\[(.+)\]\r?$", RegexOptions.Compiled | RegexOptions.Multiline);

                // Make instances of sections
                for (int i = 0; i < matches.Count; i++)
                {
                    int secDataOffset = 0;
                    int secDataLen    = 0;

                    secDataOffset = matches[i].Index + matches[i].Length + 1;
                    if (i + 1 < matches.Count)
                    {
                        secDataLen = matches[i + 1].Index - secDataOffset;
                    }
                    else
                    {
                        secDataLen = rawData.Length - secDataOffset;
                    }

                    string   secName  = matches[i].Value.Substring(1, matches[i].Length - 3);
                    string[] secLines = rawData.Substring(secDataOffset, secDataLen).Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
                    sections[secName] = new PluginSection(secName, secLines);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(string.Concat(e.GetType(), ": ", Helper.RemoveLastNewLine(e.Message)));
            }
        }
コード例 #2
0
ファイル: BakeryEngine.cs プロジェクト: Variel/PEBakery
        /// <summary>
        /// Run an plugin
        /// </summary>
        public void RunPlugin()
        {
            LoadDefaultPluginVariables();
            PluginSection section = plugins[curPluginIdx].Sections["Process"];

            nextCommand = new CommandAddress(section, 0, section.SecLines.Length);
            RunCommands();
            return;
        }
コード例 #3
0
ファイル: BakeryEngine.cs プロジェクト: Variel/PEBakery
 public CommandAddress(PluginSection section, int line, int secLength)
 {
     this.section   = section;
     this.line      = line;
     this.secLength = secLength;
 }
コード例 #4
0
ファイル: Variables.cs プロジェクト: Variel/PEBakery
        /// <summary>
        /// Add local variables
        /// </summary>
        /// <param name="section"></param>
        public void GlobalAddVariables(PluginSection section)
        {
            StringDictionary dict = Helper.ParseVarStyle(section.SecLines);

            InternalAddDictionary(globalVars, dict);
        }