public Dictionary <string, FileInfo> GetSpecificVersionedFilesToExecute(string fromVersion, string toVersion)
        {
            Version fromVersionObject = VersionNumberHelper.RemoveNegativeNumbersFromVersionObject(new Version(fromVersion));
            Version toVersionObject   = VersionNumberHelper.RemoveNegativeNumbersFromVersionObject(new Version(toVersion));

            return(GetSpecificVersionedFilesToExecute(fromVersionObject, toVersionObject));
        }
        public Dictionary <string, FileInfo> GetSpecificVersionedFilesToExecute(Version fromVersionObject, Version toVersionObject)
        {
            Dictionary <string, FileInfo> sqlFilesToExecuteInProperOrder = GetAllFilesToExecute();

            IComparer <string> versionComparer = new VersionComparer();

            IOrderedEnumerable <FileInfo> list = (from item in sqlFilesToExecuteInProperOrder
                                                  let fileVersion = VersionNumberHelper.GetVersionForFilename(item.Key)
                                                                    where
                                                                    ((fromVersionObject == null) || (fileVersion >= fromVersionObject)) &&
                                                                    ((toVersionObject == null) || (fileVersion <= toVersionObject))
                                                                    select item.Value).OrderBy(obj => obj.FullName, versionComparer);

            return(list.ToDictionary(item => item.FullName));
        }
Exemplo n.º 3
0
        public int Compare(string x, string y)
        {
            string leftPath  = Path.GetDirectoryName(x);
            string rightPath = Path.GetDirectoryName(y);

            int pathcompare = string.CompareOrdinal(leftPath, rightPath);

            if (pathcompare == 0)
            {
                Version leftVersion  = VersionNumberHelper.GetVersionForFilename(x);
                Version rightVersion = VersionNumberHelper.GetVersionForFilename(y);

                return(leftVersion.CompareTo(rightVersion));
            }

            return(pathcompare);
        }