private void WriteOptions(string category, AutoexecLuaContext context)
        {
            var options = _profileSettingsService.GetAdvancedOptions(category);

            foreach (var option in options)
            {
                if (_profileSettingsService.TryGetValue <object>(ProfileSettingsCategories.AdvancedOptions, option.Id, out var value))
                {
                    context.SetValue(option.Id, value);
                    context.Save(option.Id);
                }
            }
        }
        private void WriteRangedOptions(string category, AutoexecLuaContext context)
        {
            var options = _profileSettingsService.GetAdvancedOptions(category);

            foreach (var range in CameraRangeSettings.All)
            {
                foreach (var option in options)
                {
                    if (!_profileSettingsService.TryGetValue <object>(ProfileSettingsCategories.AdvancedOptions, option.Id, out var value))
                    {
                        continue;
                    }

                    context.SetValue(option.Id.Replace("Extreme", range), value);
                    context.Save(option.Id.Replace("Extreme", range));
                }
            }
        }
        public Task UpdateAdvancedOptionsAsync()
        {
            return(Task.Run(() =>
            {
                var install = _settingsService.SelectedInstall;

                File.WriteAllText(install.AutoexecCfg, "");

                using (var context = new AutoexecLuaContext(install))
                {
                    WriteOptions(OptionCategory.Graphics, context);
                    WriteRangedOptions(OptionCategory.Camera, context);
                    WriteRangedOptions(OptionCategory.CameraMirrors, context);
                    WriteOptions(OptionCategory.Terrain, context);
                    WriteOptions(OptionCategory.TerrainMirror, context);
                    WriteOptions(OptionCategory.TerrainReflection, context);
                    WriteOptions(OptionCategory.Sound, context);
                }
            }));
        }