public List <CustomWrapper> ProcessWrappers(List <XmlTag> lstTags, List <XmlTag> lstWrappers) { List <CustomWrapper> lstCustomWrappers = new List <CustomWrapper>(); int index = 0; foreach (XmlTag wrapper in lstWrappers[0].LSTChildNodes) { string type = Utils.GetAttributeValueByName(wrapper, XmlAttributeTypes.TYPE); switch (type) { case "position": foreach (XmlTag tag in lstTags) { foreach (XmlTag pch in tag.LSTChildNodes) { if (pch.InnerHtml.ToLower().Contains(wrapper.InnerHtml.ToLower())) { CustomWrapper obj = new CustomWrapper(); obj.Name = Utils.GetAttributeValueByName(wrapper, XmlAttributeTypes.NAME); obj.Class = Utils.GetAttributeValueByName(wrapper, XmlAttributeTypes.CLASS); obj.Depth = Utils.GetAttributeValueByName(wrapper, XmlAttributeTypes.DEPTH) == "" ? 1 : int.Parse(Utils.GetAttributeValueByName(wrapper, XmlAttributeTypes.DEPTH)); obj.Start = wrapper.PositionsArr[0]; obj.End = wrapper.PositionsArr[wrapper.PositionsArr.Length - 1]; obj.LSTPositions = wrapper.PositionsArr.ToList(); obj.Type = Utils.GetAttributeValueByName(wrapper, XmlAttributeTypes.TYPE); obj.Index = index; lstCustomWrappers.Add(obj); break; } } } break; case "placeholder": foreach (XmlTag tag in lstTags) { if (tag.Placeholders.ToLower().Contains(wrapper.InnerHtml.ToLower()) || wrapper.InnerHtml == "left,middle" || wrapper.InnerHtml == "right,middle") { CustomWrapper obj = new CustomWrapper(); obj.Name = Utils.GetAttributeValueByName(wrapper, XmlAttributeTypes.NAME); obj.Class = Utils.GetAttributeValueByName(wrapper, XmlAttributeTypes.CLASS); obj.Depth = Utils.GetAttributeValueByName(wrapper, XmlAttributeTypes.DEPTH) == "" ? 1 : int.Parse(Utils.GetAttributeValueByName(wrapper, XmlAttributeTypes.DEPTH)); obj.Start = wrapper.PositionsArr[0]; obj.End = wrapper.PositionsArr[wrapper.PositionsArr.Length - 1]; obj.LSTPositions = wrapper.PositionsArr.ToList(); obj.Type = Utils.GetAttributeValueByName(wrapper, XmlAttributeTypes.TYPE); obj.Index = index; lstCustomWrappers.Add(obj); break; } } break; } index++; } return(lstCustomWrappers); }
public List<CustomWrapper> ProcessWrappers(List<XmlTag> lstTags, List<XmlTag> lstWrappers) { List<CustomWrapper> lstCustomWrappers = new List<CustomWrapper>(); int index = 0; foreach (XmlTag wrapper in lstWrappers[0].LSTChildNodes) { string type = Utils.GetAttributeValueByName(wrapper, XmlAttributeTypes.TYPE); switch (type) { case "position": foreach (XmlTag tag in lstTags) { foreach (XmlTag pch in tag.LSTChildNodes) { if (pch.InnerHtml.ToLower().Contains(wrapper.InnerHtml.ToLower())) { CustomWrapper obj = new CustomWrapper(); obj.Name = Utils.GetAttributeValueByName(wrapper, XmlAttributeTypes.NAME); obj.Class = Utils.GetAttributeValueByName(wrapper, XmlAttributeTypes.CLASS); obj.Depth = Utils.GetAttributeValueByName(wrapper, XmlAttributeTypes.DEPTH) == "" ? 1 : int.Parse(Utils.GetAttributeValueByName(wrapper, XmlAttributeTypes.DEPTH)); obj.Start = wrapper.PositionsArr[0]; obj.End = wrapper.PositionsArr[wrapper.PositionsArr.Length - 1]; obj.LSTPositions = wrapper.PositionsArr.ToList(); obj.Type = Utils.GetAttributeValueByName(wrapper, XmlAttributeTypes.TYPE); obj.Index = index; lstCustomWrappers.Add(obj); break; } } } break; case "placeholder": foreach (XmlTag tag in lstTags) { if (tag.Placeholders.ToLower().Contains(wrapper.InnerHtml.ToLower()) || wrapper.InnerHtml=="left,middle"|| wrapper.InnerHtml=="right,middle") { CustomWrapper obj = new CustomWrapper(); obj.Name = Utils.GetAttributeValueByName(wrapper, XmlAttributeTypes.NAME); obj.Class = Utils.GetAttributeValueByName(wrapper, XmlAttributeTypes.CLASS); obj.Depth = Utils.GetAttributeValueByName(wrapper, XmlAttributeTypes.DEPTH) == "" ? 1 : int.Parse(Utils.GetAttributeValueByName(wrapper, XmlAttributeTypes.DEPTH)); obj.Start = wrapper.PositionsArr[0]; obj.End = wrapper.PositionsArr[wrapper.PositionsArr.Length - 1]; obj.LSTPositions = wrapper.PositionsArr.ToList(); obj.Type = Utils.GetAttributeValueByName(wrapper, XmlAttributeTypes.TYPE); obj.Index = index; lstCustomWrappers.Add(obj); break; } } break; } index++; } return lstCustomWrappers; }