|
PeanutButter
|
Provides a mechanism for creating a temporary folder which is automatically deleted upon disposal. More...
Public Member Functions | |||||||||||
| AutoTempFolder () | |||||||||||
| Default constructor: uses the operating system method to get a temporary path to use for the folder. | |||||||||||
| AutoTempFolder (string baseFolder) | |||||||||||
| Constructs a new AutoTempFolder with the temporary folder housed under the provided baseFolder. | |||||||||||
| void | Dispose () | ||||||||||
| string | ResolvePath (string p1, params string[] more) | ||||||||||
Resolves a relative path (or path parts) within the auto temp folder.
| |||||||||||
| IEnumerable< string > | ResolvePaths (IEnumerable< string > relativePaths) | ||||||||||
Resolves all provided relative paths within the temp folder.
| |||||||||||
| string | CreateFolder (string dirname) | ||||||||||
Creates a directory within the auto temp folder.
| |||||||||||
| string | WriteFile (string filename, string data) | ||||||||||
Writes a file within the auto temp folder.
| |||||||||||
| string | WriteFile (string filename, byte[] data) | ||||||||||
Writes a file within the auto temp folder.
| |||||||||||
| string | WriteFile (string filename, Stream data) | ||||||||||
Writes a file within the auto temp folder.
| |||||||||||
| string | ReadTextFile (string filename) | ||||||||||
Reads a text file by relative path within the auto temp folder.
| |||||||||||
| byte[] | ReadFile (string filename) | ||||||||||
Reads a binary file by relative path within the auto temp folder.
| |||||||||||
| FileStream | OpenFile (string filename) | ||||||||||
Opens a file (read-only) by relative path within the auto temp folder.
| |||||||||||
| FileStream | OpenFile (string filename, FileAccess access) | ||||||||||
Opens a file by relative path within the auto temp folder with the desired access.
| |||||||||||
| FileStream | OpenFile (string filename, FileAccess access, FileShare share) | ||||||||||
Opens a file by relative path within the auto temp folder with the desired access and share.
| |||||||||||
| FileStream | OpenFile (string filename, FileAccess access, FileShare share, int bufferSize) | ||||||||||
Opens a file by relative path within the auto temp folder with the desired access, share and buffer size.
| |||||||||||
| FileStream | OpenFile (string filename, FileAccess access, FileShare share, int bufferSize, FileOptions options) | ||||||||||
Opens a file by relative path within the auto temp folder with the desired access, share, buffer size and options.
| |||||||||||
| bool | FileExists (string relativePath) | ||||||||||
Returns true if the relative path is found to be a file.
| |||||||||||
| bool | FolderExists (string relativePath) | ||||||||||
Returns true if the relative path is found to be a folder.
| |||||||||||
| bool | Exists (string relativePath) | ||||||||||
Returns true if the relative path is a file or folder.
| |||||||||||
| bool | Contains (string fullPath) | ||||||||||
Returns true if the provided path is contained within the temp folder.
| |||||||||||
Properties | |
| int | RetryOperations [get, set] |
| How many times to retry operations if they fail. | |
| string | Path [get] |
| The local path at which this temp folder exists. | |
Provides a mechanism for creating a temporary folder which is automatically deleted upon disposal.
| PeanutButter.Utils.AutoTempFolder.AutoTempFolder | ( | string | baseFolder | ) |
Constructs a new AutoTempFolder with the temporary folder housed under the provided baseFolder.
| baseFolder | Folder within which to create the temporary folder |
| bool PeanutButter.Utils.AutoTempFolder.Contains | ( | string | fullPath | ) |
Returns true if the provided path is contained within the temp folder.
| fullPath |
Implements PeanutButter.Utils.IAutoTempFolder.
| string PeanutButter.Utils.AutoTempFolder.CreateFolder | ( | string | dirname | ) |
Creates a directory within the auto temp folder.
| dirname |
Implements PeanutButter.Utils.IAutoTempFolder.
| bool PeanutButter.Utils.AutoTempFolder.Exists | ( | string | relativePath | ) |
Returns true if the relative path is a file or folder.
| relativePath |
Implements PeanutButter.Utils.IAutoTempFolder.
| bool PeanutButter.Utils.AutoTempFolder.FileExists | ( | string | relativePath | ) |
Returns true if the relative path is found to be a file.
| relativePath |
Implements PeanutButter.Utils.IAutoTempFolder.
| bool PeanutButter.Utils.AutoTempFolder.FolderExists | ( | string | relativePath | ) |
Returns true if the relative path is found to be a folder.
| relativePath |
Implements PeanutButter.Utils.IAutoTempFolder.
| FileStream PeanutButter.Utils.AutoTempFolder.OpenFile | ( | string | filename | ) |
Opens a file (read-only) by relative path within the auto temp folder.
| filename |
Implements PeanutButter.Utils.IAutoTempFolder.
| FileStream PeanutButter.Utils.AutoTempFolder.OpenFile | ( | string | filename, |
| FileAccess | access ) |
Opens a file by relative path within the auto temp folder with the desired access.
| filename | |
| access |
Implements PeanutButter.Utils.IAutoTempFolder.
| FileStream PeanutButter.Utils.AutoTempFolder.OpenFile | ( | string | filename, |
| FileAccess | access, | ||
| FileShare | share ) |
Opens a file by relative path within the auto temp folder with the desired access and share.
| filename | |
| access | |
| share |
Implements PeanutButter.Utils.IAutoTempFolder.
| FileStream PeanutButter.Utils.AutoTempFolder.OpenFile | ( | string | filename, |
| FileAccess | access, | ||
| FileShare | share, | ||
| int | bufferSize ) |
Opens a file by relative path within the auto temp folder with the desired access, share and buffer size.
| filename | |
| access | |
| share | |
| bufferSize |
Implements PeanutButter.Utils.IAutoTempFolder.
| FileStream PeanutButter.Utils.AutoTempFolder.OpenFile | ( | string | filename, |
| FileAccess | access, | ||
| FileShare | share, | ||
| int | bufferSize, | ||
| FileOptions | options ) |
Opens a file by relative path within the auto temp folder with the desired access, share, buffer size and options.
| filename | |
| access | |
| share | |
| bufferSize | |
| options |
Implements PeanutButter.Utils.IAutoTempFolder.
| byte[] PeanutButter.Utils.AutoTempFolder.ReadFile | ( | string | filename | ) |
Reads a binary file by relative path within the auto temp folder.
| filename |
Implements PeanutButter.Utils.IAutoTempFolder.
| string PeanutButter.Utils.AutoTempFolder.ReadTextFile | ( | string | filename | ) |
Reads a text file by relative path within the auto temp folder.
| filename |
Implements PeanutButter.Utils.IAutoTempFolder.
| string PeanutButter.Utils.AutoTempFolder.ResolvePath | ( | string | p1, |
| params string[] | more ) |
Resolves a relative path (or path parts) within the auto temp folder.
| p1 | |
| more |
Implements PeanutButter.Utils.IAutoTempFolder.
| IEnumerable< string > PeanutButter.Utils.AutoTempFolder.ResolvePaths | ( | IEnumerable< string > | relativePaths | ) |
Resolves all provided relative paths within the temp folder.
| relativePaths |
Implements PeanutButter.Utils.IAutoTempFolder.
| string PeanutButter.Utils.AutoTempFolder.WriteFile | ( | string | filename, |
| byte[] | data ) |
Writes a file within the auto temp folder.
| filename | relative path to the file |
| data | binary data to write |
Implements PeanutButter.Utils.IAutoTempFolder.
| string PeanutButter.Utils.AutoTempFolder.WriteFile | ( | string | filename, |
| Stream | data ) |
Writes a file within the auto temp folder.
| filename | relative path to the file |
| data | stream data to write |
Implements PeanutButter.Utils.IAutoTempFolder.
| string PeanutButter.Utils.AutoTempFolder.WriteFile | ( | string | filename, |
| string | data ) |
Writes a file within the auto temp folder.
| filename | relative path to the file |
| data | string data to write |
Implements PeanutButter.Utils.IAutoTempFolder.
|
get |
The local path at which this temp folder exists.
Implements PeanutButter.Utils.IAutoTempFolder.
|
getset |
How many times to retry operations if they fail.
Implements PeanutButter.Utils.IAutoTempFolder.