Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/hakchi2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-09-27 04:12:54 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-09-27 04:12:54 +0300
commitfe8cd0fc4e716b1bef4aff1fc4ff7b6b5180474b (patch)
tree2c06e36bf6390f64c6771570260cdce8e54da52c /TrackableFileStream.cs
parent85bfe6e6828b52cf5b740a2d28f5b436d3d02077 (diff)
NAND dump features, some rework, new language
Diffstat (limited to 'TrackableFileStream.cs')
-rw-r--r--TrackableFileStream.cs39
1 files changed, 39 insertions, 0 deletions
diff --git a/TrackableFileStream.cs b/TrackableFileStream.cs
new file mode 100644
index 00000000..3ff953dd
--- /dev/null
+++ b/TrackableFileStream.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+
+namespace com.clusterrr.util
+{
+ public class TrackableFileStream : FileStream
+ {
+ public delegate void OnProgressDelegate(long Position, long Length);
+ public event OnProgressDelegate OnProgress = delegate { };
+
+ public TrackableFileStream(string path, FileMode mode) : base(path, mode) { }
+
+ public override void Write(byte[] array, int offset, int count)
+ {
+ base.Write(array, offset, count);
+ OnProgress(this.Position, this.Length);
+ }
+ public override void WriteByte(byte value)
+ {
+ base.WriteByte(value);
+ OnProgress(this.Position, this.Length);
+ }
+ public override int Read(byte[] array, int offset, int count)
+ {
+ var r = base.Read(array, offset, count);
+ OnProgress(this.Position, this.Length);
+ return r;
+ }
+ public override int ReadByte()
+ {
+ var r = base.ReadByte();
+ OnProgress(this.Position, this.Length);
+ return r;
+ }
+ }
+}