Example #1
0
 public virtual void SetByteArray(byte[] value)
 {
     if (value.Length == 0)
     {
         m_text = "''";
     }
     else
     {
         m_text = "0x" + StringTool.EncodeHex(value);
     }
 }
Example #2
0
        public virtual string ReadHash(IBedValueReader reader, BedValueConvertor auxConv, BedValueHolder auxHolder)
        {
            switch (reader.GetFieldType())
            {
            case TypeStorage.String:
                return(reader.GetString().ToLower());

            case TypeStorage.ByteArray:
            {
                byte[] data = reader.GetByteArray();
                if (data.Length == 32)
                {
                    return(Encoding.UTF8.GetString(data));
                }
                return(StringTool.EncodeHex(data).ToLower());
            }
            }
            auxConv.ConvertValue(reader, TypeStorage.String, auxHolder);
            return(auxHolder.GetString());
        }
Example #3
0
        public string FormatBlob(byte[] data)
        {
            switch (BlobMode)
            {
            case DataFormatBlobMode.InfoText:
                return(BlobInfo);

            case DataFormatBlobMode.Base64:
                return(Convert.ToBase64String(data) + "=");

            case DataFormatBlobMode.Hexa:
                if (HexBytesOnLine > 0)
                {
                    return(StringTool.EncodeHex(data, HexBytesOnLine));
                }
                else
                {
                    return(StringTool.EncodeHex(data));
                }
            }
            return("");
        }
Example #4
0
 public static string ToWebName(this Color color)
 {
     return(String.Format("#{0}{1}{2}", StringTool.EncodeHex(color.R), StringTool.EncodeHex(color.G), StringTool.EncodeHex(color.B)));
 }