Пример #1
0
        public void Export(IProgress <double> progress = null)
        {
            Release[] releases = this.collectionManager.Releases.ToArray();

            double processed = 0;
            double total     = releases.Length;

            foreach (Release release in releases)
            {
                string entryName = "Releases\\" + FilenameGenerator.FixFilename(release.JoinedAlbumArtists + " - " + release.Title) + ".xml";

                foreach (Stream stream in this.GetEntryOutputStream(entryName, release.DateModified, release))
                {
                    XmlWriterSettings writerSettings = new XmlWriterSettings()
                    {
                        ConformanceLevel = ConformanceLevel.Document,
                        Indent           = true
                    };
                    using (XmlWriter writer = XmlTextWriter.Create(stream, writerSettings))
                    {
                        this.ExportRelease(writer, release);
                    }
                }

                if (progress != null)
                {
                    ++processed;
                    progress.Report(processed / total);
                }
            }
        }