Beispiel #1
0
        public async Task <string> LoadHtmlFileTemplate(CdnFileSelect request)
        {
            var downloadInfo = await MongoCdn_Download(request);

            if (downloadInfo != null)
            {
                return(System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(downloadInfo.FileContentBase64)));
            }

            return(string.Empty);
        }
        public async Task <bool> MongoCdn_DeleteFiles(CdnFileSelect request)
        {
            bool result        = true;
            var  selectedFiles = Select(request.SourceType, request.SourceId, request.FileId);

            foreach (var _file in selectedFiles)
            {
                result &= await MongoCdn_DeleteFile(_file.FileId);
            }

            return(result);
        }
Beispiel #3
0
        public async Task <CdnDownloadResult> MongoCdn_Download(CdnFileSelect request, CdnFileSelect.PostProcess postProcess = CdnFileSelect.PostProcess.None)
        {
            string fileId   = request.FileId;
            string title    = String.Empty;
            var    fileItem = Select(request.SourceType, request.SourceId, request.FileId).FirstOrDefault();

            if (fileItem == null)
            {
                return(null);
            }
            title = fileItem.Title;


            CdnDownloadResult downloadInfo = await GetFileById(fileItem, postProcess);

            downloadInfo.FileTitle = title;

            return(downloadInfo);
        }
Beispiel #4
0
        public async Task <CdnDownloadResult> MongoCdn_Download(CdnFileSelect request)
        {
            string fileId = request.FileId;
            string title  = String.Empty;

            if (string.IsNullOrEmpty(fileId))
            {
                var file = Select(request.SourceType, request.SourceId).FirstOrDefault();

                if (file == null)
                {
                    return(null);
                }

                fileId = file.FileId;
                title  = file.Title;
            }

            CdnDownloadResult downloadInfo = await GetFileById(fileId);

            downloadInfo.FileTitle = title;

            return(downloadInfo);
        }