Exemplo n.º 1
0
        public static void ifcConnector(string pathSchema, string pathIfc, string pathJson)         //connects the properties to the definition of the properties
        {
            Dictionary <string, Dictionary <string, string> > ifcFile = new Dictionary <string, Dictionary <string, string> >();
            Dictionary <string, string> element = new Dictionary <string, string>();

            string[] valuesArray = ifcSplit(pathIfc);
            string[] defsArray   = findEntity(pathSchema, "ENTITY " + valuesArray[1]);

            for (int index = 0, defsIndex = 0; index < valuesArray.Length; index++, defsIndex++)
            {   // handle the end of the entity
                if (valuesArray[index].Equals(Environment.NewLine))
                {
                    ifcFile.Add(element["objectRef"], element);
                    if (index != valuesArray.Length - 1)
                    {
                        element = new Dictionary <string, string>();                                 //einfache def?
                        System.Console.WriteLine(valuesArray[index + 1]);
                        defsArray = findEntity(pathSchema, "ENTITY " + valuesArray[index + 2]);
                        defsIndex = -1;
                    }
                }
                else
                {
                    element.Add(defsArray[defsIndex], valuesArray[index]);
                }
            }
            MakeFile.mainPrint(ifcFile, pathJson);
        }
Exemplo n.º 2
0
        public static void ifcConnector(string pathSchema, string pathIfc, string pathJson)         //connects the properties to the definition of the properties
        {
            Dictionary <string, Dictionary <string, string> > ifcFile = new Dictionary <string, Dictionary <string, string> >();
            Dictionary <string, string> element = new Dictionary <string, string>();
            var           lines     = File.ReadAllLines(pathSchema);
            List <string> linesList = lines.OfType <string>().ToList();

            string[] valuesArray = ifcSplit(pathIfc);
            string[] defsArray   = findEntity(linesList, "ENTITY " + valuesArray[1]);

            /*foreach (string st in defsArray)
             *  System.Console.WriteLine(st);
             * foreach (string st in valuesArray)
             *  System.Console.WriteLine(st);*/

            for (int index = 0, defsIndex = 0; index < valuesArray.Length; index++, defsIndex++)
            {   // handle the end of the entity
                //foreach (string st in defsArray)
                //  System.Console.WriteLine(st);
                //if (valuesArray[index+1] == "#32")


                if (valuesArray[index].Equals(Environment.NewLine))
                {
                    ifcFile.Add(element["objectRef"], element);
                    if (index != valuesArray.Length - 1)
                    {
                        element   = new Dictionary <string, string>();                              //einfache def?
                        defsArray = findEntity(linesList, "ENTITY " + valuesArray[index + 2]);
                        defsIndex = -1;
                    }
                }
                else
                {
                    //System.Console.WriteLine(defsIndex);
                    System.Console.WriteLine(defsArray[defsIndex]);
                    //System.Console.WriteLine(index);
                    System.Console.WriteLine(valuesArray[index]);
                    element.Add(defsArray[defsIndex], valuesArray[index]);
                }
            }
            MakeFile.mainPrint(ifcFile, pathJson);
        }