Пример #1
0
        public static GffFieldDictionary GetFieldStruct(RawGffData.RawGffStruct gstruct, 
			RawGffData rawData)
        {
            // Loop through all of the fields in the struct adding them to the
            // collection.
            GffFieldDictionary fields = new GffFieldDictionary();
            for (int i = 0; i < gstruct.FieldCount; i++)
            {
                // Get the index of the current field.  If the structure has 1
                // member then the offset is in DataOrDataOffset directly, if not
                // then DataOrDataOffset points to an array of DWORD indeces in
                // the raw field indeces block.
                uint fieldIndex = 1 == gstruct.FieldCount ?
                    gstruct.DataOrDataOffset :
                    rawData.GetFieldIndex((uint) (gstruct.DataOrDataOffset + (i * 4)));

                // Get the data label.
                RawGffData.RawGffField rawField = rawData.GetField(fieldIndex);
                string label = rawData.GetLabel(rawField.LabelIndex);

                // Create a GffField object for the field and add it to the
                // dictionary, using the label as the key.
                GffField field = GffFieldFactory.CreateField(rawField, rawData);
                fields.Add(label, field);
            }

            return fields;
        }