Exemple #1
0
        private bool matchMarkToXML(_Mark m, List <XmlNode> rows, ref Dictionary <_Mark, XmlNode> warning)
        {
            foreach (XmlNode row in rows)
            {
                XmlNode rebar = row["B2aBar"];

                if (rebar == null)
                {
                    return(false);
                }

                string type   = XML_Handle.emptyNodehandle(rebar, "Type");
                string pos_nr = XML_Handle.emptyNodehandle(rebar, "Litt");
                string diam   = XML_Handle.emptyNodehandle(rebar, "Dim");

                if (m.Position_Shape == "A")
                {
                    if (m.Position_Shape == type && m.Position_Nr.ToString() == pos_nr && m.Diameter.ToString() == diam)
                    {
                        write("Found in XML: " + m.ToString());
                        string rebarString = XML_Handle.getXMLRebarString(rebar);
                        write(rebarString);
                        write("");
                        return(true);
                    }
                }
                else
                {
                    if (m.Position_Nr.ToString() == pos_nr)
                    {
                        if (m.Position_Shape.ToString() != type)
                        {
                            warning[m] = rebar;
                        }
                        else if (m.Diameter.ToString() != diam)
                        {
                            warning[m] = rebar;
                        }

                        write("Found in XML: " + m.ToString());
                        string rebarString = XML_Handle.getXMLRebarString(rebar);
                        write(rebarString);
                        write("");
                        return(true);
                    }
                }
            }

            return(false);
        }
Exemple #2
0
        private void printSimilar(List <XmlNode> rebars)
        {
            foreach (XmlNode row in rebars)
            {
                XmlNode rebar = row["B2aBar"];
                if (rebar == null)
                {
                    write("error reading");
                    continue;
                }

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

            write("[NB! Sümeetrilisust kontrollitakse B, C, D, F, N - tüüpi raudadel]");
        }
Exemple #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);
            xmlDoc = XML_Handle.removeEmptyNodes(xmlDoc);

            List <_Mark> marks         = getSelectedMarks();
            List <_Mark> filteredMarks = filterSelectedMarks(marks);

            List <XmlNode> pages  = XML_Handle.getAllPages(xmlDoc);
            List <XmlNode> rebars = XML_Handle.getAllRebar(xmlDoc);

            Dictionary <_Mark, XmlNode> warning = new Dictionary <_Mark, XmlNode>();
            List <_Mark> undefined = findMarksInXML(rebars, filteredMarks, ref warning);

            if (undefined.Count != 0)
            {
                List <XmlNode> newRebars = handleUndefined(undefined, rebars, xmlDoc);
                rebars.AddRange(newRebars);
                filtreeri(pages, rebars, xmlDoc);
                xmlDoc.Save(xml_output_full);
            }

            foreach (_Mark m in warning.Keys)
            {
                write("--- WARINING: " + m.ToString());
                string rebarString = XML_Handle.getXMLRebarString(warning[m]);
                write("--- WARINING: " + rebarString);
                write("");
            }
        }
Exemple #4
0
        private List <XmlNode> handleUndefined(List <_Mark> undefined, List <XmlNode> rebars, XmlDocument xmlDoc)
        {
            List <XmlNode> newRebar = new List <XmlNode>();

            write(" ");
            foreach (_Mark u in undefined)
            {
                write("--- Not found: " + u.ToString());
            }

            string materjal = promptGetMaterial();

            foreach (_Mark u in undefined)
            {
                bool add = promptAddRebarToXml(u);
                if (add)
                {
                    XmlNode newNode   = XML_Handle.newNodeHandle(u, materjal, xmlDoc, _c.ed);
                    XmlNode dublicate = checkIfRebarExists(newNode, rebars);
                    if (dublicate == null)
                    {
                        newRebar.Add(newNode);
                    }
                    else
                    {
                        write("Sama kujuga raud on juba olemas!");
                        XmlNode rebar       = dublicate["B2aBar"];
                        string  rebarString = XML_Handle.getXMLRebarString(rebar);
                        write(rebarString);
                    }
                }
                else
                {
                    write("Skip: " + u.ToString());
                }
            }

            return(newRebar);
        }
Exemple #5
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);
            }
        }