public ViewportOption[] GetViewportOptions(string moduleId)
        {
            var options = _profileSettingsService.GetViewportOptionsByModuleId(moduleId);

            foreach (var option in options)
            {
                if (_profileSettingsService.TryGetValue <object>(string.Format(ProfileSettingsCategories.ViewportOptionsFormat, moduleId), option.Id, out var value))
                {
                    option.Value = value;
                }
            }

            return(options);
        }
        public async Task WriteViewportOptionsAsync()
        {
            var install = _settingsService.SelectedInstall;
            var modules = await GetInstalledAircraftModulesAsync();

            foreach (var module in modules)
            {
                var options = _profileSettingsService.GetViewportOptionsByModuleId(module.ModuleId);

                foreach (var option in options)
                {
                    if (!_profileSettingsService.TryGetValue <object>(string.Format(ProfileSettingsCategories.ViewportOptionsFormat, module.ModuleId), option.Id, out var value))
                    {
                        continue;
                    }

                    var filePath = Path.Combine(install.Directory, option.FilePath);

                    if (!File.Exists(filePath))
                    {
                        Tracer.Warn($"Unable to find file \"{filePath}\", skipping output of option {option.Id} for module {module.ModuleId}.");
                        continue;
                    }

                    var fileContents = File.ReadAllText(filePath);
                    var regex        = new Regex(option.Regex);
                    var match        = regex.Match(fileContents);

                    if (!match.Success)
                    {
                        Tracer.Warn($"Unable to make a match on regex {option.Regex} for file \"{filePath}\", skipping output of option {option.Id} for module {module.ModuleId}.");
                        continue;
                    }

                    fileContents = fileContents.Remove(match.Index, match.Length);
                    fileContents = fileContents.Insert(match.Index, value is bool?value.ToString().ToLower() : value.ToString());

                    File.WriteAllText(filePath, fileContents);
                }
            }
        }