Class EbicsFileFolder

Namespace
Subsembly.EBICS
Assembly
Subsembly.EBICS.Core.dll

Organizes a file system folder as a storage for the EbicsFileSpooler.

public class EbicsFileFolder
Inheritance
EbicsFileFolder
Derived
Inherited Members

Remarks

The EbicsFileFolder is configured for a directory where it stores flat data files, often extracted from ZIP downloads. The file names of the files in the folder shall adhere to the EbicsFileName convention.

Fields

ACCESSFILENAME

The name of the EbicsFileSpoolerAccessControlList file that manages the access rights for this folder.

public const string ACCESSFILENAME = ".access"

Field Value

string

JOURNALFILENAME

The name of the EbicsFileSpoolerJournal file that tracks the processing of order files in the BOX_OUTBOX.

public const string JOURNALFILENAME = ".journal"

Field Value

string

OKAYFILENAME

The name of the log file in which all spooler executions for a particular HostID and PartnerID are recorded. This is a simple, unencrypted CSV file where another line is appended for every spooler execution.

public const string OKAYFILENAME = ".okay"

Field Value

string

SENTINELFILENAME

The name of the sentinel file that is maintained in the file folder for locking and tracking. This must start with a dot to be hidden and to not interfere with the real data files in this folder.

public const string SENTINELFILENAME = ".sentinel"

Field Value

string

Properties

Exists

public bool Exists { get; }

Property Value

bool

FolderName

The folder name without path information.

public string FolderName { get; }

Property Value

string

FolderPath

The complete folder path up to the file system root.

public string FolderPath { get; }

Property Value

string

IsLocked

Indicates whether the folder is already locked by this object instance.

public bool IsLocked { get; }

Property Value

bool

Remarks

If the folder was locked by another thread or process, then this will be false. Only if the folder has been locked by calling Lock() on this object instance, then the value will be true.

Methods

Delete(EbicsFileName)

Deletes all file system files of any possible file system name variation of the logical EbicsFileName.

public void Delete(EbicsFileName aFileName)

Parameters

aFileName EbicsFileName

Exceptions

ArgumentNullException

The parameter aFileName was null.

FileExists(EbicsFileName)

Indicates whether the file system file of the logical EbicsFileName exists.

public bool FileExists(EbicsFileName aFileName)

Parameters

aFileName EbicsFileName

Returns

bool

Exceptions

ArgumentNullException

The parameter aFileName was null.

GetFilePath(EbicsFileName)

Get the complete file system path to an EBICS file inside of this folder.

public string GetFilePath(EbicsFileName aFileName)

Parameters

aFileName EbicsFileName

Returns

string

Exceptions

ArgumentNullException

The parameter aFileName was null.

GetFiles(DateTime, string, EbicsAccountInfo, string, bool)

public EbicsFileName[] GetFiles(DateTime tFromDate = default, string sOrderType = null, EbicsAccountInfo aAccount = null, string sSuffix = null, bool fIncludeHidden = false)

Parameters

tFromDate DateTime

Optional starting date for the returned file names. Files that are older than this date will not be returned.

sOrderType string

Optional order type to filter the returned file names. If null, then all file names are returned.

aAccount EbicsAccountInfo

Optional account specification to filter the returned file names, If null, then all file names are returned. Only account fields that are specified in both, the given account and the file name account, are compared.

sSuffix string

Optional file name suffix. If this parameter is given, then only filenames with a matching Suffix are returned. The suffix is compared using StringComparison.OrdinalIgnoreCase.

fIncludeHidden bool

Returns

EbicsFileName[]

Returns all matching file names in chronological sorted order. For file names with the same Date, the SequenceID is compared, if present. The returned array is never null, but may be empty.

GetMaxDate(string, EbicsAccountInfo)

Gets the highest creation date of the files stored in this folder.

public DateTime GetMaxDate(string sOrderType = null, EbicsAccountInfo aAccount = null)

Parameters

sOrderType string

Optional order type to filter the files. If null, then the order type of the files is ignored.

aAccount EbicsAccountInfo

Optional account specification to filter the files. If null, then the account specification of the files is ignored. Only account fields that are specified in both, the given account and the file name account, are compared.

Returns

DateTime

If there are no matching files in this folder, then DateTime.MinValue is returned. Otherwise the highest Date of all matching files is returned. Note that there may be multiple files with the same, highest creation date.

GetSubFolder(string, bool)

public EbicsFileFolder GetSubFolder(string sSubFolderName, bool fCreate)

Parameters

sSubFolderName string
fCreate bool

Returns

EbicsFileFolder

GetSubFolders()

Returns all sub folders of this folder.

public EbicsFileFolder[] GetSubFolders()

Returns

EbicsFileFolder[]

Lock()

Attempt to exclusively lock this folder.

public bool Lock()

Returns

bool

If the folder was locked successfully, then true is returned. If the folder could not be locked, e.g. is already in use, then false is returned. Also, if there is any other file access error, false will be returned.

Exceptions

InvalidOperationException

The folder was already locked by this class instance, that means IsLocked is true.

ToString()

public override string ToString()

Returns

string

Unlock()

Release exclusive access to this folder.

public void Unlock()

Exceptions

InvalidOperationException

The folder was not previously locked via Lock(), that is, IsLocked is false.