Exemple #1
0
        public void Import(Models.Site site, System.IO.Stream zipStream, bool @override)
        {
            List <string> htmlBlocks = new List <string>();

            using (ZipFile zipFile = ZipFile.Read(zipStream))
            {
                foreach (ZipEntry item in zipFile)
                {
                    if (item.IsDirectory)
                    {
                        htmlBlocks.Add(item.FileName.Trim('/'));
                    }
                    else
                    {
                    }
                }
            }
            zipStream.Position = 0;

            var fileProvider = new Kooboo.CMS.Sites.Persistence.FileSystem.HtmlBlockProvider();

            fileProvider.Import(site, zipStream, @override);


            foreach (var item in htmlBlocks)
            {
                var htmlBlock = fileProvider.Get(new HtmlBlock(site, item));
                this.Add(htmlBlock);
            }
        }
Exemple #2
0
        public void InitializeHtmlBlocks(Site site)
        {
            IHtmlBlockProvider fileHtmlProvider = new Kooboo.CMS.Sites.Persistence.FileSystem.HtmlBlockProvider();

            foreach (var item in fileHtmlProvider.All(site))
            {
                if (item.Site == site)
                {
                    this.Add(fileHtmlProvider.Get(item));
                }
            }
        }
Exemple #3
0
 public void InitializeToDB(Site site)
 {
     IHtmlBlockProvider fileHtmlProvider = new Kooboo.CMS.Sites.Persistence.FileSystem.HtmlBlockProvider();
     foreach (var item in fileHtmlProvider.All(site))
     {
         if (item.Site == site)
         {
             this.Add(fileHtmlProvider.Get(item));
         }
     }
 }
Exemple #4
0
        public void Import(Models.Site site, System.IO.Stream zipStream, bool @override)
        {
            List<string> htmlBlocks = new List<string>();
            using (ZipFile zipFile = ZipFile.Read(zipStream))
            {
                foreach (ZipEntry item in zipFile)
                {
                    if (item.IsDirectory)
                    {
                        htmlBlocks.Add(item.FileName.Trim('/'));
                    }
                    else
                    {
                    }
                }
            }
            zipStream.Position = 0;

            var fileProvider = new Kooboo.CMS.Sites.Persistence.FileSystem.HtmlBlockProvider();

            fileProvider.Import(site, zipStream, @override);

            foreach (var item in htmlBlocks)
            {
                var htmlBlock = fileProvider.Get(new HtmlBlock(site, item));
                this.Add(htmlBlock);
            }
        }