Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
BinaryFormatter.cs
Go to the documentation of this file.
3using System.IO;
4
6
7public sealed class BinaryFormatter : IFormatter
8{
10
12
14
16
18
20
22
23 internal object[] _crossAppDomainArray;
24
26 {
27 get
28 {
29 return _typeFormat;
30 }
31 set
32 {
34 }
35 }
36
38 {
39 get
40 {
41 return _assemblyFormat;
42 }
43 set
44 {
46 }
47 }
48
50 {
51 get
52 {
53 return _securityLevel;
54 }
55 set
56 {
58 }
59 }
60
62 {
63 get
64 {
65 return _surrogates;
66 }
67 set
68 {
70 }
71 }
72
74 {
75 get
76 {
77 return _binder;
78 }
79 set
80 {
81 _binder = value;
82 }
83 }
84
86 {
87 get
88 {
89 return _context;
90 }
91 set
92 {
94 }
95 }
96
101
103 {
104 _surrogates = selector;
105 _context = context;
106 }
107
117
118 [Obsolete("BinaryFormatter serialization is obsolete and should not be used. See https://aka.ms/binaryformatter for more information.", DiagnosticId = "SYSLIB0011", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
119 [RequiresUnreferencedCode("BinaryFormatter serialization is not trim compatible because the Type of objects being processed cannot be statically discovered.")]
121 {
123 {
125 }
126 if (serializationStream == null)
127 {
128 throw new ArgumentNullException("serializationStream");
129 }
130 if (serializationStream.CanSeek && serializationStream.Length == 0L)
131 {
133 }
135 {
137 _serializerTypeEnum = InternalSerializerTypeE.Binary,
140 };
142 {
144 };
145 try
146 {
147 BinaryFormatterEventSource.Log.DeserializationStart();
149 return objectReader.Deserialize(serParser);
150 }
152 {
153 throw;
154 }
156 {
158 }
159 finally
160 {
161 BinaryFormatterEventSource.Log.DeserializationStop();
162 }
163 }
164
165 [Obsolete("BinaryFormatter serialization is obsolete and should not be used. See https://aka.ms/binaryformatter for more information.", DiagnosticId = "SYSLIB0011", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
166 [RequiresUnreferencedCode("BinaryFormatter serialization is not trim compatible because the Type of objects being processed cannot be statically discovered.")]
168 {
170 {
172 }
173 if (serializationStream == null)
174 {
175 throw new ArgumentNullException("serializationStream");
176 }
178 {
180 _serializerTypeEnum = InternalSerializerTypeE.Binary,
182 };
183 try
184 {
185 BinaryFormatterEventSource.Log.SerializationStart();
188 objectWriter.Serialize(graph, serWriter);
189 _crossAppDomainArray = objectWriter._crossAppDomainArray;
190 }
191 finally
192 {
193 BinaryFormatterEventSource.Log.SerializationStop();
194 }
195 }
196}
static string GetClrAssemblyName(Type type, out bool hasTypeForwardedFrom)
void Serialize(Stream serializationStream, object graph)
BinaryFormatter(ISurrogateSelector? selector, StreamingContext context)
static readonly ConcurrentDictionary< Type, TypeInformation > s_typeNameCache
static string Serialization_CorruptedStream
Definition SR.cs:74
static string BinaryFormatter_SerializationDisallowed
Definition SR.cs:2180
static string Serialization_Stream
Definition SR.cs:76
Definition SR.cs:7