public Dictionary <int, BugComment[]> GetComments(int[] bugIds, bool withAttachments) { BugGetComments args = new BugGetComments(); args.ids = bugIds; GetCommentsResult res = Proxy.GetComments(args); Dictionary <int, BugComment[]> dict = new Dictionary <int, BugComment[]> (); List <int> attIds = new List <int>(); Dictionary <int, BugComment> attTargets = new Dictionary <int, BugComment> (); foreach (DictionaryEntry e in res.bugs) { string bugId = (string)e.Key; XmlRpcStruct cms = (XmlRpcStruct)e.Value; object[] cmsArray = (object[])cms ["comments"]; List <BugComment> list = new List <BugComment> (); foreach (XmlRpcStruct cm in cmsArray) { BugComment c = new BugComment(); if (cm.Contains("attachment_id")) { c.attachment_id = (int)cm ["attachment_id"]; } c.author = (string)cm ["author"]; c.is_private = (bool)cm ["is_private"]; c.text = (string)cm ["text"]; c.time = (DateTime)cm ["time"]; list.Add(c); if (c.attachment_id != 0) { attIds.Add(c.attachment_id); attTargets [c.attachment_id] = c; } } dict [int.Parse(bugId)] = list.ToArray(); } if (withAttachments && attIds.Count > 0) { Dictionary <int, BugAttachment> atts = GetAttachments(attIds.ToArray()); foreach (BugAttachment at in atts.Values) { BugComment c = attTargets [at.id]; c.attachment = at; } } return(dict); }
public Dictionary<int, BugComment[]> GetComments(int[] bugIds, bool withAttachments) { BugGetComments args = new BugGetComments (); args.ids = bugIds; GetCommentsResult res = Proxy.GetComments (args); Dictionary<int, BugComment[]> dict = new Dictionary<int, BugComment[]> (); List<int> attIds = new List<int>(); Dictionary<int, BugComment> attTargets = new Dictionary<int, BugComment> (); foreach (DictionaryEntry e in res.bugs) { string bugId = (string) e.Key; XmlRpcStruct cms = (XmlRpcStruct) e.Value; object[] cmsArray = (object[]) cms ["comments"]; List<BugComment> list = new List<BugComment> (); foreach (XmlRpcStruct cm in cmsArray) { BugComment c = new BugComment (); if (cm.Contains ("attachment_id")) c.attachment_id = (int) cm ["attachment_id"]; c.author = (string) cm ["author"]; c.is_private = (bool) cm ["is_private"]; c.text = (string) cm ["text"]; c.time = (DateTime) cm ["time"]; list.Add (c); if (c.attachment_id != 0) { attIds.Add (c.attachment_id); attTargets [c.attachment_id] = c; } } dict [int.Parse (bugId)] = list.ToArray (); } if (withAttachments && attIds.Count > 0) { Dictionary<int,BugAttachment> atts = GetAttachments (attIds.ToArray ()); foreach (BugAttachment at in atts.Values) { BugComment c = attTargets [at.id]; c.attachment = at; } } return dict; }