SaveReadWriter Type
Reads and Writes with Lock, Optionally only once after a delay in which it might be called several times using Text.Encoding.UTF8 Writes Exceptions to errorLogger because it is tricky to catch exceptions form an async thread
Constructors
Constructor |
Description
|
Full Usage:
SaveReadWriter(path, errorLogger)
Parameters:
string
errorLogger : string -> unit
Returns: SaveReadWriter
|
|
Full Usage:
SaveReadWriter(path, lockObj, errorLogger)
Parameters:
string
lockObj : obj
errorLogger : string -> unit
Returns: SaveReadWriter
|
|
Instance members
Instance member |
Description
|
|
Creates file with text , only if it does not exist yet. Writes Exceptions to errorLogger. Returns true if file exists or was successfully created
|
Full Usage:
this.FileDoesNotExists
Returns: bool
|
|
Full Usage:
this.FileExists
Returns: bool
|
Calls IO.File.Exists(path)
|
Full Usage:
this.Path
Returns: string
|
The full file path
|
Full Usage:
this.ReadAllLines
Returns: string[] option
|
Thread Save reading. Ensures that no writing happens while reading. Writes Exceptions to errorLogger
|
Full Usage:
this.ReadAllText
Returns: string option
|
Thread Save reading. Ensures that no writing happens while reading. Writes Exceptions to errorLogger
|
Full Usage:
this.WriteAllLinesAsync
Parameters:
string[]
|
File will be written async and with a Lock. Ensures that no reading happens while writing. Writes Exceptions to errorLogger
|
Full Usage:
this.WriteAsync
Parameters:
string
|
File will be written async and with a Lock. Ensures that no reading happens while writing. Writes Exceptions to errorLogger
|
Full Usage:
this.WriteIfLast
Parameters:
unit -> string
delayMilliSeconds : int
|
GetString will be called in sync on calling thread, but file will be written async. Only if after the delay the counter value is the same as before. That means no more recent calls to this function have been made during the delay. If other calls to this function have been made then only the last call will be written as file. Also ensures that no reading happens while writing. Writes Exceptions to errorLogger
|