9 protected InputArchive(
int version,
object context) : base(version, context) { }
11 protected new void Reset(
int version,
object context) {
12 base.Reset(version, context);
17 public abstract void Serialize(
string name, ref sbyte value);
19 public abstract void Serialize(
string name, ref
byte value);
21 public abstract void Serialize(
string name, ref
short value);
23 public abstract void Serialize(
string name, ref ushort value);
25 public abstract void Serialize(
string name, ref
int value);
27 public abstract void Serialize(
string name, ref uint value);
29 public abstract void Serialize(
string name, ref
long value);
31 public abstract void Serialize(
string name, ref ulong value);
33 public abstract void Serialize(
string name, ref
float value);
35 public abstract void Serialize(
string name, ref
double value);
37 public abstract void Serialize(
string name, ref
bool value);
39 public abstract void Serialize(
string name, ref
char value);
41 public abstract void Serialize(
string name, ref
string value);
43 public abstract void Serialize(
string name, ref
byte[] value);
45 public abstract void Serialize(
string name,
int length, ref
byte[] value);
51 public void Serialize(
string name, Type type, ref
object value) {
55 public void Serialize(
string name, Type type,
object value) {
57 throw new InvalidOperationException(
"Value cannot be null");
90 SerializeCollection(name, list);
96 SerializeCollection(name, list);
97 foreach (T item
in list) {
103 Dictionary<K, V> dictionary =
new();
104 SerializeDictionary(name, dictionary);
109 for (
int num =
m_stack.Count - 1; num >= 0; num--) {
110 if (
m_stack[num] is T result) {
114 if (throwIfNotFound) {
115 throw new InvalidOperationException($
"Required parent object of type {typeof(T).FullName} not found on serialization stack.");
120 public abstract void ReadObjectInfo(out
int? objectId, out
bool isReference, out Type runtimeType);
122 protected virtual void ReadObject(
string name,
SerializeData staticSerializeData, ref
object value,
bool allowOverwriteOfExistingObject) {
138 object value2 = value;
139 ReadObject(name, staticSerializeData, ref value2, allowOverwriteOfExistingObject);
145 Type type = value?.GetType();
146 SerializeData serializeData = !(type ==
null) && !(staticSerializeData.
Type == type)
148 : staticSerializeData;
151 value = Activator.CreateInstance(serializeData.
Type,
true);
153 serializeData.
Read(
this, ref value);
157 ReadObjectInfo(out
int? objectId, out
bool isReference, out Type runtimeType);
159 if (!allowOverwriteOfExistingObject
161 throw new InvalidOperationException(
"Serializing null reference into an existing object.");
166 if (!allowOverwriteOfExistingObject
168 throw new InvalidOperationException(
"Serializing a reference into an existing object.");
173 Type type = value?.GetType();
175 if (!(type !=
null)) {
176 serializeData = !(runtimeType !=
null) ? staticSerializeData :
GetSerializeData(runtimeType,
false);
179 if (runtimeType !=
null
180 && runtimeType != type) {
181 throw new InvalidOperationException(
"Serialized object has different type than existing object.");
191 serializeData.
Read(
this, ref value);
193 if (objectId.HasValue) {
void VerifySerializable()
AutoConstructMode AutoConstruct
static SerializeData GetSerializeData(Type type, bool allowEmptySerializer)
Archive(int version, object context)