Example #1
0
        public void AssetPopulate(MOG_Properties asset)
        {
            mProperties = asset;

            this.AssetDescriptionTextBox.Text = mProperties.GetDescription();
            this.AssetFormatTextBox.Text      = mProperties.GetGameDataPath();
            this.AssetRipperTextBox.Text      = mProperties.GetAssetRipper();
            this.AssetRipTaskerTextBox.Text   = mProperties.GetAssetRipTasker();
            this.AssetNameTextBox.Text        = mProperties.GetClassification();

            this.AssetIconTextBox.Text = mProperties.GetAssetIcon();
            if (DosUtils.FileExist(string.Concat(MOG_ControllerProject.GetProject().GetProjectToolsPath(), "\\", mProperties.GetAssetIcon())))
            {
                this.AssetIconPictureBox.Image = Image.FromFile(string.Concat(MOG_ControllerProject.GetProject().GetProjectToolsPath(), "\\", mProperties.GetAssetIcon()));
            }

            switch (mProperties.GetPackagedAsset().ToLower())
            {
            case "true":
                this.AssetPackageCheckBox.Checked = true;
                break;

            case "false":
                this.AssetPackageCheckBox.Checked = false;
                break;

            default:
                MessageBox.Show(this, "This asset has an invalid package value");
                break;
            }
        }
Example #2
0
        private void UpdateClassificationTree()
        {
            // Attempt to drill to the specified path
            string classification = ClassificationTextBox.Text;

            // Check how this classifciation will impact the SyncTargetTree?
            MOG_Properties props = new MOG_Properties(Classification);

            if (props.IsPackagedAsset)
            {
                EnableSyncTargetTree(false);
            }
            else if (props.SyncFiles)
            {
                EnableSyncTargetTree(true);
            }
            else
            {
                EnableSyncTargetTree(false);
            }

            // Check if we have nothing selected?  or
            // Check if we have the wrong thing selected?
            if (this.ClassificationTreeView.SelectedNode == null ||
                string.Compare(this.ClassificationTreeView.SelectedNode.FullPath, classification, true) != 0)
            {
                // Locate and select the appropriate node in the classification tree
                this.ClassificationTreeView.SelectedNode = MogUtil_ClassificationTrees.FindAndExpandTreeNodeFromFullPath(this.ClassificationTreeView.Nodes, "~", classification);
            }
        }
 /// <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);
         }
     }
 }
Example #4
0
        public void LoadValues(ArrayList assets)
        {
            // Set this.allAssets first of all
            this.allAssets = new ArrayList();
            foreach (object obj in assets)
            {
                if (obj is string)
                {
                    this.allAssets.Add((string)obj);
                }
            }

            foreach (object obj in assets)
            {
                if (obj is string)
                {
                    string       asset = (string)obj;
                    ListViewItem item  = new ListViewItem();
                    item.Text = asset;
                    item.SubItems.Add("Yes");
                    this.lvAssetConfig.Items.Add(item);
                }
                else if (obj is MOG_Properties)
                {
                    MOG_Properties mai  = (MOG_Properties)obj;
                    ListViewItem   item = new ListViewItem();
                    ////item.Text = mai.mAssetKey;
                    item.SubItems.Add("Yes");
                    this.lvAssetConfig.Items.Add(item);

                    string[] slaveNames = mai.ValidSlaves.Split(",".ToCharArray());
                    foreach (string slaveName in slaveNames)
                    {
                        if (slaveName.Trim() == "")
                        {
                            continue;
                        }

                        if (Utils.ListViewContainsText(this.lvSlaveMachines, slaveName))
                        {
                            ListViewItem slaveItem = Utils.GetListViewItem(this.lvSlaveMachines, slaveName);
                            if (!(slaveItem.Tag is SlaveData))
                            {
                                slaveItem.Tag = new SlaveData(false, false, new ArrayList());
                                continue;
                            }

                            SlaveData slaveData = slaveItem.Tag as SlaveData;
                            ////slaveData.assets.Add(mai.mAssetKey);
                        }
                        else
                        {
                            ListViewItem slaveItem = new ListViewItem(slaveName);
                            slaveItem.Tag = new SlaveData(false, false, new ArrayList(new string[] { "KEYKEY" }));                               ////mai.mAssetKey } ));
                            this.lvSlaveMachines.Items.Add(slaveItem);
                        }
                    }
                }
            }
        }
Example #5
0
        static public int GetFileIconIndex(string filename, MOG_Properties properties)
        {
            if (mFileTypeManager == null)
            {
                mFileTypeManager = new IconListManager(mAssetTypeImages, IconReader.IconSize.Small);
            }

            int returnInt = 0;

            if (properties == null)
            {
                // Try getting a File Icon
                if (File.Exists(filename))
                {
                    returnInt = mFileTypeManager.AddFileIcon(filename);
                }
            }

            // If we got the default index, return our Class Icon index
            if (returnInt == 0)
            {
                return(GetAssetIconIndex(filename, properties));
            }
            else
            {
                return(returnInt);
            }
        }
Example #6
0
        public void SavePackagingChanges(MOG_Properties properties)
        {
            switch (this.PropertiesMultiClusterCheckBox.CheckState)
            {
            case CheckState.Checked:
                properties.ClusterPackaging_InheritedBoolean = MOG.PROPERTIES.MOG_InheritedBoolean.True;
                break;

            case CheckState.Unchecked:
                properties.ClusterPackaging_InheritedBoolean = MOG.PROPERTIES.MOG_InheritedBoolean.False;
                break;

            case CheckState.Indeterminate:
                properties.ClusterPackaging_InheritedBoolean = MOG.PROPERTIES.MOG_InheritedBoolean.Inherited;
                break;
            }

            switch (this.PropertiesMultiCleanWorkDirCheckBox.CheckState)
            {
            case CheckState.Checked:
                properties.CleanupPackageWorkspaceDirectory_InheritedBoolean = MOG.PROPERTIES.MOG_InheritedBoolean.True;
                break;

            case CheckState.Unchecked:
                properties.CleanupPackageWorkspaceDirectory_InheritedBoolean = MOG.PROPERTIES.MOG_InheritedBoolean.False;
                break;

            case CheckState.Indeterminate:
                properties.CleanupPackageWorkspaceDirectory_InheritedBoolean = MOG.PROPERTIES.MOG_InheritedBoolean.Inherited;
                break;
            }
        }
Example #7
0
        public int AddNewClasses(BackgroundWorker worker, int classificationProgress, int classificationTotal, MOG_Project project, TreeNodeCollection nodes)
        {
            foreach (AssetTreeNode atn in nodes)
            {
                if (atn.IsAClassification && !atn.InDB)
                {
                    string classFullName = atn.FullPath.Replace(atn.TreeView.PathSeparator, "~");

                    worker.ReportProgress(classificationProgress++ *100 / classificationTotal, "Creating " + classFullName);

                    project.ClassificationAdd(classFullName);
                    MOG_Properties properties = project.GetClassificationProperties(classFullName);
                    properties.SetImmeadiateMode(true);

                    //If all the kids have the same sync target, we're setting the classification sync target to the same one
                    string commonSyncTarget = FindCommonSyncTarget(atn);
                    if (commonSyncTarget != "")
                    {
                        // Set the classification's sync target to the common sync target of all the assets
                        atn.FileFullPath = commonSyncTarget;
                    }

                    atn.InDB = true;
                }

                // recurse
                classificationProgress = AddNewClasses(worker, classificationProgress, classificationTotal, project, atn.Nodes);
            }

            return(classificationProgress);
        }
        private void RefreshWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker         = sender as BackgroundWorker;
            string           trashDirectory = MOG_ControllerProject.GetActiveUser().GetUserPath() + "\\Trash";

            mSize = 0;

            ArrayList assets = MOG_DBInboxAPI.InboxGetAssetListWithProperties("Trash", MOG_ControllerProject.GetActiveUser().GetUserName(), "", "");
            int       i      = 0;

            foreach (MOG_DBInboxProperties asset in assets)
            {
                // Create the properties for this asset
                MOG_Properties pProperties = new MOG_Properties(asset.mProperties);

                worker.ReportProgress(i, asset.mAsset.GetAssetName());

                // Create the ListViewItem
                ListViewItem item = guiAssetManager.NewListViewItem(asset.mAsset, pProperties.Status, pProperties);

                if (!string.IsNullOrEmpty(pProperties.Size))
                {
                    mSize += long.Parse(pProperties.Size);
                }

                worker.ReportProgress(i, item);
                i++;
            }
        }
        public ListViewItem[] RefreshUsersBox(BackgroundWorker worker, string desiredBox, string contentsFileDirectory)
        {
            MOG_Time now = new MOG_Time();

            ArrayList assets = MOG_DBInboxAPI.InboxGetAssetListWithProperties(desiredBox, MOG_ControllerProject.GetActiveUser().GetUserName(), "", "");

            ListViewItem[] items = new ListViewItem[assets.Count];

            int x = 0;

            foreach (MOG_DBInboxProperties asset in assets)
            {
                // Create the properties for this asset
                MOG_Properties pProperties = new MOG_Properties(asset.mProperties);

                string message = "Refreshing:\n" +
                                 "     " + asset.mAsset.GetAssetClassification() + "\n" +
                                 "     " + asset.mAsset.GetAssetName();
                worker.ReportProgress(x, message);

                // Update the ListViewItem
                ListViewItem item = guiAssetManager.NewListViewItem(asset.mAsset, pProperties.Status, pProperties);
                items[x++] = item;
            }

            return(items);
        }
Example #10
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));
        }
Example #11
0
        private classTreeNode EncodeTree(AssetTreeNode tn, MOG_Properties props, int dialogId)
        {
            classTreeNode classNode = new classTreeNode(tn.Text);

            classNode.ImageIndex         = BLUEDOT_INDEX;
            classNode.SelectedImageIndex = BLUEDOT_INDEX;

            // Get a local handle for our progress dialog
            MOG_Progress.ProgressUpdate(dialogId, tn.FullPath);

            // if this is an asset filename node?
            if (tn.IsAnAssetFilename)
            {
                classNode.Text                = classNode.Text;
                classNode.ForeColor           = Color.Blue;
                classNode.ImageIndex          = ARROW_INDEX;
                classNode.SelectedImageIndex  = ARROW_INDEX;
                classNode.IsAssetFilenameNode = true;

                // Inherit Properties from parent
                // 'props' needs to be cloned or else all of these children assets will share the same Properties!!!
                classNode.props = props;

                // Make list o' children
                foreach (AssetTreeNode fileNode in tn.fileNodes)
                {
                    if (fileNode.IsAFile)
                    {
                        classNode.importFiles.Add(fileNode.FileFullPath);
                    }
                }

                // setup gamedatapath
                string assetDirectoryPath = MOG.CONTROLLER.CONTROLLERASSET.MOG_ControllerAsset.GetCommonDirectoryPath(this.projectRootPath, classNode.importFiles);
                string relativePath       = "";
                if (assetDirectoryPath.Length > this.projectRootPath.Length)
                {
                    relativePath = assetDirectoryPath.Substring(this.projectRootPath.Length + 1);
                }
                classNode.props.SyncTargetPath = relativePath;

                // add it to the list of asset filename nodes for later processing
                this.assetFilenameNodes.Add(classNode);

                return(classNode);                              // don't do children of an asset filename node
            }

            // Use our properties to pass along to our children
            props = MOG_ControllerProject.GetClassificationProperties(tn.FullPath.Replace(tn.TreeView.PathSeparator, "~"));
            props.SetImmeadiateMode(true);
            classNode.props = props;

            // Loop through all of our children nodes sending them our Properties
            foreach (AssetTreeNode subNode in tn.Nodes)
            {
                classNode.Nodes.Add(EncodeTree(subNode, props, dialogId));
            }

            return(classNode);
        }
Example #12
0
        /// <summary>
        /// Thread safe find and add function for icon management
        /// </summary>
        private static int FindOrAddIcon(ref MOG_Properties properties, IconType iconType, string assetPropertiesName, string assetName)
        {
            // Make sure we are mutex safe
            mMutex.WaitOne();

            try
            {
                // Does this icon key exist already
                TstDictionaryEntry node = mAssetTypes.Find(assetName);
                if (node != null && node.IsKey)
                {
                    // Return the icon index then
                    return((int)node.Value);
                }
                else
                {
                    // Do we have a valid properties object?
                    if (properties == null)
                    {
                        // If we didn't get anything, we need to load this icon into our array
                        properties = new MOG_Properties(assetPropertiesName);
                    }
                    else if (properties != null && properties.AssetIcon.Length == 0 || properties.ClassIcon.Length == 0)
                    {
                        properties = new MOG_Properties(assetPropertiesName);
                    }

                    // Lets now populate our icon name to load
                    string iconName = "";

                    // What kind of icon is this?
                    switch (iconType)
                    {
                    case IconType.ASSET:
                        iconName = properties.AssetIcon;
                        break;

                    case IconType.CLASS:
                        iconName = properties.ClassIcon;
                        break;

                    default:
                        return(0);
                    }

                    // Load this icon into our list of icons and return its newly created index
                    return(LoadIcon(iconName, assetName));
                }
            }
            catch
            {
                return(0);
            }
            finally
            {
                // Realease our mutex
                mMutex.ReleaseMutex();
            }
        }
Example #13
0
        private classTreeNode EncodeNode(AssetTreeNode atn, MOG_Properties props)
        {
            classTreeNode classNode = new classTreeNode(atn.Text);

            classNode.ImageIndex         = BLUEDOT_INDEX;
            classNode.SelectedImageIndex = BLUEDOT_INDEX;
            classNode.props = null;

            // if this is an asset filename node?
            if (atn.IsAnAssetFilename)
            {
                classNode.Text                = classNode.Text;
                classNode.ForeColor           = Color.Blue;
                classNode.ImageIndex          = ARROW_INDEX;
                classNode.SelectedImageIndex  = ARROW_INDEX;
                classNode.IsAssetFilenameNode = true;

                // Make list o' children
                foreach (AssetTreeNode fileNode in atn.fileNodes)
                {
                    if (fileNode.IsAFile)
                    {
                        classNode.importFiles.Add(fileNode.FileFullPath);
                    }
                }

                // Check if we have a props?
                if (classNode.props != null)
                {
                    // Setup SyncTargetPath Property
                    string relativePath       = "";
                    string assetDirectoryPath = MOG.CONTROLLER.CONTROLLERASSET.MOG_ControllerAsset.GetCommonDirectoryPath(this.projectRootPath, classNode.importFiles);
                    if (assetDirectoryPath.Length > this.projectRootPath.Length)
                    {
                        relativePath = assetDirectoryPath.Substring(this.projectRootPath.Length + 1);
                    }

                    // Set our SyncTargetPath
                    classNode.props.SyncTargetPath = relativePath;
                }

                // add it to the list of asset filename nodes for later processing
                this.assetFilenameNodes.Add(classNode);

                return(classNode);                              // don't do children of an asset filename node
            }

            classNode.FilledIn      = false;
            classNode.assetTreeNode = atn;

            // add a dummy child node if necessary
            if (atn.Nodes.Count > 0)
            {
                classNode.Nodes.Add(new classTreeNode("DUMMY_NODE"));
            }

            return(classNode);
        }
Example #14
0
        /// <summary>
        /// Edit the ripper in notepad
        /// </summary>
        private void EditRipper()
        {
            if (this.PropertiesList.Length > 0)
            {
                MOG_Properties properties = PropertiesList[0] as MOG_Properties;

                // Get the assigned ripper information
                string ripper = properties.AssetRipper;
                string tool   = DosUtils.FileStripArguments(properties.AssetRipper);
                string args   = DosUtils.FileGetArguments(properties.AssetRipper);

                // Do we have a ripper to edit?
                if (ripper.Length > 0)
                {
                    // Locate the ripper
                    ripper = MOG_ControllerSystem.LocateTool("", tool);
                    if (ripper.Length > 0)
                    {
                        // Edit the ripper
                        guiCommandLine.ShellSpawn("Notepad.exe", ripper);
                    }
                    else
                    {
                        // If not, do we want to create one?
                        if (MOG_Prompt.PromptResponse("No Ripper Found", "This appears to be a new ripper.\n" +
                                                      "RIPPER: " + tool + "\n\n" +
                                                      "Would you like to create a new one for editing?", MOGPromptButtons.YesNo) == MOGPromptResult.Yes)
                        {
                            // Create a new one using the user's specified name
                            string defaultRipperName = tool;
                            ripper = Path.Combine(MOG_ControllerProject.GetProject().GetProjectToolsPath(), defaultRipperName);

                            // Do we want to start from the template?
                            if (MOG_Prompt.PromptResponse("Use Ripper Template", "Would you like to base the new ripper from MOG's ripper template?", MOGPromptButtons.YesNo) == MOGPromptResult.Yes)
                            {
                                // If so, copy the template to this new ripper
                                string template = MOG_ControllerSystem.GetSystemRepositoryPath() + "\\Tools\\Rippers\\TemplateComplex_ripper.bat";

                                DosUtils.CopyFast(template, ripper, false);
                            }

                            // Launch the editor
                            string output = "";
                            guiCommandLine.ShellExecute("Notepad.exe", ripper, System.Diagnostics.ProcessWindowStyle.Normal, ref output);

                            // Now, set this new ripper as the ripper assigned to this asset restoring the users args
                            properties.AssetRipper = ripper + " " + args;
                            this.PropertiesRippingRipperComboBox.Text = properties.AssetRipper;
                        }
                    }
                }
                else
                {
                    MOG_Prompt.PromptMessage("Edit Ripper", "There is no ripper to edit.");
                }
            }
        }
Example #15
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>
        /// Find out if we have a classification that has the IsPackage property set true
        /// </summary>
        private bool NodeClassificationIsPackage(TreeNode node)
        {
            MOG_Properties classificationProps = MOG_Properties.OpenClassificationProperties(node.FullPath);

            if (classificationProps != null && classificationProps.IsPackage)
            {
                return(true);
            }
            return(false);
        }
Example #17
0
        /// <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 ()
Example #18
0
        private void UpdateSyncTarget()
        {
            MOG_Properties props = new MOG_Properties(ClassificationTextBox.Text);
            string         seeds = "";

            seeds = MOG_Tokens.AppendTokenSeeds(seeds, MOG_Tokens.GetClassificationTokenSeeds(Classification));
            seeds = MOG_Tokens.AppendTokenSeeds(seeds, MOG_Tokens.GetPropertyTokenSeeds(props.GetPropertyList()));
            string resolvedSyncTargetPath = MOG_Tokens.GetFormattedString(props.SyncTargetPath, seeds);

            SyncTarget = resolvedSyncTargetPath;
        }
Example #19
0
        public void InitializePackagingInfo(MOG_Properties properties, MOG_Filename currentFilename)
        {
            mDisableEvents = true;
            // Put in the Multi-asset commands
            SetComboBoxProperty(this.PropertiesSinglePakDelComboBox, properties.PackageCommand_DeletePackageFile, false);
            SetComboBoxProperty(this.PropertiesPackageEventsPreComboBox, properties.PackagePreMergeEvent, false);
            SetComboBoxProperty(this.PropertiesPackageEventsPostComboBox, properties.PackagePostMergeEvent, false);

            SetCheckBoxProperty(this.PropertiesMultiClusterCheckBox, properties.ClusterPackaging_InheritedBoolean);
            mResetWildcardCheck = false;
            mDisableEvents      = false;
        }
        private int EncodeAll(TreeNodeCollection nodes, int totalItems, int populatedItems, BackgroundWorker worker)
        {
            foreach (classTreeNode ctn in nodes)
            {
                if (!ctn.FilledIn && ctn.assetTreeNode != null)
                {
                    // kill dummy node
                    ctn.Nodes.Clear();

                    // populate properties
                    if (ctn.props == null)
                    {
                        // Get the classification's properties that we can edit
                        ctn.props = MOG_Properties.OpenClassificationProperties(ctn.FullPath);
                        ctn.props.SetImmeadiateMode(true);

                        // build synctargetpath
                        if (ctn.assetTreeNode.FileFullPath != "")                               // "" indicates don't set sync data path
                        {
                            string syncDataPath = ctn.assetTreeNode.FileFullPath;
                            if (syncDataPath.ToLower().StartsWith(this.projectRootPath.ToLower()))
                            {
                                syncDataPath = syncDataPath.Substring(this.projectRootPath.Length).Trim("\\".ToCharArray());
                            }

                            ctn.props.SyncTargetPath = syncDataPath;
                        }
                    }

                    // add converted children
                    foreach (AssetTreeNode atn in ctn.assetTreeNode.Nodes)
                    {
                        string message = "Creating:\n" +
                                         "     " + ctn.FullPath + "\n" +
                                         "     " + atn.FullPath.Substring(ctn.FullPath.Length);
                        worker.ReportProgress(populatedItems * 100 / totalItems, message);

                        ctn.Nodes.Add(EncodeNode(atn, ctn.props));
                    }

                    // mark this node as filled-in
                    ctn.FilledIn      = true;
                    ctn.assetTreeNode = null;
                }

                ++populatedItems;

                // recurse
                populatedItems = EncodeAll(ctn.Nodes, totalItems, populatedItems, worker);
            }

            return(populatedItems);
        }
        private void PopulateNode(classTreeNode ctn)
        {
            if (ctn != null)
            {
                if (ctn.props == null)
                {
                    // need to get a brand new props
                    if (ctn.IsAssetFilenameNode)
                    {
                        // Get a new properties that we can edit
                        ctn.props = MOG_Properties.OpenFileProperties(new MOG_PropertiesIni());
                        // Load its inherited properties
                        ctn.props.PopulateInheritance(new MOG_Filename(ctn.FullPath).GetAssetClassification());
                        // Make sure we trigger the propertyGrid to redisplay this new props
                        this.propertyGrid.SelectedObject = ctn.props;
                    }
                    else
                    {
                        // Get the classification's properties that we can edit
                        ctn.props = MOG_Properties.OpenClassificationProperties(ctn.FullPath);
                        ctn.props.SetImmeadiateMode(true);

                        // build synctargetpath
                        if (ctn.assetTreeNode != null && ctn.assetTreeNode.FileFullPath != "")                                  // "" indicates don't set sync data path
                        {
                            string syncDataPath = ctn.assetTreeNode.FileFullPath;
                            if (syncDataPath.ToLower().StartsWith(this.projectRootPath.ToLower()))
                            {
                                syncDataPath = syncDataPath.Substring(this.projectRootPath.Length).Trim("\\".ToCharArray());
                            }

                            ctn.props.SyncTargetPath = syncDataPath;
                        }

                        // Make sure we trigger the propertyGrid to redisplay this new props
                        this.propertyGrid.SelectedObject = ctn.props;
                    }

                    //					// mark node as populated
                    //					ctn.FilledIn = true;
                }
                else
                {
                    // need to update the existing props
                    if (ctn.props.PopulateInheritance())
                    {
                        // Make sure we trigger the propertyGrid to redisplay this updated props
                        this.propertyGrid.SelectedObject = ctn.props;
                    }
                }
            }
        }
Example #22
0
        private void PopulateClassNodeProps(classTreeNode ctn)
        {
            if (ctn != null)
            {
                // Get the classification's properties that we can edit
                ctn.props = MOG_Properties.OpenClassificationProperties(ctn.FullPath);
                ctn.props.SetImmeadiateMode(true);

                this.propertyGrid.SelectedObject = ctn.props;
// MIGRATION: whatever
//                if (ctn.IsNewClass)
//					ctn = ctn;
            }
        }
Example #23
0
        private bool IsInformationValid()
        {
            if (this.PackageNameTextBox.BackColor == Color.Tomato)
            {
                MOG_Prompt.PromptResponse("Package name missing", "Please specify a name for the new package.");
                return(false);
            }

            if (MOG_ControllerProject.DoesAssetExists(MOG_Filename.CreateAssetName(Classification, Platform, PackageName)))
            {
                MOG_Prompt.PromptResponse("Package name not unique", "This package already exists, please specify a unique package name and try again.");
                return(false);
            }

            if (this.ClassificationTextBox.BackColor == Color.Tomato)
            {
                MOG_Prompt.PromptResponse("Classification missing", "Please select a classification for the new package.");
                return(false);
            }

            if (SyncTargetTextBox.Enabled &&
                SyncTargetTextBox.BackColor == Color.Tomato)
            {
                MOG_Prompt.PromptResponse("Sync target missing", "Please select a sync target for the new package.");
                return(false);
            }

            // Check if this package is missing an extension?
            if (Path.GetExtension(PackageName).Length == 0)
            {
                // Check if we are also missing a defined DefaultPackageFileExtension?
                MOG_Properties tempProperties = new MOG_Properties(Classification);
                if (tempProperties.DefaultPackageFileExtension.Length == 0)
                {
                    if (MOG_Prompt.PromptResponse("Warning - Missing extension", "This package does not have an extension.  Most eninges require extensions on packages.\n\nDo you want to continue without and extenstion?", "", MOG.PROMPT.MOGPromptButtons.YesNo, MOG.PROMPT.MOG_ALERT_LEVEL.ALERT) == MOG.PROMPT.MOGPromptResult.No)
                    {
                        return(false);
                    }
                }
            }

            if (this.PlatformCombo.BackColor == Color.Tomato)
            {
                MOG_Prompt.PromptResponse("Invalid Platform", "Please select a valid platform for the new package.");
                return(false);
            }

            return(true);
        }
Example #24
0
        /// <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;
            string lockName;

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

            case MOG_FILENAME_TYPE.MOG_FILENAME_Group:
                classification = "group";
                lockName       = file.GetAssetFullName();
                break;

            default:
                classification = filename;
                lockName       = classification;
                break;
            }

            // Check for locks on this asset
            if (MOG_ControllerProject.IsLocked(lockName))
            {
                // Currently we dont distinguish between read and write locks
                return(GetLockedIcon(lockName, IconType.CLASS, properties));
            }
            else
            {
                return(FindOrAddIcon(ref properties, IconType.CLASS, classification, classification));
            }
        }         // end ()
Example #25
0
        public void CreateAll()
        {
            MOG_Project proj = MOG_ControllerProject.GetProject();

            if (proj != null)
            {
                foreach (classTreeNode tn in BuildAllClassNodesList(this.tvClassifications.Nodes))
                {
                    if (!tn.IsAssetFilenameNode)
                    {
                        proj.ClassificationAdd(tn.FullPath);
                        MOG_Properties props = new MOG_Properties(tn.FullPath);
                        props.SetProperties(tn.props.GetPropertyList());
                    }
                }
            }
        }
Example #26
0
 /// <summary>
 /// Determine and return the full filename for this asset
 /// </summary>
 /// <param name="mogAsset"></param>
 /// <param name="pProperties"></param>
 /// <param name="version"></param>
 /// <returns></returns>
 private MOG_Filename ToString(MOG_Filename mogAsset, MOG_Properties pProperties, string version)
 {
     // Is this asset already in the repository?
     if (mogAsset.IsBlessed())
     {
         return(mogAsset);
     }
     // Create a path to the blessed version of this asset
     else if (pProperties != null && version.Length > 0)
     {
         return(MOG_ControllerRepository.GetAssetBlessedVersionPath(mogAsset, version));
     }
     // OK, just return thr fullFilename of this asset
     else
     {
         return(mogAsset);
     }
 }
Example #27
0
        public override void Initialize(MethodInvoker OnInitializeDone)
        {
            this.OnInitializeDone = OnInitializeDone;

            UseWaitCursor = true;
            Nodes.Clear();

            //Before we do anything here we need to make sure there is going to be a library classification
            string classification = MOG_Filename.GetProjectLibraryClassificationString();

            if (classification.Length > 0)
            {
                //Before we do anything here we need to make sure there is going to be a library classification
                MOG_Project project = MOG_ControllerProject.GetProject();
                if (project != null)
                {
                    if (!project.ClassificationExists(classification))
                    {
                        //Oh no there's not one!  No big deal, just create it.
                        if (project.ClassificationAdd(classification))
                        {
                            MOG_Properties props = MOG_Properties.OpenClassificationProperties(classification);
                            if (props != null)
                            {
                                // This is a library
                                props.IsLibrary = true;

                                props.AssetIcon = "Images\\FileTypes\\MOG Library.bmp";
                                props.ClassIcon = "Images\\FileTypes\\MOG Library Folder.bmp";

                                // And we want to checkout all assets to a dir under the project name
                                props.SyncTargetPath = "{AssetClassificationPath.Full}";
                                props.Close();
                            }
                        }
                    }
                }
            }
            mWorker                     = new BackgroundWorker();
            mWorker.DoWork             += InitializeLibraryClassificationList_Worker;
            mWorker.RunWorkerCompleted += OnWorkerCompleted;

            mWorker.RunWorkerAsync();
        }
Example #28
0
        static public int GetAssetIconIndex(string filename, MOG_Properties properties, bool bCheckLockedIcons)
        {
            // Construct a filename
            MOG_Filename file = null;

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

            string assetName = "default";

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

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

            default:
                assetName = filename;
                break;
            }

            // Check for locks on this asset
            if (bCheckLockedIcons == true &&
                MOG_ControllerProject.IsLocked(file.GetAssetFullName()))
            {
                // Currently we dont distinguish between read and write locks
                return(GetLockedIcon(assetName, IconType.ASSET, properties));
            }
            else
            {
                return(FindOrAddIcon(ref properties, IconType.ASSET, assetName, assetName + "_ASSET"));
            }
        }
Example #29
0
        /// <summary>
        /// Remove packages from Assets currently selected.  Use CheckForBlessedAssetMessage() before calling.
        /// </summary>
        /// <param name="packagesToRemove">ArrayList of MOG_Property objects for packages to be removed</param>
        private void RemovePackageLinkFromAssets(ArrayList packagesToRemove)
        {
            foreach (ListViewItem item in AssetList.Items)
            {
                MOG_Filename assetFilename = item.Tag as MOG_Filename;
                if (assetFilename != null)
                {
                    // If this asset is not a blessed Asset, and it's not a classification...
                    if (!assetFilename.IsBlessed() && assetFilename.GetFilenameType() != MOG_FILENAME_TYPE.MOG_FILENAME_Unknown)
                    {
                        // Open up this asset so we can remove the package relationships
                        MOG_ControllerAsset asset = MOG_ControllerAsset.OpenAsset(assetFilename);
                        if (asset != null)
                        {
                            // Remove the packages
                            asset.GetProperties().RemovePackages(packagesToRemove);
                            // Depending on how the user clicked, it is possible that an inherited package assignment can be left behind as a non-inherited property
                            // The following code ensures all non-inherited package assignments are flushed by restamping any non-inherited assignemnts.
                            asset.GetProperties().SetProperties(asset.GetProperties().GetNonInheritedPackages());

                            // Make sure we keep the group in sync with our new assignment
                            MOG_ControllerAsset.SetDefaultGroup(asset);

                            // Change the state of the asset to indicate it has been modified
                            MOG_ControllerInbox.UpdateInboxView(asset, MOG_AssetStatusType.Modifying);
                            ModifyingAssets = true;

                            asset.Close();
                        }
                    }
                    else
                    {
                        // We should be looking at a classification, so treat it as such...
                        MOG_Properties properties = MOG_Properties.OpenClassificationProperties(assetFilename.GetOriginalFilename());
                        if (properties != null)
                        {
                            properties.RemovePackages(packagesToRemove);
                            properties.Close();
                        }
                    }
                }
            }
        }
Example #30
0
        public void InitializeRipperInfo(MOG_Properties properties, MOG_Filename currentFile)
        {
            mDisableEvents = true;
            // Put in the Multi-asset commands
            SetComboBoxProperty(this.PropertiesRippingRipperComboBox, properties.AssetRipper, false);
            SetComboBoxProperty(this.PropertiesRippingSlaveTaskerComboBox, properties.AssetRipTasker, false);
            SetComboBoxProperty(this.PropertiesRippingValidSlavesComboBox, properties.ValidSlaves, false);

            SetCheckBoxProperty(this.PropertiesRippingDivergentCheckBox, properties.DivergentPlatformDataType_InheritedBoolean);
            SetCheckBoxProperty(this.PropertiesRippingShowWindowCheckBox, properties.ShowRipCommandWindow_InheritedBoolean);
            SetCheckBoxProperty(this.PropertiesRippingAutoDetectCheckBox, properties.AutoDetectRippedFiles_InheritedBoolean);
            SetCheckBoxProperty(this.PropertiesRippingCopyToTempCheckBox, properties.CopyFilesIntoTempRipDir_InheritedBoolean);
            SetCheckBoxProperty(this.PropertiesRippingLocalTempCheckBox, properties.UseLocalTempRipDir_InheritedBoolean);
            SetCheckBoxProperty(this.PropertiesUseTempCheckBox, properties.UseTempRipDir_InheritedBoolean);

            this.mogArgumentsButton1.MOGAssetFilename = currentFile;
            mResetWildcardCheck = false;
            mDisableEvents      = false;
        }