ReadBinHex() public method

public ReadBinHex ( byte array, int offset, int len ) : int
array byte
offset int
len int
return int
Esempio n. 1
0
 [MonoTODO]         // FIXME: Check how expanded entity is handled here.
 public int ReadBinHex(byte [] array, int offset, int len)
 {
     if (entity != null)
     {
         return(entity.ReadBinHex(array, offset, len));
     }
     else
     {
         return(source.ReadBinHex(array, offset, len));
     }
 }
 [MonoTODO] // FIXME: Check how expanded entity is handled here.
 public int ReadBinHex(byte [] buffer, int offset, int length)
 {
     if (entity != null)
     {
         return(entity.ReadBinHex(buffer, offset, length));
     }
     else
     {
         return(source.ReadBinHex(buffer, offset, length));
     }
 }
Esempio n. 3
0
        public static System.Drawing.Icon DeserializeIcon(XmlElement xml)
        {
            System.Drawing.Icon img = null;
            if (xml == null || xml.InnerText == "")
                return null;
            bool bDecodeBinHex = false;
            if (xml.HasAttribute("encoding") && xml.GetAttribute("encoding") == "binhex")
                bDecodeBinHex = true;
            System.IO.StringReader sr = new System.IO.StringReader(xml.OuterXml);
            System.Xml.XmlTextReader xr = new System.Xml.XmlTextReader(sr);
            System.IO.MemoryStream mem = new System.IO.MemoryStream(1024);
            // Skip <image> to data
            xr.Read();

            byte[] base64 = new byte[1024];
            int base64len = 0;
            if (bDecodeBinHex)
            {
                do
                {
                    base64len = xr.ReadBinHex(base64, 0, 1024);
                    if (base64len > 0)
                        mem.Write(base64, 0, base64len);

                } while (base64len != 0);
            }
            else
            {
                do
                {
                    base64len = xr.ReadBase64(base64, 0, 1024);
                    if (base64len > 0)
                        mem.Write(base64, 0, base64len);

                } while (base64len != 0);
            }
            mem.Position = 0;
            img = new System.Drawing.Icon(mem);

            return img;
        }