public bool AddVariable(NTVariable value, Type t)
        {
            if (string.IsNullOrEmpty(value.GetKey()))
            {
                return(false);
            }

            Type newVariableType = t;

            NTVariableDictionary variableTypeDictionary = new NTVariableDictionary(t);

            if (dictionary.ContainsKey(newVariableType.ToString()))
            {
                variableTypeDictionary = dictionary[newVariableType.ToString()];
                if (variableTypeDictionary.ContainsKey(value.GetKey()))
                {
                    return(false);
                }
                else
                {
                    variableTypeDictionary.Add(value.GetKey(), value);
                    dictionary[newVariableType.ToString()] = variableTypeDictionary;
                    onModified?.Invoke();
                    return(true);
                }
            }
            else
            {
                variableTypeDictionary.Add(value.GetKey(), value);
                dictionary.Add(newVariableType.ToString(), variableTypeDictionary);
                onModified?.Invoke();
                return(true);
            }
        }
        public void RemoveVariable(string key, Type variableType)
        {
            if (string.IsNullOrEmpty(key))
            {
                return;
            }

            if (dictionary.ContainsKey(variableType.ToString()))
            {
                NTVariableDictionary variableTypeDictionary = dictionary[variableType.ToString()];
                variableTypeDictionary.Remove(key);
                dictionary[variableType.ToString()] = variableTypeDictionary;
                onModified?.Invoke();
            }
        }
        public void RemoveVariable <T>(string key) where T : NTVariable
        {
            if (string.IsNullOrEmpty(key))
            {
                return;
            }

            Type newVariableType = typeof(T);

            if (dictionary.ContainsKey(newVariableType.ToString()))
            {
                NTVariableDictionary variableTypeDictionary = dictionary[newVariableType.ToString()];
                variableTypeDictionary.Remove(key);
                dictionary[newVariableType.ToString()] = variableTypeDictionary;
                onModified?.Invoke();
            }
        }
        public bool AddVariable(Type varType, object value)
        {
            NTVariable ntVar = (NTVariable)value;

            if (ntVar == null)
            {
                return(false);
            }
            if (string.IsNullOrEmpty(ntVar.GetKey()))
            {
                return(false);
            }

            Type newVariableType = varType;
            NTVariableDictionary variableTypeDictionary = new NTVariableDictionary(newVariableType);

            if (dictionary.ContainsKey(newVariableType.ToString()))
            {
                variableTypeDictionary = dictionary[newVariableType.ToString()];
                if (variableTypeDictionary.ContainsKey(ntVar.GetKey()))
                {
                    return(false);
                }
                else
                {
                    variableTypeDictionary.Add(ntVar.GetKey(), ntVar);
                    dictionary[newVariableType.ToString()] = variableTypeDictionary;
                    onModified?.Invoke();
                    return(true);
                }
            }
            else
            {
                variableTypeDictionary.Add(ntVar.GetKey(), ntVar);
                dictionary.Add(newVariableType.ToString(), variableTypeDictionary);
                onModified?.Invoke();
                return(true);
            }
        }
        public List <string> GetOptions(Type variableType, string key, out int index)
        {
            List <string> options = new List <string>();

            index = -1;

            Type newVariableType = variableType;

            if (newVariableType == null)
            {
                return(options);
            }

            NTVariableDictionary variableTypeDictionary = new NTVariableDictionary(newVariableType);

            if (dictionary.ContainsKey(newVariableType.ToString()))
            {
                variableTypeDictionary = dictionary[newVariableType.ToString()];
                options = variableTypeDictionary.keys;
                index   = options.IndexOf(key);
            }

            return(options);
        }