Introduced a very simple "singleton" service-locator, which allowed for a removal of specific implementations which were very limited. With this it's easier to access dependencies.

This commit is contained in:
Krom, Robertus 2020-02-18 13:48:40 +01:00
parent 3ebdf3d2fe
commit 80d8f51fc5
53 changed files with 744 additions and 1230 deletions

View file

@ -52,16 +52,11 @@ namespace GreenshotPlugin.Core {
private static readonly CoreConfiguration CoreConfig = IniConfig.GetIniSection<CoreConfiguration>();
private const int ExifOrientationId = 0x0112;
/// <summary>
/// This is a factory method to create a surface, set from the Greenshot main project
/// </summary>
public static Func<ISurface> SurfaceFactory { get; set; }
static ImageHelper()
static ImageHelper()
{
StreamConverters["greenshot"] = (stream, s) =>
{
var surface = SurfaceFactory();
var surface = SimpleServiceProvider.Current.GetInstance<Func<ISurface>>().Invoke();
return surface.GetImageForExport();
};