![]() |
Anti-Cheat Toolkit
2024.3.5
Multi-purpose anti-cheat solution for Unity Engine
|
Public Member Functions | |
ObscuredFile () | |
ObscuredFile (string fileName) | |
ObscuredFile (ObscuredFileSettings settings) | |
ObscuredFile (string fileNameOrPath, IObscuredFileSettings settings) | |
void | Delete () |
ObscuredFileWriteResult | WriteAllBytes (byte[] data) |
ObscuredFileReadResult | ReadAllBytes () |
Static Public Attributes | |
const string | DefaultFileName = "actkfile" |
Properties | |
IObscuredFileSettings | CurrentSettings [get] |
bool | FileExists [get] |
string | FilePath [get] |
Events | |
Action | NotGenuineDataDetected |
Action | DataFromAnotherDeviceDetected |
Allows saving any binary data into the file either with or without encryption, with or without device locking and always with integrity check to make sure file is genuine.
Uses File IO which may cause main thread hiccups when operating with big amounts of data thus it's recommended to use it from background thread or at the stall moments of your app (like loading screens etc).
Please call DeviceIdHolder.ForceLockToDeviceInit() before accessing this class from background thread if you are using Device Lock feature without custom DeviceID.
|
inline |
Creates instance with file name set to DefaultFileName and default ObscuredFileSettings.
|
inline |
Creates instance with specified file name and default ObscuredFileSettings.
fileName | Custom file name to place at ObscuredFileLocation.PersistentData. |
|
inline |
Creates instance with file name set to DefaultFileName and custom specific settings.
settings | Custom settings to use with this instance. |
|
inline |
Creates instance with specified file name or file path and custom specific settings.
fileNameOrPath | File path if using ObscuredFileLocation.Custom, otherwise represents file name to use with set ObscuredFileLocation kind. |
settings | Custom settings to use with this instance. |
|
inline |
Deletes physical file assigned with this instance. Does nothing if file does not exists.
|
inline |
Writes passed data
to the physical file on disk. Consider calling from background thread for the large data amount.
data | Custom byte array to write. |
|
inline |
Reads all bytes from the physical file on disk. Consider calling from background thread for the large data amount.
|
static |
Filename used by default, if other name or path was not specified in constructor.
|
get |
Allows reading current settings.
|
get |
Returns true if file at FilePath physically exists on disk.
|
get |
Returns path to the file. It's always not empty and valid even if file was not saved to the physical disk yet.
Action NotGenuineDataDetected |
Fires when saved data tampering detected. Will not fire when data is damaged and not readable.
Action DataFromAnotherDeviceDetected |
Fires when saved data from some other device detected.
May be helpful to ban potential cheaters, trying to use someone's purchased in-app goods for example.
NOTE: Will fire if same device ID has changed (pretty rare case though). Read more at DeviceLockLevel.