Пример #1
0
        private async Task SetSupportFiles()
        {
            try
            {
                StatusFile = await _statusProvider.FindStatusFile(JournalDirectory);

                CargoFile = await _statusProvider.FindCargoFile(JournalDirectory);

                MarketFile = await _statusProvider.FindMarketFile(JournalDirectory);

                OutfittingFile = await _statusProvider.FindOutfittingFile(JournalDirectory);

                ShipyardFile = await _statusProvider.FindShipyardFile(JournalDirectory);

                NavRouteFile = await _statusProvider.FindNavRouteFile(JournalDirectory);

                BackpackFile = await _statusProvider.FindBackpackFile(JournalDirectory);

                ModulesInfoFile = await _statusProvider.FindModulesFile(JournalDirectory);

                if (!DisabledSupportFiles.Contains("Bindings"))
                {
                    BindingsFile = await _optionsProvider.FindActiveBindingsFile(OptionsDirectory);

                    lastPresetErrorname = "";
                }
            }
            catch (ActiveBindingsNotFoundException ex)
            {
                _log.LogWarning(ex, "Keybindings support has been disabled");
                DisabledSupportFiles.Add("Bindings");
            }
            catch (BindingsNotFoundException ex)
            {
                var preset = ex.Data["Active bindings"]?.ToString();

                if (preset == null)
                {
                    DisabledSupportFiles.Add("Bindings");
                }

                if (lastPresetErrorname != preset)
                {
                    lastPresetErrorname = preset;

                    _log.LogWarning(ex,
                                    !string.IsNullOrWhiteSpace(Bindings.Active.PresetName)
                            ? "Cannot switch to bindings preset {Bindings}"
                            : "Cannot use bindings preset {Bindings}", preset);
                }
            }

            catch (Exception ex)
            {
                _log.LogWarning(ex, "Could not set support files");
            }
        }