public void Read(BinaryReader r) { _id = r.ReadUInt64(); EntryListOffset = r.ReadInt32(); EntryListSize = r.ReadInt32(); ObjectName = NameLookup.GetName(ObjectID); InstanceName = NameLookup.GetName(InstanceID); }
static SettlementInfoLookup() { _settlementList = new Dictionary <uint, SettlementInfo>(); _itemsToSettlementList = new Dictionary <uint, string>(); try { string appdir = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); XmlDocument doc = new XmlDocument(); doc.Load(File.OpenRead(Path.Combine(Path.Combine(appdir, "SettlementsInfo"), "Settlements.xml"))); XmlNodeList itemNodes = doc.GetElementsByTagName("settlementitems"); foreach (XmlNode n in itemNodes) { string id = n.Attributes["id"].Value; foreach (XmlNode c in n.ChildNodes) { string siid = c.Attributes["iid"].Value; uint iid = uint.Parse(siid, System.Globalization.NumberStyles.HexNumber, null); _itemsToSettlementList.Add(iid, id); } } itemNodes = doc.GetElementsByTagName("settlement"); foreach (XmlNode n in itemNodes) { SettlementInfo i = new SettlementInfo(n); uint index; if (n.Attributes["index"] == null) { if (n.Attributes["name"] == null) { throw new Exception("need name or index..."); } index = NameLookup.GetHash(n.Attributes["name"].Value); } else { index = uint.Parse(n.Attributes["index"].Value); } _settlementList.Add(index, i); } } catch { } }
public override string ToString() { string oname = ClassName != null ? "\"" + ClassName + "\"" : ObjectID.ToString("X8"); string name = NameLookup.GetName(ObjectID); if (ObjectID == 0xffffffff && InstanceID == 0xffffffff) { return("NULL"); } else { if (name != null) { return(string.Format("Class: {0} ObjectID: {1:X8}(\"{2}\") InstanceID: {3:X8}", oname, ObjectID, name, InstanceID)); } else { return(string.Format("Class: {0} ObjectID: {1:X8} InstanceID: {2:X8}", oname, ObjectID, InstanceID)); } } }
public KnownChunkAttribute(string name) { this.Name = name; this.Hash = NameLookup.GetHash(name); }