示例#1
0
        static internal HttpStaticObjectsCollection Deserialize(BinaryReader reader)
        {
            int    count;
            string name;
            string typename;
            bool   hasInstance;
            Object instance;
            HttpStaticObjectsEntry      entry;
            HttpStaticObjectsCollection col;

            col = new HttpStaticObjectsCollection();

            count = reader.ReadInt32();
            while (count-- > 0)
            {
                name        = reader.ReadString();
                hasInstance = reader.ReadBoolean();
                if (hasInstance)
                {
                    instance = AltSerialization.ReadValueFromStream(reader);
                    entry    = new HttpStaticObjectsEntry(name, instance, 0);
                }
                else
                {
                    typename = reader.ReadString();
                    bool lateBound = reader.ReadBoolean();
                    entry = new HttpStaticObjectsEntry(name, Type.GetType(typename), lateBound);
                }

                col._objects.Add(name, entry);
            }

            return(col);
        }
示例#2
0
        static internal SessionDictionary Deserialize(BinaryReader reader)
        {
            SessionDictionary d = new SessionDictionary();
            int    count;
            int    nullKey;
            String key;
            Object value;
            int    i;

            count   = reader.ReadInt32();
            nullKey = reader.ReadInt32();

            for (i = 0; i < count; i++)
            {
                if (i == nullKey)
                {
                    key = null;
                }
                else
                {
                    key = reader.ReadString();
                }
                value = AltSerialization.ReadValueFromStream(reader);
                d.BaseSet(key, value);
            }

            d._dirty = false;

            return(d);
        }
示例#3
0
        public static HttpStaticObjectsCollection Deserialize(BinaryReader reader)
        {
            HttpStaticObjectsCollection objectss = new HttpStaticObjectsCollection();
            int num = reader.ReadInt32();

            while (num-- > 0)
            {
                HttpStaticObjectsEntry entry;
                string name = reader.ReadString();
                if (reader.ReadBoolean())
                {
                    object instance = AltSerialization.ReadValueFromStream(reader);
                    entry = new HttpStaticObjectsEntry(name, instance, 0);
                }
                else
                {
                    string typeName  = reader.ReadString();
                    bool   lateBound = reader.ReadBoolean();
                    entry = new HttpStaticObjectsEntry(name, Type.GetType(typeName), lateBound);
                }
                objectss._objects.Add(name, entry);
            }
            return(objectss);
        }
 private object ReadValueFromStreamWithAssert()
 {
     return(AltSerialization.ReadValueFromStream(new BinaryReader(_stream)));
 }