Beispiel #1
0
        /// <summary>
        /// Parses a directory name into it's constituent parts.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        private DirectoryNameInfo ParseDirectoryName(string name)
        {
            var dirNameInfo = new DirectoryNameInfo
            {
                FullName  = name,
                Name      = name,
                SortOrder = -1
            };

            if (name.IndexOf('-') > 0)
            {
                var hyphenIndex       = name.IndexOf('-');
                var possibleSortOrder = name.Substring(0, hyphenIndex);

                int parsedSortOrder;
                if (int.TryParse(possibleSortOrder, out parsedSortOrder))
                {
                    dirNameInfo.Name      = name.Substring(hyphenIndex + 1);
                    dirNameInfo.SortOrder = parsedSortOrder;
                    return(dirNameInfo);
                }
            }

            return(dirNameInfo);
        }
Beispiel #2
0
        /// <summary>
        /// Parses a directory name into it's constituent parts.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        private DirectoryNameInfo ParseDirectoryName(string name)
        {
            var dirNameInfo = new DirectoryNameInfo
            {
                FullName = name,
                Name = name,
                SortOrder = -1
            };

            if (name.IndexOf('-') > 0)
            {
                var hyphenIndex = name.IndexOf('-');
                var possibleSortOrder = name.Substring(0, hyphenIndex);

                int parsedSortOrder;
                if(int.TryParse(possibleSortOrder, out parsedSortOrder))
                {
                    dirNameInfo.Name = name.Substring(hyphenIndex + 1);
                    dirNameInfo.SortOrder = parsedSortOrder;
                    return dirNameInfo;
                }
            }

            return dirNameInfo;
        }