public bool IsChangelistAttachedToReview(IDictionary <int, SwarmApi.SwarmServer.Review> changes) { if (SwarmEnabled == false) { return(false); } SwarmApi.SwarmServer.ReviewList l = null; bool success = false; List <int> changeIds = null; SwarmApi.SwarmServer sw = new SwarmApi.SwarmServer(SwarmUrl, user, SwarmPassword); int[] allChangeIds = changes.Keys.ToArray(); int idx = 0; while (idx < allChangeIds.Length) { changeIds = new List <int>(); int cnt = 0; while ((idx < allChangeIds.Length) && (cnt < 50)) { changeIds.Add(allChangeIds[idx++]); cnt++; } SwarmApi.Options ops = new SwarmApi.Options(); ops["change[]"] = new JSONParser.JSONArray(changeIds.ToArray()); l = sw.GetReviews(ops); if ((l != null) && (l.Count > 0) && (l[0] != null) && (l[0] is SwarmApi.SwarmServer.Review)) { foreach (SwarmApi.SwarmServer.Review r in l) { foreach (int c in r.changes) { if (changes.ContainsKey(c)) { changes[c] = r; } } } success = true; } } return(success); }
public SwarmApi.SwarmServer.Review IsChangelistAttachedToReview(int change) { if (SwarmEnabled == false) { return(null); } SwarmApi.SwarmServer.ReviewList l = null; SwarmApi.SwarmServer sw = new SwarmApi.SwarmServer(SwarmUrl, user, SwarmPassword); SwarmApi.Options ops = new SwarmApi.Options(); ops["change[]"] = new JSONParser.JSONArray(new int[] { change }); l = sw.GetReviews(ops); if ((l != null) && (l.Count > 0) && (l[0] != null) && (l[0] is SwarmApi.SwarmServer.Review)) { return((SwarmApi.SwarmServer.Review)l[0]); } return(null); }