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 #2
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();
        }
		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);
		}
Beispiel #4
0
        /// <summary>
        /// Create one new node or update an existing node in the tree.
        /// </summary>
        /// <param name="tree"></param>
        /// <param name="assetName"></param>
        /// <param name="nodeColor"></param>
        static public void AssetTreeViewUpdateNode(string dir, TreeView tree, MOG_Filename assetName, Color nodeColor)
        {
            // Find the type in tree if exists
            TreeNode parent = FindAssetNodeInTree(tree, assetName);

            if (parent != null)
            {
                TreeNode node = new TreeNode();
                node.Text      = assetName.GetAssetLabel();                             // Name
                node.ForeColor = nodeColor;                                             // Color
                node.Checked   = true;

                node.ImageIndex = MogUtil_AssetIcons.GetClassIconIndex(assetName.GetEncodedFilename());

                string fullname = dir + "\\" + assetName.GetEncodedFilename();
                node.Tag = new guiAssetTreeTag(fullname, guiAssetTreeTag.TREE_FOCUS.SUBCLASS, true);

                // Add this asset to the tree
                parent.Nodes.Add(node);
            }
        }
Beispiel #5
0
        public RenameAssetForm(MOG_Filename source)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            this.mSourceFiles = new ArrayList(1);
            this.mSourceFiles.Add(source.GetEncodedFilename());

            mFullFilename = source.GetNotSureDefaultEncodedFilename();
            InitializeAssetName(source);
        }
        private void ExpandSyncTargetAssetNode(TreeNode gamedataNode, string platform)
        {
            Mog_BaseTag gamedataTag = (Mog_BaseTag)gamedataNode.Tag;

            // If we have valid data...
            if (gamedataTag.AttachedSyncTargetInfo != null)
            {
                // Key is gamedataFilename, Value is gamedataFilenameOnly
                MOG_DBSyncTargetInfo gamedataInfo = gamedataTag.AttachedSyncTargetInfo;
                string       currentVersionStamp  = gamedataInfo.mVersion;
                MOG_Filename tempFilename         = MOG_Filename.CreateAssetName(gamedataInfo.mAssetClassification, gamedataInfo.mAssetPlatform, gamedataInfo.mAssetLabel);
                MOG_Filename assetRealFile        = MOG_ControllerRepository.GetAssetBlessedVersionPath(tempFilename, currentVersionStamp);

                // Add the asset this gamedata file is associated with under the oldGamedataNode
                TreeNode assetNode = new TreeNode(assetRealFile.GetAssetFullName(), new TreeNode[] { new TreeNode(Blank_Node_Text) });
                assetNode.Tag  = new Mog_BaseTag(assetNode, assetRealFile.GetEncodedFilename(), LeafFocusLevel.RepositoryItems, true);
                assetNode.Name = assetRealFile.GetAssetFullName();
                gamedataNode.Nodes.Add(assetNode);
                SetImageIndices(assetNode, GetAssetFileImageIndex(assetRealFile.GetEncodedFilename()));
            }
        }
		private void RenameNode(NodeLabelEditEventArgs e, MOG_Filename repositoryName)
		{
			TreeNode parent = e.Node.Parent;

			e.Node.Text = repositoryName.GetAssetName();

			e.Node.Tag = new Mog_BaseTag(e.Node, repositoryName.GetEncodedFilename(), RepositoryFocusLevel.Repository, true);
			((Mog_BaseTag)e.Node.Tag).PackageNodeType = PackageNodeTypes.Asset;
			((Mog_BaseTag)e.Node.Tag).PackageFullName = repositoryName.GetAssetFullName();

			e.CancelEdit = true;
		}
Beispiel #8
0
        /// <summary>
        /// Find a list view item withtin a list view bt full name
        /// </summary>
        /// <param name="name"></param>
        /// <param name="list"></param>
        /// <returns></returns>
        public int ListViewItemFindFullItem(MOG_Filename filename, ListView list)
        {
            // I really don't like this solution...but, we need to be able to find the index in the list,
            // In the future, I think we need to handle new unrecorded classifications differently.

            // Attempt to obtain the index of this item in the list
            int index = ListViewItemFindFullItem(filename.GetEncodedFilename(), list);

            if (index == -1)
            {
                // We should look one more time for the full name anytime we fail
                index = ListViewItemFindFullItem(filename.GetFullFilename(), list);
            }

            return(index);
        }
Beispiel #9
0
        static protected void assetTreeViewCreate_AddIndividualNodes(string versionInfoFilename, string name,
                                                                     TreeView tree, TreeNode parent, guiAssetGamedataTreeTag.TREE_FOCUS level, int defaultImageIndex, bool createChildNode)
        {
            // Set the imageIndex for a new TreeNode, create the TreeNode, and create a blank tag for the new node
            TreeNode        node = assetTreeViewCreate_GetTreeNodeWithIcon(name, defaultImageIndex);
            guiAssetTreeTag tag  = null;

            // If `name` already has the project and projectpath, we need to get rid of it.
            string projectPath = MOG_ControllerProject.GetProject().GetProjectPath() + "\\";
            string newName     = name.Replace(projectPath, "");

            // Get the blessed path for this assetname
            MOG_Filename asset = new MOG_Filename(projectPath + newName);

            if (asset.GetFilenameType() == MOG_FILENAME_TYPE.MOG_FILENAME_Asset)
            {
                MOG_Filename fullname = GetAssetFullname(asset, versionInfoFilename);
                tag = new guiAssetGamedataTreeTag(fullname.GetEncodedFilename(), level, true);
            }
            else
            {
                tag = new guiAssetGamedataTreeTag(asset.GetEncodedFilename(), level, false);
            }

            // Save the type of node this is (Key, Class, Group...)
            node.Tag = tag;

            // Don't add an extra child if we are at the end of the chain
            if (/*level != guiAssetGamedataTreeTag.TREE_FOCUS.LABEL ||*/ createChildNode)
            {
                // Add a blank for this keys child
                node.Nodes.Add("");
            }

            // Check if we should add to the base or to a child
            if (parent == null)
            {
                tree.Nodes.Add(node);
            }
            else
            {
                parent.Nodes.Add(node);
            }
        }
Beispiel #10
0
        /// <summary>
        /// Used to get an Asset node with a good node.Tag for this TreeView or any inheriting classes.
        ///  Does not use full filename.
        /// </summary>
        protected override TreeNode CreateAssetNode(MOG_Filename asset)
        {
            TreeNode assetNode = base.CreateAssetNode(asset);

            // If we are expandingAssets or expandingPackageGroups, we need to be able to expand down
            if (ExpandAssets || ExpandPackageGroups)
            {
                // Add the dummy node so the usere will be given the opportunity to expand it
                assetNode.Nodes.Add(new TreeNode(Blank_Node_Text));
            }

            // Rebuild the node's tag
            MOG_Filename assetFile = MOG_ControllerProject.GetAssetCurrentBlessedPath(asset);
            Mog_BaseTag  tag       = new Mog_BaseTag(assetNode, assetFile.GetEncodedFilename(), FocusForAssetNodes, true);

            tag.PackageNodeType = PackageNodeTypes.Asset;
            tag.PackageFullName = assetFile.GetAssetFullName();
            assetNode.Tag       = tag;

            return(assetNode);
        }
Beispiel #11
0
        /// <summary>
        /// Update an existing ListView node for the asset manager inboxes
        /// </summary>
        /// <param name="pProperties"></param>
        /// <param name="nodeColor"></param>
        /// <returns></returns>
        public static void UpdateListViewItem(ListViewItem item, MOG_Filename asset, string status, MOG_Properties pProperties)
        {
            string date    = "";
            string size    = "";
            string creator = "";
            string owner   = "";
            string group   = "";
            string target  = "";

            // Check if we have a properties?
            if (pProperties != null)
            {
                // If we have a valid gameDataController, set our platform scope
                if (MOG_ControllerProject.GetCurrentSyncDataController() != null)
                {
                    // Set our current platform
                    pProperties.SetScope(MOG_ControllerProject.GetCurrentSyncDataController().GetPlatformName());
                }

                // Gather the following info from our properties
                date    = MOG_Time.FormatTimestamp(pProperties.CreatedTime, "");
                size    = guiAssetController.FormatSize(pProperties.Size);
                creator = pProperties.Creator;
                owner   = pProperties.Owner;
                group   = pProperties.Group;

                // Check if this is a packaged asset?
                if (pProperties.IsPackagedAsset)
                {
                    // Check if we have have any package assignments in our propeerties?
                    ArrayList packages = pProperties.GetPackages();
                    if (packages.Count == 0)
                    {
                        // Indicate this is a packaged asset w/o any package assignments
                        target = "Missing package assignment...";
                    }
                    else if (packages.Count == 1)
                    {
                        MOG_Property package          = packages[0] as MOG_Property;
                        MOG_Filename packageName      = new MOG_Filename(MOG_ControllerPackage.GetPackageName(package.mPropertyKey));
                        string       packageGroupPath = MOG_ControllerPackage.GetPackageGroups(package.mPropertyKey);
                        string       displayString    = MOG_ControllerPackage.CombinePackageAssignment(packageName.GetAssetLabel(), packageGroupPath, "");
                        target = "{Package} " + displayString + "  in  " + MOG_Filename.GetAdamlessClassification(packageName.GetAssetClassification());
                    }
                    else
                    {
                        target = "{Package} " + packages.Count + " Assignments...";
                    }
                }
                else if (pProperties.SyncFiles)
                {
                    // Get the formatted SyncTarget of this asset
                    target = MOG_Tokens.GetFormattedString("{Workspace}\\" + pProperties.SyncTargetPath, asset, pProperties.GetPropertyList());
                }
            }

            item.Text = asset.GetAssetLabel();

            // Populate the item's SubItems
            // I tried for a long time to be smart here and use ColumnNameFind(thisListView.Columns, "Name") but
            // I kept running into walls because this function is used by a lot of workers outside of the ListView's thread.
            // So, I gave up and am just going to do it the ugly brute force way!  YUCK!!
            item.SubItems[(int)AssetBoxColumns.NAME].Text       = asset.GetAssetLabel();
            item.SubItems[(int)AssetBoxColumns.CLASS].Text      = asset.GetAssetClassification();
            item.SubItems[(int)AssetBoxColumns.TARGETPATH].Text = target;
            item.SubItems[(int)AssetBoxColumns.DATE].Text       = date;
            item.SubItems[(int)AssetBoxColumns.SIZE].Text       = size;
            item.SubItems[(int)AssetBoxColumns.PLATFORM].Text   = asset.GetAssetPlatform();
            item.SubItems[(int)AssetBoxColumns.STATE].Text      = status;
            item.SubItems[(int)AssetBoxColumns.CREATOR].Text    = creator;
            item.SubItems[(int)AssetBoxColumns.RESPPARTY].Text  = owner;
            item.SubItems[(int)AssetBoxColumns.OPTIONS].Text    = "";
            item.SubItems[(int)AssetBoxColumns.FULLNAME].Text   = asset.GetEncodedFilename();
            item.SubItems[(int)AssetBoxColumns.BOX].Text        = asset.GetBoxName();
            item.SubItems[(int)AssetBoxColumns.GROUP].Text      = group;

            // Set the item's Icons
            item.ImageIndex = MogUtil_AssetIcons.GetFileIconIndex(asset.GetEncodedFilename(), pProperties);

            if (MogMainForm.MainApp != null &&
                MogMainForm.MainApp.mAssetManager != null)
            {
                // mAssetStatus.GetStatusInfo() is sort of a black sheep and should maybe become static
                item.StateImageIndex = MogMainForm.MainApp.mAssetManager.mAssetStatus.GetStatusInfo(status).IconIndex;
            }

            // Set the item's color
            item.ForeColor = MOG_AssetStatus.GetColor(status);
            // Check if this is a local item that has been blessed?
            if (asset.IsLocal() &&
                string.Compare(status, MOG_AssetStatus.GetText(MOG_AssetStatusType.Blessed), true) == 0)
            {
                // Mark local blessed items with light gray
                item.ForeColor = Color.LightGray;
            }
        }
        private static void ImportPrevious_Worker(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker        = sender as BackgroundWorker;
            List <object>    args          = e.Argument as List <object>;
            bool             looseMatching = (bool)args[0];

            string[] sourceFullNames = (args[1]) as string[];

            //string[] sourceFullNames = e.Argument as string[];

            mInvalidAssetNames.Clear();
            mNewAssetNames.Clear();
            mNewAssetProperties.Clear();

            // Check if asset has been previously imported into the system
            for (int i = 0; i < sourceFullNames.Length && !worker.CancellationPending; i++)
            {
                string    sourceFullName      = sourceFullNames[i];
                ArrayList previousSourceFiles = new ArrayList();

                string message = "Importing:\n" +
                                 "     " + Path.GetDirectoryName(sourceFullName) + "\n" +
                                 "     " + Path.GetFileName(sourceFullName);
                worker.ReportProgress(i * 100 / sourceFullNames.Length, message);

                // Check if this is a directory?
                if (DosUtils.DirectoryExistFast(sourceFullName))
                {
                    // Obtain the list of contained files
                    ArrayList containedFiles = DosUtils.FileGetRecursiveList(sourceFullName, "*.*");
                    if (containedFiles != null)
                    {
                        // Map these filenames to all the possible assetnames
                        previousSourceFiles = MOG_ControllerProject.MapFilenamesToAssetNames(containedFiles, MOG_ControllerProject.GetPlatformName(), null);
                    }
                }
                else
                {
                    // Map this filename to all possible assetnames
                    previousSourceFiles = MOG_ControllerProject.MapFilenameToAssetName(sourceFullName, MOG_ControllerProject.GetPlatformName(), MOG_ControllerProject.GetWorkspaceDirectory());
                }

                // Are we loose matching?
                if (looseMatching)
                {
                    // Did we get back only 2 files
                    if (previousSourceFiles.Count == 2)
                    {
                        // Is the second one a blank?
                        MOG_Filename file = previousSourceFiles[1] as MOG_Filename;
                        if (file.GetFullFilename().Length == 0)
                        {
                            // Then remove it!
                            previousSourceFiles.RemoveAt(1);
                        }
                    }
                }

                if (previousSourceFiles.Count == 1)
                {
                    MOG_Filename previousFile = previousSourceFiles[0] as MOG_Filename;

                    if (MogMainForm.MainApp.AssetManagerAutoImportCheckBox.Checked)
                    {
                        // Create the correct controller
                        MOG_ControllerAsset.CreateAsset(sourceFullName, previousFile.GetEncodedFilename(), false);
                    }
                    else
                    {
                        // Create a new invalid name
                        ImportFile invalidName = new ImportFile(sourceFullName);

                        // Add all possible matches to this name
                        foreach (MOG_Filename potentialMatch in previousSourceFiles)
                        {
                            // Make sure we have a valid match?
                            if (potentialMatch != null &&
                                potentialMatch.GetOriginalFilename().Length > 0)
                            {
                                invalidName.mPotentialFileMatches.Add(potentialMatch);
                            }
                        }

                        // Add to our invalidNames array
                        mInvalidAssetNames.Add(invalidName);
                    }
                }
                else
                {
                    // Create a new invalid name
                    ImportFile invalidName = new ImportFile(sourceFullName);

                    // Add all possible matches to this name
                    foreach (MOG_Filename potentialMatch in previousSourceFiles)
                    {
                        // Make sure we have a valid match?
                        if (potentialMatch != null &&
                            potentialMatch.GetOriginalFilename().Length > 0)
                        {
                            invalidName.mPotentialFileMatches.Add(potentialMatch);
                        }
                    }

                    // Add to our invalidNames array
                    mInvalidAssetNames.Add(invalidName);
                }
            }
        }
Beispiel #13
0
        public static bool RebuildNetworkPackage(MOG_Filename packageFilename, string jobLabel)
        {
            // Make sure this represents the currently blessed revision of this package
            if (!packageFilename.IsWithinRepository())
            {
                // Obtain the current revision for this specified package
                packageFilename = MOG_ControllerProject.GetAssetCurrentBlessedVersionPath(packageFilename);
            }

            // Now we should be ensured a package located within the repository
            if (packageFilename.IsWithinRepository())
            {
                // Send our Rebuild package command to the server
                MOG_Command rebuildPackageCommand = MOG_CommandFactory.Setup_NetworkPackageRebuild(packageFilename.GetEncodedFilename(), packageFilename.GetAssetPlatform(), jobLabel);
                return(MOG_ControllerSystem.GetCommandManager().SendToServer(rebuildPackageCommand));
            }

            return(false);
        }
        private string GetFormattedString(string formatedSource)
        {
            string seeds = "";

            if (MOG_ControllerProject.GetUser() != null)
            {
                seeds = MOG_Tokens.AppendTokenSeeds(seeds, MOG_Tokens.GetPackageTokenSeeds("Game~Packages{All}PackageFile.Pak", "All", "", "", "Packages\\PackageFile.Pak"));
            }

            if (MOG_ControllerProject.GetProject() != null)
            {
                seeds = MOG_Tokens.AppendTokenSeeds(seeds, MOG_Tokens.GetProjectTokenSeeds(MOG_ControllerProject.GetProject()));
            }

            if (mAssetFilename != null)
            {
                seeds = MOG_Tokens.AppendTokenSeeds(seeds, MOG_Tokens.GetFilenameTokenSeeds(mAssetFilename));
                seeds = MOG_Tokens.AppendTokenSeeds(seeds, MOG_Tokens.GetRipperTokenSeeds(mAssetFilename.GetEncodedFilename() + "\\Files.Imported", "*.*", mAssetFilename.GetEncodedFilename() + "\\Files.All"));
            }

            seeds = MOG_Tokens.AppendTokenSeeds(seeds, MOG_Tokens.GetSystemTokenSeeds());
            seeds = MOG_Tokens.AppendTokenSeeds(seeds, MOG_Tokens.GetOSTokenSeeds());
            seeds = MOG_Tokens.AppendTokenSeeds(seeds, MOG_Tokens.GetTimeTokenSeeds(new MOG_Time()));


            return(MOG_Tokens.GetFormattedString(formatedSource, seeds));
        }
		private void MogControl_PackageTreeView_AfterLabelEdit(object sender, System.Windows.Forms.NodeLabelEditEventArgs e)
		{
			// Encapsulate all of this in a try-catch, since we don't want to crash MOG
			try
			{
				if (!CheckLabelEdit(e))
				{
					return;
				}

				// Disable further label editing
				e.Node.TreeView.LabelEdit = false;

				// Find our parent package
				TreeNode package = FindPackage(e.Node);

				TreeNode parent = e.Node.Parent;

				string nodeText = e.Node.Text.ToLower();
				ArrayList packagePlatforms = GetPackageLabelEditPlatforms(e, ref nodeText);

				// Switch base on what our nodeText was before the user editted it
				switch (nodeText.ToLower())
				{
				case "newgroup":
					#region new-group
					if (package != null)
					{
						// Get the new edited label name
						//string groupName = e.Label;

						MOG_Filename packageAsset = new MOG_Filename(((Mog_BaseTag)package.Tag).FullFilename);

						string groupName = GetQualifiedGroupName(e, package);

						// If we have a duplicate, do not add it
						if (ValidateNodeIsNotDuplicate(e.Node.Parent, groupName) == true)
						{
							MOG_Prompt.PromptResponse("Duplicate Entry!", "The group, " + groupName + ", "
								+ "already exists!  Group not added.");
							e.Node.Remove();
							return;
						}

						// Add group to Database
						if (!AddGroupToDatabase(groupName, packageAsset))
						{
							// We need to clean up the unsuccessfull add to the database
							e.Node.Remove();

							// Show error
							MOG_Prompt.PromptMessage("Create group", "We were unable to add this group to the database. Aborting");
						}

						AttachValidatedTagToNewObjectOrGroup(package, e.Node, PackageNodeTypes.Group);
						// Go ahead and select our node
						e.Node.TreeView.SelectedNode = e.Node;
					}
					#endregion newgroup
					break;
				case "(newpackageobject)":
					#region new-package-object
					if (package != null)
					{
						// Get the new edited label name
						string objectName = e.Label;
						e.Node.Text = "(" + objectName + ")";

						// If we have a duplicate, do not add it
						if (ValidateNodeIsNotDuplicate(e.Node.Parent, e.Node.Text) == true)
						{
							MOG_Prompt.PromptResponse("Duplicate Entry!", "The object, (" + objectName + "), "
								+ "already exists!  Package object not added.");
							e.Node.Remove();
							return;
						}

						MOG_Filename packageAsset = new MOG_Filename(((Mog_BaseTag)package.Tag).FullFilename);

						string groupPath = GetQualifiedGroupName(e, package);

						// Add group to Database
						if (!AddGroupToDatabase(groupPath, packageAsset))
						{
							// We need to clean up the unsuccessfull add to the database
							e.Node.Remove();

							// Show error
							MOG_Prompt.PromptMessage("Create object", "We were unable to add this object to the database. Aborting");
						}
						else
						{
							e.CancelEdit = true;
							AttachValidatedTagToNewObjectOrGroup(package, e.Node, PackageNodeTypes.Object);
							// Go ahead and select our node
							e.Node.TreeView.SelectedNode = e.Node;
						}
					}
					#endregion new-package-object
					break;
				case "newpackage":
					#region new-package
					// Get the new package name
					string nodeFullname = MOG_Filename.JoinClassificationString(e.Node.FullPath, e.Label);

					// Construct a valid filename
					MOG_Filename[] packages = new MOG_Filename[packagePlatforms.Count];
					bool duplicateExists = false;
					string duplicates = "";
					for (int i = 0; i < packages.Length && i < packagePlatforms.Count; ++i)
					{
						MOG_Filename packageName = MOG_Filename.CreateAssetName(e.Node.Parent.FullPath, (string)packagePlatforms[i], e.Label);
						packages[i] = packageName;
						// If we have a duplicate package, store 
						if ((duplicateExists |= ValidateNodeIsNotDuplicate(e.Node.Parent, packageName.GetAssetName())) == true)
						{
							duplicates += packageName + "\r\n";
						}
					}

					// If we had duplicates, warn user and exit
					if (duplicateExists)
					{
						MOG_Prompt.PromptResponse("Duplicate Entry(ies) Detected!", "The following were already exist:\r\n\r\n"
							+ duplicates);
						e.Node.Remove();
						return;
					}

					// If we did not get a ValidPackageName (or the user decided to abort...)
					foreach (MOG_Filename packageName in packages)
					{
						if (!ValidatePackageExtension(e, packageName))
						{
							return;
						}
					}

					bool problemAdding = false;
					string packageErrorPrompt = "Did not complete package add for the following: \r\n";

					// Go backwards through our packages (so we can get the right platforms.
					for (int i = packages.Length - 1; i > -1; --i)
					{
						MOG_Filename packageName = packages[i];
						// Did we get a valid package name?
						if (packageName != null)
						{
							// Create the package
							MOG_Filename createdPackage = CreatePackageForPlatform(e, packageName, parent);

							// If the user cancelled some part of the process or we had an error...
							if (createdPackage == null)
							{
								// Remove the node
								packageErrorPrompt += "\t" + packageName + ".";
								problemAdding = true;
								break;
							}


							TreeNode newPackageNode;

							// For our first platform, we've already got a node, use it...
							if (i == 0)
							{
								e.Node.Text = createdPackage.GetAssetName();
								e.Label.ToString();
								newPackageNode = e.Node;
							}
							// For subsequent platforms, add a new node...
							else
							{
								newPackageNode = e.Node.Parent.Nodes.Add(createdPackage.GetAssetName());
							}

							// Now that we've got our initial information, add our tag
							newPackageNode.Tag = new Mog_BaseTag(newPackageNode, createdPackage.GetEncodedFilename(), this.FocusForAssetNodes, true);
							((Mog_BaseTag)newPackageNode.Tag).PackageNodeType = PackageNodeTypes.Package;
							((Mog_BaseTag)newPackageNode.Tag).PackageFullName = createdPackage.GetAssetFullName();
							SetImageIndices(newPackageNode, GetAssetFileImageIndex(createdPackage.GetEncodedFilename()));
						}
					}

					// If we had a problem, let the user know and remove our package
					if (problemAdding)
					{
						MOG_Prompt.PromptMessage("Unable to Add Package(s)",
							packageErrorPrompt);
						e.Node.Remove();
						foreach (MOG_Filename packageName in packages)
						{
							RemovePackage(packageName);
						}
					}
					else // Else, we were OK, so go ahead and select this node...
					{
						e.Node.TreeView.SelectedNode = e.Node;

						foreach (MOG_Filename packageName in packages)
						{
							// Add this package to the list of newly added packages
							this.CreatedPackages.Add(packageName);
						}

						// Fire the after package create event
						if (AfterPackageCreate != null)
						{
							AfterPackageCreate(this, EventArgs.Empty);
						}
					}
					#endregion new-package
					break;
				}
			}
			catch (Exception ex)
			{
				MOG_Report.ReportMessage("TreeNode Error!", "Error committing change to package, group, or package object label:\n" + ex.Message, ex.StackTrace, MOG.PROMPT.MOG_ALERT_LEVEL.ERROR);
				if (e.Node != null)
				{
					e.Node.Remove();
				}
			}
		}