using Newtonsoft.Json;
|
|
namespace HydroUI
|
{
|
|
|
[Serializable]
|
public class dict<TKey, TValue> : Dictionary<TKey, TValue>
|
{
|
|
public bool emptyCreate = true;
|
public dict() : base()
|
{
|
}
|
|
|
public bool Contains(TKey key)
|
{
|
return this.ContainsKey(key);
|
}
|
|
public TValue this[TKey key]
|
{
|
get
|
{
|
if (!this.ContainsKey(key))
|
{
|
lock (this)
|
{
|
if (!this.ContainsKey(key))
|
{
|
if (emptyCreate)
|
this.Add(key, default(TValue));
|
else
|
return default(TValue);
|
}
|
}
|
}
|
return base[key];
|
|
}
|
set
|
{
|
if (!this.ContainsKey(key))
|
{
|
lock (this)
|
{
|
if (!this.ContainsKey(key))
|
{
|
if (emptyCreate)
|
this.Add(key, value);
|
else
|
return;
|
}
|
}
|
}
|
base[key] = value;
|
}
|
|
}
|
|
public override string ToString()
|
{
|
return JsonConvert.SerializeObject(this);
|
}
|
|
public bool Remove(KeyValuePair<TKey, TValue> key)
|
{
|
return this.Remove(key.Key);
|
}
|
|
|
|
|
#region IntentCommand
|
public double confidence;
|
public string methodName;
|
public dict<TKey, TValue> args;
|
public string current_arg;
|
#endregion
|
|
}
|
|
}
|