示例#1
0
        public ArrayList LocateAssetBinary(MOG_Filename filename, AssetDirectories AssetDirectoryType)
        {
            string    targetDir   = "";
            ArrayList binaryFiles = new ArrayList();

            MOG_Properties assetProperties = new MOG_Properties(filename);

            switch (AssetDirectoryType)
            {
            case AssetDirectories.IMPORTED:
                targetDir = MOG_ControllerAsset.GetAssetImportedDirectory(assetProperties);
                break;

            case AssetDirectories.PROCESSED:
                string platformName = "";
                // If we have a valid gameDataController?
                if (MOG_ControllerProject.GetCurrentSyncDataController() != null)
                {
                    platformName = MOG_ControllerProject.GetCurrentSyncDataController().GetPlatformName();
                }
                targetDir = MOG_ControllerAsset.GetAssetProcessedDirectory(assetProperties, platformName);
                break;
            }
            if (targetDir.Length != 0 && DosUtils.Exist(targetDir))
            {
                FileInfo [] files = DosUtils.FileGetList(targetDir, "*.*");
                foreach (FileInfo file in files)
                {
                    binaryFiles.Add(file.FullName);
                }
            }
            else
            {
                MOG_Prompt.PromptMessage("Asset View", "Asset (" + targetDir + ") does not exist or is a zero length file! Cannot View.", Environment.StackTrace);
            }

            return(binaryFiles);
        }
示例#2
0
        private void InitializeAssetNames(ArrayList sourceFiles)
        {
            RenameListView.Items.Clear();

            InitializePlatformComboBox();

            string listOfBlessedAssets = "";

            // Check for presence of wildcards
            foreach (string fullFilename in sourceFiles)
            {
                MOG_Filename asset = new MOG_Filename(fullFilename);
                // If this Asset has been previously blessed...
                if (CheckIfAssetHasBeenBlessed(asset))
                {
                    listOfBlessedAssets += asset.GetAssetFullName() + "\r\n";
                }

                // Get the imported filenames
                ArrayList importFiles = DosUtils.FileGetRecursiveList(MOG_ControllerAsset.GetAssetImportedDirectory(MOG_Properties.OpenFileProperties(fullFilename + "\\Properties.info")), "*.*");
                if (importFiles.Count > 1)
                {
                    // If there are more that one, then we cannot rename the files of this asset
                    RenameFiles.Checked = false;
                    RenameFiles.Enabled = false;
                    importFilename      = "*Complex asset*";
                }
                else
                {
                    String importFile = importFiles[0] as string;

                    // Does this asset label match the imported filename?
                    if (string.Compare(DosUtils.PathGetFileNameWithoutExtension(importFile), DosUtils.PathGetFileNameWithoutExtension(asset.GetAssetLabel()), true) == 0)
                    {
                        // All is good then
                        importFilename = DosUtils.PathGetFileName(importFile);
                    }
                    else
                    {
                        // We cannot rename the files of this asset because the label and the imported filename do not match
                        RenameFiles.Checked = false;
                        RenameFiles.Enabled = false;
                        importFilename      = string.Format("Asset label({0}) and imported filename({1}) do not match!", DosUtils.PathGetFileNameWithoutExtension(asset.GetAssetLabel()), DosUtils.PathGetFileNameWithoutExtension(importFile));
                    }
                }

                mFullFilename = fullFilename;
                ListViewItem item = RenameListView.Items.Add(asset.GetAssetFullName());
                item.SubItems.Add(asset.GetAssetFullName());
                item.SubItems.Add(asset.GetAssetEncodedPath());
                item.SubItems.Add(importFilename);
                item.Selected = true;

                CheckStringForMatch(ref mCommonClass, asset.GetAssetClassification());
                CheckStringForMatch(ref mCommonPlatform, asset.GetAssetPlatform());
                CheckStringForMatch(ref mCommonLabel, asset.GetAssetLabel());
            }

            // If we have any Blessed Assets and we don't have privilege to rename them, warn the user
            if (listOfBlessedAssets.Length > 0 && !CheckPrivilegeToRename())
            {
                MOG_Prompt.PromptMessage("Insufficient privileges to rename already blessed assets",
                                         "You do not have permission to rename these previously blessed assets:\r\n" + listOfBlessedAssets);
            }
            // Else, If we have any Blessed Assets, warn user about the rename
            else if (listOfBlessedAssets.Length > 0)
            {
                MOG_Prompt.PromptMessage("Inbox renames don't rename previously blessed assets",
                                         "The following blessed assets will still exist when renamed assets are blessed:\r\n" + listOfBlessedAssets);
            }

            RenameListView.Select();

            InitializeTextBoxes(mCommonClass, mCommonPlatform, mCommonLabel);

            // Make it so that our user will hopefully type over the "*" when assigning a classification...
            if (mCommonClass == "*")
            {
                this.RenameNewClassNameTextBox.SelectAll();
            }

            bInitialized = true;
        }         // end ()