public virtual void SetByteArray(byte[] value) { if (value.Length == 0) { m_text = "''"; } else { m_text = "0x" + StringTool.EncodeHex(value); } }
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()); }
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(""); }
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))); }