public static ShowParentsAnswer GetUsagesResponse(string moduleName, string checkingBranch, string configuration = "*") { var webClient = new WebClient(); var str = webClient.DownloadString($"{CementSettings.Get().CementServer}/api/v1/{moduleName}/deps/{configuration}/{checkingBranch}"); return(JsonConvert.DeserializeObject <ShowParentsAnswer>(str)); }
public static void KillMsBuild(ILog log) { if (!CementSettings.Get().KillMsBuild) { return; } try { foreach (var process in Process.GetProcessesByName("MSBuild")) { try { process.Kill(); } catch (Exception) { // ignored } } } catch (Exception e) { log.Error(e); } }
public static void KillMsBuild(ILogger log) { if (!CementSettings.Get().KillMsBuild || Rider.IsRunning) { return; } try { foreach (var process in Process.GetProcessesByName("MSBuild")) { try { process.Kill(); } catch (Exception) { // ignored } } } catch (Exception e) { log.LogError(e, e.Message); } }
public static void Save(CementSettings settings) { var text = JsonConvert.SerializeObject(settings, Formatting.Indented); var path = Path.Combine(Helper.GetGlobalCementDirectory(), "settings"); Helper.CreateFileAndDirectory(path, text); }
private void AddUserPassword() { var settings = CementSettings.Get(); if (settings.UserName == null || settings.EncryptedPassword == null) { return; } startInfo.Domain = settings.Domain ?? Environment.MachineName; startInfo.UserName = settings.UserName; var decryptedPassword = Helper.Decrypt(settings.EncryptedPassword); var password = new SecureString(); foreach (var c in decryptedPassword) { password.AppendChar(c); } startInfo.Password = password; }
public static IList <Package> GetPackages() { return(CementSettings.Get().Packages ?? throw new CementException("Packages not specified.")); }
public static IList <Package> GetPackages() { return(CementSettings.Get().Packages); }
public string GetNewCommitHash() { var webClient = new WebClient(); try { var infoModel = JsonConvert.DeserializeObject <InfoResponseModel>(webClient.DownloadString($"{CementSettings.Get().CementServer}/api/v1/cement/info/head/" + branch)); return(infoModel?.CommitHash); } catch (WebException ex) { log.LogError("Fail self-update ", ex); if (ex.Status == WebExceptionStatus.ProtocolError && ex.Response != null) { var resp = (HttpWebResponse)ex.Response; if (resp.StatusCode == HttpStatusCode.NotFound) // HTTP 404 { ConsoleWriter.WriteError("Failed to look for updates on branch " + branch + ". Server responsed 404"); return(null); } } ConsoleWriter.WriteError("Failed to look for updates on branch " + branch + ": " + ex.Message); return(null); } }
public UsagesProvider(ILogger <UsagesProvider> logger, Func <CementSettings> optionsAccessor) { this.logger = logger; cementSettings = optionsAccessor(); }