private static void LoadList(List <List <object> > datalist) { SortedDictionary <int, List <ProblemInfo> > catData = new SortedDictionary <int, List <ProblemInfo> >(); //Load problem from list foreach (List <object> lst in datalist) { ProblemInfo plist = new ProblemInfo(lst); problemList.Add(plist); //set the file size string file = LocalDirectory.GetProblemHtml(plist.pnum); if (File.Exists(file)) { plist.FileSize = (new System.IO.FileInfo(file)).Length; } SetProblem(plist.pnum, plist); SetNumber(plist.pid, plist.pnum); //Categorize if (!catData.ContainsKey(plist.Volume)) { catData.Add(plist.Volume, new List <ProblemInfo>()); } catData[plist.Volume].Add(plist); } //add volume category var volCat = new CategoryNode("Volumes", "Problem list by volumes"); categoryRoot.branches.Add(volCat); foreach (var data in catData.Values) { string vol = string.Format("Volume {0:000}", data[0].Volume); var nod = new CategoryNode(vol, "", volCat); volCat.branches.Add(nod); foreach (var p in data) { nod.problems.Add(new CategoryProblem(p.pnum)); } } volCat.ProcessData(); }