Class Map
Implements
ITypeDescriptorContext
Assembly: Xareus.Scenarios.dll
Syntax
[Serializable]
public class Map : Dictionary<string, object>, IDictionary<string, object>, ICollection<KeyValuePair<string, object>>, IReadOnlyDictionary<string, object>, IReadOnlyCollection<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>, IDictionary, ICollection, IEnumerable, IDeserializationCallback, ISerializable, IContext, ITypeDescriptorContext, IServiceProvider
Constructors
Map()
Declaration
Map(Dictionary<string, object>)
Construct map from existing dictionary
Declaration
public Map(Dictionary<string, object> dictionary)
Parameters
Map(SerializationInfo, StreamingContext)
Declaration
protected Map(SerializationInfo info, StreamingContext context)
Parameters
Properties
Container
Declaration
public virtual IContainer Container { get; }
Property Value
| Type |
Description |
| IContainer |
An System.ComponentModel.IContainer with the set of objects for this TypeDescriptor; otherwise, null if there is no container or if the TypeDescriptor does not use outside objects.
|
Instance
Gets the object that is connected with this type descriptor request.
Declaration
public virtual object Instance { get; }
Property Value
| Type |
Description |
| object |
The object that invokes the method on the TypeDescriptor; otherwise, null if there is no object responsible for the call.
|
PropertyDescriptor
Gets the System.ComponentModel.PropertyDescriptor that is associated with the given context item.
Declaration
public virtual PropertyDescriptor PropertyDescriptor { get; }
Property Value
| Type |
Description |
| PropertyDescriptor |
The System.ComponentModel.PropertyDescriptor that describes the given context item; otherwise, null if there is no System.ComponentModel.PropertyDescriptor responsible for the call.
|
Methods
ExtractMapAndKey(string, bool, bool)
Extract the furthest nested map and the key from a given path
Declaration
protected (bool, Map, string) ExtractMapAndKey(string path, bool silent = false, bool createIfNotFound = false)
Parameters
| Type |
Name |
Description |
| string |
path |
the full path in the form CONTEXT.any.possible.path.THEKEY
|
| bool |
silent |
|
| bool |
createIfNotFound |
create the path and the key if they are missing
|
Returns
| Type |
Description |
| (bool, Map, string) |
Truple :
True if the nested map was found and it contains the key, false otherwise
The furthest nested map (null if not found)
The key in the nested map (null if not found)
|
GetPaths()
Declaration
public IEnumerable<string> GetPaths()
Returns
GetPaths(string, KeyValuePair<string, object>)
Gets the list of paths recursively
Declaration
protected List<string> GetPaths(string currentPath, KeyValuePair<string, object> current)
Parameters
Returns
GetService(Type)
Gets the service object of the specified type.
Declaration
public virtual object GetService(Type serviceType)
Parameters
| Type |
Name |
Description |
| Type |
serviceType |
An object that specifies the type of service object to get.
|
Returns
| Type |
Description |
| object |
A service object of type serviceType.
-or-
null if there is no service object of type serviceType.
|
GetValue(string)
Declaration
public object GetValue(string path)
Parameters
| Type |
Name |
Description |
| string |
path |
|
Returns
GetValue(string, bool, bool)
Gets the value at the given path.
Declaration
public object GetValue(string path, bool silent, bool createIfNotFound = false)
Parameters
| Type |
Name |
Description |
| string |
path |
|
| bool |
silent |
Disable logs if true
|
| bool |
createIfNotFound |
Create the path with a null value if it doesn't exists
|
Returns
GetValueOrDefault(string, object)
Declaration
public object GetValueOrDefault(string path, object defaultValue = null)
Parameters
Returns
GetValue<T>(string)
Get the value at the given path
Declaration
public T GetValue<T>(string path)
Parameters
| Type |
Name |
Description |
| string |
path |
|
Returns
| Type |
Description |
| T |
The value at the given path if the path exists, fails otherwise
|
Type Parameters
GetValue<T>(string, T)
Gets the value at the given path
Declaration
public T GetValue<T>(string path, T defaultValue)
Parameters
| Type |
Name |
Description |
| string |
path |
|
| T |
defaultValue |
The value to return if the given path is incorrect
|
Returns
| Type |
Description |
| T |
The value at the given path if the path exists, the given valueIfNotFound value otherwise
|
Type Parameters
HasPath(string)
Declaration
public bool HasPath(string path)
Parameters
| Type |
Name |
Description |
| string |
path |
|
Returns
OnComponentChanged()
Declaration
public virtual void OnComponentChanged()
OnComponentChanging()
Declaration
public virtual bool OnComponentChanging()
Returns
| Type |
Description |
| bool |
true if this object can be changed; otherwise, false.
|
SetValue(string, object)
Declaration
public void SetValue(string path, object value)
Parameters
SetValue<T>(string, T)
Changes or sets the value at the given path
Declaration
public void SetValue<T>(string path, T value)
Parameters
| Type |
Name |
Description |
| string |
path |
|
| T |
value |
|
Type Parameters
ToString()
Declaration
public override string ToString()
Returns
Overrides
Union(string, IContext)
Declaration
public void Union(string path, IContext other)
Parameters
Union(IContext, bool)
Declaration
public void Union(IContext other, bool overrideDuplicates = true)
Parameters
| Type |
Name |
Description |
| IContext |
other |
|
| bool |
overrideDuplicates |
|
Implements
System.Collections.Generic.IReadOnlyDictionary<TKey, TValue>
System.ComponentModel.ITypeDescriptorContext