[skip ci] documentation in AssetRipper.IO.Files

This commit is contained in:
Jeremy Pritts 2023-09-19 00:38:08 -04:00
parent cbd02f75ca
commit c7961747a6
4 changed files with 22 additions and 17 deletions

View File

@ -4,6 +4,14 @@ namespace AssetRipper.IO.Files
{
public interface IScheme
{
/// <summary>
/// Checks if the file can be read by this scheme.
/// </summary>
/// <remarks>
/// Implementations are expected to reset the <paramref name="stream"/> to its initial position.
/// </remarks>
/// <param name="stream">The stream for the file.</param>
/// <returns>True if the file can be read.</returns>
bool CanRead(SmartStream stream);
FileBase Read(SmartStream stream, string filePath, string fileName);
}

View File

@ -57,6 +57,9 @@ namespace AssetRipper.IO.Files.SerializedFiles.Parser
if (HasEndian(header.Version))
{
int num = stream.ReadByte();
//This is not and should not be aligned.
//Aligment only happens for the endian boolean on version 9 and greater.
//This coincides with endianess being stored in the header on version 9 and greater.
return num switch
{
< 0 => throw new EndOfStreamException(),

View File

@ -2,6 +2,12 @@
namespace AssetRipper.IO.Files.SerializedFiles.Parser
{
/// <summary>
/// A reference type for a serializeable C# type.
/// </summary>
/// <remarks>
/// These are used for fields with the [SerializeReference] attribute.
/// </remarks>
public sealed class SerializedTypeReference : SerializedTypeBase
{
public string ClassName { get; set; } = "";

View File

@ -6,14 +6,8 @@ namespace AssetRipper.IO.Files.SerializedFiles
{
public SerializedFileException(string message, UnityVersion version, BuildTarget platform, int classIdType, string fileName, string filePath) : base(message)
{
if (string.IsNullOrEmpty(fileName))
{
throw new ArgumentNullException(nameof(fileName));
}
if (string.IsNullOrEmpty(filePath))
{
throw new ArgumentNullException(nameof(filePath));
}
ArgumentException.ThrowIfNullOrEmpty(fileName);
ArgumentException.ThrowIfNullOrEmpty(filePath);
Version = version;
Platform = platform;
@ -24,14 +18,8 @@ namespace AssetRipper.IO.Files.SerializedFiles
public SerializedFileException(string message, Exception innerException, UnityVersion version, BuildTarget platform, int classIdType, string fileName, string filePath) : base(message, innerException)
{
if (string.IsNullOrEmpty(fileName))
{
throw new ArgumentNullException(nameof(fileName));
}
if (string.IsNullOrEmpty(filePath))
{
throw new ArgumentNullException(nameof(filePath));
}
ArgumentException.ThrowIfNullOrEmpty(fileName);
ArgumentException.ThrowIfNullOrEmpty(filePath);
Version = version;
Platform = platform;
@ -42,7 +30,7 @@ namespace AssetRipper.IO.Files.SerializedFiles
public override string ToString()
{
StringBuilder sb = new StringBuilder();
StringBuilder sb = new();
sb.Append("SerializedFileException:");
sb.Append(" v:").Append(Version.ToString());
sb.Append(" p:").Append(Platform.ToString());