private static void SearchAndSaveBranchInSettings(ref string server, ref string branch) { var settings = CementSettingsRepository.Get(); if (branch != null) { settings.SelfUpdateTreeish = branch; } else { branch = settings.SelfUpdateTreeish; } if (server != null) { var uri = new Uri(server); settings.CementServer = uri.ToString(); } else { server = settings.CementServer; } CementSettingsRepository.Save(settings); }
private void UpdateCementServerIfRequestWasRedirected(Uri requestUri, Uri effectiveRequestUri) { if (requestUri == effectiveRequestUri) { return; } log.LogDebug("Request was redirected, '{RequestUri}' -> '{NewRequestUri}'", requestUri, effectiveRequestUri); var newServerUri = effectiveRequestUri.GetLeftPart(UriPartial.Authority); log.LogDebug("New server url: {CementServerUri}", newServerUri); var settings = CementSettingsRepository.Get(); settings.CementServer = newServerUri; CementSettingsRepository.Save(settings); consoleWriter.WriteInfo($"CementServer has been updated: {Name} => {newServerUri}"); Name = newServerUri; }