OpenPetra
Free Administration Software for Non-Profits
Ict.Common.IO.TFileHelper Class Reference

Helps in handling with certain aspects of files and compression. More...

Classes

class  Streams
 Helps in handling Streams and files. More...
 

Static Public Member Functions

static string MoveToBackup (string AOrigFilename)
 move the given file to a backup file, but do not overwrite an existing backup file. use additional numbers instead. More...
 
static void CreateDirectory (string APath)
 create directory if it does not exist yet works around issues on Linux, with symbolic links More...
 
static string GetTempFileName (string ASpeakingName, string AExtension)
 returns the filename for a file that does not exist yet More...
 
static bool OpenBinaryFileAndConvertToBase64String (string APathToFile, out string AResult)
 Opens the specified binary file, reads it and converts it to a Base64 encoded string More...
 
static bool WriteBinaryFileConvertedFromBase64String (string ABase64String, string APathToFile, out string AFailMessage)
 Writes a string in Base64 format to a binary file using the specified file path More...
 
static String GetDefaultTemporaryTemplatePath (string AUniqueTemplateName, string ATemplateFileExtension)
 Gets the full path to the location for a temporary copy of a Templater template downloaded from the database. The location will be beneath the user's Local Application Data area More...
 
static String GetPreferredTextEditorPath ()
 Gets the full path to the preferred text editor. On Unix systems this always returns null. On Windows systems it returns a value from the registry for the application associated with a 'txtfile'. If the registered application is Notepad but Notepad++ is installed then it return the path to Notepad++. Returns null on Windows too if it cannot get any information from the registry. More...
 

Detailed Description

Helps in handling with certain aspects of files and compression.

Member Function Documentation

◆ CreateDirectory()

static void Ict.Common.IO.TFileHelper.CreateDirectory ( string  APath)
inlinestatic

create directory if it does not exist yet works around issues on Linux, with symbolic links

◆ GetDefaultTemporaryTemplatePath()

static String Ict.Common.IO.TFileHelper.GetDefaultTemporaryTemplatePath ( string  AUniqueTemplateName,
string  ATemplateFileExtension 
)
inlinestatic

Gets the full path to the location for a temporary copy of a Templater template downloaded from the database. The location will be beneath the user's Local Application Data area

Parameters
AUniqueTemplateNameA unique filename made up of FormCode/FormName and FormLanguage
ATemplateFileExtensionA file extension with or without an initial dot
Returns
Full path to the file for the specified code, name and langauge

◆ GetPreferredTextEditorPath()

static String Ict.Common.IO.TFileHelper.GetPreferredTextEditorPath ( )
inlinestatic

Gets the full path to the preferred text editor. On Unix systems this always returns null. On Windows systems it returns a value from the registry for the application associated with a 'txtfile'. If the registered application is Notepad but Notepad++ is installed then it return the path to Notepad++. Returns null on Windows too if it cannot get any information from the registry.

◆ GetTempFileName()

static string Ict.Common.IO.TFileHelper.GetTempFileName ( string  ASpeakingName,
string  AExtension 
)
inlinestatic

returns the filename for a file that does not exist yet

Parameters
ASpeakingName
AExtension
Returns

◆ MoveToBackup()

static string Ict.Common.IO.TFileHelper.MoveToBackup ( string  AOrigFilename)
inlinestatic

move the given file to a backup file, but do not overwrite an existing backup file. use additional numbers instead.

Parameters
AOrigFilename
Returns
the name of the backed up file

◆ OpenBinaryFileAndConvertToBase64String()

static bool Ict.Common.IO.TFileHelper.OpenBinaryFileAndConvertToBase64String ( string  APathToFile,
out string  AResult 
)
inlinestatic

Opens the specified binary file, reads it and converts it to a Base64 encoded string

Parameters
APathToFilePath to the file to open
AResultEither the Base64 encoded string if the method returned true, or an error message if the method returned false
Returns
True if successful. False if an error occurred.

◆ WriteBinaryFileConvertedFromBase64String()

static bool Ict.Common.IO.TFileHelper.WriteBinaryFileConvertedFromBase64String ( string  ABase64String,
string  APathToFile,
out string  AFailMessage 
)
inlinestatic

Writes a string in Base64 format to a binary file using the specified file path

Parameters
ABase64StringThe Base64 string
APathToFileThe path to the file to be written
AFailMessageA failure message if the method returns false
Returns
True of successful, false otherwise. If false the failure message will be in the out parameter.

The documentation for this class was generated from the following file: