Exemple #1
0
        /// <summary>
        /// Read lines of meta docs from Java files in a zip.
        /// </summary>
        public static string[] ReadLines(ZipArchive zip, string folderLimit = null)
        {
            List <string> lines = new List <string>();

            foreach (ZipArchiveEntry entry in zip.Entries)
            {
                if (folderLimit != null && !entry.FullName.StartsWith(folderLimit))
                {
                    continue;
                }
                if (!entry.FullName.EndsWith(".java"))
                {
                    continue;
                }
                using (Stream entryStream = entry.Open())
                {
                    lines.Add(START_OF_FILE_PREFIX + entry.FullName);
                    lines.AddRange(entryStream.AllLinesOfText().Where((s) => s.TrimStart().StartsWith("// ")).Select((s) => s.Trim().Substring("// ".Length).Replace("\r", "")));
                    lines.Add(END_OF_FILE_MARK);
                }
            }
            return(lines.ToArray());
        }