예제 #1
0
        protected override void DoExecute()
        {
            // artifacts downloaded by previous executed html api (not REST!) are packed one more time in zip archive :/ move to separate step?
            if (!_fileAdapter.Exists(_artifactsFilePath))
            {
                throw new InvalidOperationException(string.Format("Couldn't extract ZIP archive because it doesn't exist: '{0}'.", _artifactsFilePath));
            }

            _zipFileAdapter.ExtractAll(_artifactsFilePath, _targetArtifactsDirPath, true);

            string projectArchiveFileName =
                string.Format(
                    @"{0}_{1}.zip",
                    _projectInfo.ArtifactsRepositoryName,
                    _deploymentInfo.ProjectConfigurationName);

            string archivePath = Path.Combine(_targetArtifactsDirPath, projectArchiveFileName);

            // unpacking internal zip package, true is that inside are packed artifacts with name like [Project_BuildConfigName.zip]
            if (!_fileAdapter.Exists(archivePath))
            {
                throw new InvalidOperationException(string.Format("Couldn't extract internal ZIP archive because it doesn't exist: '{0}'.", archivePath));
            }

            _zipFileAdapter.ExtractAll(archivePath, _targetArtifactsDirPath, true);
        }
예제 #2
0
        //public string Read(string filePath, string key)
        //{
        //    if (!File.Exists(filePath))
        //        throw new Exception("File does not exist");

        //    string[] lines = File.ReadAllLines(filePath);
        //    return lines[0];
        //}

        public string Read(string filePath, string key)
        {
            if (_fileAdapter.Exists(filePath))
            {
                throw new FileNotFoundException("File does not exist");
            }

            string[] lines = _fileAdapter.ReadAllLines(filePath);
            return(lines[0]);
        }