Ejemplo n.º 1
0
        /// <summary>
        /// 삭제할 ZIP 파일 리스트에서 특정 파일을 제외합니다.
        /// </summary>
        /// <param name="path">제외하려는 TreeNode의 Name</param>
        /// <returns></returns>
        public override bool Delist(string path)
        {
            try
            {
                EntryTree.BeginUpdate();

                foreach (var key in deZipper.Entries.ToList())
                {
                    if (key.Value.FullName.Contains(path))
                    {
                        deZipper.Delist(key.Value.FullName);
                        if (key.Value.Name.Equals(""))
                            cDirs--;
                        else
                            cFiles--;
                    }
                }

                TreeNode delNode = EntryTree.Nodes.Find(path, true)[0];

                EntryTree.Nodes.Remove(delNode);
                EntryTree.EndUpdate();

                return true;
            }
            catch
            {
                throw;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// TreeView 컴포넌트에 파일 리스트를 출력합니다.
        /// </summary>
        public override void PrintList()
        {
            try
            {
                cDirs = 0;
                cFiles = 0;

                EntryTree.BeginUpdate();
                EntryTree.Nodes.Clear();

                List<string> dirList = new List<string>();
                TreeNodeCollection branch = EntryTree.Nodes;

                foreach (KeyValuePair<string, ZipArchiveEntry> entry in deZipper.Entries)
                {
                    string path = entry.Value.FullName;
                    path = path.TrimEnd('/');
                    path = path.Remove(path.LastIndexOf('/') + 1);

                    if (entry.Value.Name.Equals(""))    // Folder
                    {
                        string name = entry.Value.FullName.Split('/')[entry.Value.FullName.Split('/').Length - 2];

                        dirList.Add(entry.Value.FullName);

                        if (dirList.Contains(path))
                            branch.Find(path, true)[0].Nodes.Add(entry.Value.FullName, name, 1, 1);
                        else
                            branch.Add(entry.Value.FullName, name, 1, 1);

                        cDirs++;
                    }
                    else                                // Files
                    {
                        if (dirList.Contains(path))
                            branch.Find(path, true)[0].Nodes.Add(entry.Value.FullName, entry.Value.Name);
                        else
                            branch.Add(entry.Value.FullName, entry.Value.Name);

                        cFiles++;
                    }
                }

                EntryTree.EndUpdate();
                EntryTree.ExpandAll();
            }
            catch
            {
                throw;
            }
        }