public WebBrowserPageEdit(SceneEditingModel parent, ISceneItem item) { Editing = true; _item = item; var web = item.Source.Web; Url.Value = web.Url; Resolution.Value = Resolutions.FirstOrDefault(s => s.Width == web.Width && s.Height == web.Height) ?? Custom; CustomWidth.Value = web.Width.ToString(); CustomHeight.Value = web.Height.ToString(); Go.Execute = () => { item.Source = GetModel(); Update(); }; }
protected override void LoadFromIni() { // VIDEO var section = Ini["VIDEO"]; Fullscreen = section.GetBool("FULLSCREEN", true); UpdateResolutionsList(); CustomResolution.Width = section.GetInt("WIDTH", 0); CustomResolution.Height = section.GetInt("HEIGHT", 0); CustomResolution.Framerate = section.GetInt("REFRESH", 0); var resolution = Resolutions.GetByIdOrDefault(section.GetInt("INDEX", 0)) ?? Resolutions.FirstOrDefault(x => x.Same(CustomResolution)) ?? CustomResolution; if (Fullscreen && ReferenceEquals(resolution, CustomResolution) && SettingsHolder.Common.FixResolutionAutomatically) { Resolution = GetClosestToCustom(); if (!ReferenceEquals(CustomResolution, Resolution)) { ForceSave(); Logging.Debug($"RESOLUTION ({CustomResolution.DisplayName}) IS INVALID, CHANGED TO ({Resolution?.DisplayName})"); } } else { Resolution = resolution; } VerticalSyncronization = section.GetBool("VSYNC", false); AntiAliasingLevel = section.GetEntry("AASAMPLES", AntiAliasingLevels); AnisotropicLevel = section.GetEntry("ANISOTROPIC", AnisotropicLevels, "8"); ShadowMapSize = section.GetEntry("SHADOW_MAP_SIZE", ShadowMapSizes, "2048"); var limit = section.GetDouble("FPS_CAP_MS", 0); FramerateLimitEnabled = Math.Abs(limit) >= 0.1; FramerateLimit = FramerateLimitEnabled ? (int)Math.Round(1e3 / limit) : 60; CameraMode = Ini["CAMERA"].GetEntry("MODE", CameraModes); // ASSETTOCORSA section = Ini["ASSETTOCORSA"]; HideArms = section.GetBool("HIDE_ARMS", false); HideSteeringWheel = section.GetBool("HIDE_STEER", false); LockSteeringWheel = section.GetBool("LOCK_STEER", false); WorldDetail = section.GetEntry("WORLD_DETAIL", WorldDetailLevels, "4"); MotionBlur = Ini["EFFECTS"].GetInt("MOTION_BLUR", 6); SmokeInMirrors = Ini["EFFECTS"].GetBool("RENDER_SMOKE_IN_MIRROR", false); SmokeLevel = Ini["EFFECTS"].GetEntry("SMOKE", SmokeLevels, "2"); // POST_PROCESS section = Ini["POST_PROCESS"]; PostProcessing = section.GetBool("ENABLED", true); PostProcessingQuality = section.GetEntry("QUALITY", PostProcessingQualities, "4"); PostProcessingFilter = section.GetNonEmpty("FILTER", "default"); GlareQuality = section.GetEntry("GLARE", GlareQualities, "4"); DepthOfFieldQuality = section.GetEntry("DOF", DepthOfFieldQualities, "4"); RaysOfGod = section.GetBool("RAYS_OF_GOD", true); HeatShimmering = section.GetBool("HEAT_SHIMMER", true); Fxaa = section.GetBool("FXAA", true); ColorSaturation = Ini["SATURATION"].GetInt("LEVEL", 100); MirrorHighQuality = Ini["MIRROR"].GetBool("HQ", false); MirrorResolution = Ini["MIRROR"].GetEntry("SIZE", MirrorResolutions, "512"); section = Ini["CUBEMAP"]; CubemapResolution = section.GetEntry("SIZE", CubemapResolutions, "1024"); var orig = CubemapResolution.Value == @"0" && section.ContainsKey(@"__ORIG_FACES_PER_FRAME"); CubemapRenderingFrequency = section.GetEntry(orig ? @"__ORIG_FACES_PER_FRAME" : @"FACES_PER_FRAME", CubemapRenderingFrequencies, "3"); CubemapDistance = section.GetInt(orig ? @"__ORIG_FARPLANE" : @"FARPLANE", 600); }
private ResolutionEntry GetClosestToCustom() { return(Resolutions.FirstOrDefault( x => x.Width == CustomResolution.Width && x.Height == CustomResolution.Height && Equals(x.Framerate, CustomResolution.Framerate)) ?? Resolutions.FirstOrDefault(x => x.Width == CustomResolution.Width && x.Height == CustomResolution.Height) ?? GetPreferredResolution()); }