cache result of IsWine
This commit is contained in:
@@ -28,6 +28,7 @@ public class IntroUi : WindowMediatorSubscriberBase
|
||||
private readonly CacheMonitor _cacheMonitor;
|
||||
private readonly Dictionary<string, string> _languages = new(StringComparer.Ordinal) { { "English", "en" }, { "Deutsch", "de" }, { "Français", "fr" } };
|
||||
private readonly ServerConfigurationManager _serverConfigurationManager;
|
||||
private readonly DalamudUtilService _dalamudUtilService;
|
||||
private readonly UiSharedService _uiShared;
|
||||
private int _currentLanguage;
|
||||
private bool _readFirstPage;
|
||||
@@ -43,14 +44,14 @@ public class IntroUi : WindowMediatorSubscriberBase
|
||||
|
||||
public IntroUi(ILogger<IntroUi> logger, UiSharedService uiShared, MareConfigService configService, ApiController apiController,
|
||||
CacheMonitor fileCacheManager, ServerConfigurationManager serverConfigurationManager, MareMediator mareMediator,
|
||||
PerformanceCollectorService performanceCollectorService) : base(logger, mareMediator, "Loporrit Setup", performanceCollectorService)
|
||||
PerformanceCollectorService performanceCollectorService, DalamudUtilService dalamudUtilService) : base(logger, mareMediator, "Loporrit Setup", performanceCollectorService)
|
||||
{
|
||||
_uiShared = uiShared;
|
||||
_configService = configService;
|
||||
_apiController = apiController;
|
||||
_cacheMonitor = fileCacheManager;
|
||||
_serverConfigurationManager = serverConfigurationManager;
|
||||
|
||||
_dalamudUtilService = dalamudUtilService;
|
||||
IsOpen = false;
|
||||
ShowCloseButton = false;
|
||||
RespectCloseHotkey = false;
|
||||
@@ -66,7 +67,7 @@ public class IntroUi : WindowMediatorSubscriberBase
|
||||
Mediator.Subscribe<SwitchToMainUiMessage>(this, (_) => IsOpen = false);
|
||||
Mediator.Subscribe<SwitchToIntroUiMessage>(this, (_) =>
|
||||
{
|
||||
_configService.Current.UseCompactor = !Util.IsWine();
|
||||
_configService.Current.UseCompactor = !dalamudUtilService.IsWine;
|
||||
IsOpen = true;
|
||||
});
|
||||
}
|
||||
@@ -189,7 +190,7 @@ public class IntroUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
_uiShared.DrawFileScanState();
|
||||
}
|
||||
if (!Util.IsWine())
|
||||
if (!_dalamudUtilService.IsWine)
|
||||
{
|
||||
var useFileCompactor = _configService.Current.UseCompactor;
|
||||
if (ImGui.Checkbox("Use File Compactor", ref useFileCompactor))
|
||||
|
||||
@@ -39,10 +39,10 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
private readonly ApiController _apiController;
|
||||
private readonly IpcManager _ipcManager;
|
||||
private readonly CacheMonitor _cacheMonitor;
|
||||
private readonly DalamudUtilService _dalamudUtilService;
|
||||
private readonly MareConfigService _configService;
|
||||
private readonly ConcurrentDictionary<GameObjectHandler, Dictionary<string, FileDownloadStatus>> _currentDownloads = new();
|
||||
private readonly FileCompactor _fileCompactor;
|
||||
private readonly DalamudUtilService _dalamudUtilService;
|
||||
private readonly FileUploadManager _fileTransferManager;
|
||||
private readonly FileTransferOrchestrator _fileTransferOrchestrator;
|
||||
private readonly FileCacheManager _fileCacheManager;
|
||||
@@ -96,6 +96,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_apiController = apiController;
|
||||
_ipcManager = ipcManager;
|
||||
_cacheMonitor = cacheMonitor;
|
||||
_dalamudUtilService = dalamudUtilService;
|
||||
_fileCompactor = fileCompactor;
|
||||
_uiShared = uiShared;
|
||||
AllowClickthrough = false;
|
||||
@@ -798,7 +799,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
ImGui.TextUnformatted($"Currently utilized local storage: {UiSharedService.ByteToString(_cacheMonitor.FileCacheSize)}");
|
||||
else
|
||||
ImGui.TextUnformatted($"Currently utilized local storage: Calculating...");
|
||||
bool isLinux = Util.IsWine();
|
||||
bool isLinux = _dalamudUtilService.IsWine;
|
||||
if (!isLinux)
|
||||
ImGui.TextUnformatted($"Remaining space free on drive: {UiSharedService.ByteToString(_cacheMonitor.FileCacheDriveFree)}");
|
||||
bool useFileCompactor = _configService.Current.UseCompactor;
|
||||
@@ -822,8 +823,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_ = Task.Run(() =>
|
||||
{
|
||||
_fileCompactor.CompactStorage(compress: true);
|
||||
CancellationTokenSource cts = new();
|
||||
_cacheMonitor.RecalculateFileCacheSize(cts.Token);
|
||||
_cacheMonitor.RecalculateFileCacheSize(CancellationToken.None);
|
||||
});
|
||||
}
|
||||
UiSharedService.AttachToolTip("This will run compression on all files in your current storage folder." + Environment.NewLine
|
||||
@@ -835,7 +835,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
_fileCompactor.CompactStorage(compress: false);
|
||||
CancellationTokenSource cts = new();
|
||||
_cacheMonitor.RecalculateFileCacheSize(cts.Token);
|
||||
_cacheMonitor.RecalculateFileCacheSize(CancellationToken.None);
|
||||
});
|
||||
}
|
||||
UiSharedService.AttachToolTip("This will run decompression on all files in your current storage folder.");
|
||||
|
||||
Reference in New Issue
Block a user