// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { if (loader.IsSwitch) { Name = loader.LoadString(); long DataOffset = loader.ReadOffset(); ushort count = loader.ReadUInt16(); Type = loader.ReadEnum <RenderInfoType>(true); loader.Seek(5); switch (Type) { case RenderInfoType.Int32: _value = loader.LoadCustom(() => loader.ReadInt32s(count), (uint)DataOffset); break; case RenderInfoType.Single: _value = loader.LoadCustom(() => loader.ReadSingles(count), (uint)DataOffset); break; case RenderInfoType.String: if (DataOffset == 0) //Some games have empty data offset and no strings { _value = new string[0]; } else { _value = loader.LoadCustom(() => loader.LoadStrings(count), (uint)DataOffset); } break; } } else { ushort count = loader.ReadUInt16(); Type = loader.ReadEnum <RenderInfoType>(true); loader.Seek(1); Name = loader.LoadString(); switch (Type) { case RenderInfoType.Int32: _value = loader.ReadInt32s(count); break; case RenderInfoType.Single: _value = loader.ReadSingles(count); break; case RenderInfoType.String: _value = loader.LoadStrings(count); break; } } }
// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader, UserDataType Type, int count) { switch (Type) { case UserDataType.Int32: _value = loader.ReadInt32s(count); break; case UserDataType.Single: _value = loader.ReadSingles(count); break; case UserDataType.String: _value = loader.LoadStrings(count, Encoding.ASCII); break; case UserDataType.WString: _value = loader.LoadStrings(count, Encoding.Unicode); break; case UserDataType.Byte: _value = loader.ReadBytes(count); break; } }
// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { Name = loader.LoadString(); ushort count = loader.ReadUInt16(); Type = loader.ReadEnum <UserDataType>(true); loader.Seek(1); switch (Type) { case UserDataType.Int32: _value = loader.ReadInt32s(count); break; case UserDataType.Single: _value = loader.ReadSingles(count); break; case UserDataType.String: _value = loader.LoadStrings(count, Encoding.ASCII); break; case UserDataType.WString: _value = loader.LoadStrings(count, Encoding.Unicode); break; case UserDataType.Byte: _value = loader.ReadBytes(count); break; } }
// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { ushort count = loader.ReadUInt16(); Type = loader.ReadEnum <RenderInfoType>(true); loader.Seek(1); Name = loader.LoadString(); switch (Type) { case RenderInfoType.Int32: _value = loader.ReadInt32s(count); break; case RenderInfoType.Single: _value = loader.ReadSingles(count); break; case RenderInfoType.String: _value = loader.LoadStrings(count); break; } }
// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { if (loader.IsSwitch) { Name = loader.LoadString(); uint DataOffset = loader.ReadOffset(); uint count = 0; if (loader.ResFile.VersionMajor2 <= 2 && loader.ResFile.VersionMajor == 0) { char[] Reserved = loader.ReadChars(8); count = loader.ReadUInt32(); Type = (UserDataType)loader.ReadUInt32(); } else { count = loader.ReadUInt32(); Type = loader.ReadEnum <UserDataType>(true); char[] Reserved = loader.ReadChars(43); } switch (Type) { case UserDataType.Byte: _value = loader.LoadCustom(() => loader.ReadSBytes((int)count), DataOffset); break; case UserDataType.Int32: _value = loader.LoadCustom(() => loader.ReadInt32s((int)count), DataOffset); break; case UserDataType.Single: _value = loader.LoadCustom(() => loader.ReadSingles((int)count), DataOffset); break; case UserDataType.String: _value = loader.LoadCustom(() => loader.LoadStrings((int)count, Encoding.UTF8), DataOffset); break; case UserDataType.WString: _value = loader.LoadCustom(() => loader.LoadStrings((int)count, Encoding.Unicode), DataOffset); break; } } else { Name = loader.LoadString(); ushort count = loader.ReadUInt16(); Type = loader.ReadEnum <UserDataType>(true); loader.Seek(1); switch (Type) { case UserDataType.Int32: _value = loader.ReadInt32s(count); break; case UserDataType.Single: _value = loader.ReadSingles(count); break; case UserDataType.String: _value = loader.LoadStrings(count, Encoding.UTF8); break; case UserDataType.WString: _value = loader.LoadStrings(count, Encoding.Unicode); break; case UserDataType.Byte: _value = loader.ReadBytes(count); break; } } }