Example #1
0
        /// <summary>
        /// Constructs an instance from the given XML element
        /// </summary>
        /// <param name="element">the XML element</param>
        /// <returns>the created instance</returns>
        public static ALULogEntry FromXML(XmlElement element)
        {
            ALULogEntry result = new ALULogEntry();

            // get the name
            result.name = element.GetAttribute("Name");

            // parse all the child elements
            // parse all the entries
            for (int i = 0; i < element.ChildNodes.Count; ++i)
            {
                XmlElement child = element.ChildNodes[i] as XmlElement;
                if (child == null)
                {
                    continue;
                }

                switch (child.Name)
                {
                default:
                    result.attributes[child.Name] = child.GetAttribute("value");
                    break;
                }
            }

            return(result);
        }
Example #2
0
        /// <summary>
        /// Constructs an instance from the given XML element
        /// </summary>
        /// <param name="element">the XML element</param>
        /// <returns>the resulting instance</returns>
        public static MathBoxLogEntry FromElement(XmlElement element)
        {
            MathBoxLogEntry result = new MathBoxLogEntry();

            // parse all the child elements
            // parse all the entries
            for (int i = 0; i < element.ChildNodes.Count; ++i)
            {
                XmlElement child = element.ChildNodes[i] as XmlElement;
                if (child == null)
                {
                    continue;
                }

                switch (child.Name)
                {
                case "ALU":
                    result.alu.Add(ALULogEntry.FromXML(child));
                    break;

                default:
                    result.attributes[child.Name] = child.GetAttribute("value");
                    break;
                }
            }

            return(result);
        }
Example #3
0
        private void UpdateControls()
        {
            // special case if our entry is null
            ALULogEntry entry = this.logEntry;

            if (entry == null)
            {
                entry = new ALULogEntry();
            }

            a.Field      = entry.GetAttribute("A");
            b.Field      = entry.GetAttribute("B");
            dataIn.Field = entry.GetAttribute("DataIn");
            cn.Field     = entry.GetAttribute("Cn");
            f3.Field     = entry.GetAttribute("F3");
            i678.Field   = entry.GetAttribute("I678");
            ovr.Field    = entry.GetAttribute("OVR");
            r.Field      = entry.GetAttribute("R");
            s.Field      = entry.GetAttribute("S");
            qLatch.Field = entry.GetAttribute("QLatch");

            // set i012
            string i012Value = entry.GetAttribute("I012");

            switch (i012Value)
            {
            case "00": i012.Field = "AQ (0)"; break;

            case "01": i012.Field = "AB (1)"; break;

            case "02": i012.Field = "ZQ (2)"; break;

            case "03": i012.Field = "ZB (3)"; break;

            case "04": i012.Field = "ZA (4)"; break;

            case "05": i012.Field = "DA (5)"; break;

            case "06": i012.Field = "DQ (6)"; break;

            case "07": i012.Field = "DZ (7)"; break;

            default: i012.Field = i012Value; break;
            }

            // set i345
            string i345Value = entry.GetAttribute("I345");

            switch (i345Value)
            {
            case "00": i345.Field = "ADD (0)"; break;

            case "01": i345.Field = "SUBR (1)"; break;

            case "02": i345.Field = "SUBS (2)"; break;

            case "03": i345.Field = "OR (3)"; break;

            case "04": i345.Field = "AND (4)"; break;

            case "05": i345.Field = "NOTRS (5)"; break;

            case "06": i345.Field = "EXOR (6)"; break;

            case "07": i345.Field = "EXNOR (7)"; break;

            default: i345.Field = i345Value; break;
            }

            // RAM
            ram0.Text = entry.GetAttribute("RAM0");
            ram1.Text = entry.GetAttribute("RAM1");
            ram2.Text = entry.GetAttribute("RAM2");
            ram3.Text = entry.GetAttribute("RAM3");
            ram4.Text = entry.GetAttribute("RAM4");
            ram5.Text = entry.GetAttribute("RAM5");
            ram6.Text = entry.GetAttribute("RAM6");
            ram7.Text = entry.GetAttribute("RAM7");
            ram8.Text = entry.GetAttribute("RAM8");
            ram9.Text = entry.GetAttribute("RAM9");
            ramA.Text = entry.GetAttribute("RAMA");
            ramB.Text = entry.GetAttribute("RAMB");
            ramC.Text = entry.GetAttribute("RAMC");
            ramD.Text = entry.GetAttribute("RAMD");
            ramE.Text = entry.GetAttribute("RAME");
            ramF.Text = entry.GetAttribute("RAMF");
        }