mirror of
https://github.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies.git
synced 2026-07-25 14:24:32 +00:00
ed5d3c2eda
- Add links.json to repo (alongside update.xml) with Website and Documentation URLs. - Add LinksManager to support link fetching on startup via raw.githubusercontent.com - Suppress TimeAligner failure instead of blocking app launch
61 lines
1.9 KiB
C#
61 lines
1.9 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Extensions.Logging;
|
|
using NebulaAuth.Core;
|
|
using NebulaAuth.Model.MAAC;
|
|
using NebulaAuth.Model.MafileExport;
|
|
using NebulaAuth.Model.Mafiles;
|
|
using NLog;
|
|
using NLog.Extensions.Logging;
|
|
using SteamLib.Core;
|
|
using SteamLib.SteamMobile;
|
|
using ILogger = Microsoft.Extensions.Logging.ILogger;
|
|
|
|
namespace NebulaAuth.Model;
|
|
|
|
public static class Shell
|
|
{
|
|
public static Logger Logger { get; private set; } = null!;
|
|
public static ILogger ExtensionsLogger { get; private set; } = null!;
|
|
|
|
public static async Task Initialize()
|
|
{
|
|
File.Delete("log.log");
|
|
LocManager.Init();
|
|
LocManager.SetApplicationLocalization(Settings.Instance.Language);
|
|
Logger = LogManager.GetLogger("Logger");
|
|
var lp = new NLogLoggerProvider();
|
|
var logger = lp.CreateLogger("SteamLib");
|
|
SteamLibErrorMonitor.MonitorLogger = logger;
|
|
AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
|
|
|
|
var loggerFactory = new NLogLoggerFactory();
|
|
ExtensionsLogger = loggerFactory.CreateLogger("Logger");
|
|
|
|
try
|
|
{
|
|
await TimeAligner.AlignTimeAsync();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Logger.Error(ex, "Failed to align time with Steam");
|
|
TimeAligner.SetTimeDifference(0);
|
|
}
|
|
|
|
var threads = Environment.ProcessorCount > 0 ? Environment.ProcessorCount : 1;
|
|
await Storage.Initialize(threads);
|
|
ProxyAssignmentCache.Initialize(Storage.MaFiles);
|
|
MAACStorage.Initialize();
|
|
MafileExporterStorage.Initialize();
|
|
_ = LinksManager.FetchAsync();
|
|
|
|
ExtensionsLogger.LogDebug("Application started");
|
|
}
|
|
|
|
private static void CurrentDomainOnUnhandledException(object sender, UnhandledExceptionEventArgs e)
|
|
{
|
|
Logger.Fatal((Exception) e.ExceptionObject);
|
|
LogManager.Shutdown();
|
|
}
|
|
} |