public FieldTypeDescriptor(string name, Field elem) : base(name, null) { this.field = elem; }
private Field parseField(FieldDescriptor fieldDesc, BinaryReader b) { Field field = new Field(fieldDesc, this.unhash, b.BaseStream.Position - (long)((ulong)this.catEntry.offset), this); FieldType type = fieldDesc.type; if (type <= FieldType.Int8) { if (type <= FieldType.Array) { if (type <= FieldType.Complex) { if (type != FieldType.Inheritance && type != FieldType.Complex) { return field; } } else { if (type == FieldType.Guid) { field.value = b.ReadUInt32(); return field; } if (type != FieldType.Array) { return field; } ArrayRepeater arrayRepeater = this.arrayRepeaters[b.ReadInt32()]; ComplexDescriptor cd = this.complexDescriptors[(int)fieldDesc.reference]; FieldDescriptor fieldDesc2 = this.fieldDescriptors[(int)cd.fieldStartIndex]; if (arrayRepeater.repetitions == 0u) { field.value = "*nullArray*"; return field; } b.BaseStream.Position = (long)((ulong)(this.arraySectionStart + arrayRepeater.offset)); Complex complex = new Complex(cd, this.unhash); int num = 0; while ((long)num < (long)((ulong)arrayRepeater.repetitions)) { complex.fields.Add(this.parseField(fieldDesc2, b)); num++; } field.value = complex; return field; } } else { if (type <= FieldType.String) { if (type == FieldType.Enum) { Enum @enum = new Enum(); @enum.selection = b.ReadUInt32(); ComplexDescriptor complexDescriptor = this.complexDescriptors[(int)fieldDesc.reference]; for (int i = 0; i < (int)complexDescriptor.numField; i++) { Field field2 = new Field(this.fieldDescriptors[(int)(complexDescriptor.fieldStartIndex + (uint)i)], this.unhash, b.BaseStream.Position, this); @enum.choices.Add(new Tuple<uint, string>(field2.descriptor.offset, field2.name)); } field.value = @enum; return field; } if (type != FieldType.String) { return field; } long position = b.BaseStream.Position; b.BaseStream.Position = (long)((ulong)(this.stringSectionStart + b.ReadUInt32())); field.value = DbxFile.readNullTerminatedString(b); b.BaseStream.Position = position + 4L; return field; } else { if (type == FieldType.Bool) { field.value = (b.ReadByte() != 0); return field; } if (type != FieldType.Int8) { return field; } field.value = b.ReadByte(); return field; } } } else { if (type <= FieldType.UInt32) { if (type <= FieldType.Int16) { if (type == FieldType.UInt16) { field.value = b.ReadUInt16(); return field; } if (type != FieldType.Int16) { return field; } field.value = b.ReadInt16(); return field; } else { if (type == FieldType.Int32) { field.value = b.ReadInt32(); return field; } if (type != FieldType.UInt32) { return field; } field.value = b.ReadUInt32(); return field; } } else { if (type <= FieldType.Double) { if (type == FieldType.Single) { field.value = b.ReadSingle(); return field; } if (type != FieldType.Double) { return field; } field.value = b.ReadDouble(); return field; } else { if (type == FieldType.RawGuid) { field.value = b.ReadBytes(16); return field; } if (type != FieldType.Complex2) { return field; } } } } field.value = this.parseComplex((int)fieldDesc.reference, b); return field; }