public static GitHubUpgrader Create( ITracer tracer, PhysicalFileSystem fileSystem, bool dryRun, bool noVerify, LocalGVFSConfig localConfig, out string error) { GitHubUpgrader upgrader = null; GitHubUpgraderConfig gitHubUpgraderConfig = new GitHubUpgraderConfig(tracer, localConfig); if (!gitHubUpgraderConfig.TryLoad(out error)) { return(null); } if (gitHubUpgraderConfig.ConfigError()) { gitHubUpgraderConfig.ConfigAlertMessage(out error); return(null); } upgrader = new GitHubUpgrader( ProcessHelper.GetCurrentProcessVersion(), tracer, fileSystem, gitHubUpgraderConfig, dryRun, noVerify); return(upgrader); }
public virtual bool TryLoadRingConfig(out string error) { string gitPath = GVFSPlatform.Instance.GitInstallation.GetInstalledGitBinPath(); LocalGVFSConfig localConfig = new LocalGVFSConfig(); string ringConfig = null; if (localConfig.TryGetConfig(GVFSConstants.LocalGVFSConfig.UpgradeRing, out ringConfig, out error, this.tracer)) { RingType ringType; if (Enum.TryParse(ringConfig, ignoreCase: true, result: out ringType) && Enum.IsDefined(typeof(RingType), ringType) && ringType != RingType.Invalid) { this.Ring = ringType; error = null; return(true); } if (string.IsNullOrEmpty(ringConfig)) { this.Ring = RingType.NoConfig; error = null; return(true); } error = "Invalid upgrade ring `" + ringConfig + "` specified in gvfs config." + Environment.NewLine; } error += GVFSConstants.UpgradeVerbMessages.SetUpgradeRingCommand; this.Ring = RingType.Invalid; return(false); }
public static GitHubUpgrader Create( ITracer tracer, PhysicalFileSystem fileSystem, LocalGVFSConfig gvfsConfig, bool dryRun, bool noVerify, out string error) { return(Create(tracer, fileSystem, dryRun, noVerify, gvfsConfig, out error)); }
public static GitHubUpgrader Create(LocalGVFSConfig localConfig, ITracer tracer, out string error) { GitHubUpgrader upgrader = null; GitHubUpgraderConfig gitHubUpgraderConfig = new GitHubUpgraderConfig(tracer, localConfig); if (!gitHubUpgraderConfig.TryLoad(out error)) { return(null); } if (gitHubUpgraderConfig.ConfigError()) { gitHubUpgraderConfig.ConfigAlertMessage(out error); return(null); } upgrader = new GitHubUpgrader( ProcessHelper.GetCurrentProcessVersion(), tracer, gitHubUpgraderConfig); return(upgrader); }
public static bool TryCreateUpgrader( ITracer tracer, PhysicalFileSystem fileSystem, LocalGVFSConfig 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(GVFSConstants.LocalGVFSConfig.UpgradeFeedUrl); bool containsUpgradePackageName = entries.ContainsKey(GVFSConstants.LocalGVFSConfig.UpgradeFeedPackageName); bool containsOrgInfoServerUrl = entries.ContainsKey(GVFSConstants.LocalGVFSConfig.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); }
public GitHubUpgraderConfig(ITracer tracer, LocalGVFSConfig localGVFSConfig) { this.Tracer = tracer; this.LocalConfig = localGVFSConfig; }