Exemplo n.º 1
0
 private Dictionary<uint, Bitstream> ReadStreams (List<Page> pages, out long end)
 {
    Dictionary<uint, Bitstream> streams = new Dictionary<uint, Bitstream> ();
    List<Bitstream> active_streams = new List<Bitstream> ();
    
    long position = 0;
    
    do
    {
       Bitstream stream = null;
       Page page = new Page (this, position);
       
       if ((page.Header.Flags & PageFlags.FirstPageOfStream) != 0)
       {
          stream = new Bitstream (page);
          streams.Add (page.Header.StreamSerialNumber, stream);
          active_streams.Add (stream);
       }
       
       if (stream == null)
          stream = streams [page.Header.StreamSerialNumber];
       
       if (active_streams.Contains (stream) && stream.ReadPage (page))
          active_streams.Remove (stream);
       
       if (pages != null)
          pages.Add (page);
       
       position += page.Size;
    }
    while (active_streams.Count > 0);
    
    end = position;
    
    return streams;
 }