Wrapper to encrypt and store a value with obfuscated cache for performance. More...
Inherits CryptoValue< T, U >.
Public Member Functions | |
CryptoCache(T value=default) override void | OnBeforeSerialize () |
Initialize with the specified value. More... | |
override void | OnAfterDeserialize () |
OnAfterDeserialize, read the real value to the obfuscated cache. More... | |
override string | ToString () |
Return the plain text. More... | |
Protected Member Functions | |
abstract T | ReadObfuscated () |
Read the obfuscated cache value. More... | |
abstract void | WriteObfuscated (T value) |
Write value to the obfuscated cache. More... | |
int | RandomValue (int min=int.MinValue, int max=int.MaxValue) |
Get a random value in the specified range. More... | |
T | ReadValue () |
Read the stored real value. More... | |
void | WriteValue (T value) |
Write the real value to store. More... | |
string | ReadText () |
Read the decrypted plain text. More... | |
void | WriteText (string text, bool force=false) |
Encrypt the plain text and write with a new key. More... | |
virtual T | ToValue (string text) |
Convert the decrypted text to the real value. More... | |
virtual string | ToText (T value) |
Convert the real value to the text to encrypt. More... | |
virtual U | ReadEditee () |
Read the stored value to the editee value. More... | |
virtual void | WriteEditee (U editee) |
Write the editee value to the stored value. More... | |
virtual string | ValidateEditee () |
Validate the editee value, return null if correct, otherwise the warning message. More... | |
Properties | |
override T | value [get, set] |
The stored value. More... | |
Wrapper to encrypt and store a value with obfuscated cache for performance.
A derived class should provide a simple algorithm to keep the obfuscated data in the memory.
T | The value type. |
U | The property type for editing, commonly use T or string . |
|
virtual |
Initialize with the specified value.
value | Value. |
OnBeforeSerialize, write the obfuscated cache to the real value.
Reimplemented from CryptoValue< T, U >.
|
virtual |
OnAfterDeserialize, read the real value to the obfuscated cache.
Reimplemented from CryptoValue< T, U >.
|
protectedpure virtual |
Read the obfuscated cache value.
Implemented in CryptoDate, CryptoPeriod, CryptoFloat, CryptoAscii, CryptoBool, CryptoInt, and CryptoLong.
|
protectedpure virtual |
Write value to the obfuscated cache.
value | Value. |
|
protected |
Get a random value in the specified range.
min | Min value. |
max | Max value. |
|
inherited |
Return the plain text.
string
represents this.
|
protectedinherited |
Read the stored real value.
|
protectedinherited |
Write the real value to store.
value | Value. |
|
protectedinherited |
Read the decrypted plain text.
|
protectedinherited |
Encrypt the plain text and write with a new key.
text | Plain text. |
force | If to force update, otherwise check changed in editor. |
|
protectedvirtualinherited |
Convert the decrypted text to the real value.
text | Text. |
Reimplemented in CryptoObject< T, U >.
|
protectedvirtualinherited |
Convert the real value to the text to encrypt.
value | Value. |
Reimplemented in CryptoObject< T, U >.
|
protectedvirtualinherited |
Read the stored value to the editee value.
|
protectedvirtualinherited |
Write the editee value to the stored value.
editee | Editee. |
|
protectedvirtualinherited |
Validate the editee value, return null
if correct, otherwise the warning message.
|
getset |
The stored value.