diff --git a/Directory.Build.props b/Directory.Build.props index bbdd541..51d41bd 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - 1.2.1 + 1.2.2 ParManager Kaplas diff --git a/ParLibrary/Converter/ParArchiveReader.cs b/ParLibrary/Converter/ParArchiveReader.cs index 50a70db..9306559 100644 --- a/ParLibrary/Converter/ParArchiveReader.cs +++ b/ParLibrary/Converter/ParArchiveReader.cs @@ -122,9 +122,9 @@ public NodeContainerFormat Convert(BinaryFormat source) for (int i = 0; i < totalFileCount; i++) { uint compressionFlag = reader.ReadUInt32(); - int size = reader.ReadInt32(); - int compressedSize = reader.ReadInt32(); - int offset = reader.ReadInt32(); + uint size = reader.ReadUInt32(); + uint compressedSize = reader.ReadUInt32(); + uint offset = reader.ReadUInt32(); int attributes = reader.ReadInt32(); int unknown2 = reader.ReadInt32(); int unknown3 = reader.ReadInt32(); diff --git a/ParLibrary/Converter/ParArchiveWriter.cs b/ParLibrary/Converter/ParArchiveWriter.cs index 31c3fc0..d2aee23 100644 --- a/ParLibrary/Converter/ParArchiveWriter.cs +++ b/ParLibrary/Converter/ParArchiveWriter.cs @@ -341,8 +341,8 @@ private static void WriteFiles(DataWriter writer, IEnumerable files, long writer.Write(parFile.IsCompressed ? 0x80000000 : 0x00000000); writer.Write(parFile.DecompressedSize); - writer.Write((int)node.Stream.Length); - writer.Write((int)dataPosition); + writer.Write((uint)node.Stream.Length); + writer.Write((uint)dataPosition); writer.Write(attributes); writer.Write(parFile.Unknown2); writer.Write(parFile.Unknown3); diff --git a/ParLibrary/ParFile.cs b/ParLibrary/ParFile.cs index 9ac4c8d..d68b7f4 100644 --- a/ParLibrary/ParFile.cs +++ b/ParLibrary/ParFile.cs @@ -41,7 +41,7 @@ public ParFile(DataStream stream) this.CanBeCompressed = true; this.IsCompressed = false; - this.DecompressedSize = (int)stream.Length; + this.DecompressedSize = (uint)stream.Length; this.Attributes = 0x00000020; this.Unknown2 = 0x00000000; this.Unknown3 = 0x00000000; @@ -59,7 +59,7 @@ public ParFile(DataStream stream, long offset, long length) { this.CanBeCompressed = true; this.IsCompressed = false; - this.DecompressedSize = (int)length; + this.DecompressedSize = (uint)length; this.Attributes = 0x00000020; this.Unknown2 = 0x00000000; this.Unknown3 = 0x00000000; @@ -79,7 +79,7 @@ public ParFile(DataStream stream, long offset, long length) /// /// Gets or sets the file size (decompressed). /// - public int DecompressedSize { get; set; } + public uint DecompressedSize { get; set; } /// /// Gets or sets the file attributes. diff --git a/Tests/ParLib.UnitTests/SllzTests.cs b/Tests/ParLib.UnitTests/SllzTests.cs index f2ca107..f0e56a2 100644 --- a/Tests/ParLib.UnitTests/SllzTests.cs +++ b/Tests/ParLib.UnitTests/SllzTests.cs @@ -5,6 +5,7 @@ namespace ParLib.UnitTests { using System.Text; using NUnit.Framework; + using ParLibrary; using ParLibrary.Sllz; using Yarhl.FileFormat; using Yarhl.IO; @@ -27,7 +28,7 @@ public void TestSllz(byte compressorVersion) byte[] buffer = Encoding.ASCII.GetBytes(sampleText); DataStream dataStream = DataStreamFactory.FromArray(buffer, 0, buffer.Length); - using var binaryFormat = new BinaryFormat(dataStream); + using var binaryFormat = new ParFile(dataStream); var parameters = new CompressorParameters { @@ -35,11 +36,11 @@ public void TestSllz(byte compressorVersion) Version = compressorVersion, }; - var compressedBinaryFormat = (BinaryFormat)ConvertFormat.With(parameters, binaryFormat); - var decompressedBinaryFormat = (BinaryFormat)ConvertFormat.With(compressedBinaryFormat); + var compressedBinaryFormat = (ParFile)ConvertFormat.With(parameters, binaryFormat); + var decompressedBinaryFormat = (ParFile)ConvertFormat.With(compressedBinaryFormat); Assert.IsTrue(compressedBinaryFormat.Stream.Length < decompressedBinaryFormat.Stream.Length); Assert.IsTrue(dataStream.Compare(decompressedBinaryFormat.Stream)); } } -} \ No newline at end of file +}