Exemple #1
0
        private static int RunPackage(PackageOptions options)
        {
            var arguments = $"cvf package.tar {options.SourceDirectory}";

            if (options.SourceDirectory == ".")
            {
                arguments += " --exclude=package.tar";
            }

            if (!File.Exists(Path.Combine(options.SourceDirectory, "package.manifest")))
            {
                console.WriteLine("File: package.manifest was not found.");
                return(2);
            }

            try
            {
                var manifest = PackageManifest.Load(Path.Combine(options.SourceDirectory, "package.manifest"), "test");
            }
            catch (Exception)
            {
                console.WriteLine("Manifest was not valid.");
                return(2);
            }

            var process = Process.Start("tar", arguments);

            process.WaitForExit();

            process = Process.Start("7z", "a package.7z -mx9 -mmt -md29 -ms=on -myx=9 -mfb=273 package.tar");

            process.WaitForExit();

            File.Delete(Path.Combine(options.SourceDirectory, "package.tar"));

            File.Move(Path.Combine(options.SourceDirectory, "package.7z"), Path.Combine(options.SourceDirectory, "package.avpkg"));

            return(1);
        }