Exemple #1
0
        public Task DeleteMedia(string name)
        {
            string path = ResolvePath(name);

            FileHelpers.DeleteFile(new string[] { path });

            if (EnableThumbnailGeneration)
            {
                //  Delete thumbnail
                ThumbnailGenerator.Destroy(name);
            }

            return(Task.FromResult(0));
        }
Exemple #2
0
        public async Task <SaveMediaResponse> UpdateMedia(string originalName, string newName, string mimeType, Stream stream)
        {
            string path = ResolvePath(originalName);

            if (File.Exists(path))
            {
                //  Remove this file
                FileHelpers.DeleteFile(new string[] { path });

                //
                if (EnableThumbnailGeneration)
                {
                    ThumbnailGenerator.Destroy(originalName);
                }

                return(await SaveMedia(newName, mimeType, stream));
            }
            else
            {
                return(await SaveMedia(originalName, mimeType, stream));
            }
        }