Пример #1
0
        public static string[] GetArchiveFiles(SourceFile file)
        {
            List <string> results = new List <string>();
            string        path    = file.FilePath;

            using (Stream stream = file.OpenStream())
            {
                try
                {
                    using (IArchive archive = ArchiveFactory.Open(stream))
                    {
                        if (archive.Type == SharpCompress.Common.ArchiveType.Tar)
                        {
                            return(null); //default type when not recognised
                        }

                        foreach (IArchiveEntry entry in archive.Entries)
                        {
                            if (!entry.IsDirectory)
                            {
                                try
                                {
                                    string ext = Path.GetExtension(entry.Key).ToLower();
                                    if (ext == ".nkit" || ext == ".gcz" || ext == ".gcm" || ext == ".iso" || ext == ".dec" || ext == ".wbfs")
                                    {
                                        results.Add(entry.Key);
                                    }
                                }
                                catch { }
                            }
                        }
                    }
                }
                catch
                {
                    return(null);
                }
            }
            return(results.ToArray());
        }