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); } }
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)); } } }
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)); } } }
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); } }