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); } } }