Beispiel #1
0
 public override ArcFile TryOpen(ArcView file)
 {
     using (var input = file.CreateStream())
         using (var reader = new PsbReader(input))
         {
             foreach (var key in KnownKeys)
             {
                 try
                 {
                     if (reader.Parse(key))
                     {
                         return(OpenArcFile(reader, file));
                     }
                     if (!reader.IsEncrypted)
                     {
                         break;
                     }
                 }
                 catch { /* ignore parse errors caused by invalid key */ }
             }
             if (reader.ParseNonEncrypted())
             {
                 return(OpenArcFile(reader, file));
             }
             return(null);
         }
 }
Beispiel #2
0
 public override ArcFile TryOpen(ArcView file)
 {
     using (var input = file.CreateStream())
         using (var reader = new PsbReader(input))
         {
             foreach (var key in KnownKeys)
             {
                 if (reader.Parse(key))
                 {
                     var dir = reader.GetTextures();
                     if (null == dir || 0 == dir.Count)
                     {
                         return(null);
                     }
                     else
                     {
                         return(new ArcFile(file, this, dir));
                     }
                 }
                 if (!reader.IsEncrypted)
                 {
                     break;
                 }
             }
             return(null);
         }
 }
Beispiel #3
0
        ArcFile OpenArcFile(PsbReader reader, ArcView file)
        {
            var dir = reader.GetTextures();

            if (null == dir)
            {
                dir = reader.GetLayers();
            }
            if (null == dir || 0 == dir.Count)
            {
                return(null);
            }
            return(new ArcFile(file, this, dir));
        }