Show / Hide Table of Contents

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()
Namespace: SecureExchangesSDK.Helpers
Assembly: SecureExchangesSDK.dll
Syntax
public class FileHelper

Methods

DownloadSecureFiles(SecureFiles, List<DownloadedFileWithMetaData>)

Declaration
public void DownloadSecureFiles(SecureFiles filesMetaData, List<DownloadedFileWithMetaData> files)
Parameters
Type Name Description
SecureFiles filesMetaData
System.Collections.Generic.List<DownloadedFileWithMetaData> files

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)

PrepareFileToDownload(FileMetaData, String, Object)

Declaration
public DownloadedFileWithMetaData PrepareFileToDownload(FileMetaData fileMetaData, string savingDirectory, object paramsToFile = null)
Parameters
Type Name Description
FileMetaData fileMetaData
System.String savingDirectory
System.Object paramsToFile
Returns
Type Description
DownloadedFileWithMetaData

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
Type Description
System.Collections.Generic.List<DownloadedFileWithMetaData>

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
Type Description
FileHelper.BeforeUploadChunksErrorRetry

DowloadChuckFinish_Event

Fired when a chuck is finish donwload

Declaration
public event FileHelper.DownloadChuckFinishEvent DowloadChuckFinish_Event
Event Type
Type Description
FileHelper.DownloadChuckFinishEvent

DownloadChuckStart_Event

Fired when a chuck is start donwload

Declaration
public event FileHelper.DownloadChuckStart DownloadChuckStart_Event
Event Type
Type Description
FileHelper.DownloadChuckStart

DownloadChunkErorr_Event

Declaration
public event FileHelper.DownloadChunkError DownloadChunkErorr_Event
Event Type
Type Description
FileHelper.DownloadChunkError

DownloadFileError_event

The Event of the download file

Declaration
public event FileHelper.DownloadFileError DownloadFileError_event
Event Type
Type Description
FileHelper.DownloadFileError

DownloadFinish_event

Fired when a file finish download

Declaration
public event FileHelper.DownloadFinish DownloadFinish_event
Event Type
Type Description
FileHelper.DownloadFinish

DownloadsFinish_event

Fired after all download completed

Declaration
public event FileHelper.DownloadsFinish DownloadsFinish_event
Event Type
Type Description
FileHelper.DownloadsFinish

DownloadsStart_event

Fired Before all download started

Declaration
public event FileHelper.DownloadsStart DownloadsStart_event
Event Type
Type Description
FileHelper.DownloadsStart

DownloadStart_event

Fired when a file start download

Declaration
public event FileHelper.DownloadStart DownloadStart_event
Event Type
Type Description
FileHelper.DownloadStart

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
Type Description
FileHelper.GetFileSizeToUpload

UploadChunkCompleted_Event

The event that need to be register to get and UploadChunkCompleted delegate

Declaration
public event FileHelper.UploadChunkCompleted UploadChunkCompleted_Event
Event Type
Type Description
FileHelper.UploadChunkCompleted

UploadEvent

The event call when a chuck finish upload

Declaration
public static event FileHelper.UploadProgress UploadEvent
Event Type
Type Description
FileHelper.UploadProgress

UploadFileEnd_Event

This event occur when all the file chunks has finish

Declaration
public event FileHelper.UploadFileDelegate UploadFileEnd_Event
Event Type
Type Description
FileHelper.UploadFileDelegate

UploadFileStart_Event

This event occur before the file start to be uploaded to the server

Declaration
public event FileHelper.UploadFileDelegate UploadFileStart_Event
Event Type
Type Description
FileHelper.UploadFileDelegate

UploadFinish_Event

Declaration
public event FileHelper.UploadFinish UploadFinish_Event
Event Type
Type Description
FileHelper.UploadFinish

UploadFinishFiles_Event

Declaration
public event FileHelper.UploadFinishFiles UploadFinishFiles_Event
Event Type
Type Description
FileHelper.UploadFinishFiles

Extension Methods

ExtensionHelper.CopySameNameAndTypeProperties<T, S>(T, S)
In This Article
Back to top Generated by DocFX