Example #1
0
        public override List <ImageFileContext> LoadImageFileContextList()
        {
            // サブディレクトリを含める/含めない オプション
            SearchOption searchOpt;

            if (MainWindow.Current.Setting.SerachAllDirectoriesInFolderReading)
            {
                searchOpt = SearchOption.AllDirectories;
            }
            else
            {
                searchOpt = SearchOption.TopDirectoryOnly;
            }

            // フォルダ内のファイルパスを取得し、拡張子でフィルタ
            var imgPathes     = Directory.GetFiles(this.ArchiverPath, "*.*", searchOpt);
            var filteredFiles = imgPathes.Where(file => AllowedFileExt.Any(ext =>
                                                                           file.ToLower().EndsWith(ext)));

            // ロード
            List <ImageFileContext> newList = new List <ImageFileContext>();

            foreach (string imgPath in filteredFiles)
            {
                ImageFileContext imageFileContext = new ImageFileContext(imgPath);
                imageFileContext.Archiver = this;
                newList.Add(imageFileContext);
            }

            return(newList);
        }
        public override List <ImageFileContext> LoadImageFileContextList()
        {
            List <ImageFileContext> newList = new List <ImageFileContext>();

            try
            {
                foreach (IArchiveEntry entry in archive.Entries)
                {
                    // ファイル拡張子でフィルタ
                    if (AllowedFileExt.Any(ext => entry.Key.ToLower().EndsWith(ext)))
                    {
                        // ロード
                        ImageFileContext ifc = new ImageFileContext(entry.Key);
                        ifc.Archiver = this;
                        ImageFileInfo fi = new ImageFileInfo();
                        fi.LastWriteTime = entry.LastModifiedTime;
                        fi.Length        = entry.Size;
                        ifc.Info         = fi;

                        newList.Add(ifc);
                    }
                }
            }
            catch
            {
                DisposeArchive();
                Debug.WriteLine("LoadImageFileInfoList() failed  path = " + ArchiverPath);
            }

            return(newList);
        }
Example #3
0
        public override List <ImageFileContext> LoadImageFileContextList()
        {
            List <ImageFileContext> newList = new List <ImageFileContext>();

            try
            {
                // エントリ
                var entries = GetEntries();

                foreach (ZipArchiveEntry entory in entries)
                {
                    // ファイル拡張子でフィルタ
                    if (AllowedFileExt.Any(ext => entory.FullName.ToLower().EndsWith(ext)))
                    {
                        // ロード
                        ImageFileContext ifc = new ImageFileContext(entory.FullName);
                        ImageFileInfo    fi  = new ImageFileInfo();
                        ifc.Info         = fi;
                        ifc.Archiver     = this;
                        fi.LastWriteTime = entory.LastWriteTime;
                        fi.Length        = entory.Length;

                        newList.Add(ifc);
                    }
                }
            }
            catch
            {
                DisposeArchive();
                Debug.WriteLine("LoadImageFileInfoList() failed  path = " + ArchiverPath);
            }

            return(newList);
        }
Example #4
0
        public ImageFileContext LoadImageFileContext(string filePath)
        {
            // 拡張子でフィルタ
            if (!AllowedFileExt.Any(ext => filePath.ToLower().EndsWith(ext)))
            {
                return(null);
            }

            ImageFileContext imageFileContext = new ImageFileContext(filePath);

            imageFileContext.Archiver = this;

            return(imageFileContext);
        }