Ejemplo n.º 1
0
 protected void InitializeLibraryClassificationsList()
 {
     lock (mRequiredClassifications)
     {
         // Create a new list of required classifications and make sure the project's library is listed
         mRequiredClassifications = new SortedList();
         string libraryClassification = MOG_Filename.GetProjectLibraryClassificationString();
         if (libraryClassification.Length > 0)
         {
             mRequiredClassifications.Add(libraryClassification, new List <string>());
         }
     }
 }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
0
        private void InitializeClassificationList_Worker(object sender, DoWorkEventArgs e)
        {
            lock (mRequiredClassifications)
            {
                ArrayList classifications;

                ExclusionList   = MOG_Filename.GetProjectLibraryClassificationString();
                classifications = MOG_DBReports.ClassificationForProperty("", MOG_PropertyFactory.MOG_Sync_OptionsProperties.New_SyncFiles(true), false);

                mRequiredClassifications.Clear();

                if (classifications != null && classifications.Count > 0)
                {
                    foreach (string classificationName in classifications)
                    {
                        // Do we already have this class?
                        if (!mRequiredClassifications.Contains(classificationName))
                        {
                            bool excluded = false;
                            if (ExclusionList.Length > 0)
                            {
                                excluded = StringUtils.IsFiltered(classificationName, ExclusionList);
                            }

                            // Is it excluded?
                            if (excluded == false)
                            {
                                //we don't have this classification yet, so add it and give it a container for assets
                                List <string> assetList = new List <string>();
                                mRequiredClassifications.Add(classificationName, assetList);
                            }
                        }
                    }
                }

                if (ShowAssets)
                {
                    // Enable this if we wnat to show assets in this tree
                    ArrayList assets = MOG_DBAssetAPI.GetAllAssets(true, MOG_ControllerProject.GetBranchName());

                    // Enable this if we wnat to show assets in this tree
                    if (assets != null && assets.Count > 0)
                    {
                        foreach (MOG_Filename asset in assets)
                        {
                            int index = mRequiredClassifications.IndexOfKey(asset.GetAssetClassification());
                            if (index >= 0)
                            {
                                List <string> assetList = mRequiredClassifications.GetByIndex(index) as List <string>;
                                if (assetList != null)
                                {
                                    bool excluded = false;
                                    if (ExclusionList.Length > 0)
                                    {
                                        excluded = StringUtils.IsFiltered(asset.GetAssetFullName(), ExclusionList);
                                    }

                                    // Is it excluded?
                                    if (excluded == false)
                                    {
                                        assetList.Add(asset.GetAssetFullName());
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Shows Assets based on MOG_Property(s) assigned to PropertyList
        /// </summary>
        private void ExpandPropertyTreeDown(TreeNode node)
        {
            BeginUpdate();

            List <string> classificationsToAdd = GetSubClassifications(node);

            string thisClassification     = node.FullPath;
            string thisClassificationPath = MOG_ControllerLibrary.ConstructPathFromLibraryClassification(thisClassification);

            // Check for any local directories
            if (thisClassificationPath.Length > 0)
            {
                DirectoryInfo[] directories = DosUtils.DirectoryGetList(thisClassificationPath, "*.*");
                if (directories != null && directories.Length > 0)
                {
                    foreach (DirectoryInfo directory in directories)
                    {
                        // If we don't already have this classification, add it.
                        if (!classificationsToAdd.Contains(directory.Name))
                        {
                            classificationsToAdd.Add(directory.Name);
                        }
                    }
                }
            }

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

            // Foreach classification, add it
            foreach (string classification in classificationsToAdd)
            {
                string fullClassification = MOG_Filename.JoinClassificationString(node.FullPath, classification);

                // Only add library classifications
                if (MOG_Filename.IsParentClassificationString(fullClassification, MOG_Filename.GetProjectLibraryClassificationString()))
                {
                    TreeNode classificationNode = new TreeNode(classification);

                    // Is this a non-MOG folder?
                    if (!MOG_ControllerProject.IsValidClassification(fullClassification))
                    {
                        classificationNode.ForeColor = Color.LightGray;
                    }

                    // 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));
                }
            }

            EndUpdate();
        }