PeanutButter
Loading...
Searching...
No Matches
PeanutButter.Utils.AutoTempFile Class Reference

Provides a mechanism to create, read and write a temporary file which is automatically removed at disposal time. More...

Inheritance diagram for PeanutButter.Utils.AutoTempFile:

Public Member Functions

 AutoTempFile ()
 Default constructor: creates the temp file with no data and no naming hints using the OS-level temporary filename generator.
 AutoTempFile (byte[] data)
 Constructs a new AutoTempFile with the provided binary data. The file name is generated by the operating system.
 AutoTempFile (string data)
 Constructs a new AutoTempFile with the provided string data. The file name is generated by the operating system.
 AutoTempFile (string baseFolder, string data)
 Constructs a new AutoTempFile in the specified baseFolder with the provided string data.
 AutoTempFile (string baseFolder, string fileName, string data)
 Constructs a new AutoTempFile in the provided folder with the provided name, containing the provided string data.
 AutoTempFile (string baseFolder, byte[] data)
 Constructs a new AutoTempFile in the specified baseFolder with the provided binary data.
 AutoTempFile (string baseFolder, string fileName, byte[] data)
 Constructs a new AutoTempFile in the provided folder with the provided name, containing the provided binary data.
void Delete ()
 Deletes the temp file, if found, otherwise does nothing.
void Dispose ()

Properties

int RetryOperations [get, set]
 How many times to retry operations if they fail.
string Path [get]
 Provides the path to the temporary file on disk.
byte[] BinaryData [get, set]
 Reads and writes binary data from and to the file.
string StringData [get, set]
 Reads and writes string data from and to the file.

Detailed Description

Provides a mechanism to create, read and write a temporary file which is automatically removed at disposal time.

Constructor & Destructor Documentation

◆ AutoTempFile() [1/6]

PeanutButter.Utils.AutoTempFile.AutoTempFile ( byte[] data)

Constructs a new AutoTempFile with the provided binary data. The file name is generated by the operating system.

Parameters
data

◆ AutoTempFile() [2/6]

PeanutButter.Utils.AutoTempFile.AutoTempFile ( string data)

Constructs a new AutoTempFile with the provided string data. The file name is generated by the operating system.

Parameters
data

◆ AutoTempFile() [3/6]

PeanutButter.Utils.AutoTempFile.AutoTempFile ( string baseFolder,
string data )

Constructs a new AutoTempFile in the specified baseFolder with the provided string data.

Parameters
baseFolderFolder to create the file within
dataString data to initialize the file with

◆ AutoTempFile() [4/6]

PeanutButter.Utils.AutoTempFile.AutoTempFile ( string baseFolder,
string fileName,
string data )

Constructs a new AutoTempFile in the provided folder with the provided name, containing the provided string data.

Parameters
baseFolderFolder to create the file within
fileNameName to use for the file
dataString data to initialize the file with (will be encoded utf-8)

◆ AutoTempFile() [5/6]

PeanutButter.Utils.AutoTempFile.AutoTempFile ( string baseFolder,
byte[] data )

Constructs a new AutoTempFile in the specified baseFolder with the provided binary data.

Parameters
baseFolderFolder to create the file within
dataBinary data to initialize the file with

◆ AutoTempFile() [6/6]

PeanutButter.Utils.AutoTempFile.AutoTempFile ( string baseFolder,
string fileName,
byte[] data )

Constructs a new AutoTempFile in the provided folder with the provided name, containing the provided binary data.

Parameters
baseFolderFolder to create the file within
fileNameName to use for the file
dataBinary data to initialize the file with

Property Documentation

◆ RetryOperations

int PeanutButter.Utils.AutoTempFile.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 ):

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