Google.SafeBrowsing.API.ParseFullHashes C# (CSharp) Метод

ParseFullHashes() приватный Метод

private ParseFullHashes ( Stream stream ) : IEnumerable
stream Stream
Результат IEnumerable
        private IEnumerable<byte[]> ParseFullHashes(Stream stream)
        {
            var hashes = new List<byte[]>();

            Regex regex = new Regex(@"^(.+)\:(\d+)\:(\d+)$");
            Match match = null;
            string list = null;
            int chunkNum = 0, hashLen;

            string line = null;

            var sr = new StreamReader(stream);

            //simple state machine
            while (!sr.EndOfStream)
            {
                line = sr.ReadLine();
                match = regex.Match(line);

                if (!match.Success)
                    throw new Exception("Unable to parse data");

                //list and chunk id is ignored
                list = match.Groups[1].Value;
                if (!Int32.TryParse(match.Groups[2].Value, out chunkNum))
                    chunkNum = 0;
                if (!Int32.TryParse(match.Groups[3].Value, out hashLen))
                    hashLen = 0;

                line = sr.ReadLine();

                hashes.Add(Encoding.ASCII.GetBytes(line));

            }

            return hashes;
        }