diff --git a/RhythiaLib/Rhr/RhrFile.cs b/RhythiaLib/Rhr/RhrFile.cs index 1d3d653..85e2ca7 100644 --- a/RhythiaLib/Rhr/RhrFile.cs +++ b/RhythiaLib/Rhr/RhrFile.cs @@ -4,6 +4,13 @@ namespace RhythiaLib.Rhr { public static class RhrFile { + + /// + /// Reads a replay from the specified file. + /// + /// The path of the RHR file to read. + /// Optional settings that control resource limits. + /// The replay decoded from the file. public static RhrReplay Read(string path, RhrReadOptions? options = null) { ArgumentNullException.ThrowIfNullOrWhiteSpace(path); @@ -12,11 +19,23 @@ namespace RhythiaLib.Rhr return Read(stream, options); } + /// + /// Read a replay from the specified stream. + /// + /// A readable stream at the beginning of a replay. + /// Optional settings that control resource limits. + /// The replay decoded from the stream. + /// This method will not close or dispose public static RhrReplay Read(Stream stream, RhrReadOptions? options = null) { return RhrReader.Read(stream, options ?? new RhrReadOptions()); } + /// + /// Writes a replay to the specified file. + /// + /// The destination file path. Will overwrite any existing file. + /// The replay to encode and write. public static void Write(string path, RhrReplay replay) { ArgumentNullException.ThrowIfNullOrWhiteSpace(path); @@ -24,11 +43,22 @@ namespace RhythiaLib.Rhr Write(stream, replay); } + /// + /// Writes a replay to the specified stream. + /// + /// A writable stream that will recieve the encoded replay. + /// The replay to encode and write. + /// This method writes at the stream's current position and does not close or dispose public static void Write(Stream stream, RhrReplay replay) { RhrWriter.Write(stream, replay); } + /// + /// Encodes and RHR replay into a new byte array. + /// + /// The replay to encode. + /// A byte array containing the encoded replay. public static byte[] Encode(RhrReplay replay) { using var stream = new MemoryStream(); @@ -36,6 +66,12 @@ namespace RhythiaLib.Rhr return stream.ToArray(); } + /// + /// Decodes a replay from the specified bytes. + /// + /// The encoded replay data. + /// Optional settings that control resource limits. + /// The replay decoded from ww public static RhrReplay Decode(ReadOnlySpan data, RhrReadOptions? options = null) { byte[] buffer = data.ToArray();