using System; using System.Runtime.ConstrainedExecution; using System.Runtime.InteropServices; using System.Runtime.Remoting.Channels; using System.Runtime.Serialization; namespace System.Runtime.Remoting { /// Stores all relevant information required to generate a proxy in order to communicate with a remote object. // Token: 0x02000443 RID: 1091 [ComVisible(true)] [Serializable] public class ObjRef : ISerializable, IObjectReference { /// Initializes a new instance of the class with default values. // Token: 0x060029EA RID: 10730 RVA: 0x000867CC File Offset: 0x000849CC public ObjRef() { this.UpdateChannelInfo(); } // Token: 0x060029EB RID: 10731 RVA: 0x000867DC File Offset: 0x000849DC internal ObjRef(string typeName, string uri, IChannelInfo cinfo) { this.uri = uri; this.channel_info = cinfo; this.typeInfo = new TypeInfo(Type.GetType(typeName, true)); } // Token: 0x060029EC RID: 10732 RVA: 0x00086810 File Offset: 0x00084A10 internal ObjRef(ObjRef o, bool unmarshalAsProxy) { this.channel_info = o.channel_info; this.uri = o.uri; this.typeInfo = o.typeInfo; this.envoyInfo = o.envoyInfo; this.flags = o.flags; if (unmarshalAsProxy) { this.flags |= ObjRef.MarshalledObjectRef; } } /// Initializes a new instance of the class to reference a specified of a specified . /// The object that the new instance will reference. /// The of the object that the new instance will reference. // Token: 0x060029ED RID: 10733 RVA: 0x00086878 File Offset: 0x00084A78 public ObjRef(MarshalByRefObject o, Type requestedType) { if (o == null) { throw new ArgumentNullException("o"); } if (requestedType == null) { throw new ArgumentNullException("requestedType"); } this.uri = RemotingServices.GetObjectUri(o); this.typeInfo = new TypeInfo(requestedType); if (!requestedType.IsInstanceOfType(o)) { throw new RemotingException("The server object type cannot be cast to the requested type " + requestedType.FullName); } this.UpdateChannelInfo(); } // Token: 0x060029EE RID: 10734 RVA: 0x000868F0 File Offset: 0x00084AF0 internal ObjRef(Type type, string url, object remoteChannelData) { this.uri = url; this.typeInfo = new TypeInfo(type); if (remoteChannelData != null) { this.channel_info = new ChannelInfo(remoteChannelData); } this.flags |= ObjRef.WellKnowObjectRef; } /// Initializes a new instance of the class from serialized data. /// The object that holds the serialized object data. /// The contextual information about the source or destination of the exception. // Token: 0x060029EF RID: 10735 RVA: 0x00086930 File Offset: 0x00084B30 protected ObjRef(SerializationInfo info, StreamingContext context) { SerializationInfoEnumerator enumerator = info.GetEnumerator(); bool flag = true; while (enumerator.MoveNext()) { string name = enumerator.Name; switch (name) { case "uri": this.uri = (string)enumerator.Value; continue; case "typeInfo": this.typeInfo = (IRemotingTypeInfo)enumerator.Value; continue; case "channelInfo": this.channel_info = (IChannelInfo)enumerator.Value; continue; case "envoyInfo": this.envoyInfo = (IEnvoyInfo)enumerator.Value; continue; case "fIsMarshalled": { object value = enumerator.Value; int num2; if (value is string) { num2 = ((IConvertible)value).ToInt32(null); } else { num2 = (int)value; } if (num2 == 0) { flag = false; } continue; } case "objrefFlags": this.flags = Convert.ToInt32(enumerator.Value); continue; } throw new NotSupportedException(); } if (flag) { this.flags |= ObjRef.MarshalledObjectRef; } } // Token: 0x060029F1 RID: 10737 RVA: 0x00086AE0 File Offset: 0x00084CE0 internal bool IsPossibleToCAD() { return false; } // Token: 0x17000855 RID: 2133 // (get) Token: 0x060029F2 RID: 10738 RVA: 0x00086AE4 File Offset: 0x00084CE4 internal bool IsReferenceToWellKnow { get { return (this.flags & ObjRef.WellKnowObjectRef) > 0; } } /// Gets or sets the for the . /// The interface for the . /// /// /// // Token: 0x17000856 RID: 2134 // (get) Token: 0x060029F3 RID: 10739 RVA: 0x00086AF8 File Offset: 0x00084CF8 // (set) Token: 0x060029F4 RID: 10740 RVA: 0x00086B00 File Offset: 0x00084D00 public virtual IChannelInfo ChannelInfo { [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] get { return this.channel_info; } set { this.channel_info = value; } } /// Gets or sets the for the . /// The interface for the . /// /// /// // Token: 0x17000857 RID: 2135 // (get) Token: 0x060029F5 RID: 10741 RVA: 0x00086B0C File Offset: 0x00084D0C // (set) Token: 0x060029F6 RID: 10742 RVA: 0x00086B14 File Offset: 0x00084D14 public virtual IEnvoyInfo EnvoyInfo { get { return this.envoyInfo; } set { this.envoyInfo = value; } } /// Gets or sets the for the object that the describes. /// The for the object that the describes. /// /// /// // Token: 0x17000858 RID: 2136 // (get) Token: 0x060029F7 RID: 10743 RVA: 0x00086B20 File Offset: 0x00084D20 // (set) Token: 0x060029F8 RID: 10744 RVA: 0x00086B28 File Offset: 0x00084D28 public virtual IRemotingTypeInfo TypeInfo { get { return this.typeInfo; } set { this.typeInfo = value; } } /// Gets or sets the URI of the specific object instance. /// The URI of the specific object instance. /// /// /// // Token: 0x17000859 RID: 2137 // (get) Token: 0x060029F9 RID: 10745 RVA: 0x00086B34 File Offset: 0x00084D34 // (set) Token: 0x060029FA RID: 10746 RVA: 0x00086B3C File Offset: 0x00084D3C public virtual string URI { get { return this.uri; } set { this.uri = value; } } /// Populates a specified with the data needed to serialize the current instance. /// The to populate with data. /// The contextual information about the source or destination of the serialization. /// The parameter is null. /// The immediate caller does not have serialization formatter permission. /// /// /// // Token: 0x060029FB RID: 10747 RVA: 0x00086B48 File Offset: 0x00084D48 public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { info.SetType(base.GetType()); info.AddValue("uri", this.uri); info.AddValue("typeInfo", this.typeInfo, typeof(IRemotingTypeInfo)); info.AddValue("envoyInfo", this.envoyInfo, typeof(IEnvoyInfo)); info.AddValue("channelInfo", this.channel_info, typeof(IChannelInfo)); info.AddValue("objrefFlags", this.flags); } /// Returns a reference to the remote object that the describes. /// A reference to the remote object that the describes. /// The context where the current object resides. /// The immediate caller does not have serialization formatter permission. /// /// /// /// /// // Token: 0x060029FC RID: 10748 RVA: 0x00086BD4 File Offset: 0x00084DD4 public virtual object GetRealObject(StreamingContext context) { if ((this.flags & ObjRef.MarshalledObjectRef) > 0) { return RemotingServices.Unmarshal(this); } return this; } /// Returns a Boolean value that indicates whether the current instance references an object located in the current . /// A Boolean value that indicates whether the current instance references an object located in the current . /// /// /// // Token: 0x060029FD RID: 10749 RVA: 0x00086BF0 File Offset: 0x00084DF0 public bool IsFromThisAppDomain() { Identity identityForUri = RemotingServices.GetIdentityForUri(this.uri); return identityForUri != null && identityForUri.IsFromThisAppDomain; } /// Returns a Boolean value that indicates whether the current instance references an object located in the current process. /// A Boolean value that indicates whether the current instance references an object located in the current process. /// /// /// // Token: 0x060029FE RID: 10750 RVA: 0x00086C18 File Offset: 0x00084E18 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public bool IsFromThisProcess() { foreach (object obj in this.channel_info.ChannelData) { if (obj is CrossAppDomainData) { string processID = ((CrossAppDomainData)obj).ProcessID; return processID == RemotingConfiguration.ProcessId; } } return true; } // Token: 0x060029FF RID: 10751 RVA: 0x00086C70 File Offset: 0x00084E70 internal void UpdateChannelInfo() { this.channel_info = new ChannelInfo(); } // Token: 0x1700085A RID: 2138 // (get) Token: 0x06002A00 RID: 10752 RVA: 0x00086C80 File Offset: 0x00084E80 internal Type ServerType { get { if (this._serverType == null) { this._serverType = Type.GetType(this.typeInfo.TypeName); } return this._serverType; } } // Token: 0x04001014 RID: 4116 private IChannelInfo channel_info; // Token: 0x04001015 RID: 4117 private string uri; // Token: 0x04001016 RID: 4118 private IRemotingTypeInfo typeInfo; // Token: 0x04001017 RID: 4119 private IEnvoyInfo envoyInfo; // Token: 0x04001018 RID: 4120 private int flags; // Token: 0x04001019 RID: 4121 private Type _serverType; // Token: 0x0400101A RID: 4122 private static int MarshalledObjectRef = 1; // Token: 0x0400101B RID: 4123 private static int WellKnowObjectRef = 2; } }