//public ContainerBase AdamOfField { get; set; } public FolderOfField(AdamAppContext <TFolderId, TFileId> adamContext, Guid entityGuid, string fieldName) : base(adamContext) { var adamOfField = new AdamOfField <TFolderId, TFileId>(AdamContext, entityGuid, fieldName); if (!AdamContext.Exists(adamOfField.Root)) { return; } var f = AdamContext.Folder(adamOfField.Root); if (f == null) { return; } Path = f.Path; Modified = f.Modified; SysId = f.SysId; Created = f.Created; Modified = f.Modified; // IAdamItem interface properties Name = f.Name; Url = f.Url; }
private static File DnnToAdam(AdamAppContext appContext, IFileInfo f) => new File(appContext) { FullName = f.FileName, Extension = f.Extension, Size = f.Size, Id = f.FileId, Folder = f.Folder, FolderId = f.FolderId, Path = f.RelativePath, Created = f.CreatedOnDate, Name = System.IO.Path.GetFileNameWithoutExtension(f.FileName) // commented out stuff is from DNN // but it will probably never be cross-platform //UniqueId = f.UniqueId, //VersionGuid = f.VersionGuid, //PortalId = f.PortalId, //Width = f.Width, //Height = f.Height, //ContentType = f.ContentType, //StorageLocation = f.StorageLocation, //IsCached = f.IsCached, //SHA1Hash = f.SHA1Hash, };
/// <summary> /// Get the first metadata entity of an item - or return a fake one instead /// </summary> internal static IDynamicEntity GetFirstOrFake(AdamAppContext appContext, int id, bool isFolder) { var meta = GetFirstMetadata(appContext.AppRuntime, id, isFolder) ?? Build.FakeEntity(Eav.Constants.TransientAppId); return(new DynamicEntity(meta, new[] { Thread.CurrentThread.CurrentCulture.Name }, appContext.CompatibilityLevel, appContext.BlockBuilder)); }
private Folder DnnToAdam(AdamAppContext appContext, IFolderInfo f) => new Folder(appContext, this) { Path = f.FolderPath, Id = f.FolderID, Name = f.DisplayName, Created = f.CreatedOnDate, Modified = f.LastUpdated, // commented out stuff is from DNN // but it will probably never be cross-platform //DisplayName = f.DisplayName, //DisplayPath = f.DisplayPath, //PortalID = f.PortalID, //MappedPath = f.MappedPath, //StorageLocation = f.StorageLocation, //IsProtected = f.IsProtected, //IsCached = f.IsCached, //FolderMappingID = f.FolderMappingID, //IsVersioned = f.IsVersioned, //KeyID = (f as FolderInfo)?.KeyID ?? 0, //ParentID = f.ParentID, //UniqueId = f.UniqueId, //VersionGuid = f.VersionGuid, //WorkflowID = f.WorkflowID, };
private List <Folder> GetFolders(IFolderInfo fldObj, AdamAppContext appContext = null) { var firstList = _folderManager.GetFolders(fldObj); var folders = firstList?.Select(f => DnnToAdam(appContext, f)).ToList() ?? new List <Folder>(); return(folders); }
public List <File> GetFiles(int folderId, AdamAppContext appContext) { var fldObj = _folderManager.GetFolder(folderId); var firstList = _folderManager.GetFiles(fldObj); var files = firstList?.Select(f => DnnToAdam(appContext, f)).ToList() ?? new List <File>(); return(files); }
private Folder DnnToAdam(AdamAppContext appContext, IFolderInfo f) => new Folder(appContext, this) { Path = f.FolderPath, Id = f.FolderID, Name = f.DisplayName, Created = f.CreatedOnDate, Modified = f.LastUpdated, // note: there are more properties in the DNN data, but we don't use it, // because it will probably never be cross-platform };
/// <summary> /// Get the first metadata entity of an item - or return a fake one instead /// </summary> internal IDynamicEntity GetFirstOrFake(AdamAppContext appContext, MetadataFor mdId) { var meta = GetFirstMetadata(appContext.AppRuntime, mdId) ?? Build.FakeEntity(Eav.Constants.TransientAppId); var dynEnt = new DynamicEntity(meta, (appContext.AppContext?.Site).SafeLanguagePriorityCodes(), appContext.CompatibilityLevel, null) { ServiceProviderOrNull = _serviceProvider }; return(dynEnt); }
public List <File> GetFiles(int folderId, AdamAppContext appContext) { var fldObj = _folderManager.GetFolder(folderId); // sometimes the folder doesn't exist for whatever reason if (fldObj == null) { return(new List <File>()); } // try to find the files var firstList = _folderManager.GetFiles(fldObj); var files = firstList?.Select(f => DnnToAdam(appContext, f)).ToList() ?? new List <File>(); return(files); }
private static File DnnToAdam(AdamAppContext appContext, IFileInfo f) => new File(appContext) { FullName = f.FileName, Extension = f.Extension, Size = f.Size, Id = f.FileId, Folder = f.Folder, FolderId = f.FolderId, Path = f.RelativePath, Created = f.CreatedOnDate, Name = System.IO.Path.GetFileNameWithoutExtension(f.FileName) // note: there are more properties in the DNN data, but we don't use it, // because it will probably never be cross-platform };
public FolderOfField(IEnvironmentFileSystem enfFileSystem, AdamAppContext appContext, Guid entityGuid, string fieldName) : base(appContext, enfFileSystem) { Container = new ContainerOfField(AppContext, entityGuid, fieldName); if (!Exists) { return; } // ReSharper disable once PatternAlwaysOfType if (!(AppContext.Folder(Container.Root) is Eav.Apps.Assets.Folder f)) { return; } Path = f.Path; Modified = f.Modified; Id = f.Id; Created = f.Created; Modified = f.Modified; // IAdamItem interface properties Name = f.Name; }
public ContainerOfField(AdamAppContext appContext, Guid eGuid, string fName) : base(appContext) { _entityGuid = eGuid; _fieldName = fName; }
public Folder(AdamAppContext <TFolderId, TFileId> adamContext) { AdamContext = adamContext; }
public File(AdamAppContext appContext) { AppContext = appContext; }
public Folder(AdamAppContext appContext, IEnvironmentFileSystem fileSystem) { AppContext = appContext; _fileSystem = fileSystem; }
public Export(AdamAppContext adm) { _root = adm.RootFolder; _envFs = adm.EnvironmentFs; }
public Export(AdamAppContext <TFolderId, TFileId> adm) { _root = adm.RootFolder; _envFs = adm.AdamFs; }
public AdamOfField(AdamAppContext <TFolderId, TFileId> appContext, Guid eGuid, string fName) : base(appContext) { _entityGuid = eGuid; _fieldName = fName; }
public File(AdamAppContext adamContext) { AdamContext = adamContext; }
/// <summary> /// Get the first metadata entity of an item - or return a fake one instead /// </summary> internal static DynamicEntity GetFirstOrFake(AdamAppContext appContext, int id, bool isFolder) { var meta = GetFirstMetadata(appContext.App, id, isFolder) ?? CreateFakeMetadata(); return(new DynamicEntity(meta, new[] { Thread.CurrentThread.CurrentCulture.Name }, appContext.SxcInstance)); }
public Eav.Apps.Assets.Folder Get(int tenantId, string path, AdamAppContext appContext) => DnnToAdam(appContext, _folderManager.GetFolder(tenantId, path));
public List <Folder> GetFolders(int folderId, AdamAppContext appContext) => GetFolders(GetFolder(folderId), appContext);
public static int GetMetadataId(AdamAppContext appContext, int id, bool isFolder) => GetFirstMetadata(appContext.App, id, isFolder)?.EntityId ?? 0;
protected ContainerBase(AdamAppContext appContext) { AppContext = appContext; }