One more GetEndOffset removal

This commit is contained in:
Matt Nadareski
2025-08-20 08:04:01 -04:00
parent 64cd8febaa
commit 6e0ced5ffe

View File

@@ -70,25 +70,6 @@ namespace SabreTools.Serialization.Wrappers
#region Data
/// <summary>
/// Get the ending offset of the source
/// </summary>
/// <returns>Value greater than 0 for a valid end of file, -1 on error</returns>
public long GetEndOffset()
{
// Validate the data souece
if (!IsValid())
return -1;
// Return the effective endpoint
return _dataSourceType switch
{
DataSourceType.ByteArray => _byteArrayData!.Length - _initialPosition,
DataSourceType.Stream => _streamData!.Length - _initialPosition,
_ => -1,
};
}
/// <summary>
/// Get the filename from the source, if possible
/// </summary>
@@ -156,7 +137,7 @@ namespace SabreTools.Serialization.Wrappers
return false;
// If we have an invalid position
if (position < 0 || position >= GetEndOffset())
if (position < 0 || position >= GetLength())
return false;
return _dataSourceType switch