Click or drag to resize

FileHelper Class

Static helper methods to manipulate files, directories and ZIP archives, available in Razor scripts
Inheritance Hierarchy
SystemObject
  Seal.HelpersFileHelper

Namespace: Seal.Helpers
Assembly: SealLibrary (in SealLibrary.dll) Version: 10.0.1.0+a44cd3a7f03c2bf3cdbd971a878c679e40bed08a
Syntax
C#
public class FileHelper

The FileHelper type exposes the following members.

Constructors
 NameDescription
Public methodFileHelperInitializes a new instance of the FileHelper class
Top
Properties
 NameDescription
Public propertyStatic memberTempApplicationDirectory Path of the '_Seal_Report.Temp' application temporary directory (created if necessary)
Public propertyStatic memberTempPath Path of the temporary directory (AlternateTemporaryDirectory if set, otherwise the local user temp directory)
Top
Methods
 NameDescription
Public methodStatic memberAddFolderChoices Add recursively the sub-folder paths of a directory to a list of choices (paths relative to the repository Reports folder, with a prefix)
Public methodStatic memberAddPersonalFolderChoices Add recursively the sub-folder paths of a directory to a list of choices (paths relative to the repository Personal folder)
Public methodStatic memberChangeGUID Replace a GUID by a new one in a report file
Public methodStatic memberCleanFilePath Replace invalid file name and path characters in a file path by a given string
Public methodStatic memberConvertOSFilePath Convert a file path to use the directory separator of the current operating system
Public methodStatic memberCopyDirectory Copy the files of a directory to a destination, optionally recursive, with a search pattern and a pattern of file name starts to skip
Public methodStatic memberCreateAndGetDirectory Create the root directory and an optional sub-folder if they do not exist, and return the resulting path
Public methodStatic memberCreateZIP(DictionaryString, String, String, String) Create a ZIP archive from a dictionary of file paths and their entry names, with an optional password
Public methodStatic memberCreateZIP(String, String, String, String) Create a ZIP archive containing a single file with a given entry name, with an optional password
Public methodStatic memberCreateZIPFromFile Create a ZIP archive containing a single file, with an optional password
Public methodStatic memberCreateZIPFromFolder Create a ZIP archive from the files of a folder matching a filter, with an optional password
Public methodStatic memberDeleteFile Delete a file if it exists
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodStatic memberExtractZipFile Extract all files of a ZIP archive to a folder, with an optional password
Public methodStatic memberFillZipDictionaryFiles Fill a dictionary of files for CreateZIP
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
Public methodStatic memberFtpCopyDirectory Upload the files of a directory to an FTP destination, optionally recursive
Public methodStatic memberGetDirectorySize Returns the total size in bytes of a directory including its sub-directories
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodStatic memberGetResultFilePrefix Returns the prefix used for report result file names (file name plus extension without the dot)
Public methodStatic memberGetTempUniqueFileName Returns a unique file name in the application temporary directory for the given file name
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodStatic memberGetUniqueFileName(String, String, Boolean) Returns a unique file name in the directory of the given path, appending a number if the file exists. If lockFile is true, an empty file is created.
Public methodStatic memberGetUniqueFileName(String, String, String, Boolean) Returns a unique file name in a directory, appending a number if the file exists and optionally changing the extension. If lockFile is true, an empty file is created.
Public methodStatic memberHasInvalidFileNameChars Returns true if the file name contains invalid characters
Public methodStatic memberIsReportFile Returns true if the file path has the Seal report file extension
Public methodStatic memberIsShortcutFile Returns true if the file path has the Seal report shortcut file extension
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Public methodStatic memberMoveFile Move (or copy if the copy flag is true) a file to a destination
Public methodStatic memberPurgeTempApplicationDirectory Purge the application temporary directory (files older than 8 hours) and RazorEngine directories older than 120 minutes
Public methodStatic memberPurgeTempDirectory Delete the files older than 8 hours in a directory
Public methodStatic memberReadFile Returns the content of a file as a string
Public methodStatic memberReportHasSchedule Returns true if the report file contains a schedule definition
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Public methodStatic memberWriteFile Write a string to a file, creating the directory if necessary
Top
Fields
 NameDescription
Public fieldStatic memberAlternateTemporaryDirectory If set, overrides the temporary directory returned by TempPath
Top
See Also