/// <summary> /// Carga un archivo OPML sobre la carpeta actual /// </summary> internal void Load(BlogReaderManager manager, string fileName) { if (System.IO.File.Exists(fileName)) { try { OPMLChannel channel = new OPMLParser().Parse(fileName); string title = channel.Title; // Obtiene el título de la carpeta if (string.IsNullOrWhiteSpace(title)) { title = "Opml"; } // Añade las entradas if (channel.Entries.Count > 0) { AddEntries(manager.File.Folders.Add(title), channel.Entries); } } catch (Exception exception) { System.Diagnostics.Debug.WriteLine("Excepción: " + exception.Message); } } }
/// <summary> /// Graba un archivo OPML con los datos actuales /// </summary> internal void Save(BlogReaderManager manager, string fileName) { OPMLChannel channel = new OPMLChannel(); // Asigna las propiedades channel.Title = "Archivo creado con Bau Studio"; // Añade las carpetas foreach (Model.FolderModel folder in manager.File.Folders) { AddFolder(folder, channel.Entries); } // Añade los blogs foreach (Model.BlogModel blog in manager.File.Blogs) { AddBlog(blog, channel.Entries); } // Graba el archivo LibHelper.Files.HelperFiles.MakePath(System.IO.Path.GetDirectoryName(fileName)); new OPMLWriter().Save(channel, fileName); }
public RssDownload(BlogReaderManager blogManager) { _blogManager = blogManager; }