Hi there,
I'm attempting to update part of a file on a remote server using this library, and I'm experiencing some issues with the SftpFileStream class. It's my impression from reading the code and the Stream class documentation, that Seek() is supposed to allow me to read/write from specific areas in a file.
My end goal is to be able to update zip files remotely after I've appended to them locally. Other than this, I like this library as it's simple to use and awesome at what it does :).
Example code that works locally, and produces a 4 KB file:
```
using (var file = File.OpenWrite("tmp"))
file.Write(new byte[1000], 0, 1000);
using (var file = File.Open("tmp", FileMode.Open, FileAccess.ReadWrite))
{
file.Seek(1000, SeekOrigin.Begin);
Console.WriteLine(file.Position);
file.Write(new byte[1500], 0, 1500);
file.Write(new byte[1500], 0, 1500);
}
```
Example using SSH.Net that does not produce a 4 KB file:
```
using (SftpClient client = new SftpClient(Host, User, _privateKeyFile))
{
client.Connect();
using (var file = client.OpenWrite("/home/mike/tmp"))
file.Write(new byte[1000], 0, 1000);
using (var file = client.Open("/home/mike/tmp", FileMode.Open, FileAccess.ReadWrite))
{
file.Seek(1000, SeekOrigin.Begin);
Console.WriteLine(file.Position);
file.Write(new byte[1500], 0, 1500);
file.Write(new byte[1500], 0, 1500);
}
return;
}
```
I'm attempting to update part of a file on a remote server using this library, and I'm experiencing some issues with the SftpFileStream class. It's my impression from reading the code and the Stream class documentation, that Seek() is supposed to allow me to read/write from specific areas in a file.
My end goal is to be able to update zip files remotely after I've appended to them locally. Other than this, I like this library as it's simple to use and awesome at what it does :).
Example code that works locally, and produces a 4 KB file:
```
using (var file = File.OpenWrite("tmp"))
file.Write(new byte[1000], 0, 1000);
using (var file = File.Open("tmp", FileMode.Open, FileAccess.ReadWrite))
{
file.Seek(1000, SeekOrigin.Begin);
Console.WriteLine(file.Position);
file.Write(new byte[1500], 0, 1500);
file.Write(new byte[1500], 0, 1500);
}
```
Example using SSH.Net that does not produce a 4 KB file:
```
using (SftpClient client = new SftpClient(Host, User, _privateKeyFile))
{
client.Connect();
using (var file = client.OpenWrite("/home/mike/tmp"))
file.Write(new byte[1000], 0, 1000);
using (var file = client.Open("/home/mike/tmp", FileMode.Open, FileAccess.ReadWrite))
{
file.Seek(1000, SeekOrigin.Begin);
Console.WriteLine(file.Position);
file.Write(new byte[1500], 0, 1500);
file.Write(new byte[1500], 0, 1500);
}
return;
}
```