private MetaInt16_Enum ReadShortFlags(XmlNode node, int enumNameHash) { var shortFlags = new MetaInt16_Enum(); var enumInfo = (MetaEnumXml)null; foreach (var x in xmlInfos.Enums) { if (x.NameHash == enumNameHash) { enumInfo = x; } } var keyStrings = node.InnerText.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries); foreach (var x in keyStrings) { var enumKey = GetHashForFlagName(x); foreach (var p in enumInfo.Entries) { if (p.NameHash == enumKey) { shortFlags.Value += (ushort)(1 << p.Value); } } } return(shortFlags); }
private static MetaInt16_Enum MakeShortFlagsB() { var shortFlags = new MetaInt16_Enum(); shortFlags.info = MakeShortFlagsInfo(); shortFlags.Value = 0; return(shortFlags); }
private void WriteShortFlagsContent(XmlWriter writer, MetaInt16_Enum shortValue) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < 16; i++) { if ((shortValue.Value & (1 << i)) != 0) { foreach (var xy in shortValue.info.Entries) { if (xy.EntryValue == i) { sb.Append(' '); sb.Append(GetFlagNameForHash(xy.EntryNameHash)); } } } } writer.WriteString(sb.ToString().Trim()); }
public void AssertInt16(MetaInt16_Enum expectedInt, MetaInt16_Enum actualInt) { Assert.AreEqual(expectedInt.Value, actualInt.Value); }