- 积分
- 673
- 明经币
- 个
- 注册时间
- 2014-11-18
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2015-4-25 08:08:38
|
显示全部楼层
/// <summary>
/// //将转成二进制数据
/// </summary>
/// <param name="filepath">文件名</param>
/// <returns></returns>
public static Byte[] streamin(string filepath)
{
FileStream fs = new FileStream(filepath, FileMode.Open, FileAccess.Read);
Byte[] btye2 = new byte[fs.Length];
fs.Read(btye2, 0, Convert.ToInt32(fs.Length));
fs.Close();
return btye2;
}
/// <summary>
/// 将二进制数据转成
/// </summary>
/// <param name="bb"></param>
/// <param name="filepath"></param>
public static void streamout(byte[] bb, string filepath)
{
int ArraySize = bb.GetUpperBound(0);
FileStream fs = new FileStream(filepath, FileMode.OpenOrCreate, FileAccess.Write);
fs.Write(bb, 0, ArraySize);
fs.Close();
} |
|