Unmarshal() private méthode

private Unmarshal ( ObjRef objectRef ) : Object
objectRef ObjRef
Résultat Object
 /// <summary>Returns a reference to the remote object that the <see cref="T:System.Runtime.Remoting.ObjRef" /> describes.</summary>
 /// <returns>A reference to the remote object that the <see cref="T:System.Runtime.Remoting.ObjRef" /> describes.</returns>
 /// <param name="context">The context where the current object resides. </param>
 /// <exception cref="T:System.Security.SecurityException">The immediate caller does not have serialization formatter permission. </exception>
 /// <PermissionSet>
 ///   <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="*AllFiles*" PathDiscovery="*AllFiles*" />
 ///   <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
 ///   <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="SerializationFormatter, RemotingConfiguration, Infrastructure" />
 /// </PermissionSet>
 public virtual object GetRealObject(StreamingContext context)
 {
     if ((this.flags & ObjRef.MarshalledObjectRef) > 0)
     {
         return(RemotingServices.Unmarshal(this));
     }
     return(this);
 }
Exemple #2
0
 public virtual object GetRealObject(StreamingContext sc)
 {
     if ((flags & MarshalledObjectRef) > 0)
     {
         return(RemotingServices.Unmarshal(this));
     }
     else
     {
         return(this);
     }
 }
Exemple #3
0
 public virtual object GetRealObject(StreamingContext context)
 {
                 #if !DISABLE_REMOTING
     if ((flags & MarshalledObjectRef) > 0)
     {
         return(RemotingServices.Unmarshal(this));
     }
     else
                 #endif
     return(this);
 }
Exemple #4
0
 internal object GetRealObjectHelper()
 {
     if (!this.IsMarshaledObject())
     {
         return((object)this);
     }
     if (this.IsObjRefLite())
     {
         int num = this.uri.IndexOf(RemotingConfiguration.ApplicationId);
         if (num > 0)
         {
             this.uri = this.uri.Substring(num - 1);
         }
     }
     return(this.GetCustomMarshaledCOMObject(RemotingServices.Unmarshal(this, !(this.GetType() == typeof(ObjRef)))));
 }
Exemple #5
0
        // This is the common helper called by serialization / smuggling
        internal Object GetRealObjectHelper()

        {
            // Check if we are a result of serialiazing an MBR object
            // or if someone wanted to pass an ObjRef itself
            if (!IsMarshaledObject())
            {
                BCLDebug.Trace("REMOTE", "ObjRef.GetRealObject: Returning *this*\n");
                return(this);
            }
            else
            {
                // Check if this is a lightweight objref
                if (IsObjRefLite())
                {
                    BCLDebug.Assert(null != uri, "null != uri");

                    // transform the url, if this is a local object (we know it is local
                    //   if we find the current application id in the url)
                    int index = uri.IndexOf(RemotingConfiguration.ApplicationId);

                    // we need to be past 0, since we have to back up a space and pick up
                    //   a slash.
                    if (index > 0)
                    {
                        uri = uri.Substring(index - 1);
                    }
                }

                // In the general case, 'this' is the
                // objref of an activated object

                // It may also be a well known object ref ... which came by
                // because someone did a Connect(URL) and then passed the proxy
                // over to a remote method call.

                // The below call handles both cases.
                bool   fRefine = !(GetType() == typeof(ObjRef));
                Object ret     = RemotingServices.Unmarshal(this, fRefine);

                // Check for COMObject & do some special custom marshaling
                ret = GetCustomMarshaledCOMObject(ret);

                return(ret);
            }
        }
Exemple #6
0
        internal object GetRealObjectHelper()
        {
            if (!this.IsMarshaledObject())
            {
                return(this);
            }
            if (this.IsObjRefLite())
            {
                int index = this.uri.IndexOf(RemotingConfiguration.ApplicationId);
                if (index > 0)
                {
                    this.uri = this.uri.Substring(index - 1);
                }
            }
            bool   fRefine = !(base.GetType() == typeof(ObjRef));
            object ret     = RemotingServices.Unmarshal(this, fRefine);

            return(this.GetCustomMarshaledCOMObject(ret));
        }
Exemple #7
0
        internal static object GetDomainProxy(AppDomain domain)
        {
            byte[] data = null;

            Context currentContext = Thread.CurrentContext;

            try
            {
                data = (byte[])AppDomain.InvokeInDomain(domain, typeof(AppDomain).GetMethod("GetMarshalledDomainObjRef", BindingFlags.Instance | BindingFlags.NonPublic), domain, null);
            }
            finally
            {
                AppDomain.InternalSetContext(currentContext);
            }

            MemoryStream stream = new MemoryStream(data);
            ObjRef       appref = (ObjRef)CADSerializer.DeserializeObject(stream);

            return((AppDomain)RemotingServices.Unmarshal(appref));
        }