/// <summary> /// Initializes a new instance of the <see cref="NiObjectNET" /> class. /// </summary> /// <param name="file">The file.</param> /// <param name="reader">The reader.</param> /// <exception cref="Exception">Unsupported Version!</exception> public NiObjectNET(NiFile file, BinaryReader reader) : base(file, reader) { this.Name = new NiString(file, reader); if (this.File.Header.Version <= eNifVersion.VER_2_3) { throw new Exception("Unsupported Version!"); } if (this.File.Header.Version >= eNifVersion.VER_3_0 && this.File.Header.Version <= eNifVersion.VER_4_2_2_0) { this.ExtraData = new NiRef<NiExtraData>[1]; this.ExtraData[0] = new NiRef<NiExtraData>(reader.ReadUInt32()); } if (this.File.Header.Version >= eNifVersion.VER_10_0_1_0) { uint num = reader.ReadUInt32(); this.ExtraData = new NiRef<NiExtraData>[num]; int num2 = 0; while ((long)num2 < (long)((ulong)num)) { this.ExtraData[num2] = new NiRef<NiExtraData>(reader.ReadUInt32()); num2++; } } if (this.File.Header.Version >= eNifVersion.VER_3_0) { this.Controller = new NiRef<NiTimeController>(reader.ReadUInt32()); } }
/// <summary> /// Initializes a new instance of the <see cref="NiObjectNET" /> class. /// </summary> /// <param name="file">The file.</param> /// <param name="reader">The reader.</param> /// <exception cref="Exception">Unsupported Version!</exception> public NiObjectNET(NiFile file, BinaryReader reader) : base(file, reader) { this.Name = new NiString(file, reader); if (this.File.Header.Version <= eNifVersion.VER_2_3) { throw new Exception("Unsupported Version!"); } if (this.File.Header.Version >= eNifVersion.VER_3_0 && this.File.Header.Version <= eNifVersion.VER_4_2_2_0) { this.ExtraData = new NiRef <NiExtraData> [1]; this.ExtraData[0] = new NiRef <NiExtraData>(reader.ReadUInt32()); } if (this.File.Header.Version >= eNifVersion.VER_10_0_1_0) { uint num = reader.ReadUInt32(); this.ExtraData = new NiRef <NiExtraData> [num]; int num2 = 0; while ((long)num2 < (long)((ulong)num)) { this.ExtraData[num2] = new NiRef <NiExtraData>(reader.ReadUInt32()); num2++; } } if (this.File.Header.Version >= eNifVersion.VER_3_0) { this.Controller = new NiRef <NiTimeController>(reader.ReadUInt32()); } }
/// <summary> /// Initializes a new instance of the <see cref="Morph"/> class. /// </summary> /// <param name="file">The file.</param> /// <param name="reader">The reader.</param> /// <param name="numVertices">The number vertices.</param> public Morph(NiFile file, BinaryReader reader, uint numVertices) { if (file.Version >= eNifVersion.VER_10_1_0_106) { this.FrameName = new NiString(file, reader); } if (file.Version <= eNifVersion.VER_10_1_0_0) { this.Keys = new KeyGroup <FloatKey>(reader); } if (file.Version >= eNifVersion.VER_10_1_0_106 && file.Version <= eNifVersion.VER_10_2_0_0) { this.UnkownInt = reader.ReadUInt32(); } if (file.Version >= eNifVersion.VER_20_0_0_4 && file.Version <= eNifVersion.VER_20_1_0_3) { this.UnkownInt = reader.ReadUInt32(); } this.Vectors = new Vector3[numVertices]; int num = 0; while ((long)num < (long)((ulong)numVertices)) { this.Vectors[num] = reader.ReadVector3(); num++; } }
/// <summary> /// Initializes a new instance of the <see cref="Morph"/> class. /// </summary> /// <param name="file">The file.</param> /// <param name="reader">The reader.</param> /// <param name="numVertices">The number vertices.</param> public Morph(NiFile file, BinaryReader reader, uint numVertices) { if (file.Version >= eNifVersion.VER_10_1_0_106) { this.FrameName = new NiString(file, reader); } if (file.Version <= eNifVersion.VER_10_1_0_0) { this.Keys = new KeyGroup<FloatKey>(reader); } if (file.Version >= eNifVersion.VER_10_1_0_106 && file.Version <= eNifVersion.VER_10_2_0_0) { this.UnkownInt = reader.ReadUInt32(); } if (file.Version >= eNifVersion.VER_20_0_0_4 && file.Version <= eNifVersion.VER_20_1_0_3) { this.UnkownInt = reader.ReadUInt32(); } this.Vectors = new Vector3[numVertices]; int num = 0; while ((long)num < (long)((ulong)numVertices)) { this.Vectors[num] = reader.ReadVector3(); num++; } }
/// <summary> /// Initializes a new instance of the <see cref="NiStringExtraData"/> class. /// </summary> /// <param name="file">The file.</param> /// <param name="reader">The reader.</param> public NiStringExtraData(NiFile file, BinaryReader reader) : base(file, reader) { if (base.Version <= eNifVersion.VER_4_2_2_0) { this.BytesRemaining = reader.ReadUInt32(); } this.StringData = new NiString(file, reader); }
/// <summary> /// Initializes a new instance of the <see cref="StringKey"/> class. /// </summary> /// <param name="reader">The reader.</param> /// <param name="type">The type.</param> /// <exception cref="Exception">Invalid eKeyType</exception> public StringKey(BinaryReader reader, eKeyType type) { this.Time = reader.ReadSingle(); if (type != eKeyType.LINEAR_KEY) { throw new Exception("Invalid eKeyType"); } this.Value = new NiString(null, reader); }
/// <summary> /// Initializes a new instance of the <see cref="NiExtraData" /> class. /// </summary> /// <param name="file">The file.</param> /// <param name="reader">The reader.</param> public NiExtraData(NiFile file, BinaryReader reader) : base(file, reader) { if (this.File.Header.Version >= eNifVersion.VER_10_0_1_0) { this.Name = new NiString(file, reader); } if (this.File.Header.Version <= eNifVersion.VER_4_2_2_0) { this.NextExtraData = new NiRef <NiExtraData>(reader.ReadUInt32()); } }
/// <summary> /// Initializes a new instance of the <see cref="NiExtraData" /> class. /// </summary> /// <param name="file">The file.</param> /// <param name="reader">The reader.</param> public NiExtraData(NiFile file, BinaryReader reader) : base(file, reader) { if (this.File.Header.Version >= eNifVersion.VER_10_0_1_0) { this.Name = new NiString(file, reader); } if (this.File.Header.Version <= eNifVersion.VER_4_2_2_0) { this.NextExtraData = new NiRef<NiExtraData>(reader.ReadUInt32()); } }
/// <summary> /// Initializes a new instance of the <see cref="NiSourceTexture" /> class. /// </summary> /// <param name="file">The file.</param> /// <param name="reader">The reader.</param> public NiSourceTexture(NiFile file, BinaryReader reader) : base(file, reader) { this.IsStatic = true; this.UseExternal = Version == eNifVersion.VER_4_0_0_2 ? reader.ReadBoolean() : reader.ReadBoolean(Version); // TES3 nif has version 4.0.0.2 and one byte bool here if (this.UseExternal) { this.FileName = new NiString(file, reader); if (base.Version >= eNifVersion.VER_10_1_0_0) { reader.ReadUInt32(); } } if (!this.UseExternal) { if (base.Version <= eNifVersion.VER_10_0_1_0) { reader.ReadByte(); } if (base.Version >= eNifVersion.VER_10_1_0_0) { this.FileName = new NiString(file, reader); } this.InternalTexture = new NiRef <ATextureRenderData>(reader); } this.PixelLayout = (ePixelLayout)reader.ReadUInt32(); this.UseMipmaps = (eMipMapFormat)reader.ReadUInt32(); this.AlphaFormat = (eAlphaFormat)reader.ReadUInt32(); this.IsStatic = Version == eNifVersion.VER_4_0_0_2 ? reader.ReadBoolean() : reader.ReadBoolean(Version); // TES3 nif has version 4.0.0.2 and one byte bool here if (base.Version >= eNifVersion.VER_10_1_0_106) { this.DirectRender = reader.ReadBoolean(Version); } if (base.Version >= eNifVersion.VER_20_2_0_7) { this.PersistentRenderData = reader.ReadBoolean(Version); } }
/// <summary> /// Initializes a new instance of the <see cref="NiSourceTexture" /> class. /// </summary> /// <param name="file">The file.</param> /// <param name="reader">The reader.</param> public NiSourceTexture(NiFile file, BinaryReader reader) : base(file, reader) { this.IsStatic = true; this.UseExternal = reader.ReadBoolean(Version); if (this.UseExternal) { this.FileName = new NiString(file, reader); if (base.Version >= eNifVersion.VER_10_1_0_0) { reader.ReadUInt32(); } } if (!this.UseExternal) { if (base.Version <= eNifVersion.VER_10_0_1_0) { reader.ReadByte(); } if (base.Version >= eNifVersion.VER_10_1_0_0) { this.FileName = new NiString(file, reader); } this.InternalTexture = new NiRef<ATextureRenderData>(reader); } this.PixelLayout = (ePixelLayout)reader.ReadUInt32(); this.UseMipmaps = (eMipMapFormat)reader.ReadUInt32(); this.AlphaFormat = (eAlphaFormat)reader.ReadUInt32(); this.IsStatic = reader.ReadBoolean(Version); if (base.Version >= eNifVersion.VER_10_1_0_106) { this.DirectRender = reader.ReadBoolean(Version); } if (base.Version >= eNifVersion.VER_20_2_0_7) { this.PersistentRenderData = reader.ReadBoolean(Version); } }