コード例 #1
0
        public async Task SetExecutionPolicyAsync()
        {
            var executionPolicy = "RemoteSigned";
            var script          = @$ "Set-ExecutionPolicy {executionPolicy} -Force
Get-ExecutionPolicy";

            var powerShellResult = await powerShell.ExecuteAsync(script);

            consoleLogger.Result($"PowerShell - Execution Policy: {powerShellResult.AsString}");

            windowsPowerShell.Execute(script);
            consoleLogger.Result($"Windows PowerShell - Execution Policy: {executionPolicy}");
        }
コード例 #2
0
        public async Task InstallOrUpgradeAsync(IApp app)
        {
            consoleLogger.Info($"Installing '{app.AppId}'");
            var preInstallDesktopSystemEntries = desktopRepository.LoadSystemEntries();

            var preInstallVerificationResult = await VerifyAppAsync(app);

            var actionScript = GetActionScript(app, preInstallVerificationResult);

            if (!string.IsNullOrWhiteSpace(actionScript))
            {
                await powerShell.ExecuteAsync(actionScript);
                await VerifyAppAsync(app);
            }

            var postInstallDesktopSystemEntries = desktopRepository.LoadSystemEntries();
            var desktopSystemEntriesToDelete    = postInstallDesktopSystemEntries.Except(preInstallDesktopSystemEntries).ToList();

            if (desktopSystemEntriesToDelete.Any())
            {
                desktopRepository.DeletePaths(desktopSystemEntriesToDelete);
            }

            consoleLogger.Result($"Installed '{app.AppId}'");
        }
コード例 #3
0
        public async Task InstallAsync(IDownloadApp app)
        {
            consoleLogger.Info($"Installing '{app.AppId}'");

            IDownloader downloader = downloaderFactory.GetDownloader(app.Downloader);

            var downloadedFilePath = await downloader.DownloadAsync(app.DownloaderArgs.ToString() !);

            var installScript = $"{app.InstallScript} {downloadedFilePath}";

            if (app.VerificationScript == null)
            {
                await powerShell.ExecuteAsync(installScript);
            }
            else
            {
                await powerShell.ExecuteAsync(installScript, app.VerificationScript);
            }

            consoleLogger.Result($"Installed '{app.AppId}'");
        }