/// <summary> /// Converts an object into its XML representation. /// </summary> /// <param name="writer">The <see cref="T:System.Xml.XmlWriter"/> stream to which the object is serialized. /// </param> public void WriteXml(XmlWriter writer) { Assembly me = System.Reflection.Assembly.GetExecutingAssembly(); AssemblyName name = me.GetName(); writer.WriteComment(string.Format(CultureInfo.InvariantCulture, "Written by PodcastUtilities.Common v{0}", name.Version)); writer.WriteStartElement("global"); if (SourceRoot != null) { writer.WriteElementString("sourceRoot", SourceRoot); } if (DestinationRoot != null) { writer.WriteElementString("destinationRoot", DestinationRoot); } if (PlaylistFileName != null) { writer.WriteElementString("playlistFilename", PlaylistFileName); } writer.WriteElementString("playlistFormat", WritePlaylistFormat(PlaylistFormat)); writer.WriteElementString("playlistPathSeparator", PlaylistPathSeparator); writer.WriteElementString("freeSpaceToLeaveOnDestinationMB", FreeSpaceToLeaveOnDestination.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("freeSpaceToLeaveOnDownloadMB", FreeSpaceToLeaveOnDownload.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("maximumNumberOfConcurrentDownloads", MaximumNumberOfConcurrentDownloads.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("retryWaitInSeconds", RetryWaitInSeconds.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("number", DefaultNumberOfFiles.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("pattern", DefaultFilePattern); writer.WriteElementString("deleteEmptyFolder", DefaultDeleteEmptyFolder.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("sortfield", PodcastInfo.WriteSortField(DefaultSortField)); writer.WriteElementString("sortdirection", PodcastInfo.WriteSortDirection(DefaultAscendingSort)); writer.WriteElementString("postdownloadcommand", DefaultPostDownloadCommand); writer.WriteStartElement("feed"); writer.WriteElementString("maximumDaysOld", DefaultFeedMaximumDaysOld.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("deleteDownloadsDaysOld", DefaultFeedDeleteDownloadsDaysOld.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("format", FeedInfo.WriteFeedFormat(DefaultFeedFormat)); writer.WriteElementString("namingStyle", FeedInfo.WriteFeedEpisodeNamingStyle(DefaultFeedEpisodeNamingStyle)); writer.WriteElementString("downloadStrategy", FeedInfo.WriteFeedEpisodeDownloadStrategy(DefaultFeedEpisodeDownloadStrategy)); writer.WriteEndElement(); writer.WriteStartElement("diagnostics"); writer.WriteElementString("retainTempFiles", WriteDiagnosticRetainTemporaryFiles(DiagnosticRetainTemporaryFiles)); writer.WriteElementString("outputLevel", WriteDiagnosticOutputLevel(DiagnosticOutput)); writer.WriteEndElement(); writer.WriteStartElement("postdownloadcommand"); writer.WriteElementString("command", DefaultPostDownloadCommand); writer.WriteElementString("arguments", DefaultPostDownloadArguments); writer.WriteElementString("workingdirectory", DefaultPostDownloadWorkingDirectory); writer.WriteEndElement(); writer.WriteEndElement(); foreach (var podcastInfo in Podcasts) { // simulate the behaviour of XmlSerialisation writer.WriteStartElement("podcast"); podcastInfo.WriteXml(writer); writer.WriteEndElement(); } }
/// <summary> /// remove a feed from the podcast /// </summary> public void RemoveFeed() { Feed = new FeedInfo(_controlFileGlobalDefaults); }