mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-02-05 05:37:46 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b745d4b9f6 | ||
|
|
4271bd86b3 | ||
|
|
88de4be27b | ||
|
|
33905165f7 | ||
|
|
83ec3b6950 | ||
|
|
9b5d51884c |
@@ -1280,6 +1280,7 @@ namespace SabreTools.Serialization
|
||||
{
|
||||
var stringData = new StringData();
|
||||
|
||||
int dataStartOffset = offset;
|
||||
stringData.Length = data.ReadUInt16(ref offset);
|
||||
stringData.ValueLength = data.ReadUInt16(ref offset);
|
||||
stringData.ResourceType = (VersionResourceType)data.ReadUInt16(ref offset);
|
||||
@@ -1294,7 +1295,8 @@ namespace SabreTools.Serialization
|
||||
|
||||
if (stringData.ValueLength > 0)
|
||||
{
|
||||
byte[]? valueBytes = data.ReadBytes(ref offset, stringData.ValueLength * sizeof(ushort));
|
||||
int bytesReadable = Math.Min(stringData.ValueLength * sizeof(ushort), stringData.Length - (offset - dataStartOffset));
|
||||
byte[]? valueBytes = data.ReadBytes(ref offset, bytesReadable);
|
||||
if (valueBytes != null)
|
||||
stringData.Value = Encoding.Unicode.GetString(valueBytes);
|
||||
}
|
||||
|
||||
@@ -165,6 +165,12 @@ namespace SabreTools.Serialization.Files
|
||||
cueTracks.Add(track);
|
||||
break;
|
||||
|
||||
// Next file found, return
|
||||
case "FILE":
|
||||
i--;
|
||||
cueFile.Tracks = cueTracks.ToArray();
|
||||
return cueFile;
|
||||
|
||||
// Default means return
|
||||
default:
|
||||
i--;
|
||||
@@ -299,6 +305,13 @@ namespace SabreTools.Serialization.Files
|
||||
cueTrack.PostGap = postgap;
|
||||
break;
|
||||
|
||||
// Next track or file found, return
|
||||
case "TRACK":
|
||||
case "FILE":
|
||||
i--;
|
||||
cueTrack.Indices = cueIndices.ToArray();
|
||||
return cueTrack;
|
||||
|
||||
// Default means return
|
||||
default:
|
||||
i--;
|
||||
@@ -583,4 +596,4 @@ namespace SabreTools.Serialization.Files
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace SabreTools.Serialization
|
||||
return null;
|
||||
|
||||
// Open the file for deserialization
|
||||
var stream = File.OpenRead(path);
|
||||
var stream = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||||
|
||||
// Get the extension to determine if additional handling is needed
|
||||
string ext = Path.GetExtension(path).TrimStart('.');
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<Version>1.3.0</Version>
|
||||
<Version>1.3.2</Version>
|
||||
|
||||
<!-- Package Properties -->
|
||||
<Authors>Matt Nadareski</Authors>
|
||||
<Description>Serialization and deserialization helpers for various types</Description>
|
||||
<Copyright>Copyright (c) Matt Nadareski 2019-2023</Copyright>
|
||||
<Copyright>Copyright (c) Matt Nadareski 2019-2024</Copyright>
|
||||
<PackageProjectUrl>https://github.com/SabreTools/</PackageProjectUrl>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<RepositoryUrl>https://github.com/SabreTools/SabreTools.Serialization</RepositoryUrl>
|
||||
|
||||
Reference in New Issue
Block a user