private ProcessStartInfo GetStartInfo() { if (_solverSelections == null) { _solverSelections = _backingSolver.Solve(_solverRequirements); } var missing = _selectionsManager.GetUncachedImplementations(_solverSelections); _fetcher.Fetch(missing); var arguments = new[] { "--console", "slave", ApiVersion }; for (int i = 0; i < (int)_handler.Verbosity; i++) { arguments = arguments.Append("--verbose"); } var startInfo = _executor.GetStartInfo(_solverSelections, arguments); startInfo.CreateNoWindow = true; startInfo.RedirectStandardInput = true; startInfo.RedirectStandardOutput = true; startInfo.RedirectStandardError = true; if (Locations.IsPortable) { startInfo.EnvironmentVariables["ZEROINSTALL_PORTABLE_BASE"] = Locations.PortableBase; } return(startInfo); }
private ProcessStartInfo GetStartInfo() { _solverSelections ??= _backingSolver.Solve(_solverRequirements); foreach (var implementation in _selectionsManager.GetUncachedImplementations(_solverSelections)) { _fetcher.Fetch(implementation); } var builder = _executor.Inject(_solverSelections) .AddArguments("--console", "slave", ExternalSolverSession.ApiVersion); for (int i = 0; i < (int)_handler.Verbosity; i++) { builder.AddArguments("--verbose"); } var startInfo = builder.ToStartInfo(); startInfo.CreateNoWindow = true; startInfo.RedirectStandardInput = true; startInfo.RedirectStandardOutput = true; startInfo.RedirectStandardError = true; startInfo.EnvironmentVariables["GNUPGHOME"] = OpenPgp.VerifyingHomeDir; if (Locations.IsPortable) { startInfo.EnvironmentVariables["ZEROINSTALL_PORTABLE_BASE"] = Locations.PortableBase; } return(startInfo); }
public async static Task <FetchResponse> Request(IFetcher fetch, string url, string method = "GET", object body = null, Dictionary <string, string> headerOverrides = null) { var headers = GetHeaders(headerOverrides); return(await fetch.Fetch(url, new FetchConfig { Method = MethodMode.Parse(method), Body = body, Mode = CorsMode.Cors, Headers = headers, Credentials = CredentialsMode.Include, ReferrerPolicy = ReferrerPolicyMode.NoReferrerWhenDowngrade })); }
/// <summary> /// Creates a wearables JSON patch using the configured fetcher. /// </summary> /// <param name="fetcher">Item fetcher.</param> /// <param name="path">Path to file or directory to fetch from.</param> /// <returns>Wearables JSON patch.</returns> public static JArray CreatePatch(IFetcher fetcher, string path, bool namesOnly = false, string[] parameters = null) { var wearables = CreateWearableList(); if (namesOnly) { fetcher.OnItemFound += (assetPath, assetData) => HandleItemName(assetPath, assetData, wearables); } else { fetcher.OnItemFound += (assetPath, assetData) => HandleItem(assetPath, assetData, wearables, parameters); } fetcher.Fetch(path); return(CreatePatchFromWearables(wearables)); }
public async Task <byte[]> GetPdf(Guid hash, long docId) { var headers = GetHeaders(new Dictionary <string, string> { { "accept", "application/pdf,*/*" }, { "accept-encoding", "gzip, deflate, br" }, { "cache-control", "no-cache" } }); var config = new FetchConfig { Method = MethodMode.Get, Mode = CorsMode.Cors, Headers = headers, Credentials = CredentialsMode.Include, ReferrerPolicy = ReferrerPolicyMode.NoReferrerWhenDowngrade }; var response = await fetcher.Fetch( baseAddress + $"Rest/MediaService/image/{hash}/pdf?docId={docId}&docType=Medius.ExpenseInvoice.Entities.ExpenseInvoice&tag=DocumentImage&download=application/pdf;base64", config); return((byte[])response.Body); }
/// <summary> /// Inject dependencies into the given fetcher, invoke it, and return the result /// </summary> protected T Get <T>(IFetcher <T> fetcher) { InjectDependencies(fetcher); return(fetcher.Fetch()); }