protected override IMedia AddMediaFromPath(string fullPath, DateTime lastUpdated) { if (!AcceptFile(fullPath)) { return(null); } if (FindMediaFirstByFullPath(fullPath) is AnimatedMedia newMedia) { return(newMedia); } var relativeName = fullPath.Substring(Folder.Length); var fileName = Path.GetFileName(relativeName); newMedia = new AnimatedMedia { MediaName = FileUtils.GetFileNameWithoutExtension(fullPath, TMediaType.Animation).ToUpper(), LastUpdated = lastUpdated, MediaType = TMediaType.Animation, MediaGuid = Guid.NewGuid(), FileName = Path.GetFileName(relativeName), Folder = relativeName.Substring(0, relativeName.Length - fileName.Length).Trim(PathSeparator), MediaStatus = TMediaStatus.Available, IsVerified = true }; AddMedia(newMedia); newMedia.Save(); return(newMedia); }
public IAnimatedMedia CloneMedia(IAnimatedMedia source, Guid newMediaGuid) { var result = new AnimatedMedia(this, newMediaGuid, 0); result.Folder = source.Folder; result.FileName = source.FileName; result.CloneMediaProperties(source); result.MediaStatus = source.MediaStatus; result.LastUpdated = DateTime.UtcNow; result.Save(); return(result); }
public void CloneMedia(IAnimatedMedia source, Guid newMediaGuid) { var result = new AnimatedMedia { LastUpdated = source.LastUpdated, MediaGuid = newMediaGuid == Guid.Empty ? source.MediaGuid : newMediaGuid, Folder = source.Folder, FileName = source.FileName, Directory = this }; result.CloneMediaProperties(source); result.MediaStatus = source.MediaStatus; result.LastUpdated = DateTime.UtcNow; AddMedia(result); result.Save(); }
internal void OnMediaSaved(AnimatedMedia animatedMedia) { MediaSaved?.Invoke(this, new MediaEventArgs(animatedMedia)); }