private void SetTag(clsDyntag tagX, string content) { string scontent; for (int i = 0; i < tagX.Indices.Count; ++i) { scontent = content; if (String.IsNullOrWhiteSpace(content)) { scontent = GetAutoTagContent(tagX); } switch ((int)tagX.formats[i]) { case (int)clsDyntag.DynTagFormats.DTF_HTMLEncoded: this.content[(int)tagX.Indices[i]] = System.Web.HttpUtility.HtmlEncode(scontent); break; case (int)clsDyntag.DynTagFormats.DTF_HtmlBRMultiline: /* added [dlatikay 20120209] */ this.content[(int)tagX.Indices[i]] = Html.MultilineString2HTML(scontent); break; default: this.content[(int)tagX.Indices[i]] = scontent; break; } } }
private clsDyntag AddTag(int index, string sTag, string sFmt) { clsDyntag tagX = null; /* 1. dynamic tags, every one is added */ try { /* the hashtable complains if the tag already exists */ tagX = new clsDyntag(content.Count, sTag, sFmt); tags.Add(sTag, tagX); } catch (ArgumentException) { /* tag already exists, add an item to the index collection */ tagX = tags[sTag] as clsDyntag; tagX.Indices.Add(index); tagX.formats.Add(tagX.iFmt(sFmt)); /* only allow tags of type 'literal' (m) and 'config' (c) to carry the same numbers as their names; * here it will be prohibited */ var sResidentialFmt = tagX.sFmts(0); if (sResidentialFmt != sFmt) { if ((tagX.type != clsDyntag.DynTagTypes.DTT_FixedLiteral)) /* [dlatikay 20120206] js escape not supported here */ { throw new Exception("dyntags of the same name ('" + sTag + "') differ by format indicator ':" + tagX.sFmts(0) + "/:" + sFmt + "' in '" + filename + "'."); } } } return(tagX); }
protected virtual string GetAutoTagContent(clsDyntag tagX) { if (tagX.type == clsDyntag.DynTagTypes.DTT_Dynamic) { return(String.Empty); /* it is just plain empty */ } else if (tagX.type == clsDyntag.DynTagTypes.DTT_FixedLiteral) { return(my(tagX.iName)); } else { return("<missing #" + tagX.iName.ToString() + ">"); } }