文件与流
public byte[] FileToStream(string path)
{
byte[] s = null;
StreamReader reader = new StreamReader(path);
s = File.ReadAllBytes(path);
return s;
}
public void StreamToFile(string path, byte[] bytes)
{
FileStream stream = null;
stream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None);
stream.Write(bytes, 0, bytes.Length);
stream.Close();
}