public SitemapIndex GenerateSitemapIndex(List <SitemapInfo> sitemaps, DirectoryInfo targetDirectory, string targetSitemapFileName)
        {
            var sitemapIndex = new SitemapIndex(sitemaps);

            _serializedXmlSaver.SerializeAndSave(sitemapIndex, targetDirectory, targetSitemapFileName);
            return(sitemapIndex);
        }
        private List <FileInfo> SaveSitemaps(DirectoryInfo targetDirectory, string sitemapBaseFileNameWithoutExtension, List <Sitemap> sitemaps)
        {
            var sitemapFileInfos = new List <FileInfo>();

            for (var i = 0; i < sitemaps.Count; i++)
            {
                var fileName = $"{sitemapBaseFileNameWithoutExtension}-00{i + 1}.xml";
                sitemapFileInfos.Add(_serializedXmlSaver.SerializeAndSave(sitemaps[i], targetDirectory, fileName));
            }
            return(sitemapFileInfos);
        }
Exemple #3
0
        private List <FileInfo> SaveSitemaps(DirectoryInfo targetDirectory, string sitemapBaseFileNameWithoutExtension, IReadOnlyList <Sitemap> sitemaps)
        {
            var files = new List <FileInfo>();

            for (var i = 0; i < sitemaps.Count; i++)
            {
                var fileName = $"{sitemapBaseFileNameWithoutExtension}-{(i+1).ToString("000")}.xml";
                files.Add(_serializedXmlSaver.SerializeAndSave(sitemaps[i], targetDirectory, fileName));
            }

            return(files);
        }
Exemple #4
0
        private void SaveSitemaps(DirectoryInfo targetDirectory, string sitemapBaseFileNameWithoutExtension, Sitemap sitemap)
        {
            var fileName = $"{sitemapBaseFileNameWithoutExtension}.xml";

            _serializedXmlSaver.SerializeAndSave(sitemap, targetDirectory, fileName);
        }