Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
IntSizedArray.cs
Go to the documentation of this file.
1
namespace
System.Runtime.Serialization.Formatters.Binary
;
2
3
internal
sealed
class
IntSizedArray
:
ICloneable
4
{
5
internal
int
[]
_objects
=
new
int
[16];
6
7
internal
int
[]
_negObjects
=
new
int
[4];
8
9
internal
int
this
[
int
index
]
10
{
11
get
12
{
13
if
(
index
< 0)
14
{
15
if
(-
index
<=
_negObjects
.Length - 1)
16
{
17
return
_negObjects
[-
index
];
18
}
19
return
0;
20
}
21
if
(
index
<=
_objects
.Length - 1)
22
{
23
return
_objects
[
index
];
24
}
25
return
0;
26
}
27
set
28
{
29
if
(
index
< 0)
30
{
31
if
(-
index
>
_negObjects
.Length - 1)
32
{
33
IncreaseCapacity
(
index
);
34
}
35
_negObjects
[-
index
] =
value
;
36
}
37
else
38
{
39
if
(
index
>
_objects
.Length - 1)
40
{
41
IncreaseCapacity
(
index
);
42
}
43
_objects
[
index
] =
value
;
44
}
45
}
46
}
47
48
public
IntSizedArray
()
49
{
50
}
51
52
private
IntSizedArray
(
IntSizedArray
sizedArray
)
53
{
54
_objects
=
new
int
[
sizedArray
._objects.Length];
55
sizedArray
._objects.CopyTo(
_objects
, 0);
56
_negObjects
=
new
int
[
sizedArray
._negObjects.Length];
57
sizedArray
._negObjects.CopyTo(
_negObjects
, 0);
58
}
59
60
public
object
Clone
()
61
{
62
return
new
IntSizedArray
(
this
);
63
}
64
65
internal
void
IncreaseCapacity
(
int
index
)
66
{
67
try
68
{
69
if
(
index
< 0)
70
{
71
int
num =
Math
.
Max
(
_negObjects
.Length * 2, -
index
+ 1);
72
int
[]
array
=
new
int
[num];
73
Array
.
Copy
(
_negObjects
,
array
,
_negObjects
.Length);
74
_negObjects
=
array
;
75
}
76
else
77
{
78
int
num2
=
Math
.
Max
(
_objects
.Length * 2,
index
+ 1);
79
int
[]
array2
=
new
int
[
num2
];
80
Array
.
Copy
(
_objects
,
array2
,
_objects
.Length);
81
_objects
=
array2
;
82
}
83
}
84
catch
(
Exception
)
85
{
86
throw
new
SerializationException
(
System
.
SR
.
Serialization_CorruptedStream
);
87
}
88
}
89
}
System.Array.Copy
static unsafe void Copy(Array sourceArray, Array destinationArray, int length)
Definition
Array.cs:624
System.Array
Definition
Array.cs:16
System.Exception
Definition
Exception.cs:15
System.Math.Max
static byte Max(byte val1, byte val2)
Definition
Math.cs:738
System.Math
Definition
Math.cs:13
System.Runtime.Serialization.Formatters.Binary.IntSizedArray.IncreaseCapacity
void IncreaseCapacity(int index)
Definition
IntSizedArray.cs:65
System.Runtime.Serialization.Formatters.Binary.IntSizedArray.IntSizedArray
IntSizedArray()
Definition
IntSizedArray.cs:48
System.Runtime.Serialization.Formatters.Binary.IntSizedArray._negObjects
int[] _negObjects
Definition
IntSizedArray.cs:7
System.Runtime.Serialization.Formatters.Binary.IntSizedArray._objects
int[] _objects
Definition
IntSizedArray.cs:5
System.Runtime.Serialization.Formatters.Binary.IntSizedArray.Clone
object Clone()
Definition
IntSizedArray.cs:60
System.Runtime.Serialization.Formatters.Binary.IntSizedArray.IntSizedArray
IntSizedArray(IntSizedArray sizedArray)
Definition
IntSizedArray.cs:52
System.Runtime.Serialization.Formatters.Binary.IntSizedArray
Definition
IntSizedArray.cs:4
System.Runtime.Serialization.SerializationException
Definition
SerializationException.cs:8
System.SR.Serialization_CorruptedStream
static string Serialization_CorruptedStream
Definition
SR.cs:74
System.SR
Definition
SR.cs:7
System.ICloneable
Definition
ICloneable.cs:4
System.Runtime.Serialization.Formatters.Binary
Definition
BinaryArray.cs:1
System.Runtime.Serialization.CollectionKind.Dictionary
@ Dictionary
System.ExceptionArgument.value
@ value
System.ExceptionArgument.index
@ index
System.ExceptionArgument.array
@ array
System
Definition
BlockingCollection.cs:8
source
System.Runtime.Serialization.Formatters
System.Runtime.Serialization.Formatters.Binary
IntSizedArray.cs
Generated by
1.10.0