本文整理汇总了C#中TextNode类的典型用法代码示例。如果您正苦于以下问题:C# TextNode类的具体用法?C# TextNode怎么用?C# TextNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextNode类属于命名空间,在下文中一共展示了TextNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AdjustUrlPath
private TextNode AdjustUrlPath(TextNode textValue)
{
if (Importer != null)
{
textValue.Value = Importer.AlterUrl(textValue.Value, ImportPaths);
}
return textValue;
}
开发者ID:helephant,项目名称:dotless,代码行数:8,代码来源:Url.cs
示例2: TextButton
public TextButton(ButtonFrames frames, SpriteFont font, int textSize, string text)
: base(frames)
{
_text = new TextNode(font, textSize)
{
Text = text
};
Icon = _text;
}
开发者ID:nikita-sky,项目名称:SkidiKit,代码行数:9,代码来源:TextButton.cs
示例3: Activate
// Given new text node
public void Activate(TextNode tn)
{
CurNode = tn;
Active = true;
WritingText = true;
Chat.text = "";
Name.text = CurNode.Name;
WritingIndex = 0;
}
开发者ID:FourFangedCow,项目名称:UnityVN,代码行数:10,代码来源:TextManager.cs
示例4: Main
static void Main()
{
ImaginaryHost h = new ImaginaryHost();
TextNode t = new TextNode(h);
Node tn = (Node)t;
MemoryStream s = new MemoryStream();
h.SerializeTo(s);
s.Position = 0;
System.Windows.Forms.Application.Run();
}
开发者ID:Kerdek,项目名称:scaling-tribble,代码行数:12,代码来源:Program.cs
示例5: Read
public Node Read(string xmlString)
{
Node node = null;
if (xmlString.Contains("?xml"))
{
node = new XmlDeclarationNode {Name = "Declaration", Value = xmlString};
}
else if (xmlString.Contains("<!--"))
{
node = new CommentNode {Name = "Comment", Value = xmlString.Substring(4, xmlString.Length - 7)};
}else if (xmlString.Contains("\\"))
{
node = new CommentNode {Name = "ScriptComment", Value = xmlString.Substring(2, xmlString.Length - 2)};
}
else if (xmlString.Contains("<Item>"))
{
node = new TextNode {Name = "Text", Value = xmlString.Substring(6, xmlString.Length - 13)};
}else if (xmlString.ToLower().Contains("<script>"))
{
node = new TextNode {Name = "script", Value = xmlString.Substring(8, xmlString.Length - 17)};
}
return node;
}
开发者ID:hjyao,项目名称:compound,代码行数:23,代码来源:XmlDocumentReader.cs
示例6: Url
public Url(TextNode value, IEnumerable<string> paths)
{
// The following block is commented out, because we want to have the path verbatim,
// not rewritten. Here's why: Say less/trilogy_base.less contains
//
// background-image: url(img/sprites.png)
//
// and serverfault/all.less contains
//
// @import "../less/trilogy_base"
//
// If relative paths where to be rewritten, the resulting serverfault/all.css would read
//
// background-image: url(../less/img/sprites.png)
//
// which is obviously not what we want.
/*if (!Regex.IsMatch(value.Value, @"^(http:\/)?\/") && paths.Any())
{
value.Value = paths.Concat(new[] {value.Value}).AggregatePaths();
}*/
Value = value;
}
开发者ID:NickCraver,项目名称:dotless,代码行数:24,代码来源:Url.cs
示例7: SvgTitleElement
public SvgTitleElement(string s)
{
TextNode tn = new TextNode(s);
AddChild(tn);
}
开发者ID:djpnewton,项目名称:ddraw,代码行数:5,代码来源:SvgTitleElement.cs
示例8: BlockNode
public BlockNode(TextNode owner)
{
this.owner = owner;
}
开发者ID:JackWangCUMT,项目名称:extensions,代码行数:4,代码来源:EmailTemplateParser.Nodes.cs
示例9: VisitText
public virtual void VisitText(TextNode textNode)
{
VisitChildren(textNode);
}
开发者ID:modulexcite,项目名称:ICSharpCode.Decompiler-retired,代码行数:4,代码来源:DepthFirstAstVisitor.cs
示例10: VisitText
public void VisitText(TextNode textNode)
{
// unused
}
开发者ID:x-strong,项目名称:ILSpy,代码行数:4,代码来源:CSharpOutputVisitor.cs
示例11: ConvertFromCSharp
public string ConvertFromCSharp(TextNode node)
{
var sb = new StringBuilder();
if (node.Text == "List")
{
sb.Append(ConvertFromCSharp(node.Children[0]));
sb.Append("[]");
}
else if (node.Text == "Dictionary")
{
sb.Append("{ [index:");
sb.Append(ConvertFromCSharp(node.Children[0]));
sb.Append("]: ");
sb.Append(ConvertFromCSharp(node.Children[1]));
sb.Append("; }");
}
else
{
sb.Append(TypeAlias(node.Text));
if (node.Children.Count > 0)
{
sb.Append("<");
for (var i = 0; i < node.Children.Count; i++)
{
var childNode = node.Children[i];
if (i > 0)
sb.Append(",");
sb.Append(ConvertFromCSharp(childNode));
}
sb.Append(">");
}
}
return sb.ToString();
}
开发者ID:ricardoshimoda,项目名称:ServiceStack,代码行数:38,代码来源:TypeScriptGenerator.cs
示例12: AcceptNodePackage
/// <summary>
/// Add a string for the system to draw. Strings are drawn in a FIFO basis, so calling this method
/// does not guarantee the string will immediately begin drawing.
/// </summary>
/// <param name="str">String to draw</param>
/// <param name="delay">Optional param, to specify delay before the message is written</param>
public void AcceptNodePackage(TextNode.NodePackage package, bool skipCurrent = false)
{
if (skipCurrent) { SkipCurrentSequence(); }
toDisplay.Enqueue(package);
PackageAddedToQueue();
}
开发者ID:akrischer,项目名称:red-pill-blue-pill,代码行数:12,代码来源:AbstractTerminal.cs
示例13: AdjustUrlPath
private TextNode AdjustUrlPath(TextNode textValue)
{
if (Importer != null && !Regex.IsMatch(textValue.Value, @"^(([a-zA-Z]+:)|(\/))"))
{
textValue.Value = Importer.AlterUrl(textValue.Value, ImportPaths);
}
return textValue;
}
开发者ID:heinrichbreedt,项目名称:dotless,代码行数:8,代码来源:Url.cs
示例14: AddChar
internal override GlobNode AddChar(char c)
{
var node = new TextNode(this);
nodes.Add(node);
return node.AddChar(c);
}
开发者ID:MicroHealthLLC,项目名称:mCleaner,代码行数:6,代码来源:Glob.cs
示例15: Add
public bool Add(TextNode textNode)
{
if(Contains(textNode.Text)) {
foreach (var child in Children) {
if (child.Add(textNode)) {
return true;
}
}
Children.Add(textNode);
return true;
}
return false;
}
开发者ID:aarondandy,项目名称:pigeoid,代码行数:13,代码来源:WriterUtils.cs
示例16: WriteWordLookUp
public static void WriteWordLookUp(EpsgData data, BinaryWriter textWriter, BinaryWriter indexWriter)
{
var roots = new List<TextNode>();
foreach(var text in data.WordLookUpList) {
var containerRoot = TextNode.FindContainingRoot(roots, text);
if(null == containerRoot) {
containerRoot = new TextNode(text);
var containedRoots = roots.Where(r => containerRoot.Contains(r.Text)).ToList();
foreach(var containedRoot in containedRoots) {
roots.Remove(containedRoot);
if(!containerRoot.Add(containedRoot)) {
throw new InvalidOperationException();
}
}
roots.Add(containerRoot);
}else {
if(!containerRoot.Add(text)) {
throw new InvalidOperationException();
}
}
}
for (int quality = Math.Min(6,roots.Select(x => x.Text.Length).Max()/2); quality >= 0; quality--) {
for (int i = 0; i < roots.Count; i++) {
for (int j = i + 1; j < roots.Count; j++) {
int overlapAt = StringUtils.OverlapIndex(roots[i].Text, roots[j].Text);
if (overlapAt >= 0 && (roots[i].Text.Length - overlapAt) >= quality) {
var newText = roots[i].Text.Substring(0, overlapAt) + roots[j].Text;
var newNode = new TextNode(newText, new[]{roots[i], roots[j]});
roots.RemoveAt(j);
roots[i] = newNode;
i--;
break;
}
overlapAt = StringUtils.OverlapIndex(roots[j].Text, roots[i].Text);
if (overlapAt >= 0 && (roots[j].Text.Length - overlapAt) >= quality) {
var newText = roots[j].Text.Substring(0, overlapAt) + roots[i].Text;
var newNode = new TextNode(newText, new[]{roots[j], roots[i]});
roots.RemoveAt(j);
roots[i] = newNode;
i--;
break;
}
}
}
}
var offsetLookUp = new Dictionary<string, int>();
int rootOffset = 0;
foreach(var root in roots) {
var rootText = root.Text;
var rootBytes = Encoding.UTF8.GetBytes(rootText);
textWriter.Write(rootBytes);
foreach(var text in root.GetAllString()) {
int startIndex = rootText.IndexOf(text, StringComparison.Ordinal);
var localOffset = Encoding.UTF8.GetByteCount(rootText.Substring(0, startIndex));
offsetLookUp.Add(text, rootOffset + localOffset);
}
rootOffset += rootBytes.Length;
}
foreach(var word in data.WordLookUpList) {
indexWriter.Write((ushort)offsetLookUp[word]);
indexWriter.Write((byte)(Encoding.UTF8.GetByteCount(word)));
}
}
开发者ID:aarondandy,项目名称:pigeoid,代码行数:66,代码来源:WriterUtils.cs
示例17: AddChar
internal override GlobNode/*!*/ AddChar(char c) {
TextNode node = new TextNode(this);
_nodes.Add(node);
return node.AddChar(c);
}
开发者ID:atczyc,项目名称:ironruby,代码行数:5,代码来源:Glob.cs
示例18: Write
public virtual void Write(TextNode t)
{
if (t is DocumentNode) { Write((DocumentNode)t); return; }
if (t is Token) { WriteToken((Token)t); return; }
}
开发者ID:simonegli8,项目名称:Silversite,代码行数:5,代码来源:Writer.cs
示例19: SvgTspanElement
public SvgTspanElement(string s, float x, float y)
{
TextNode tn = new TextNode(s);
AddChild(tn);
X=x;
Y=y;
}
开发者ID:djpnewton,项目名称:ddraw,代码行数:7,代码来源:SvgTextElement.cs
示例20: VisitText
public virtual void VisitText(TextNode textNode)
{
if (this.ThrowException)
{
throw (Exception)this.CreateException(textNode);
}
}
开发者ID:fabriciomurta,项目名称:BridgeUnified,代码行数:7,代码来源:Visitor.Exception.cs
注:本文中的TextNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论