示例#1
0
        public override bool Equals(object obj)
        {
            ONBlob lObj2 = obj as ONBlob;

            if ((Value == null) && (((object)lObj2 == null) || (lObj2.Value == null)))
            {
                return(true);
            }

            if ((Value == null) || (((object)lObj2 == null) || (lObj2.Value == null)))
            {
                return(false);
            }

            byte[] lValue  = (byte[])Value;
            byte[] lValue2 = (byte[])lObj2.Value;

            if (lValue.Length != lValue2.Length)
            {
                return(false);
            }
            for (int lIndex = 0; lIndex < lValue.Length; lIndex++)
            {
                if (lValue[lIndex] != lValue2[lIndex])
                {
                    return(false);
                }
            }

            return(true);
        }
示例#2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="val">Value for this type</param>
 public ONBlob(ONBlob val)
 {
     if (val == null)
         Value = null;
     else
         Value = val.Value;
 }
示例#3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="val">Value for this type</param>
 public ONBlob(ONBlob val)
 {
     if (val == null)
     {
         Value = null;
     }
     else
     {
         Value = val.Value;
     }
 }
示例#4
0
        /// <summary>
        /// <param name="xmlWriter">Object with the XML message to add new information and return to client side</param>
        /// <param name="val">Value to be put inside the XML message</param>
        /// <param name="dtdVersion">Version of the DTD that follows the XML message</param>
        /// <param name="xmlElement">Element of the XML that is cheked</param>
        /// </summary>
        public static void ON2XML(XmlWriter xmlWriter, ONBlob val, double dtdVersion, string xmlElement)
        {
            if (val == null)
            {
                if (xmlElement == ONXml.XMLTAG_V)
                    xmlWriter.WriteElementString(xmlElement, "");
                else
                    xmlWriter.WriteElementString(ONXml.XMLTAG_NULL, null);
            }
            else
            {
                xmlWriter.WriteStartElement(xmlElement);
                if (xmlElement == ONXml.XMLTAG_OIDFIELD && dtdVersion > 2.0)
                    xmlWriter.WriteAttributeString("Type", "blob");

                xmlWriter.WriteString(Convert.ToBase64String(val.TypedValue));
                xmlWriter.WriteEndElement();
            }
        }