/// <summary> /// Load the builds for the project. /// </summary> /// <param name="value"></param> protected virtual void LoadBuilds(ProjectStatus value) { lock (lockObject) { buildsLoaded = true; if (builds.Count == 0) { // This is the first load - so load all of the builds string[] buildNames = { }; try { client.ProcessSingleAction(p => { buildNames = client.GetBuildNames(p.Name); }, InnerProject); } catch { // Ignore any errors - just means that no builds will be loaded } foreach (var buildName in buildNames ?? new string[0]) { builds.Add(buildName, new ProjectBuild(buildName, this, client)); } } else { if (project.LastBuildDate != value.LastBuildDate) { // Last build date has changed, therefore there will be one or more builds to load string[] buildNames = { }; try { client.ProcessSingleAction(p => { // Cannot pass in a date, only a number, so guessing there will be no more then // 10 builds since the last build buildNames = client.GetMostRecentBuildNames(p.Name, 10); }, InnerProject); } catch { // Ignore any errors - just means that no builds will be loaded } foreach (var buildName in buildNames) { if (!builds.ContainsKey(buildName)) { builds.Add(buildName, new ProjectBuild(buildName, this, client)); } } } } } }
public int GetAverageBuildTime(string projectName) { //var sums = _client.GetBuildSummaries(projectName, 0, 5); var names = _client.GetMostRecentBuildNames(projectName, 5); var statuses = names.Select(n => _client.GetFinalBuildStatus(projectName, n)).ToArray(); //var snap = _client.(projectName); //if ((!snap.TimeCompleted.HasValue) || (!snap.TimeStarted.HasValue)) return 0; //return Convert.ToInt32((snap.TimeCompleted.Value - snap.TimeStarted.Value).TotalSeconds); //var ps = _farmsvc.GetProjectStatusListAndCaptureExceptions(_location, null); //return ps.StatusAndServerList.Select(sos => sos.ProjectStatus); return(0); }