Class FileHelper
This is the Helper need to be use for upload and download files to Secure Exchanges.
This Helper will decrypt the files, and encrypt them
Assembly: SecureExchangesSDK.dll
Syntax
Methods
Declaration
public void DownloadSecureFiles(SecureFiles filesMetaData, List<DownloadedFileWithMetaData> files)
Parameters
DownloadSecureFiles(SecureFiles, string, object)
Declaration
public void DownloadSecureFiles(SecureFiles filesMetaData, string savingDirectory, object paramsToFile = null)
Parameters
GetExtensionsByMimeType(string)
Return a list of extensions based on the mimeType
Declaration
public static string[] GetExtensionsByMimeType(string mimeType)
Parameters
| Type |
Name |
Description |
| string |
mimeType |
|
Returns
GetMimeType(string)
Get the mime type of an extension
Declaration
public static string GetMimeType(string fileNameOrExtension)
Parameters
| Type |
Name |
Description |
| string |
fileNameOrExtension |
|
Returns
| Type |
Description |
| string |
return the mime type of the extension
|
Examples
string mimeType= FileHelper.GetMimeType(".jpg");
// mimeType = "image/jpeg"
GetNumberOfChunk(long)
Declaration
public static double GetNumberOfChunk(long totalBytes)
Parameters
| Type |
Name |
Description |
| long |
totalBytes |
|
Returns
GetTextSize(long)
That will return in text the Size of a file
Declaration
public static string GetTextSize(long bytes)
Parameters
| Type |
Name |
Description |
| long |
bytes |
Size of the file
|
Returns
| Type |
Description |
| string |
The formated file size ie: 50 MB or 103 Bytes
|
Examples
FileHelper.GetTextSize(fileSize)
Declaration
public DownloadedFileWithMetaData PrepareFileToDownload(FileMetaData fileMetaData, string savingDirectory, object paramsToFile = null)
Parameters
Returns
PrepareFileToDownload(SecureFiles, string, object)
Declaration
public List<DownloadedFileWithMetaData> PrepareFileToDownload(SecureFiles filesMetaData, string savingDirectory, object paramsToFiles = null)
Parameters
Returns
UploadLargeFiles(ILocalFile, HandShake, Guid, int)
Method use to uploads files to Secure Exchanges.This method is optimsed for large files.
Declaration
public List<UploadFiles> UploadLargeFiles(ILocalFile args, HandShake handShake, Guid rep, int maxDegreeOfParallelism = 6)
Parameters
| Type |
Name |
Description |
| ILocalFile |
args |
|
| HandShake |
handShake |
|
| Guid |
rep |
|
| int |
maxDegreeOfParallelism |
The number of thread use to upload documents
|
Returns
Events
Before_UploadChunksErrorRetry
Event fired before the retry of the upload chunks in errors.
Declaration
public event FileHelper.BeforeUploadChunksErrorRetry Before_UploadChunksErrorRetry
Event Type
DowloadChuckFinish_Event
Fired when a chuck is finish donwload
Declaration
public event FileHelper.DownloadChuckFinishEvent DowloadChuckFinish_Event
Event Type
DownloadChuckStart_Event
Fired when a chuck is start donwload
Declaration
public event FileHelper.DownloadChuckStart DownloadChuckStart_Event
Event Type
DownloadChunkErorr_Event
Declaration
public event FileHelper.DownloadChunkError DownloadChunkErorr_Event
Event Type
DownloadFileError_event
The Event of the download file
Declaration
public event FileHelper.DownloadFileError DownloadFileError_event
Event Type
DownloadFinish_event
Fired when a file finish download
Declaration
public event FileHelper.DownloadFinish DownloadFinish_event
Event Type
DownloadStart_event
Fired when a file start download
Declaration
public event FileHelper.DownloadStart DownloadStart_event
Event Type
DownloadsFinish_event
Fired after all download completed
Declaration
public event FileHelper.DownloadsFinish DownloadsFinish_event
Event Type
DownloadsStart_event
Fired Before all download started
Declaration
public event FileHelper.DownloadsStart DownloadsStart_event
Event Type
GetFileSizeBeforeUpload
Fired when Secure Exchanges need to know the file size of all files before upload begin
Declaration
public static event FileHelper.GetFileSizeToUpload GetFileSizeBeforeUpload
Event Type
UploadChunkCompleted_Event
The event that need to be register to get and UploadChunkCompleted delegate
Declaration
public event FileHelper.UploadChunkCompleted UploadChunkCompleted_Event
Event Type
UploadChunkError_Event
The event that must be instanciated to received the error chunk event.
Declaration
public event FileHelper.UploadChunkError UploadChunkError_Event
Event Type
UploadEvent
The event call when a chuck finish upload
Declaration
public static event FileHelper.UploadProgress UploadEvent
Event Type
UploadFileEnd_Event
This event occur when all the file chunks has finish
Declaration
public event FileHelper.UploadFileDelegate UploadFileEnd_Event
Event Type
UploadFileStart_Event
This event occur before the file start to be uploaded to the server
Declaration
public event FileHelper.UploadFileDelegate UploadFileStart_Event
Event Type
UploadFinishFiles_Event
Declaration
public event FileHelper.UploadFinishFiles UploadFinishFiles_Event
Event Type
UploadFinish_Event
Declaration
public event FileHelper.UploadFinish UploadFinish_Event
Event Type
Extension Methods