Ejemplo n.º 1
0
        /// <summary>
        ///		Añade las entradas OPML a las categorías
        /// </summary>
        private void AddOpmlEntries(DesktopFilesChannel channel, DesktopFilesEntry parent,
                                    Data.OPMLEntriesCollection opmlEntries)
        {
            foreach (Data.OPMLEntry channelEntry in opmlEntries)
            {
                DesktopFilesEntry entry = new DesktopFilesEntry();

                // Asigna las propiedades
                entry.Text = channelEntry.Title;
                if (string.IsNullOrEmpty(entry.Text))
                {
                    entry.Text = channelEntry.Text;
                }
                entry.URL           = channelEntry.URL;
                entry.NumberNotRead = 0;
                // Añade la entrada
                if (parent == null)
                {
                    channel.Entries.Add(entry);
                }
                else
                {
                    parent.Entries.Add(entry);
                }
                // Añade las entradas OPML hijas
                AddOpmlEntries(channel, entry, channelEntry.Entries);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///		Interpreta una entrada a partir de un nodo XML
        /// </summary>
        private DesktopFilesEntry ParseEntry(MLNode node)
        {
            DesktopFilesEntry entry = new DesktopFilesEntry();

            // Lee los atributos
            entry.Text            = node.Attributes[DesktopFilesConstTags.cnsttext].Value;
            entry.LocalFileName   = node.Attributes[DesktopFilesConstTags.cnstfileName].Value;
            entry.NumberNotRead   = node.Attributes[DesktopFilesConstTags.cnstStrNotRead].Value.GetInt(0);
            entry.Enabled         = node.Attributes[DesktopFilesConstTags.cnstStrEnabled].Value.GetBool(true);
            entry.URL             = node.Attributes[DesktopFilesConstTags.cnsturl].Value;
            entry.User            = node.Attributes[DesktopFilesConstTags.cnstuser].Value;
            entry.Password        = node.Attributes[DesktopFilesConstTags.cnstpassword].Value;
            entry.DateCreated     = node.Attributes[DesktopFilesConstTags.cnstStrCreated].Value.GetDateTime(DateTime.Now);
            entry.DateLastRead    = node.Attributes[DesktopFilesConstTags.cnstStrLastRead].Value.GetDateTime(DateTime.MinValue);
            entry.DateLastUpdated = node.Attributes[DesktopFilesConstTags.cnstStrLastUpdate].Value.GetDateTime(DateTime.Now);
            // Lee las entradas
            foreach (MLNode child in node.Nodes)
            {
                if (child.Name == DesktopFilesConstTags.cnstStrOutline)
                {
                    entry.Entries.Add(ParseEntry(child));
                }
            }
            // Devuelve la entrada
            return(entry);
        }