Skip to content

Commit

Permalink
Improvement: Renamed "from/to data" methods to "from/to bytes"
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin113D committed Nov 11, 2023
1 parent a0b1cb8 commit cdf0412
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 37 deletions.
20 changes: 10 additions & 10 deletions src/SA3D.Modeling/File/AnimationFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static bool CheckIsAnimationFile(EndianStackReader reader, uint address)
/// <returns>The animation file that was read.</returns>
public static AnimationFile ReadFromFile(string filepath)
{
return ReadFromData(System.IO.File.ReadAllBytes(filepath), 0);
return ReadFromBytes(System.IO.File.ReadAllBytes(filepath), 0);
}

/// <summary>
Expand All @@ -91,17 +91,17 @@ public static AnimationFile ReadFromFile(string filepath)
/// <returns>The animation file that was read.</returns>
public static AnimationFile ReadFromFile(string filepath, uint? nodeCount, bool shortRot)
{
return ReadFromData(System.IO.File.ReadAllBytes(filepath), 0, nodeCount, shortRot);
return ReadFromBytes(System.IO.File.ReadAllBytes(filepath), 0, nodeCount, shortRot);
}

/// <summary>
/// Reads a animation file off byte data.
/// </summary>
/// <param name="data">The data to read.</param>
/// <returns>The animation file that was read.</returns>
public static AnimationFile ReadFromData(byte[] data)
public static AnimationFile ReadFromBytes(byte[] data)
{
return ReadFromData(data, 0, null, false);
return ReadFromBytes(data, 0, null, false);
}

/// <summary>
Expand All @@ -110,9 +110,9 @@ public static AnimationFile ReadFromData(byte[] data)
/// <param name="data">The data to read.</param>
/// <param name="address">Address at which to start reading.</param>
/// <returns>The animation file that was read.</returns>
public static AnimationFile ReadFromData(byte[] data, uint address)
public static AnimationFile ReadFromBytes(byte[] data, uint address)
{
return ReadFromData(data, address, null, false);
return ReadFromBytes(data, address, null, false);
}

/// <summary>
Expand All @@ -123,7 +123,7 @@ public static AnimationFile ReadFromData(byte[] data, uint address)
/// <param name="nodeCount">Number of nodes in the targeted model node tree. <br/> Only acts as fallback, in case the file does not contain the value.</param>
/// <param name="shortRot">Whether euler rotations are stored in 16-bit instead of 32-bit. <br/> Only acts as fallback, in case the file does not contain the value.</param>
/// <returns>The animation file that was read.</returns>
public static AnimationFile ReadFromData(byte[] data, uint address, uint? nodeCount, bool shortRot)
public static AnimationFile ReadFromBytes(byte[] data, uint address, uint? nodeCount, bool shortRot)
{
using(EndianStackReader reader = new(data))
{
Expand Down Expand Up @@ -266,9 +266,9 @@ public void WriteToFile(string filepath)
/// </summary>
/// <returns></returns>
/// <exception cref="InvalidOperationException"></exception>
public byte[] WriteToData()
public byte[] WriteToBytes()
{
return WriteToData(Animation, MetaData);
return WriteToBytes(Animation, MetaData);
}

/// <summary>
Expand Down Expand Up @@ -305,7 +305,7 @@ public static void WriteToFile(string filepath, Motion animation, MetaData? meta
/// <param name="metaData">The metadata to include.</param>
/// <returns>The written byte data.</returns>
/// <exception cref="InvalidOperationException"></exception>
public static byte[] WriteToData(Motion animation, MetaData? metaData = null)
public static byte[] WriteToBytes(Motion animation, MetaData? metaData = null)
{
using(MemoryStream stream = new())
{
Expand Down
14 changes: 7 additions & 7 deletions src/SA3D.Modeling/File/LevelFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,17 @@ public static bool CheckIsLevelFile(EndianStackReader reader, uint address)
/// <returns>The level file that was read.</returns>
public static LevelFile ReadFromFile(string filepath)
{
return ReadFromData(System.IO.File.ReadAllBytes(filepath));
return ReadFromBytes(System.IO.File.ReadAllBytes(filepath));
}

/// <summary>
/// Reads a level file off byte data.
/// </summary>
/// <param name="data">The data to read.</param>
/// <returns>The level file that was read.</returns>
public static LevelFile ReadFromData(byte[] data)
public static LevelFile ReadFromBytes(byte[] data)
{
return ReadFromData(data, 0);
return ReadFromBytes(data, 0);
}

/// <summary>
Expand All @@ -108,7 +108,7 @@ public static LevelFile ReadFromData(byte[] data)
/// <param name="data">The data to read.</param>
/// <param name="address">Address at which to start reading.</param>
/// <returns>The level file that was read.</returns>
public static LevelFile ReadFromData(byte[] data, uint address)
public static LevelFile ReadFromBytes(byte[] data, uint address)
{
using(EndianStackReader reader = new(data))
{
Expand Down Expand Up @@ -186,9 +186,9 @@ public void WriteToFile(string filepath)
/// </summary>
/// <returns></returns>
/// <exception cref="InvalidOperationException"></exception>
public byte[] WriteToData()
public byte[] WriteToBytes()
{
return WriteToData(Level, MetaData);
return WriteToBytes(Level, MetaData);
}

/// <summary>
Expand Down Expand Up @@ -225,7 +225,7 @@ public static void WriteToFile(string filepath, LandTable level, MetaData? metaD
/// <param name="metaData">The metadata to include.</param>
/// <returns>The written byte data.</returns>
/// <exception cref="InvalidOperationException"></exception>
public static byte[] WriteToData(LandTable level, MetaData? metaData = null)
public static byte[] WriteToBytes(LandTable level, MetaData? metaData = null)
{
using(MemoryStream stream = new())
{
Expand Down
14 changes: 7 additions & 7 deletions src/SA3D.Modeling/File/ModelFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,17 @@ public static bool CheckIsModelFile(EndianStackReader reader, uint address)
/// <returns>The model file that was read.</returns>
public static ModelFile ReadFromFile(string filepath)
{
return ReadFromData(System.IO.File.ReadAllBytes(filepath));
return ReadFromBytes(System.IO.File.ReadAllBytes(filepath));
}

/// <summary>
/// Reads a model file off byte data.
/// </summary>
/// <param name="data">Data to read.</param>
/// <returns>The model file that was read.</returns>
public static ModelFile ReadFromData(byte[] data)
public static ModelFile ReadFromBytes(byte[] data)
{
return ReadFromData(data, 0);
return ReadFromBytes(data, 0);
}

/// <summary>
Expand All @@ -128,7 +128,7 @@ public static ModelFile ReadFromData(byte[] data)
/// <param name="data">The data to read from.</param>
/// <param name="address">The address at which to start reading.</param>
/// <returns>The model file that was read.</returns>
public static ModelFile ReadFromData(byte[] data, uint address)
public static ModelFile ReadFromBytes(byte[] data, uint address)
{
using(EndianStackReader reader = new(data))
{
Expand Down Expand Up @@ -271,9 +271,9 @@ public void WriteToFile(string filepath)
/// </summary>
/// <exception cref="InvalidOperationException"></exception>
/// <returns>The written byte data.</returns>
public byte[] WriteToData()
public byte[] WriteToBytes()
{
return WriteToData(Model, NJFile, MetaData, Format);
return WriteToBytes(Model, NJFile, MetaData, Format);
}

/// <summary>
Expand Down Expand Up @@ -314,7 +314,7 @@ public static void WriteToFile(string filepath, Node model, bool nj = false, Met
/// <param name="format">The format to write in.</param>
/// <exception cref="InvalidOperationException"></exception>
/// <returns>The written byte data.</returns>
public static byte[] WriteToData(Node model, bool nj = false, MetaData? metaData = null, ModelFormat? format = null)
public static byte[] WriteToBytes(Node model, bool nj = false, MetaData? metaData = null, ModelFormat? format = null)
{
using(MemoryStream stream = new())
{
Expand Down
26 changes: 13 additions & 13 deletions src/SA3D.Modeling/PublicAPI/net7.0/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,13 @@ SA3D.Modeling.File.AnimationFile
SA3D.Modeling.File.AnimationFile.Animation.get -> SA3D.Modeling.Animation.Motion!
SA3D.Modeling.File.AnimationFile.MetaData.get -> SA3D.Modeling.File.MetaData!
SA3D.Modeling.File.AnimationFile.Write(SA3D.Common.IO.EndianStackWriter! writer) -> void
SA3D.Modeling.File.AnimationFile.WriteToData() -> byte[]!
SA3D.Modeling.File.AnimationFile.WriteToBytes() -> byte[]!
SA3D.Modeling.File.AnimationFile.WriteToFile(string! filepath) -> void
SA3D.Modeling.File.LevelFile
SA3D.Modeling.File.LevelFile.Level.get -> SA3D.Modeling.ObjectData.LandTable!
SA3D.Modeling.File.LevelFile.MetaData.get -> SA3D.Modeling.File.MetaData!
SA3D.Modeling.File.LevelFile.Write(SA3D.Common.IO.EndianStackWriter! writer) -> void
SA3D.Modeling.File.LevelFile.WriteToData() -> byte[]!
SA3D.Modeling.File.LevelFile.WriteToBytes() -> byte[]!
SA3D.Modeling.File.LevelFile.WriteToFile(string! filepath) -> void
SA3D.Modeling.File.MetaBlockType
SA3D.Modeling.File.MetaBlockType.ActionName = 1094931534 -> SA3D.Modeling.File.MetaBlockType
Expand Down Expand Up @@ -284,7 +284,7 @@ SA3D.Modeling.File.ModelFile.MetaData.get -> SA3D.Modeling.File.MetaData!
SA3D.Modeling.File.ModelFile.Model.get -> SA3D.Modeling.ObjectData.Node!
SA3D.Modeling.File.ModelFile.NJFile.get -> bool
SA3D.Modeling.File.ModelFile.Write(SA3D.Common.IO.EndianStackWriter! writer) -> void
SA3D.Modeling.File.ModelFile.WriteToData() -> byte[]!
SA3D.Modeling.File.ModelFile.WriteToBytes() -> byte[]!
SA3D.Modeling.File.ModelFile.WriteToFile(string! filepath) -> void
SA3D.Modeling.Mesh.Attach
SA3D.Modeling.Mesh.Attach.Attach() -> void
Expand Down Expand Up @@ -1689,25 +1689,25 @@ static SA3D.Modeling.File.AnimationFile.CheckIsAnimationFile(SA3D.Common.IO.Endi
static SA3D.Modeling.File.AnimationFile.Read(SA3D.Common.IO.EndianStackReader! reader) -> SA3D.Modeling.File.AnimationFile!
static SA3D.Modeling.File.AnimationFile.Read(SA3D.Common.IO.EndianStackReader! reader, uint address) -> SA3D.Modeling.File.AnimationFile!
static SA3D.Modeling.File.AnimationFile.Read(SA3D.Common.IO.EndianStackReader! reader, uint address, uint? nodeCount, bool shortRot) -> SA3D.Modeling.File.AnimationFile!
static SA3D.Modeling.File.AnimationFile.ReadFromData(byte[]! data) -> SA3D.Modeling.File.AnimationFile!
static SA3D.Modeling.File.AnimationFile.ReadFromData(byte[]! data, uint address) -> SA3D.Modeling.File.AnimationFile!
static SA3D.Modeling.File.AnimationFile.ReadFromData(byte[]! data, uint address, uint? nodeCount, bool shortRot) -> SA3D.Modeling.File.AnimationFile!
static SA3D.Modeling.File.AnimationFile.ReadFromBytes(byte[]! data) -> SA3D.Modeling.File.AnimationFile!
static SA3D.Modeling.File.AnimationFile.ReadFromBytes(byte[]! data, uint address) -> SA3D.Modeling.File.AnimationFile!
static SA3D.Modeling.File.AnimationFile.ReadFromBytes(byte[]! data, uint address, uint? nodeCount, bool shortRot) -> SA3D.Modeling.File.AnimationFile!
static SA3D.Modeling.File.AnimationFile.ReadFromFile(string! filepath) -> SA3D.Modeling.File.AnimationFile!
static SA3D.Modeling.File.AnimationFile.ReadFromFile(string! filepath, uint? nodeCount, bool shortRot) -> SA3D.Modeling.File.AnimationFile!
static SA3D.Modeling.File.AnimationFile.Write(SA3D.Common.IO.EndianStackWriter! writer, SA3D.Modeling.Animation.Motion! animation, SA3D.Modeling.File.MetaData? metaData = null) -> void
static SA3D.Modeling.File.AnimationFile.WriteToData(SA3D.Modeling.Animation.Motion! animation, SA3D.Modeling.File.MetaData? metaData = null) -> byte[]!
static SA3D.Modeling.File.AnimationFile.WriteToBytes(SA3D.Modeling.Animation.Motion! animation, SA3D.Modeling.File.MetaData? metaData = null) -> byte[]!
static SA3D.Modeling.File.AnimationFile.WriteToFile(string! filepath, SA3D.Modeling.Animation.Motion! animation, SA3D.Modeling.File.MetaData? metaData = null) -> void
static SA3D.Modeling.File.LevelFile.CheckIsLevelFile(byte[]! data) -> bool
static SA3D.Modeling.File.LevelFile.CheckIsLevelFile(byte[]! data, uint address) -> bool
static SA3D.Modeling.File.LevelFile.CheckIsLevelFile(SA3D.Common.IO.EndianStackReader! reader) -> bool
static SA3D.Modeling.File.LevelFile.CheckIsLevelFile(SA3D.Common.IO.EndianStackReader! reader, uint address) -> bool
static SA3D.Modeling.File.LevelFile.Read(SA3D.Common.IO.EndianStackReader! reader) -> SA3D.Modeling.File.LevelFile!
static SA3D.Modeling.File.LevelFile.Read(SA3D.Common.IO.EndianStackReader! reader, uint address) -> SA3D.Modeling.File.LevelFile!
static SA3D.Modeling.File.LevelFile.ReadFromData(byte[]! data) -> SA3D.Modeling.File.LevelFile!
static SA3D.Modeling.File.LevelFile.ReadFromData(byte[]! data, uint address) -> SA3D.Modeling.File.LevelFile!
static SA3D.Modeling.File.LevelFile.ReadFromBytes(byte[]! data) -> SA3D.Modeling.File.LevelFile!
static SA3D.Modeling.File.LevelFile.ReadFromBytes(byte[]! data, uint address) -> SA3D.Modeling.File.LevelFile!
static SA3D.Modeling.File.LevelFile.ReadFromFile(string! filepath) -> SA3D.Modeling.File.LevelFile!
static SA3D.Modeling.File.LevelFile.Write(SA3D.Common.IO.EndianStackWriter! writer, SA3D.Modeling.ObjectData.LandTable! level, SA3D.Modeling.File.MetaData? metaData = null) -> void
static SA3D.Modeling.File.LevelFile.WriteToData(SA3D.Modeling.ObjectData.LandTable! level, SA3D.Modeling.File.MetaData? metaData = null) -> byte[]!
static SA3D.Modeling.File.LevelFile.WriteToBytes(SA3D.Modeling.ObjectData.LandTable! level, SA3D.Modeling.File.MetaData? metaData = null) -> byte[]!
static SA3D.Modeling.File.LevelFile.WriteToFile(string! filepath, SA3D.Modeling.ObjectData.LandTable! level, SA3D.Modeling.File.MetaData? metaData = null) -> void
static SA3D.Modeling.File.MetaData.Read(SA3D.Common.IO.EndianStackReader! reader, uint address, int version, bool hasAnimMorphFiles) -> SA3D.Modeling.File.MetaData!
static SA3D.Modeling.File.ModelFile.CheckIsModelFile(byte[]! data) -> bool
Expand All @@ -1716,11 +1716,11 @@ static SA3D.Modeling.File.ModelFile.CheckIsModelFile(SA3D.Common.IO.EndianStackR
static SA3D.Modeling.File.ModelFile.CheckIsModelFile(SA3D.Common.IO.EndianStackReader! reader, uint address) -> bool
static SA3D.Modeling.File.ModelFile.Read(SA3D.Common.IO.EndianStackReader! reader) -> SA3D.Modeling.File.ModelFile!
static SA3D.Modeling.File.ModelFile.Read(SA3D.Common.IO.EndianStackReader! reader, uint address) -> SA3D.Modeling.File.ModelFile!
static SA3D.Modeling.File.ModelFile.ReadFromData(byte[]! data) -> SA3D.Modeling.File.ModelFile!
static SA3D.Modeling.File.ModelFile.ReadFromData(byte[]! data, uint address) -> SA3D.Modeling.File.ModelFile!
static SA3D.Modeling.File.ModelFile.ReadFromBytes(byte[]! data) -> SA3D.Modeling.File.ModelFile!
static SA3D.Modeling.File.ModelFile.ReadFromBytes(byte[]! data, uint address) -> SA3D.Modeling.File.ModelFile!
static SA3D.Modeling.File.ModelFile.ReadFromFile(string! filepath) -> SA3D.Modeling.File.ModelFile!
static SA3D.Modeling.File.ModelFile.Write(SA3D.Common.IO.EndianStackWriter! writer, SA3D.Modeling.ObjectData.Node! model, bool nj = false, SA3D.Modeling.File.MetaData? metaData = null, SA3D.Modeling.ObjectData.Enums.ModelFormat? format = null) -> void
static SA3D.Modeling.File.ModelFile.WriteToData(SA3D.Modeling.ObjectData.Node! model, bool nj = false, SA3D.Modeling.File.MetaData? metaData = null, SA3D.Modeling.ObjectData.Enums.ModelFormat? format = null) -> byte[]!
static SA3D.Modeling.File.ModelFile.WriteToBytes(SA3D.Modeling.ObjectData.Node! model, bool nj = false, SA3D.Modeling.File.MetaData? metaData = null, SA3D.Modeling.ObjectData.Enums.ModelFormat? format = null) -> byte[]!
static SA3D.Modeling.File.ModelFile.WriteToFile(string! filepath, SA3D.Modeling.ObjectData.Node! model, bool nj = false, SA3D.Modeling.File.MetaData? metaData = null, SA3D.Modeling.ObjectData.Enums.ModelFormat? format = null) -> void
static SA3D.Modeling.Mesh.Attach.Read(SA3D.Common.IO.EndianStackReader! reader, uint address, SA3D.Modeling.ObjectData.Enums.ModelFormat format, SA3D.Modeling.Structs.PointerLUT! lut) -> SA3D.Modeling.Mesh.Attach!
static SA3D.Modeling.Mesh.Attach.ReadBuffer(SA3D.Common.IO.EndianStackReader! reader, uint address, SA3D.Modeling.Structs.PointerLUT! lut) -> SA3D.Modeling.Mesh.Attach!
Expand Down

0 comments on commit cdf0412

Please sign in to comment.