コード例 #1
0
 private static IEnumerable <BreakingChange> ParseBreakingChange(Stream stream, string extension)
 {
     if (string.Equals(".md", extension, StringComparison.OrdinalIgnoreCase))
     {
         return(BreakingChangeParser.FromMarkdown(stream));
     }
     if (string.Equals(".json", extension, StringComparison.OrdinalIgnoreCase))
     {
         return(stream.Deserialize <IEnumerable <BreakingChange> >());
     }
     else
     {
         return(Enumerable.Empty <BreakingChange>());
     }
 }
コード例 #2
0
ファイル: Data.cs プロジェクト: mi8301/dotnet-apiport
 private static IEnumerable <BreakingChange> ParseBreakingChange(Stream stream, string extension, IEnumerable <string> allowedCategories)
 {
     if (string.Equals(".md", extension, StringComparison.OrdinalIgnoreCase))
     {
         return(BreakingChangeParser.FromMarkdown(stream, allowedCategories));
     }
     if (string.Equals(".json", extension, StringComparison.OrdinalIgnoreCase))
     {
         try
         {
             return(stream.Deserialize <IEnumerable <BreakingChange> >());
         }
         catch (Exception)
         {
             // An invalid json file will throw an exception when deserialized. Simply ignore such files.
         }
     }
     return(Enumerable.Empty <BreakingChange>());
 }