protected ServicedComponentMarshaler(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     byte[] buffer = null;
     Type type = null;
     bool flag = false;
     ComponentServices.InitializeRemotingChannels();
     SerializationInfoEnumerator enumerator = info.GetEnumerator();
     while (enumerator.MoveNext())
     {
         if (enumerator.Name.Equals("servertype"))
         {
             type = (Type) enumerator.Value;
         }
         else
         {
             if (enumerator.Name.Equals("dcomInfo"))
             {
                 buffer = (byte[]) enumerator.Value;
                 continue;
             }
             if (enumerator.Name.Equals("fIsMarshalled"))
             {
                 int num = 0;
                 object obj2 = enumerator.Value;
                 if (obj2.GetType() == typeof(string))
                 {
                     num = ((IConvertible) obj2).ToInt32(null);
                 }
                 else
                 {
                     num = (int) obj2;
                 }
                 if (num == 0)
                 {
                     flag = true;
                 }
             }
         }
     }
     if (!flag)
     {
         this._marshalled = true;
     }
     this._um = new SCUnMarshaler(type, buffer);
     this._rt = type;
     if (base.IsFromThisProcess() && !ServicedComponentInfo.IsTypeEventSource(type))
     {
         this._rp = RemotingServices.GetRealProxy(base.GetRealObject(context));
     }
     else
     {
         if (ServicedComponentInfo.IsTypeEventSource(type))
         {
             this.TypeInfo = new SCMTypeName(type);
         }
         object realObject = base.GetRealObject(context);
         this._rp = RemotingServices.GetRealProxy(realObject);
     }
     this._um.Dispose();
 }
Example #2
0
        protected ServicedComponentMarshaler(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            byte[] buffer              = null;
            Type   servertype          = null;
            bool   bFoundFIsMarshalled = false;

            DBG.Info(DBG.SC, "SCM: construct");
            ComponentServices.InitializeRemotingChannels();
            SerializationInfoEnumerator e = info.GetEnumerator();

            while (e.MoveNext())
            {
                DBG.Info(DBG.SC, "SCM: ctor: name = " + e.Name + " value = " + e.Value);
                if (e.Name.Equals("servertype"))
                {
                    servertype = (Type)e.Value;
                }
                else if (e.Name.Equals("dcomInfo"))
                {
                    buffer = (byte[])e.Value;
                }
                else if (e.Name.Equals("fIsMarshalled"))
                {
                    int    value = 0;
                    Object o     = e.Value;
                    if (o.GetType() == typeof(String))
                    {
                        value = ((IConvertible)o).ToInt32(null);
                    }
                    else
                    {
                        value = (int)o;
                    }

                    if (value == 0)
                    {
                        bFoundFIsMarshalled = true;
                    }
                }
            }

            if (!bFoundFIsMarshalled)
            {
                DBG.Info(DBG.SC, "SCM: ctor: didn't find fIsMarshalled.");
                _marshalled = true;
            }

            _um = new SCUnMarshaler(servertype, buffer);

            _rt = servertype;


            if (IsFromThisProcess() && !ServicedComponentInfo.IsTypeEventSource(servertype))
            {
                _rp = RemotingServices.GetRealProxy(base.GetRealObject(context));
            }
            else
            {
                DBG.Assert(servertype != null, "SCM: server type is null during marshal.");
                if (ServicedComponentInfo.IsTypeEventSource(servertype))
                {
                    TypeInfo = (IRemotingTypeInfo) new SCMTypeName(servertype);
                }
                Object otp = base.GetRealObject(context);
                _rp = RemotingServices.GetRealProxy(otp);
            }
            // cleanup the buffer, in case we found an existing rp
            _um.Dispose();
        }
        protected ServicedComponentMarshaler(SerializationInfo info, StreamingContext context) : base(info, context)
        {
            byte[] buffer = null;
            Type   type   = null;
            bool   flag   = false;

            ComponentServices.InitializeRemotingChannels();
            SerializationInfoEnumerator enumerator = info.GetEnumerator();

            while (enumerator.MoveNext())
            {
                if (enumerator.Name.Equals("servertype"))
                {
                    type = (Type)enumerator.Value;
                }
                else
                {
                    if (enumerator.Name.Equals("dcomInfo"))
                    {
                        buffer = (byte[])enumerator.Value;
                        continue;
                    }
                    if (enumerator.Name.Equals("fIsMarshalled"))
                    {
                        int    num  = 0;
                        object obj2 = enumerator.Value;
                        if (obj2.GetType() == typeof(string))
                        {
                            num = ((IConvertible)obj2).ToInt32(null);
                        }
                        else
                        {
                            num = (int)obj2;
                        }
                        if (num == 0)
                        {
                            flag = true;
                        }
                    }
                }
            }
            if (!flag)
            {
                this._marshalled = true;
            }
            this._um = new SCUnMarshaler(type, buffer);
            this._rt = type;
            if (base.IsFromThisProcess() && !ServicedComponentInfo.IsTypeEventSource(type))
            {
                this._rp = RemotingServices.GetRealProxy(base.GetRealObject(context));
            }
            else
            {
                if (ServicedComponentInfo.IsTypeEventSource(type))
                {
                    this.TypeInfo = new SCMTypeName(type);
                }
                object realObject = base.GetRealObject(context);
                this._rp = RemotingServices.GetRealProxy(realObject);
            }
            this._um.Dispose();
        }