本文整理汇总了C#中TagNode类的典型用法代码示例。如果您正苦于以下问题:C# TagNode类的具体用法?C# TagNode怎么用?C# TagNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TagNode类属于命名空间,在下文中一共展示了TagNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteNbtTag
private void WriteNbtTag (StreamWriter writer, TagNode tag)
{
if (tag == null)
return;
writer.Write(JSONSerializer.Serialize(tag));
}
示例2: GetTagNodeText
public static string GetTagNodeText(TagNode tag)
{
if (tag == null)
return null;
switch (tag.GetTagType())
{
case TagType.TAG_BYTE:
case TagType.TAG_SHORT:
case TagType.TAG_INT:
case TagType.TAG_LONG:
case TagType.TAG_FLOAT:
case TagType.TAG_DOUBLE:
case TagType.TAG_STRING:
return tag.ToString();
case TagType.TAG_BYTE_ARRAY:
return tag.ToTagByteArray().Length + " bytes";
case TagType.TAG_LIST:
return tag.ToTagList().Count + " entries";
case TagType.TAG_COMPOUND:
return tag.ToTagCompound().Count + " entries";
}
return null;
}
示例3: DeleteTag
public bool DeleteTag (TagNode tag)
{
bool result = _tag.Remove(tag);
if (result)
SetModified();
return result;
}
示例4: DeleteTag
public bool DeleteTag(TagNode tag)
{
foreach (String name in _tag.Keys)
if (_tag[name] == tag)
return _tag.Remove(name);
return false;
}
示例5: InsertTag
public bool InsertTag(TagNode tag, int index)
{
if (index < 0 || index > _tag.Count)
return false;
_tag.Insert(index, tag);
return true;
}
示例6: GetTagName
public string GetTagName(TagNode tag)
{
foreach (String name in _tag.Keys)
if (_tag[name] == tag)
return name;
return null;
}
示例7: AddTag
public bool AddTag(TagNode tag, string name)
{
if (_tag.ContainsKey(name))
return false;
_tag.Add(name, tag);
return true;
}
示例8: LoadTree
public override TypedEntity LoadTree(TagNode tree)
{
TagNodeCompound ctree = tree as TagNodeCompound;
if (ctree == null || base.LoadTree(tree) == null) {
return null;
}
return this;
}
示例9: AppendTag
public bool AppendTag (TagNode tag)
{
if (_tag.ValueType != tag.GetTagType())
return false;
_tag.Add(tag);
SetModified();
return true;
}
示例10: LoadTree
public override TileEntity LoadTree(TagNode tree)
{
TagNodeCompound ctree = tree as TagNodeCompound;
if (ctree == null || base.LoadTree(tree) == null) {
return null;
}
_command = ctree["Command"].ToTagString();
return this;
}
示例11: LoadTree
public override TypedEntity LoadTree (TagNode tree)
{
TagNodeCompound ctree = tree as TagNodeCompound;
if (ctree == null || base.LoadTree(tree) == null) {
return null;
}
_profession = ctree["Profession"].ToTagInt();
return this;
}
示例12: RenameTag
public bool RenameTag(TagNode tag, string name)
{
if (_tag.ContainsKey(name))
return false;
string oldName = GetTagName(tag);
_tag.Remove(oldName);
_tag.Add(name, tag);
return true;
}
示例13: LoadTree
public override EntityTyped LoadTree(TagNode tree)
{
TagNodeCompound ctree = tree as TagNodeCompound;
if (ctree == null || base.LoadTree(tree) == null) {
return null;
}
_saddle = ctree["Saddle"].ToTagByte() == 1;
return this;
}
示例14: LoadTree
public override EntityTyped LoadTree(TagNode tree)
{
TagNodeCompound ctree = tree as TagNodeCompound;
if (ctree == null || base.LoadTree(tree) == null) {
return null;
}
_size = ctree["Size"].ToTagInt();
return this;
}
示例15: LoadTree
public override TypedEntity LoadTree(TagNode tree)
{
TagNodeCompound ctree = tree as TagNodeCompound;
if (ctree == null || base.LoadTree(tree) == null) {
return null;
}
_anger = ctree["Anger"].ToTagShort();
return this;
}