diff --git a/MinecraftUSkinEditor/Classes/IO/PCK/PCKFileReader.cs b/MinecraftUSkinEditor/Classes/IO/PCK/PCKFileReader.cs index 507ac7fc..5ceffc6a 100644 --- a/MinecraftUSkinEditor/Classes/IO/PCK/PCKFileReader.cs +++ b/MinecraftUSkinEditor/Classes/IO/PCK/PCKFileReader.cs @@ -61,8 +61,6 @@ namespace PckStudio.Classes.IO foreach (var file_entry in _file.file_entries) { int property_count = ReadInt(stream); - - var properties = new PCKProperties(); for (; 0 < property_count; property_count--) { int index = ReadInt(stream); @@ -70,11 +68,11 @@ namespace PckStudio.Classes.IO throw new Exception("Value not found"); string key = GetKeyFromValue(_file.meta_data, index); string value = ReadString(stream); - properties.Add(new Tuple(key, value)); + file_entry.properties.Add(new ValueTuple(key, value)); ReadInt(stream); // padding ??? } - file_entry.properties = properties; - stream.Read(file_entry.data, 0, file_entry.size); // file data buffer is only allocated when FileData is constructed with `dataSize` + // file data buffer is only allocated when FileData is constructed with `dataSize` + stream.Read(file_entry.data, 0, file_entry.size); } } private static T1 GetKeyFromValue(Dictionary dict, T2 value) diff --git a/MinecraftUSkinEditor/Classes/IO/PCK/PCKFileWriter.cs b/MinecraftUSkinEditor/Classes/IO/PCK/PCKFileWriter.cs index 76c25b15..f2f35853 100644 --- a/MinecraftUSkinEditor/Classes/IO/PCK/PCKFileWriter.cs +++ b/MinecraftUSkinEditor/Classes/IO/PCK/PCKFileWriter.cs @@ -36,7 +36,7 @@ namespace PckStudio.Classes.IO byte[] buffer = BitConverter.GetBytes(value); if (BitConverter.IsLittleEndian && !isLittleEndian) Array.Reverse(buffer); - stream.Write(buffer, 0, buffer.Length); + stream.Write(buffer, 0, 4); } internal void WriteString(Stream stream, string s)