public void PreprocessDescription(iniOption opt) { if (opt.description == null) { return; } while (opt.description.Contains("%C_")) { var range = ""; var idx = opt.description.IndexOf("%C_") + 2; while (true) { if (opt.description[idx++] == ' ' || opt.description.Length == idx) { break; } range += opt.description[idx]; } if (!range.Contains("ALL")) { var modeSpl = range.Split('-'); var first = int.Parse(modeSpl[0]); var second = modeSpl.Length == 1 ? first : int.Parse(modeSpl[1]); var commentsToAdd = new List <string>(); for (var i = first - 1; i <= second - 1; i++) { commentsToAdd.Add(opt.comments[i]); } opt.description = opt.description.Replace("%C_" + range, string.Join("\n", commentsToAdd.ToArray())); } else { opt.description = opt.description.Replace("%C_ALL", string.Join("\n", opt.comments)); } } }
public void AddOption(iniOption opt) { options.Add(opt); renderables.Add(opt); }