如何在没有C# 中的File.Copy()的情况下将应用程序 dll从一个系统发送到另一个系统?可能是 FileStream,有什么想法吗?
我正在使用网络服务
网络服务代码
public string fileUpdates(string filesPath)
{
//System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(filesPath);
//string[] fileNames = Directory.GetFiles(filesPath);
FileStream fileStream = new FileStream(filesPath, FileMode.Open, FileAccess.Read);
FileInfo fi = new FileInfo(filesPath);
string s=fi.Extension;
byte[] byteArr = new byte[fileStream.Length];
fileStream.Read(byteArr, 0, Convert.ToInt32(fileStream.Length));
string data=Encoding.ASCII.GetString(byteArr);
return data;
}
在客户端
fileDa = wcf3.fileUpdates(listItem);
byteArray = Encoding.ASCII.GetBytes(fileDa);
fileData = new MemoryStream(byteArray);
int Length = 256;
Byte[] buffer = new Byte[Length];
int bytesRead = fileData.Read(buffer, 0, Length);
while (bytesRead > 0)
{
writeStream.Write(buffer, 0, bytesRead);
bytesRead = fileData.Read(buffer, 0, Length);
}
//fileData.Close();
//writeStream.Close();