本文整理汇总了C#中Tokenizer.Substring方法的典型用法代码示例。如果您正苦于以下问题:C# Tokenizer.Substring方法的具体用法?C# Tokenizer.Substring怎么用?C# Tokenizer.Substring使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tokenizer
的用法示例。
在下文中一共展示了Tokenizer.Substring方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompileLayout
internal static LayoutRenderer[] CompileLayout(Tokenizer sr, bool isNested, out string text)
{
List<LayoutRenderer> result = new List<LayoutRenderer>();
StringBuilder literalBuf = new StringBuilder();
int ch;
int p0 = sr.Position;
while ((ch = sr.Peek()) != -1)
{
if (isNested && (ch == '}' || ch == ':'))
{
break;
}
sr.Read();
if (ch == '$' && sr.Peek() == '{')
{
if (literalBuf.Length > 0)
{
result.Add(new LiteralLayoutRenderer(literalBuf.ToString()));
literalBuf.Length = 0;
}
LayoutRenderer newLayoutRenderer = ParseLayoutRenderer(sr);
if (newLayoutRenderer.IsAppDomainFixed())
newLayoutRenderer = ConvertToLiteral(newLayoutRenderer);
result.Add(newLayoutRenderer);
// layout renderer
}
else
{
literalBuf.Append((char)ch);
}
}
if (literalBuf.Length > 0)
{
result.Add(new LiteralLayoutRenderer(literalBuf.ToString()));
literalBuf.Length = 0;
}
int p1 = sr.Position;
MergeLiterals(result);
text = sr.Substring(p0, p1);
return result.ToArray();
}
示例2: CompileLayout
internal static LayoutRenderer[] CompileLayout(ConfigurationItemFactory configurationItemFactory, Tokenizer sr, bool isNested, out string text)
{
var result = new List<LayoutRenderer>();
var literalBuf = new StringBuilder();
int ch;
int p0 = sr.Position;
while ((ch = sr.Peek()) != -1)
{
if (isNested && (ch == '}' || ch == ':'))
{
break;
}
sr.Read();
if (ch == '$' && sr.Peek() == '{')
{
if (literalBuf.Length > 0)
{
result.Add(new LiteralLayoutRenderer(literalBuf.ToString()));
literalBuf.Length = 0;
}
LayoutRenderer newLayoutRenderer = ParseLayoutRenderer(configurationItemFactory, sr);
if (CanBeConvertedToLiteral(newLayoutRenderer))
{
newLayoutRenderer = ConvertToLiteral(newLayoutRenderer);
}
// layout renderer
result.Add(newLayoutRenderer);
}
else
{
literalBuf.Append((char)ch);
}
}
if (literalBuf.Length > 0)
{
result.Add(new LiteralLayoutRenderer(literalBuf.ToString()));
literalBuf.Length = 0;
}
int p1 = sr.Position;
MergeLiterals(result);
text = sr.Substring(p0, p1);
return result.ToArray();
}