Example #1
1
        internal SoapFault(SerializationInfo info, StreamingContext context)
        {
            SerializationInfoEnumerator siEnum = info.GetEnumerator();        

            while(siEnum.MoveNext())
            {
                String name = siEnum.Name;
                Object value = siEnum.Value;
                SerTrace.Log(this, "SetObjectData enum ",name," value ",value);
                if (String.Compare(name, "faultCode", true, CultureInfo.InvariantCulture) == 0)
                {
                    int index = ((String)value).IndexOf(':');
                    if (index > -1)
                        faultCode = ((String)value).Substring(++index);
                    else
                        faultCode = (String)value;
                }
                else if (String.Compare(name, "faultString", true, CultureInfo.InvariantCulture) == 0)
                    faultString = (String)value;
                else if (String.Compare(name, "faultActor", true, CultureInfo.InvariantCulture) == 0)
                    faultActor = (String)value;
                else if (String.Compare(name, "detail", true, CultureInfo.InvariantCulture) == 0)
                    detail = value;
            }
        }
 private ImageListStreamer(SerializationInfo info, StreamingContext context)
 {
     SerializationInfoEnumerator enumerator = info.GetEnumerator();
     if (enumerator != null)
     {
         while (enumerator.MoveNext())
         {
             if (string.Equals(enumerator.Name, "Data", StringComparison.OrdinalIgnoreCase))
             {
                 byte[] input = (byte[]) enumerator.Value;
                 if (input != null)
                 {
                     IntPtr userCookie = System.Windows.Forms.UnsafeNativeMethods.ThemingScope.Activate();
                     try
                     {
                         MemoryStream dataStream = new MemoryStream(this.Decompress(input));
                         lock (internalSyncObject)
                         {
                             SafeNativeMethods.InitCommonControls();
                             this.nativeImageList = new ImageList.NativeImageList(SafeNativeMethods.ImageList_Read(new System.Windows.Forms.UnsafeNativeMethods.ComStreamFromDataStream(dataStream)));
                         }
                     }
                     finally
                     {
                         System.Windows.Forms.UnsafeNativeMethods.ThemingScope.Deactivate(userCookie);
                     }
                     if (this.nativeImageList.Handle == IntPtr.Zero)
                     {
                         throw new InvalidOperationException(System.Windows.Forms.SR.GetString("ImageListStreamerLoadFailed"));
                     }
                 }
             }
         }
     }
 }
        public TOCList(SerializationInfo info, StreamingContext context)
        {
            TOCNode[] tocNodes = null;

            SerializationInfoEnumerator enumerator = info.GetEnumerator();
            while( enumerator.MoveNext()) 
            {
                switch( enumerator.Name) 
                {
                    case "TOCNodes":
                        tocNodes = (TOCNode[])info.GetValue("TOCNodes", typeof(TOCNode[]));
                        break;
                }
            }

            if (tocNodes == null)
                throw new SerializationException();

            arrayList.Clear();
            hashTable.Clear();

            for (int i = 0; i < tocNodes.Length; i++)
            {
                arrayList.Add(tocNodes[i]);
                hashTable.Add(tocNodes[i].Identifier, tocNodes[i]);
            }
        }
 internal LogicalCallContext(SerializationInfo info, StreamingContext context)
 {
     SerializationInfoEnumerator enumerator = info.GetEnumerator();
     while (enumerator.MoveNext())
     {
         if (enumerator.Name.Equals("__RemotingData"))
         {
             this.m_RemotingData = (CallContextRemotingData) enumerator.Value;
         }
         else
         {
             if (enumerator.Name.Equals("__SecurityData"))
             {
                 if (context.State == StreamingContextStates.CrossAppDomain)
                 {
                     this.m_SecurityData = (CallContextSecurityData) enumerator.Value;
                 }
                 continue;
             }
             if (enumerator.Name.Equals("__HostContext"))
             {
                 this.m_HostContext = enumerator.Value;
                 continue;
             }
             if (enumerator.Name.Equals("__CorrelationMgrSlotPresent"))
             {
                 this.m_IsCorrelationMgr = (bool) enumerator.Value;
                 continue;
             }
             this.Datastore[enumerator.Name] = enumerator.Value;
         }
     }
 }
 public ComObjRef(SerializationInfo info, StreamingContext ctx)
 {
     byte[] b = null;
     IntPtr zero = IntPtr.Zero;
     SerializationInfoEnumerator enumerator = info.GetEnumerator();
     while (enumerator.MoveNext())
     {
         if (enumerator.Name.Equals("buffer"))
         {
             b = (byte[]) enumerator.Value;
         }
     }
     try
     {
         zero = Proxy.UnmarshalObject(b);
         this._realobj = Marshal.GetObjectForIUnknown(zero);
     }
     finally
     {
         if (zero != IntPtr.Zero)
         {
             Marshal.Release(zero);
         }
     }
     if (this._realobj == null)
     {
         throw new NotSupportedException();
     }
 }
 protected OwnerDrawPropertyBag(SerializationInfo info, StreamingContext context)
 {
     this.foreColor = Color.Empty;
     this.backColor = Color.Empty;
     SerializationInfoEnumerator enumerator = info.GetEnumerator();
     while (enumerator.MoveNext())
     {
         SerializationEntry current = enumerator.Current;
         if (current.Name == "Font")
         {
             this.font = (System.Drawing.Font) current.Value;
         }
         else
         {
             if (current.Name == "ForeColor")
             {
                 this.foreColor = (Color) current.Value;
                 continue;
             }
             if (current.Name == "BackColor")
             {
                 this.backColor = (Color) current.Value;
             }
         }
     }
 }
 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 #8
0
        protected BaseSettings(SerializationInfo info, StreamingContext context)
        {
            SerializationInfoEnumerator infoEnum = info.GetEnumerator();
            while (infoEnum.MoveNext())
            {
                switch (infoEnum.Name)
                {
                    case "Name":
                        _name = info.GetString("Name");
                        break;

                    case "ContentType":
                        _contentType = (ContentType)info.GetValue("ContentType", typeof(ContentType));
                        break;

                    case "Order":
                        _order = info.GetUInt16("Order");
                        break;

                    case "Activated":
                        _activated = info.GetBoolean("Activated");
                        break;
                }
            }
        }
Example #9
0
		protected TreeNode (SerializationInfo serializationInfo, StreamingContext context) : this ()
		{
			SerializationInfoEnumerator	en;
			SerializationEntry		e;
			int				children;

			en = serializationInfo.GetEnumerator();
			children = 0;
			while (en.MoveNext()) {
				e = en.Current;
				switch(e.Name) {
					case "Text": Text = (string)e.Value; break;
					case "PropBag": prop_bag = (OwnerDrawPropertyBag)e.Value; break;
					case "ImageIndex": image_index = (int)e.Value; break;
					case "SelectedImageIndex": selected_image_index = (int)e.Value; break;
					case "Tag": tag = e.Value; break;
					case "IsChecked": check = (bool)e.Value; break;
					case "ChildCount": children = (int)e.Value; break;
				}
			}
			if (children > 0) {
				for (int i = 0; i < children; i++) {
					TreeNode node = (TreeNode) serializationInfo.GetValue ("children" + i, typeof (TreeNode));
					Nodes.Add (node);
				}
			}
		}
 protected XsltException(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     this.res = (string) info.GetValue("res", typeof(string));
     this.args = (string[]) info.GetValue("args", typeof(string[]));
     this.sourceUri = (string) info.GetValue("sourceUri", typeof(string));
     this.lineNumber = (int) info.GetValue("lineNumber", typeof(int));
     this.linePosition = (int) info.GetValue("linePosition", typeof(int));
     string str = null;
     SerializationInfoEnumerator enumerator = info.GetEnumerator();
     while (enumerator.MoveNext())
     {
         SerializationEntry current = enumerator.Current;
         if (current.Name == "version")
         {
             str = (string) current.Value;
         }
     }
     if (str == null)
     {
         this.message = CreateMessage(this.res, this.args, this.sourceUri, this.lineNumber, this.linePosition);
     }
     else
     {
         this.message = null;
     }
 }
        public void Serialize(IAppendingFudgeFieldContainer msg, object obj, Action<object, SerializationInfo, StreamingContext> serializeMethod)
        {
            var si = new SerializationInfo(type, formatterConverter);

            beforeAfterMixin.CallBeforeSerialize(obj);
            serializeMethod(obj, si, streamingContext);
            beforeAfterMixin.CallAfterSerialize(obj);

            // Pull the data out of the SerializationInfo and add to the message
            var e = si.GetEnumerator();
            while (e.MoveNext())
            {
                string name = e.Name;
                object val = e.Value;

                if (val != null)
                {
                    msg.Add(name, val);
                }
                else
                {
                    // .net binary serialization still outputs the member with a null, so we have to do
                    // the same (using Indicator), otherwise deserialization blows up.
                    msg.Add(name, IndicatorType.Instance);
                }
            }
        }
Example #12
0
        public KTreeView(SerializationInfo info, StreamingContext context)
            : this()
        {
            Dictionary<string,TreeNode> nodesList = new Dictionary<string,TreeNode>();
            SerializationInfoEnumerator infoEnumerator = info.GetEnumerator();
            while (infoEnumerator.MoveNext())
            {

                NodeBase node = info.GetValue(infoEnumerator.Name, infoEnumerator.ObjectType) as NodeBase;

                if (node != null)
                {
                    string[] parts=infoEnumerator.Name.Split(new char[]{';'});

                    string id = parts[0].Split(new char[] { ':' })[1];

                    string parent = parts[1].Split(new char[] { ':' })[1];

                    if (string.IsNullOrEmpty(parent))
                    {
                        this.Nodes.Add(node);
                    }
                    else
                    {

                        NodeBase mynode = GetNode(node, parent);

                        mynode.Nodes.Add(node);

                    }
                }
            }
        }
Example #13
0
 public ScriptScopeDictionary(SerializationInfo info, StreamingContext context)
     : base()
 {
     var e = info.GetEnumerator();
     while(e.MoveNext()){
         base[e.Name as object] = e.Value;
     }
 }
		protected CustomSerializableObject(SerializationInfo info, StreamingContext context)
		{
			SerializationInfoEnumerator enumerator = info.GetEnumerator();
			while (enumerator.MoveNext())
			{
				FieldInfo fieldInfo = GetType().GetField(enumerator.Name, GetBindingFlags());
				object value = info.GetValue(enumerator.Name, typeof(object));
				fieldInfo.SetValue(this, value);
			}
		}
        private CacheListOfAttributeValuesWrapper(SerializationInfo info, StreamingContext context)
        {
            this.List = new List<AttributeValue>();

            var en = info.GetEnumerator();
            while (en.MoveNext())
            {
                this.List.Add(((CacheAttributeValueWrapper)en.Value).AttributeValue);
            }
        }
        private CacheDictionaryOfAttributeValuesWrapper(SerializationInfo info, StreamingContext context)
        {
            this.Dictionary = new Dictionary<string, AttributeValue>();

            var en = info.GetEnumerator();
            while (en.MoveNext())
            {
                this.Dictionary[en.Name] = ((CacheAttributeValueWrapper) en.Value).AttributeValue;
            }
        }
        /// <summary>
        /// Constructs the collection using serialization information.
        /// </summary>
        public AttributeTreeCollection(SerializationInfo info, 
			StreamingContext context)
        {
            // Go through the items and add them
            SerializationInfoEnumerator infoItems = info.GetEnumerator();

            while (infoItems.MoveNext())
            {
                base.BaseAdd(infoItems.Name, infoItems.Value);
            }
        }
 private IdentityContextData(SerializationInfo info, StreamingContext context)
 {
     SerializationInfoEnumerator enumerator = info.GetEnumerator();
     while (enumerator.MoveNext())
     {
         if (enumerator.Name.Equals("identity"))
         {
             this.identity = (String)enumerator.Value;
         }
     }
 }
Example #19
0
 private Comparer(SerializationInfo info, StreamingContext context) {            
     m_compareInfo = null;
     SerializationInfoEnumerator enumerator = info.GetEnumerator();                        
     while( enumerator.MoveNext()) {
         switch( enumerator.Name) {
             case CompareInfoName:
                 m_compareInfo = (CompareInfo) info.GetValue(CompareInfoName, typeof(CompareInfo));
                 break;
         }
     }
 }
 /// <summary>
 /// Creates a new HtmlTagBaseCollection.
 /// </summary>
 /// <param name="info"> The serialization info.</param>
 /// <param name="context"> The streaming context.</param>
 public HtmlTagBaseCollection(SerializationInfo info, StreamingContext context)
 {
     //this._de = (Session)s.GetValue("SafeSession", typeof(Session));
     System.Runtime.Serialization.SerializationInfoEnumerator
         infoItems = info.GetEnumerator();
     while(infoItems.MoveNext())
     {
         //if ( !infoItems.Name.StartsWith("Ecyware.GreenBlue.Engine.HtmlDom.") )
             base.BaseAdd(infoItems.Name, infoItems.Value);
     }
 }
Example #21
0
        /// <summary>
        /// Retrieves objects from the <see cref="SerializationInfo"/> store.
        /// </summary>
        public object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector)
        {
            var dictionary = new Dictionary<string, object>();

            var enumerator = info.GetEnumerator();
            while (enumerator.MoveNext())
            {
                dictionary.Add(enumerator.Name, enumerator.Value);
            }

            return dictionary;
        }
 private ExecutionContext(SerializationInfo info, StreamingContext context)
 {
     SerializationInfoEnumerator enumerator = info.GetEnumerator();
     while (enumerator.MoveNext())
     {
         if (enumerator.Name.Equals("LogicalCallContext"))
         {
             this._logicalCallContext = (System.Runtime.Remoting.Messaging.LogicalCallContext) enumerator.Value;
         }
     }
     this.Thread = System.Threading.Thread.CurrentThread;
 }
        private CacheDocumentWrapper(SerializationInfo info, StreamingContext context)
        {
            var dic = new Dictionary<string, AttributeValue>();

            var en = info.GetEnumerator();
            while (en.MoveNext())
            {
                dic.Add(en.Name, ((CacheAttributeValueWrapper)en.Value).AttributeValue);
            }

            this.Document = Document.FromAttributeMap(dic);
        }
Example #24
0
 private Comparer(SerializationInfo info, StreamingContext context)
 {
     this.m_compareInfo = null;
     SerializationInfoEnumerator enumerator = info.GetEnumerator();
     while (enumerator.MoveNext())
     {
         string str;
         if (((str = enumerator.Name) != null) && (str == "CompareInfo"))
         {
             this.m_compareInfo = (CompareInfo) info.GetValue("CompareInfo", typeof(CompareInfo));
         }
     }
 }
        /**
         * Constructor used in deserialization
         */
        private ImageListStreamer(SerializationInfo info, StreamingContext context)
        {
            SerializationInfoEnumerator sie = info.GetEnumerator();
            if (sie == null)
            {
                return;
            }
            while (sie.MoveNext())
            {
                if (String.Equals(sie.Name, "Data", StringComparison.OrdinalIgnoreCase))
                {
#if DEBUG
                    try {
#endif
                    byte[] dat = (byte[])sie.Value;
                    if (dat != null)
                    {
                        //VSW #123063: We enclose this imagelist handle create in a theming scope. This is a temporary 
                        //             solution till we tackle the bigger issue tracked by VSW #95247
                        IntPtr userCookie = UnsafeNativeMethods.ThemingScope.Activate();

                        try
                        {
                            MemoryStream ms = new MemoryStream(Decompress(dat));

                            lock (internalSyncObject) {
                                SafeNativeMethods.InitCommonControls();
                                nativeImageList = new ImageList.NativeImageList(
                                    SafeNativeMethods.ImageList_Read(new UnsafeNativeMethods.ComStreamFromDataStream(ms)));
                            }
                        }
                        finally
                        {
                            UnsafeNativeMethods.ThemingScope.Deactivate(userCookie);
                        }
                        if (nativeImageList.Handle == IntPtr.Zero)
                        {
                            throw new InvalidOperationException(SR.GetString(SR.ImageListStreamerLoadFailed));
                        }
                    }
#if DEBUG
                    }
                    catch (Exception e) {
                        Debug.Fail("ImageList serialization failure: " + e.ToString());
                        throw;
                    }
#endif
                }
            }
        }
		OwnerDrawPropertyBag(SerializationInfo info, StreamingContext context) {
			SerializationInfoEnumerator	en;
			SerializationEntry		e;

			en = info.GetEnumerator();

			while (en.MoveNext()) {
				e = en.Current;
				switch(e.Name) {
					case "Font": font = (Font)e.Value; break;
					case "ForeColor": fore_color = (Color)e.Value; break;
					case "BackColor": back_color = (Color)e.Value; break;
				}
			}
		}
Example #27
0
		private DotNetBarStreamer(SerializationInfo info, StreamingContext c)
		{
			SerializationInfoEnumerator en=info.GetEnumerator();
			while(en.MoveNext())
			{
				//System.Windows.Forms.MessageBox.Show("Read stream: "+en.Name);
				if(en.Name=="dotnetbardata")
				{
					string s=(string)en.Value;
					m_XmlDoc=new XmlDocument();
                    m_XmlDoc.LoadXml(s);
					break;
				}
			}
		}
 protected FtpItemInfo(SerializationInfo info, StreamingContext context)
 {
     this.Context = FtpContext.GetDeserializationContext((FtpContext) info.GetValue("Context", typeof(FtpContext)));
     this.AbsoluteUri = (Uri) info.GetValue("AbsoluteUri", typeof(Uri));
     this.FName = info.GetString("Name");
     SerializationInfoEnumerator enumerator = info.GetEnumerator();
     while (enumerator.MoveNext())
     {
         SerializationEntry current = enumerator.Current;
         if (current.Name == "LastWriteTime")
         {
             this.FLastWriteTime = new DateTime?((DateTime) current.Value);
             break;
         }
     }
     this.Initialize();
 }
        public object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector)
        {
            // Get the set of serializable members for our class and base classes
            Type thisType = obj.GetType();
            MemberInfo[] mi = FormatterServices.GetSerializableMembers(thisType, context);

            System.Drawing.Image image = null;
            List<object> dataList = new List<object>();
            SerializationInfoEnumerator sie = info.GetEnumerator();
            while (sie.MoveNext())
            {
                object val = sie.Current.Value;
                if (sie.Name == "icon")
                {
                    image = val as System.Drawing.Image;
                    val = null;
                }
                dataList.Add(val);
            }
            object[] data = dataList.ToArray();
            obj = FormatterServices.PopulateObjectMembers(obj, mi, data);

            // handle the icon
            if (image != null)
            {
                RegisteredApplication ra = obj as RegisteredApplication;
                if (ra != null)
                {
                    ra.IconID = ImageCache.Add(ra.Name, image);
                    image.Dispose();
                    image = null;
                }
                else
                {
                    RegisteredNotification rn = obj as RegisteredNotification;
                    if (rn != null)
                    {
                        AddTemporaryNotificationImage(rn, image);
                        // dont dispose of the image yet, it will get taken care of later
                    }
                }
            }

            return obj;
        }
Example #30
0
 /**
  * Constructor used in deserialization
  */
 internal Cursor(SerializationInfo info, StreamingContext context) {
     SerializationInfoEnumerator sie = info.GetEnumerator();
     if (sie == null) {
         return;
     }
     for (; sie.MoveNext();) {
         // Dont catch any exceptions while Deserialising objects from stream.
         if (String.Equals(sie.Name, "CursorData", StringComparison.OrdinalIgnoreCase) ){
             cursorData = (byte[])sie.Value;
             if (cursorData != null) {
                 LoadPicture(new UnsafeNativeMethods.ComStreamFromDataStream(new MemoryStream(cursorData)));
             }
         }
         else if (String.Compare(sie.Name, "CursorResourceId", true, CultureInfo.InvariantCulture) == 0) {
             LoadFromResourceId((int)sie.Value);
         }
     }
 }
        internal void WriteSerializationInfo(XmlWriterDelegator xmlWriter, Type objType, SerializationInfo serInfo)
        {
            if (DataContract.GetClrTypeFullName(objType) != serInfo.FullTypeName)
            {
                if (base.DataContractResolver != null)
                {
                    XmlDictionaryString str;
                    XmlDictionaryString str2;
                    if (this.ResolveType(serInfo.ObjectType, objType, out str, out str2))
                    {
                        xmlWriter.WriteAttributeQualifiedName("z", DictionaryGlobals.ISerializableFactoryTypeLocalName, DictionaryGlobals.SerializationNamespace, str, str2);
                    }
                }
                else
                {
                    string str3;
                    string str4;
                    DataContract.GetDefaultStableName(serInfo.FullTypeName, out str3, out str4);
                    xmlWriter.WriteAttributeQualifiedName("z", DictionaryGlobals.ISerializableFactoryTypeLocalName, DictionaryGlobals.SerializationNamespace, DataContract.GetClrTypeString(str3), DataContract.GetClrTypeString(str4));
                }
            }
            this.WriteClrTypeInfo(xmlWriter, objType, serInfo);
            base.IncrementItemCount(serInfo.MemberCount);
            SerializationInfoEnumerator enumerator = serInfo.GetEnumerator();

            while (enumerator.MoveNext())
            {
                SerializationEntry  current       = enumerator.Current;
                XmlDictionaryString clrTypeString = DataContract.GetClrTypeString(DataContract.EncodeLocalName(current.Name));
                xmlWriter.WriteStartElement(clrTypeString, DictionaryGlobals.EmptyString);
                object obj2 = current.Value;
                if (obj2 == null)
                {
                    this.WriteNull(xmlWriter);
                }
                else
                {
                    this.InternalSerializeReference(xmlWriter, obj2, false, false, -1, Globals.TypeOfObject.TypeHandle);
                }
                xmlWriter.WriteEndElement();
            }
        }