示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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();
        }