namespace Yw.BIMFace { /// /// base64格式转换器 /// public static class Base64Extension { /// /// 使用 UTF8 编码格式,对字符串进行进行 Base64 方式编码(加密) /// /// 扩展对象 /// 编码后的字符串 public static string EncryptByBase64(this string @this) { byte[] bytes = Encoding.Default.GetBytes(@this); return Convert.ToBase64String(bytes); } /// /// 使用 UTF8 编码格式,对字符串进行进行 Base64 方式解码(解密) /// /// 扩展对象 /// 解码后的字符串 public static string DecryptByBase64(this string @this) { byte[] bytes = Convert.FromBase64String(@this); return Encoding.Default.GetString(bytes); } } }