filewatcher/code/src/EventRaisingStreamWriter.cs
Brian 51e217e38c Added project files, source files, and assets.
As long as you have IronPython 2.7.3 you should be able to compile now
with this commit.
2013-12-20 19:54:45 -07:00

39 lines
903 B
C#

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace FileWatcher
{
public class EventRaisingStreamWriter : StreamWriter
{
public event EventHandler<MyEvtArgs<string>> StringWritten;
public EventRaisingStreamWriter(Stream s)
: base(s)
{
}
private void LaunchEvent(string txtWritten)
{
if (StringWritten != null)
{
StringWritten(this, new MyEvtArgs<string>(txtWritten));
}
}
public override void Write(string value)
{
base.Write(value);
LaunchEvent(value);
}
public override void Write(bool value)
{
base.Write(value);
LaunchEvent(value.ToString());
}
}
}