PeanutButter
Loading...
Searching...
No Matches
PeanutButter.Utils.IAutoTempFolder Interface Reference

Describes the contract for an auto-deleting temporary folder. More...

Inheritance diagram for PeanutButter.Utils.IAutoTempFolder:
PeanutButter.Utils.AutoTempFolder

Public Member Functions

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

string Path [get]
 The local path at which this temp folder exists.
int RetryOperations [get, set]
 How many times to retry operations if they fail.

Detailed Description

Describes the contract for an auto-deleting temporary folder.

Member Function Documentation

◆ Contains()

bool PeanutButter.Utils.IAutoTempFolder.Contains ( string fullPath)

Returns true if the provided path is contained within the temp folder.

Parameters
fullPath
Returns

Implemented in PeanutButter.Utils.AutoTempFolder.

◆ CreateFolder()

string PeanutButter.Utils.IAutoTempFolder.CreateFolder ( string dirname)

Creates a directory within the auto temp folder.

  • any supporting directories will also be created
Parameters
dirname
Returns

Implemented in PeanutButter.Utils.AutoTempFolder.

◆ Exists()

bool PeanutButter.Utils.IAutoTempFolder.Exists ( string relativePath)

Returns true if the relative path is a file or folder.

Parameters
relativePath
Returns

Implemented in PeanutButter.Utils.AutoTempFolder.

◆ FileExists()

bool PeanutButter.Utils.IAutoTempFolder.FileExists ( string relativePath)

Returns true if the relative path is found to be a file.

Parameters
relativePath
Returns

Implemented in PeanutButter.Utils.AutoTempFolder.

◆ FolderExists()

bool PeanutButter.Utils.IAutoTempFolder.FolderExists ( string relativePath)

Returns true if the relative path is found to be a folder.

Parameters
relativePath
Returns

Implemented in PeanutButter.Utils.AutoTempFolder.

◆ OpenFile() [1/5]

FileStream PeanutButter.Utils.IAutoTempFolder.OpenFile ( string filename)

Opens a file (read-only) by relative path within the auto temp folder.

Parameters
filename
Returns

Implemented in PeanutButter.Utils.AutoTempFolder.

◆ OpenFile() [2/5]

FileStream PeanutButter.Utils.IAutoTempFolder.OpenFile ( string filename,
FileAccess access )

Opens a file by relative path within the auto temp folder with the desired access.

  • defaulted share is None
  • defaulted buffer size is 4096
  • defaulted options is None
Parameters
filename
access
Returns

Implemented in PeanutButter.Utils.AutoTempFolder.

◆ OpenFile() [3/5]

FileStream PeanutButter.Utils.IAutoTempFolder.OpenFile ( string filename,
FileAccess access,
FileShare share )

Opens a file by relative path within the auto temp folder with the desired access and share.

  • defaulted buffer size is 4096
  • defaulted options is None
Parameters
filename
access
share

Implemented in PeanutButter.Utils.AutoTempFolder.

◆ OpenFile() [4/5]

FileStream PeanutButter.Utils.IAutoTempFolder.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.

  • defaulted options is None
Parameters
filename
access
share
bufferSize

Implemented in PeanutButter.Utils.AutoTempFolder.

◆ OpenFile() [5/5]

FileStream PeanutButter.Utils.IAutoTempFolder.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.

Parameters
filename
access
share
bufferSize
options

Implemented in PeanutButter.Utils.AutoTempFolder.

◆ ReadFile()

byte[] PeanutButter.Utils.IAutoTempFolder.ReadFile ( string filename)

Reads a binary file by relative path within the auto temp folder.

Parameters
filename
Returns

Implemented in PeanutButter.Utils.AutoTempFolder.

◆ ReadTextFile()

string PeanutButter.Utils.IAutoTempFolder.ReadTextFile ( string filename)

Reads a text file by relative path within the auto temp folder.

Parameters
filename
Returns

Implemented in PeanutButter.Utils.AutoTempFolder.

◆ ResolvePath()

string PeanutButter.Utils.IAutoTempFolder.ResolvePath ( string p1,
params string[] more )

Resolves a relative path (or path parts) within the auto temp folder.

  • note: this doesn't guarantee that the path exists
Parameters
p1
more
Returns

Implemented in PeanutButter.Utils.AutoTempFolder.

◆ ResolvePaths()

IEnumerable< string > PeanutButter.Utils.IAutoTempFolder.ResolvePaths ( IEnumerable< string > relativePaths)

Resolves all provided relative paths within the temp folder.

  • note: this doesn't guarantee that the path exists
Parameters
relativePaths
Returns

Implemented in PeanutButter.Utils.AutoTempFolder.

◆ WriteFile() [1/3]

string PeanutButter.Utils.IAutoTempFolder.WriteFile ( string filename,
byte[] data )

Writes a file within the auto temp folder.

Parameters
filenamerelative path to the file
databinary data to write
Returns
full path to the written file

Implemented in PeanutButter.Utils.AutoTempFolder.

◆ WriteFile() [2/3]

string PeanutButter.Utils.IAutoTempFolder.WriteFile ( string filename,
Stream data )

Writes a file within the auto temp folder.

Parameters
filenamerelative path to the file
datastream data to write
Returns
full path to the written file

Implemented in PeanutButter.Utils.AutoTempFolder.

◆ WriteFile() [3/3]

string PeanutButter.Utils.IAutoTempFolder.WriteFile ( string filename,
string data )

Writes a file within the auto temp folder.

Parameters
filenamerelative path to the file
datastring data to write
Returns
full path to the written file

Implemented in PeanutButter.Utils.AutoTempFolder.

Property Documentation

◆ Path

string PeanutButter.Utils.IAutoTempFolder.Path
get

The local path at which this temp folder exists.

Implemented in PeanutButter.Utils.AutoTempFolder.

◆ RetryOperations

int PeanutButter.Utils.IAutoTempFolder.RetryOperations
getset

How many times to retry operations if they fail.

  • operations like read and write are retried on failure as I've seen antivirus hold onto files ):

Implemented in PeanutButter.Utils.AutoTempFolder.


The documentation for this interface was generated from the following file:
  • source/Utils/PeanutButter.Utils/AutoTempFolder.cs