static void getSettings(WebResponse response) { SettingsInfo info = new SettingsInfo(); // Read the current graphics flags info.lensFlares = Scripting.GetUserSetting("Graphics/Enable Lensflares", false); info.volumetricScattering = Scripting.GetUserSetting("Graphics/Enable Volumetric Scattering", true); info.bloom = Scripting.GetUserSetting("Graphics/Enable Bloom", true); info.afterImage = Scripting.GetUserSetting("Graphics/Enable AfterImage", true); info.tonemapping = Scripting.GetUserSetting("Graphics/Enable Tonemapping", true); info.noise = Scripting.GetUserSetting("Graphics/Enable Noise", false); info.shadows = Scripting.GetUserSetting("Graphics/Enable Shadows", true); info.ssao = Scripting.GetUserSetting("Graphics/Enable SSAO", true); info.fog = Scripting.GetUserSetting("Graphics/Enable Fog", true); info.fxaa = Scripting.GetUserSetting("Graphics/Enable FXAA", true); // Currently, only the main screen can be set for fullscreen mode. info.fullscreen = Scripting.GetUserSettingString("WindowManager/Fullscreen", "-1") != "-1"; // Read the supported video modes List <string> modes = Rendering.GetSupportedVideoModes(); modes.Insert(0, "Native Resolution"); info.resolution = Scripting.GetUserSettingString("WindowManager/Resolution", "-1x-1"); if (info.resolution == "-1x-1") { info.resolution = "Native Resolution"; } info.supportedModes = modes.Distinct().ToArray(); double lod = (Scripting.GetUserSettingNumber("Graphics/Lod Falloff", 40.0) - 10.0) / 30.0; lod += Scripting.GetUserSettingNumber("Graphics/Min Lod Range", 0.0) / 30.0; if (lod < 0) { lod = 0; } if (lod > 2) { lod = 2; } info.lod = lod; // Serialize to json to be read by the gui StringWriter writer = new StringWriter(); JsonSerializer json = new JsonSerializer(); JsonTextWriter jsonWriter = new JsonTextWriter(writer); json.Formatting = Formatting.Indented; json.Serialize(jsonWriter, info); response.AddHeader("Content-Type", "application/json"); response.AppendBody(writer.GetStringBuilder().ToString()); }