Пример #1
0
        /// <summary>
        /// Loads a picture from file
        /// </summary>
        /// <param name="pictureId">Picture identifier</param>
        /// <param name="mimeType">MIME type</param>
        /// <returns>Picture binary</returns>
        public virtual byte[] LoadPictureFromFile(int pictureId, string mimeType)
        {
            var lastPart = GetFileExtensionFromMimeType(mimeType);
            var fileName = $"{pictureId:0000000}_0.{lastPart}";
            var filePath = GetPictureLocalPath(fileName);

            return(_fileProvider.ReadAllBytes(filePath));
        }
Пример #2
0
        public (byte[] fileBinary, string filePath, string fileName) GetTempFile(string fileName, string folder)
        {
            string originalFileName = fileName.Split("____").Last();
            string filePath         = $"{CommonConstant.FILE_TEMP_FOLDER}/{folder}/{fileName}";
            string fullFilePath     = _aQFileProvider.GetAbsolutePath(filePath);

            if (!_aQFileProvider.FileExists(fullFilePath))
            {
                return(null, filePath, fileName);
            }
            var fileBinary = _aQFileProvider.ReadAllBytes(fullFilePath);

            return(fileBinary, filePath, originalFileName);
        }