Exemplo n.º 1
0
        /// <summary>
        /// Loads a manifest from a <see cref="Stream"/>.
        /// </summary>
        /// <param name="manifestStream">A stream containing a manifest."/></param>
        /// <returns>A list of <see cref="ManifestEntry"/> objects.</returns>
        private static List <ManifestEntry> LoadManifest(Stream manifestStream)
        {
            List <string> rawManifest = new List <string>();

            using (StreamReader sr = new StreamReader(manifestStream))
            {
                while (sr.BaseStream.Position < sr.BaseStream.Length)
                {
                    rawManifest.Add(sr.ReadLine());
                }
            }

            List <ManifestEntry> manifest = new List <ManifestEntry>();

            foreach (string rawEntry in rawManifest)
            {
                ManifestEntry newEntry;
                if (ManifestEntry.TryParse(rawEntry, out newEntry))
                {
                    manifest.Add(newEntry);
                }
            }

            return(manifest);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Loads a manifest from a <see cref="Stream"/>.
        /// </summary>
        /// <param name="manifestStream">A stream containing a manifest."/></param>
        /// <returns>A read-only list of <see cref="ManifestEntry"/> objects.</returns>
        public static IReadOnlyList <ManifestEntry> LoadManifest(Stream manifestStream)
        {
            var rawManifest = new List <string>();

            using (var sr = new StreamReader(manifestStream))
            {
                string line;
                while ((line = sr.ReadLine()) != null)
                {
                    rawManifest.Add(line);
                }
            }

            var manifest = new List <ManifestEntry>();

            foreach (var rawEntry in rawManifest)
            {
                if (ManifestEntry.TryParse(rawEntry, out var newEntry))
                {
                    manifest.Add(newEntry);
                }
            }

            return(manifest);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Loads a manifest from a <see cref="Stream"/>.
        /// </summary>
        /// <param name="manifestStream">A stream containing a manifest."/></param>
        /// <returns>A list of <see cref="ManifestEntry"/> objects.</returns>
        public static List <ManifestEntry> LoadManifest(Stream manifestStream)
        {
            List <string> rawManifest = new List <string>();

            using (StreamReader sr = new StreamReader(manifestStream))
            {
                string line;
                while ((line = sr.ReadLine()) != null)
                {
                    rawManifest.Add(line);
                }
            }

            List <ManifestEntry> manifest = new List <ManifestEntry>();

            foreach (string rawEntry in rawManifest)
            {
                ManifestEntry newEntry;
                if (ManifestEntry.TryParse(rawEntry, out newEntry))
                {
                    manifest.Add(newEntry);
                }
            }

            return(manifest);
        }