A lightweight thread-safe IO utility used by the Logger class.
Uses ProjectGamedev.IO.File and ProjectGamedev.IO.Directory for its operations. Does not handle exceptions.
More...
|
| bool | ExistsDirectory (string dir) |
| | Determines whether the given path refers to an existing directory on disk. Thread-safe.- Parameters
-
| dir | The absolute directory path to test |
- Returns
true if dir refers to an existing directory;
false if the directory dir does not exist or an error occurs when trying to determine if the specified directory exists.
|
| bool | ExistsFile (string path) |
| | Determines whether the given path refers to an existing file on disk. Thread-safe.- Parameters
-
| path | The absolute file path to test |
- Returns
true if path refers to an existing file;
false if the file path does not exist or an error occurs when trying to determine if the specified file exists.
|
| DirectoryInfo | CreateDirectory (string dir) |
| | Creates all the directories in a specified path. Thread-safe.- Parameters
-
| dir | The absolute path of the directory to create. |
- Returns
- An object that represents the directory at the specified path.
This object is returned regardless of whether a directory at the specified path already exists.
|
| void | Append (string filePath, string text) |
| | Appends text contents to file. If file does not exist, it is created. Assumes valid file path. Thread-safe.- Parameters
-
| filePath | The absolute path of the file to write to. |
| text | The text that will be appended to filePath . |
|
| void | AppendNoLock (string filePath, string text) |
| | Appends text contents to file without locking the file. If file does not exist, it is created. Assumes valid file path. NOT thread-safe!- Parameters
-
| filePath | The absolute path of the file to write to. |
| text | The text that will be appended to filePath . |
|
| DirectoryInfo | GetDirectory (string dirPath) |
| | Returns a new instance of the DirectoryInfo class, which acts as a wrapper for a directory path. Thread-safe.
|
| FileInfo | GetFile (string path) |
| | Returns a new instance of the FileInfo class, which acts as a wrapper for a file path. Thread-safe.
|
| void | DeleteFile (string filePath) |
| | Deletes a file. Thread-safe. If the file does not exist, does nothing.- Parameters
-
| filePath | The path of the file to be deleted. Wildcard characters are not supported. |
|
| string | ReadAllText (string filePath) |
| | Opens a text file, reads all the text in the file, and then closes the file. Thread-safe. If the file does not exist, returns an empty string.- Parameters
-
| filePath | The absolute path of the file to read from. |
- Returns
- A string containing all the text in the file, or an empty string if the file does not exist.
|
A lightweight thread-safe IO utility used by the Logger class.
Uses ProjectGamedev.IO.File and ProjectGamedev.IO.Directory for its operations. Does not handle exceptions.
◆ Append()
| void ProjectGamedev.Logging.LoggerIO.Append |
( |
string | filePath, |
|
|
string | text ) |
|
inline |
Appends text contents to file. If file does not exist, it is created. Assumes valid file path. Thread-safe.
- Parameters
-
| filePath | The absolute path of the file to write to. |
| text | The text that will be appended to filePath . |
Implements ProjectGamedev.Logging.ILoggerIO.
◆ AppendNoLock()
| void ProjectGamedev.Logging.LoggerIO.AppendNoLock |
( |
string | filePath, |
|
|
string | text ) |
|
inline |
Appends text contents to file without locking the file. If file does not exist, it is created. Assumes valid file path. NOT thread-safe!
- Parameters
-
| filePath | The absolute path of the file to write to. |
| text | The text that will be appended to filePath . |
Implements ProjectGamedev.Logging.ILoggerIO.
◆ CreateDirectory()
| DirectoryInfo ProjectGamedev.Logging.LoggerIO.CreateDirectory |
( |
string | dir | ) |
|
|
inline |
Creates all the directories in a specified path. Thread-safe.
- Parameters
-
| dir | The absolute path of the directory to create. |
- Returns
- An object that represents the directory at the specified path.
This object is returned regardless of whether a directory at the specified path already exists.
Implements ProjectGamedev.Logging.ILoggerIO.
◆ DeleteFile()
| void ProjectGamedev.Logging.LoggerIO.DeleteFile |
( |
string | filePath | ) |
|
|
inline |
Deletes a file. Thread-safe. If the file does not exist, does nothing.
- Parameters
-
| filePath | The path of the file to be deleted. Wildcard characters are not supported. |
Implements ProjectGamedev.Logging.ILoggerIO.
◆ ExistsDirectory()
| bool ProjectGamedev.Logging.LoggerIO.ExistsDirectory |
( |
string | dir | ) |
|
|
inline |
Determines whether the given path refers to an existing directory on disk. Thread-safe.
- Parameters
-
| dir | The absolute directory path to test |
- Returns
true if dir refers to an existing directory;
false if the directory dir does not exist or an error occurs when trying to determine if the specified directory exists.
Implements ProjectGamedev.Logging.ILoggerIO.
◆ ExistsFile()
| bool ProjectGamedev.Logging.LoggerIO.ExistsFile |
( |
string | path | ) |
|
|
inline |
Determines whether the given path refers to an existing file on disk. Thread-safe.
- Parameters
-
| path | The absolute file path to test |
- Returns
true if path refers to an existing file;
false if the file path does not exist or an error occurs when trying to determine if the specified file exists.
Implements ProjectGamedev.Logging.ILoggerIO.
◆ GetDirectory()
| DirectoryInfo ProjectGamedev.Logging.LoggerIO.GetDirectory |
( |
string | dirPath | ) |
|
|
inline |
Returns a new instance of the DirectoryInfo class, which acts as a wrapper for a directory path. Thread-safe.
- Parameters
-
| dirPath | A string specifying the path on which to create the DirectoryInfo. |
- Returns
- A new instance of the DirectoryInfo class containing various information about the directory located at dirPath .
- Exceptions
-
| ArgumentNullException | dirPath is null. |
| SecurityException | The caller does not have the required permission. |
| ArgumentException | .NET Framework and .NET Core versions older than 2.1: The file name is empty, contains only white spaces, or contains invalid characters. |
| PathTooLongException | The specified path, file name, or both exceed the system-defined maximum length. |
Implements ProjectGamedev.Logging.ILoggerIO.
◆ GetFile()
| FileInfo ProjectGamedev.Logging.LoggerIO.GetFile |
( |
string | path | ) |
|
|
inline |
Returns a new instance of the FileInfo class, which acts as a wrapper for a file path. Thread-safe.
- Parameters
-
| path | The fully qualified name of the file, or the relative file name. Do not end the path with the directory separator character. |
- Returns
- A new instance of the FileInfo class containing various information about the file located at path .
- Exceptions
-
| ArgumentNullException | path is null. |
| SecurityException | The caller does not have the required permission. |
| ArgumentException | .NET Framework and .NET Core versions older than 2.1: The file name is empty, contains only white spaces, or contains invalid characters. |
| UnauthorizedAccessException | Access to path is denied. |
| PathTooLongException | The specified path, file name, or both exceed the system-defined maximum length. |
| NotSupportedException | path contains a colon (:) in the middle of the string. |
Implements ProjectGamedev.Logging.ILoggerIO.
◆ ReadAllText()
| string ProjectGamedev.Logging.LoggerIO.ReadAllText |
( |
string | filePath | ) |
|
|
inline |
Opens a text file, reads all the text in the file, and then closes the file. Thread-safe. If the file does not exist, returns an empty string.
- Parameters
-
| filePath | The absolute path of the file to read from. |
- Returns
- A string containing all the text in the file, or an empty string if the file does not exist.
Implements ProjectGamedev.Logging.ILoggerIO.
The documentation for this class was generated from the following file:
- Assets/Project GAMEDEV/Tools/Logger/Scripts/LoggerIO.cs