mirror of
https://github.com/whoswhip/RhythiaLib.git
synced 2026-12-05 09:18:42 +00:00
feat: add RhrFile xml comments
This commit is contained in:
@@ -4,6 +4,13 @@ namespace RhythiaLib.Rhr
|
|||||||
{
|
{
|
||||||
public static class RhrFile
|
public static class RhrFile
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reads a replay from the specified file.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path">The path of the RHR file to read.</param>
|
||||||
|
/// <param name="options">Optional settings that control resource limits.</param>
|
||||||
|
/// <returns>The replay decoded from the file.</returns>
|
||||||
public static RhrReplay Read(string path, RhrReadOptions? options = null)
|
public static RhrReplay Read(string path, RhrReadOptions? options = null)
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNullOrWhiteSpace(path);
|
ArgumentNullException.ThrowIfNullOrWhiteSpace(path);
|
||||||
@@ -12,11 +19,23 @@ namespace RhythiaLib.Rhr
|
|||||||
return Read(stream, options);
|
return Read(stream, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Read a replay from the specified stream.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="stream">A readable stream at the beginning of a replay.</param>
|
||||||
|
/// <param name="options">Optional settings that control resource limits.</param>
|
||||||
|
/// <returns>The replay decoded from the stream.</returns>
|
||||||
|
/// <remarks>This method will not close or dispose <paramref name="stream"/></remarks>
|
||||||
public static RhrReplay Read(Stream stream, RhrReadOptions? options = null)
|
public static RhrReplay Read(Stream stream, RhrReadOptions? options = null)
|
||||||
{
|
{
|
||||||
return RhrReader.Read(stream, options ?? new RhrReadOptions());
|
return RhrReader.Read(stream, options ?? new RhrReadOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes a replay to the specified file.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path">The destination file path. Will overwrite any existing file.</param>
|
||||||
|
/// <param name="replay">The replay to encode and write.</param>
|
||||||
public static void Write(string path, RhrReplay replay)
|
public static void Write(string path, RhrReplay replay)
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNullOrWhiteSpace(path);
|
ArgumentNullException.ThrowIfNullOrWhiteSpace(path);
|
||||||
@@ -24,11 +43,22 @@ namespace RhythiaLib.Rhr
|
|||||||
Write(stream, replay);
|
Write(stream, replay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes a replay to the specified stream.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="stream">A writable stream that will recieve the encoded replay.</param>
|
||||||
|
/// <param name="replay">The replay to encode and write.</param>
|
||||||
|
/// <remarks>This method writes at the stream's current position and does not close or dispose <paramref name="stream"/></remarks>
|
||||||
public static void Write(Stream stream, RhrReplay replay)
|
public static void Write(Stream stream, RhrReplay replay)
|
||||||
{
|
{
|
||||||
RhrWriter.Write(stream, replay);
|
RhrWriter.Write(stream, replay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Encodes and RHR replay into a new byte array.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="replay">The replay to encode.</param>
|
||||||
|
/// <returns>A byte array containing the encoded replay.</returns>
|
||||||
public static byte[] Encode(RhrReplay replay)
|
public static byte[] Encode(RhrReplay replay)
|
||||||
{
|
{
|
||||||
using var stream = new MemoryStream();
|
using var stream = new MemoryStream();
|
||||||
@@ -36,6 +66,12 @@ namespace RhythiaLib.Rhr
|
|||||||
return stream.ToArray();
|
return stream.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Decodes a replay from the specified bytes.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="data">The encoded replay data.</param>
|
||||||
|
/// <param name="options">Optional settings that control resource limits.</param>
|
||||||
|
/// <returns>The replay decoded from <paramref name="data"/>ww</returns>
|
||||||
public static RhrReplay Decode(ReadOnlySpan<byte> data, RhrReadOptions? options = null)
|
public static RhrReplay Decode(ReadOnlySpan<byte> data, RhrReadOptions? options = null)
|
||||||
{
|
{
|
||||||
byte[] buffer = data.ToArray();
|
byte[] buffer = data.ToArray();
|
||||||
|
|||||||
Reference in New Issue
Block a user