Add receiver (not complete)

This commit is contained in:
parallelbgls
2023-10-12 15:16:48 +08:00
parent 511434d18a
commit d23b942464
41 changed files with 1592 additions and 42 deletions

View File

@@ -0,0 +1,36 @@
using Quartz.Logging;
namespace ModbusTcpToRtu
{
// simple log provider to get something to the console
public class ConsoleLogProvider : ILogProvider
{
private readonly IConfigurationRoot configuration = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT") ?? "Production"}.json", true)
.Build();
public Logger GetLogger(string name)
{
return (level, func, exception, parameters) =>
{
if (level >= configuration.GetSection("Quartz").GetValue<Quartz.Logging.LogLevel>("LogLevel") && func != null)
{
Console.WriteLine("[" + DateTime.Now.ToLongTimeString() + "] [" + level + "] " + func(), parameters);
}
return true;
};
}
public IDisposable OpenNestedContext(string message)
{
throw new NotImplementedException();
}
public IDisposable OpenMappedContext(string key, object value, bool destructure = false)
{
throw new NotImplementedException();
}
}
}