Ejemplo n.º 1
0
 /// <summary>
 /// Download File, Returns byte array. This byte array convert into Image
 /// </summary>
 /// <param name="downloadFileName"></param>
 /// <returns></returns>
 public byte[] DownloadFile(string downloadFileName)
 {
     _blobWrapper = new DataUpload();
     byte[] data = _blobWrapper.DownloadFileFromBlob(downloadFileName);
     return data;
 }
        /// <summary>
        /// Get and save metadata of file
        /// </summary>
        /// <param name="filePath"></param>
        /// <param name="appStartPath"></param>
        public void SaveMetadataOfImage(string filePath, string appStartPath)
        {
            try
            {
                _blobWrapper = new DataUpload();
                _faceDetection = new FaceDetection(appStartPath);
                _imgGrabber = new ImageGrabber();
                List<DataLayer.EntityModel.Image> imageList = new List<DataLayer.EntityModel.Image>();
                String[] files = new string[1];
                files[0] = filePath;
                List<string> fileNameList = new List<string>();
                fileNameList = GetUniqueImages(files.ToList());

                foreach (var fileObj in fileNameList)
                {
                    //Get metadata of file and save it
                    imageList.Add(GetImageMetadata(fileObj, appStartPath));
                    //Upload file to file to azure blob
                    _blobWrapper.UploadFile(fileObj);
                }

                new DataLayer.ModelClasses.Image().SaveUpdateMetadata(imageList);
            }
            catch (Exception)
            {
                throw;
            }
        }
 private async void UploadFile(string filePath)
 {
     DataUpload _blobWrapper = new DataUpload();
     _blobWrapper.UploadFile(filePath);
 }
        /// <summary>
        /// Get and save metadata of all files from input folder
        /// </summary>
        /// <param name="folderPath"></param>
        /// <param name="appStartPath"></param>
        public void SaveMetadataOfAllImages(string folderPath, string appStartPath)
        {
            try
            {
                _blobWrapper = new DataUpload();
                _faceDetection = new FaceDetection(appStartPath);
                _imgGrabber = new ImageGrabber();
                DirectoryInfo directory = new DirectoryInfo(folderPath);
                List<DataLayer.EntityModel.Image> imageList = new List<DataLayer.EntityModel.Image>();
                String[] files =  GetFilesFrom(folderPath, imageFilters,true);
                List<string> fileNameList = new List<string>();
                fileNameList = GetUniqueImages(files.ToList());

                foreach (var fileObj in fileNameList)
                {
                    //Get metadata of file and save it
                    imageList.Add(GetImageMetadata(fileObj, appStartPath));
                    //Upload file to file to azure blob
                    _blobWrapper.UploadFile(fileObj);
                }

                new DataLayer.ModelClasses.Image().SaveUpdateMetadata(imageList);
            }
            catch (Exception ex)
            {
                throw;
            }
        }