public static HtmlParametersPage TryLoad(string htmlData, string name) { HtmlParametersPage htmlParametersPage = null; int i; while ((i = CultureInfo.InvariantCulture.CompareInfo.IndexOf(htmlData, ParamTag, CompareOptions.IgnoreCase)) >= 0) { // Find end of parameter definition int iEnd = htmlData.IndexOf("}", i); string ParamDef = (iEnd >= 0 ? htmlData.Substring(i + ParamTag.Length, iEnd - i - ParamTag.Length) : ""); HtmlParameter NewPar = HtmlParameter.TryParam(ParamDef); // We found parameter definition if (NewPar != null) { if (htmlParametersPage == null) { htmlParametersPage = new HtmlParametersPage(name); } Array.Resize(ref htmlParametersPage.m_htmlParameters, htmlParametersPage.m_htmlParameters.Length + 1); htmlParametersPage.m_htmlParameters[htmlParametersPage.m_htmlParameters.Length - 1] = NewPar; htmlData = String.Concat(htmlData.Substring(0, i), NewPar.ID, htmlData.Substring(iEnd + 1)); } } HtmlPage.SetHtmlData(htmlParametersPage, htmlData); return(htmlParametersPage); }
public static HtmlParameter TryParam(string ParamDef) { // Split it to parts [1]=ParamName, [2..]=Options, where options are // Optional ID // Result=string (default)/numeric // CallName=Heading (default u) // CallType=IDAndValue (default)/ValueOnly string[] Parts = ParamDef.Split(new string[] { ":" }, StringSplitOptions.None); if (Parts.Length < 1) { return(null); } HtmlParameter NewPar = new HtmlParameter(Parts); if (NewPar.p.Length == 0) { NewPar = null; } return(NewPar); }