private static IEnumerable <T> AllInternal <T>(Site site) where T : PathResource, IInheritable <T>, IPersistable { string baseDir = ModelActivatorFactory <T> .GetActivator().CreateDummy(site).BasePhysicalPath; if (Directory.Exists(baseDir)) { foreach (var dir in IO.IOUtility.EnumerateDirectoriesExludeHidden(baseDir).Where(it => !it.Name.EqualsOrNullEmpty("~versions", StringComparison.OrdinalIgnoreCase))) { var o = ModelActivatorFactory <T> .GetActivator().Create(dir.FullName); if (o is IFilePersistable) { if (!File.Exists(((IFilePersistable)o).DataFile)) { continue; } } // The provider used in AsActual is possibly different with the current provider. // the AsActual method is not recommended used in Provider level. //if (o.AsActual() == null) //{ // continue; //} yield return(o); } } }
public void Import(Site site, System.IO.Stream zipStream, bool @override) { GetLocker().EnterWriteLock(); try { var destDir = ModelActivatorFactory <T> .GetActivator().CreateDummy(site).BasePhysicalPath; ImportHelper.Import(site, destDir, zipStream, @override); } finally { GetLocker().ExitWriteLock(); } }
public IEnumerable <Models.Page> ChildPagesEnumerable(Models.Page parentPage) { List <Page> list = new List <Page>(); if (parentPage.Exists()) { string baseDir = parentPage.PhysicalPath; foreach (var dir in IO.IOUtility.EnumerateDirectoriesExludeHidden(baseDir).Where(it => !it.Name.EqualsOrNullEmpty("~versions", StringComparison.OrdinalIgnoreCase))) { var page = ModelActivatorFactory <Page> .GetActivator().Create(dir.FullName); if (File.Exists(page.DataFile)) { list.Add(page); } } } return(list); }
private static IEnumerable <T> AllInternal <T>(Site site) where T : PathResource, IInheritable <T> { string baseDir = ModelActivatorFactory <T> .GetActivator().CreateDummy(site).BasePhysicalPath; if (Directory.Exists(baseDir)) { foreach (var dir in IO.IOUtility.EnumerateDirectoriesExludeHidden(baseDir).Where(it => !it.Name.EqualsOrNullEmpty("~versions", StringComparison.OrdinalIgnoreCase))) { var o = ModelActivatorFactory <T> .GetActivator().Create(dir.FullName); if (o is IFilePersistable) { if (!File.Exists(((IFilePersistable)o).DataFile)) { continue; } } yield return(o); } } }
private string GetScriptBasePath(Site site) { ScriptFile dummy = ModelActivatorFactory <ScriptFile> .GetActivator().CreateDummy(site); return(dummy.BasePhysicalPath); }