public PssgAttribute(PssgBinaryReader reader, PssgFile file, PssgNode node) { this.file = file; this.ParentNode = node; int id = reader.ReadInt32(); this.AttributeInfo = PssgSchema.GetAttribute(id); this.size = reader.ReadInt32(); this.data = reader.ReadAttributeValue(this.AttributeInfo.DataType, size); this.AttributeInfo = PssgSchema.AddAttribute(this.ParentNode.Name, this.Name, this.ValueType); }
public static void LoadFromPssg(PssgBinaryReader reader) { int attributeInfoCount = reader.ReadInt32(); int nodeInfoCount = reader.ReadInt32(); Node node; Attribute attribute; for (int i = 0; i < nodeInfoCount; i++) { int nId = reader.ReadInt32(); node = new Node(reader.ReadPSSGString()); node.Id = nId; if (entries.ContainsKey(node.Name)) { entries[node.Name].Id = node.Id; } else { PssgSchema.AddNode(node); } int subAttributeInfoCount = reader.ReadInt32(); for (int j = 0; j < subAttributeInfoCount; j++) { int id = reader.ReadInt32(); attribute = new Attribute(reader.ReadPSSGString()); attribute.Id = id; Attribute attr = PssgSchema.GetAttribute(node.Name, attribute.Name); if (attr == null) { PssgSchema.AddAttribute(node.Name, attribute); } else { attr.Id = attribute.Id; } } } }