private BoxRenderElement CreateBoxElement(IDOMElement domElement) { var boxElement = new BoxRenderElement(m_renderTree); foreach (var styleRule in m_styleRules.Items) { if (styleRule.Selector == domElement.TagName || styleRule.Selector.Remove(0, 1) == domElement.ID) { foreach (var rule in styleRule.Rules) { switch (rule.Key) { case "color": boxElement.Color = double.Parse(rule.Value); break; case "x": boxElement.Box.X = double.Parse(rule.Value); break; } } } } return(boxElement); }
private string DeserializeChilds(IDOMElement currentElement, bool doNotAddRootElement) { return((doNotAddRootElement && currentElement == this ? string.Empty : currentElement.Element.ToString()) + currentElement.Childs.Select(el => DeserializeChilds(el, doNotAddRootElement)).Aggregate(string.Empty, (agg, el) => agg + el) + (string.IsNullOrEmpty(currentElement.TagName) || (doNotAddRootElement && currentElement == this) || (!string.IsNullOrEmpty(currentElement.TagName) && tagsWithoutClosingTag.Contains(currentElement.TagName)) ? string.Empty : string.Format("</{0}>", currentElement.TagName))); }
public IDOMElement GetLastChildInSubThree(Func <IDOMElement, bool> filter) { IDOMElement lastChildInSubThree = null; GetLastChildInSubThree(this, filter, ref lastChildInSubThree); return(lastChildInSubThree); }
public IDOMElement GetFirstChildInSubThree(Func <IDOMElement, bool> filter) { IDOMElement firstChildInSubThree = null; GetFirstChildInSubThree(this, filter, ref firstChildInSubThree); return(firstChildInSubThree); }
private IRenderElement CreateElement(IDOMElement domElement) { var element = CreateActualElement(domElement); foreach (var child in domElement.Children) { element.Children.Add(CreateElement(child)); } return(element); }
internal static Element Create(IDOMElement Element) { if (Element is IDOMHTMLElement) { return(HTMLElement.Create(Element as IDOMHTMLElement)); } else { return(new Element(Element)); } }
public IDOMElement GetLastChildFromChilds(Func <IDOMElement, string, bool> filter, params string[] childs) { IDOMElement currentNode = this; var index = 0; while (currentNode != null && index < childs.Length) { var curretnIndex = index++; currentNode = currentNode.GetFirstChild(el => filter(el, childs[curretnIndex])); } return(currentNode); }
private void GetLastChildInSubThree(IDOMElement currentElement, Func <IDOMElement, bool> filter, ref IDOMElement foundElement) { if (filter(currentElement)) { foundElement = currentElement; } else { var childs = currentElement.Childs; var index = childs.Count - 1; while (foundElement == null && index >= 0) { GetLastChildInSubThree(childs[index--], filter, ref foundElement); } } }
private IRenderElement CreateActualElement(IDOMElement domElement) { switch (domElement.TagName) { case "viewport": return(new ViewportRenderElement(m_renderTree)); case "camera": return(new CameraRenderElement(m_renderTree)); case "box": return(CreateBoxElement(domElement)); default: return(new DummyRenderElement(m_renderTree)); } }
private void GatherStyles(IDOMElement domElement) { if (domElement.TagName == "style") { foreach (var child in domElement.Children) { GetStyleRules((StyleRuleDOMElement)child); } } else { foreach (var child in domElement.Children) { GatherStyles(child); } } }
public virtual dynamic ProcessDOMNode(XElement xmlParceRule, IDOMElement expectedDOMElement, PostModel postModel) { string result = null; var searchCritereaNode = xmlParceRule.Elements().FirstOrDefault(el => el.Name.ToString().ToLower() == SEARCH_CRITEREA_NODE_NAME.ToLower()); var expectedNode = SearchForNode(searchCritereaNode.Elements(), expectedDOMElement, postModel); if (expectedNode != null) { result = ProcessGetCriterea(xmlParceRule, expectedNode, postModel); } if (string.IsNullOrEmpty(result)) { Logger.LogException(string.Format("BaseXMLGuideParcer returned no result for {0} factory", GetType().Name), LogTypeEnum.CORE); } return(result); }
protected virtual IDOMElement SearchForNode(IEnumerable <XElement> searchCriterea, IEnumerable <IDOMElement> domElements, PostModel postModel, bool useFirstElSearch = true) { IDOMElement result = null; var domElementsCount = domElements.Count(); var domElementsIndex = useFirstElSearch ? 0 : domElementsCount - 1; if (useFirstElSearch) { while (result == null && domElementsCount > domElementsIndex) { result = SearchForNode(searchCriterea, domElements.ElementAt(domElementsIndex++), postModel, useFirstElSearch); } } else { while (result == null && domElementsIndex >= 0) { result = SearchForNode(searchCriterea, domElements.ElementAt(domElementsIndex--), postModel, useFirstElSearch); } } return(result); }
public void willSubmitForm(webFrame frame, webFrame sourceFrame, IDOMElement form, CFDictionaryPropertyBag values, IWebFormSubmissionListener listener) { SubmitForm((HTMLElement)HTMLElement.Create(form), listener); }
public int supportsFullScreenForElement(IDOMElement __MIDL__IWebUIDelegatePrivate40000, int withKeyboard) { return 1; }
public void exitFullScreenForElement(IDOMElement __MIDL__IWebUIDelegatePrivate40002) { }
public void didPressMissingPluginButton(IDOMElement __MIDL__IWebUIDelegatePrivate30000) { owner.OnMissingPlugin(__MIDL__IWebUIDelegatePrivate30000); }
public override dynamic ProcessDOMNode(XElement xmlParceRule, IDOMElement expectedDOMElement, PostModel postModel) { IPostContentModel result = null; var searchCritereaNode = xmlParceRule.Elements().FirstOrDefault(el => el.Name.ToString().ToLower() == SEARCH_CRITEREA_NODE_NAME.ToLower()); var expectedNode = SearchForNode(searchCritereaNode.Elements(), expectedDOMElement, postModel); if (expectedNode != null) { string videoName = string.Empty; string videoData = string.Empty; var searchCritereaVideoNameNode = xmlParceRule.Elements().FirstOrDefault(el => el.Name.ToString().ToLower() == (SUB_SEARCH_CRITEREA_NODE_NAME + VIDEO_NAME_POSTFIX_NAME).ToLower()); var videoNameNode = SearchForNode(searchCritereaVideoNameNode.Elements(), expectedNode, postModel); if (videoNameNode != null) { videoName = ProcessGetCriterea(xmlParceRule, videoNameNode, postModel, VIDEO_NAME_POSTFIX_NAME); } var searchCritereaVideoLinkNode = xmlParceRule.Elements().FirstOrDefault(el => el.Name.ToString().ToLower() == (SUB_SEARCH_CRITEREA_NODE_NAME + VIDEO_LINK_POSTFIX_NAME).ToLower()); if (searchCritereaVideoLinkNode != null) { var videoLinkNode = SearchForNode(searchCritereaVideoLinkNode.Elements(), expectedNode, postModel); if (videoNameNode != null) { videoData = ProcessGetCriterea(xmlParceRule, videoLinkNode, postModel, VIDEO_LINK_POSTFIX_NAME); } } else { var externalGetNode = xmlParceRule.Elements().FirstOrDefault(el => el.Name.ToString().ToLower() == EXTERNAL_GET_NODE_NAME.ToLower()); if (externalGetNode != null) { var videoDataTask = ProcessExternlaGetCriterea(externalGetNode.Elements(), expectedNode, postModel); videoDataTask.Wait(); videoData = videoDataTask.Result; } } if (!string.IsNullOrEmpty(videoData)) { if (!string.IsNullOrEmpty(videoName)) { result = PostContentModelfactory.GetInitializedFactory(PostContentTypeEnum.Video, postModel.PostContent.Count, new VideoPostContentContainerModel(videoName, videoData)); } else { Logger.LogException("VideoContentXMLParcer factory returned empty video name", LogTypeEnum.CORE); } } else { Logger.LogException("VideoContentXMLParcer factory returned empty video data", LogTypeEnum.CORE); } } return(result); }
public DOMElement(IDOMElement parent, StringBuilder domElement) { Parent = parent; Element = domElement; Childs = new List <IDOMElement>(); if (Element.Length > 0) { if (Element[0] == '<') { var tagNameIndexEnd = Element.FirstIndexOfAny(false, " ", "\t", "\n"); if (tagNameIndexEnd > 0) { TagName = Element.GetRange(1, tagNameIndexEnd - 1).ToString().ToLower(); } else if (Element[Element.Length - 1] == '>') { TagName = Element.GetRange(1, Element.Length - 2).ToString().ToLower(); } else { BadTag = true; IsDomElementComplete = true; } switch (TagName) { case "script": ElementType = DOMEleementTypeEnum.Script; break; case "noscript": ElementType = DOMEleementTypeEnum.NoScript; break; default: if (Element[1] == '!') { ElementType = DOMEleementTypeEnum.Comment; if (Element.Length >= 4 && (Element[2] == '-' && Element[3] == '-')) { TagName = "--"; if (Element.Length >= 7 && (Element[Element.Length - 2] == '-' && Element[Element.Length - 3] == '-')) { IsDomElementComplete = true; } } } else if (Element.Length >= 4 && (Element[Element.Length - 2] == '-' && Element[Element.Length - 2] == '-')) { ElementType = DOMEleementTypeEnum.Comment; TagName = "--"; } else { ElementType = DOMEleementTypeEnum.Tag; } break; } if (!IsDomElementComplete) { IsDomElementComplete = (Element[Element.Length - 1] == '>' && Element[Element.Length - 2] == '/') || (!string.IsNullOrEmpty(TagName) && tagsWithoutClosingTag.Contains(TagName)); } } else { IsDomElementComplete = true; } } else { BadTag = true; IsDomElementComplete = true; } }
public void willSubmitForm(webFrame frame, webFrame sourceFrame, IDOMElement form, CFDictionaryPropertyBag values, IWebFormSubmissionListener listener) { SubmitForm((HTMLElement)HTMLElement.Create(form),listener); }
public override dynamic ProcessDOMNode(XElement xmlParceRule, IDOMElement expectedDOMElement, PostModel postModel) { dynamic textContent = base.ProcessDOMNode(xmlParceRule, expectedDOMElement, postModel); return(string.IsNullOrEmpty(textContent) ? null : PostContentModelfactory.GetInitializedFactory(PostContentTypeEnum.Text, postModel.PostContent.Count, textContent)); }
public int supportsFullScreenForElement(IDOMElement __MIDL__IWebUIDelegatePrivate40000, int withKeyboard) { return(1); }
protected virtual string ProcessGetCriterea(XElement xmlParceRule, IDOMElement expectedNode, PostModel postModel, string postfix = null) { string result = null; var getCritereaNode = xmlParceRule.Elements().FirstOrDefault(el => el.Name.ToString().ToLower() == (string.IsNullOrEmpty(postfix) ? GET_CRITEREA_NODE_NAME : GET_CRITEREA_NODE_NAME + postfix).ToLower()); var getCriterea = getCritereaNode.Elements().First(); var getResult = string.Empty; switch (getCriterea.Name.ToString().ToLower()) { case "values": case "childs": case "element": case "content": getResult = expectedNode.GetContent(getCriterea.Name.ToString()); break; default: var expectedNodeContent = expectedNode.GetContent(getCriterea.Name.ToString()); if (!string.IsNullOrEmpty(expectedNodeContent)) { getResult = string.IsNullOrEmpty(getCriterea.Value) ? expectedNodeContent : Regex.Match(expectedNodeContent, getCriterea.Value, RegexOptions.IgnoreCase).Value; } break; } var trimCritereaNode = xmlParceRule.Elements().FirstOrDefault(el => el.Name.ToString().ToLower() == (string.IsNullOrEmpty(postfix) ? TRIM_CRITEREA_NODE_NAME : TRIM_CRITEREA_NODE_NAME + postfix).ToLower()); if (trimCritereaNode != null) { if (trimCritereaNode.Attributes().Any(attr => attr.Name.ToString().ToLower() == STRING_TRIM_ATTRIBUTE_NAME.ToLower() && bool.Parse(attr.Value))) { var splitResult = getResult.Split(trimCritereaNode.Value.Split(new[] { ' ' }), StringSplitOptions.RemoveEmptyEntries); result = trimCritereaNode.Attributes().Any(attr => attr.Name.ToString().ToLower() == GET_LAST_OCCURENCE_ATTRIBUTE_NAME.ToLower() && bool.Parse(attr.Value)) ? splitResult[splitResult.Length - 1] : splitResult[0]; } else if (trimCritereaNode.Attributes().Any(attr => attr.Name.ToString().ToLower() == REG_EXP_TRIM_ATTRIBUTE_NAME.ToLower() && bool.Parse(attr.Value))) { if (trimCritereaNode.Attributes().Any(attr => attr.Name.ToString().ToLower() == GET_LAST_OCCURENCE_ATTRIBUTE_NAME.ToLower() && bool.Parse(attr.Value))) { var regExpMatch = Regex.Matches(getResult, trimCritereaNode.Value, RegexOptions.IgnoreCase); result = regExpMatch[regExpMatch.Count - 1].Value; } else { result = Regex.Match(getResult, trimCritereaNode.Value, RegexOptions.IgnoreCase).Value; } } else if (trimCritereaNode.Attributes().Any(attr => attr.Name.ToString().ToLower() == REMOVE_TRIM_ATTRIBUTE_NAME.ToLower() && bool.Parse(attr.Value))) { result = result.Where(el => !trimCritereaNode.Value.Any(elem => elem == el)).Aggregate(string.Empty, (agg, el) => agg + el); } else { result = getResult.Trim(trimCritereaNode.Value.ToArray()); } var additionalTrimCritereaNode = xmlParceRule.Elements().FirstOrDefault(el => el.Name.ToString().ToLower() == (ADDITIONAL_PREFIX + (string.IsNullOrEmpty(postfix) ? TRIM_CRITEREA_NODE_NAME : TRIM_CRITEREA_NODE_NAME + postfix)).ToLower()); if (additionalTrimCritereaNode != null) { if (additionalTrimCritereaNode.Attributes().Any(attr => attr.Name.ToString().ToLower() == STRING_TRIM_ATTRIBUTE_NAME.ToLower() && bool.Parse(attr.Value))) { var splitResult = getResult.Split(trimCritereaNode.Value.Split(new[] { ' ' }), StringSplitOptions.RemoveEmptyEntries); result = trimCritereaNode.Attributes().Any(attr => attr.Name.ToString().ToLower() == GET_LAST_OCCURENCE_ATTRIBUTE_NAME.ToLower() && bool.Parse(attr.Value)) ? splitResult[splitResult.Length - 1] : splitResult[0]; } else if (additionalTrimCritereaNode.Attributes().Any(attr => attr.Name.ToString().ToLower() == REG_EXP_TRIM_ATTRIBUTE_NAME.ToLower() && bool.Parse(attr.Value))) { if (trimCritereaNode.Attributes().Any(attr => attr.Name.ToString().ToLower() == GET_LAST_OCCURENCE_ATTRIBUTE_NAME.ToLower() && bool.Parse(attr.Value))) { var regExpMatch = Regex.Matches(getResult, trimCritereaNode.Value, RegexOptions.IgnoreCase); result = regExpMatch[regExpMatch.Count - 1].Value; } else { result = Regex.Match(getResult, trimCritereaNode.Value, RegexOptions.IgnoreCase).Value; } } else if (additionalTrimCritereaNode.Attributes().Any(attr => attr.Name.ToString().ToLower() == REMOVE_TRIM_ATTRIBUTE_NAME.ToLower() && bool.Parse(attr.Value))) { result = result.Where(el => !additionalTrimCritereaNode.Value.Any(elem => elem == el)).Aggregate(string.Empty, (agg, el) => agg + el); } else { result = result.Trim(additionalTrimCritereaNode.Value.ToArray()); } } } else { result = getResult; } return(result); }
public void AddChild(IDOMElement child) { Childs.Add(child); }
/// <summary> /// Element constructor. /// </summary> /// <param name="Element">WebKit IDOMElement object.</param> protected Element(IDOMElement Element) : base(Element) { this.element = Element; }
protected virtual async Task <dynamic> ProcessExternlaGetCriterea(IEnumerable <XElement> xmlParceRules, IDOMElement expectedNode, PostModel postModel) { var result = string.Empty; var externalLinkNode = xmlParceRules.FirstOrDefault(el => el.Name.ToString().ToLower() == EXTERNAL_GET_LINK_NODE_NAME.ToLower()); if (externalLinkNode != null) { var searchCritereaLinkNode = externalLinkNode.Elements().FirstOrDefault(el => el.Name.ToString().ToLower() == (SUB_SEARCH_CRITEREA_NODE_NAME + EXTERNAL_GET_LINK_NODE_NAME).ToLower()); var linkNode = SearchForNode(searchCritereaLinkNode.Elements(), expectedNode, postModel); if (linkNode != null) { var link = ProcessGetCriterea(externalLinkNode, linkNode, postModel, EXTERNAL_GET_LINK_NODE_NAME); if (!string.IsNullOrEmpty(link)) { var serializedExternalData = await GetAdditionalResourceData(string.Format("{0}\\{1}", postModel.BaseURL.TrimEnd(new[] { '\\', ' ' }), link)); if (serializedExternalData != null) { var externalGetContentCriteriaNode = xmlParceRules.FirstOrDefault(el => el.Name.ToString().ToLower() == EXTERNAL_GET_CONTENT_NODE_NAME.ToLower()); if (externalGetContentCriteriaNode != null) { var searchCriterea = externalGetContentCriteriaNode.Elements().FirstOrDefault(el => el.Name.ToString().ToLower() == SEARCH_CRITEREA_NODE_NAME.ToLower()); var useLastElSearch = searchCriterea.Attributes().Any(attr => attr.Name.ToString().ToLower() == USE_LAST_CHILD_SEARCH_ATTRIBUTE_NAME.ToLower() && bool.Parse(attr.Value)); var expectedDataNode = SearchForNode(searchCriterea.Elements(), serializedExternalData, postModel, !useLastElSearch); if (expectedDataNode != null) { result = ProcessGetCriterea(externalGetContentCriteriaNode, expectedDataNode, postModel); } else { Logger.LogException("ProcessExternlaGetCriterea from BaseXMLGuideParcer factory no node found from external SearchForNode process", LogTypeEnum.CORE); } } else { Logger.LogException("ProcessExternlaGetCriterea from BaseXMLGuideParcer factory no get criteria node", LogTypeEnum.CORE); } } else { Logger.LogException("ProcessExternlaGetCriterea from BaseXMLGuideParcer factory serialization result is null", LogTypeEnum.CORE); } } else { Logger.LogException("ProcessExternlaGetCriterea from BaseXMLGuideParcer factory has an empty link", LogTypeEnum.CORE); } } else { Logger.LogException("ProcessExternlaGetCriterea from BaseXMLGuideParcer factory can`t find a link node", LogTypeEnum.CORE); } } else { Logger.LogException("ProcessExternlaGetCriterea from BaseXMLGuideParcer factory link node in XML Guide is not found", LogTypeEnum.CORE); } return(result); }
public override dynamic ProcessDOMNode(XElement xmlParceRule, IDOMElement expectedDOMElement, PostModel postModel) { IPostContentModel result = null; var searchCritereaNode = xmlParceRule.Elements().FirstOrDefault(el => el.Name.ToString().ToLower() == SEARCH_CRITEREA_NODE_NAME.ToLower()); var expectedNode = SearchForNode(searchCritereaNode.Elements(), expectedDOMElement, postModel); if (expectedNode != null) { var imgUrls = new List <string>(); Parallel.ForEach(expectedNode.Childs, child => { if (!child.BadTag) { var subSearchCritereaNode = xmlParceRule.Elements().FirstOrDefault(el => el.Name.ToString().ToLower() == SUB_SEARCH_CRITEREA_NODE_NAME.ToLower()); var expectedSubNode = SearchForNode(subSearchCritereaNode.Elements(), child, postModel); if (expectedSubNode != null) { var imgUrl = string.Empty; var getCritereaNode = xmlParceRule.Elements().FirstOrDefault(el => el.Name.ToString().ToLower() == GET_CRITEREA_NODE_NAME.ToLower()); var getCriterea = getCritereaNode.Elements().First(); var getResult = Regex.Matches(expectedSubNode.GetContent(getCriterea.Name.ToString()), getCriterea.Value, RegexOptions.IgnoreCase); var trimCritereaNode = xmlParceRule.Elements().FirstOrDefault(el => el.Name.ToString().ToLower() == TRIM_CRITEREA_NODE_NAME.ToLower()); foreach (Match resultPart in getResult) { if (trimCritereaNode != null) { imgUrl += (trimCritereaNode.Attributes().Any(attr => attr.Name.ToString().ToLower() == STRING_TRIM_ATTRIBUTE_NAME.ToLower() && bool.Parse(attr.Value)) ? resultPart.Value.Split(trimCritereaNode.Value.Split(new[] { ' ' }), StringSplitOptions.RemoveEmptyEntries)[0] : resultPart.Value.Trim(trimCritereaNode.Value.ToArray())).Trim(); } else { imgUrl += resultPart.Value.Trim(); } } var extNode = xmlParceRule.Elements().FirstOrDefault(el => el.Name.ToString().ToLower() == IMG_EXT_NAME.ToLower()); if (extNode != null && !string.IsNullOrEmpty(imgUrl)) { imgUrl += string.Format(".{0}", extNode.Value.Trim()); } if (string.IsNullOrEmpty(imgUrl)) { Logger.LogException("ImgContentXMLParcer factory returned an empty link", LogTypeEnum.CORE); } else { var filename = Path.GetFileNameWithoutExtension(imgUrl); if (string.IsNullOrEmpty(filename)) { Logger.LogException(string.Format("ImgContentXMLParcer factory returned a link without name: {0}", imgUrl), LogTypeEnum.CORE); } else { var extension = Path.GetExtension(imgUrl); if (string.IsNullOrEmpty(extension)) { Logger.LogException(string.Format("ImgContentXMLParcer factory returned a link without extension: {0}", imgUrl), LogTypeEnum.CORE); } else { imgUrls.Add(imgUrl); } } } } } }); if (imgUrls.Any()) { result = PostContentModelfactory.GetInitializedFactory(PostContentTypeEnum.Img, postModel.PostContent.Count, imgUrls.ToArray()); } else { Logger.LogException("ImgContentXMLParcer factory returned no records", LogTypeEnum.CORE); } } return(result); }
protected virtual IDOMElement SearchForNode(IEnumerable <XElement> searchCriterea, IDOMElement domElement, PostModel postModel, bool useFirstElSearch = true) { Func <IDOMElement, bool> searchCritereaFilter = el => searchCriterea.All(elem => el.ElementMatch(elem.Name.ToString(), elem.Value.Replace(EXPECTED_AUTHOR_ID_MACRO_NAME, postModel.AuthorId).Replace(EXPECTED_POST_ID_MACRO_NAME, postModel.PostId), elem.Attributes().Any(attr => attr.Name.ToString().ToLower() == USE_STRICT_EQUAL_CHECK_ATTRIBUTE_NAME.ToLower() && bool.Parse(attr.Value)))); return(useFirstElSearch ? domElement.GetFirstChildInSubThree(searchCritereaFilter) : domElement.GetLastChildInSubThree(searchCritereaFilter)); }
public override dynamic ProcessDOMNode(XElement xmlParceRule, IDOMElement expectedDOMElement, PostModel postModel) { IPostContentModel result = null; var searchCritereaNode = xmlParceRule.Elements().FirstOrDefault(el => el.Name.ToString().ToLower() == SEARCH_CRITEREA_NODE_NAME.ToLower()); var expectedNode = SearchForNode(searchCritereaNode.Elements(), expectedDOMElement, postModel); if (expectedNode != null) { var songsData = new List <AudioPostContentContainerModel>(); Parallel.ForEach(expectedNode.Childs, child => { var songAuthor = string.Empty; var songName = string.Empty; var searchCritereaSongLinkNode = xmlParceRule.Elements().FirstOrDefault(el => el.Name.ToString().ToLower() == (SUB_SEARCH_CRITEREA_NODE_NAME + SONG_LINK_POSTFIX_NAME).ToLower()); var songLinkNode = SearchForNode(searchCritereaSongLinkNode.Elements(), child, postModel); if (songLinkNode != null) { var songLink = ProcessGetCriterea(xmlParceRule, songLinkNode, postModel, SONG_LINK_POSTFIX_NAME); if (!string.IsNullOrEmpty(songLink)) { var searchCritereaSongAuthorNode = xmlParceRule.Elements().FirstOrDefault(el => el.Name.ToString().ToLower() == (SUB_SEARCH_CRITEREA_NODE_NAME + SONG_AUTHOR_POSTFIX_NAME).ToLower()); if (searchCritereaSongAuthorNode != null) { var songAuthorNode = SearchForNode(searchCritereaSongAuthorNode.Elements(), child, postModel); songAuthor = ProcessGetCriterea(xmlParceRule, songAuthorNode, postModel, SONG_AUTHOR_POSTFIX_NAME); } var searchCritereaSongNameNode = xmlParceRule.Elements().FirstOrDefault(el => el.Name.ToString().ToLower() == (SUB_SEARCH_CRITEREA_NODE_NAME + SONG_NAME_POSTFIX_NAME).ToLower()); if (searchCritereaSongNameNode != null) { var songNameNode = SearchForNode(searchCritereaSongNameNode.Elements(), child, postModel); songName = ProcessGetCriterea(xmlParceRule, songNameNode, postModel, SONG_NAME_POSTFIX_NAME); } var filename = Path.GetFileName(songLink); if (string.IsNullOrEmpty(filename)) { Logger.LogException(string.Format("AudioContentXMLParcer factory returned a link without name: {0}", songLink), LogTypeEnum.CORE); } else { var extension = Path.GetExtension(songLink); if (string.IsNullOrEmpty(extension)) { Logger.LogException(string.Format("AudioContentXMLParcer factory returned a link without extension: {0}", songLink), LogTypeEnum.CORE); } else { songsData.Add(new AudioPostContentContainerModel(songAuthor, songName, songLink)); } } } else { Logger.LogException("AudioContentXMLParcer factory returned an empty link", LogTypeEnum.CORE); } } }); if (songsData.Any()) { result = PostContentModelfactory.GetInitializedFactory(PostContentTypeEnum.Audio, postModel.PostContent.Count, songsData.ToArray()); } else { Logger.LogException("AudioContentXMLParcer factory returned no records", LogTypeEnum.CORE); } } return(result); }
public void didPressMissingPluginButton(IDOMElement __MIDL__IWebUIDelegatePrivate30000) { owner.OnMissingPlugin(__MIDL__IWebUIDelegatePrivate30000); }
public virtual IEnumerable <IDOMElement> Serialize(StringBuilder denormalizedDom) { var serializedList = new List <IDOMElement>(); try { var splitCharacters = new[] { '>', '<' }; var normalizedDom = denormalizedDom.Split(el => splitCharacters.Any(elem => elem == el), el => el == '>'); IDOMElement parentNode = null; var complexElementProcessing = false; foreach (var el in normalizedDom) { if (el.Length > 0) { var tagName = string.Empty; var tagNameIndexEnd = el.FirstIndexOfAny(false, " ", "\t", "\n"); if (el.Length >= 2 && el[0] == '<' && (el[1] == '/' || (complexElementProcessing && (el[1] == '!' || (el[el.Length - 1] == '>' && el[el.Length - 2] == '-'))))) { tagName = el.GetRange(2, tagNameIndexEnd > 0 ? tagNameIndexEnd - 1 : el.Length - 3).ToString().ToLower(); if (complexElementProcessing && ((el[1] == '!' && (tagName.Length > 2 && tagName[tagName.Length - 1] == '-' && tagName[tagName.Length - 2] == '-')) || tagName.Length >= 1 && tagName[tagName.Length - 1] == '-')) { tagName = "--"; } var curretnNode = parentNode; if (complexElementProcessing) { if (curretnNode.TagName == tagName) { complexElementProcessing = false; curretnNode.IsDomElementComplete = true; while (curretnNode != null && curretnNode.IsDomElementComplete) { curretnNode = curretnNode.Parent; } parentNode = curretnNode == null ? null : curretnNode; } else { parentNode.AddComplexElementContent(el.ToString()); } } else { while (curretnNode != null && (curretnNode.TagName != tagName || curretnNode.IsDomElementComplete)) { curretnNode = curretnNode.Parent; } if (curretnNode != null && curretnNode.TagName == tagName && !curretnNode.IsDomElementComplete) { curretnNode.IsDomElementComplete = true; while (curretnNode != null && curretnNode.IsDomElementComplete) { curretnNode = curretnNode.Parent; } parentNode = curretnNode == null ? null : curretnNode; } } } else { if (complexElementProcessing) { parentNode.AddComplexElementContent(el.ToString()); } else { var newElement = new DOMElement(parentNode, el); if (parentNode == null) { serializedList.Add(newElement); } else { parentNode.AddChild(newElement); } if (!newElement.IsDomElementComplete && !newElement.BadTag) { parentNode = newElement; complexElementProcessing = parentNode.ElementType == DOMEleementTypeEnum.Script || parentNode.ElementType == DOMEleementTypeEnum.Comment || parentNode.ElementType == DOMEleementTypeEnum.NoScript; } } } } } } catch (Exception ex) { Logger.LogException(ex, LogTypeEnum.CORE, string.Format("Serialize for {0} parser failed", GetType().Name)); } return(serializedList); }
internal void OnMissingPlugin(IDOMElement el) { PluginFailed(this, new PluginFailedErrorEventArgs("Plugin missing for element with TagName: " + el.tagName())); }
public void exitFullScreenForElement(IDOMElement __MIDL__IWebUIDelegatePrivate40002) { }