Example #1
0
        public Manifest Build(string path, IPackageMetaData packageMetaData)
        {
            var files = this.artefactProcessor.RetrieveFiles(path);

            var manifest = new Manifest
                {
                    Author = packageMetaData.Author,
                    Id = Guid.NewGuid(),
                    Name = packageMetaData.Name,
                    Path = path,
                    Tokens = packageMetaData.Tokens,
                    Version = packageMetaData.Version,
                };

            int progress = 0;

            var fileCount = files.Count();
            var manifestFiles = new BlockingCollection<ManifestFile>();

            Parallel.ForEach(
                files,
                file =>
                    {
                        manifestFiles.Add(new ManifestFile { File = StripParentPath(path, file) });
                        this.progressNotifier.UpdateProgress(ProgressStage.BuildManifest, fileCount, progress);
                        progress++;
                    });

            manifest.Files.AddRange(manifestFiles);

            return manifest;
        }
        public void Execute(Package package)
        {
            this.manifest = package.Manifest;
            int progress = 0;

            Parallel.ForEach(
                package.Manifest.Files,
                manifestFile =>
                    {
                        progress++;

                        // Set destination to the Package default, unless the file has an override defined
                        string destFilePath = this.GetDestFilePath(manifestFile);

                        if (!Directory.Exists(Path.GetDirectoryName(destFilePath)))
                        {
                            Directory.CreateDirectory(Path.GetDirectoryName(destFilePath));
                        }

                        this.archiveProcessor.Extract(this.manifest.Path, manifestFile.File, destFilePath);

                        this.progressNotifier.UpdateProgress(
                            ProgressStage.ExtractFilesFromPackage, this.manifest.Files.Count, progress);
                    });
        }
        public void Execute(Package package)
        {
            this.manifest = package.Manifest;

            foreach (var file in this.manifest.Files)
            {
                file.InstallPath = this.GetDestFilePath(file);
            }

            this.archiveProcessor.Extract(this.manifest.Path, package.Manifest.Files);
        }
Example #4
0
 public static void Save(string path, Manifest manifest)
 {
     Serializer.SaveInstance(manifest, path);
 }