IGLib
1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
|
Public Member Functions | |
StringSettings () | |
override void | Export (string filePath) |
Saves (serializes) the specified variable system to the specified JSON file. More... | |
override void | Export (string filePath, bool append) |
Saves (serializes) the specified variable system to the specified JSON file. More... | |
override void | Import (string filePath) |
Imports variables from the specified variable system in JSON format. More... | |
bool | LockFileMutexCheckAbandoned () |
Check whether the filesystem locking mutex (property LockFileMutex) has been abandoned, and returns true if it has been (otherwise, false is returned). More... | |
int | AddSettingDirectories (params string[] directoryPaths) |
Adds the specified directory paths to the list of directories that are periodically checked for settings to be imported. More... | |
int | RemoveSettingDirectories (params string[] directoryPaths) |
Removes the specified directory paths to the list of directories that are periodically checked for settings to be imported. More... | |
bool | IsPeriodicImportCheckPerformed () |
Returns a flag indicating whether the state of the current setting object is such that periodic checks and imports of settings form files are performed. More... | |
![]() | |
StringVariableSystem () | |
Constructs a new system of string variables. More... | |
virtual string | GetVariable (string varName) |
Returns value of the specified variable, or null if it is not defined. More... | |
virtual void | SetVariable (string varName, string varValue) |
Sets the specified variable to the specified value. More... | |
virtual void | AddNewVariable (string varName, string varValue) |
Adds a new variable of the specified name and with the specified value (which can be null). More... | |
virtual bool | RemoveVariable (string varName) |
Removes a variable with the specified name from the current variable system, and returns a flag indicating whether variable was actually removed. More... | |
virtual int | RemoveVariables (params string[] varNames) |
Removes all variables whose names are specified by the argument, and returns the number of variables that were actully been removed. More... | |
virtual bool | UnSetVariable (string varName) |
Unsets the variable with the specified name on the current variable system, and returns a flag indicating whether variable was defined. More... | |
virtual bool | IsVariableDefined (string varName) |
Returns true if the specified variable is defined, false otherwise. More... | |
virtual string[][] | ToArray () |
Returns array representation of variables that are currently defined on the system. More... | |
virtual void | ImportVariables (string[][] variables) |
Imports variables defined in form of two dimensional array. More... | |
virtual void | SetVariable (string varName, object varValue) |
Sets the specified variable to the specified value. More... | |
bool | TryGetIntegerVariable (string varName, out int varTypedValue) |
Obtains a value of an integer-typed variable of the specified name, if such a variable is defined and its value can be interpreted as an integer. More... | |
int | GetIntegerVariable (string varName) |
Returns the value of an integer-valued variable of the specified name. More... | |
bool | TryGetDoubleVariable (string varName, out double varTypedValue) |
Obtains a value of a double-typed variable of the specified name, if such a variable is defined and its value can be interpreted as a number of type double. More... | |
double | GetDoubleVariable (string varName) |
Returns the value of a double-valued variable of the specified name. More... | |
bool | TryGetBooleanVariable (string varName, out bool varTypedValue) |
Obtains a value of a boolean-typed variable of the specified name, if such a variable is defined and its value can be interpreted as a boolean value. More... | |
bool | GetBooleanVariable (string varName) |
Returns the value of a boolean-valued variable of the specified name. More... | |
bool | GetFlag (string flagName) |
Returns value of the flag with the specified name. More... | |
void | SetFlag (string flagName, bool flagValue) |
Sets the flag of the specified name to the specified value. More... | |
void | PrintVariables () |
Prints all variables (with their values) defined on the current object. More... | |
Static Public Member Functions | |
static void | SaveJson (StringSettings settings, string filePath) |
Saves (serializes) the specified variable system to the specified JSON file. File is owerwritten if it exists. More... | |
static void | SaveJson (StringSettings settings, string filePath, bool append) |
Saves (serializes) the specified variable system to the specified JSON file. If the file already exists, contents either overwrites the file or is appended at the end, dependent on the value of the append flag. More... | |
static void | LoadJson (string filePath, ref StringSettings settingsRestored) |
Restores (deserializes) a vector from the specified file in JSON format. More... | |
static void | ExportDto (StringSettingsDto settings, string filePath) |
Saves (serializes) the specified variable system DTO to the specified JSON file. More... | |
static void | ExportDto (StringSettingsDto variables, string filePath, bool append) |
Saves (serializes) the specified variable system DTO to the specified JSON file. More... | |
static void | ImportDto (string filePath, ref StringSettingsDto settings) |
Restores (deserializes) variable system DTO from the specified file in JSON format. More... | |
![]() | |
static void | SaveJson (StringVariableSystem variableSystem, string filePath) |
Saves (serializes) the specified variable system to the specified JSON file. File is owerwritten if it exists. More... | |
static void | SaveJson (StringVariableSystem variableSystem, string filePath, bool append) |
Saves (serializes) the specified variable system to the specified JSON file. If the file already exists, contents either overwrites the file or is appended at the end, dependent on the value of the append flag. More... | |
static void | LoadJson (string filePath, ref StringVariableSystem variableSystemRestored) |
Restores (deserializes) a vector from the specified file in JSON format. More... | |
static void | ExportDto (StringVariableSystemDto settings, string filePath) |
Saves (serializes) the specified variable system DTO to the specified JSON file. More... | |
static void | ExportDto (StringVariableSystemDto variables, string filePath, bool append) |
Saves (serializes) the specified variable system DTO to the specified JSON file. More... | |
static void | ImportDto (string filePath, ref StringVariableSystemDto settings) |
Restores (deserializes) variable system DTO from the specified file in JSON format. More... | |
static void | TestMisc () |
Miscellaneous tests. More... | |
Public Attributes | |
const string | DefaultLockFileMutexName = "Global\\IG.Lib.Utils.MutexSettingsDefault.R2D2_by_Igor_Gresovnik" |
Default name of the mutex for system-wide locking of files used by the current class. More... | |
const string | DefaultImportingFilename = "settingsglobal.json" |
Default name of the file containing settings to be imported. More... | |
const string | DefaultMsgImportOnceFilename = "importsettings.msg" |
Default name of the message file instructing object of this class to import the settings file once and then delete the message. More... | |
const string | DefaultMsgImportContinuoslyFilename = "importsettingscontinuously.msg" |
Default name of the message file instructing object of this class to continuously import the settings file without deleting the message. More... | |
const double | DefaultImportCheckPeriodSeconds = 1.0421 |
Default period for checking for settings to be imported (ind importing them, if applicable). More... | |
const double | MinimalImportCheckPeriodSeconds = 0.01 |
Minimal period for checking for settings to be imported (ind importing them, if applicable). More... | |
Protected Member Functions | |
bool | CheckAndImport (string directoryPath) |
Check the directory with the specified path for instructions to import the settings file, imports the settings file if instructed so and if the settings file exists, and eventualy removes the message instructing a single import. More... | |
void | ImportPeriodically () |
Periodically checks the designated directories for settings to be imported, and imports them if availeble. More... | |
void | StartImportingThreadIfNotRunning () |
Starts the thread that periodically checks for settings to be imported and imports them. More... | |
void | StopImportingThreadIfRunning () |
Stops the thread that periodically checks for settings to be imported and imports them. More... | |
void | OnChangedImportingStatus () |
Method that is called every time the state of variables that influence how periodic importing is done, is changed. More... | |
Protected Attributes | |
string | _lockFileMutexName = DefaultLockFileMutexName |
Mutex | _lockFileMutex |
string | _msgImportOnceFilename = DefaultMsgImportOnceFilename |
string | _msgImportContinuouslyFilename = DefaultMsgImportContinuoslyFilename |
string | _importingFilename = DefaultImportingFilename |
bool | _doImportPeriodically = true |
double | _importCheckPeriodSeconds = DefaultImportCheckPeriodSeconds |
Thread | _importingThread |
![]() | |
SortedList< string, string > | _variables = new SortedList<string, string>() |
Properties | |
string | LockFileMutexName [get, set] |
Name of the mutex for system-wide locking of files used by the current class. More... | |
virtual Mutex | LockFileMutex [get, set] |
Mutex for system-wide exclusive locks for file system operations related to the current class. More... | |
string | MsgImportOnceFilename [get, set] |
Name of the message file instructing object of this class to import the settings file once and then delete the message. More... | |
string | MsgImportContinuoslyFilename [get, set] |
Name of the message file instructing object of this class to continuously import the settings file without deleting the message. More... | |
string | ImportingFilename [get, set] |
Name of the message file instructing object of this class to continuously import the settings file without deleting the message. More... | |
bool | DoImportPeriodically [get, set] |
Flag indicating whether the current object should periodically check the designated directories for settings to be imported, and import them. More... | |
double | ImportCheckPeriodSeconds [get, set] |
Period for checking for settings to be imported (ind importing them, if applicable). More... | |
List< string > | SettingDirectories [get] |
![]() | |
object | Lock [get] |
This object's central lock object to be used by other object. More... | |
bool | SetNullOnImport [get, set] |
Flag indicating whether null variable values are also set when importing variable values. If false then, if some imported variable has null value, this variable will not be set on the current system of variables. This means that the value of eventually existent variable will remain unchanged if variables are imported from another system where this variable is defined but has null value. More... | |
virtual SortedList< string, string > | Variables [get] |
virtual string | this[string varName] [get, set] |
Gets or sets value of the specified variable. More... | |
![]() | |
object | Lock [get] |
Private Attributes | |
List< string > | _settingDirectories |
|
inline |
|
inlinevirtual |
Saves (serializes) the specified variable system to the specified JSON file.
If the file already exists, contents overwrite the file.
filePath | Path to the file in variables and properties of the system are saved. |
Reimplemented from IG.Lib.StringVariableSystem.
|
inlinevirtual |
Saves (serializes) the specified variable system to the specified JSON file.
If the file already exists, contents either overwrite the file or are appended at the end, dependent on the value of the append flag.
filePath | Path to the file in variables and properties of the system are saved. |
append | Specifies whether serialized data is appended at the end of the file in the case that the file already exists. |
Reimplemented from IG.Lib.StringVariableSystem.
References IG.Lib.SerializationDtoBase< Type, BaseType >.CopyFrom().
|
inlinevirtual |
Imports variables from the specified variable system in JSON format.
filePath | File from which object is restored. |
Reimplemented from IG.Lib.StringVariableSystem.
|
inlinestatic |
Saves (serializes) the specified variable system to the specified JSON file. File is owerwritten if it exists.
settings | Object that is saved to a file. |
filePath | Path to the file in which object is is saved. |
|
inlinestatic |
Saves (serializes) the specified variable system to the specified JSON file. If the file already exists, contents either overwrites the file or is appended at the end, dependent on the value of the append flag.
settings | Object that is saved to a file. |
filePath | Path to the file into which object is saved. |
append | Specifies whether serialized data is appended at the end of the file in the case that the file already exists. |
References IG.Lib.SerializationDtoBase< Type, BaseType >.CopyFrom().
|
inlinestatic |
Restores (deserializes) a vector from the specified file in JSON format.
filePath | File from which object is restored. |
settingsRestored | Object that is restored by deserialization. |
References IG.Lib.SerializationDtoBase< Type, BaseType >.CopyTo().
|
inlinestatic |
Saves (serializes) the specified variable system DTO to the specified JSON file.
If the file already exists, contents overwrite the file.
settings | Variable system DTO that is saved to a file. |
filePath | Path to the file into which variables (and settings and other stuff) are saved. |
|
inlinestatic |
Saves (serializes) the specified variable system DTO to the specified JSON file.
If the file already exists, contents either overwrite the file or are appended at the end, dependent on the value of the append flag.
variables | Variable system DTO that is saved to a file. |
filePath | Path to the file into which variables (and settings and other stuff) are saved. |
append | Specifies whether serialized data is appended at the end of the file in the case that the file already exists. |
|
inlinestatic |
Restores (deserializes) variable system DTO from the specified file in JSON format.
The restored DTO can be used e.g. to import variables to a variable system.
filePath | File from which object is restored. |
settings | Variable system DTO that is restored by deserialization. |
|
inline |
Check whether the filesystem locking mutex (property LockFileMutex) has been abandoned, and returns true if it has been (otherwise, false is returned).
After the call, mutex is no longer in abandoned state (WaitOne() will not throw an exception) if it has been before the call.
Call does not block.
References IG.Lib.Util.MutexCheckAbandoned().
|
inline |
Adds the specified directory paths to the list of directories that are periodically checked for settings to be imported.
directoryPaths | Paths to be added to the list, can be relative or absolute. |
References IG.Lib.UtilSystem.StandardizeDirectoryPath().
|
inline |
Removes the specified directory paths to the list of directories that are periodically checked for settings to be imported.
directoryPaths | Paths to be added to the list, can be relative or absolute. |
References IG.Lib.UtilSystem.StandardizeDirectoryPath().
|
inlineprotected |
Check the directory with the specified path for instructions to import the settings file, imports the settings file if instructed so and if the settings file exists, and eventualy removes the message instructing a single import.
Returns true if settings were imported, false otherwise.
directoryPath | Path to the directory where settings are checked. |
|
inlineprotected |
Periodically checks the designated directories for settings to be imported, and imports them if availeble.
Check and import is performed by the CheckAndImport method.
References IG.Lib.Util.SleepSeconds().
|
inline |
Returns a flag indicating whether the state of the current setting object is such that periodic checks and imports of settings form files are performed.
|
inlineprotected |
Starts the thread that periodically checks for settings to be imported and imports them.
|
inlineprotected |
Stops the thread that periodically checks for settings to be imported and imports them.
|
inlineprotected |
Method that is called every time the state of variables that influence how periodic importing is done, is changed.
This method checks whether periodic checking should be performed or not. If it should be performed, then it starts the thread that does it, if it is not already running. If it sould not be performed, then it stops that tread if it is running.
const string IG.Lib.StringSettings.DefaultLockFileMutexName = "Global\\IG.Lib.Utils.MutexSettingsDefault.R2D2_by_Igor_Gresovnik" |
Default name of the mutex for system-wide locking of files used by the current class.
const string IG.Lib.StringSettings.DefaultImportingFilename = "settingsglobal.json" |
Default name of the file containing settings to be imported.
const string IG.Lib.StringSettings.DefaultMsgImportOnceFilename = "importsettings.msg" |
Default name of the message file instructing object of this class to import the settings file once and then delete the message.
const string IG.Lib.StringSettings.DefaultMsgImportContinuoslyFilename = "importsettingscontinuously.msg" |
Default name of the message file instructing object of this class to continuously import the settings file without deleting the message.
const double IG.Lib.StringSettings.DefaultImportCheckPeriodSeconds = 1.0421 |
Default period for checking for settings to be imported (ind importing them, if applicable).
const double IG.Lib.StringSettings.MinimalImportCheckPeriodSeconds = 0.01 |
Minimal period for checking for settings to be imported (ind importing them, if applicable).
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
private |
|
protected |
|
getset |
Name of the mutex for system-wide locking of files used by the current class.
|
getsetprotected |
Mutex for system-wide exclusive locks for file system operations related to the current class.
|
getset |
Name of the message file instructing object of this class to import the settings file once and then delete the message.
|
getset |
Name of the message file instructing object of this class to continuously import the settings file without deleting the message.
|
getset |
Name of the message file instructing object of this class to continuously import the settings file without deleting the message.
|
getsetprotected |
Flag indicating whether the current object should periodically check the designated directories for settings to be imported, and import them.
Directories that are checked for settings are set by the AddSettingDirectories and RemoveSettingDirectories methods. Time periods are specified by the ImportCheckPeriodSeconds property.
Checking and importing settings is performed by the CheckAndImport method.
|
getset |
Period for checking for settings to be imported (ind importing them, if applicable).
|
getprotected |