public AttributeDefinitions(File file) { _attrDefs = new Dictionary<AttributeType, AttributeDefinitionRecord>(); byte[] buffer = new byte[AttributeDefinitionRecord.Size]; using (Stream s = file.OpenStream(AttributeType.Data, null, FileAccess.Read)) { while (Utilities.ReadFully(s, buffer, 0, buffer.Length) == buffer.Length) { AttributeDefinitionRecord record = new AttributeDefinitionRecord(); record.Read(buffer, 0); // NULL terminator record if (record.Type != AttributeType.None) { _attrDefs.Add(record.Type, record); } } } }
private void Add(AttributeType attributeType, string name, AttributeTypeFlags attributeTypeFlags, int minSize, int maxSize) { AttributeDefinitionRecord adr = new AttributeDefinitionRecord(); adr.Type = attributeType; adr.Name = name; adr.Flags = attributeTypeFlags; adr.MinSize = minSize; adr.MaxSize = maxSize; _attrDefs.Add(attributeType, adr); }