示例#1
0
 public static bool IsRarFile(Stream stream)
 {
     try
     {
         RarHeaderFactory headerFactory = new RarHeaderFactory(StreamingMode.Seekable, RarOptions.CheckForSFX);
         RarHeader        header        = headerFactory.ReadHeaders(stream).FirstOrDefault();
         if (header == null)
         {
             return(false);
         }
         return(Enum.IsDefined(typeof(HeaderType), header.HeaderType));
     }
     catch
     {
         return(false);
     }
 }
示例#2
0
 public static bool IsRarFile(Stream stream, Options options)
 {
     try
     {
         RarHeaderFactory factory = new RarHeaderFactory(StreamingMode.Seekable, options, null);
         RarHeader        header  = Enumerable.FirstOrDefault <RarHeader>(factory.ReadHeaders(stream));
         if (header == null)
         {
             return(false);
         }
         return(Enum.IsDefined(typeof(HeaderType), header.HeaderType));
     }
     catch
     {
         return(false);
     }
 }