Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetChars() [1/2]

override long System.Data.Common.DataRecordInternal.GetChars ( int i,
long dataIndex,
char[] buffer,
int bufferIndex,
int length )
inline

Definition at line 131 of file DataRecordInternal.cs.

132 {
133 string text = (string)_values[i];
134 char[] array = text.ToCharArray();
135 int num = array.Length;
136 if (dataIndex > int.MaxValue)
137 {
138 throw ADP.InvalidSourceBufferIndex(num, dataIndex, "dataIndex");
139 }
140 int num2 = (int)dataIndex;
141 if (buffer == null)
142 {
143 return num;
144 }
145 try
146 {
147 if (num2 < num)
148 {
149 num = ((num2 + length <= num) ? length : (num - num2));
150 }
151 Array.Copy(array, num2, buffer, bufferIndex, num);
152 }
153 catch (Exception e) when (ADP.IsCatchableExceptionType(e))
154 {
155 num = array.Length;
156 if (length < 0)
157 {
158 throw ADP.InvalidDataLength(length);
159 }
160 if (bufferIndex < 0 || bufferIndex >= buffer.Length)
161 {
162 throw ADP.InvalidDestinationBufferIndex(buffer.Length, bufferIndex, "bufferIndex");
163 }
164 if (num2 < 0 || num2 >= num)
165 {
166 throw ADP.InvalidSourceBufferIndex(num, dataIndex, "dataIndex");
167 }
168 if (num + bufferIndex > buffer.Length)
169 {
170 throw ADP.InvalidBufferSizeOrIndex(num, bufferIndex);
171 }
172 }
173 return num;
174 }

References System.Data.Common.DataRecordInternal._values, System.array, System.buffer, System.Array.Copy(), System.Data.Common.ADP.InvalidBufferSizeOrIndex(), System.Data.Common.ADP.InvalidDataLength(), System.Data.Common.ADP.InvalidDestinationBufferIndex(), System.Data.Common.ADP.InvalidSourceBufferIndex(), System.Data.Common.ADP.IsCatchableExceptionType(), System.length, and System.text.