Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AigioL committed Jun 8, 2022
1 parent dcebb03 commit 0bbc561
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion references/ArchiSteamFarm
1 change: 1 addition & 0 deletions src/ST.Client/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using ArchiSteamFarm;
using ArchiSteamFarm.Library;
using Microsoft.Extensions.DependencyInjection.Extensions;
using System.Application;
using System.Application.Entities;
Expand Down
24 changes: 12 additions & 12 deletions src/ST.Client/Services/Implementation/ArchiSteamFarmServiceImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using ArchiSteamFarm.Steam.Storage;
using ArchiSteamFarm.Storage;
using Microsoft.Extensions.Configuration;
using NLog;
using ReactiveUI;
using System.Application.UI;
using System.Application.UI.Resx;
Expand All @@ -17,13 +18,19 @@
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using MSEXLog = Microsoft.Extensions.Logging;

namespace System.Application.Services.Implementation
{
public partial class ArchiSteamFarmServiceImpl : ReactiveObject, IArchiSteamFarmService
public partial class ArchiSteamFarmServiceImpl : ReactiveObject, IArchiSteamFarmService, IIoc
{
const string TAG = "ArchiSteamFarmS";

public ArchiSteamFarmServiceImpl()
{
ArchiSteamFarmLibrary.Init(this, IOPath.AppDataDirectory, IApplication.LogDirPathASF);
}

public event Action<string>? OnConsoleWirteLine;

public TaskCompletionSource<string>? ReadLineTask { get; set; }
Expand All @@ -42,16 +49,9 @@ public bool IsReadPasswordLine

private bool isFirstStart = true;

sealed class Ioc : IIoc
{
private Ioc() { }

public static Ioc Instance { get; } = new();
T IIoc.GetRequiredService<T>() where T : class => DI.Get<T>();

public T GetRequiredService<T>() where T : class => DI.Get<T>();

public T? GetService<T>() where T : class => DI.Get_Nullable<T>();
}
T? IIoc.GetService<T>() where T : class => DI.Get_Nullable<T>();

public async Task<bool> Start(string[]? args = null)
{
Expand All @@ -63,8 +63,6 @@ public async Task<bool> Start(string[]? args = null)
{
//IArchiSteamFarmService.InitCoreLoggers?.Invoke();

ArchiSteamFarmLibrary.Init(Ioc.Instance, IOPath.AppDataDirectory, IApplication.LogDirPathASF);

InitHistoryLogger();

ArchiSteamFarm.NLog.Logging.GetUserInputFunc = async (bool isPassword) =>
Expand Down Expand Up @@ -126,6 +124,8 @@ async Task IArchiSteamFarmHelperService.Restart()
Toast.Show(AppResources.ASF_Restarted, ToastLength.Short);
}

MSEXLog.LogLevel IArchiSteamFarmHelperService.MinimumLevel => IApplication.LoggerMinLevel;

private void InitHistoryLogger()
{
ArchiSteamFarm.NLog.Logging.InitHistoryLogger();
Expand Down
2 changes: 1 addition & 1 deletion src/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
using ReactiveUI;
using System.Reactive;
#endif
#if !MAUI
#if !MAUI && !__MOBILE__
using AvaloniaApplication = Avalonia.Application;
#endif
#if __ANDROID__ && !MAUI
Expand Down

0 comments on commit 0bbc561

Please sign in to comment.