Esempio n. 1
0
        public void LinkControlsToTweaks()
        {
            // Make *.ini files read-only
            LinkedTweaks.LinkTweak(checkBoxReadOnly, iniReadOnlyTweak);

            // Automatically apply changes when tool is closed or game is launched
            LinkedTweaks.LinkTweak(checkBoxAutoApply, autoApplyTweak);

            // Don't check for updates on startup.
            LinkedTweaks.LinkTweak(checkBoxIgnoreUpdates, ignoreUpdatesTweak);

            // Play notification sounds
            LinkedTweaks.LinkTweak(checkBoxPlayNotificationSound, playNotificationSoundsTweak);

            // Close the tool when the game is launched.
            LinkedTweaks.LinkTweak(checkBoxQuitOnGameLaunch, toolQuitOnLaunchTweak);


            /*
             * Nuclear Winter options
             */

            // Rename added *.dll files
            LinkedTweaks.LinkTweak(checkBoxNWRenameDLL, renameDLLsTweak);

            // Automatically deploy mods
            LinkedTweaks.LinkTweak(checkBoxNWAutoDeployMods, deployModsOnNWModeTweak);

            // Automatically remove mods
            LinkedTweaks.LinkTweak(checkBoxNWAutoDisableMods, removeModsOnNWModeTweak);
        }
 private void FormSettings_Load(object sender, EventArgs e)
 {
     LinkedTweaks.LoadValues();
     UpdateGamesTab();
     RefreshNMUI();
     if (IniFiles.Config.GetBool("NexusMods", "bAutoUpdateProfile", true))
     {
         UpdateNMProfile();
     }
 }
Esempio n. 3
0
 private void FormSettings_Load(object sender, EventArgs e)
 {
     LinkedTweaks.LoadValues();
     UpdateGamesTab();
     RefreshNMUI();
     if (IniFiles.Config.GetBool("NexusMods", "bAutoUpdateProfile", true))
     {
         UpdateNMProfile();
     }
     this.checkBoxHandleNXMLinks.Checked = NXMHandler.IsRegistered();
 }
 public void LinkInfo()
 {
     LinkedTweaks.LinkInfo(checkBoxReadOnly, toolTip, iniReadOnlyTweak);
     LinkedTweaks.LinkInfo(checkBoxAutoApply, toolTip, autoApplyTweak);
     LinkedTweaks.LinkInfo(checkBoxIgnoreUpdates, toolTip, ignoreUpdatesTweak);
     LinkedTweaks.LinkInfo(checkBoxPlayNotificationSound, toolTip, playNotificationSoundsTweak);
     LinkedTweaks.LinkInfo(checkBoxQuitOnGameLaunch, toolTip, toolQuitOnLaunchTweak);
     LinkedTweaks.LinkInfo(checkBoxNWRenameDLL, toolTip, renameDLLsTweak);
     LinkedTweaks.LinkInfo(checkBoxNWAutoDeployMods, toolTip, deployModsOnNWModeTweak);
     LinkedTweaks.LinkInfo(checkBoxNWAutoDisableMods, toolTip, removeModsOnNWModeTweak);
 }
 private void buttonCameraPositionReset_Click(object sender, EventArgs e)
 {
     this.applyCameraNodeAnimationsTweak.ResetValue();
     this.cameraOverShoulderPosXTweak.ResetValue();
     this.cameraOverShoulderPosZTweak.ResetValue();
     this.cameraOverShoulderCombatPosXTweak.ResetValue();
     this.cameraOverShoulderCombatPosZTweak.ResetValue();
     this.cameraOverShoulderCombatAddYTweak.ResetValue();
     this.cameraOverShoulderMeleeCombatPosXTweak.ResetValue();
     this.cameraOverShoulderMeleeCombatPosZTweak.ResetValue();
     this.cameraOverShoulderMeleeCombatAddYTweak.ResetValue();
     LinkedTweaks.LoadValues();
 }
        public void LinkDangerZoneControls()
        {
            // Screen Space Reflections:
            LinkedTweaks.LinkTweak(checkBoxScreenSpaceReflections, screenSpaceReflectionsTweak);

            // Amount of shadow "segments": iDirShadowSplits
            LinkedTweaks.LinkTweak(
                comboBoxiDirShadowSplits,
                new int[] { 1, 2, 3 },
                dirShadowSplitsTweak);

            // BlendSplitDirShadowTweak / Shadow "segment" transition distance
            LinkedTweaks.LinkTweak(numfBlendSplitDirShadow, blendSplitDirShadowTweak);
        }
        /// <summary>
        /// Links trackbars to numericupdowns (and vice-versa)
        /// </summary>
        public void LinkSliders()
        {
            // Link numericUpDown and sliders:
            LinkedTweaks.LinkSlider(this.sliderGrassFadeDistance, this.numGrassFadeDistance, 1);
            //LinkSlider(this.sliderGrassDensity, this.numGrassDensity, 1, true);
            LinkedTweaks.LinkSlider(this.sliderLODObjects, this.numLODObjects, 10);
            LinkedTweaks.LinkSlider(this.sliderLODItems, this.numLODItems, 10);
            LinkedTweaks.LinkSlider(this.sliderLODActors, this.numLODActors, 10);
            LinkedTweaks.LinkSlider(this.sliderShadowDistance, this.numShadowDistance, 1);
            LinkedTweaks.LinkSlider(this.sliderfBlendSplitDirShadow, this.numfBlendSplitDirShadow, 0.0833333);
            LinkedTweaks.LinkSlider(this.sliderMouseSensitivity, this.numMouseSensitivity, 10000.0);
            LinkedTweaks.LinkSlider(this.sliderTAAPostOverlay, this.numTAAPostOverlay, 100);
            LinkedTweaks.LinkSlider(this.sliderTAAPostSharpen, this.numTAAPostSharpen, 100);

            LinkedTweaks.LinkSlider(this.sliderVolumeMaster, this.numVolumeMaster, 100);
            LinkedTweaks.LinkSlider(this.sliderAudioChat, this.numAudioChat, 1);
            LinkedTweaks.LinkSlider(this.sliderAudiofVal0, this.numAudiofVal0, 100);
            LinkedTweaks.LinkSlider(this.sliderAudiofVal1, this.numAudiofVal1, 100);
            LinkedTweaks.LinkSlider(this.sliderAudiofVal2, this.numAudiofVal2, 100);
            LinkedTweaks.LinkSlider(this.sliderAudiofVal3, this.numAudiofVal3, 100);
            LinkedTweaks.LinkSlider(this.sliderAudiofVal4, this.numAudiofVal4, 100);
            LinkedTweaks.LinkSlider(this.sliderAudiofVal5, this.numAudiofVal5, 100);
            LinkedTweaks.LinkSlider(this.sliderAudiofVal6, this.numAudiofVal6, 100);

            LinkedTweaks.LinkSlider(this.sliderFloatingQuestMarkersDistance, this.numFloatingQuestMarkersDistance, 10);
            LinkedTweaks.LinkSlider(this.sliderConversationHistorySize, this.numConversationHistorySize, 1);
            LinkedTweaks.LinkSlider(this.sliderHUDOpacity, this.numHUDOpacity, 100);

            LinkedTweaks.LinkSlider(this.sliderCameraDistanceMinimum, this.numCameraDistanceMinimum, 1);
            LinkedTweaks.LinkSlider(this.sliderCameraDistanceMaximum, this.numCameraDistanceMaximum, 1);
            LinkedTweaks.LinkSlider(this.sliderfPitchZoomOutMaxDist, this.numfPitchZoomOutMaxDist, 1);

            LinkedTweaks.LinkSlider(this.trackBarPhotomodeTranslationSpeed, this.numericUpDownPhotomodeTranslationSpeed, 10);
            LinkedTweaks.LinkSlider(this.trackBarPhotomodeRotationSpeed, this.numericUpDownPhotomodeRotationSpeed, 10);
            LinkedTweaks.LinkSlider(this.trackBarPhotomodeRange, this.numericUpDownPhotomodeRange, 1);


            LinkedTweaks.LinkSlider(this.trackBarfOverShoulderPosX, this.numfOverShoulderPosX, 1);
            LinkedTweaks.LinkSlider(this.trackBarfOverShoulderPosZ, this.numfOverShoulderPosZ, 1);
            LinkedTweaks.LinkSlider(this.trackBarfOverShoulderCombatPosX, this.numfOverShoulderCombatPosX, 1);
            LinkedTweaks.LinkSlider(this.trackBarfOverShoulderCombatPosZ, this.numfOverShoulderCombatPosZ, 1);
            LinkedTweaks.LinkSlider(this.trackBarfOverShoulderCombatAddY, this.numfOverShoulderCombatAddY, 1);
            LinkedTweaks.LinkSlider(this.trackBarfOverShoulderMeleeCombatPosX, this.numfOverShoulderMeleeCombatPosX, 1);
            LinkedTweaks.LinkSlider(this.trackBarfOverShoulderMeleeCombatPosZ, this.numfOverShoulderMeleeCombatPosZ, 1);
            LinkedTweaks.LinkSlider(this.trackBarfOverShoulderMeleeCombatAddY, this.numfOverShoulderMeleeCombatAddY, 1);
        }
Esempio n. 8
0
 public void LinkInfo()
 {
     LinkedTweaks.LinkInfo(checkBoxReadOnly, toolTip, iniReadOnlyTweak);
     LinkedTweaks.LinkInfo(checkBoxAutoApply, toolTip, autoApplyTweak);
     LinkedTweaks.LinkInfo(checkBoxIgnoreUpdates, toolTip, ignoreUpdatesTweak);
     LinkedTweaks.LinkInfo(checkBoxPlayNotificationSound, toolTip, playNotificationSoundsTweak);
     LinkedTweaks.LinkInfo(checkBoxQuitOnGameLaunch, toolTip, toolQuitOnLaunchTweak);
     LinkedTweaks.LinkInfo(checkBoxNWRenameDLL, toolTip, renameDLLsTweak);
     LinkedTweaks.LinkInfo(checkBoxNWAutoDeployMods, toolTip, deployModsOnNWModeTweak);
     LinkedTweaks.LinkInfo(checkBoxNWAutoDisableMods, toolTip, removeModsOnNWModeTweak);
     LinkedTweaks.LinkInfo(labelArchiveTwoPath, toolTip, archiveTwoPathTweak);
     LinkedTweaks.LinkInfo(labelSevenZipPath, toolTip, sevenZipPathTweak);
     LinkedTweaks.LinkInfo(labelDownloadsPath, toolTip, downloadPathTweak);
     LinkedTweaks.LinkInfo(textBoxArchiveTwoPath, toolTip, archiveTwoPathTweak);
     LinkedTweaks.LinkInfo(textBoxSevenZipPath, toolTip, sevenZipPathTweak);
     LinkedTweaks.LinkInfo(textBoxDownloadsPath, toolTip, downloadPathTweak);
     LinkedTweaks.LinkInfo(buttonPickArchiveTwoPath, toolTip, archiveTwoPathTweak);
     LinkedTweaks.LinkInfo(buttonPickSevenZipPath, toolTip, sevenZipPathTweak);
     LinkedTweaks.LinkInfo(buttonPickDownloadsPath, toolTip, downloadPathTweak);
 }
        /// <summary>
        /// Link controls to tweaks, that means:
        /// -> If a control's value changes, change the value of a tweak.
        /// -> If the UI is being (re)loaded, set each value according to that of the linked tweak.
        /// </summary>
        public void LinkControlsToTweaks()
        {
            /*
             * Info tab
             */

            // Make *.ini files read-only

            /*LinkedTweaks.LinkTweak(checkBoxReadOnly, iniReadOnlyTweak);
             *
             * // Automatically apply changes when tool is closed or game is launched
             * LinkedTweaks.LinkTweak(checkBoxAutoApply, autoApplyTweak);
             *
             * // Don't check for updates on startup.
             * LinkedTweaks.LinkTweak(checkBoxIgnoreUpdates, ignoreUpdatesTweak);
             *
             * // Play notification sounds
             * LinkedTweaks.LinkTweak(checkBoxPlayNotificationSound, playNotificationSoundsTweak);
             *
             * // Close the tool when the game is launched.
             * LinkedTweaks.LinkTweak(checkBoxQuitOnGameLaunch, toolQuitOnLaunchTweak);*/



            /*
             * General tab
             */

            // Enable Steam
            LinkedTweaks.LinkTweak(checkBoxEnableSteam, enableSteamTweak);

            // Automatically sign-in
            LinkedTweaks.LinkTweak(checkBoxAutoSignin, autoSigninTweak);

            // Skip intro videos
            LinkedTweaks.LinkTweakNegated(checkBoxSkipIntroVideos, introVideoTweak);


            // Show splash screen with news on startup
            LinkedTweaks.LinkTweak(checkBoxSkipSplash, skipStartupSplash);

            // Show damage numbers in Nuclear Winter
            LinkedTweaks.LinkTweak(checkBoxShowDamageNumbersNW, showDamageNumbersNuclearWinterTweak);

            // Show damage numbers in Adventure mode
            LinkedTweaks.LinkTweak(checkBoxShowDamageNumbersA, showDamageNumbersAdventureTweak);

            // Show item rarity colors
            LinkedTweaks.LinkTweak(checkBoxItemRarityColorsNW, enableItemRarityColorsTweak);

            // Show Public Team Notifications
            LinkedTweaks.LinkTweak(checkBoxShowPublicTeamNotifications, showPublicTeamNotificationsTweak);

            // Show Floating Quest Markers
            LinkedTweaks.LinkTweak(checkBoxShowFloatingQuestMarkers, showFloatingQuestMarkersTweak);

            // Show Floating Quest Text
            LinkedTweaks.LinkTweak(checkBoxShowFloatingQuestText, showFloatingQuestTextTweak);

            // Show crosshair
            LinkedTweaks.LinkTweak(checkBoxShowCrosshair, showCrosshairTweak);

            // Enable Power Armor HUD
            LinkedTweaks.LinkTweak(checkBoxEnablePowerArmorHUD, enablePowerArmorHUDTweak);

            // Show compass
            LinkedTweaks.LinkTweak(checkBoxShowCompass, showCompassTweak);

            // Show Other Players' Names
            LinkedTweaks.LinkTweak(checkBoxShowOtherPlayersNames, showOtherPlayersNamesTweak);

            // Show active effects on HUD
            LinkedTweaks.LinkTweak(comboBoxShowActiveEffectsOnHUD, activeEffectsOnHUDTweak);

            // Floating Quest Markers Draw Distance
            LinkedTweaks.LinkTweak(numFloatingQuestMarkersDistance, floatingQuestMarkersDistanceTweak);

            // HUD Opacity
            LinkedTweaks.LinkTweak(numHUDOpacity, hudOpacityTweak);


            // XYZ Quest Active when started
            LinkedTweaks.LinkTweak(checkBoxEnableQuestAutoTrackMain, autoTrackMainQuestWhenStartedTweak);
            LinkedTweaks.LinkTweak(checkBoxEnableQuestAutoTrackSide, autoTrackSideQuestWhenStartedTweak);
            LinkedTweaks.LinkTweak(checkBoxEnableQuestAutoTrackMisc, autoTrackMiscQuestWhenStartedTweak);
            LinkedTweaks.LinkTweak(checkBoxEnableQuestAutoTrackEvent, autoTrackEventQuestWhenStartedTweak);
            LinkedTweaks.LinkTweak(checkBoxEnableQuestAutoTrackDaily, autoTrackOtherQuestWhenStartedTweak);



            /*
             * Video tab
             */

            // Custom resolution
            LinkedTweaks.LinkSize(numCustomResW, numCustomResH, displaySizeTweak);

            // Display mode
            LinkedTweaks.LinkTweak(comboBoxDisplayMode, displayModeTweak);

            // iPresentInterval
            LinkedTweaks.LinkTweak(checkBoxVSync, presentIntervalTweak);

            // Always active
            LinkedTweaks.LinkTweak(checkBoxAlwaysActive, windowAlwaysActiveTweak);

            // Top most window
            LinkedTweaks.LinkTweak(checkBoxTopMostWindow, topMostWindowTweak);

            // Fix HUD for 5:4 and 4:3 screens
            LinkedTweaks.LinkTweak(checkBoxFixHUDFor5_4and4_3, fixHUD4to3RatioTweak);



            /*
             * Graphics
             */

            // Anti aliasing
            LinkedTweaks.LinkTweak(comboBoxAntiAliasing, antiAliasingTweak);

            // Anisotropic filtering
            LinkedTweaks.LinkTweak(
                comboBoxAnisotropicFiltering,
                new int[] { 0, 2, 4, 8, 16 },
                anisotropicFilteringTweak);

            // Depth of Field
            LinkedTweaks.LinkTweak(checkBoxDepthOfField, enableDepthOfFieldTweak);

            // Motion Blur
            LinkedTweaks.LinkTweak(checkBoxMotionBlur, motionBlurTweak);

            // Radial Blur
            LinkedTweaks.LinkTweak(checkBoxRadialBlur, radialBlurTweak);

            // Lens Flare
            LinkedTweaks.LinkTweak(checkBoxLensFlare, lensFlareTweak);

            // Ambient Occlusion
            LinkedTweaks.LinkTweak(checkBoxAmbientOcclusion, ambientOcclusionTweak);

            // Water / Displacement
            LinkedTweaks.LinkTweak(checkBoxWaterDisplacement, waterDisplacementsTweak);

            // Weather / Fog
            LinkedTweaks.LinkTweak(checkBoxFogEnabled, fogTweak);

            // Weather / Rain Occlusion
            LinkedTweaks.LinkTweak(checkBoxWeatherRainOcclusion, rainOcclusionTweak);

            // Weather / Wetness Occlusion
            LinkedTweaks.LinkTweak(checkBoxWeatherWetnessOcclusion, wetnessOcclusionTweak);

            // Lighting / Volumetric Lighting
            LinkedTweaks.LinkTweak(checkBoxGodrays, volumetricLightingTweak);

            // Effects / Disable gore
            LinkedTweaks.LinkTweak(checkBoxDisableGore, disableAllGoreTweak);

            // Shadow texture map resolution
            LinkedTweaks.LinkTweak(
                comboBoxShadowTextureResolution,
                new int[] { 512, 1024, 2048, 4096 },
                shadowMapResolutionTweak);

            // Shadows / Blurriness
            LinkedTweaks.LinkTweak(
                comboBoxShadowBlurriness,
                new int[] { 1, 2, 3 },
                shadowBlurrinessTweak);

            // Shadow distance
            LinkedTweaks.LinkTweak(numShadowDistance, shadowDistanceTweak);

            // Enable grass
            LinkedTweaks.LinkTweak(checkBoxGrass, enableGrassTweak);

            // Grass fade distance
            LinkedTweaks.LinkTweak(numGrassFadeDistance, grassFadeDistanceTweak);

            // LOD Fade Distances
            LinkedTweaks.LinkTweak(numLODObjects, lodFadeOutMultObjectsTweak);
            LinkedTweaks.LinkTweak(numLODItems, lodFadeOutMultItemsTweak);
            LinkedTweaks.LinkTweak(numLODActors, lodFadeOutMultActorsTweak);

            // TAA Sharpening
            LinkedTweaks.LinkTweak(numTAAPostOverlay, taaPostOverlayTweak);
            LinkedTweaks.LinkTweak(numTAAPostSharpen, taaPostSharpenTweak);



            /*
             * Audio tab
             */

            // Enable audio
            LinkedTweaks.LinkTweak(checkBoxEnableAudio, enableAudioTweak);

            // Play music in main menu
            LinkedTweaks.LinkTweak(checkBoxMainMenuMusic, playMainMenuMusicTweak);


            // Voice Chat Mode
            LinkedTweaks.LinkTweak(comboBoxVoiceChatMode, voiceChatModeTweak);

            // Push-To-Talk
            LinkedTweaks.LinkTweak(checkBoxPushToTalk, voicePushToTalkEnabledTweak);


            // General subtitles
            LinkedTweaks.LinkTweak(checkBoxGeneralSubtitles, generalSubtitlesTweak);

            // Dialogue subtitles
            LinkedTweaks.LinkTweak(checkBoxDialogueSubtitles, dialogueSubtitlesTweak);

            // Dialogue history
            LinkedTweaks.LinkTweak(checkBoxDialogueHistory, showDialogueHistoryTweak);

            // Conversation History Size
            LinkedTweaks.LinkTweak(numConversationHistorySize, conversationHistorySizeTweak);


            // Master volume
            LinkedTweaks.LinkTweak(numVolumeMaster, masterVolumeTweak);

            // Voice chat volume
            LinkedTweaks.LinkTweak(numAudioChat, vivoxVoiceVolumeTweak);

            // Audio menu:
            LinkedTweaks.LinkTweak(numAudiofVal0, val0Tweak);
            LinkedTweaks.LinkTweak(numAudiofVal1, val1Tweak);
            LinkedTweaks.LinkTweak(numAudiofVal2, val2Tweak);
            LinkedTweaks.LinkTweak(numAudiofVal3, val3Tweak);
            LinkedTweaks.LinkTweak(numAudiofVal4, val4Tweak);
            LinkedTweaks.LinkTweak(numAudiofVal5, val5Tweak);
            LinkedTweaks.LinkTweak(numAudiofVal6, val6Tweak);



            /*
             * Controls tab
             */

            // Mouse sensitivity
            LinkedTweaks.LinkTweak(numMouseSensitivity, mouseSensitivityTweak);

            // Fix mouse sensitivity
            LinkedTweaks.LinkTweak(checkBoxFixMouseSensitivity, fixMouseSensitivityTweak);

            // Fix aim sensitivity
            LinkedTweaks.LinkTweak(checkBoxFixAimSensitivity, fixAimSensitivityTweak);

            // Mouse acceleration
            LinkedTweaks.LinkTweak(checkBoxMouseAcceleration, mouseAccelerationTweak);

            // Invert mouse:
            LinkedTweaks.LinkTweak(checkBoxMouseInvertX, mouseInvertXTweak);
            LinkedTweaks.LinkTweak(checkBoxMouseInvertY, mouseInvertYTweak);

            // Gamepad enabled
            LinkedTweaks.LinkTweak(checkBoxGamepadEnabled, gamepadEnableTweak);

            // Vibration
            LinkedTweaks.LinkTweak(checkBoxGamepadRumble, enableGamepadRumbleTweak);



            /*
             * Pipboy tab
             */

            // Pipboy color
            LinkedTweaks.LinkColor(
                buttonColorPickPipboy,  // "Pick color" button
                buttonColorResetPipboy, // "Reset" button
                colorDialog,            // The color picking dialog that should open when clicking on "Pick color"
                colorPreviewPipboy,     // The little, colored square that is left to the label.
                pipboyColorTweak);

            // Quickboy color
            LinkedTweaks.LinkColor(
                buttonColorPickQuickboy,
                buttonColorResetQuickboy,
                colorDialog,
                colorPreviewQuickboy,
                quickboyColorTweak);

            // Power Armor Pipboy color
            LinkedTweaks.LinkColor(
                buttonColorPickPAPipboy,
                buttonColorResetPAPipboy,
                colorDialog,
                colorPreviewPAPipboy,
                powerArmorPipboyColorTweak);

            // Radiobuttons, Quickboy or Pipboy mode
            LinkedTweaks.LinkTweak(this.radioButtonQuickboy, this.radioButtonPipboy, quickboyModeEnabledTweak);

            // Pipboy resolution
            LinkedTweaks.LinkSize(numPipboyTargetWidth, numPipboyTargetHeight, pipboyTargetResolutionTweak);



            /*
             * Camera tab
             */

            // 1st person FOV
            LinkedTweaks.LinkTweak(numFirstPersonFOV, fov1stPersonTweak);

            // World FOV
            LinkedTweaks.LinkTweak(numWorldFOV, fov3rdPersonTweak);

            // 3rd person ADS FOV
            LinkedTweaks.LinkTweak(numADSFOV, fov3rdADSTweak);

            // fDefaultFOV
            LinkedTweaks.LinkTweak(numfDefaultFOV, defaultFOVTweak);

            // Camera distance
            LinkedTweaks.LinkTweak(numCameraDistanceMinimum, vanityModeMinDistTweak);
            LinkedTweaks.LinkTweak(numCameraDistanceMaximum, vanityModeMaxDistTweak);

            // fPitchZoomOutMaxDist
            LinkedTweaks.LinkTweak(numfPitchZoomOutMaxDist, pitchZoomOutMaxDistTweak);

            // Switch delay
            LinkedTweaks.LinkTweak(this.numCameraSwitchDelay, firstThirdPerspectiveSwitchDelayTweak);

            // Photomode options:
            LinkedTweaks.LinkTweak(this.numericUpDownPhotomodeRange, selfieModeRangeTweak);
            LinkedTweaks.LinkTweak(this.numericUpDownPhotomodeTranslationSpeed, selfieCameraTranslationSpeedTweak);
            LinkedTweaks.LinkTweak(this.numericUpDownPhotomodeRotationSpeed, selfieCameraRotationSpeedTweak);

            // Vanity mode
            LinkedTweaks.LinkTweakNegated(this.checkBoxVanityMode, disableAutoVanityModeTweak);
            LinkedTweaks.LinkTweak(this.checkBoxForceVanityMode, forceAutoVanityModeTweak);

            // bApplyCameraNodeAnimations
            LinkedTweaks.LinkTweak(this.checkBoxbApplyCameraNodeAnimations, applyCameraNodeAnimationsTweak);

            // OverShoulder sliders:
            LinkedTweaks.LinkTweak(this.numfOverShoulderPosX, cameraOverShoulderPosXTweak);
            LinkedTweaks.LinkTweak(this.numfOverShoulderPosZ, cameraOverShoulderPosZTweak);
            LinkedTweaks.LinkTweak(this.numfOverShoulderCombatPosX, cameraOverShoulderCombatPosXTweak);
            LinkedTweaks.LinkTweak(this.numfOverShoulderCombatPosZ, cameraOverShoulderCombatPosZTweak);
            LinkedTweaks.LinkTweak(this.numfOverShoulderCombatAddY, cameraOverShoulderCombatAddYTweak);
            LinkedTweaks.LinkTweak(this.numfOverShoulderMeleeCombatPosX, cameraOverShoulderMeleeCombatPosXTweak);
            LinkedTweaks.LinkTweak(this.numfOverShoulderMeleeCombatPosZ, cameraOverShoulderMeleeCombatPosZTweak);
            LinkedTweaks.LinkTweak(this.numfOverShoulderMeleeCombatAddY, cameraOverShoulderMeleeCombatAddYTweak);



            /*
             * Gallery tab
             */

            // Screenshot index
            LinkedTweaks.LinkTweak(numScreenshotIndex, screenshotIndexTweak);
        }
        /// <summary>
        /// Adds tooltip information (ITweakInfo)
        /// </summary>
        public void LinkInfo()
        {
            // Info tab

            /*LinkedTweaks.LinkInfo(checkBoxReadOnly, iniReadOnlyTweak);
             * LinkedTweaks.LinkInfo(checkBoxAutoApply, autoApplyTweak);
             * LinkedTweaks.LinkInfo(checkBoxIgnoreUpdates, ignoreUpdatesTweak);
             * LinkedTweaks.LinkInfo(checkBoxPlayNotificationSound, playNotificationSoundsTweak);
             * LinkedTweaks.LinkInfo(checkBoxQuitOnGameLaunch, toolQuitOnLaunchTweak);*/

            // General tab
            LinkedTweaks.LinkInfo(checkBoxEnableSteam, toolTip, enableSteamTweak);
            LinkedTweaks.LinkInfo(checkBoxAutoSignin, toolTip, autoSigninTweak);
            LinkedTweaks.LinkInfo(checkBoxSkipIntroVideos, toolTip, introVideoTweak);
            LinkedTweaks.LinkInfo(checkBoxSkipSplash, toolTip, skipStartupSplash);

            LinkedTweaks.LinkInfo(checkBoxShowDamageNumbersNW, toolTip, showDamageNumbersNuclearWinterTweak);
            LinkedTweaks.LinkInfo(checkBoxShowDamageNumbersA, toolTip, showDamageNumbersAdventureTweak);
            LinkedTweaks.LinkInfo(checkBoxItemRarityColorsNW, toolTip, enableItemRarityColorsTweak);
            LinkedTweaks.LinkInfo(checkBoxShowPublicTeamNotifications, toolTip, showPublicTeamNotificationsTweak);
            LinkedTweaks.LinkInfo(checkBoxShowFloatingQuestMarkers, toolTip, showFloatingQuestMarkersTweak);
            LinkedTweaks.LinkInfo(checkBoxShowFloatingQuestText, toolTip, showFloatingQuestTextTweak);
            LinkedTweaks.LinkInfo(checkBoxShowCrosshair, toolTip, showCrosshairTweak);
            LinkedTweaks.LinkInfo(checkBoxEnablePowerArmorHUD, toolTip, enablePowerArmorHUDTweak);
            LinkedTweaks.LinkInfo(checkBoxShowCompass, toolTip, showCompassTweak);
            LinkedTweaks.LinkInfo(checkBoxShowOtherPlayersNames, toolTip, showOtherPlayersNamesTweak);
            LinkedTweaks.LinkInfo(comboBoxShowActiveEffectsOnHUD, toolTip, activeEffectsOnHUDTweak);
            LinkedTweaks.LinkInfo(labelShowActiveEffectsOnHUD, toolTip, activeEffectsOnHUDTweak);
            LinkedTweaks.LinkInfo(numFloatingQuestMarkersDistance, toolTip, floatingQuestMarkersDistanceTweak);
            LinkedTweaks.LinkInfo(sliderFloatingQuestMarkersDistance, toolTip, floatingQuestMarkersDistanceTweak);
            LinkedTweaks.LinkInfo(labelFloatingQuestMarkersDistance, toolTip, floatingQuestMarkersDistanceTweak);
            LinkedTweaks.LinkInfo(numHUDOpacity, toolTip, hudOpacityTweak);
            LinkedTweaks.LinkInfo(sliderHUDOpacity, toolTip, hudOpacityTweak);
            LinkedTweaks.LinkInfo(labelHUDOpacity, toolTip, hudOpacityTweak);

            LinkedTweaks.LinkInfo(checkBoxEnableQuestAutoTrackMain, toolTip, autoTrackMainQuestWhenStartedTweak);
            LinkedTweaks.LinkInfo(checkBoxEnableQuestAutoTrackSide, toolTip, autoTrackSideQuestWhenStartedTweak);
            LinkedTweaks.LinkInfo(checkBoxEnableQuestAutoTrackMisc, toolTip, autoTrackMiscQuestWhenStartedTweak);
            LinkedTweaks.LinkInfo(checkBoxEnableQuestAutoTrackEvent, toolTip, autoTrackEventQuestWhenStartedTweak);
            LinkedTweaks.LinkInfo(checkBoxEnableQuestAutoTrackDaily, toolTip, autoTrackOtherQuestWhenStartedTweak);

            // Video tab
            LinkedTweaks.LinkInfo(numCustomResW, toolTip, displaySizeTweak);
            LinkedTweaks.LinkInfo(numCustomResH, toolTip, displaySizeTweak);
            LinkedTweaks.LinkInfo(labelResolution, toolTip, displaySizeTweak);
            LinkedTweaks.LinkInfo(labelCustomResolution, toolTip, displaySizeTweak);
            LinkedTweaks.LinkInfo(comboBoxResolution, toolTip, displaySizeTweak);
            LinkedTweaks.LinkInfo(comboBoxDisplayMode, toolTip, displayModeTweak);
            LinkedTweaks.LinkInfo(labelDisplayMode, toolTip, displayModeTweak);
            LinkedTweaks.LinkInfo(checkBoxVSync, toolTip, presentIntervalTweak);
            LinkedTweaks.LinkInfo(checkBoxAlwaysActive, toolTip, windowAlwaysActiveTweak);
            LinkedTweaks.LinkInfo(checkBoxTopMostWindow, toolTip, topMostWindowTweak);
            LinkedTweaks.LinkInfo(checkBoxFixHUDFor5_4and4_3, toolTip, fixHUD4to3RatioTweak);

            // Graphics:
            LinkedTweaks.LinkInfo(labelAntiAliasing, toolTip, antiAliasingTweak);
            LinkedTweaks.LinkInfo(comboBoxAntiAliasing, toolTip, antiAliasingTweak);
            LinkedTweaks.LinkInfo(labelAnisotropicFiltering, toolTip, anisotropicFilteringTweak);
            LinkedTweaks.LinkInfo(comboBoxAnisotropicFiltering, toolTip, anisotropicFilteringTweak);
            LinkedTweaks.LinkInfo(checkBoxDepthOfField, toolTip, enableDepthOfFieldTweak);
            LinkedTweaks.LinkInfo(checkBoxMotionBlur, toolTip, motionBlurTweak);
            LinkedTweaks.LinkInfo(checkBoxRadialBlur, toolTip, radialBlurTweak);
            LinkedTweaks.LinkInfo(checkBoxLensFlare, toolTip, lensFlareTweak);
            LinkedTweaks.LinkInfo(checkBoxAmbientOcclusion, toolTip, ambientOcclusionTweak);
            LinkedTweaks.LinkInfo(checkBoxWaterDisplacement, toolTip, waterDisplacementsTweak);
            LinkedTweaks.LinkInfo(checkBoxFogEnabled, toolTip, fogTweak);
            LinkedTweaks.LinkInfo(checkBoxWeatherRainOcclusion, toolTip, rainOcclusionTweak);
            LinkedTweaks.LinkInfo(checkBoxWeatherWetnessOcclusion, toolTip, wetnessOcclusionTweak);
            LinkedTweaks.LinkInfo(checkBoxGodrays, toolTip, volumetricLightingTweak);
            LinkedTweaks.LinkInfo(checkBoxDisableGore, toolTip, disableAllGoreTweak);
            LinkedTweaks.LinkInfo(labelShadowTextureResolution, toolTip, shadowMapResolutionTweak);
            LinkedTweaks.LinkInfo(comboBoxShadowTextureResolution, toolTip, shadowMapResolutionTweak);
            LinkedTweaks.LinkInfo(comboBoxShadowBlurriness, toolTip, shadowBlurrinessTweak);
            LinkedTweaks.LinkInfo(labelShadowBlurriness, toolTip, shadowBlurrinessTweak);
            LinkedTweaks.LinkInfo(numShadowDistance, toolTip, shadowDistanceTweak);
            LinkedTweaks.LinkInfo(sliderShadowDistance, toolTip, shadowDistanceTweak);
            LinkedTweaks.LinkInfo(numLODObjects, toolTip, lodFadeOutMultObjectsTweak);
            LinkedTweaks.LinkInfo(numLODItems, toolTip, lodFadeOutMultItemsTweak);
            LinkedTweaks.LinkInfo(numLODActors, toolTip, lodFadeOutMultActorsTweak);
            LinkedTweaks.LinkInfo(sliderLODObjects, toolTip, lodFadeOutMultObjectsTweak);
            LinkedTweaks.LinkInfo(sliderLODItems, toolTip, lodFadeOutMultItemsTweak);
            LinkedTweaks.LinkInfo(sliderLODActors, toolTip, lodFadeOutMultActorsTweak);
            LinkedTweaks.LinkInfo(checkBoxGrass, toolTip, enableGrassTweak);
            LinkedTweaks.LinkInfo(comboBoxiDirShadowSplits, toolTip, dirShadowSplitsTweak);
            LinkedTweaks.LinkInfo(labeliDirShadowSplits, toolTip, dirShadowSplitsTweak);
            LinkedTweaks.LinkInfo(numfBlendSplitDirShadow, toolTip, blendSplitDirShadowTweak);
            LinkedTweaks.LinkInfo(sliderfBlendSplitDirShadow, toolTip, blendSplitDirShadowTweak);
            LinkedTweaks.LinkInfo(numTAAPostOverlay, toolTip, taaPostOverlayTweak);
            LinkedTweaks.LinkInfo(numTAAPostSharpen, toolTip, taaPostSharpenTweak);
            LinkedTweaks.LinkInfo(sliderTAAPostOverlay, toolTip, taaPostOverlayTweak);
            LinkedTweaks.LinkInfo(sliderTAAPostSharpen, toolTip, taaPostSharpenTweak);
            LinkedTweaks.LinkInfo(checkBoxScreenSpaceReflections, toolTip, screenSpaceReflectionsTweak);
            LinkedTweaks.LinkInfo(numGrassFadeDistance, toolTip, grassFadeDistanceTweak);

            // Audio tab
            LinkedTweaks.LinkInfo(checkBoxEnableAudio, toolTip, enableAudioTweak);
            LinkedTweaks.LinkInfo(checkBoxMainMenuMusic, toolTip, playMainMenuMusicTweak);
            LinkedTweaks.LinkInfo(comboBoxVoiceChatMode, toolTip, voiceChatModeTweak);
            LinkedTweaks.LinkInfo(labelVoiceChatMode, toolTip, voiceChatModeTweak);
            LinkedTweaks.LinkInfo(checkBoxGeneralSubtitles, toolTip, generalSubtitlesTweak);
            LinkedTweaks.LinkInfo(checkBoxDialogueSubtitles, toolTip, dialogueSubtitlesTweak);
            LinkedTweaks.LinkInfo(checkBoxDialogueHistory, toolTip, showDialogueHistoryTweak);
            LinkedTweaks.LinkInfo(checkBoxPushToTalk, toolTip, voicePushToTalkEnabledTweak);
            LinkedTweaks.LinkInfo(numConversationHistorySize, toolTip, conversationHistorySizeTweak);
            LinkedTweaks.LinkInfo(sliderConversationHistorySize, toolTip, conversationHistorySizeTweak);
            LinkedTweaks.LinkInfo(labelConversationHistorySize, toolTip, conversationHistorySizeTweak);
            LinkedTweaks.LinkInfo(numVolumeMaster, toolTip, masterVolumeTweak);
            LinkedTweaks.LinkInfo(numAudioChat, toolTip, vivoxVoiceVolumeTweak);
            LinkedTweaks.LinkInfo(sliderVolumeMaster, toolTip, masterVolumeTweak);
            LinkedTweaks.LinkInfo(sliderAudioChat, toolTip, vivoxVoiceVolumeTweak);

            // Volume:
            LinkedTweaks.LinkInfo(labelVolumeMaster, toolTip, masterVolumeTweak);
            LinkedTweaks.LinkInfo(labelAudioChat, toolTip, vivoxVoiceVolumeTweak);

            LinkedTweaks.LinkInfo(numAudiofVal0, toolTip, val0Tweak);
            LinkedTweaks.LinkInfo(numAudiofVal1, toolTip, val1Tweak);
            LinkedTweaks.LinkInfo(numAudiofVal2, toolTip, val2Tweak);
            LinkedTweaks.LinkInfo(numAudiofVal3, toolTip, val3Tweak);
            LinkedTweaks.LinkInfo(numAudiofVal4, toolTip, val4Tweak);
            LinkedTweaks.LinkInfo(numAudiofVal5, toolTip, val5Tweak);
            LinkedTweaks.LinkInfo(numAudiofVal6, toolTip, val6Tweak);
            LinkedTweaks.LinkInfo(sliderAudiofVal0, toolTip, val0Tweak);
            LinkedTweaks.LinkInfo(sliderAudiofVal1, toolTip, val1Tweak);
            LinkedTweaks.LinkInfo(sliderAudiofVal2, toolTip, val2Tweak);
            LinkedTweaks.LinkInfo(sliderAudiofVal3, toolTip, val3Tweak);
            LinkedTweaks.LinkInfo(sliderAudiofVal4, toolTip, val4Tweak);
            LinkedTweaks.LinkInfo(sliderAudiofVal5, toolTip, val5Tweak);
            LinkedTweaks.LinkInfo(sliderAudiofVal6, toolTip, val6Tweak);

            // Controls tab
            LinkedTweaks.LinkInfo(numMouseSensitivity, toolTip, mouseSensitivityTweak);
            LinkedTweaks.LinkInfo(sliderMouseSensitivity, toolTip, mouseSensitivityTweak);
            LinkedTweaks.LinkInfo(checkBoxFixMouseSensitivity, toolTip, fixMouseSensitivityTweak);
            LinkedTweaks.LinkInfo(checkBoxFixAimSensitivity, toolTip, fixAimSensitivityTweak);
            LinkedTweaks.LinkInfo(checkBoxMouseAcceleration, toolTip, mouseAccelerationTweak);
            LinkedTweaks.LinkInfo(checkBoxMouseInvertX, toolTip, mouseInvertXTweak);
            LinkedTweaks.LinkInfo(checkBoxMouseInvertY, toolTip, mouseInvertYTweak);
            LinkedTweaks.LinkInfo(checkBoxGamepadEnabled, toolTip, gamepadEnableTweak);
            LinkedTweaks.LinkInfo(checkBoxGamepadRumble, toolTip, enableGamepadRumbleTweak);

            // Camera tab
            LinkedTweaks.LinkInfo(this.checkBoxbApplyCameraNodeAnimations, toolTip, applyCameraNodeAnimationsTweak);
            LinkedTweaks.LinkInfo(this.numfOverShoulderPosX, toolTip, cameraOverShoulderPosXTweak);
            LinkedTweaks.LinkInfo(this.numfOverShoulderPosZ, toolTip, cameraOverShoulderPosZTweak);
            LinkedTweaks.LinkInfo(this.numfOverShoulderCombatPosX, toolTip, cameraOverShoulderCombatPosXTweak);
            LinkedTweaks.LinkInfo(this.numfOverShoulderCombatPosZ, toolTip, cameraOverShoulderCombatPosZTweak);
            LinkedTweaks.LinkInfo(this.numfOverShoulderCombatAddY, toolTip, cameraOverShoulderCombatAddYTweak);
            LinkedTweaks.LinkInfo(this.numfOverShoulderMeleeCombatPosX, toolTip, cameraOverShoulderMeleeCombatPosXTweak);
            LinkedTweaks.LinkInfo(this.numfOverShoulderMeleeCombatPosZ, toolTip, cameraOverShoulderMeleeCombatPosZTweak);
            LinkedTweaks.LinkInfo(this.numfOverShoulderMeleeCombatAddY, toolTip, cameraOverShoulderMeleeCombatAddYTweak);
            LinkedTweaks.LinkInfo(this.trackBarfOverShoulderPosX, toolTip, cameraOverShoulderPosXTweak);
            LinkedTweaks.LinkInfo(this.trackBarfOverShoulderPosZ, toolTip, cameraOverShoulderPosZTweak);
            LinkedTweaks.LinkInfo(this.trackBarfOverShoulderCombatPosX, toolTip, cameraOverShoulderCombatPosXTweak);
            LinkedTweaks.LinkInfo(this.trackBarfOverShoulderCombatPosZ, toolTip, cameraOverShoulderCombatPosZTweak);
            LinkedTweaks.LinkInfo(this.trackBarfOverShoulderCombatAddY, toolTip, cameraOverShoulderCombatAddYTweak);
            LinkedTweaks.LinkInfo(this.trackBarfOverShoulderMeleeCombatPosX, toolTip, cameraOverShoulderMeleeCombatPosXTweak);
            LinkedTweaks.LinkInfo(this.trackBarfOverShoulderMeleeCombatPosZ, toolTip, cameraOverShoulderMeleeCombatPosZTweak);
            LinkedTweaks.LinkInfo(this.trackBarfOverShoulderMeleeCombatAddY, toolTip, cameraOverShoulderMeleeCombatAddYTweak);
            LinkedTweaks.LinkInfo(this.numericUpDownPhotomodeRange, toolTip, selfieModeRangeTweak);
            LinkedTweaks.LinkInfo(this.numericUpDownPhotomodeTranslationSpeed, toolTip, selfieCameraTranslationSpeedTweak);
            LinkedTweaks.LinkInfo(this.numericUpDownPhotomodeRotationSpeed, toolTip, selfieCameraRotationSpeedTweak);
            LinkedTweaks.LinkInfo(this.labelPhotomodeRange, toolTip, selfieModeRangeTweak);
            LinkedTweaks.LinkInfo(this.labelPhotomodeTranslationSpeed, toolTip, selfieCameraTranslationSpeedTweak);
            LinkedTweaks.LinkInfo(this.labelPhotomodeRotationSpeed, toolTip, selfieCameraRotationSpeedTweak);
            LinkedTweaks.LinkInfo(this.trackBarPhotomodeRange, toolTip, selfieModeRangeTweak);
            LinkedTweaks.LinkInfo(this.trackBarPhotomodeTranslationSpeed, toolTip, selfieCameraTranslationSpeedTweak);
            LinkedTweaks.LinkInfo(this.trackBarPhotomodeRotationSpeed, toolTip, selfieCameraRotationSpeedTweak);
            LinkedTweaks.LinkInfo(this.checkBoxVanityMode, toolTip, disableAutoVanityModeTweak);
            LinkedTweaks.LinkInfo(this.checkBoxForceVanityMode, toolTip, forceAutoVanityModeTweak);
            LinkedTweaks.LinkInfo(this.numCameraSwitchDelay, toolTip, firstThirdPerspectiveSwitchDelayTweak);
            LinkedTweaks.LinkInfo(this.labelSwitchDelay, toolTip, firstThirdPerspectiveSwitchDelayTweak);
            LinkedTweaks.LinkInfo(numFirstPersonFOV, toolTip, fov1stPersonTweak);
            LinkedTweaks.LinkInfo(numWorldFOV, toolTip, fov3rdPersonTweak);
            LinkedTweaks.LinkInfo(numADSFOV, toolTip, fov3rdADSTweak);
            LinkedTweaks.LinkInfo(numfDefaultFOV, toolTip, defaultFOVTweak);
            LinkedTweaks.LinkInfo(labelFirstPersonFOV, toolTip, fov1stPersonTweak);
            LinkedTweaks.LinkInfo(labelWorldFOV, toolTip, fov3rdPersonTweak);
            LinkedTweaks.LinkInfo(labelADSFOV, toolTip, fov3rdADSTweak);
            LinkedTweaks.LinkInfo(labelfDefaultFOV, toolTip, defaultFOVTweak);
            LinkedTweaks.LinkInfo(numCameraDistanceMinimum, toolTip, vanityModeMinDistTweak);
            LinkedTweaks.LinkInfo(numCameraDistanceMaximum, toolTip, vanityModeMaxDistTweak);
            LinkedTweaks.LinkInfo(numfPitchZoomOutMaxDist, toolTip, pitchZoomOutMaxDistTweak);
            LinkedTweaks.LinkInfo(labelCameraDistanceMinimum, toolTip, vanityModeMinDistTweak);
            LinkedTweaks.LinkInfo(labelCameraDistanceMaximum, toolTip, vanityModeMaxDistTweak);
            LinkedTweaks.LinkInfo(labelPitchZoomOutMaxDist, toolTip, pitchZoomOutMaxDistTweak);

            // Pipboy tab
            LinkedTweaks.LinkInfo(buttonColorPickPipboy, toolTip, pipboyColorTweak);
            LinkedTweaks.LinkInfo(buttonColorPickQuickboy, toolTip, quickboyColorTweak);
            LinkedTweaks.LinkInfo(buttonColorPickPAPipboy, toolTip, powerArmorPipboyColorTweak);
            LinkedTweaks.LinkInfo(labelPipboyColor, toolTip, pipboyColorTweak);
            LinkedTweaks.LinkInfo(labelQuickboyColor, toolTip, quickboyColorTweak);
            LinkedTweaks.LinkInfo(labelPowerArmorColor, toolTip, powerArmorPipboyColorTweak);
            LinkedTweaks.LinkInfo(numPipboyTargetHeight, toolTip, pipboyTargetResolutionTweak);
            LinkedTweaks.LinkInfo(numPipboyTargetWidth, toolTip, pipboyTargetResolutionTweak);
            LinkedTweaks.LinkInfo(radioButtonQuickboy, toolTip, quickboyModeEnabledTweak);
            LinkedTweaks.LinkInfo(radioButtonPipboy, toolTip, quickboyModeEnabledTweak);

            // Gallery tab
            LinkedTweaks.LinkInfo(numScreenshotIndex, toolTip, screenshotIndexTweak);
            LinkedTweaks.LinkInfo(labelScreenshotIndex, toolTip, screenshotIndexTweak);
        }
        /*
         * Serialization:
         */

        public void Save(string fileName, string version)
        {
            string newFileName = fileName;
            string newFilePath = Path.Combine(Localization.LanguageFolder, newFileName);

            // Create document and root:
            XDocument xmlDoc  = new XDocument();
            XElement  xmlRoot = new XElement("Language");

            xmlRoot.Add(new XAttribute("name", this.Name));
            xmlRoot.Add(new XAttribute("iso", this.ISO));
            if (this.ISO != "en-US" && this.Author.Length > 0)
            {
                xmlRoot.Add(new XAttribute("author", this.Author));
            }

            if (this.ISO == "en-US")
            {
                xmlDoc.AddFirst(
                    new XComment("\n" +
                                 "     This file is auto-generated on program start.\n" +
                                 "     Therefore any changes made to this file will be overwritten.\n" +
                                 "     You can use this as a template for your own translation, though.\n" +
                                 "\n" +
                                 "     If you need help with translating, you can find a guide here:\n" +
                                 "     https://github.com/FelisDiligens/Fallout76-QuickConfiguration/wiki/Translations\n"));
            }
            else
            {
                xmlDoc.AddFirst(
                    new XComment("\n" +
                                 "     This is a template that contains some of the already translated elements.\n" +
                                 "     You can rename it from \"*.template.xml\" to \"*.xml\" and translate the added elements.\n" +
                                 "\n" +
                                 "     If you need help with translating, you can find a guide here:\n" +
                                 "     https://github.com/FelisDiligens/Fallout76-QuickConfiguration/wiki/Translations\n"));
            }

            xmlRoot.Add(new XAttribute("version", version));
            xmlDoc.Add(xmlRoot);

            // Serialize external stuff:
            // TODO: Find a way to remove the references, plz:
            XElement xmlStrings      = Localization.SerializeStrings();
            XElement xmlDropDowns    = DropDown.SerializeAll();
            XElement xmlMsgBoxes     = MsgBox.SerializeAll();
            XElement xmlDescriptions = LinkedTweaks.SerializeTweakDescriptionList();
            string   separator       = "".PadLeft(150, '*');

            xmlStrings.AddFirst(new XComment($"\n        Strings\n        {separator}\n        Basically little text snippets that can be used everywhere.\n    "));
            xmlDropDowns.AddFirst(new XComment($"\n        Dropdowns\n        {separator}\n        Make sure that the amount of options stays the same.\n    "));
            xmlMsgBoxes.AddFirst(new XComment($"\n        Message boxes\n        {separator}\n        The {"{0}"} is a placeholder, btw.\n    "));
            xmlDescriptions.AddFirst(new XComment($"\n        Descriptions\n        {separator}\n        These are the descriptions of almost all tweaks.\n        They appear in tool tips, when the user hovers over a tweak with the mouse cursor.\n    "));
            xmlRoot.Add(xmlStrings);
            xmlRoot.Add(xmlDropDowns);
            xmlRoot.Add(xmlMsgBoxes);
            xmlRoot.Add(xmlDescriptions);

            ignoreTooltipsOfTheseControls = LinkedTweaks.GetListOfLinkedControlNames();

            // Serialize all control elements:
            foreach (LocalizedForm form in Localization.LocalizedForms)
            {
                XElement xmlForm = new XElement(form.Form.Name, new XAttribute("title", form.Form.Text));
                xmlForm.AddFirst(new XComment($"\n        {form.Form.Name}\n        {separator}\n        {form.Form.Text}\n    "));
                SerializeControls(xmlForm, form.Form, form.ToolTip);
                foreach (Control control in form.SpecialControls)
                {
                    SerializeControl(xmlForm, control, form.ToolTip);
                }
                xmlRoot.Add(xmlForm);
            }

            // Save it:
            Directory.CreateDirectory(Localization.LanguageFolder);
            xmlDoc.Save(newFilePath);
        }
        /*
         * Deserialization:
         */

        public void Apply()
        {
            try
            {
                // Read *.xml file:
                XDocument xmlDoc  = XDocument.Load(this.filePath);
                XElement  xmlRoot = xmlDoc.Element("Language");

                ignoreTooltipsOfTheseControls = LinkedTweaks.GetListOfLinkedControlNames();

                // Translate each form individually:
                foreach (LocalizedForm form in Localization.LocalizedForms)
                {
                    XElement xmlForm = xmlRoot.Element(form.Form.Name);

                    // Ignore non-existing forms
                    if (xmlForm == null)
                    {
                        continue; // throw new InvalidXmlException($"Couldn't find <{form.Form.Name}>");
                    }
                    // Set title, if it exists:
                    if (xmlForm.Attribute("title") != null)
                    {
                        form.Form.Text = xmlForm.Attribute("title").Value;
                    }

                    // Forms:
                    DeserializeDictionaries(xmlForm); // TODO: xmlRoot replaced with xmlForm. Good idea?
                    DeserializeControls(xmlForm, form.Form, form.ToolTip);
                    foreach (Control subControl in form.SpecialControls)
                    {
                        DeserializeControl(xmlForm, subControl, form.ToolTip);
                    }

                    // Message boxes:
                    XElement xmlMsgBox = xmlRoot.Element("Messageboxes");
                    if (xmlMsgBox != null)
                    {
                        MsgBox.Deserialize(xmlMsgBox);
                    }

                    // Strings:
                    XElement xmlStrings = xmlRoot.Element("Strings");
                    if (xmlStrings != null)
                    {
                        Localization.DeserializeStrings(xmlStrings);
                    }

                    // TODO: Generalize this. No outside references, plz:

                    // TODO: Doesn't make sense to deserialize them multiple times:

                    // Drop downs:
                    XElement xmlDropDowns = xmlRoot.Element("Dropdowns");
                    if (xmlDropDowns != null)
                    {
                        DropDown.DeserializeAll(xmlDropDowns);
                    }

                    // Tweak descriptions:
                    XElement xmlTweakDescriptions = xmlRoot.Element("TweakDescriptions");
                    if (xmlTweakDescriptions != null)
                    {
                        LinkedTweaks.DeserializeTweakDescriptionList(xmlTweakDescriptions);
                    }
                    if (form.ToolTip != null)
                    {
                        LinkedTweaks.SetToolTips(); // TODO: No need to call it per form anymore
                    }
                }

                // Call event handler:
                if (LanguageChanged != null)
                {
                    TranslationEventArgs e = new TranslationEventArgs();
                    e.HasAuthor = this.Author != "";
                    //e.ActiveTranslation = this;
                    LanguageChanged(this, e);
                }
            }
            catch (Exception exc)
            {
                MsgBox.Show("Loading translation failed", $"The translation '{Path.GetFileNameWithoutExtension(filePath)}' couldn't be loaded.\n{exc.GetType()}: {exc.Message}", MessageBoxIcon.Error);
            }
        }
        private void OnProfileChanged(object sender, ProfileEventArgs e)
        {
            this.game = e.ActiveGameInstance;
            this.timerCheckFiles.Enabled = false;
            while (true)
            {
                try
                {
                    IniFiles.Load(game);
                    break;
                }
                catch (IniParsingException exc)
                {
                    DialogResult result = FormIniError.OpenDialog(exc);
                    if (result == DialogResult.Retry)
                    {
                        continue;
                    }
                    else if (result == DialogResult.Ignore)
                    {
                        continue;
                    }
                    else if (result == DialogResult.Abort)
                    {
                        Environment.Exit(-1);
                        return;
                    }
                    //MsgBox.Get("iniParsingError").FormatText(exc.Message).Show(MessageBoxIcon.Error);
                    //Application.Exit();
                    //return;
                }
            }
            LinkedTweaks.LoadValues();
            // TODO: For some reason, it won't update the resolution combobox, unless I add this workaround:
            numCustomRes_ValueChanged(null, null);

            // Change image
            switch (e.ActiveGameInstance.Edition)
            {
            case GameEdition.Steam:
                this.pictureBoxGameEdition.Image          = Resources.steam;
                this.toolStripStatusLabelEditionText.Text = "Steam";
                this.labelGameEdition.Text = "Steam";
                break;

            case GameEdition.BethesdaNet:
                this.pictureBoxGameEdition.Image          = Resources.bethesda;
                this.toolStripStatusLabelEditionText.Text = "Bethesda.net";
                this.labelGameEdition.Text = "Bethesda";
                break;

            case GameEdition.BethesdaNetPTS:
                this.pictureBoxGameEdition.Image          = Resources.bethesda_pts;
                this.toolStripStatusLabelEditionText.Text = "Bethesda.net (PTS)";
                this.labelGameEdition.Text = "Bethesda\n(PTS)";
                break;

            case GameEdition.MSStore:
                this.pictureBoxGameEdition.Image          = Resources.msstore;
                this.toolStripStatusLabelEditionText.Text = "Microsoft Store";
                this.labelGameEdition.Text = "Microsoft\nStore";
                break;

            default:
                this.pictureBoxGameEdition.Image          = Resources.help_128;
                this.toolStripStatusLabelEditionText.Text = Localization.GetString("unknown");
                this.labelGameEdition.Text = Localization.GetString("unknown");
                break;
            }

            LoadAccountProfile();
            LoadCustomTab();

            this.toolStripStatusLabelGameText.Text = e.ActiveGameInstance?.Title;
            this.timerCheckFiles.Enabled           = true;
        }