Пример #1
0
        private XmlNode checkIfRebarExists(XmlNode newNode, List <XmlNode> rebars)
        {
            string         filter   = newNode["B2aBar"]["Type"].InnerText;
            List <XmlNode> filtered = XML_Handle.filter(rebars, filter);

            foreach (XmlNode rebar in filtered)
            {
                XmlNode dublicate = XML_Handle.compare(newNode, rebar);
                if (dublicate != null)
                {
                    return(dublicate);
                }
            }

            return(null);
        }
Пример #2
0
        public void run()
        {
            if (!File.Exists(xml_full))
            {
                throw new DMTException("[ERROR] Joonise kaustas ei ole XML faili nimega: " + name + ".xml");
            }
            if (File.Exists(xml_lock_full))
            {
                throw new DMTLockedException("[ERROR] XML fail nimega: " + name + ".xml" + " on lukkus!");
            }


            string userFilter = promptFilter();

            if (userFilter == null)
            {
                return;
            }

            string userDiameter = promptDiameter();

            if (userDiameter == null || userDiameter == "")
            {
                userDiameter = "???";
            }

            File.Create(xml_lock_full).Dispose();
            write("[XML] LOCK ON");

            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(xml_full);

            List <XmlNode> rows = XML_Handle.getAllRebar(xmlDoc);

            List <XmlNode> filteredRows = XML_Handle.filter(rows, userFilter);
            List <XmlNode> similar      = findSimilar(userFilter, userDiameter, filteredRows, xmlDoc);

            printSimilar(similar);
        }
Пример #3
0
        public void run()
        {
            if (!File.Exists(xml_full))
            {
                throw new DMTException("[ERROR] Joonise kaustas ei ole XML faili nimega: " + name + ".xml");
            }
            if (File.Exists(xml_lock_full))
            {
                throw new DMTLockedException("[ERROR] XML fail nimega: " + name + ".xml" + " on lukkus!");
            }

            File.Create(xml_lock_full).Dispose();
            write("[XML] LOCK ON");

            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(xml_full);

            List <XmlNode> rows = XML_Handle.getAllRebar(xmlDoc);

            string         userFilter   = promptFilter();
            List <XmlNode> filteredRows = XML_Handle.filter(rows, userFilter);

            foreach (XmlNode row in filteredRows)
            {
                XmlNode rebar = row["B2aBar"];
                if (rebar == null)
                {
                    write("error reading");
                    continue;
                }

                string rebarString = XML_Handle.getXMLRebarString(rebar);
                write(rebarString);
            }
        }