This repository has been archived on 2019-06-21. You can view files and clone it, but cannot push or open issues or pull requests.
PixelHub/PixelServer/PrefixedWriter.cs

68 lines
1.5 KiB
C#
Raw Normal View History

using System;
using System.IO;
using System.Text;
namespace SBRL.Utilities
{
public class PrefixedWriter : TextWriter, IDisposable
{
private TextWriter destination;
public string Prefix { get; set; } = "";
public override Encoding Encoding {
get {
return Encoding.UTF8;
}
}
public PrefixedWriter(TextWriter inDestination)
{
destination = inDestination;
}
public override void Write(string str, params object[] args)
{
destination.Write(Prefix + str, args);
}
public override void Write(string str)
{
Write(str, new object[] {});
}
public override void Write(string str, object arg1)
{
Write(str, new object[] { arg1 });
}
public override void Write(string str, object arg1, object arg2)
{
Write(str, new object[] { arg1, arg2 });
}
public override void Write(string str, object arg1, object arg2, object arg3)
{
Write(str, new object[] { arg1, arg2, arg3 });
}
public override void WriteLine(string str, params object[] args)
{
Write(str + Environment.NewLine, args);
}
public override void WriteLine(string str)
{
WriteLine(str, new object[] {});
}
public override void WriteLine(string str, object arg1)
{
WriteLine(str, new object[] { arg1 });
}
public override void WriteLine(string str, object arg1, object arg2)
{
WriteLine(str, new object[] { arg1, arg2 });
}
public override void WriteLine(string str, object arg1, object arg2, object arg3)
{
WriteLine(str, new object[] { arg1, arg2, arg3 });
}
}
}