public void SetOptions(string sOptions) { if (sOptions == null) { return; } string[] sOptions2 = zsplit.Split(sOptions, ',', true); foreach (string s in sOptions2) { switch (s.ToLower()) { case "nochildcount": gbNoChildCount = true; break; case "hide": gbHide = true; break; case "hidechild": gbHideChild = true; break; case "expandnode": gbExpandNode = true; break; default: StringZone[] zones = StringZones.SplitZone(s, new char[, ] { { '(', ')' } }); if (zones.Length == 2 && zones[0].BeginZoneChar == (char)0 && zones[1].BeginZoneChar == '(') { if (string.Compare(zones[0].String, "hide", true) == 0) { giHideElementIndex = new List <int>(); foreach (string index in zsplit.Split(zones[1].ContentString, ',', true)) { int i; if (int.TryParse(index, out i)) { giHideElementIndex.Add(i - 1); } } } } break; } } }
public static XFormat CreateXFormat(XElement xe) { XFormat xf = new XFormat(); xf.gsName = xe.Name.LocalName; xf.gsFormat = xe.zAttribValue("format"); if (xf.gsFormat != null) { xf.gFormats = StringZones.SplitZone(xf.gsFormat, new char[, ] { { '{', '}' } }); string sFormat = ""; int i = 0; xf.gFormatValues = new List <XValueFormat>(); foreach (StringZone format in xf.gFormats) { if (format.BeginZoneChar == '{') { sFormat += "{" + i++.ToString() + "}"; XValueFormat valueFormat = null; //{Node(Phone) - {@PhoneType} {@Phone}} StringZone[] zones = StringZones.SplitZone(format.ContentString, new char[, ] { { '(', ')' }, { '{', '}' } }); if (zones.Length >= 2 && zones[0].BeginZoneChar == (char)0 && zones[1].BeginZoneChar == '(') { if (zones[0].String.ToLower() == "node") { valueFormat = new XValueFormat(); valueFormat.XPath = zones[1].ContentString; valueFormat.Values = new List <XValueFormat>(); string sFormat2 = ""; int i2 = 0; for (int j = 2; j < zones.Length; j++) { if (zones[j].BeginZoneChar == '{') { sFormat2 += "{" + i2++.ToString() + "}"; valueFormat.Values.Add(new XValueFormat() { XPath = zones[j].ContentString }); } else { sFormat2 += zones[j].String; } } valueFormat.Format = sFormat2; } } else { valueFormat = new XValueFormat() { XPath = format.ContentString } }; if (valueFormat != null) { xf.gFormatValues.Add(valueFormat); } } else { sFormat += format.String; } } xf.gsStringFormat = sFormat; } xf.SetOptions(xe.zAttribValue("option")); return(xf); }