Esempio n. 1
0
        public static int Compare(string first, string second, CultureInfo cultureInfo)
        {
            AlphabeticThenNumericComparer.SeparatedString separatedString  = AlphabeticThenNumericComparer.TrimDigits(first, cultureInfo);
            AlphabeticThenNumericComparer.SeparatedString separatedString1 = AlphabeticThenNumericComparer.TrimDigits(second, cultureInfo);
            int num = ProjectPathHelper.CompareForDisplay(separatedString.BaseString, separatedString1.BaseString, cultureInfo);

            if (num == 0)
            {
                num = (separatedString.BaseString == first || separatedString1.BaseString == second ? first.CompareTo(second) : separatedString.Number - separatedString1.Number);
            }
            return(num);
        }
Esempio n. 2
0
        public override int CompareTo(HierarchicalNode treeItem)
        {
            ProjectItemNode projectItemNode = treeItem as ProjectItemNode;

            if (projectItemNode == null)
            {
                return(-1);
            }
            if (this.ProjectItem is FolderStandIn)
            {
                return(-1);
            }
            if (projectItemNode.ProjectItem is FolderStandIn)
            {
                return(1);
            }
            IDocumentType item = base.Services.DocumentTypeManager().DocumentTypes[DocumentTypeNamesHelper.Folder];

            if (this.ProjectItem.DocumentType == item)
            {
                if (projectItemNode.ProjectItem.DocumentType != item)
                {
                    return(-1);
                }
                return(AlphabeticThenNumericComparer.Compare(this.DisplayName, projectItemNode.DisplayName, CultureInfo.CurrentCulture));
            }
            if (projectItemNode.ProjectItem.DocumentType == item)
            {
                return(1);
            }
            try
            {
                if (Microsoft.Expression.Framework.Documents.PathHelper.GetSafeExtension(this.FullPath) == Microsoft.Expression.Framework.Documents.PathHelper.GetSafeExtension(projectItemNode.FullPath))
                {
                    int num = AlphabeticThenNumericComparer.Compare(Path.GetFileNameWithoutExtension(this.FullPath), Path.GetFileNameWithoutExtension(projectItemNode.FullPath), CultureInfo.CurrentCulture);
                    return(num);
                }
            }
            catch (ArgumentException argumentException)
            {
            }
            return(ProjectPathHelper.CompareForDisplay(this.DisplayName, projectItemNode.DisplayName, CultureInfo.CurrentCulture));
        }