Пример #1
0
        public List <ImageNameData> LoadBook(string path)
        {
            List <ImageNameData> result = new List <ImageNameData>();

            SevenZipExtractor extractor = null;

            try
            {
                Use7Zip.SetSevenZipDllPath();

                extractor = new SevenZipExtractor(path);
                long size = extractor.PackedSize;
                foreach (ArchiveFileInfo fil in extractor.ArchiveFileData)
                {
                    if (!fil.IsDirectory)
                    {
                        if (Use7Zip.ImageExtensions.Contains(Path.GetExtension(fil.FileName).ToLower()))
                        {
                            ImageNameData data = new ImageNameData(fil.FileName, path);
                            result.Add(data);
                            if (this.ImageNameDataAdded != null)
                            {
                                this.ImageNameDataAdded(this, new ImageNameDataAddedEventArgs(data, result.Count));
                            }
                        }
                    }
                }

                result.Sort();
                //foreach (ImageNameData id in result)
                //{
                //    System.Diagnostics.Debug.WriteLine("sorted: " + id.Name);
                //}
            }
            catch (Exception err)
            {
                System.Diagnostics.Debug.WriteLine(err.Message);
            }
            finally
            {
                if (extractor != null)
                {
                    extractor.Dispose();
                    extractor = null;
                }
            }
            return(result);
        }
Пример #2
0
 public ImageNameDataAddedEventArgs(ImageNameData current, int count)
 {
     this.DataDone    = current;
     this.NumberAdded = count;
 }