protected string SecType(string text) { if (string.IsNullOrEmpty(text) || !text.Contains(':')) return string.Empty; string hdr = text.Substring(0, text.IndexOf(':')); hdr = Lib.ToLat(SLst.NormStr(hdr).ToLower()); if (st.Is(hdr, out SType)) return SType; return string.Empty; }
public bool Is(string str, out string SType) { SType = null; string x = SLst.NormStr(str); foreach (SLst lst in Tab) { if (!lst.Is(x)) continue; SType = lst.Type(x); return true; } return false; }
public Section Get(string Text, string whichSection = "") { string[] sections = Lib.ToLat(SLst.NormStr(Text).ToLower()).Split(';'); foreach (string str in sections) { SType = SecType(str); body = SecBody(str); if (string.IsNullOrEmpty(whichSection) || whichSection == SType) return this; } SType = body = string.Empty; return this; }
public List<Section> Parse(string Text) { var result = new List<Section>(); if (string.IsNullOrEmpty(Text)) return result; string[] sections = Lib.ToLat(SLst.NormStr(Text).ToLower()).Split(';'); foreach (string str in sections) { Section x = new Section(); x.SType = SecType(str); if (x.SType == Decl.STypeNOT_DEFINED) continue; x.body = SecBody(str); result.Add(x); } return result; }