/// <summary> /// Private method that parses and returns the list in the current position of the stream. /// </summary> /// <param name="br">The BinaryReader with the data to parse.</param> /// <returns>The list parsed.</returns> /// <remarks>If the current position does not contain data similar to "lvaluese", which is a bencoded list, an exception will be thrown.</remarks> private static BList ParseList(BinaryReader br) { StringBuilder buffer = new StringBuilder(1024); char c = (char)br.ReadByte(); if (c != 'l') { throw new InvalidCharacterException(c, "'l'"); } BList list = new BList(); do { list.Add(Parse(br)); } while ((char)br.PeekChar() != 'e'); br.ReadByte(); //skips the 'e' char return(list); }
/// <summary> /// Private method that parses and returns the list in the current position of the stream. /// </summary> /// <param name="br">The BinaryReader with the data to parse.</param> /// <returns>The list parsed.</returns> /// <remarks>If the current position does not contain data similar to "lvaluese", which is a bencoded list, an exception will be thrown.</remarks> private static BList ParseList(BinaryReader br) { StringBuilder buffer = new StringBuilder(1024); char c = (char)br.ReadByte(); if (c != 'l') throw new InvalidCharacterException(c, "'l'"); BList list = new BList(); do { list.Add(Parse(br)); } while ((char)br.PeekChar() != 'e'); br.ReadByte(); //skips the 'e' char return list; }