You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

122 lines
2.7 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Text;
namespace Sog.Log
{
public class BillLogHelper
{
private StringBuilder sb;
public BillLogHelper(int type)
{
sb = new StringBuilder();
sb.Append("iType=");
sb.Append(type);
}
public void Append(string name, bool value)
{
sb.Append("|i");
sb.Append(name);
sb.Append("=");
sb.Append(value ? 1 : 0);
}
public void Append(string name, sbyte value)
{
sb.Append("|i");
sb.Append(name);
sb.Append("=");
sb.Append(value);
}
public void Append(string name, byte value)
{
sb.Append("|i");
sb.Append(name);
sb.Append("=");
sb.Append(value);
}
public void Append(string name, Int16 value)
{
sb.Append("|i");
sb.Append(name);
sb.Append("=");
sb.Append(value);
}
public void Append(string name, UInt16 value)
{
sb.Append("|i");
sb.Append(name);
sb.Append("=");
sb.Append(value);
}
public void Append(string name, int value)
{
sb.Append("|i");
sb.Append(name);
sb.Append("=");
sb.Append(value);
}
public void Append(string name, uint value)
{
sb.Append("|i");
sb.Append(name);
sb.Append("=");
sb.Append(value);
}
public void Append(string name, Int64 value)
{
sb.Append("|I");
sb.Append(name);
sb.Append("=");
sb.Append(value);
}
public void Append(string name, UInt64 value)
{
sb.Append("|I");
sb.Append(name);
sb.Append("=");
sb.Append(value);
}
public void Append(string name, string value)
{
sb.Append("|s");
sb.Append(name);
sb.Append("=");
if (value != null)
{
sb.Append(value);
}
}
public void Append(string name, ReadOnlySpan<char> ptrValue)
{
sb.Append("|s");
sb.Append(name);
sb.Append("=");
if (ptrValue.IsEmpty == false)
{
sb.Append(ptrValue);
}
}
public override string ToString()
{
return sb.ToString();
}
}
}