private ProcessorResult ProcessGlobalElements(XmlReader reader)
        {
            var result = ProcessorResult.Processed;

            var elementName = reader.LocalName;

            if (elementName == "feed")
            {
                XmlSerializationHelper.ProcessElement(reader, "feed", ProcessGlobalFeedElements);
                return(result);
            }
            if (elementName == "postdownloadcommand")
            {
                XmlSerializationHelper.ProcessElement(reader, "postdownloadcommand", ProcessGlobalPostDownloadCommandElements);
                return(result);
            }
            if (elementName == "diagnostics")
            {
                XmlSerializationHelper.ProcessElement(reader, "diagnostics", ProcessGlobalDiagnosticsElements);
                return(result);
            }

            if (!reader.IsEmptyElement)
            {
                reader.Read();
            }
            var content = reader.Value.Trim();

            long longValue;
            int  intValue;
            bool boolValue;

            switch (elementName)
            {
            case "sourceRoot":
                SourceRoot = content;
                break;

            case "destinationRoot":
                DestinationRoot = content;
                break;

            case "playlistFilename":
                PlaylistFileName = content;
                break;

            case "playlistFormat":
                PlaylistFormat = ReadPlaylistFormat(content);
                break;

            case "playlistPathSeparator":
                PlaylistPathSeparator = content;
                break;

            case "freeSpaceToLeaveOnDestinationMB":
                if (long.TryParse(content, NumberStyles.Integer, CultureInfo.InvariantCulture, out longValue))
                {
                    FreeSpaceToLeaveOnDestination = longValue;
                }
                break;

            case "freeSpaceToLeaveOnDownloadMB":
                if (long.TryParse(content, NumberStyles.Integer, CultureInfo.InvariantCulture, out longValue))
                {
                    FreeSpaceToLeaveOnDownload = longValue;
                }
                break;

            case "maximumNumberOfConcurrentDownloads":
                if (int.TryParse(content, NumberStyles.Integer, CultureInfo.InvariantCulture, out intValue))
                {
                    MaximumNumberOfConcurrentDownloads = intValue;
                }
                break;

            case "retryWaitInSeconds":
                if (int.TryParse(content, NumberStyles.Integer, CultureInfo.InvariantCulture, out intValue))
                {
                    RetryWaitInSeconds = intValue;
                }
                break;

            case "number":
                if (int.TryParse(content, NumberStyles.Integer, CultureInfo.InvariantCulture, out intValue))
                {
                    DefaultNumberOfFiles = intValue;
                }
                break;

            case "pattern":
                if (!string.IsNullOrEmpty(content))
                {
                    DefaultFilePattern = content;
                }
                break;

            case "deleteEmptyFolder":
                if (bool.TryParse(content, out boolValue))
                {
                    DefaultDeleteEmptyFolder = boolValue;
                }
                break;

            case "sortfield":
                DefaultSortField = PodcastInfo.ReadSortField(content);
                break;

            case "sortdirection":
                DefaultAscendingSort = PodcastInfo.ReadSortDirection(content);
                break;

            default:
                result = ProcessorResult.Ignored;
                break;
            }
            return(result);
        }
 /// <summary>
 /// Generates an object from its XML representation.
 /// </summary>
 /// <param name="reader">The <see cref="T:System.Xml.XmlReader"/> stream from which the object is deserialized.
 ///                 </param>
 public void ReadXml(XmlReader reader)
 {
     SetHardcodedDefaults();
     XmlSerializationHelper.ProcessElement(reader, "podcasts", ProcessPodcastsElements);
 }
Пример #3
0
 /// <summary>
 /// Generates an object from its XML representation.
 /// </summary>
 /// <param name="reader">The <see cref="T:System.Xml.XmlReader"/> stream from which the object is deserialized.
 ///                 </param>
 public void ReadXml(XmlReader reader)
 {
     XmlSerializationHelper.ProcessElement(reader, "feed", ProcessFeedElements);
 }
 /// <summary>
 /// Generates an object from its XML representation.
 /// </summary>
 /// <param name="reader">The <see cref="T:System.Xml.XmlReader"/> stream from which the object is deserialized.
 ///                 </param>
 public void ReadXml(XmlReader reader)
 {
     XmlSerializationHelper.ProcessElement(reader, "postdownloadcommand", ProcessTokenisedCommandElements);
 }
Пример #5
0
 /// <summary>
 /// Generates an object from its XML representation.
 /// </summary>
 /// <param name="reader">The <see cref="T:System.Xml.XmlReader"/> stream from which the object is deserialized.
 ///                 </param>
 public void ReadXml(XmlReader reader)
 {
     XmlSerializationHelper.ProcessElement(reader, "podcast", ProcessPodcastElements);
 }