예제 #1
0
        /// <summary>
        /// Scans the local branches data to locate all binaries that do not have a counterpart in the project database
        /// </summary>
        private bool LocateNonMogAssetsScanFiles(BackgroundWorker worker, string path, ArrayList rogueFiles, HybridDictionary MergeableAssets, string targetProjectPath, MOG_Properties classificationProperties)
        {
            // Check if this is a library path?
            if (MOG_ControllerLibrary.GetWorkingDirectory().Length > 0 &&
                path.StartsWith(MOG_ControllerLibrary.GetWorkingDirectory(), StringComparison.CurrentCultureIgnoreCase))
            {
                // Build us our library classification for this library path
                string classification = MOG_ControllerLibrary.ConstructLibraryClassificationFromPath(path);
                // Check if this library classification exists?
                if (MOG_ControllerProject.IsValidClassification(classification))
                {
                    // Obtain the properties for this library classification
                    classificationProperties = new MOG_Properties(classification);
                }
            }

            // Get all the files withing this directory
            FileInfo [] files = DosUtils.FileGetList(path, "*.*");
            if (files != null)
            {
                // For each file, check to see if we have a DB link for that filename
                foreach (FileInfo file in files)
                {
                    if (worker.CancellationPending)
                    {
                        return(false);
                    }

                    try
                    {
                        // Check to see if we have a DB link for that filename
                        if (MergeableAssets.Contains(file.FullName) == false)
                        {
                            // Check if we have a classificationProperties?
                            if (classificationProperties != null)
                            {
                                // Make sure this does not violate the classification filters
                                // Check the classification's inclusion filter.
                                if (classificationProperties.FilterInclusions.Length > 0)
                                {
                                    FilePattern inclusions = new FilePattern(classificationProperties.FilterInclusions);
                                    if (inclusions.IsFilePatternMatch(file.FullName) == false)
                                    {
                                        // Skip this file as it is not included
                                        continue;
                                    }
                                }
                                // Check the classification's exclusion filter.
                                if (classificationProperties.FilterExclusions.Length > 0)
                                {
                                    FilePattern exclusions = new FilePattern(classificationProperties.FilterExclusions);
                                    if (exclusions.IsFilePatternMatch(file.FullName) == true)
                                    {
                                        // Skip this file as it is excluded
                                        continue;
                                    }
                                }
                            }

                            // Make sure it is not hidden
                            if (Convert.ToBoolean(file.Attributes & FileAttributes.Hidden) == false)
                            {
                                // If no match was found, add to our list of rogue assets
                                rogueFiles.Add(file.FullName);
                            }
                        }
                    }
                    catch
                    {
                        // Needed just in case we have some files larger than 260 in length
                    }
                }
            }

            // Now check all these subDirs
            DirectoryInfo [] dirs = DosUtils.DirectoryGetList(path, "*.*");
            if (dirs != null)
            {
                foreach (DirectoryInfo dir in dirs)
                {
                    // Make sure it is not hidden
                    if (Convert.ToBoolean(dir.Attributes & FileAttributes.Hidden) == false)
                    {
                        // Scan their respective files
                        if (!LocateNonMogAssetsScanFiles(worker, dir.FullName, rogueFiles, MergeableAssets, targetProjectPath, classificationProperties))
                        {
                            return(false);
                        }
                    }
                }
            }

            return(true);
        }
예제 #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);

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