Nothing exciting here, but since it's LGPLed, here ya go:
public delegate void InitProgressDelegate( long Total );
public InitProgressDelegate InitProgress;
public delegate void FinishProgressDelegate();
public FinishProgressDelegate FinishProgress;
public delegate void IncrementProgressDelegate( long Progress );
public IncrementProgressDelegate IncrementProgress;
private void PutBinary(Stream srcStream, string remoteFile, bool append)
{
BufferedStream reader = new BufferedStream(srcStream);
InitPut(remoteFile, append);
// get an output stream
BinaryWriter writer = new BinaryWriter(GetDataStream());
byte[] buf = new byte[512];
InitProgress( reader.Length );
// read a chunk at a time and write to the data socket
int count = 0;
while ((count = reader.Read(buf, 0, buf.Length)) > 0)
{
writer.Write(buf, 0, count);
IncrementProgress( reader.Position );
}
FinishProgress();
reader.Close();
writer.Flush();
writer.Close();
}