static OpmlOutline GetOutline(XElement root) { var data = new OpmlOutline { Category = root.ToAttributeValueOrNull("category"), Id = root.ToAttributeValueOrNull("id"), Text = root.ToAttributeValueOrNull("text"), Title = root.ToAttributeValueOrNull("title"), OutlineType = root.ToAttributeValueOrNull("type"), Url = root.ToAttributeValueOrNull("url"), XmlUrl = root.ToAttributeValueOrNull("xmlUrl") }; #if !NETSTANDARD1_2 if (data.Url != null) { data.Url = Environment.ExpandEnvironmentVariables(data.Url); } if (data.XmlUrl != null) { data.XmlUrl = Environment.ExpandEnvironmentVariables(data.XmlUrl); } #endif return(data); }
public void OpmlOutlineInfoIndexTest() { OpmlOutline ol = new OpmlOutline(); int index = 10; object target = RssToolkitUnitTest.RssToolkit_Opml_OutlineInfoAccessor.CreatePrivate(ol, index); int val = 10; RssToolkitUnitTest.RssToolkit_Opml_OutlineInfoAccessor accessor = new RssToolkitUnitTest.RssToolkit_Opml_OutlineInfoAccessor(target); Assert.AreEqual(val, accessor.Index, "RssToolkit.Opml.OutlineInfo.Index was not set correctly."); }
private void buttonAddItem_Click(object sender, System.Web.UI.ImageClickEventArgs e) { OpmlOutline newEntry = new OpmlOutline(); newEntry.title = "New Entry"; outlineCollection.Insert(0, newEntry); StoreEditItemIndexInViewState(blogRollGrid.EditItemIndex = 0); StoreCurrentPageIndexInViewState(blogRollGrid.CurrentPageIndex = 0); Bind(); }
public void OpmlOutlineInfoConstructorTest() { OpmlOutline ol = new OpmlOutline(); ol.XmlUrl = "http://www.microsoft.com"; int index = 11; object target = RssToolkitUnitTest.RssToolkit_Opml_OutlineInfoAccessor.CreatePrivate(ol, index); RssToolkitUnitTest.RssToolkit_Opml_OutlineInfoAccessor accessor = new RssToolkitUnitTest.RssToolkit_Opml_OutlineInfoAccessor(target); Assert.AreEqual(index, accessor.Index, "RssToolkit.Opml.OutlineInfo.Index was not set correctly."); Assert.AreEqual(ol.XmlUrl, accessor.Outline.XmlUrl, "RssToolkit.Opml.OutlineInfo.Index was not set correctly."); }
private void blogRollGrid_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { if (e.CommandName == "AddItem") { OpmlOutline newEntry = new OpmlOutline(); newEntry.title = resmgr.GetString("text_new_entry"); opmlTree.body.outline.Insert(0, newEntry); blogRollGrid.EditItemIndex = 0; blogRollGrid.CurrentPageIndex = 0; blogRollGrid.DataBind(); } }
//============================================================ // PUBLIC METHODS //============================================================ #region Fill(OpmlDocument resource) /// <summary> /// Modifies the <see cref="OpmlDocument"/> to match the data source. /// </summary> /// <param name="resource">The <see cref="OpmlDocument"/> to be filled.</param> /// <exception cref="ArgumentNullException">The <paramref name="resource"/> is a null reference (Nothing in Visual Basic).</exception> public void Fill(OpmlDocument resource) { //------------------------------------------------------------ // Validate parameter //------------------------------------------------------------ Guard.ArgumentNotNull(resource, "resource"); //------------------------------------------------------------ // Create namespace resolver //------------------------------------------------------------ XmlNamespaceManager manager = new XmlNamespaceManager(this.Navigator.NameTable); //------------------------------------------------------------ // Attempt to fill syndication resource //------------------------------------------------------------ XPathNavigator documentNavigator = this.Navigator.SelectSingleNode("opml", manager); if (documentNavigator != null) { XPathNavigator headNavigator = documentNavigator.SelectSingleNode("head", manager); if (headNavigator != null) { resource.Head.Load(headNavigator, this.Settings); } XPathNodeIterator outlineIterator = documentNavigator.Select("body/outline", manager); if (outlineIterator != null && outlineIterator.Count > 0) { int counter = 0; while (outlineIterator.MoveNext()) { OpmlOutline outline = new OpmlOutline(); counter++; if (outline.Load(outlineIterator.Current, this.Settings)) { if (this.Settings.RetrievalLimit != 0 && counter > this.Settings.RetrievalLimit) { break; } ((Collection <OpmlOutline>)resource.Outlines).Add(outline); } } } SyndicationExtensionAdapter adapter = new SyndicationExtensionAdapter(documentNavigator, this.Settings); adapter.Fill(resource, manager); } }
public void Serialize() { Opml opml = new Opml(); OpmlOutline a =new OpmlOutline(); a.title = "a"; a.xmlUrl ="a.xml"; opml.body.outline.Add(a); XmlSerializer ser = new XmlSerializer(typeof(Opml)); using (Stream s = File.OpenWrite("opml.txt")) { ser.Serialize(s, opml); } }
private void blogRollGrid_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { OpmlOutline row = opmlTree.body.outline[e.Item.DataSetIndex]; EditBlogRollEditItem item = ((EditBlogRollEditItem)e.Item.FindControl("editBlogRollEditItem")); row.description = item.Description; row.title = item.Title; row.htmlUrl = item.HtmlUrl; row.xmlUrl = item.XmlUrl; SaveOutline(Path.Combine(SiteConfig.GetConfigPathFromCurrentContext(), baseFileName)); blogRollGrid.EditItemIndex = -1; blogRollGrid.SelectedIndex = -1; LoadOutline(Path.Combine(SiteConfig.GetConfigPathFromCurrentContext(), baseFileName)); BindGrid(); }
public void Serialize() { Opml opml = new Opml(); OpmlOutline a = new OpmlOutline(); a.title = "a"; a.xmlUrl = "a.xml"; opml.body.outline.Add(a); XmlSerializer ser = new XmlSerializer(typeof(Opml)); using (Stream s = File.OpenWrite("opml.txt")) { ser.Serialize(s, opml); } }
/// <summary> /// Provides example code for the OpmlDocument class. /// </summary> public static void ClassExample() { OpmlDocument document = new OpmlDocument(); document.Head.Title = "Example OPML List"; document.Head.CreatedOn = new DateTime(2005, 6, 18, 12, 11, 52); document.Head.ModifiedOn = new DateTime(2005, 7, 2, 21, 42, 48); document.Head.Owner = new OpmlOwner("John Doe", "*****@*****.**"); document.Head.VerticalScrollState = 1; document.Head.Window = new OpmlWindow(61, 304, 562, 842); OpmlOutline containerOutline = new OpmlOutline("Feeds"); containerOutline.Outlines.Add(OpmlOutline.CreateSubscriptionListOutline("Argotic", "rss", new Uri("http://www.codeplex.com/Argotic/Project/ProjectRss.aspx"))); containerOutline.Outlines.Add(OpmlOutline.CreateSubscriptionListOutline("Google News", "feed", new Uri("http://news.google.com/?output=atom"))); document.AddOutline(containerOutline); }
private void blogRollGrid_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { OpmlOutline row = outlineCollection[e.Item.DataSetIndex]; EditBlogRollEditItem item = ((EditBlogRollEditItem)e.Item.FindControl("nestedEdit").Controls[0]); row.description = item.Description; row.title = item.Title; row.htmlUrl = item.HtmlUrl; row.xmlUrl = item.XmlUrl; StoreEditItemIndexInViewState(blogRollGrid.EditItemIndex = -1); OpmlOutline[] sortedOutlines = outlineCollection.ToArraySortedByTitle(); for (int newIndex = 0; newIndex < sortedOutlines.Length; newIndex++) { if (row == sortedOutlines[newIndex]) { StoreCurrentPageIndexInViewState(blogRollGrid.CurrentPageIndex = newIndex / blogRollGrid.PageSize); break; } } Bind(); }
private void blogRollGrid_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { if (e.Item.DataSetIndex != -1 && e.Item.DataSetIndex == blogRollGrid.EditItemIndex) { EditBlogRollEditItem nestedEdit = Page.LoadControl("EditBlogRollEditItem.ascx") as EditBlogRollEditItem; nestedEdit.ID = "innerEditor"; e.Item.FindControl("nestedEdit").Controls.Add(nestedEdit); if (enteringEditMode) { // if we're just entering an editing session, make sure that // the inner item's view state gets wiped, in case there's some // state remembered for a control at this place already. nestedEdit.StoreEditItemIndexInViewState(-1); } OpmlOutline outline = outlineCollection[e.Item.DataSetIndex]; nestedEdit.Description = outline.description; nestedEdit.Title = outline.title; nestedEdit.XmlUrl = outline.xmlUrl; nestedEdit.HtmlUrl = outline.htmlUrl; nestedEdit.Outline = outline.outline; } }
private void blogRollGrid_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { if ( e.CommandName == "AddItem" ) { OpmlOutline newEntry = new OpmlOutline(); newEntry.title = resmgr.GetString("text_new_entry"); opmlTree.body.outline.Insert(0,newEntry); blogRollGrid.EditItemIndex = 0; blogRollGrid.CurrentPageIndex = 0; blogRollGrid.DataBind(); } }
internal static OpmlOutline ParseXml(XmlElement node) { var newOutline = new OpmlOutline(); newOutline.Text = ParseElement(node, "text"); newOutline.Type = ParseElement(node, "type"); newOutline.IsComment = (ParseElement(node, "isComment") == "true" ? true : false); newOutline.IsBreakpoint = (ParseElement(node, "isBreakpoint") == "true" ? true : false); try { newOutline.Created = DateTime.Parse(ParseElement(node, "created")); } catch (Exception ex) { DnnLog.Error(ex); } newOutline.Category = ParseElement(node, "category"); try { newOutline.XmlUrl = new Uri(ParseElement(node, "xmlUrl")); } catch (Exception ex) { DnnLog.Error(ex); } try { newOutline.HtmlUrl = new Uri(ParseElement(node, "htmlUrl")); } catch (Exception ex) { DnnLog.Error(ex); } newOutline.Language = ParseElement(node, "language"); newOutline.Title = ParseElement(node, "title"); try { newOutline.Url = new Uri(ParseElement(node, "url")); } catch (Exception ex) { DnnLog.Error(ex); } newOutline.Description = ParseElement(node, "description"); if (node.HasChildNodes) { foreach (XmlElement childNode in node.SelectNodes("./outline")) { newOutline.Outlines.Add(ParseXml(childNode)); } } return newOutline; }
public void AddOutline(string text, string type, Uri xmlUrl, string category, OpmlOutlines outlines) { var item = new OpmlOutline(); item.Text = text; item.Type = type; item.XmlUrl = xmlUrl; item.Category = category; item.Outlines = outlines; _outlines.Add(item); }
public void AddOutline(OpmlOutline item) { _outlines.Add(item); }
private void buttonAddItem_Click(object sender, System.Web.UI.ImageClickEventArgs e) { OpmlOutline newEntry = new OpmlOutline(); newEntry.title = "New Entry"; outlineCollection.Insert(0,newEntry); StoreEditItemIndexInViewState(blogRollGrid.EditItemIndex = 0); StoreCurrentPageIndexInViewState( blogRollGrid.CurrentPageIndex = 0 ); Bind(); }