Ejemplo n.º 1
0
        protected byte[] CMP(byte[] a, byte[] b)
        {
            if (!GeneralUtils.CompareBytes(a, b))
            {
                throw new ArgumentException(String.Format(Properties.Resources.BaseParser_CMPFailure, GeneralUtils.EscapeBytes(a), GeneralUtils.EscapeBytes(b)));
            }

            return(a);
        }
Ejemplo n.º 2
0
        private dynamic DoCmpb(object target, object[] args)
        {
            if (args.Length > 1)
            {
                byte[] a = ToBytes(target, args[0], false, null);
                byte[] b = ToBytes(target, args[1], false, null);

                return(GeneralUtils.CompareBytes(a, b));
            }

            return(false);
        }
Ejemplo n.º 3
0
        private bool CompareValues(DataValue x, DataValue y)
        {
            Type xType = x.Value.GetType();

            if (xType == y.Value.GetType())
            {
                if (xType == typeof(byte[]))
                {
                    return(GeneralUtils.CompareBytes((byte[])x.Value, (byte[])y.Value));
                }
                else
                {
                    return(x.Value.Equals(y.Value));
                }
            }

            return(false);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Equals method
        /// </summary>
        /// <param name="x">First frame</param>
        /// <param name="y">Second frame</param>
        /// <returns>True if equals</returns>
        public bool Equals(DataFrame x, DataFrame y)
        {
            if (ReferenceEquals(x, y))
            {
                return(true);
            }
            else
            {
                if (x.IsBasic)
                {
                    if (y.IsBasic)
                    {
                        return(GeneralUtils.CompareBytes(x.ToArray(), y.ToArray()));
                    }
                }
                else if ((x.Root != null) && (y.Root != null))
                {
                    return(_nodeComparer.Equals(x.Root, y.Root));
                }
            }

            return(false);
        }
        //TODO: Maybe optimize by saving byte arrays

        /// <summary>
        /// Whether the two frames are equal
        /// </summary>
        /// <param name="x">Left frame</param>
        /// <param name="y">Right frame</param>
        /// <returns></returns>
        public bool Equals(DataFrame x, DataFrame y)
        {
            return(GeneralUtils.CompareBytes(x.ToArray(), y.ToArray()));
        }