/// <summary> /// Crea una entrada /// </summary> private OPMLEntry CreateEntry(string name, string type, string description, string url) { OPMLEntry entry = new OPMLEntry(); // Asigna las propiedades entry.Text = name; entry.Type = type; entry.Title = description; entry.URL = url; // Devuelve la entrada return(entry); }
/// <summary> /// Añade una carpeta a la colección de entrada /// </summary> private void AddFolder(Model.FolderModel folder, OPMLEntriesCollection entries) { OPMLEntry entry = CreateEntry(folder.Name, "Folder", null, null); // Añade la entrada a la colección entries.Add(entry); // Añade las carpetas foreach (Model.FolderModel child in folder.Folders) { AddFolder(child, entry.Entries); } // Añade los blogs foreach (Model.BlogModel blog in folder.Blogs) { AddBlog(blog, entry.Entries); } }
/// <summary> /// Interpreta una entrada a partir de un nodo XML /// </summary> private OPMLEntry ParseEntry(MLNode node) { OPMLEntry entry = new OPMLEntry(); // Lee los atributos entry.Type = node.Attributes[OPMLConstTags.cnsttype].Value; entry.Title = node.Attributes[OPMLConstTags.cnsttitleEntry].Value; entry.Text = node.Attributes[OPMLConstTags.cnsttext].Value; entry.URL = node.Attributes[OPMLConstTags.cnsturl].Value; if (string.IsNullOrEmpty(entry.URL)) { entry.URL = node.Attributes[OPMLConstTags.cnstStrXMLUrl].Value; } entry.DateCreated = node.Attributes[OPMLConstTags.cnstStrCreated].Value.GetDateTime(DateTime.Now); // Lee las entradas ParseEntries(node.Nodes, entry.Entries); // Devuelve la entrada return(entry); }