Exemplo n.º 1
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);
     }
 }
Exemplo n.º 2
0
        // <summary>
        // Deserialize the node from the given object.
        // </summary>
        public void Deserialize(JObject obj)
        {
            foreach (var prop in obj)
            {
                if (prop.Key == "?value")
                {
                    Value.Set(prop.Value);
                }
                else if (prop.Key.StartsWith("$"))
                {
                    Configs.Set(prop.Key.Substring(1), new Value(prop.Value));
                }
                else if (prop.Key.StartsWith("@"))
                {
                    Attributes.Set(prop.Key.Substring(1), new Value(prop.Value));
                }
                else if (prop.Key == "privateConfigs")
                {
                    foreach (var entry in prop.Value.Value <JObject>())
                    {
                        PrivateConfigs.Set(entry.Key, new Value(entry.Value));
                    }
                }
                else if (prop.Value is JObject)
                {
                    string name = prop.Key;

                    if (!Children.ContainsKey(name))
                    {
                        string className;
                        if (prop.Value["?class"] != null)
                        {
                            className = prop.Value["?class"].Value <string>();
                        }
                        else
                        {
                            className = "node";
                        }

                        var builder = CreateChild(name, className);
                        builder.Deserialize((JObject)prop.Value);
                        builder.BuildNode();
                    }
                    else
                    {
                        Children[name].Deserialize((JObject)prop.Value);
                    }
                }
            }
        }
Exemplo n.º 3
0
 private void _createInitialData()
 {
     Configs.Set(ConfigType.ClassName, new Value(ClassName));
 }