Repository navigation
Expand file tree
/
Copy pathProgram.cs
More file actions
43 lines (38 loc) · 1.51 KB
/
Copy pathProgram.cs
File metadata and controls
43 lines (38 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using Avalonia;
using System;
using System.IO;
using System.Text.Json;
using System.Threading.Tasks;
using LootDrop.Services;
namespace LootDrop;
internal class Program
{
[STAThread]
public static void Main(string[] args)
{
ProblemReporter.Initialize();
AppDomain.CurrentDomain.UnhandledException += (_, e) =>
ProblemReporter.Record("Unexpected error (LootDrop had to close)", e.ExceptionObject as Exception);
TaskScheduler.UnobservedTaskException += (_, e) => { ProblemReporter.Record("Unobserved background error", e.Exception); e.SetObserved(); };
// One LootDrop per data folder: a second launch shows the running copy instead.
using var instance = SingleInstance.TryAcquire(AppPaths.DataRoot);
if (instance == null) { SingleInstance.SignalExisting(AppPaths.DataRoot); return; }
App.Instance = instance;
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
}
private static bool UseSoftwareRenderer()
{
try
{
return new Services.LocalLibraryService().Load().ForceSoftwareRendering;
}
catch { return false; }
}
public static AppBuilder BuildAvaloniaApp()
{
var builder = AppBuilder.Configure<App>().UsePlatformDetect().WithInterFont().LogToTrace();
if (OperatingSystem.IsWindows() && UseSoftwareRenderer())
builder = builder.With(new Win32PlatformOptions { RenderingMode = new[] { Win32RenderingMode.Software } });
return builder;
}
}