Example #1
0
        public static List <T> DeserializeList <T>(Runtime.Serialization.IO.CompactReader reader)
        {
            bool flag = reader.ReadBoolean();

            if (flag)
            {
                int      length = reader.ReadInt32();
                List <T> list   = new List <T>();

                for (int i = 0; i < length; i++)
                {
                    list.Add((T)reader.ReadObject());
                }

                return(list);
            }
            else
            {
                return(null);
            }
        }
Example #2
0
        public static ClusteredArray <T> DeserializeClusteredArray <T>(Runtime.Serialization.IO.CompactReader reader)
        {
            bool flag = reader.ReadBoolean();

            if (flag)
            {
                int length               = reader.ReadInt32();
                int threshold            = reader.ReadInt32();
                ClusteredArray <T> array = new ClusteredArray <T>(threshold, length);

                for (int i = 0; i < length; i++)
                {
                    array[i] = (T)reader.ReadObject();
                }

                return(array);
            }
            else
            {
                return(null);
            }
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        public static IDictionary <T, V> DeserializeDictionary <T, V>(Runtime.Serialization.IO.CompactReader reader, IEqualityComparer <T> comparer = null)
        {
            T    key;
            V    val;
            bool flag = reader.ReadBoolean();

            if (flag)
            {
                IDictionary <T, V> dictionary = new HashVector <T, V>(comparer);
                int Length = reader.ReadInt32();
                for (int i = 0; i < Length; i++)
                {
                    key = (T)reader.ReadObject();
                    val = (V)reader.ReadObject();

                    dictionary.Add(key, val);
                }
                return(dictionary);
            }
            else
            {
                return(null);
            }
        }
Example #4
0
        public static IDictionary <T, IDictionary <V, K> > DeserializeDD <T, V, K>(Runtime.Serialization.IO.CompactReader reader)
        {
            bool flag = reader.ReadBoolean();

            if (flag)
            {
                T key;

                int dictionarylength = reader.ReadInt32();
                IDictionary <T, IDictionary <V, K> > dList = new HashVector <T, IDictionary <V, K> >();
                for (int i = 0; i < dictionarylength; i++)
                {
                    IDictionary <V, K> valueList;
                    key       = (T)reader.ReadObject();
                    valueList = DeserializeDictionary <V, K>(reader);
                    dList.Add(key, valueList);
                }
                return(dList);
            }
            else
            {
                return(null);
            }
        }
Example #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        public static ConcurrentDictionary <T, TV> DeserializeConcurrentDictionary <T, TV>(Runtime.Serialization.IO.CompactReader reader)
        {
            bool flag = reader.ReadBoolean();

            if (flag)
            {
                ConcurrentDictionary <T, TV> dictionary = new ConcurrentDictionary <T, TV>();
                int length = reader.ReadInt32();
                for (int i = 0; i < length; i++)
                {
                    T  key = (T)reader.ReadObject();
                    TV val = (TV)reader.ReadObject();

                    dictionary.TryAdd(key, val);
                }
                return(dictionary);
            }
            return(null);
        }