Esempio n. 1
0
        /// <summary>
        /// Adds a parameter.
        /// </summary>
        /// <param name="parameter">Parameter</param>
        public void AddParameter(Parameter parameter)
        {
            if (!Configs.Has(ConfigType.Parameters))
            {
                Configs.Set(ConfigType.Parameters, new Value(new JArray()));
            }
            var parameters = Configs.Get(ConfigType.Parameters).JArray;

            foreach (JToken token in parameters)
            {
                if (token["name"].Value <string>() == parameter.Name)
                {
                    throw new Exception($"Parameter {parameter.Name} already exists on {_path}");
                }
            }
            parameters.Add(parameter);
        }
Esempio n. 2
0
 /// <summary>
 /// Initializes the Node Class.
 /// </summary>
 public void InitializeClass()
 {
     if (_initializedClass || _link == null)
     {
         return;
     }
     _initializedClass = true;
     if (_link.Responder.NodeClasses.ContainsKey(ClassName) &&
         (!PrivateConfigs.Has("nodeClassInit") || PrivateConfigs.Get("nodeClassInit").Boolean == false))
     {
         PrivateConfigs.Set("nodeClassInit", new Value(true));
         ResetNode();
         _link.Responder.NodeClasses[ClassName](this);
     }
 }