Example #1
0
        private static string TextReaderRenderer(ITexplate texplate, StreamReader reader)
        {
            reader.AssertNotNull("reader");

            lock (reader)
            {
                var tRes = string.Empty;
                reader.BaseStream.Position = 0;

                for (;;)
                {
                    var tLine = reader.ReadLine();

                    if (tLine == null)
                    {
                        break;
                    }

                    tLine = Regex.Replace(
                        tLine,
                        @"\$\{(\w+)\}",
                        xMatch => TexplateReplace(texplate, xMatch)
                        );
                    tRes += tLine + Environment.NewLine;
                }

                return(tRes);
            }
        }
Example #2
0
        private static string TexplateReplace(ITexplate texplate, Match match)
        {
            string tRet = string.Empty;

            if (match.Groups.Count == 2 && texplate != null)
            {
                var tResValue = texplate[match.Groups[1].Value];
                if (tResValue != null)
                {
                    tRet = tResValue.Render(texplate);
                }
            }

            return(tRet);
        }
Example #3
0
        private string RenderList(ITexplate texplate, ITexplateClause clause)
        {
            string tRet = string.Empty;

            if (clause != null)
            {
                foreach (var iClp in this.clipList)
                {
                    using (texplate.EnterContext(iClp))
                    {
                        tRet += clause.Render(texplate);
                    }
                }
            }

            return(tRet);
        }
Example #4
0
        private string RenderPgsList(ITexplate texplate, ITexplateClause clause)
        {
            string tRet = string.Empty;

            if (clause != null)
            {
                foreach (var iPgs in this.pgsList.Values)
                {
                    using (texplate.EnterContext(iPgs))
                    {
                        tRet += clause.Render(texplate);
                    }
                }
            }

            return(tRet);
        }
Example #5
0
 private string RenderClipRefEntries(ITexplate texplate)
 {
     return(RenderList(texplate, texplate.AssertNotNull("texplate")["ClipRefEntry"]));
 }
Example #6
0
 public string Render(ITexplate texplate)
 {
     return(renderer(texplate));
 }
Example #7
0
 private string RenderPgsProgInfoes(ITexplate texplate)
 {
     return(RenderPgsList(texplate, texplate.AssertNotNull("texplate")["PgsProgInfo"]));
 }
Example #8
0
 private string RenderPgsEntries(ITexplate texplate)
 {
     return(RenderPgsList(texplate, texplate.AssertNotNull("texplate")["PgsEntry"]));
 }