Ejemplo n.º 1
0
 /// <summary>Implements the <see cref="T:System.Runtime.Serialization.ISerializable" /> interface and is called back by the deserialization event when deserialization is complete.</summary>
 /// <param name="sender">The source of the deserialization event. </param>
 void IDeserializationCallback.OnDeserialization(object sender)
 {
     this._token = (IntPtr)this._info.GetValue("m_userToken", typeof(IntPtr));
     this._name  = this._info.GetString("m_name");
     if (this._name != null)
     {
         string tokenName = WindowsIdentity.GetTokenName(this._token);
         if (tokenName != this._name)
         {
             throw new SerializationException("Token-Name mismatch.");
         }
     }
     else
     {
         this._name = WindowsIdentity.GetTokenName(this._token);
         if (this._name == string.Empty || this._name == null)
         {
             throw new SerializationException("Token doesn't match a user.");
         }
     }
     this._type          = this._info.GetString("m_type");
     this._account       = (WindowsAccountType)((int)this._info.GetValue("m_acctType", typeof(WindowsAccountType)));
     this._authenticated = this._info.GetBoolean("m_isAuthenticated");
 }