示例#1
0
        private AssetTreeNode CreateTreeFromDisk(string rootPath, string path, BackgroundWorker worker)
        {
            if (Directory.Exists(path))
            {
                // Show the relative path so we have more real estate in the progress dialog
                string relativePath = DosUtils.PathMakeRelativePath(rootPath, path);
                worker.ReportProgress(0, "Loading:\n" + relativePath);

                AssetTreeNode node = CreateFolderNode(path);

                //Add subdirectories
                foreach (string subdir in Directory.GetDirectories(path))
                {
                    node.Nodes.Add(CreateTreeFromDisk(rootPath, subdir, worker));
                }

                //Add files
                foreach (string file in Directory.GetFiles(path))
                {
                    node.Nodes.Add(CreateFileNode(file, path));
                }

                return(node);
            }

            return(null);
        }
示例#2
0
        private void SyncTargetTreeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            string relativePath = DosUtils.PathMakeRelativePath(MOG_ControllerProject.GetWorkspaceDirectory(), e.Node.FullPath);

            SyncTargetTextBox.Text      = relativePath;
            SyncTargetTextBox.BackColor = Color.PaleGreen;
        }
示例#3
0
        private void UpdateSyncTargetTree()
        {
            // Attempt to drill to the specified path
            string relativeSyncTargetPath = DosUtils.PathMakeRelativePath(this.SyncTargetTreeView.MOGRootNode.FullPath, SyncTargetTextBox.Text);

            this.SyncTargetTreeView.MOGSelectedNode = MogUtil_ClassificationTrees.FindAndExpandTreeNodeFromFullPath(this.SyncTargetTreeView.MOGRootNode.Nodes, "\\", relativeSyncTargetPath);
        }
        /// <summary>
        /// Fetch the next set of files and folders for this parent folder
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="fullPath"></param>
        /// <param name="targetGameData"></param>
        private void VirtualExpand(TreeNode parent, string fullPath, string workspaceDirectory)
        {
            try
            {
                // If we have a gameData target we need to remove it from our path prepatory to the Dictionary lookup of the children of this folder
                if (DosUtils.PathIsWithinPath(workspaceDirectory, fullPath))
                {
                    // Also remove any begininng backslashes
                    fullPath = DosUtils.PathMakeRelativePath(workspaceDirectory, fullPath);
                }

                HybridDictionary dic = mSyncTargetFiles.GetFiles(fullPath);
                if (dic != null)
                {
                    // Search our btree for the children of this folder
                    IDictionaryEnumerator file = dic.GetEnumerator();

                    // Now itterate through those children
                    while (file.MoveNext())
                    {
                        string fullDirectoryName = "";
                        // we now need to reconstruct the full path to this file or folder
                        if (fullPath.Length == 0)
                        {
                            fullDirectoryName = workspaceDirectory + "\\" + file.Key;
                        }
                        else
                        {
                            fullDirectoryName = workspaceDirectory + "\\" + fullPath + "\\" + file.Key;
                        }

                        DirectorySetInfo fileInfo = (DirectorySetInfo)file.Value;

                        // Create the node
                        TreeNode newNode = CreateTreeNodeFullPath(GameDataTreeView, parent, workspaceDirectory, "\\", file.Key as string, fullDirectoryName, fileInfo, 0, 0, 0, 0, true);

                        // If this is a newly created node and it is a folder, we assume it has children and create a black node beneath it
                        if (newNode != null && newNode.Nodes.Count == 0)
                        {
                            guiAssetTreeTag info           = (guiAssetTreeTag)newNode.Tag;
                            string          relationalPath = "";

                            // Get a relational path to this folder
                            if (fullPath.Length == 0)
                            {
                                relationalPath = file.Key as string;
                            }
                            else
                            {
                                relationalPath = fullPath + "\\" + file.Key;
                            }

                            // If this file is a folder and has children, create a place holder 'blank'
                            if (info != null && info.TagType == guiAssetTreeTag.TREE_FOCUS.FOLDER && mSyncTargetFiles.HasFolderChildren(relationalPath, false))
                            {
                                newNode.Nodes.Add("BLANK");
                            }
                        }
                    }
                }
            }
            catch
            {
            }
        }