-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCopyStream.cs
53 lines (43 loc) · 1.25 KB
/
CopyStream.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
using System.IO;
namespace DropboxEncrypedUploader
{
public class CopyStream : Stream
{
public CopyStream(Stream copyTo)
{
CopyTo = copyTo;
}
public CopyStream()
{
}
public Stream CopyTo { get; set; }
public override bool CanRead => false;
public override bool CanSeek => false;
public override bool CanWrite => true;
public override long Length => _position;
public override long Seek(long offset, SeekOrigin loc)
{
throw new NotSupportedException();
}
public override void SetLength(long value)
{
throw new NotSupportedException();
}
public override void Flush()
{
CopyTo.Flush();
}
public override int Read(byte[] buffer, int offset, int count)
{
throw new NotSupportedException();
}
public override void Write(byte[] buffer, int offset, int count)
{
CopyTo.Write(buffer, 0, count);
_position += count;
}
long _position;
public override long Position { get => _position; set => throw new NotSupportedException(); }
}
}