Example #1
0
        private void LoadFileOrDirectory(string path)
        {
            // 新規アーカイバ
            ArchiverBase archiver;

            // ファイル
            if (File.Exists(path))
            {
                // 拡張子取得
                string ext = Path.GetExtension(path);

                // 画像ファイル単体
                ImageFileContext ifc = NullArchiver.LoadImageFileContext(path);
                if (ifc != null)
                {
                    ImageFileContextList.Add(ifc);
                }

                // 圧縮ファイル / その他のファイル
                else
                {
                    if (ext == ".lnk")
                    {
                        // .lnkファイルの場合、ショートカット先のフルパスを取得し、やり直し
                        LoadFileOrDirectory(GetShortcutTargetPath(path));
                        return;
                    }
                    else
                    {
                        // 書庫
                        archiver = ArchiverFactory.Create(path, ext);
                        if (archiver == null)
                        {
                            return;
                        }
                        else
                        {
                            Archivers.Add(archiver);
                        }
                    }

                    ImageFileContextList.AddRange(archiver.LoadImageFileContextList());
                }
            }

            // フォルダ
            else if (Directory.Exists(path))
            {
                Archivers.Add(archiver = new FolderArchiver(path));
                ImageFileContextList.AddRange(archiver.LoadImageFileContextList());
            }
        }
Example #2
0
        /* ---------------------------------------------------- */
        //     メソッド
        /* ---------------------------------------------------- */
        public void Initialize(string[] pathes, bool isAddition)
        {
            if (!isAddition)
            {
                ImageFileContextList.Clear();
                Archivers.Clear();
            }

            foreach (string path in pathes)
            {
                LoadFileOrDirectory(path);
            }

            InitIndex(0);
        }