Skip to content

Commit 7356bdd

Browse files
committed
rename NUtils to NHelper
1 parent b41e995 commit 7356bdd

File tree

17 files changed

+53
-55
lines changed

17 files changed

+53
-55
lines changed

src/http/partials/Websocket/HTTP.WebSocketTo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,10 @@ private async void ReceiveJob(object _)
299299
? MessageType.Text
300300
: MessageType.Binary;
301301

302-
var stream = NUtils.NewStream(data.LongLength);
302+
var stream = NHelper.NewStream(data.LongLength);
303303
await stream.WriteAsync(data, 0, data.Length);
304304

305-
if (NMessage.TryParse(stream, out var name, out var message, NUtils.NewStream))
305+
if (NMessage.TryParse(stream, out var name, out var message, NHelper.NewStream))
306306
{
307307
var reference = new byte[message.Length];
308308
message.Position = 0;

src/netly/NEnvironment.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/// Provides general information about the Netly library,
55
/// including its name, version, Git repository, and supported protocols.
66
/// </summary>
7-
public static partial class NEnvironment
7+
public static class NEnvironment
88
{
99
/// <summary>
1010
/// The name of the library.

src/netly/NFraming.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,13 @@ public void Write(ArraySegment<byte> segment, Func<long, Stream> getStream)
159159
throw new InvalidDataException($"{nameof(size)}: {size}");
160160

161161
// get and verify prefix
162-
if (NUtils.ArraySequenced(Prefix, _headerBuffer))
162+
if (NHelper.ArraySequenced(Prefix, _headerBuffer))
163163
_transactions.AddLast(new Transaction(getStream(size), false));
164164
else
165165
throw new InvalidDataException(
166-
$"{nameof(Prefix)}: {NUtils.Format(Prefix)} - {NUtils.Format(_headerBuffer)}");
166+
$"{nameof(Prefix)}: {NHelper.Format(Prefix)} - {NHelper.Format(_headerBuffer)}");
167167

168-
segment = NUtils.SegmentShift(segment, copied);
168+
segment = NHelper.SegmentShift(segment, copied);
169169
_size = size;
170170
_headerOffset = 0;
171171
_transactions.Last.Value.Stream.Position = 0;
@@ -196,7 +196,7 @@ public void Write(ArraySegment<byte> segment, Func<long, Stream> getStream)
196196

197197
if (left > 0)
198198
{
199-
segment = NUtils.SegmentShift(segment, count);
199+
segment = NHelper.SegmentShift(segment, count);
200200
continue; // REQUIRED: Read new stream again!
201201
}
202202
}
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44

55
namespace Netly
66
{
7-
public static class NUtils
7+
public static class NHelper
88
{
99
/// <summary>
10-
/// Returns a new <see cref="ArraySegment{T}"/> shifted by the specified number of elements.
11-
/// If the shift is greater than or equal to the segment count, an empty segment at the end is returned.
10+
/// Returns a new <see cref="ArraySegment{T}" /> shifted by the specified number of elements.
11+
/// If the shift is greater than or equal to the segment count, an empty segment at the end is returned.
1212
/// </summary>
1313
/// <typeparam name="T">The type of elements in the array segment.</typeparam>
1414
/// <param name="segment">The original array segment.</param>
1515
/// <param name="shift">The number of elements to skip from the start.</param>
1616
/// <returns>A new array segment representing the shifted portion.</returns>
17-
/// <exception cref="ArgumentOutOfRangeException">Thrown if <paramref name="shift"/> is negative.</exception>
18-
/// <exception cref="ArgumentNullException">Thrown if the array in <paramref name="segment"/> is null.</exception>
17+
/// <exception cref="ArgumentOutOfRangeException">Thrown if <paramref name="shift" /> is negative.</exception>
18+
/// <exception cref="ArgumentNullException">Thrown if the array in <paramref name="segment" /> is null.</exception>
1919
public static ArraySegment<T> SegmentShift<T>(ArraySegment<T> segment, int shift)
2020
{
2121
if (shift < 0)
@@ -30,15 +30,15 @@ public static ArraySegment<T> SegmentShift<T>(ArraySegment<T> segment, int shift
3030
}
3131

3232
/// <summary>
33-
/// Compares all elements in the given array to determine if they are equal.
34-
/// For arrays with more than one element, returns true if all elements are the same.
33+
/// Compares all elements in the given array to determine if they are equal.
34+
/// For arrays with more than one element, returns true if all elements are the same.
3535
/// </summary>
3636
/// <typeparam name="T">The type of elements in the array. Must support equality comparison.</typeparam>
3737
/// <param name="array">The array of elements to compare.</param>
3838
/// <returns>
39-
/// True if all elements are equal or the array has zero or one element; otherwise, false.
39+
/// True if all elements are equal or the array has zero or one element; otherwise, false.
4040
/// </returns>
41-
/// <exception cref="ArgumentNullException">Thrown if <paramref name="array"/> is null.</exception>
41+
/// <exception cref="ArgumentNullException">Thrown if <paramref name="array" /> is null.</exception>
4242
public static bool ArraySequenced<T>(params T[][] array)
4343
{
4444
if (array == null)
@@ -57,7 +57,7 @@ public static bool ArraySequenced<T>(params T[][] array)
5757
}
5858

5959
/// <summary>
60-
/// Returns a string representation of an array in the format [elem1,elem2,...].
60+
/// Returns a string representation of an array in the format [elem1,elem2,...].
6161
/// </summary>
6262
/// <typeparam name="T">The type of elements in the array.</typeparam>
6363
/// <param name="elements">The array to format.</param>
@@ -68,13 +68,13 @@ public static string Format<T>(T[] elements)
6868
}
6969

7070
/// <summary>
71-
/// Concatenates all elements of the given array into a new array.
72-
/// This is mainly useful if you want a copy of the array or to combine multiple arrays later.
71+
/// Concatenates all elements of the given array into a new array.
72+
/// This is mainly useful if you want a copy of the array or to combine multiple arrays later.
7373
/// </summary>
7474
/// <typeparam name="T">The type of elements in the array.</typeparam>
7575
/// <param name="elements">The array of elements to concatenate.</param>
7676
/// <returns>A new array containing all elements from the input array in order.</returns>
77-
/// <exception cref="ArgumentNullException">Thrown if <paramref name="elements"/> is null.</exception>
77+
/// <exception cref="ArgumentNullException">Thrown if <paramref name="elements" /> is null.</exception>
7878
public static T[] ArrayConcat<T>(params T[][] elements)
7979
{
8080
if (elements == null)
@@ -99,7 +99,7 @@ public static T[] ArrayConcat<T>(params T[][] elements)
9999
/// Throws <see cref="InternalBufferOverflowException" /> if the size exceeds the default maximum.
100100
/// </summary>
101101
/// <param name="size">The desired size of the stream.</param>
102-
/// <returns>A <see cref="Stream"/> with the specified size.</returns>
102+
/// <returns>A <see cref="Stream" /> with the specified size.</returns>
103103
public static Stream NewStream(long size)
104104
{
105105
if (size <= 1024 * 1024 * 20) // 20.00 MB

src/netly/NLogger.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ public void Submit<T>(T value)
6969
/// </summary>
7070
/// <param name="callback">The action to call with each log message.</param>
7171
/// <param name="forceImmediateDispatcherMode">
72-
/// If true, the callback is executed immediately on the submitting thread.<br/>
73-
/// If false, the callback is enqueued using the available <see cref="NDispatcher"/> instance.
72+
/// If true, the callback is executed immediately on the submitting thread.<br />
73+
/// If false, the callback is enqueued using the available <see cref="NDispatcher" /> instance.
7474
/// </param>
7575
public void OnSubmit(Action<string> callback, bool forceImmediateDispatcherMode = false)
7676
{

src/netly/NMessage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public static bool TryParse(Stream stream, out string name, out Stream message,
126126

127127
var offset = 0;
128128

129-
if (!NUtils.ArraySequenced(Prefix, header))
129+
if (!NHelper.ArraySequenced(Prefix, header))
130130
return false;
131131

132132
offset += Prefix.Length;

src/netly/tcp/NTcp.Client.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ public partial class NTcp
44
{
55
public class Client
66
{
7-
87
}
98
}
109
}

src/netly/tcp/NTcp.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ namespace Netly
22
{
33
public partial class NTcp
44
{
5-
65
}
76
}

src/package/NTcpClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class NTcpClient : INTcpClient
3434
private NTcpClient()
3535
{
3636
_server = null;
37-
_onStream = NUtils.NewStream;
37+
_onStream = NHelper.NewStream;
3838
Host = NHost.Default;
3939
IsConnected = false;
4040
SecureProtocol = SslProtocols.Default;

src/package/NTcpServer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ private NTcpServer()
3333
IsFraming = false;
3434
AllowUnsecured = false;
3535
FramingSize = NFraming.DefaultSize;
36-
OnStreamObject = NUtils.NewStream;
36+
OnStreamObject = NHelper.NewStream;
3737
OnSecureObject = new List<Func<X509Certificate, X509Chain, SslPolicyErrors, bool>>();
3838
Socket = null;
3939
Certificate = new X509Certificate();

0 commit comments

Comments
 (0)