Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
RangeValidationHelpers.cs
Go to the documentation of this file.
1namespace System.Net;
2
3internal static class RangeValidationHelpers
4{
5 public static bool ValidateRange(int actual, int fromAllowed, int toAllowed)
6 {
7 if (actual >= fromAllowed)
8 {
9 return actual <= toAllowed;
10 }
11 return false;
12 }
13
14 public static void ValidateSegment(ArraySegment<byte> segment)
15 {
16 if (segment.Array == null)
17 {
18 throw new ArgumentNullException("segment");
19 }
20 if (segment.Offset < 0 || segment.Count < 0 || segment.Count > segment.Array.Length - segment.Offset)
21 {
22 throw new ArgumentOutOfRangeException("segment");
23 }
24 }
25}
static bool ValidateRange(int actual, int fromAllowed, int toAllowed)
static void ValidateSegment(ArraySegment< byte > segment)