CGToGH.GH_FileComposer.ConstructGH C# (CSharp) 메소드

ConstructGH() 개인적인 메소드

private ConstructGH ( ) : void
리턴 void
        private void ConstructGH()
        {
            var root = doc.Root;
            var definition = findChunk(root, "Definition");
            var definitionObjects = findChunk(definition, "DefinitionObjects");
            var objChunks = getChunks(definitionObjects);

            List<XElement> nodesFromGraph = new List<XElement>();

            foreach (Node n in graph.Nodes)
            {
                nodesFromGraph.Add(ElementFromNode(n));

            }

            int i=0;
            foreach (XElement nodeFromGraph in nodesFromGraph)
            {

                try
                {

                    nodeFromGraph.SetAttributeValue(XName.Get("index"), i);
                    i++;
                }
                catch { }

            }

            var items = definitionObjects.Elements().Where(elem => elem.Name == "items").First();

            var objectCount = items.Elements().Where(elem => elementName(elem) == "ObjectCount").First();

            int newCount = nodesFromGraph.Count;
            objectCount.Value = newCount.ToString();

            objChunks.First().Parent.ReplaceAll(nodesFromGraph.ToArray());
              //  foreach (XElement objChunk in objChunks)
              //  {
               //     objChunk.Parent.ReplaceAll(dummyElement);
              //  objChunk.Remove();
             //   }
        }