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

◆ Add() [4/5]

void System.Xml.Resolvers.XmlPreloadedResolver.Add ( Uri uri,
Stream value )
inline

Definition at line 282 of file XmlPreloadedResolver.cs.

283 {
284 if (uri == null)
285 {
286 throw new ArgumentNullException("uri");
287 }
288 if (value == null)
289 {
290 throw new ArgumentNullException("value");
291 }
292 checked
293 {
294 if (value.CanSeek)
295 {
296 int num = (int)value.Length;
297 byte[] array = new byte[num];
298 value.Read(array, 0, num);
299 Add(uri, new ByteArrayChunk(array));
300 return;
301 }
303 byte[] array2 = new byte[4096];
304 int count;
305 while ((count = value.Read(array2, 0, array2.Length)) > 0)
306 {
307 memoryStream.Write(array2, 0, count);
308 }
309 int num2 = (int)memoryStream.Position;
310 byte[] array3 = new byte[num2];
311 Array.Copy(memoryStream.ToArray(), array3, num2);
312 Add(uri, new ByteArrayChunk(array3));
313 }
314 }

References System.Add, System.array, System.Array.Copy(), System.count, System.Xml.Dictionary, and System.value.