Exemplo n.º 1
0
        public static SortedList <string, string> ResolveScriptsFromPathAndVersion(string path, string pattern, bool recurse, string workingDirectory, Versioning.Version source, Versioning.Version destination, Versioning.IParseVersions versionParser = null)
        {
            SortedList <string, string> files = new SortedList <string, string>();

            if (versionParser == null)
            {
                versionParser = new Versioning.VersionDateParser();
            }
            string usedPath = path;

            if (!System.IO.Directory.Exists(usedPath))
            {
                usedPath = System.IO.Path.Combine(workingDirectory, path);
            }
            if (!System.IO.Directory.Exists(usedPath))
            {
                throw new ArgumentOutOfRangeException("path");
            }
            foreach (var d in System.IO.Directory.GetDirectories(usedPath))
            {
                System.IO.DirectoryInfo dir        = new DirectoryInfo(d);
                Versioning.Version      dirVersion = versionParser.Parse(dir.Name);
                if (dirVersion >= source && dirVersion <= destination)
                {
                    var scripts = ResolveScriptsFromPath(dir.FullName, pattern, recurse, workingDirectory);
                    foreach (string key in scripts.Keys)
                    {
                        files.Add(key, scripts[key]);
                    }
                }
            }

            return(files);
        }
Exemplo n.º 2
0
        public static SortedList<string, string> ResolveScriptsFromPathAndVersion(string path, string pattern, bool recurse, string workingDirectory, Versioning.Version source, Versioning.Version destination, Versioning.IParseVersions versionParser = null)
        {
            SortedList<string, string> files = new SortedList<string, string>();
            if (versionParser == null) versionParser = new Versioning.VersionDateParser();
            string usedPath = path;
            if (!System.IO.Directory.Exists(usedPath)) usedPath = System.IO.Path.Combine(workingDirectory, path);
            if (!System.IO.Directory.Exists(usedPath)) throw new ArgumentOutOfRangeException("path");
            foreach (var d in System.IO.Directory.GetDirectories(usedPath))
            {
                System.IO.DirectoryInfo dir = new DirectoryInfo(d);
                Versioning.Version dirVersion = versionParser.Parse(dir.Name);
                if (dirVersion >= source && dirVersion <= destination)
                {
                    var scripts = ResolveScriptsFromPath(dir.FullName, pattern, recurse, workingDirectory);
                    foreach (string key in scripts.Keys)
                    {
                        files.Add(key, scripts[key]);
                    }

                }
            }

            return files;
        }