mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-02-04 05:36:12 +00:00
Name some type parameters
This commit is contained in:
@@ -7,22 +7,22 @@ namespace SabreTools.Data.Models.SGA
|
||||
}
|
||||
|
||||
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/SGAFile.h"/>
|
||||
public abstract class DirectoryHeader<T> where T : notnull
|
||||
public abstract class DirectoryHeader<TNumeric> where TNumeric : notnull
|
||||
{
|
||||
public uint SectionOffset { get; set; }
|
||||
|
||||
public T? SectionCount { get; set; }
|
||||
public TNumeric? SectionCount { get; set; }
|
||||
|
||||
public uint FolderOffset { get; set; }
|
||||
|
||||
public T? FolderCount { get; set; }
|
||||
public TNumeric? FolderCount { get; set; }
|
||||
|
||||
public uint FileOffset { get; set; }
|
||||
|
||||
public T? FileCount { get; set; }
|
||||
public TNumeric? FileCount { get; set; }
|
||||
|
||||
public uint StringTableOffset { get; set; }
|
||||
|
||||
public T? StringTableCount { get; set; }
|
||||
public TNumeric? StringTableCount { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,14 +9,14 @@ namespace SabreTools.Data.Models.SGA
|
||||
}
|
||||
|
||||
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/SGAFile.h"/>
|
||||
public abstract class Folder<T> : Folder where T : notnull
|
||||
public abstract class Folder<TNumeric> : Folder where TNumeric : notnull
|
||||
{
|
||||
public T? FolderStartIndex { get; set; }
|
||||
public TNumeric? FolderStartIndex { get; set; }
|
||||
|
||||
public T? FolderEndIndex { get; set; }
|
||||
public TNumeric? FolderEndIndex { get; set; }
|
||||
|
||||
public T? FileStartIndex { get; set; }
|
||||
public TNumeric? FileStartIndex { get; set; }
|
||||
|
||||
public T? FileEndIndex { get; set; }
|
||||
public TNumeric? FileEndIndex { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,16 +9,16 @@ namespace SabreTools.Data.Models.SGA
|
||||
}
|
||||
|
||||
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/SGAFile.h"/>
|
||||
public abstract class Section<T> : Section where T : notnull
|
||||
public abstract class Section<TNumeric> : Section where TNumeric : notnull
|
||||
{
|
||||
public T? FolderStartIndex { get; set; }
|
||||
public TNumeric? FolderStartIndex { get; set; }
|
||||
|
||||
public T? FolderEndIndex { get; set; }
|
||||
public TNumeric? FolderEndIndex { get; set; }
|
||||
|
||||
public T? FileStartIndex { get; set; }
|
||||
public TNumeric? FileStartIndex { get; set; }
|
||||
|
||||
public T? FileEndIndex { get; set; }
|
||||
public TNumeric? FileEndIndex { get; set; }
|
||||
|
||||
public T? FolderRootIndex { get; set; }
|
||||
public TNumeric? FolderRootIndex { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,8 @@ namespace SabreTools.Serialization.Wrappers
|
||||
/// <see href="https://stackoverflow.com/a/72775719"/>
|
||||
internal static class ObjectExtensions
|
||||
{
|
||||
public static T ThrowOnNull<T>(this T? value) where T : class => value ?? throw new ArgumentNullException();
|
||||
public static TClass ThrowOnNull<TClass>(this TClass? value) where TClass : class
|
||||
=> value ?? throw new ArgumentNullException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,17 +2,17 @@ using System.IO;
|
||||
|
||||
namespace SabreTools.Serialization.Wrappers
|
||||
{
|
||||
public abstract class WrapperBase<T> : WrapperBase, IWrapper<T>
|
||||
public abstract class WrapperBase<TModel> : WrapperBase, IWrapper<TModel>
|
||||
{
|
||||
#region Properties
|
||||
|
||||
/// <inheritdoc/>
|
||||
public T GetModel() => Model;
|
||||
public TModel GetModel() => Model;
|
||||
|
||||
/// <summary>
|
||||
/// Internal model
|
||||
/// </summary>
|
||||
public T Model { get; }
|
||||
public TModel Model { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
/// </summary>
|
||||
/// <param name="model">Model to be used in the wrapper</param>
|
||||
/// <param name="data">Underlying data for the wrapper</param>
|
||||
protected WrapperBase(T model, byte[] data)
|
||||
protected WrapperBase(TModel model, byte[] data)
|
||||
: this(model, data, 0, data.Length)
|
||||
{
|
||||
}
|
||||
@@ -34,7 +34,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
/// <param name="model">Model to be used in the wrapper</param>
|
||||
/// <param name="data">Underlying data for the wrapper</param>
|
||||
/// <param name="offset">Offset into the data to use as the window start</param>
|
||||
protected WrapperBase(T model, byte[] data, int offset)
|
||||
protected WrapperBase(TModel model, byte[] data, int offset)
|
||||
: this(model, data, offset, data.Length - offset)
|
||||
{
|
||||
}
|
||||
@@ -46,7 +46,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
/// <param name="data">Underlying data for the wrapper</param>
|
||||
/// <param name="offset">Offset into the data to use as the window start</param>
|
||||
/// <param name="length">Length of the window into the data</param>
|
||||
protected WrapperBase(T model, byte[] data, int offset, int length)
|
||||
protected WrapperBase(TModel model, byte[] data, int offset, int length)
|
||||
: base(data, offset, length)
|
||||
{
|
||||
Model = model;
|
||||
@@ -62,7 +62,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
/// <param name="model">Model to be used in the wrapper</param>
|
||||
/// <param name="data">Underlying data for the wrapper</param>
|
||||
/// <remarks>Uses the current stream position as the offset</remarks>
|
||||
protected WrapperBase(T model, Stream data)
|
||||
protected WrapperBase(TModel model, Stream data)
|
||||
: this(model, data, data.Position, data.Length - data.Position)
|
||||
{
|
||||
}
|
||||
@@ -73,7 +73,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
/// <param name="model">Model to be used in the wrapper</param>
|
||||
/// <param name="data">Underlying data for the wrapper</param>
|
||||
/// <param name="offset">Offset into the data to use as the window start</param>
|
||||
protected WrapperBase(T model, Stream data, long offset)
|
||||
protected WrapperBase(TModel model, Stream data, long offset)
|
||||
: this(model, data, offset, data.Length - offset)
|
||||
{
|
||||
}
|
||||
@@ -85,7 +85,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
/// <param name="data">Underlying data for the wrapper</param>
|
||||
/// <param name="offset">Offset into the data to use as the window start</param>
|
||||
/// <param name="length">Length of the window into the data</param>
|
||||
protected WrapperBase(T model, Stream data, long offset, long length)
|
||||
protected WrapperBase(TModel model, Stream data, long offset, long length)
|
||||
: base(data, offset, length)
|
||||
{
|
||||
Model = model;
|
||||
|
||||
Reference in New Issue
Block a user