예제 #1
0
        /// <summary>
        /// Unpacks the zip-file and constructs a new FileArtifactSource on the unzipped directory
        /// </summary>
        /// <remarks>This is an expensive operations and should be run once. As well, it unpacks files on the
        /// file system and is not thread-safe.</remarks>
        private DirectorySource createSource()
        {
            if (!File.Exists(ZipPath))
            {
                throw new FileNotFoundException($"Cannot prepare {nameof(ZipSource)}: file '{ZipPath}' was not found");
            }

            var zc     = new ZipCacher(ZipPath, GetCacheKey());
            var source = new DirectorySource(zc.GetContentDirectory(), _settings);

            var mask = Mask;

            if (!string.IsNullOrEmpty(mask))
            {
                source.Mask = mask;
            }
            return(source);
        }
예제 #2
0
        /// <summary>
        /// Unpacks the zip-file and constructs a new FileArtifactSource on the unzipped directory
        /// </summary>
        /// <remarks>This is an expensive operations and should be run once. As well, it unpacks files on the
        /// file system and is not thread-safe.</remarks>
        private void prepare()
        {
            if (_prepared)
            {
                return;
            }

            if (!File.Exists(_zipPath))
            {
                throw new FileNotFoundException(String.Format("Cannot prepare ZipArtifactSource: file '{0}' was not found", _zipPath));
            }

            var zc = new ZipCacher(_zipPath, CACHE_KEY);

            _filesSource = new FileDirectoryArtifactSource(zc.GetContentDirectory(), includeSubdirectories: false);

            _prepared = true;
        }