一、类名Class

类名:PublicFunctions.Base64

 

二、属性Properties

 

三、方法Methods

1、Base64加密

函数:public static string EncodeBase64(string code_type, string code)

code_type:加密方式,如:utf-8,gb2312等

code:加密内容

返回: 加密后的字符串

 

2、Base64解密

函数:public static string DecodeBase64(string code_type, string code)

code_type:解密方式,如:utf-8,gb2312等

code:解密内容

返回: 解密后的字符串

 

3、将BASE64保存为图片

函数:public static bool SaveImageFromBase64(string FilePath, string ImageBaseEncode)

FilePath:保存图片的路径

ImageBaseEncode:图片的Base64编码

返回: 是否成功,true/false

 

4、将图片转换为BASE64编码

函数:public static string GetBase64FromImage(Bitmap bmp)

bmp:图像对象

返回: Base64编码

 

5、将图片转换为BASE64编码(重载)

函数:public static string GetBase64FromImage(string imagefile)

imagefile:图像路径

返回: Base64编码

 

6、将文件转换为BASE64编码

函数:public static string GetBase64FromFile(string FileName)

FileName:文件路径

返回: Base64编码

 

7、将BASE64编码保存为文件

函数:public static bool SaveFileFromBase64(string FilePath, string FileBaseEncode)

FileName:文件路径

FileBaseEncode:文件BASE64编码内容

返回: 是否成功,true/false

 

8、将BASE64编码保存为文件(重载)

函数:public static bool SaveFileFromBase64(string FilePath, string FileBaseEncode, out string ErrorMsg)

FileName:文件路径

FileBaseEncode:文件BASE64编码内容

ErrorMsg:如果失败,失败的原因

返回: 是否成功,true/false