Exemple #1
0
        private static void ProcessAttribute(FHXObject attr)
        {
            FHXObject parent = attr.Parent;

            if (parent == null)
            {
                return;
            }
            List <FHXObject> ATTRIBUTE = parent.GetAllChildren();

            ATTRIBUTE = ATTRIBUTE.Where(i => i.Type == "ATTRIBUTE" && i.Name == attr.Name).ToList();

            if (ATTRIBUTE.Count > 1)
            {
                Console.WriteLine("Multiple instances of {0} found", attr.Name);
            }

            foreach (var a in ATTRIBUTE)
            {
                if (a.Parent != null)
                {
                    //Adds the ATTRIBUTE_INSTANCE in the parent of the ATTRIBUTE
                    attr.SetParent(null);
                    a.Parent.AddChild(attr);

                    attr.AddParameter(a.GetParameter("TYPE"));

                    //Removes the ATTRIBUTE from its parent
                    a.Parent.RemoveChild(a);
                    a.SetParent(null);
                }
            }
        }
Exemple #2
0
        private static void ProcessFB(FHXObject fb, List <FHXObject> FUNCTION_BLOCK_DEFINITION)
        {
            FHXObject parent = fb.Parent;

            fb.Parent.RemoveChild(fb);
            fb.SetParent(null);

            if (FUNCTION_BLOCK_DEFINITION.Any(i => i.Name == fb.GetParameter("DEFINITION").Value))
            {
                foreach (FHXObject newChild in FUNCTION_BLOCK_DEFINITION.Where(i => i.Name == fb.GetParameter("DEFINITION").Value))
                {
                    newChild.mName = fb.Name;
                    newChild.Type  = "FUNCTION_BLOCK";
                    newChild.Parent.RemoveChild(newChild);
                    newChild.SetParent(null);
                    parent.AddChild(newChild);
                }
            }
        }
Exemple #3
0
 public void AddChild(FHXObject obj)
 {
     Children.Add(obj);
     obj.SetParent(this);
 }