public AttributesList GetUpdatedAttributeList(ObservableCollection <Helpers.Attribute> contactList) { AttributesList attributeList = new AttributesList(); Settings.ContactDataContext contactContext = Settings.ContactDataContext.GetInstance(); foreach (Helpers.Attribute contact in contactList.Where(x => x.IsAltered == true && !string.IsNullOrEmpty(x.AttributeId) && ((!string.IsNullOrEmpty(x.AttributeValue.Trim()) && x.Type == Settings.ContactDataContext.AttributeType.Multiple) || (x.Type == Settings.ContactDataContext.AttributeType.Single)))) { string attributeName = contactContext.ContactValidAttribute.Where(x => x.Value.Equals(contact.AttributeName)).Single().Key; if (attributeList.Cast <AttributesHeader>().Where(y => y.AttrName.Equals(attributeName)).ToList().Count == 0) // if(!attributeList.Contains(contact.AttributeName)) { AttributesHeader attributeHeader = new AttributesHeader(); // attributeHeader.AttrName = contact.AttributeName; attributeHeader.AttrName = attributeName; AttributesInfoList attributeInfoList = new AttributesInfoList(); List <Pointel.Interactions.Contact.Helpers.Attribute> lst = contactList.Where(x => x.IsAltered == true && !string.IsNullOrEmpty(x.AttributeId) && x.AttributeName.Equals(contact.AttributeName) && !string.IsNullOrEmpty(x.AttributeValue.Trim())).ToList <Pointel.Interactions.Contact.Helpers.Attribute>(); int i = 1; foreach (Helpers.Attribute contactGroup in lst) { AttributesInfo attributeInfo = new AttributesInfo(); attributeInfo.AttrValue = contactGroup.AttributeValue; attributeInfo.AttrId = contactGroup.AttributeId; attributeInfo.Description = contactGroup.Description; if (contactGroup.Type == Settings.ContactDataContext.AttributeType.Single) { attributeInfo.AttrIndex = 0; } else { if (contactGroup.Isprimary) { attributeInfo.AttrIndex = 0; } else { attributeInfo.AttrIndex = i++; } } attributeInfoList.Add(attributeInfo); } attributeHeader.AttributesInfoList = attributeInfoList; attributeList.Add(attributeHeader); } } if (attributeList.Count == 0) { attributeList = null; } return(attributeList); }
internal void Deserialize(IBinaryReader reader) { Clear(); AttributesInfoList attributes = new AttributesInfoList(); // read attributes list attributes.Deserialize(reader); int count = reader.ReadInt32(); bool is64Bit = reader.ReadBoolean(); MatchParseContext context = new MatchParseContext(attributes, is64Bit); for (int i = 0; i < count; i++) { Match match = new Match(); match.Deserialize(reader, context); Add(match); } }
internal MatchParseContext(AttributesInfoList attributes, bool isLongIdentifiers) { _attributes = attributes; _isLongIdentifiers = isLongIdentifiers; }