JD2022-TU1/main/tools/framework/JD.Bloomberg/JdBloombergLegacy.cs

75 lines
No EOL
2 KiB
C#

using Plume.Bloomberg;
using Plume.Core.Logging;
using Plume.Interfaces.Services;
using System;
namespace JD.Bloomberg
{
/// <summary>
/// This class is here to reflect what JD.Bloomberg was doing, until all apps are migrated to the Plume framework.
/// </summary>
public class JdBloombergLegacy
{
private readonly BloombergService _service = new BloombergService();
public static JdBloombergLegacy Instance { get; } = new JdBloombergLegacy();
private JdBloombergLegacy()
{
}
public void Start()
{
var context = new LegacyBloombergServiceContext();
_service.Initialize(context);
var reporter = new BloombergReporter("bloomberg_settings_tools.ini");
_service.ConnectReporter(reporter);
}
public string GetCurrentVersion()
{
// TODO: return the service version
return "42"; // this is the actual default bloomberg version
}
private class LegacyBloombergServiceContext : IServiceContext
{
public void Dispose()
{
}
public ILogger Logger { get; } = new LegacyLogger();
private class LegacyLogger : ILogger
{
public void Debug(string message, Exception exception = null)
{
}
public void Error(string message, Exception exception = null)
{
}
public void Fatal(string message, Exception exception = null)
{
}
public void Info(string message, Exception exception = null)
{
}
public void Trace(string message, Exception exception = null)
{
}
public void Warn(string message, Exception exception = null)
{
}
public string Name { get; } = nameof(LegacyLogger);
}
}
}
}