Example #1
0
        /// <summary>
        /// Decode the next token as a list.
        /// Assumes the next token is a list.
        /// </summary>
        /// <param name="inputStream"></param>
        /// <param name="bytesConsumed"></param>
        /// <returns>Decoded list</returns>
        public static BList Decode(BinaryReader inputStream, ref int bytesConsumed)
        {
            // Get past 'l'
            inputStream.Read();
            bytesConsumed++;

            BList res = new BList();

            // Read elements till an 'e'
            while (inputStream.PeekChar() != 'e')
            {
                res.Add(BencodingUtils.Decode(inputStream, ref bytesConsumed));
            }

            // Get past 'e'
            inputStream.Read();
            bytesConsumed++;

            return(res);
        }
Example #2
0
        public bool Equals(BList obj)
        {
            IList <IBencodingType> other = obj;

            return(Equals(other));
        }
Example #3
0
        public override bool Equals(object obj)
        {
            BList other = obj as BList;

            return(Equals(other));
        }