示例#1
0
        /// <summary>
        /// Gets a list of source files used to create this PAR2 file.
        /// </summary>
        /// <returns>A collection of <see cref="SourceFile"/> objects.</returns>
        public IEnumerable<SourceFile> GetSourceList()
        {
            var yieldedFiles = new List<FileID>();

            using (var reader = new ParReader(StreamFactory.GetContentStreamAsync(Location).Result))
            {
                while (reader.BaseStream.Position < reader.BaseStream.Length)
                {
                    var fd = reader.ReadPacket(Packet.DefaultFactory.GetPacketType<FileDescriptionPacket>()) as FileDescriptionPacket;

                    if (fd == null)
                        break;

                    if (yieldedFiles.Contains(fd.FileID))
                        continue;

                    yield return fd.ToSourceFile();
                }
            }
        }
示例#2
0
        /// <summary>
        /// Gets a list of source files used to create this PAR2 file.
        /// </summary>
        /// <returns>A collection of <see cref="SourceFile"/> objects.</returns>
        public IEnumerable <SourceFile> GetSourceList()
        {
            var yieldedFiles = new List <FileID>();

            using (var reader = new ParReader(StreamFactory.GetContentStreamAsync(Location).Result))
            {
                while (reader.BaseStream.Position < reader.BaseStream.Length)
                {
                    var fd = reader.ReadPacket(Packet.DefaultFactory.GetPacketType <FileDescriptionPacket>()) as FileDescriptionPacket;

                    if (fd == null)
                    {
                        break;
                    }

                    if (yieldedFiles.Contains(fd.FileID))
                    {
                        continue;
                    }

                    yield return(fd.ToSourceFile());
                }
            }
        }