Ejemplo n.º 1
0
        public static async Task DoWork(string[] args)
        {
            var config = new ConfigurationBuilder()
                         .AddCommandLine(args)
                         .Build();

            var configuration = new NotarizerConfiguration();

            config.Bind(configuration);

            var provider = new ServiceCollection()
                           .AddLogging()
                           .AddSingleton <ExecutableFinder>()
                           .AddSingleton <ExecutableSigner>()
                           .AddSingleton <ExecutableZipBuilder>()
                           .AddSingleton <ExecutableNotarizer>()
                           .AddSingleton <ProcessRunner>()
                           .AddSingleton <Workflow>()
                           .BuildServiceProvider();

            provider.GetRequiredService <ILoggerFactory>()
            .AddConsole();

            await provider.GetRequiredService <Workflow>().Run(configuration);
        }
Ejemplo n.º 2
0
        public async Task Run(NotarizerConfiguration configuration)
        {
            var executables = executableFinder.FindExecutables(configuration.AppDirectory).ToArray();

            foreach (var executable in executables)
            {
                executableSigner.SignExecutable(configuration.CertificateId, executable, configuration.EntitlementsMap);
            }

            executableSigner.SignExecutable(configuration.CertificateId, configuration.AppDirectory, configuration.EntitlementsMap);

            var zipFile = executableZipBuilder.BuildZipFile(configuration.AppDirectory, executables);

            await executableNotarizer.NotarizeExecutables(zipFile, configuration.AppDirectory, configuration.DeveloperUsername, configuration.DeveloperPassword);

            zipFile.Delete();
        }