Example #1
0
        public static TeamCityRevisionDto GetByDirectory(string directory)
        {
            if (Directory.Exists(directory))
            {
                var file = GetRevisionFile(Directory.GetFiles(directory, "*.*"));
                if (file != null)
                {
                    return(GetDto(file, File.ReadAllText(file)));
                }
            }

            return(TeamCityRevisionDto.Create());
        }
Example #2
0
        public static TeamCityRevisionDto GetByZipFile(string zipFileName)
        {
            if (File.Exists(zipFileName))
            {
                using (var archive = ZipFile.OpenRead(zipFileName))
                {
                    var file = GetRevisionFile(archive.Entries.Select(e => e.FullName));
                    if (file != null)
                    {
                        var entry = archive.Entries.First(e => e.FullName == file);
                        using var entryStream = entry.Open();
                        using (TextReader reader = new StreamReader(entryStream))
                        {
                            return(GetDto(file, reader.ReadToEnd()));
                        }
                    }
                }
            }

            return(TeamCityRevisionDto.Create());
        }