/// <summary> /// Gets the content for headers and footers. /// </summary> /// <param name="contentNode">The content node.</param> /// <param name="textDocument">The text document.</param> /// <returns>The contents as IContentCollection.</returns> public ContentCollection GetContentHeaderFooter(XmlNode contentNode, TextDocument textDocument) { ContentCollection contents = new ContentCollection(); if (contentNode != null && contentNode.HasChildNodes) { XmlNode node = null; if (textDocument.XmlDoc != contentNode.OwnerDocument) { node = textDocument.XmlDoc.ImportNode(contentNode, true); } else { node = contentNode; } MainContentProcessor mcp = new MainContentProcessor(textDocument); foreach (XmlNode nodeChild in node.ChildNodes) { IContent iContent = mcp.CreateContent(nodeChild); if (iContent != null) { if (iContent is AODL.Document.Content.Tables.Table) { ((AODL.Document.Content.Tables.Table)iContent).BuildNode(); } contents.Add(iContent); } } } return(contents); }
public override void PerformRestore(DockingManager dm) { // Create collection of Contents to auto hide ContentCollection cc = new ContentCollection(); // In this case, there is only one cc.Add(_content); // Add to appropriate AutoHidePanel based on _state dm.AutoHideContents(cc, _state); }
public virtual void AddToContentCollection() { if (_contentCollection != null) { if (_refCounter == 0) { _contentCollection.Add(_controlRef); _refCounter++; } else { throw new Exception("Cannot add control to form: it already belongs to another form!"); } } }
private void AddToCollection(IContent content, ContentCollection coll) { coll.Add(content); if (content is ODFControlRef) { ODFControlRef ctrlRef = content as ODFControlRef; if (this._document is TextDocument) { TextDocument td = this._document as TextDocument; ODFFormControl fc = td.FindControlById(ctrlRef.DrawControl); if (fc != null) { fc.ContentCollection = coll; fc.ControlRef = ctrlRef; } } } }
public static ContentCollection Contents(Zone z) { // Container for returned group of found Content objects ContentCollection cc = new ContentCollection(); // Process each Window in the Zone foreach (Window w in z.Windows) { WindowContent wc = w as WindowContent; // Is the Zone a Content derived variation? if (wc != null) { // Add each Content into the collection foreach (Content c in wc.Contents) { cc.Add(c); } } } return(cc); }
/// <summary> /// Gets the content for headers and footers. /// </summary> /// <param name="contentNode">The content node.</param> /// <param name="textDocument">The text document.</param> /// <returns>The contents as IContentCollection.</returns> public ContentCollection GetContentHeaderFooter(XElement contentNode, TextDocument textDocument) { ContentCollection contents = new ContentCollection(); if (contentNode != null && contentNode.HasElements) { XElement node = textDocument.XmlDoc != contentNode.Document ? new XElement(contentNode) : contentNode; MainContentProcessor mcp = new MainContentProcessor(textDocument); foreach (XElement nodeChild in node.Elements()) { IContent iContent = mcp.CreateContent(nodeChild); if (iContent != null) { if (iContent is Table) { ((Table)iContent).BuildNode(); } contents.Add(iContent); } } } return(contents); }
public ContentCollection CloneContentCollection(ContentCollection contentCollection) { ContentCollection clonedContent = new ContentCollection(); int index = 0; foreach (IContent content in contentCollection) { index ++; try { clonedContent.Add(CloneAny(content)); } catch (ContentMockerException e) { throw new ContentMockerException(string.Format( "Could not clone element {0} in given collection. Item " + " index was {1}", content.Node.Value, index), e); } } return clonedContent; }
public ContentCollection CloneContentCollection(ContentCollection contentCollection) { ContentCollection clonedContent = new ContentCollection(); int index = 0; foreach (IContent content in contentCollection) { index++; try { clonedContent.Add(CloneAny(content)); } catch (ContentMockerException e) { throw new ContentMockerException(string.Format( "Could not clone element {0} in given collection. Item " + " index was {1}", content.Node, index), e); } } return(clonedContent); }
public async Task TestParse(string urls, decimal numberStrParse) { string getHtml = ""; HttpWebRequest firstRequest = WebRequest.Create(urls) as HttpWebRequest; firstRequest.Method = "GET"; // IWebProxy webProxy = new WebProxy("185.27.62.66:54547"); // request.Proxy = webProxy; firstRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36"; HttpWebResponse firstResponse = await firstRequest.GetResponseAsync() as HttpWebResponse; using (var stream = new StreamReader(firstResponse.GetResponseStream())) { getHtml = await stream.ReadToEndAsync(); ContentCollection.Add(getHtml); } firstResponse.Close(); firstResponse.Dispose(); HtmlAgilityPack.HtmlDocument htmlDocument = new HtmlAgilityPack.HtmlDocument(); htmlDocument.LoadHtml(getHtml); // var getMaxPageNode = htmlDocument.DocumentNode.SelectSingleNode($"//span[@class='item fleft'][14]/a[@class='block br3 brc8 large tdnone lheight24']/span"); var getMaxAdsNode = htmlDocument.DocumentNode.SelectSingleNode($"//td/div[@class='hasPromoted section clr']/p[@class='color-2']"); string getAdsStr = ""; string getMaxAds = getMaxAdsNode.InnerText; int s = 0; int pages = 0; int getPostTestResult = await PostTest(urls); if (getMaxAdsNode == null) { MessageBox.Show("Null maximum page"); return; } if (getPostTestResult != 0) { pages = getPostTestResult; } else { for (int i = 0; i < getMaxAds.Length; i++) { if (!int.TryParse(getMaxAds[i].ToString(), out s)) { continue; } getAdsStr += getMaxAds[i]; } decimal onlyAdsOnePage = 44m; // decimal calculatePage = Convert.ToInt32(getAdsStr) / onlyAdsOnePage; decimal calculatePage = Convert.ToDecimal(getAdsStr) / onlyAdsOnePage; int typeComparer = (int)calculatePage; if (typeComparer <= calculatePage) { pages = typeComparer + 1; } } //try //{ // getMaxStr = node.InnerText; //} //catch (Exception exp) //{ // MessageBox.Show(exp.ToString()); // MessageBox.Show(exp.Message); // return; //} for (var i = 2; i <= pages + 1; i++) { if (numberStrParse <= i) { break; } HttpWebRequest request = WebRequest.Create($"{urls}?page={i}") as HttpWebRequest; request.Method = "GET"; // IWebProxy webProxy = new WebProxy("185.27.62.66:54547"); // request.Proxy = webProxy; request.UserAgent = "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36"; request.AllowAutoRedirect = false; Response = await request.GetResponseAsync() as HttpWebResponse; string sgg = Response.Headers[HttpResponseHeader.Location]; if (sgg != null) { MessageBox.Show("Location Jump"); } using (var stream = new StreamReader(Response.GetResponseStream())) { ContentCollection.Add(await stream.ReadToEndAsync()); stream.Close(); } Response.Close(); } }
private void AddToCollection(IContent content, ContentCollection coll) { coll.Add(content); }
/// <summary> /// Gets the content for headers and footers. /// </summary> /// <param name="contentNode">The content node.</param> /// <param name="textDocument">The text document.</param> /// <returns>The contents as IContentCollection.</returns> public ContentCollection GetContentHeaderFooter(XmlNode contentNode, TextDocument textDocument) { ContentCollection contents = new ContentCollection(); if (contentNode != null && contentNode.HasChildNodes) { XmlNode node = null; if (textDocument.XmlDoc != contentNode.OwnerDocument) { node = textDocument.XmlDoc.ImportNode(contentNode, true); } else { node = contentNode; } MainContentProcessor mcp = new MainContentProcessor(textDocument); foreach(XmlNode nodeChild in node.ChildNodes) { IContent iContent = mcp.CreateContent(nodeChild); if (iContent != null) { if (iContent is AODL.Document.Content.Tables.Table) ((AODL.Document.Content.Tables.Table)iContent).BuildNode(); contents.Add(iContent); } } } return contents; }