Exemple #1
0
        private static void readHeader <T>(BinaryReader reader, IList <T> items, HeaderCallback <T> readCallback)
        {
            // Count
            int count = BinaryReaderTools.ReadNumber(reader);

            // Items)
            for (int i = 0; i < count; i++)
            {
                string itemAsText = BinaryReaderTools.ReadString(reader);
                T      item       = readCallback(itemAsText);
                items.Add(item);
            }
        }
        private static void ReadHeader <T>(BinaryReader reader, ICollection <T> items, HeaderCallback <T> readCallback)
        {
            // Count
            var count = BinaryReaderTools.ReadNumber(reader);

            // Items
            for (var i = 0; i < count; i++)
            {
                var itemAsText = BinaryReaderTools.ReadString(reader);
                var item       = readCallback(itemAsText);
                items.Add(item);
            }
        }
 /// <summary>
 ///   Read integer which was saved as 1,2 or 4 bytes, according to its size
 /// </summary>
 /// <returns></returns>
 public int ReadNumber()
 {
     return(BinaryReaderTools.ReadNumber(_reader));
 }
Exemple #4
0
        /// <summary>
        ///   Read type
        /// </summary>
        /// <returns></returns>
        public Type ReadType()
        {
            int index = BinaryReaderTools.ReadNumber(_reader);

            return(_types[index]);
        }
Exemple #5
0
        /// <summary>
        ///   Reads property name
        /// </summary>
        /// <returns></returns>
        public string ReadName()
        {
            int index = BinaryReaderTools.ReadNumber(_reader);

            return(_names[index]);
        }