Files
zszq-trs/Tools/YLPublishTool/PublishContext.cs
T
2024-05-09 14:06:26 +08:00

53 lines
1.1 KiB
C#

using NLog;
using System;
using System.Collections.Specialized;
namespace YLPublishTool
{
class PublishContext : IPublishContext, IPublishAction
{
readonly NameValueCollection _nv;
public PublishContext(NameValueCollection nv)
{
_nv = nv ?? new NameValueCollection();
}
public ILogger Logger { get; set; }
public string GetProperty(string name)
{
return _nv[name];
}
public void SetProperty(string name, string value)
{
if (string.IsNullOrEmpty(name))
{
return;
}
_nv[name] = value;
}
public void Execute(IPublishContext context)
{
}
public void LogDebug(string message)
{
Logger?.Debug(message);
}
public void LogInfo(string message)
{
Logger?.Info(message);
}
public void LogError(string message, Exception ex = null)
{
Logger?.Error(ex, message);
}
}
}