| FileJanitor Class |
Namespace: Sdl.FileTypeSupport.Framework
The FileJanitor type exposes the following members.
| Name | Description | |
|---|---|---|
| FileJanitor |
Associates the janitor with the specified file.
|
| Name | Description | |
|---|---|---|
| DeleteFile |
Delete the file, if possible. Also deletes the directory if it is empty and DeleteDirectoryIfEmpty is true.
| |
| Dispose |
Deletes the file, if it exists.
| |
| Dispose(Boolean) |
Implementation of the recommended dispose protocol. Deletes the file if possible.
| |
| Equals | (Inherited from Object.) | |
| Finalize |
Deletes the file, if possible.
(Overrides ObjectFinalize.) | |
| GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
| ToString | Returns a string that represents the current object. (Inherited from Object.) |
| Name | Description | |
|---|---|---|
| CancelDelete |
If true then this Janitored file is not deleted when this instance is disposed.
| |
| Deleted |
If true then this managed file was sucessfully deleted.
| |
| DeleteDirectoryIfEmpty |
If true a check will be made after the file
has been deleted, and if no other files exist in the
same directory that directory will also be deleted.
| |
| FilePath |
Full path to the file to be deleted.
|
Provides a convenient way to manage session-scope temporary files. Make sure that all objects needing access to the file holds a reference to the corresponding FileJanitor object. When the file janitor is garbage collected or disposed the file is deleted.
The class also implements IDisposable interface. The file is deleted in the Dispose() implementation.
If the file for some reason cannot be deleted no error is raised.
Note that the .NET Framework does not guarantee that finalizers will be called, so there is always a possibility that the file does not get deleted.