public static XDocument BuildCharacterFile(SynchronizedObservableCollection <Character> list) { var root = new XElement(CharactersTag, new XAttribute(EliteTag, SessionManager.IsElite)); list.ToSyncList().ForEach(c => { var xChar = BuildGeneralDataXelement(c); xChar.Add(BuildDungeonDataXelement(c)); xChar.Add(BuildGearDataXelement(c)); xChar.Add(BuildBuffsXelement(c)); xChar.Add(BuildInventoryDataXelement(c)); root.Add(xChar); }); return(new XDocument(new XDeclaration("1.0", "utf-8", "yes"), root)); }
private static bool FindAndUpdate(SynchronizedObservableCollection <Cooldown> list, Cooldown sk) { var existing = list.ToSyncList().FirstOrDefault(x => x.Skill.IconName == sk.Skill.IconName); if (existing == null) { list.Add(sk); return(true); } if (existing.Mode == CooldownMode.Pre && sk.Mode == CooldownMode.Normal) { existing.Start(sk); return(true); } else { existing.Refresh(sk.Skill.Id, sk.Duration, sk.Mode); return(true); } }