Beispiel #1
0
        public static void MarkLocalAssetBlessed(MOG_Filename assetFilename, string blessedTimestamp)
        {
            // Walk through all of our workspaces
            foreach (MOG_ControllerSyncData workspace in mWorkspaces.Values)
            {
                // Check if this is the current workspace?  or
                // Check if this workspace is active?
                if (workspace == MOG_ControllerProject.GetCurrentSyncDataController() ||
                    workspace.IsAlwaysActive())
                {
                    // Build the expected path to this asset in our local workspace
                    MOG_Filename workspaceAsset = MOG_Filename.GetLocalUpdatedTrayFilename(workspace.GetSyncDirectory(), assetFilename);
                    // Open the local asset
                    MOG_ControllerAsset localAsset = MOG_ControllerAsset.OpenAsset(workspaceAsset);
                    if (localAsset != null)
                    {
                        // Stamp this locally update asset with the newly blessed revision timestamp
                        localAsset.GetProperties().BlessedTime = blessedTimestamp;

                        // Change the state of this asset to blessed
                        MOG_ControllerInbox.UpdateInboxView(localAsset, MOG_AssetStatusType.Blessed);
                        localAsset.Close();
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Make sure this asset is MOG Compliant
        /// </summary>
        private bool CheckName(string filename)
        {
            MOG_Filename assetName;

            try
            {
                assetName = new MOG_Filename(filename);
            }
            catch
            {
                throw new Exception("Unable to convert filename, '" + filename + "' to a valid MOG Filename.");
            }

            // No asset is valid if it has the '[' character
            // Original string == "[]'`,$^:?*<>/\\%#!|="
            // glk:  Kier and I changed this so that ONLY Windows, MOG-Specific, and INI chars are filtered
            if (assetName.GetAssetLabel().Split(ImportFilter_String.ToCharArray()).Length > 1)
            {
                throw new Exception("Non-valid character in import file: \n\n\t " + ImportFilter_String);
            }

            // Make sure the asset name is valid
            if (assetName.GetFilenameType() == MOG_FILENAME_TYPE.MOG_FILENAME_Unknown && MOG_ControllerProject.ValidateAssetFilename(assetName) == false)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
		/// <summary>
		/// Add group or object to the database
		/// </summary>
		private bool AddGroupToDatabase(string addCandidate, MOG_Filename packageAsset)
		{
			// Are we platform generic?
			bool success = true;

			if (packageAsset.GetAssetPlatform() == "All")
			{
				string packageVersion = MOG_DBAssetAPI.GetAssetVersion(packageAsset);
				if (packageVersion.Length > 0)
				{
					success = MOG_DBPackageAPI.AddPackageGroupName(packageAsset, packageVersion, addCandidate, MOG_ControllerProject.GetUser().GetUserName());
				}
			}

			// We are platform generic, loop through all platforms then
			ArrayList platforms = MOG_ControllerProject.GetProject().GetPlatforms();
			for (int p = 0; p < platforms.Count && success; p++)
			{
				MOG_Platform platform = (MOG_Platform)platforms[p];

				// Set this package to be platform specific for this platform name
				packageAsset = MOG_Filename.CreateAssetName(packageAsset.GetAssetClassification(), platform.mPlatformName, packageAsset.GetAssetLabel());
				string packageVersion = MOG_DBAssetAPI.GetAssetVersion(packageAsset);
				if (packageVersion.Length > 0)
				{
					// Add to the database
					success &= MOG_DBPackageAPI.AddPackageGroupName(packageAsset, packageVersion, addCandidate, MOG_ControllerProject.GetUser().GetUserName());
				}
			}

			return success;
		}
 /// <summary>
 /// Walk up the parents of a node looking for a parent with a valid MOG_Filename
 /// in the tag as well as the isPackage() bool set to true
 /// </summary>
 private TreeNode FindPackage(TreeNode node)
 {
     try
     {
         MOG_Filename   assetName = new MOG_Filename(((MOG_ControlsLibrary.Controls.Mog_BaseTag)node.Tag).FullFilename);
         MOG_Properties props     = new MOG_Properties(assetName);
         if (assetName != null && props.IsPackage)
         {
             return(node);
         }
         else
         {
             if (node.Parent != null)
             {
                 return(FindPackage(node.Parent));
             }
             else
             {
                 return(null);
             }
         }
     }
     catch
     {
         if (node.Parent != null)
         {
             return(FindPackage(node.Parent));
         }
         else
         {
             return(null);
         }
     }
 }
Beispiel #5
0
        /// <summary>
        /// Keeps user from renaming multiple asset labels.
        /// </summary>
        private void RenameNewLabelTextBox_TextChanged(object sender, System.EventArgs e)
        {
            try
            {
                // Check for invalid characters in the new name
                if (MOG_ControllerSystem.InvalidMOGCharactersCheck(RenameNewLabelTextBox.Text, true))
                {
                    RenameNewLabelTextBox.Text = MOG_ControllerSystem.ReplaceInvalidCharacters(RenameNewLabelTextBox.Text);
                }

                // For Rename Label, we only need to worry about one asset...
                if (mFullFilename != null)
                {
                    MOG_Filename currentFilename = new MOG_Filename(this.mFullFilename);
                    string       targetName      = GetTargetName(currentFilename, RenameNewClassNameTextBox.Text,
                                                                 RenameNewPlatformComboBox.Text, RenameNewLabelTextBox.Text);

                    ChangeAssetFilenameInListView(targetName);

                    // Update the imported files column
                    if (RenameFiles.Checked && bInitialized)
                    {
                        ChangeAssetImportnameInListView(RenameNewLabelTextBox.Text);
                    }
                }
            }
            // Eat any errors we get
            catch (Exception ex)
            {
                MOG_Prompt.PromptMessage("Error With Value", ex.Message, ex.StackTrace, MOG_ALERT_LEVEL.ALERT);
            }
        }
Beispiel #6
0
        private void PackageManagementForm_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            guiUserPrefs.SaveDynamic_LayoutPrefs(guiUserPrefs.PackageManagementForm_Text, this);

            // Check if we were modyifying assets?
            if (ModifyingAssets)
            {
                // Itterate through all the assets and mark them as being modified
                foreach (ListViewItem item in AssetList.Items)
                {
                    MOG_Filename assetFilename = item.Tag as MOG_Filename;
                    if (assetFilename != null)
                    {
                        // Open up this asset so we can remove the package relationships
                        MOG_ControllerAsset asset = MOG_ControllerAsset.OpenAsset(assetFilename);
                        if (asset != null)
                        {
                            if (asset.GetProperties().NativeDataType)
                            {
                                MOG_ControllerInbox.UpdateInboxView(asset, MOG_AssetStatusType.Processed);
                            }
                            else
                            {
                                MOG_ControllerInbox.UpdateInboxView(asset, MOG_AssetStatusType.Modified);
                            }
                            asset.Close();
                        }
                    }
                }
            }
        }
Beispiel #7
0
        private ArrayList GetRequiredAssets(string classification)
        {
            ArrayList requiredAssetList = new ArrayList();

            // Break up classification into its parts
            string[] classificationParts = MOG_Filename.SplitClassificationString(classification);

            // Scan our list of required assets looking for any immediate children that should be included?
            foreach (DictionaryEntry requiredAsset in mRequiredAssets)
            {
                MOG_Filename requiredAssetFilename  = new MOG_Filename(requiredAsset.Key.ToString());
                string       requiredClassification = requiredAssetFilename.GetAssetClassification();

                // Check if classification is a parent for requiredClassification?
                if (MOG_Filename.IsParentClassificationString(requiredClassification, classification))
                {
                    // Break up classification into its parts
                    string[] requiredClassificationParts = MOG_Filename.SplitClassificationString(requiredClassification);
                    // Make sure there is an immediate child classification we can extract?
                    if (requiredClassificationParts.Length == classificationParts.Length)
                    {
                        requiredAssetList.Add(requiredAssetFilename);
                    }
                }
            }

            return(requiredAssetList);
        }
		private void AttachValidatedTagToNewObjectOrGroup(TreeNode package, TreeNode newNode, PackageNodeTypes nodeType)
		{
			// If this thing is a Group or Object, we need to do this algorithm
			string fullFilename = null;
			MOG_Filename assetFile = null;

			int imageIndex = 0;

			switch (nodeType)
			{
			case PackageNodeTypes.Group:
				imageIndex = MogUtil_AssetIcons.GetClassIconIndex(PackageGroup_ImageText);
				break;
			case PackageNodeTypes.Object:
				imageIndex = MogUtil_AssetIcons.GetClassIconIndex(PackageObject_ImageText);
				break;
			default:
				MOG_Report.ReportSilent("Got Unexpected PackageNodeTypes",
					"Unexpected PackageNodeTypes enum given for MOG_ControlsLibrary.Controls",
					Environment.StackTrace);
				break;
			}

			string groupPath = newNode.FullPath.Substring(package.FullPath.Length).Trim(PathSeparator.ToCharArray()).Replace(PathSeparator, "/");
			fullFilename = package.FullPath + "/" + groupPath;
			assetFile = new MOG_Filename(((Mog_BaseTag)package.Tag).FullFilename);

			// Now that we've got our initial information, add our tag
			newNode.Tag = new Mog_BaseTag(newNode, assetFile.GetEncodedFilename(), this.FocusForAssetNodes, true);
			((Mog_BaseTag)newNode.Tag).PackageNodeType = nodeType;
			((Mog_BaseTag)newNode.Tag).PackageFullName = fullFilename;
			SetImageIndices(newNode, imageIndex);
		}
        /// <summary>
        /// Used to get an Asset node with a good node.Tag for this TreeView or any inheriting classes.
        /// </summary>
        private TreeNode CreateAssetNode(MOG_Filename asset, System.Drawing.Color foreColor, bool useFullFilename)
        {
            string       assetName = asset.GetAssetFullName();
            MOG_Filename assetFullFilename;

            // If we found revisions, go ahead and select the first one as the full filename for our tag...
            assetFullFilename = MOG_ControllerRepository.GetAssetBlessedPath(asset);

            TreeNode assetNode = new TreeNode(asset.GetAssetName());

            if (useFullFilename)
            {
                assetNode.Text = asset.GetAssetFullName();
            }

            assetNode.Tag = new Mog_BaseTag(assetNode, assetFullFilename.GetEncodedFilename(), RepositoryFocusLevel.Repository, true);

            // If we are Archive_Color, remain displayed as such
            if (foreColor == Archive_Color)
            {
                assetNode.ForeColor = Archive_Color;
            }

            assetNode.Nodes.Add(new TreeNode(Blank_Node_Text));
            assetNode.Name = asset.GetAssetFullName();

            SetImageIndices(assetNode, GetAssetImageIndex(((Mog_BaseTag)assetNode.Tag).FullFilename));

            return(assetNode);
        }
Beispiel #10
0
        private void CheckPackages(HybridDictionary packages, bool markAsInherited)
        {
            // Add our packages to our mogPackagesSet and expand the tree to that node
            foreach (DictionaryEntry entry in packages)
            {
                string package = entry.Key as string;
                int    count   = (int)entry.Value;

                // Generate a MOG_Filename and concat our path from it
                MOG_Filename packageFile   = new MOG_Filename(package);
                string       assetName     = packageFile.GetAssetName();
                string       assetFullName = packageFile.GetAssetClassification() + assetName;

                // Make sure we have this Package selected (if possible)
                TreeNode node = FindPackageNode(assetFullName);
                if (node == null)
                {
                    node = AddPackageNode(assetFullName);
                }
                if (node != null)
                {
                    if (count < AssetList.Items.Count)
                    {
                        node.ForeColor = Color.Gray;
                    }

                    if (markAsInherited)
                    {
                        node.NodeFont = new Font(node.TreeView.Font, FontStyle.Italic);
                    }

                    node.Checked = true;
                }
            }
        }
Beispiel #11
0
        public bool ToolNewerCheck(MOG_Filename mogAsset, string version, MOG_Project pProject, ref string failedString)
        {
            MOG_Time assetTime        = new MOG_Time(version);
            MOG_Time correctAssetTime = new MOG_Time();

            DirectoryInfo [] dirs = DosUtils.DirectoryGetList(MOG_ControllerRepository.GetAssetBlessedPath(mogAsset).GetEncodedFilename(), "*.*");

            if (dirs != null)
            {
                foreach (DirectoryInfo dir in dirs)
                {
                    string   checkVersion = dir.Name.Substring(dir.Name.LastIndexOf(".") + 1);
                    MOG_Time dirTime      = new MOG_Time(checkVersion);

                    // Is this asset equal or newer than this dir version?
                    if (assetTime.Compare(dirTime) < 0)
                    {
                        failedString = "Out of date," + failedString;
                        return(false);
                    }
                }
            }

            return(true);
        }
Beispiel #12
0
        private void CreateLateResolverItem(MOG_DBPackageCommandInfo packageCommand)
        {
            MOG_Filename assetName = new MOG_Filename(packageCommand.mAssetName);

            if (assetName.GetFilenameType() == MOG_FILENAME_TYPE.MOG_FILENAME_Asset)
            {
                ListViewItem item = new ListViewItem();

                // "NAME, CLASSIFICATION, DATE, TARGET PACKAGE, OWNER, FULLNAME, COMMANDID, LABEL, VERSION"

                item.Text = assetName.GetAssetLabel();
                item.SubItems.Add(assetName.GetAssetClassification());                 // Class
                item.SubItems.Add(MogUtils_StringVersion.VersionToString(packageCommand.mAssetVersion));
                item.SubItems.Add(packageCommand.mPackageName);
                item.SubItems.Add((packageCommand.mBlessedBy.Length != 0) ? packageCommand.mBlessedBy : packageCommand.mCreatedBy);
                item.SubItems.Add(packageCommand.mAssetName);
                item.SubItems.Add(packageCommand.mID.ToString());
                item.SubItems.Add(packageCommand.mLabel);
                item.SubItems.Add(packageCommand.mAssetVersion);

                item.ImageIndex = MogUtil_AssetIcons.GetAssetIconIndex(packageCommand.mAssetName, null, false);

                mainForm.ConnectionManagerLateResolversListView.Items.Add(item);
            }
        }
        protected TreeNode CreateSyncTargetTreeNode(MOG_DBSyncTargetInfo info, string platform)
        {
            bool ableToGetSourceFileAssetLinks = false;

            string       currentVersionStamp = info.mVersion;
            MOG_Filename tempFilename        = MOG_Filename.CreateAssetName(info.mAssetClassification, info.mAssetPlatform, info.mAssetLabel);
            MOG_Filename assetRealFile       = MOG_ControllerRepository.GetAssetBlessedVersionPath(tempFilename, currentVersionStamp);

            // Create node with FocusLevel that does not plug into the BaseLeafTreeView
            TreeNode    node = new TreeNode(info.FilenameOnly, new TreeNode[] { new TreeNode(Blank_Node_Text) });
            Mog_BaseTag tag  = new Mog_BaseTag(node, assetRealFile.GetEncodedFilename(), RepositoryFocusLevel.Classification, true);

            node.Name = tempFilename.GetAssetFullName();
            tag.AttachedSyncTargetInfo = info;
            node.Tag = tag;

            string gamedataFilePath;

            if (ableToGetSourceFileAssetLinks)
            {
                gamedataFilePath = assetRealFile.GetEncodedFilename() + "\\Files.Imported\\" + info.mSyncTargetFile;
            }
            else
            {
                gamedataFilePath = assetRealFile.GetEncodedFilename() + "\\Files.Imported\\" + info.FilenameOnly;
            }

            //This is either a file or an asset
            SetImageIndices(node, base.GetAssetFileImageIndex(gamedataFilePath));

            return(node);
        }
Beispiel #14
0
        private ListViewItem AddItemToListView(MOG_Filename mogAsset, MOG_Properties pProperties, string fullPath)
        {
            ListViewItem item = new ListViewItem();

            foreach (ColumnHeader column in ListListView.Columns)
            {
                item.SubItems.Add("");
            }

            SetSubColumnText(item, "Name", mogAsset.GetAssetLabel());
            SetSubColumnText(item, "MOG Classification", mogAsset.GetAssetClassification());
            SetSubColumnText(item, "Platform", mogAsset.GetAssetPlatform());
            SetSubColumnText(item, "Version", mogAsset.GetVersionTimeStampString(""));

            if (pProperties != null)
            {
                SetSubColumnText(item, "Size", guiAssetController.FormatSize(pProperties.Size));
                SetSubColumnText(item, "Package", GetPackages(pProperties));
                SetSubColumnText(item, "Creator", pProperties.Creator);
                SetSubColumnText(item, "Last Bless", pProperties.Owner);
                SetSubColumnText(item, "Computer", pProperties.SourceMachine);
                SetSubColumnText(item, "GamePath", pProperties.SyncTargetPath);
                SetSubColumnText(item, "Last Comment", pProperties.LastComment);
            }

            SetSubColumnText(item, "Fullname", fullPath);

            // Icon
            item.ImageIndex = MogUtil_AssetIcons.GetAssetIconIndex(mogAsset.GetOriginalFilename(), pProperties, false);
            return(ListListView.Items.Add(item));
        }
		/// <summary>
		/// Utility method to make sure we have a valid Package name (which should have an extension)
		/// </summary>
		private bool ValidatePackageExtension(NodeLabelEditEventArgs e, MOG_Filename packageName)
		{
			// Make sure packages have extensions, if not make strong warning
			if (packageName.GetExtension().Length == 0)
			{
				string message = "This package does not have an extension!\r\n"
					+ "Most engines require extensions on packages.\r\n\r\n"
					+ "(Click 'Ignore' to continue without adding an extension)";
				switch (MOG_Prompt.PromptResponse("Create new package", message, MOGPromptButtons.AbortRetryIgnore))
				{
				case MOGPromptResult.Retry:
					e.CancelEdit = true;
					e.Node.TreeView.LabelEdit = true;
					e.Node.BeginEdit();
					return false;
				case MOGPromptResult.Abort:
					e.Node.Remove();
					e.CancelEdit = true;
					return false;
				}
			}

			// We finished the block.  Return true.
			return true;
		}
Beispiel #16
0
 private void FindAndUpdateNodeLockStatus(string nodeKey, MOG_Filename assetName, MogControl_BaseTreeView tree)
 {
     // Attempt to find this node in our tree
     TreeNode[] foundNodes = tree.Nodes.Find(nodeKey, true);
     if (foundNodes != null && foundNodes.Length > 0)
     {
         foreach (TreeNode node in foundNodes)
         {
             Mog_BaseTag tag = node.Tag as Mog_BaseTag;
             if (tag != null)
             {
                 // Is this a sync target node
                 if (tag.AttachedSyncTargetInfo != null)
                 {
                     // Update this assets status
                     string assetRepositoryName = tag.FullFilename + "\\Files.Imported\\" + tag.AttachedSyncTargetInfo.FilenameOnly;
                     node.ImageIndex         = MogUtil_AssetIcons.GetBinaryLockedOrUnlockedIcon(assetName.GetAssetFullName(), assetRepositoryName);
                     node.SelectedImageIndex = node.ImageIndex;
                 }
                 else
                 {
                     // Update this assets status
                     node.ImageIndex         = MogUtil_AssetIcons.GetAssetIconIndex(assetName.GetAssetFullName());
                     node.SelectedImageIndex = node.ImageIndex;
                 }
             }
         }
     }
 }
Beispiel #17
0
        static public bool RepackageAssetInWorkspaces(MOG_Filename assetFilename, BackgroundWorker worker)
        {
            bool bFailed = false;

            // Walk through all of our workspaces
            foreach (MOG_ControllerSyncData workspace in mWorkspaces.Values)
            {
                // Check if this is the current workspace?  or
                // Check if this workspace is active?
                if (workspace == MOG_ControllerProject.GetCurrentSyncDataController() ||
                    workspace.IsAlwaysActive())
                {
                    // Proceed to add the asset to this workspace
                    MOG_Filename workspaceAsset = MOG_Filename.GetLocalUpdatedTrayFilename(workspace.GetSyncDirectory(), assetFilename);
                    if (!workspace.RepackageAssetInLocalWorkspace(workspaceAsset))
                    {
                        bFailed = true;
                    }
                }
            }

            if (!bFailed)
            {
                return(true);
            }
            return(false);
        }
Beispiel #18
0
        private bool SetParentForecolors(MOG_Filename filename, TreeNode node, int numberOfRevisions)
        {
            node.ForeColor = Color.Red;

            if (node.Text.EndsWith(filename.GetAssetLabel(), StringComparison.CurrentCultureIgnoreCase))
            {
                // We also need to remove the "Current <DATE>" node
                if (node.Nodes != null &&
                    node.Nodes.Count > 0 &&
                    node.Nodes[0].Text.StartsWith("Current", StringComparison.CurrentCultureIgnoreCase))
                {
                    node.Nodes[0].Remove();
                }

                return(true);
            }
            else if (numberOfRevisions == 1)
            {
                if (node.Parent != null)
                {
                    if (SetParentForecolors(filename, node.Parent, numberOfRevisions))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Beispiel #19
0
        /// <summary>
        /// Returns true if asset has been blessed.
        /// </summary>
        /// <param name="asset"></param>
        /// <returns></returns>
        private bool CheckIfAssetHasBeenBlessed(MOG_Filename asset)
        {
            // Create MOG_Filename for this asset
            string assetVersion = MOG.DATABASE.MOG_DBAssetAPI.GetAssetVersion(asset);

            return(assetVersion != null && assetVersion.Length > 0);
        }
Beispiel #20
0
        /// <summary>
        /// Shows Assets based on MOG_Property(s) assigned to PropertyList
        /// </summary>
        private void ExpandPropertyTreeDown(TreeNode node)
        {
            BeginUpdate();

            List <string> classificationsToAdd = GetSubClassifications(node);
            List <string> assetsToAdd          = GetAssets(node);

            // Sort our classifications alphabetically
            classificationsToAdd.Sort();

            // Foreach classification, add it
            foreach (string classification in classificationsToAdd)
            {
                TreeNode classificationNode = new TreeNode(classification);

                // Assign the default node checked state
                classificationNode.Checked = node.Checked;

                classificationNode.Tag = new Mog_BaseTag(classificationNode, classification, RepositoryFocusLevel.Classification, false);
                ((Mog_BaseTag)classificationNode.Tag).PackageNodeType = PackageNodeTypes.Class;
                node.Nodes.Add(classificationNode);

                classificationNode.Name = classificationNode.FullPath;
                SetImageIndices(classificationNode, GetClassificationImageIndex(classificationNode.FullPath));

                classificationNode.Nodes.Add(new TreeNode(Blank_Node_Text));
            }

            // Use the System.IComparable interface for `string` to sort our list
            assetsToAdd.Sort();

            // Foreach Asset, add it
            foreach (string assetFilename in assetsToAdd)
            {
                MOG_Filename assetFile = new MOG_Filename(assetFilename);
                assetFile = MOG_ControllerProject.GetAssetCurrentBlessedPath(assetFile);
                TreeNode assetNode;
                // If we are expandingAssets or expandingPackageGroups, we need to be able to expand down
                if (ExpandAssets || ExpandPackageGroups)
                {
                    assetNode = new TreeNode(assetFile.GetAssetName(), new TreeNode[] { new TreeNode(Blank_Node_Text) });
                }
                // Else, do not expand down.  Showing the Asset is all we need to do
                else
                {
                    assetNode = new TreeNode(assetFile.GetAssetName());
                }

                assetNode.Tag = new Mog_BaseTag(assetNode, assetFile.GetEncodedFilename(), FocusForAssetNodes, true);
                ((Mog_BaseTag)assetNode.Tag).PackageNodeType = PackageNodeTypes.Asset;
                ((Mog_BaseTag)assetNode.Tag).PackageFullName = assetFile.GetAssetFullName();
                node.Nodes.Add(assetNode);
                assetNode.Name = assetFile.GetAssetFullName();

                SetImageIndices(assetNode, GetAssetFileImageIndex(assetFile.GetEncodedFilename()));
            }

            EndUpdate();
        }
Beispiel #21
0
        private bool ShowEntireClassificationContents(string classification)
        {
            bool bShowEntireTree = true;

            // Check if we have any properties associated with this tree?
            if (MogPropertyList.Count > 0)
            {
                // Check if we have no mRequiredClassifications?
                if (mRequiredClassifications.Count > 0)
                {
                    int bestMatchingRequiredClassificationLength = 0;

                    // Check if this classification is a child of a required classification?
                    foreach (DictionaryEntry requiredClassification in mRequiredClassifications)
                    {
                        // Is this classification a child of this required classification?
                        if (MOG_Filename.IsParentClassificationString(classification, requiredClassification.Key.ToString()))
                        {
                            // Check if this requiredClassification is a better match?
                            if (requiredClassification.Key.ToString().Length > bestMatchingRequiredClassificationLength)
                            {
                                // Start tracking this as our best match thus far
                                bestMatchingRequiredClassificationLength = requiredClassification.Key.ToString().Length;
                            }
                        }
                    }

                    // Check if we think we found a best match?
                    if (bestMatchingRequiredClassificationLength != 0)
                    {
                        // Check if this classification is a child of a an excluded classification?
                        foreach (DictionaryEntry excludedClassification in mExludedClassifications)
                        {
                            // Is this classification a child of this excluded classification?
                            if (MOG_Filename.IsParentClassificationString(classification, excludedClassification.Key.ToString()))
                            {
                                // Check if this trumps our best match?
                                if (excludedClassification.Key.ToString().Length > bestMatchingRequiredClassificationLength)
                                {
                                    // Looks like the nays take it
                                    bestMatchingRequiredClassificationLength = 0;
                                    break;
                                }
                            }
                        }
                    }

                    // Check if we still have a best possitive match?
                    if (bestMatchingRequiredClassificationLength == 0)
                    {
                        bShowEntireTree = false;
                    }
                }
            }

            return(bShowEntireTree);
        }
		/// <summary>
		/// Utility method for the Package portion of AfterLabelEdit() (above)
		/// </summary>
		private ArrayList GetValidTargetSyncPath(NodeLabelEditEventArgs e, MOG_Filename packageName)
		{
			// Get the gameDataPath for this new package
			GameDataPathForm getPath = new GameDataPathForm(packageName.GetAssetPlatform(), packageName.GetAssetName());
			ArrayList targetSyncPath = null;

			// This dialog should be pushed to topmost when it doesn't have a parent or else it can ger lost behind other apps.
			// You would think this is simple but for some reason MOG has really struggled with these dialogs being kept on top...
			// We have tried it all and finally ended up with this...toggling the TopMost mode seems to be working 100% of the time.
			getPath.TopMost = true;
			getPath.TopMost = false;
			getPath.TopMost = true;
			// Show the dialog
			if (DialogResult.Cancel != getPath.ShowDialog())
			{

				targetSyncPath = getPath.MOGPropertyArray;

				// Get a value for our relative gamedata path
				string relativePath = null;
				if (targetSyncPath.Count > 0)
				{
					relativePath = ((MOG_Property)targetSyncPath[0]).mPropertyValue;
				}
				// If we found our relativePath...
				if (relativePath != null)
				{
					// Go ahead and add an initial backslash, if necessary...
					if (relativePath.Length > 0 && relativePath[0] != '\\')
					{
						relativePath = "\\" + relativePath;
					}

					// Find all our assets with this gamedata path
					ArrayList assets = MOG_DBAssetAPI.GetAllAssetsBySyncLocation(relativePath, packageName.GetAssetPlatform());
					// If we found assets...
					if (assets != null && assets.Count > 0)
					{
						// Check and see if any of the assets we found match the package we want to add...
						foreach (MOG_Filename asset in assets)
						{
							// If we already have the package name we want to add, warn user and quit...
							if (asset.GetAssetName().ToLower() == packageName.GetAssetName().ToLower())
							{
								MessageBox.Show(this, "Package name, " + packageName.GetAssetName() + ", already exists in location, '" + relativePath.Substring(1) + "'!", "Package Already Exists!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
								e.Node.EndEdit(true);
								e.Node.Remove();
								return null;
							}
						}
					}
				}
			}

			// Finished our method, so return true
			return targetSyncPath;
		}
Beispiel #23
0
 private void MessageAttachOpenFileDialog_FileOk(object sender, System.ComponentModel.CancelEventArgs e)
 {
     foreach (string file in MessageAttachOpenFileDialog.FileNames)
     {
         MOG_Filename filename = new MOG_Filename(file);
         mMessage.AttachmentAdd(filename);
         MessageAttachTextBox.Text = String.Concat(MessageAttachTextBox.Text, "\r\n", file);
     }
 }
        /// <summary> SetAssetIcon
        /// Searches through mAssetTypes to find the matching key with
        /// that of the filename.  Then returns the index
        /// </summary>
        /// <param name="filename"></param>
        /// <returns>index of icon in the mAssetTypeImages list</returns>
        static public int GetClassIconIndex(String filename)
        {
            // Construct a filename
            MOG_Filename file = null;

            try
            {
                file = new MOG_Filename(filename);
            }
            catch (Exception e)
            {
                e.ToString();
                return(0);
            }

            string classification;

            switch (file.GetFilenameType())
            {
            case MOG_FILENAME_TYPE.MOG_FILENAME_Asset:
                classification = file.GetAssetClassification();
                break;

            case MOG_FILENAME_TYPE.MOG_FILENAME_Group:
                classification = "group";
                break;

            default:
                classification = filename;
                break;
            }

            // Get the index of the key in the types array
            int x = 0;

            foreach (string classType in mAssetTypes)
            {
                if (string.Compare(classType, classification, true) == 0)
                {
                    break;
                }
                else
                {
                    x++;
                }
            }

            // If the asset was not found, return  for first icon in the list
            if (x >= mAssetTypes.Count)
            {
                return(0);
            }

            // Return the index of the icon
            return(x);
        }         // end ()
Beispiel #25
0
        /// <summary>
        ///  Add a new mog asset to the listView items array
        /// </summary>
        /// <param name="mogAsset"></param>
        /// <param name="version"></param>
        /// <param name="pProperties"></param>
        /// <param name="failedString"></param>
        /// <returns></returns>
        public ListViewItem ItemAdd(MOG_Filename mogAsset, MOG_Properties pProperties, string failedString)
        {
            //MOG_Time assetTime = new MOG_Time(version);

            ListViewItem item = AddItemToListView(mogAsset, pProperties, ToString(mogAsset, pProperties, mogAsset.GetVersionTimeStamp()).GetEncodedFilename());

            //item.SubItems[FindColumn("Failed Check")].Text = failedString;												// Failed string

            return(item);
        }
        /// <summary>
        /// Add a new asset to this listView
        /// </summary>
        public ListViewItem CreateListViewItem(ListView thisListView, MOG_Filename add, string status, MOG_Properties properties)
        {
            // Update the ListViewItem
            ListViewItem item = guiAssetManager.NewListViewItem(add, status, properties);

            // Add the item to the list view
            thisListView.Items.Add(item);

            return(item);
        }
Beispiel #27
0
        public bool ToolExistsCheck(MOG_Filename mogAsset, string version, MOG_Project pProject, ref string failedString)
        {
            if (!Directory.Exists(MOG_ControllerRepository.GetAssetBlessedVersionPath(mogAsset, version).GetEncodedFilename()))
            {
                failedString = "Doesn't exist," + failedString;
                return(false);
            }

            return(true);
        }
Beispiel #28
0
        /// Build a node within the confirm treeView of assets to confirm
        /// </summary>
        /// <param name="filename"></param>
        /// <param name="fullFilename"></param>
        private void BuildMogFilenameNode(MOG_Filename filename, string fullFilename, string label)
        {
            TreeNode node = MogUtil_ClassificationTrees.CreateAndExpandTreeNodeFullPath(ConfirmTreeView, null, this.LabelTreeDelimiter, label);

            if (node != null)
            {
                node.Tag     = fullFilename;
                node.Checked = true;
            }
        }
Beispiel #29
0
        /// <summary>
        /// Makes the selected assets the current version in the current branch
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MakeCurrentMenuItem_Click(object sender, System.EventArgs e)
        {
            try
            {
                ArrayList selectedItems  = ControlGetSelectedItems();
                ArrayList assetFilenames = new ArrayList();

                // Scan the list and prepare it for delivery to the DLL
                string message = "";
                foreach (guiAssetTreeTag tag in selectedItems)
                {
                    if (tag.Execute)
                    {
                        MOG_Filename filename = new MOG_Filename(tag.FullFilename);
                        if (filename.GetFilenameType() == MOG_FILENAME_TYPE.MOG_FILENAME_Asset)
                        {
                            assetFilenames.Add(filename);
                        }

                        message = message + filename.GetAssetFullName() + "\n";
                    }
                }

                // Check if this request effects more than 1 asset??
                if (selectedItems.Count > 1)
                {
                    if (MOG_Prompt.PromptResponse("Are you sure you want to make all of these assets the current versions?", message, MOGPromptButtons.OKCancel) != MOGPromptResult.OK)
                    {
                        return;
                    }
                }

                // Stamp all the specified assets
                if (MOG_ControllerProject.MakeAssetCurrentVersion(assetFilenames, "Made current by " + MOG_ControllerProject.GetUserName_DefaultAdmin()))
                {
                    // Check if this request effects more than 1 asset??
                    if (selectedItems.Count > 1)
                    {
                        // Inform the user this may take a while
                        MOG_Prompt.PromptResponse("Completed",
                                                  "This change requires Slave processing.\n" +
                                                  "The project will not reflect these changes until all slaves have finished processing the generated commands.\n" +
                                                  "The progress of this task can be monitored in the Connections Tab.");
                    }
                }
                else
                {
                    MOG_Prompt.PromptMessage("Make Current Failed", "The system was unable to fully complete the task!", Environment.StackTrace);
                }
            }
            catch (Exception ex)
            {
                MOG_Report.ReportMessage("MakeCurrent Exception", ex.Message, ex.StackTrace, MOG.PROMPT.MOG_ALERT_LEVEL.CRITICAL);
            }
        }
        /// <summary> SetAssetIcon
        /// Searches through mAssetTypes to find the matching key with
        /// that of the filename.  Then returns the index
        /// </summary>
        /// <param name="filename"></param>
        /// <returns>index of icon in the mAssetTypeImages list</returns>
        static public int GetClassIconIndex(string filename, MOG_Properties properties)
        {
            // Construct a filename
            MOG_Filename file = null;

            try
            {
                file = new MOG_Filename(filename);
            }
            catch (Exception e)
            {
                e.ToString();
                return(0);
            }

            string classification;

            switch (file.GetFilenameType())
            {
            case MOG_FILENAME_TYPE.MOG_FILENAME_Asset:
                classification = file.GetAssetClassification();
                break;

            case MOG_FILENAME_TYPE.MOG_FILENAME_Group:
                classification = "group";
                break;

            default:
                classification = filename;
                break;
            }

            try
            {
                TstDictionaryEntry node = mAssetTypes.Find(classification);
                if (node != null && node.IsKey)
                {
                    return((int)node.Value);
                }
                else
                {
                    if (properties == null)
                    {
                        // If we didn't get anything, we need to load this icon into our array
                        properties = new MOG_Properties(classification);
                    }
                    return(MogUtil_AssetIcons.LoadIcon(properties.ClassIcon, classification));
                }
            }
            catch
            {
                return(0);
            }
        }         // end ()