Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ThrowHelper.cs
Go to the documentation of this file.
4
5namespace System;
6
7internal static class ThrowHelper
8{
9 [DoesNotReturn]
10 internal static void ThrowArgumentNullException(System.ExceptionArgument argument)
11 {
13 }
14
15 [MethodImpl(MethodImplOptions.NoInlining)]
16 private static Exception CreateArgumentNullException(System.ExceptionArgument argument)
17 {
18 return new ArgumentNullException(argument.ToString());
19 }
20
21 [DoesNotReturn]
22 internal static void ThrowArgumentOutOfRangeException(System.ExceptionArgument argument)
23 {
25 }
26
27 [MethodImpl(MethodImplOptions.NoInlining)]
29 {
30 return new ArgumentOutOfRangeException(argument.ToString());
31 }
32
33 [DoesNotReturn]
34 internal static void ThrowInvalidOperationException()
35 {
37 }
38
39 [MethodImpl(MethodImplOptions.NoInlining)]
41 {
42 return new InvalidOperationException();
43 }
44
45 [DoesNotReturn]
50
51 [MethodImpl(MethodImplOptions.NoInlining)]
56
57 [DoesNotReturn]
62
63 [MethodImpl(MethodImplOptions.NoInlining)]
68
69 [DoesNotReturn]
74
75 [MethodImpl(MethodImplOptions.NoInlining)]
80
81 [DoesNotReturn]
86
87 [MethodImpl(MethodImplOptions.NoInlining)]
89 {
90 return new ObjectDisposedException("ArrayMemoryPoolBuffer");
91 }
92
93 [DoesNotReturn]
98
100 {
101 if (startSegment == null)
102 {
103 return CreateArgumentNullException(System.ExceptionArgument.startSegment);
104 }
105 if (endSegment == null)
106 {
107 return CreateArgumentNullException(System.ExceptionArgument.endSegment);
108 }
109 if (startSegment != endSegment && startSegment.RunningIndex > endSegment.RunningIndex)
110 {
111 return CreateArgumentOutOfRangeException(System.ExceptionArgument.endSegment);
112 }
113 if ((uint)startSegment.Memory.Length < (uint)startIndex)
114 {
115 return CreateArgumentOutOfRangeException(System.ExceptionArgument.startIndex);
116 }
117 return CreateArgumentOutOfRangeException(System.ExceptionArgument.endIndex);
118 }
119
120 [DoesNotReturn]
125
127 {
128 if (array == null)
129 {
130 return CreateArgumentNullException(System.ExceptionArgument.array);
131 }
132 if ((uint)start > (uint)array.Length)
133 {
134 return CreateArgumentOutOfRangeException(System.ExceptionArgument.start);
135 }
136 return CreateArgumentOutOfRangeException(System.ExceptionArgument.length);
137 }
138
139 [DoesNotReturn]
144
146 {
147 if (start < 0)
148 {
149 return CreateArgumentOutOfRangeException(System.ExceptionArgument.start);
150 }
151 return CreateArgumentOutOfRangeException(System.ExceptionArgument.length);
152 }
153}
static string EndPositionNotReached
Definition SR.cs:14
Definition SR.cs:7
static Exception CreateArgumentNullException(System.ExceptionArgument argument)
static Exception CreateInvalidOperationException()
static void ThrowArgumentOutOfRangeException(System.ExceptionArgument argument)
static Exception CreateArgumentOutOfRangeException(System.ExceptionArgument argument)
static void ThrowInvalidOperationException()
static void ThrowArgumentOutOfRangeException_PositionOutOfRange()
static Exception CreateInvalidOperationException_EndPositionNotReached()
static Exception CreateArgumentValidationException(Array array, int start)
static Exception CreateArgumentOutOfRangeException_PositionOutOfRange()
static void ThrowStartOrEndArgumentValidationException(long start)
static Exception CreateStartOrEndArgumentValidationException(long start)
static void ThrowArgumentValidationException< T >(ReadOnlySequenceSegment< T > startSegment, int startIndex, ReadOnlySequenceSegment< T > endSegment)
static void ThrowInvalidOperationException_EndPositionNotReached()
static void ThrowArgumentOutOfRangeException_OffsetOutOfRange()
static void ThrowArgumentNullException(System.ExceptionArgument argument)
static Exception CreateArgumentOutOfRangeException_OffsetOutOfRange()
static Exception CreateObjectDisposedException_ArrayMemoryPoolBuffer()
static void ThrowObjectDisposedException_ArrayMemoryPoolBuffer()
static Exception CreateArgumentValidationException< T >(ReadOnlySequenceSegment< T > startSegment, int startIndex, ReadOnlySequenceSegment< T > endSegment)
static void ThrowArgumentValidationException(Array array, int start)