示例#1
0
        string ResolveToken(string token)
        {
            string value = "";

            // Make sure this token starts with the '{'?
            if (token.StartsWith("{"))
            {
                // Get the name of this token
                string[] parts = token.Split("{}.".ToCharArray(), 3);
                // Make sure this resembled a real token?
                if (parts.Length == 3)
                {
                    // Check for any contained commands?
                    string testToken = "{" + parts[1] + "}";
                    // Determine which token we have?
                    switch (testToken)
                    {
                    // Repository Tokens
                    case TOKEN_Repository_Path:
                        value = MOG_ControllerSystem.GetSystemRepositoryPath();
                        break;

                    case TOKEN_Repository_ProjectsPath:
                        value = MOG_ControllerSystem.GetSystemProjectsPath();
                        break;

                    case TOKEN_Repository_ToolsPath:
                        value = MOG_ControllerSystem.GetSystemRepositoryPath() + "\\Tools";
                        break;

                    case TOKEN_Repository_Project_Path:
                        value = MOG_ControllerProject.GetProjectPath();
                        break;

                    case TOKEN_Repository_Project_ToolsPath:
                        value = MOG_ControllerProject.GetProjectPath() + "\\Tools";
                        break;

                    case TOKEN_Repository_Project_AssetsPath:
                        value = MOG_ControllerRepository.GetRepositoryPath();
                        break;

                    case TOKEN_Repository_Project_ArchivePath:
                        value = MOG_ControllerRepository.GetArchivePath();
                        break;

                    case TOKEN_Repository_Project_UsersPath:
                        value = MOG_ControllerProject.GetProjectPath() + "\\Users";
                        break;

                    // Project Tokens
                    case TOKEN_Project_Name:
                        value = MOG_ControllerProject.GetProjectName();
                        break;

                    case TOKEN_Project_BranchName:
                        value = MOG_ControllerProject.GetBranchName();
                        break;

                    case TOKEN_Project_UserName:
                        value = MOG_ControllerProject.GetUserName_DefaultAdmin();
                        break;

                    case TOKEN_Project_PlatformName:
                        value = MOG_ControllerProject.GetPlatformName();
                        break;

                    case TOKEN_Project_WorkspaceDirectory:
                        value = MOG_ControllerProject.GetWorkspaceDirectory();
                        break;

                    // Ripper Tokens
                    case TOKEN_Ripper_SourcePath:
                        value = mRipperSourcePath;
                        break;

                    case TOKEN_Ripper_SourceFilePattern:
                        value = mRipperSourceFilePattern;
                        break;

                    case TOKEN_Ripper_DestinationPath:
                        value = mRipperDestinationPath;
                        break;

                    // Package Tokens
                    case TOKEN_Package_WorkspaceDirectory:
                        if (mPackageFileInfo != null)
                        {
                            value = mPackageFileInfo.mPackageWorkspaceDirectory;
                        }
                        break;

                    case TOKEN_Package_DataDirectory:
                        if (mPackageFileInfo != null)
                        {
                            value = mPackageFileInfo.mPackageDataDirectory;
                        }
                        break;

                    case TOKEN_Package_PackageFile_Filename:
                        if (mPackageFileInfo != null)
                        {
                            value = mPackageFileInfo.mPackageFile;
                        }
                        break;

                    case TOKEN_Package_PackageFile_FullName:
                    {
                        MOG_Filename packageFilename = (mPackageFileInfo != null) ? mPackageFileInfo.mPackageAssetFilename : new MOG_Filename(MOG_ControllerPackage.GetPackageName(mPackageAssignment));
                        value = packageFilename.GetAssetFullName();
                    }
                    break;

                    case TOKEN_Package_PackageFile_Classification:
                    {
                        MOG_Filename packageFilename = (mPackageFileInfo != null) ? mPackageFileInfo.mPackageAssetFilename : new MOG_Filename(MOG_ControllerPackage.GetPackageName(mPackageAssignment));
                        value = packageFilename.GetAssetClassification();
                    }
                    break;

                    case TOKEN_Package_PackageFile_Label:
                    {
                        MOG_Filename packageFilename = (mPackageFileInfo != null) ? mPackageFileInfo.mPackageAssetFilename : new MOG_Filename(MOG_ControllerPackage.GetPackageName(mPackageAssignment));
                        value = packageFilename.GetAssetLabel();
                    }
                    break;

                    case TOKEN_Package_PackageFile_Platform:
                    {
                        MOG_Filename packageFilename = (mPackageFileInfo != null) ? mPackageFileInfo.mPackageAssetFilename : new MOG_Filename(MOG_ControllerPackage.GetPackageName(mPackageAssignment));
                        value = packageFilename.GetAssetPlatform();
                    }
                    break;

                    case TOKEN_Package_PackageFile_Group:
                        value = MOG_ControllerPackage.GetPackageGroups(mPackageAssignment);
                        break;

                    case TOKEN_Package_PackageFile_Object:
                        value = MOG_ControllerPackage.GetPackageObjects(mPackageAssignment);
                        break;

                    // Inbox Tokens
                    case TOKEN_Inbox_UserName:
                        value = mAssetFilename.GetUserName();
                        break;

                    case TOKEN_Inbox_UserPath:
                        value = mAssetFilename.GetUserPath();
                        break;

                    case TOKEN_Inbox_BoxName:
                        value = mAssetFilename.GetBoxName();
                        break;

                    case TOKEN_Inbox_BoxPath:
                        value = mAssetFilename.GetBoxPath();
                        break;

                    // Asset Tokens
                    case TOKEN_Asset_AssetName_Path:
                        value = mAssetFilename.GetPath();
                        break;

                    case TOKEN_Asset_AssetName_FullName:
                        value = mAssetFilename.GetAssetFullName();
                        break;

                    case TOKEN_Asset_AssetName_Classification:
                        value = mAssetFilename.GetAssetClassification();
                        break;

                    case TOKEN_Asset_AssetName_Name:
                        value = mAssetFilename.GetAssetName();
                        break;

                    case TOKEN_Asset_AssetName_PlatformName:
                        value = mAssetFilename.GetAssetPlatform();
                        break;

                    case TOKEN_Asset_AssetName_Label:
                        value = mAssetFilename.GetAssetLabel();
                        break;

                    case TOKEN_Asset_ImportedFile:
                    case TOKEN_Asset_RippedFile:
                        value = ResolveToken_AssetFile(token);
                        break;

                    case TOKEN_Asset_Property:
                        value = ResolveToken_Property(token);
                        break;

                    case TOKEN_Asset_ClassificationPath:
                        value = MOG_Filename.GetClassificationPath(mAssetFilename.GetAssetClassification());
                        break;

                    case TOKEN_Asset_VersionTimeStamp:
                        value = mAssetFilename.GetVersionTimeStamp();
                        break;
                    }

                    // Check if we have a command?
                    if (parts[2] != ".")
                    {
                    }
                }
            }

            return(value);
        }
示例#2
0
        private void DialogInitialize_Worker(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker      = sender as BackgroundWorker;
            List <Object>    args        = e.Argument as List <Object>;
            string           parentPath  = args[0] as string;
            ArrayList        assets      = args[1] as ArrayList;
            ArrayList        assetLabels = args[2] as ArrayList;
            TreeNode         parentNode  = null;

            for (int counter = 0; counter < assets.Count; counter++)
            {
                string rawString   = assets[counter] as string;
                string labelString = (assetLabels != null) ? assetLabels[counter] as string : "";

                worker.ReportProgress(counter * 100 / assets.Count);

                // Determin if we should use the label or the str
                string displayString = (labelString.Length > 0) ? labelString : rawString;

                // Check if this is an official MOG_Filename? and
                // Make sure it contains no path!
                MOG_Filename filename = new MOG_Filename(displayString);
                if (filename.GetFilenameType() != MOG_FILENAME_TYPE.MOG_FILENAME_Unknown &&
                    filename.GetPath().Length == 0)
                {
                    if (ConfirmTreeView.ImageList != MogUtil_AssetIcons.Images)
                    {
                        ConfirmTreeView.ImageList = MogUtil_AssetIcons.Images;
                    }

                    // Build the node
                    BuildMogFilenameNode(filename, rawString, labelString);
                }
                // Check if this resembles a path?
                else if (displayString.Contains("\\"))
                {
                    // Is this the first node?
                    if (ConfirmTreeView.Nodes.Count == 0)
                    {
                        // Check if we are missing a parentPath?
                        if (parentPath.Length == 0)
                        {
                            // Use the root of the file as our parentPath
                            parentPath = displayString.Substring(0, displayString.IndexOf("\\"));
                        }

                        // Create the start node
                        parentNode         = ConfirmTreeView.Nodes.Add(parentPath);
                        parentNode.Checked = true;

                        try
                        {
                            // Select file icon
                            parentNode.ImageIndex = MogUtil_AssetIcons.GetFileIconIndex(parentNode.FullPath);
                        }
                        catch (Exception ex)
                        {
                            ex.ToString();
                        }
                    }

                    // Figure out what...if any...remainingPath
                    string remainingPath = "";
                    if (displayString.StartsWith(parentPath, StringComparison.CurrentCultureIgnoreCase))
                    {
                        remainingPath = displayString.Substring(parentPath.Length).Trim("\\".ToCharArray());
                    }

                    // Build the Node path
                    BuildWindowsFileNode(parentNode, remainingPath, rawString);
                }
                else
                {
                    // Check if we have a parentNode?
                    if (parentNode != null)
                    {
                        // Just add the basic node
                        TreeNode thisNode = new TreeNode(displayString);
                        thisNode.Checked = true;
                        parentNode.Nodes.Add(thisNode);
                    }
                }
            }
        }