Пример #1
0
        private void AddFilesToSelectedNode(TreeView treeview, string filter)
        {
            TreeNode selectedNode = treeview.SelectedNode;

            if (CanAddFolder_File(selectedNode))
            {
                OpenFileDialog dlg = new OpenFileDialog();
                dlg.Multiselect = true;
                dlg.Filter      = filter;
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    foreach (string filename in dlg.FileNames)
                    {
                        FileInfo fileInfo = new FileInfo(filename);
                        TreeNode newNode  = new TreeNode(fileInfo.Name, sysilsSmall.IconIndex(fileInfo.FullName, true), sysilsSmall.IconIndex(fileInfo.FullName, true));
                        treeview.SelectedNode.Nodes.Add(newNode);
                        ComponentProperty property = new ComponentProperty();
                        property.Id         = Common.GetId();
                        property.SourcePath = fileInfo.FullName;
                        newNode.Tag         = new ComponentNode(ComponentType.File, property);
                    }

                    // change file, folder count value
                    CalculateFilesFoldersCount_Start();
                }
            }
        }
Пример #2
0
        private void pgComponent_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
        {
            ComponentProperty selectedComponent = (ComponentProperty)pgComponent.SelectedObject;

            if (String.IsNullOrEmpty(selectedComponent.PatchFile) == false)
            {
                ChangeNodeColor(tvComponents.SelectedNode, true, Globals.PatchFileColor);
            }
        }
Пример #3
0
        private void AddFoldersFilesInPath(TreeNode node, string path)
        {
            if (Directory.Exists(path) && CanAddFolder_File(node))
            {
                // add this directory to this tree node
                DirectoryInfo dirInfo = new DirectoryInfo(path);
                TreeNode      dirNode = new TreeNode(dirInfo.Name, sysilsSmall.IconIndex(dirInfo.FullName, true), sysilsSmall.IconIndex(dirInfo.FullName, true));
                dirNode.Tag = new ComponentNode(ComponentType.Folder, new ComponentProperty());
                AddNodeInUIThread(node, dirNode);// node.Nodes.Add(dirNode);
                addFilesFoldersThread.ReportProgress(1);
                FileInfo[] files = dirInfo.GetFiles();
                foreach (FileInfo file in files)
                {
                    TreeNode          fileNode = new TreeNode(file.Name, sysilsSmall.IconIndex(file.FullName, true), sysilsSmall.IconIndex(file.FullName, true));
                    ComponentProperty property = new ComponentProperty();
                    property.Id         = Common.GetId();
                    property.SourcePath = file.FullName;
                    fileNode.Tag        = new ComponentNode(ComponentType.File, property);
                    AddNodeInUIThread(dirNode, fileNode);// dirNode.Nodes.Add(fileNode);
                    addFilesFoldersThread.ReportProgress(1);
                }

                string[] directories = Directory.GetDirectories(path);
                foreach (string directoryPath in directories)
                {
                    AddFoldersFilesInPath(dirNode, directoryPath);
                }
            }
            else if (File.Exists(path) && CanAddFolder_File(node))
            {
                // add this file to node
                FileInfo          file     = new FileInfo(path);
                TreeNode          fileNode = new TreeNode(file.Name, sysilsSmall.IconIndex(file.FullName, true), sysilsSmall.IconIndex(file.FullName, true));
                ComponentProperty property = new ComponentProperty();
                property.Id         = Common.GetId();
                property.SourcePath = file.FullName;
                fileNode.Tag        = new ComponentNode(ComponentType.File, property);
                AddNodeInUIThread(node, fileNode);// node.Nodes.Add(fileNode);
                addFilesFoldersThread.ReportProgress(1);
            }
        }
Пример #4
0
        private void addAssembly_Components_Click(object sender, EventArgs e)
        {
            TreeNode selectedNode = tvComponents.SelectedNode;

            if (CanAddFolder_File(selectedNode))
            {
                OpenFileDialog dlg = new OpenFileDialog();
                dlg.Multiselect = true;
                dlg.Filter      = "Assembly|*.exe;*.dll";
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    foreach (string filename in dlg.FileNames)
                    {
                        FileInfo fileInfo = new FileInfo(filename);
                        TreeNode node     = new TreeNode("[Assembly:" + fileInfo.Name + "]", sysilsSmall.IconIndex(fileInfo.FullName, true), sysilsSmall.IconIndex(fileInfo.FullName, true));
                        tvComponents.SelectedNode.Nodes.Add(node);
                        ComponentProperty property = new ComponentProperty();
                        property.Id         = Common.GetId();
                        property.SourcePath = fileInfo.FullName;
                        node.Tag            = new ComponentNode(ComponentType.Assembly, property);
                    }
                }
            }
        }
Пример #5
0
 public ComponentNode(ComponentType type, ComponentProperty property)
 {
     this.type     = type;
     this.property = property;
 }