コード例 #1
0
        public void InitializeVirtual(string platform)
        {
            if (!mInitialized)
            {
                GameDataTreeView.BeginUpdate();

                GameDataTreeView.Nodes.Clear();
                mVirtual = true;

                // Populate our project tree
                ArrayList virtualDirectories        = MOG_DBAssetAPI.GetAllProjectSyncTargetFilesForPlatform(platform);
                ArrayList fixedUpVirtualDirectories = new ArrayList();
                foreach (string file in virtualDirectories)
                {
                    // Only add files that have '\\' in front of them.  These are files.  Those
                    // without '\\' are packages and the files that go into them
                    if (file.StartsWith("\\"))
                    {
                        fixedUpVirtualDirectories.Add(file.TrimStart("\\".ToCharArray()));
                    }
                    else
                    {
                        // File did not have a starting '\', so just add it :)
                        fixedUpVirtualDirectories.Add(file);
                    }
                }

                mSyncTargetFiles = new DirectorySet(fixedUpVirtualDirectories);
                if (MOG_ControllerProject.GetCurrentSyncDataController() != null)
                {
                    mRoot     = new TreeNode(MOG_ControllerProject.GetCurrentSyncDataController().GetSyncDirectory());
                    mRoot.Tag = new guiAssetTreeTag(MOG_ControllerProject.GetCurrentSyncDataController().GetSyncDirectory(), mRoot, MOG_ControllerProject.GetCurrentSyncDataController(), false);

                    VirtualExpand(mRoot, "", MOG_ControllerProject.GetCurrentSyncDataController());

                    FillDirectory(mRoot, MOG_ControllerProject.GetCurrentSyncDataController().GetSyncDirectory(), SystemColors.InactiveCaptionText);

                    GameDataTreeView.Nodes.Add(mRoot);

                    mRoot.Expand();
                }

                mInitialized = true;

                // If we have nothing for this tree, we should disable it...
                if (GameDataTreeView.Nodes.Count < 1)
                {
                    GameDataTreeView.Visible = false;
                    NoLocalDataLabel.Visible = true;
                }
                else
                {
                    GameDataTreeView.Visible = true;
                    NoLocalDataLabel.Visible = false;
                }

                GameDataTreeView.EndUpdate();
            }
        }
コード例 #2
0
        static public void AssetTreeViewCreate(string versionInfoFilename, TreeView tree, TreeNode parent, guiAssetGamedataTreeTag.TREE_FOCUS level, bool createChildNode)
        {
            /// Changes to this function could have side-effects in many other areas...
            int defaultImageIndex = 0;

            guiAssetGamedataTreeTag currentTag = null;

            if (parent != null)
            {
                currentTag = (guiAssetGamedataTreeTag)parent.Tag;
            }

            // Find the items in the ASSETS section, set value of `contents`
            ArrayList contents = new ArrayList();

            switch (level)
            {
            case guiAssetGamedataTreeTag.TREE_FOCUS.BASE:
// TODO - Check this!
//					contents = MOG_DBAssetAPI.GetAllUniqueProjectKeys();
                break;

            case guiAssetGamedataTreeTag.TREE_FOCUS.PLATFORM:
                string[] platformNames = MOG_ControllerProject.GetProject().GetPlatformNames();
                foreach (string platformName in platformNames)
                {
                    contents.Add(platformName);
                }
                break;

            case guiAssetGamedataTreeTag.TREE_FOCUS.KEY:

                // If we have no ListForNode ArrayList, start fresh
                if (currentTag == null || currentTag.ListForNode.Count < 1)
                {
                    contents = MOG_DBAssetAPI.GetAllProjectSyncTargetFilesForPlatform(parent.Text);
                    assetTreeViewCreate_ParseSyncTargetFileNodes(contents, parent, versionInfoFilename, level);
                }
                //Else we are in a subNode and need to process a ListForNode
                else
                {
                    assetTreeViewCreate_ParseSyncTargetFileNodes(currentTag.ListForNode, parent, versionInfoFilename, level);
                }
                return;

            default:
                return;
            }
            assetTreeViewCreate_AddNodes(contents, versionInfoFilename, tree, parent,
                                         level, defaultImageIndex, true);
        }
コード例 #3
0
        private void LocateNonMogAssets_Worker(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker = sender as BackgroundWorker;
            string           path   = e.Argument as string;

            // Determin our workspaceDirectory and platformName
            string workspaceDirectory = "";
            string relativePath       = "";
            string platformName       = "";

            // Check if this is a library path?
            if (MOG_ControllerLibrary.GetWorkingDirectory().Length > 0 &&
                path.StartsWith(MOG_ControllerLibrary.GetWorkingDirectory(), StringComparison.CurrentCultureIgnoreCase))
            {
                // Determin proper settings for the library
                workspaceDirectory = MOG_ControllerLibrary.GetWorkingDirectory();
                relativePath       = path.Substring(workspaceDirectory.Length).Trim("\\".ToCharArray());
                platformName       = "All";

                // Get the list of known MOG files within the workspace
                string    classification  = MOG_ControllerLibrary.ConstructLibraryClassificationFromPath(path);
                ArrayList containedAssets = MOG_DBAssetAPI.GetAllAssetsByParentClassification(classification);
                foreach (MOG_Filename thisAsset in containedAssets)
                {
                    string thisPath     = MOG_ControllerLibrary.ConstructPathFromLibraryClassification(thisAsset.GetAssetClassification());
                    string thisFilename = Path.Combine(thisPath, thisAsset.GetAssetLabel());
                    mKnownSyncFiles.Add(thisFilename, thisFilename);
                    mKnownSyncFiles_ArrayList.Add(thisFilename);
                }
            }
            // Check if this is a workspace path?
            else
            {
                workspaceDirectory = MOG_ControllerSyncData.DetectWorkspaceRoot(path);
                if (workspaceDirectory.Length > 0)
                {
                    relativePath = path.Substring(workspaceDirectory.Length).Trim("\\".ToCharArray());
                    MOG_ControllerSyncData sync = MOG_ControllerProject.GetCurrentSyncDataController();
                    if (sync != null)
                    {
                        platformName = sync.GetPlatformName();

                        // Get the list of known MOG files within the workspace
                        ArrayList allFiles = MOG_DBAssetAPI.GetAllProjectSyncTargetFilesForPlatform(platformName);
                        foreach (string thisFile in allFiles)
                        {
                            // Trim thisFile just in case it has an extra '\' at the beginning (Needed for BioWare's formulaic sync target booboo)
                            string tempFile = thisFile.Trim("\\".ToCharArray());
                            // Check if this relative directory matches?
                            if (tempFile.StartsWith(relativePath, StringComparison.CurrentCultureIgnoreCase))
                            {
                                string filename = Path.Combine(workspaceDirectory, tempFile);
                                mKnownSyncFiles[filename] = filename;
                                mKnownSyncFiles_ArrayList.Add(filename);
                            }
                        }
                    }
                }
            }

            // Continue as long as we got at least one asset from the database
            ArrayList rogueFiles = new ArrayList();

            LocateNonMogAssetsScanFiles(worker, path, rogueFiles, mKnownSyncFiles, path, null);
            e.Result = rogueFiles;
        }