Ejemplo n.º 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(String.Format("Cannot prepare ZipArtifactSource: file '{0}' was not found", ZipPath));
            }

            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);
        }
Ejemplo n.º 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 DirectorySource(zc.GetContentDirectory(), includeSubdirectories: false);
            if (!string.IsNullOrEmpty(Mask))
            {
                _filesSource.Mask = Mask;
            }
            _prepared = true;
        }