本文整理汇总了C#中Tag.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# Tag.Contains方法的具体用法?C# Tag.Contains怎么用?C# Tag.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tag
的用法示例。
在下文中一共展示了Tag.Contains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Save
public static void Save(Tag parent, Dictionary<byte, ItemSlot> slots)
{
if (parent.Contains("Inventory")) parent["Inventory"].Remove();
Tag inventory = parent.AddList("Inventory", TagType.Compound);
foreach (ItemSlot slot in slots.Values) {
if (slot.Item == null) continue;
Tag item = inventory.AddCompound();
item.Add("id", slot.Item.ID);
item.Add("Slot", slot.Slot);
item.Add("Count", slot.Item.Count);
item.Add("Damage", slot.Item.Damage);
}
}
示例2: TagWrapper
public TagWrapper(TagBlock tag, MapStream map, Tag meta)
{
tag_ = tag;
/* Enumerate through all the StringIDs in this tag, check to see if they exist in the Globals list,
* if not we should add them locally and update the StringID value to point to the list*/
foreach (StringID string_id in tag as IEnumerable<StringID>)
{
if (Halo2.Strings.Contains(string_id)) continue;
else
{
var string_value = map.Strings[string_id.Index];
var entry = new KeyValuePair<StringID, string>(string_id, string_value);
local_strings_.Add(entry);
var index = local_strings_.IndexOf(entry);
short string_id_index = (short)(index |= 0x8000);
sbyte string_length = (sbyte)Encoding.UTF8.GetByteCount(string_value);
var bytes = BitConverter.GetBytes((int)new StringID(string_id_index, string_length));
//((IField)string_id).SetFieldData(bytes);
throw new Exception();
}
}
foreach (TagIdent tag_id in tag as IEnumerable<TagIdent>)
{
tag_ids_.Add(tag_id);
}
/*Intent: to build a list of all tagblock addresses in tag
*/
foreach (var array in tag as IEnumerable<IFieldArray>)
{
var address = array.Address;
if (array.Fields.Count() > 0)
{
var item = new { Address = address, Size = array.Fields[0].Size, Count = array.Fields.Count() };
tag_blocks.Add(item);
if (meta.Contains(item.Address))
{
}
}
}
/* Intent: check every tag_block in the list for being external
* if it is external build a reference list and add information about the tag_block
* to that list.
* address => [count, size]?
* */
}