using System;
using System.Collections;
namespace System.Runtime.Serialization
{
/// Manages serialization processes at run time. This class cannot be inherited.
// Token: 0x02000496 RID: 1174
public sealed class SerializationObjectManager
{
/// Initializes a new instance of the class.
/// An instance of the class that contains information about the current serialization operation.
// Token: 0x06002C83 RID: 11395 RVA: 0x000927D0 File Offset: 0x000909D0
public SerializationObjectManager(StreamingContext context)
{
this.context = context;
}
// Token: 0x14000007 RID: 7
// (add) Token: 0x06002C84 RID: 11396 RVA: 0x000927EC File Offset: 0x000909EC
// (remove) Token: 0x06002C85 RID: 11397 RVA: 0x00092808 File Offset: 0x00090A08
private event SerializationCallbacks.CallbackHandler callbacks;
/// Registers the object upon which events will be raised.
/// The object to register.
// Token: 0x06002C86 RID: 11398 RVA: 0x00092824 File Offset: 0x00090A24
public void RegisterObject(object obj)
{
if (this.seen.Contains(obj))
{
return;
}
SerializationCallbacks sc = SerializationCallbacks.GetSerializationCallbacks(obj.GetType());
this.seen[obj] = 1;
sc.RaiseOnSerializing(obj, this.context);
if (sc.HasSerializedCallbacks)
{
this.callbacks = (SerializationCallbacks.CallbackHandler)Delegate.Combine(this.callbacks, new SerializationCallbacks.CallbackHandler(delegate(StreamingContext ctx)
{
sc.RaiseOnSerialized(obj, ctx);
}));
}
}
/// Invokes the OnSerializing callback event if the type of the object has one; and registers the object for raising the OnSerialized event if the type of the object has one.
// Token: 0x06002C87 RID: 11399 RVA: 0x000928CC File Offset: 0x00090ACC
public void RaiseOnSerializedEvent()
{
if (this.callbacks != null)
{
this.callbacks(this.context);
}
}
// Token: 0x04001137 RID: 4407
private readonly StreamingContext context;
// Token: 0x04001138 RID: 4408
private readonly Hashtable seen = new Hashtable();
}
}