コード例 #1
0
        public void setFileList(MyDirectory myDict)
        {
            explorerFrom.clearData();
            List <ListViewItem> fileList = myDict.getFileList();

            explorerFrom.setData(fileList);
        }
コード例 #2
0
        public TreeNode addDirectory(MyDirectory directory)
        {
            if (idDirectoryDict.ContainsKey(directory.id))
            {
                return(idDirectoryDict[directory.id]);
            }
            TreeNode treeNode = new TreeNode(directory.name);

            treeNodeDirectoryDict.Add(treeNode, directory);

            idDirectoryDict.Add(directory.id, treeNode);
            List <TreeNode> lostChildNodeList = new List <TreeNode>();

            foreach (TreeNode unknownTreeNode in unknownPathTreeNode.Nodes)
            {
                if (treeNodeDirectoryDict[unknownTreeNode].parentId == directory.id)
                {
                    lostChildNodeList.Add(unknownTreeNode);
                }
            }

            foreach (TreeNode lostChildNode in lostChildNodeList)
            {
                unknownPathTreeNode.Nodes.Remove(lostChildNode);
                treeNode.Nodes.Add(lostChildNode);
            }

            if (directory.parentId == 1)
            {
                treeViewExplorer.Nodes.Add(treeNode);
            }
            else if (idDirectoryDict.ContainsKey(directory.parentId))
            {
                idDirectoryDict[directory.parentId].Nodes.Add(treeNode);
            }
            else
            {
                unknownPathTreeNode.Nodes.Add(treeNode);
            }
            return(treeNode);
        }
コード例 #3
0
        public void setRecordListMethod(List <ListViewItem> listViewItemList)
        {
            if (parsingTable.getTableName().Equals("SystemIndex_GthrPth"))
            {
                fileTreeForm.init();
                listViewItemList.Sort(compareRecord);
                fileTreeForm.startAddDirectory();
                foreach (ListViewItem listViewItem in listViewItemList)
                {
                    try
                    {
                        MyDirectory myDir = new MyDirectory();
                        myDir.id       = Int32.Parse(listViewItem.SubItems[1].Text);
                        myDir.parentId = Int32.Parse(listViewItem.SubItems[2].Text);
                        myDir.name     = listViewItem.SubItems[3].Text;

                        fileTreeForm.addDirectory(myDir);
                    }
                    catch (Exception e)
                    {
                    }
                }
                fileTreeForm.finishAddDirectory();
            }

            if (parsingTable.getTableName().Equals("SystemIndex_Gthr"))
            {
                fileDictionary = new Dictionary <int, MyFile>();
                foreach (ListViewItem listViewItem in listViewItemList)
                {
                    try
                    {
                        MyFile myFile = new MyFile();
                        myFile.parentId     = Int32.Parse(listViewItem.SubItems[1].Text);
                        myFile.id           = Int32.Parse(listViewItem.SubItems[2].Text);
                        myFile.lastModified = listViewItem.SubItems[3].Text;
                        myFile.priority     = Int32.Parse(listViewItem.SubItems[4].Text);
                        myFile.name         = listViewItem.SubItems[5].Text;
                        if (!fileDictionary.Keys.Contains(myFile.id))
                        {
                            fileDictionary.Add(myFile.id, myFile);
                            fileTreeForm.addChild(myFile);
                        }
                    }
                    catch (Exception e)
                    {
                    }
                }
                List <string> columnList = new List <string>()
                {
                    "FileName", "LastModified"
                };
                explorerFrom.clearData();
                explorerFrom.clearColumn();
                explorerFrom.setColumn(columnList);
                explorerFrom.Show(dockPanel, DockState.Document);
            }
            if (parsingTable.getTableName().Equals("SystemIndex_PropertyStore") || parsingTable.getTableName().Equals("SystemIndex_0A"))
            {
                MyDirectory categorizeDir = new MyDirectory();
                categorizeDir.id       = -2;
                categorizeDir.parentId = 1;
                categorizeDir.name     = "Categorize";
                fileTreeForm.addDirectory(categorizeDir);

                MyDirectory allDir = new MyDirectory();
                allDir.id       = -3;
                allDir.parentId = 1;
                allDir.name     = "ALL";
                fileTreeForm.addDirectory(allDir);

                extDirDictionary = new Dictionary <string, MyDirectory>();
                int           categorizeID  = -3;
                List <string> parsingColumn = parsingTable.getParsingColumn();
                explorerFrom.addColumn(parsingColumn);

                foreach (ListViewItem listViewItem in listViewItemList)
                {
                    MyFile myFile;
                    int    key = Int32.Parse(listViewItem.SubItems[1].Text);
                    if (fileDictionary.ContainsKey(key))
                    {
                        myFile = fileDictionary[key];
                    }
                    else
                    {
                        myFile              = new MyFile();
                        myFile.parentId     = 0;
                        myFile.id           = key;
                        myFile.lastModified = "0";;
                        myFile.priority     = 0;
                        fileTreeForm.addChild(myFile);
                    }
                    allDir.addFile(myFile.id, myFile);
                    for (int i = 2; i < listViewItem.SubItems.Count; i++)
                    {
                        if (parsingColumn[i - 2].Contains("System_IsFolder"))
                        {
                            if (listViewItem.SubItems[i].Text == "TRUE")
                            {
                                myFile.isFolder = true;
                            }
                        }
                        else if (parsingColumn[i - 2].Contains("System_Search_AutoSummary"))
                        {
                            myFile.summary = listViewItem.SubItems[i].Text;
                        }
                        else if (parsingColumn[i - 2].Contains("System_FileName"))
                        {
                            if (myFile.name == "")
                            {
                                myFile.name = listViewItem.SubItems[i].Text;
                            }
                        }
                        else if (parsingColumn[i - 2].Contains("System_FileExtension"))
                        {
                            string ext = listViewItem.SubItems[i].Text.ToLower();
                            if (!extDirDictionary.Keys.Contains(ext))
                            {
                                MyDirectory newDir = new MyDirectory();
                                newDir.id       = categorizeID--;
                                newDir.parentId = categorizeDir.id;
                                newDir.name     = ext;
                                fileTreeForm.addDirectory(newDir);
                                extDirDictionary.Add(ext, newDir);
                            }
                            extDirDictionary[ext].addFile(myFile.id, myFile);
                        }
                        myFile.fileInformationList.Add(listViewItem.SubItems[i].Text);
                    }
                }
                fileTreeForm.sortTreeView(categorizeDir.id);
                explorerFrom.setAutoColumnSize();
                if (!searchForm.IsActivated)
                {
                    searchForm.Show(dockPanel, DockState.DockTop);
                    dockPanel.DockTopPortion = 45;
                }
            }
        }