Пример #1
0
        private string CreatePackage(PackageType packageType, Archive archive, ArchiveMetadata metadata, string outputDirectory)
        {
            string packageDirectory = CreatePackageDirectory(archive, outputDirectory);

            string packageFilePath = Path.Combine(packageDirectory, archive.GetInformationPackageFileName());

            Stream     outStream  = File.Create(packageFilePath);
            TarArchive tarArchive = TarArchive.CreateOutputTarArchive(new TarOutputStream(outStream));

            string packageRootDirectory = archive.Uuid.GetValue() + Path.DirectorySeparatorChar;

            CreateEntry(packageRootDirectory, false, new DirectoryInfo("none"), tarArchive, string.Empty, string.Empty);

            AddFilesInDirectory(
                archive, archive.WorkingDirectory.Root().DirectoryInfo(), packageType, tarArchive, packageRootDirectory
                );

            if (archive.WorkingDirectory.HasExternalContentDirectory())
            {
                Log.Debug($"Archive has external content directory, including files from {archive.WorkingDirectory.Content()}");

                string contentDirectory = packageRootDirectory +
                                          ArkadeConstants.DirectoryNameContent +
                                          Path.DirectorySeparatorChar;

                AddFilesInDirectory(
                    archive, archive.WorkingDirectory.Content().DirectoryInfo(), null, tarArchive, contentDirectory
                    );
            }

            tarArchive.Close();

            new InfoXmlCreator().CreateAndSaveFile(metadata, packageFilePath);

            HasRun = true;

            return(packageFilePath);
        }
Пример #2
0
        /// <summary>
        /// Create AIP (Archival Information Package)
        /// Package- and metafile are written to the given output directory
        /// The full path of the created package is returned
        /// </summary>
        public string CreateAip(Archive archive, ArchiveMetadata metadata, string outputDirectory)
        {
            string packageFilePath = CreatePackage(PackageType.ArchivalInformationPackage, archive, metadata, outputDirectory);

            return(packageFilePath);
        }