public static bool TryCreateUpgrader( ITracer tracer, PhysicalFileSystem fileSystem, bool dryRun, bool noVerify, out ProductUpgrader newUpgrader, out string error) { // Prefer to use the NuGet upgrader if it is configured. If the NuGet upgrader is not configured, // then try to use the GitHubUpgrader. if (NuGetUpgrader.TryCreate(tracer, fileSystem, dryRun, noVerify, out NuGetUpgrader nuGetUpgrader, out bool isConfigured, out error)) { // We were successfully able to load a NuGetUpgrader - use that. newUpgrader = nuGetUpgrader; return(true); }
public static bool TryCreateUpgrader( ITracer tracer, PhysicalFileSystem fileSystem, LocalGSDConfig gvfsConfig, ICredentialStore credentialStore, bool dryRun, bool noVerify, out ProductUpgrader newUpgrader, out string error) { Dictionary <string, string> entries; if (!gvfsConfig.TryGetAllConfig(out entries, out error)) { newUpgrader = null; return(false); } bool containsUpgradeFeedUrl = entries.ContainsKey(GSDConstants.LocalGSDConfig.UpgradeFeedUrl); bool containsUpgradePackageName = entries.ContainsKey(GSDConstants.LocalGSDConfig.UpgradeFeedPackageName); bool containsOrgInfoServerUrl = entries.ContainsKey(GSDConstants.LocalGSDConfig.OrgInfoServerUrl); if (containsUpgradeFeedUrl || containsUpgradePackageName) { // We are configured for NuGet - determine if we are using OrgNuGetUpgrader or not if (containsOrgInfoServerUrl) { if (OrgNuGetUpgrader.TryCreate( tracer, fileSystem, gvfsConfig, new HttpClient(), credentialStore, dryRun, noVerify, out OrgNuGetUpgrader orgNuGetUpgrader, out error)) { // We were successfully able to load a NuGetUpgrader - use that. newUpgrader = orgNuGetUpgrader; return(true); } else { tracer.RelatedError($"{nameof(TryCreateUpgrader)}: Could not create organization based upgrader. {error}"); newUpgrader = null; return(false); } } else { if (NuGetUpgrader.TryCreate( tracer, fileSystem, gvfsConfig, credentialStore, dryRun, noVerify, out NuGetUpgrader nuGetUpgrader, out bool isConfigured, out error)) { // We were successfully able to load a NuGetUpgrader - use that. newUpgrader = nuGetUpgrader; return(true); }