using System;
using System.Collections;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization
{
/// Stores all the data needed to serialize or deserialize an object. This class cannot be inherited.
// Token: 0x02000494 RID: 1172
[ComVisible(true)]
public sealed class SerializationInfo
{
// Token: 0x06002C50 RID: 11344 RVA: 0x00091F3C File Offset: 0x0009013C
private SerializationInfo(Type type)
{
this.assemblyName = type.Assembly.FullName;
this.fullTypeName = type.FullName;
this.converter = new FormatterConverter();
}
// Token: 0x06002C51 RID: 11345 RVA: 0x00091F90 File Offset: 0x00090190
private SerializationInfo(Type type, SerializationEntry[] data)
{
int num = data.Length;
this.assemblyName = type.Assembly.FullName;
this.fullTypeName = type.FullName;
this.converter = new FormatterConverter();
for (int i = 0; i < num; i++)
{
this.serialized.Add(data[i].Name, data[i]);
this.values.Add(data[i]);
}
}
/// Creates a new instance of the class.
/// The of the object to serialize.
/// The used during deserialization.
///
/// or is null.
// Token: 0x06002C52 RID: 11346 RVA: 0x0009203C File Offset: 0x0009023C
[CLSCompliant(false)]
public SerializationInfo(Type type, IFormatterConverter converter)
{
if (type == null)
{
throw new ArgumentNullException("type", "Null argument");
}
if (converter == null)
{
throw new ArgumentNullException("converter", "Null argument");
}
this.converter = converter;
this.assemblyName = type.Assembly.FullName;
this.fullTypeName = type.FullName;
}
/// Gets or sets the assembly name of the type to serialize during serialization only.
/// The full name of the assembly of the type to serialize.
/// The value the property is set to is null.
// Token: 0x170008A7 RID: 2215
// (get) Token: 0x06002C53 RID: 11347 RVA: 0x000920B8 File Offset: 0x000902B8
// (set) Token: 0x06002C54 RID: 11348 RVA: 0x000920C0 File Offset: 0x000902C0
public string AssemblyName
{
get
{
return this.assemblyName;
}
set
{
if (value == null)
{
throw new ArgumentNullException("Argument is null.");
}
this.assemblyName = value;
}
}
/// Gets or sets the full name of the to serialize.
/// The full name of the type to serialize.
/// The value this property is set to is null.
// Token: 0x170008A8 RID: 2216
// (get) Token: 0x06002C55 RID: 11349 RVA: 0x000920DC File Offset: 0x000902DC
// (set) Token: 0x06002C56 RID: 11350 RVA: 0x000920E4 File Offset: 0x000902E4
public string FullTypeName
{
get
{
return this.fullTypeName;
}
set
{
if (value == null)
{
throw new ArgumentNullException("Argument is null.");
}
this.fullTypeName = value;
}
}
/// Gets the number of members that have been added to the store.
/// The number of members that have been added to the current .
// Token: 0x170008A9 RID: 2217
// (get) Token: 0x06002C57 RID: 11351 RVA: 0x00092100 File Offset: 0x00090300
public int MemberCount
{
get
{
return this.serialized.Count;
}
}
/// Adds a value into the store, where is associated with and is serialized as being of .
/// The name to associate with the value, so it can be deserialized later.
/// The value to be serialized. Any children of this object will automatically be serialized.
/// The to associate with the current object. This parameter must always be the type of the object itself or of one of its base classes.
/// If or is null.
/// A value has already been associated with .
// Token: 0x06002C58 RID: 11352 RVA: 0x00092110 File Offset: 0x00090310
public void AddValue(string name, object value, Type type)
{
if (name == null)
{
throw new ArgumentNullException("name is null");
}
if (type == null)
{
throw new ArgumentNullException("type is null");
}
if (this.serialized.ContainsKey(name))
{
throw new SerializationException("Value has been serialized already.");
}
SerializationEntry serializationEntry = new SerializationEntry(name, type, value);
this.serialized.Add(name, serializationEntry);
this.values.Add(serializationEntry);
}
/// Retrieves a value from the store.
/// The object of the specified associated with .
/// The name associated with the value to retrieve.
/// The of the value to retrieve. If the stored value cannot be converted to this type, the system will throw a .
///
/// or is null.
/// The value associated with cannot be converted to .
/// An element with the specified name is not found in the current instance.
// Token: 0x06002C59 RID: 11353 RVA: 0x0009218C File Offset: 0x0009038C
public object GetValue(string name, Type type)
{
if (name == null)
{
throw new ArgumentNullException("name is null.");
}
if (type == null)
{
throw new ArgumentNullException("type");
}
if (!this.serialized.ContainsKey(name))
{
throw new SerializationException("No element named " + name + " could be found.");
}
SerializationEntry serializationEntry = (SerializationEntry)this.serialized[name];
if (serializationEntry.Value != null && !type.IsInstanceOfType(serializationEntry.Value))
{
return this.converter.Convert(serializationEntry.Value, type);
}
return serializationEntry.Value;
}
/// Sets the of the object to serialize.
/// The of the object to serialize.
/// The parameter is null.
// Token: 0x06002C5A RID: 11354 RVA: 0x00092230 File Offset: 0x00090430
public void SetType(Type type)
{
if (type == null)
{
throw new ArgumentNullException("type is null.");
}
this.fullTypeName = type.FullName;
this.assemblyName = type.Assembly.FullName;
}
/// Returns a used to iterate through the name-value pairs in the store.
/// A for parsing the name-value pairs contained in the store.
// Token: 0x06002C5B RID: 11355 RVA: 0x0009226C File Offset: 0x0009046C
public SerializationInfoEnumerator GetEnumerator()
{
return new SerializationInfoEnumerator(this.values);
}
/// Adds a 16-bit signed integer value into the store.
/// The name to associate with the value, so it can be deserialized later.
/// The Int16 value to serialize.
/// The parameter is null.
/// A value has already been associated with .
// Token: 0x06002C5C RID: 11356 RVA: 0x0009227C File Offset: 0x0009047C
public void AddValue(string name, short value)
{
this.AddValue(name, value, typeof(short));
}
/// Adds a 16-bit unsigned integer value into the store.
/// The name to associate with the value, so it can be deserialized later.
/// The UInt16 value to serialize.
/// The parameter is null.
/// A value has already been associated with .
// Token: 0x06002C5D RID: 11357 RVA: 0x00092298 File Offset: 0x00090498
[CLSCompliant(false)]
public void AddValue(string name, ushort value)
{
this.AddValue(name, value, typeof(ushort));
}
/// Adds a 32-bit signed integer value into the store.
/// The name to associate with the value, so it can be deserialized later.
/// The Int32 value to serialize.
/// The parameter is null.
/// A value has already been associated with .
// Token: 0x06002C5E RID: 11358 RVA: 0x000922B4 File Offset: 0x000904B4
public void AddValue(string name, int value)
{
this.AddValue(name, value, typeof(int));
}
/// Adds an 8-bit unsigned integer value into the store.
/// The name to associate with the value, so it can be deserialized later.
/// The byte value to serialize.
/// The parameter is null.
/// A value has already been associated with .
// Token: 0x06002C5F RID: 11359 RVA: 0x000922D0 File Offset: 0x000904D0
public void AddValue(string name, byte value)
{
this.AddValue(name, value, typeof(byte));
}
/// Adds a Boolean value into the store.
/// The name to associate with the value, so it can be deserialized later.
/// The Boolean value to serialize.
/// The parameter is null.
/// A value has already been associated with .
// Token: 0x06002C60 RID: 11360 RVA: 0x000922EC File Offset: 0x000904EC
public void AddValue(string name, bool value)
{
this.AddValue(name, value, typeof(bool));
}
/// Adds a Unicode character value into the store.
/// The name to associate with the value, so it can be deserialized later.
/// The character value to serialize.
/// The parameter is null.
/// A value has already been associated with .
// Token: 0x06002C61 RID: 11361 RVA: 0x00092308 File Offset: 0x00090508
public void AddValue(string name, char value)
{
this.AddValue(name, value, typeof(char));
}
/// Adds an 8-bit signed integer value into the store.
/// The name to associate with the value, so it can be deserialized later.
/// The Sbyte value to serialize.
/// The parameter is null.
/// A value has already been associated with .
// Token: 0x06002C62 RID: 11362 RVA: 0x00092324 File Offset: 0x00090524
[CLSCompliant(false)]
public void AddValue(string name, sbyte value)
{
this.AddValue(name, value, typeof(sbyte));
}
/// Adds a double-precision floating-point value into the store.
/// The name to associate with the value, so it can be deserialized later.
/// The double value to serialize.
/// The parameter is null.
/// A value has already been associated with .
// Token: 0x06002C63 RID: 11363 RVA: 0x00092340 File Offset: 0x00090540
public void AddValue(string name, double value)
{
this.AddValue(name, value, typeof(double));
}
/// Adds a decimal value into the store.
/// The name to associate with the value, so it can be deserialized later.
/// The decimal value to serialize.
/// If The parameter is null.
/// If a value has already been associated with .
// Token: 0x06002C64 RID: 11364 RVA: 0x0009235C File Offset: 0x0009055C
public void AddValue(string name, decimal value)
{
this.AddValue(name, value, typeof(decimal));
}
/// Adds a value into the store.
/// The name to associate with the value, so it can be deserialized later.
/// The value to serialize.
/// The parameter is null.
/// A value has already been associated with .
// Token: 0x06002C65 RID: 11365 RVA: 0x00092378 File Offset: 0x00090578
public void AddValue(string name, DateTime value)
{
this.AddValue(name, value, typeof(DateTime));
}
/// Adds a single-precision floating-point value into the store.
/// The name to associate with the value, so it can be deserialized later.
/// The single value to serialize.
/// The parameter is null.
/// A value has already been associated with .
// Token: 0x06002C66 RID: 11366 RVA: 0x00092394 File Offset: 0x00090594
public void AddValue(string name, float value)
{
this.AddValue(name, value, typeof(float));
}
/// Adds a 32-bit unsigned integer value into the store.
/// The name to associate with the value, so it can be deserialized later.
/// The UInt32 value to serialize.
/// The parameter is null.
/// A value has already been associated with .
// Token: 0x06002C67 RID: 11367 RVA: 0x000923B0 File Offset: 0x000905B0
[CLSCompliant(false)]
public void AddValue(string name, uint value)
{
this.AddValue(name, value, typeof(uint));
}
/// Adds a 64-bit signed integer value into the store.
/// The name to associate with the value, so it can be deserialized later.
/// The Int64 value to serialize.
/// The parameter is null.
/// A value has already been associated with .
// Token: 0x06002C68 RID: 11368 RVA: 0x000923CC File Offset: 0x000905CC
public void AddValue(string name, long value)
{
this.AddValue(name, value, typeof(long));
}
/// Adds a 64-bit unsigned integer value into the store.
/// The name to associate with the value, so it can be deserialized later.
/// The UInt64 value to serialize.
/// The parameter is null.
/// A value has already been associated with .
// Token: 0x06002C69 RID: 11369 RVA: 0x000923E8 File Offset: 0x000905E8
[CLSCompliant(false)]
public void AddValue(string name, ulong value)
{
this.AddValue(name, value, typeof(ulong));
}
/// Adds the specified object into the store, where it is associated with a specified name.
/// The name to associate with the value, so it can be deserialized later.
/// The value to be serialized. Any children of this object will automatically be serialized.
///
/// is null.
/// A value has already been associated with .
// Token: 0x06002C6A RID: 11370 RVA: 0x00092404 File Offset: 0x00090604
public void AddValue(string name, object value)
{
if (value == null)
{
this.AddValue(name, value, typeof(object));
}
else
{
this.AddValue(name, value, value.GetType());
}
}
/// Retrieves a Boolean value from the store.
/// The Boolean value associated with .
/// The name associated with the value to retrieve.
///
/// is null.
/// The value associated with cannot be converted to a Boolean value.
/// An element with the specified name is not found in the current instance.
// Token: 0x06002C6B RID: 11371 RVA: 0x0009243C File Offset: 0x0009063C
public bool GetBoolean(string name)
{
object value = this.GetValue(name, typeof(bool));
return this.converter.ToBoolean(value);
}
/// Retrieves an 8-bit unsigned integer value from the store.
/// The 8-bit unsigned integer associated with .
/// The name associated with the value to retrieve.
///
/// is null.
/// The value associated with cannot be converted to an 8-bit unsigned integer.
/// An element with the specified name is not found in the current instance.
// Token: 0x06002C6C RID: 11372 RVA: 0x00092468 File Offset: 0x00090668
public byte GetByte(string name)
{
object value = this.GetValue(name, typeof(byte));
return this.converter.ToByte(value);
}
/// Retrieves a Unicode character value from the store.
/// The Unicode character associated with .
/// The name associated with the value to retrieve.
///
/// is null.
/// The value associated with cannot be converted to a Unicode character.
/// An element with the specified name is not found in the current instance.
// Token: 0x06002C6D RID: 11373 RVA: 0x00092494 File Offset: 0x00090694
public char GetChar(string name)
{
object value = this.GetValue(name, typeof(char));
return this.converter.ToChar(value);
}
/// Retrieves a value from the store.
/// The value associated with .
/// The name associated with the value to retrieve.
///
/// is null.
/// The value associated with cannot be converted to a value.
/// An element with the specified name is not found in the current instance.
// Token: 0x06002C6E RID: 11374 RVA: 0x000924C0 File Offset: 0x000906C0
public DateTime GetDateTime(string name)
{
object value = this.GetValue(name, typeof(DateTime));
return this.converter.ToDateTime(value);
}
/// Retrieves a decimal value from the store.
/// A decimal value from the .
/// The name associated with the value to retrieve.
///
/// is null.
/// The value associated with cannot be converted to a decimal.
/// An element with the specified name is not found in the current instance.
// Token: 0x06002C6F RID: 11375 RVA: 0x000924EC File Offset: 0x000906EC
public decimal GetDecimal(string name)
{
object value = this.GetValue(name, typeof(decimal));
return this.converter.ToDecimal(value);
}
/// Retrieves a double-precision floating-point value from the store.
/// The double-precision floating-point value associated with .
/// The name associated with the value to retrieve.
///
/// is null.
/// The value associated with cannot be converted to a double-precision floating-point value.
/// An element with the specified name is not found in the current instance.
// Token: 0x06002C70 RID: 11376 RVA: 0x00092518 File Offset: 0x00090718
public double GetDouble(string name)
{
object value = this.GetValue(name, typeof(double));
return this.converter.ToDouble(value);
}
/// Retrieves a 16-bit signed integer value from the store.
/// The 16-bit signed integer associated with .
/// The name associated with the value to retrieve.
///
/// is null.
/// The value associated with cannot be converted to a 16-bit signed integer.
/// An element with the specified name is not found in the current instance.
// Token: 0x06002C71 RID: 11377 RVA: 0x00092544 File Offset: 0x00090744
public short GetInt16(string name)
{
object value = this.GetValue(name, typeof(short));
return this.converter.ToInt16(value);
}
/// Retrieves a 32-bit signed integer value from the store.
/// The 32-bit signed integer associated with .
/// The name of the value to retrieve.
///
/// is null.
/// The value associated with cannot be converted to a 32-bit signed integer.
/// An element with the specified name is not found in the current instance.
// Token: 0x06002C72 RID: 11378 RVA: 0x00092570 File Offset: 0x00090770
public int GetInt32(string name)
{
object value = this.GetValue(name, typeof(int));
return this.converter.ToInt32(value);
}
/// Retrieves a 64-bit signed integer value from the store.
/// The 64-bit signed integer associated with .
/// The name associated with the value to retrieve.
///
/// is null.
/// The value associated with cannot be converted to a 64-bit signed integer.
/// An element with the specified name is not found in the current instance.
// Token: 0x06002C73 RID: 11379 RVA: 0x0009259C File Offset: 0x0009079C
public long GetInt64(string name)
{
object value = this.GetValue(name, typeof(long));
return this.converter.ToInt64(value);
}
/// Retrieves an 8-bit signed integer value from the store.
/// The 8-bit signed integer associated with .
/// The name associated with the value to retrieve.
///
/// is null.
/// The value associated with cannot be converted to an 8-bit signed integer.
/// An element with the specified name is not found in the current instance.
// Token: 0x06002C74 RID: 11380 RVA: 0x000925C8 File Offset: 0x000907C8
[CLSCompliant(false)]
public sbyte GetSByte(string name)
{
object value = this.GetValue(name, typeof(sbyte));
return this.converter.ToSByte(value);
}
/// Retrieves a single-precision floating-point value from the store.
/// The single-precision floating-point value associated with .
/// The name of the value to retrieve.
///
/// is null.
/// The value associated with cannot be converted to a single-precision floating-point value.
/// An element with the specified name is not found in the current instance.
// Token: 0x06002C75 RID: 11381 RVA: 0x000925F4 File Offset: 0x000907F4
public float GetSingle(string name)
{
object value = this.GetValue(name, typeof(float));
return this.converter.ToSingle(value);
}
/// Retrieves a value from the store.
/// The associated with .
/// The name associated with the value to retrieve.
///
/// is null.
/// The value associated with cannot be converted to a .
/// An element with the specified name is not found in the current instance.
// Token: 0x06002C76 RID: 11382 RVA: 0x00092620 File Offset: 0x00090820
public string GetString(string name)
{
object value = this.GetValue(name, typeof(string));
if (value == null)
{
return null;
}
return this.converter.ToString(value);
}
/// Retrieves a 16-bit unsigned integer value from the store.
/// The 16-bit unsigned integer associated with .
/// The name associated with the value to retrieve.
///
/// is null.
/// The value associated with cannot be converted to a 16-bit unsigned integer.
/// An element with the specified name is not found in the current instance.
// Token: 0x06002C77 RID: 11383 RVA: 0x00092654 File Offset: 0x00090854
[CLSCompliant(false)]
public ushort GetUInt16(string name)
{
object value = this.GetValue(name, typeof(ushort));
return this.converter.ToUInt16(value);
}
/// Retrieves a 32-bit unsigned integer value from the store.
/// The 32-bit unsigned integer associated with .
/// The name associated with the value to retrieve.
///
/// is null.
/// The value associated with cannot be converted to a 32-bit unsigned integer.
/// An element with the specified name is not found in the current instance.
// Token: 0x06002C78 RID: 11384 RVA: 0x00092680 File Offset: 0x00090880
[CLSCompliant(false)]
public uint GetUInt32(string name)
{
object value = this.GetValue(name, typeof(uint));
return this.converter.ToUInt32(value);
}
/// Retrieves a 64-bit unsigned integer value from the store.
/// The 64-bit unsigned integer associated with .
/// The name associated with the value to retrieve.
///
/// is null.
/// The value associated with cannot be converted to a 64-bit unsigned integer.
/// An element with the specified name is not found in the current instance.
// Token: 0x06002C79 RID: 11385 RVA: 0x000926AC File Offset: 0x000908AC
[CLSCompliant(false)]
public ulong GetUInt64(string name)
{
object value = this.GetValue(name, typeof(ulong));
return this.converter.ToUInt64(value);
}
// Token: 0x06002C7A RID: 11386 RVA: 0x000926D8 File Offset: 0x000908D8
private SerializationEntry[] get_entries()
{
SerializationEntry[] array = new SerializationEntry[this.MemberCount];
int num = 0;
foreach (SerializationEntry serializationEntry in this)
{
array[num++] = serializationEntry;
}
return array;
}
// Token: 0x04001131 RID: 4401
private Hashtable serialized = new Hashtable();
// Token: 0x04001132 RID: 4402
private ArrayList values = new ArrayList();
// Token: 0x04001133 RID: 4403
private string assemblyName;
// Token: 0x04001134 RID: 4404
private string fullTypeName;
// Token: 0x04001135 RID: 4405
private IFormatterConverter converter;
}
}