Add project
Basic formatting applied. Unnecessary comments have been removed. Suspicious code is covered by TODO.
This commit is contained in:
46
Hcs.Client/GostCryptography/Asn1/Ber/Asn1TraceHandler.cs
Normal file
46
Hcs.Client/GostCryptography/Asn1/Ber/Asn1TraceHandler.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace GostCryptography.Asn1.Ber
|
||||
{
|
||||
public class Asn1TraceHandler : IAsn1NamedEventHandler
|
||||
{
|
||||
internal StreamWriter mPrintStream;
|
||||
|
||||
public Asn1TraceHandler()
|
||||
{
|
||||
mPrintStream = new StreamWriter(Console.OpenStandardOutput(), Console.Out.Encoding);
|
||||
mPrintStream.AutoFlush = true;
|
||||
}
|
||||
|
||||
public Asn1TraceHandler(StreamWriter ps)
|
||||
{
|
||||
mPrintStream = ps;
|
||||
}
|
||||
|
||||
public virtual void Characters(string svalue, short typeCode)
|
||||
{
|
||||
mPrintStream.WriteLine("data: " + svalue);
|
||||
}
|
||||
|
||||
public virtual void EndElement(string name, int index)
|
||||
{
|
||||
mPrintStream.Write(name);
|
||||
if (index >= 0)
|
||||
{
|
||||
mPrintStream.Write("[" + index + "]");
|
||||
}
|
||||
mPrintStream.WriteLine(": end");
|
||||
}
|
||||
|
||||
public virtual void StartElement(string name, int index)
|
||||
{
|
||||
mPrintStream.Write(name);
|
||||
if (index >= 0)
|
||||
{
|
||||
mPrintStream.Write("[" + index + "]");
|
||||
}
|
||||
mPrintStream.WriteLine(": start");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user