Esempio n. 1
0
        public static MacroDataContainer SplitBuilderOptions(string data)
        {
            int splIdx, splEndIdx;

            if ((splIdx = data.IndexOf(DeclareBuilderOption)) != -1 && (splEndIdx = data.LastIndexOf(DeclareBuilderOption)) != -1 && splIdx != splEndIdx)
            {
                var builderOptions = new MacroBuilderOptions();
                var d = splIdx + splEndIdx + DeclareBuilderOption.Length;
                var options = data.Substring(splIdx, splEndIdx).Split('\n');
                var code = data.Remove(splIdx, splEndIdx + DeclareBuilderOption.Length + ((data.Length > d && data[d] == '\n') ? 1 : 0));

                for (int i = 0; i < options.Length; i++)
                {
                    var f = options[i].IndexOf(BuilderOptionLine);

                    if (f != -1)
                        builderOptions.GetOptionList().Add(MacroBuilderOption.Create(options[i].Remove(0, f + BuilderOptionLine.Length)));
                }

                return Create(code, builderOptions);
            }

            return Create(data);
        }
Esempio n. 2
0
 public MacroDataContainer(string code, MacroBuilderOptions builderOptions)
 {
     Code = code;
     BuilderOptions = builderOptions;
 }
Esempio n. 3
0
 public static MacroDataContainer Create(string code, MacroBuilderOptions builderOptions) =>
     new MacroDataContainer(code, builderOptions);