refactor
This commit is contained in:
parent
2d6a6bd3a1
commit
d80e723b94
28 changed files with 1801 additions and 352 deletions
37
src/Poe2Trade.Screen/FramePipelineService.cs
Normal file
37
src/Poe2Trade.Screen/FramePipelineService.cs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
using Serilog;
|
||||
|
||||
namespace Poe2Trade.Screen;
|
||||
|
||||
public class FramePipelineService : IDisposable
|
||||
{
|
||||
public FramePipeline Pipeline { get; }
|
||||
public IScreenCapture Backend { get; }
|
||||
|
||||
public FramePipelineService()
|
||||
{
|
||||
Backend = CreateBackend();
|
||||
Pipeline = new FramePipeline(Backend);
|
||||
}
|
||||
|
||||
private static IScreenCapture CreateBackend()
|
||||
{
|
||||
try
|
||||
{
|
||||
var dxgi = new DesktopDuplication();
|
||||
Log.Information("Screen capture: DXGI Desktop Duplication");
|
||||
return dxgi;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Warning(ex, "DXGI unavailable, falling back to GDI");
|
||||
}
|
||||
|
||||
Log.Information("Screen capture: GDI (CopyFromScreen)");
|
||||
return new GdiCapture();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Pipeline.Dispose();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue