Skip to content

Commit ff933d0

Browse files
committed
docs(CompressionHelper): 更新压缩解压缩辅助类的文档注释
将中文注释转换为中英双语格式,提高代码的可读性和国际化支持
1 parent ec31e40 commit ff933d0

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

GameFrameX.Utility/CompressionHelper.cs

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,30 @@
3636
namespace GameFrameX.Utility;
3737

3838
/// <summary>
39-
/// 压缩解压缩辅助器。
39+
/// Compression and decompression helper.
4040
/// </summary>
41+
/// <remarks>
42+
/// 压缩解压缩辅助器。
43+
/// </remarks>
4144
public static class CompressionHelper
4245
{
4346
/// <summary>
44-
/// 用于压缩和解压缩操作的缓冲区大小(以字节为单位)
47+
/// Buffer size in bytes for compression and decompression operations
4548
/// </summary>
49+
/// <remarks>
50+
/// 用于压缩和解压缩操作的缓冲区大小(以字节为单位)
51+
/// </remarks>
4652
private const int BufferSize = 8192;
4753

4854
/// <summary>
49-
/// 压缩数据。使用Deflate算法将原始字节数组压缩成更小的字节数组。
55+
/// Compresses data. Uses the Deflate algorithm to compress the original byte array into a smaller byte array.
5056
/// </summary>
51-
/// <param name="bytes">要压缩的原始字节数组。不能为null。</param>
52-
/// <returns>压缩后的字节数组。如果输入为空数组,则直接返回该空数组。如果压缩过程中发生异常,则返回原始数组。</returns>
53-
/// <exception cref="ArgumentNullException">当输入参数bytes为null时抛出。</exception>
57+
/// <remarks>
58+
/// 压缩数据。使用Deflate算法将原始字节数组压缩成更小的字节数组。
59+
/// </remarks>
60+
/// <param name="bytes">The original byte array to be compressed. Cannot be null. / 要压缩的原始字节数组。不能为null。</param>
61+
/// <returns>The compressed byte array. If the input is an empty array, returns the empty array directly. If an exception occurs during compression, returns the original array. / 压缩后的字节数组。如果输入为空数组,则直接返回该空数组。如果压缩过程中发生异常,则返回原始数组。</returns>
62+
/// <exception cref="ArgumentNullException">Thrown when the input parameter bytes is null. / 当输入参数bytes为null时抛出。</exception>
5463
public static byte[] Compress(byte[] bytes)
5564
{
5665
ArgumentNullException.ThrowIfNull(bytes, nameof(bytes));
@@ -90,12 +99,15 @@ public static byte[] Compress(byte[] bytes)
9099
}
91100

92101
/// <summary>
93-
/// 解压数据。使用Inflate算法将压缩的字节数组还原成原始字节数组。
102+
/// Decompresses data. Uses the Inflate algorithm to restore the compressed byte array to the original byte array.
94103
/// </summary>
95-
/// <param name="bytes">要解压的压缩字节数组。不能为null。</param>
96-
/// <returns>解压后的原始字节数组。如果输入为空数组,则直接返回该空数组。如果解压过程中发生异常,则返回原始数组。</returns>
97-
/// <exception cref="ArgumentNullException">当输入参数bytes为null时抛出。</exception>
98-
/// <exception cref="InvalidDataException">当压缩数据格式无效或已损坏时抛出。</exception>
104+
/// <remarks>
105+
/// 解压数据。使用Inflate算法将压缩的字节数组还原成原始字节数组。
106+
/// </remarks>
107+
/// <param name="bytes">The compressed byte array to be decompressed. Cannot be null. / 要解压的压缩字节数组。不能为null。</param>
108+
/// <returns>The decompressed original byte array. If the input is an empty array, returns the empty array directly. If an exception occurs during decompression, returns the original array. / 解压后的原始字节数组。如果输入为空数组,则直接返回该空数组。如果解压过程中发生异常,则返回原始数组。</returns>
109+
/// <exception cref="ArgumentNullException">Thrown when the input parameter bytes is null. / 当输入参数bytes为null时抛出。</exception>
110+
/// <exception cref="InvalidDataException">Thrown when the compressed data format is invalid or corrupted. / 当压缩数据格式无效或已损坏时抛出。</exception>
99111
public static byte[] Decompress(byte[] bytes)
100112
{
101113
ArgumentNullException.ThrowIfNull(bytes, nameof(bytes));

0 commit comments

Comments
 (0)