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
Inheritance
System.Object
FileHelper
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
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
Type |
Name |
Description |
SecureFiles |
filesMetaData |
|
System.String |
savingDirectory |
|
System.Object |
paramsToFile |
|
GetExtensionsByMimeType(String)
Return a list of extensions based on the mimeType
Declaration
public static string[] GetExtensionsByMimeType(string mimeType)
Parameters
Type |
Name |
Description |
System.String |
mimeType |
|
Returns
Type |
Description |
System.String[] |
|
GetMimeType(String)
Get the mime type of an extension
Declaration
public static string GetMimeType(string extension)
Parameters
Type |
Name |
Description |
System.String |
extension |
Extension, with the (.)
|
Returns
Type |
Description |
System.String |
return the mime type of the extension
|
Examples
string mimeType= FileHelper.GetMimeType(".jpg");
// mimeType = "image/jpeg"
GetNumberOfChunk(Int64)
Declaration
public static double GetNumberOfChunk(long totalBytes)
Parameters
Type |
Name |
Description |
System.Int64 |
totalBytes |
|
Returns
Type |
Description |
System.Double |
|
GetTextSize(Int64)
That will return in text the Size of a file
Declaration
public static string GetTextSize(long bytes)
Parameters
Type |
Name |
Description |
System.Int64 |
bytes |
Size of the file
|
Returns
Type |
Description |
System.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
Type |
Name |
Description |
FileMetaData |
fileMetaData |
|
System.String |
savingDirectory |
|
System.Object |
paramsToFile |
|
Returns
PrepareFileToDownload(SecureFiles, String, Object)
Declaration
public List<DownloadedFileWithMetaData> PrepareFileToDownload(SecureFiles filesMetaData, string savingDirectory, object paramsToFiles = null)
Parameters
Type |
Name |
Description |
SecureFiles |
filesMetaData |
|
System.String |
savingDirectory |
|
System.Object |
paramsToFiles |
|
Returns
UploadLargeFiles(ILocalFile, HandShake, Guid, Int32)
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 |
|
System.Guid |
rep |
|
System.Int32 |
maxDegreeOfParallelism |
The number of thread use to upload documents
|
Returns
Type |
Description |
System.Collections.Generic.List<UploadFiles> |
|
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
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
DownloadStart_event
Fired when a file start download
Declaration
public event FileHelper.DownloadStart DownloadStart_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
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
UploadFinish_Event
Declaration
public event FileHelper.UploadFinish UploadFinish_Event
Event Type
UploadFinishFiles_Event
Declaration
public event FileHelper.UploadFinishFiles UploadFinishFiles_Event
Event Type
Extension Methods