Exemple #1
0
 public ImageNameData(string name, string path)
 {
     this.FullName = name;
     this.Name     = new System.IO.FileInfo(name).Name;
     this.Path     = path;
     this.Image    = Use7Zip.GetImageFromStream(path, name);
     SetWidthHeight(this.Image.PixelWidth, this.Image.PixelHeight);
     //((BitmapImage)this.Image).PixelWidth;
     System.Diagnostics.Debug.WriteLine("ImageNameData " + this.Name + " : w: " + this.Image.PixelWidth.ToString() + " : Full: " + this.FullName);
 }
Exemple #2
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);
        }