Beispiel #1
0
        private static Manifest GenerateManifest(string path, ManifestFormat format, ITaskHandler handler)
        {
            var generator = new ManifestGenerator(path, format);

            handler.RunTask(generator);
            return(generator.Manifest);
        }
Beispiel #2
0
        private static void Test(TestRoot root, params ManifestNode[] expected)
        {
            using var sourceDirectory = new TemporaryDirectory("0install-unit-tests");
            root.Build(sourceDirectory);
            var generator = new ManifestGenerator(sourceDirectory, ManifestFormat.Sha1New);

            generator.Run();
            generator.Manifest.Should().Equal(expected);
        }
Beispiel #3
0
        /// <summary>
        /// Generates a manifest for a directory in the filesystem and writes the manifest to a file named <see cref="Manifest.ManifestFile"/> in that directory.
        /// </summary>
        /// <param name="path">The path of the directory to analyze.</param>
        /// <param name="format">The format of the manifest (which file details are listed, which digest method is used, etc.).</param>
        /// <param name="handler">A callback object used when the the user is to be informed about progress.</param>
        /// <returns>The manifest digest.</returns>
        /// <exception cref="IOException">A problem occurred while writing the file.</exception>
        /// <remarks>
        /// The exact format is specified here: https://docs.0install.net/specifications/manifest/
        /// </remarks>
        public static string CreateDotFile(string path, ManifestFormat format, ITaskHandler handler)
        {
            #region Sanity checks
            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentNullException(nameof(path));
            }
            if (format == null)
            {
                throw new ArgumentNullException(nameof(format));
            }
            if (handler == null)
            {
                throw new ArgumentNullException(nameof(handler));
            }
            #endregion

            var generator = new ManifestGenerator(path, format);
            handler.RunTask(generator);
            return(generator.Manifest.Save(Path.Combine(path, Manifest.ManifestFile)));
        }