Exemplo n.º 1
0
        /*
         * If configure MACHINE, the ByteOrder in database will
         * switch to LITTLE_ENDIAN or BIG_ENDIAN according to the
         * current machine.
         */
        public static void ConfirmByteOrder(XmlElement xmlElem,
                                            string name, ByteOrder byteOrder, bool compulsory)
        {
            XmlNode   xmlNode;
            ByteOrder specOrder;

            xmlNode = XMLReader.GetNode(xmlElem, name);
            if (xmlNode == null && compulsory == true)
            {
                throw new ConfigNotFoundException(name);
            }
            else if (xmlNode != null)
            {
                specOrder = ByteOrder.FromConst(int.Parse(
                                                    xmlNode.InnerText));
                if (specOrder == ByteOrder.MACHINE)
                {
                    Assert.AreNotEqual(specOrder, byteOrder);
                }
                else
                {
                    Assert.AreEqual(specOrder, byteOrder);
                }
            }
        }
Exemplo n.º 2
0
        public static bool ConfigByteOrder(XmlElement xmlElem,
                                           string name, ref ByteOrder byteOrder, bool compulsory)
        {
            XmlNode xmlNode;

            xmlNode = XMLReader.GetNode(xmlElem, name);
            if (xmlNode == null && compulsory == false)
            {
                return(false);
            }
            else if (xmlNode == null && compulsory == true)
            {
                throw new ConfigNotFoundException(name);
            }

            byteOrder = ByteOrder.FromConst(
                int.Parse(xmlNode.InnerText));
            return(true);
        }