private void editMenuPreferencesItem_clicked(object sender, EventArgs e)
        {
            object ret;
            using (Preferences_Dialog dlg = new Preferences_Dialog(this))
            {
                //Check Registry for previous settings. If some are missing fill in with defaults
                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "DisplayOcean", (object)true);
                if (ret == null || String.Equals(ret.ToString(), "True"))
                {
                    ret = (object)true;
                }
                else
                {
                    ret = (object)false;
                }
                dlg.DisplayOceanCheckbox = (bool)ret;
                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "DisplayFog", (object)true);
                if (ret == null || String.Equals(ret.ToString(), "True"))
                {
                    ret = (object)true;
                }
                else
                {
                    ret = (object)false;
                }
                dlg.DisplayFogEffects = (bool)ret;
                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "DisplayLight", (object)true);
                if (ret == null || String.Equals(ret.ToString(), "True"))
                {
                    ret = (object)true;
                }
                else
                {
                    ret = (object)false;
                }
                dlg.LightEffectsDisplay = (bool)ret;
                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "DisplayShadows", (object)false);
                if (ret == null || String.Equals(ret.ToString(), "False"))
                {
                    ret = (object)false;
                }
                else
                {
                    ret = (object)true;
                }
                dlg.ShadowsDisplay = (bool)ret;
                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "DisplayRegionMarkers", (object)true);
                if (ret == null || String.Equals(ret.ToString(), "True"))
                {
                    ret = (object)true;
                }
                else
                {
                    ret = (object)false;
                }
                dlg.DisplayRegionMarkers = (bool)ret;
                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "DisplayRoadMarkers", (object)true);
                if (ret == null || String.Equals(ret.ToString(), "True"))
                {
                    ret = (object)true;
                }
                else
                {
                    ret = (object)false;
                }
                dlg.DisplayRoadMarkers = (bool)ret;
                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "DisplayMarkerPoints", (object)true);
                if (ret == null || String.Equals(ret.ToString(), "True"))
                {
                    ret = (object)true;
                }
                else
                {
                    ret = (object)false;
                }
                dlg.DisplayMarkerPoints = (bool)ret;
                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "DisplayPointLightMarkers", (object)true);
                if (ret == null || String.Equals(ret.ToString(), "True"))
                {
                    ret = (object)true;
                }
                else
                {
                    ret = (object)false;
                }
                dlg.DisplayPointLightMarkers = (bool)ret;
                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "Disable All Markers", (object)false);
                if (ret == null || String.Equals(ret.ToString(), "False"))
                {
                    ret = (object)false;
                }
                else
                {
                    ret = (object)true;
                }
                dlg.DisableAllMarkerPoints = (bool)ret;
                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "Display Terrain Decals", (object)true);
                if (ret == null || String.Equals(ret.ToString(), "True"))
                {
                    ret = (object)true;
                }
                else
                {
                    ret = (object)false;
                }
                dlg.DisplayTerrainDecals = (bool)ret;
                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "CameraFollowsTerrain", (object)false);
                if (ret == null || String.Equals(ret.ToString(), "False"))
                {
                    ret = (object)false;
                }
                else
                {
                    ret = (object)true;
                }
                dlg.CameraFollowsTerrain = (bool)ret;
                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "CameraStaysAboveTerrain", (object)true);
                if (ret == null || String.Equals(ret.ToString(), "True"))
                {
                    ret = (object)true;
                }
                else
                {
                    ret = (object)false;
                }
                dlg.CameraStaysAboveTerrain = (bool)ret;
                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "CameraNearDistance", (object)1f);
                if (ret != null)
                {
                    dlg.CameraNearDistanceFloat = float.Parse(ret.ToString());
                }
                else
                {
                    dlg.CameraNearDistanceFloat = 1f;
                }
                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "LockCameraToObject", (object)false);
                if (ret == null || String.Equals(ret.ToString(), "False"))
                {
                    ret = (object)false;
                }
                else
                {
                    ret = (object)true;
                }
                dlg.LockCameraToObject = (bool)ret;

                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "Disable Video Playback", (object)false);
                if (ret == null || String.Equals(ret.ToString(), "False"))
                {
                    ret = (object)false;
                }
                else
                {
                    ret = (object)true;
                }
                dlg.DisableVideoPlayback = (bool)ret;

                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "MaxFPS", (object)0);
                if (ret != null)
                {
                    uint maxfps;
                    if (uint.TryParse(ret.ToString(), out maxfps) && maxfps > 0)
                    {
                        dlg.MaxFramesPerSecondEnabled = true;
                        dlg.MaxFramesPerSesconduInt = maxfps;
                    }
                    else
                    {
                        dlg.MaxFramesPerSecondEnabled = false;
                    }
                }
                else
                {
                    dlg.MaxFramesPerSecondEnabled = false;
                }
                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "AutoSaveEnable", (object)true);
                if (ret == null || String.Equals(ret, "True"))
                {
                    ret = (object)true;
                }
                else
                {
                    ret = (object)false;
                }
                dlg.AutoSaveEnabled = (bool)ret;
                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "AutoSaveTime", (object)(30 * 60000));
                if (ret == null)
                {
                    dlg.AutoSaveTimeuInt = 30;
                }
                else
                {
                    dlg.AutoSaveTimeuInt = (uint.Parse(ret.ToString())) / 60000;
                }
                List<string> dirs = RepositoryClass.Instance.RepositoryDirectoryList;
                dlg.RepositoryDirectoryList = dirs;

                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "CameraDefaultSpeed", (object)(Config.DefaultCamSpeed));
                if (ret != null)
                {
                    dlg.CameraDefaultSpeedTextBoxAsFloat = float.Parse(ret.ToString()) / 1000f;
                }
                else
                {
                    dlg.CameraDefaultSpeedTextBoxAsFloat = Config.DefaultCamSpeed / 1000f;
                }
                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "CameraSpeedIncrement", (object)(Config.DefaultCamSpeedIncrement));
                if (ret != null)
                {
                    dlg.CameraSpeedIncrementTextBoxAsFloat = float.Parse(ret.ToString()) / 1000f;
                }
                else
                {
                    dlg.CameraSpeedIncrementTextBoxAsFloat = Config.DefaultCamSpeedIncrement / 1000f;
                }
                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "PresetCameraSpeed1", (object)(Config.DefaultPresetCamSpeed1));
                if (ret != null)
                {
                    dlg.PresetCameraSpeed1TextBoxAsFloat = float.Parse(ret.ToString()) / 1000f;
                }
                else
                {
                    dlg.PresetCameraSpeed1TextBoxAsFloat = Config.DefaultPresetCamSpeed1 / 1000f;
                }
                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "PresetCameraSpeed2", (object)(Config.DefaultPresetCamSpeed2));
                if (ret != null)
                {
                    dlg.PresetCameraSpeed2TextBoxAsFloat = float.Parse(ret.ToString()) / 1000f;
                }
                else
                {
                    dlg.PresetCameraSpeed2TextBoxAsFloat = config.DefaultPresetCamSpeed2 / 1000f;
                }
                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "PresetCameraSpeed3", (object)(Config.DefaultPresetCamSpeed3));
                if (ret != null)
                {
                    dlg.PresetCameraSpeed3TextBoxAsFloat = float.Parse(ret.ToString()) / 1000f;
                }
                else
                {
                    dlg.PresetCameraSpeed3TextBoxAsFloat = Config.DefaultPresetCamSpeed3 / 1000f;
                }
                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "PresetCameraSpeed4", (object)(Config.DefaultPresetCamSpeed4));
                if (ret != null)
                {
                    dlg.PresetCameraSpeed4TextBoxAsFloat = float.Parse(ret.ToString()) / 1000f;
                }
                else
                {
                    dlg.PresetCameraSpeed4TextBoxAsFloat = Config.DefaultPresetCamSpeed4 / 1000f;
                }

                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "CameraAccelerate", (object)Config.DefaultAccelerateCamera);
                if (ret != null && String.Equals(ret, "False"))
                {
                    dlg.AccelerateCameraCheckBoxChecked = false;
                }
                else
                {
                    dlg.AccelerateCameraCheckBoxChecked = true;
                }

                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "CameraAccelerationRate", (object)(Config.DefaultCamAccelRate));
                if (ret != null)
                {
                    dlg.CameraAccelerationRateTextBoxAsFloat = float.Parse(ret.ToString()) / 1000f;
                }
                else
                {
                    dlg.CameraAccelerationRateTextBoxAsFloat = Config.DefaultCamAccelRate / 1000f;
                }
                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "CameraAccelerationIncrement", (object)(Config.DefaultCamAccelRateIncrement));
                if (ret != null)
                {
                    dlg.CameraAccelerationIncrementTextBoxAsFloat = float.Parse(ret.ToString()) / 1000f;
                }
                else
                {
                    dlg.CameraAccelerationIncrementTextBoxAsFloat = Config.DefaultCamAccelRateIncrement / 1000f;
                }

                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "PresetCameraAccelRate1", (object)(Config.DefaultPresetCamAccel1));
                if (ret != null)
                {
                    dlg.PresetCameraAcceleration1TextBoxAsFloat = float.Parse(ret.ToString()) / 1000f;
                }
                else
                {
                    dlg.PresetCameraAcceleration1TextBoxAsFloat = Config.DefaultPresetCamAccel1 / 1000f;
                }

                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "PresetCameraAccelRate2", (object)(Config.DefaultPresetCamAccel2));
                if (ret != null)
                {
                    dlg.PresetCameraAcceleration2TextBoxAsFloat = float.Parse(ret.ToString()) / 1000f;
                }
                else
                {
                    dlg.PresetCameraAcceleration2TextBoxAsFloat = Config.DefaultPresetCamAccel2 / 1000f;
                }
                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "PresetCameraAccelRate3", (object)(Config.DefaultPresetCamAccel3));
                if (ret != null)
                {
                    dlg.PresetCameraAcceleration3TextBoxAsFloat = float.Parse(ret.ToString()) / 1000f;
                }
                else
                {
                    dlg.PresetCameraAcceleration3TextBoxAsFloat = Config.DefaultPresetCamAccel3 / 1000f;
                }
                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "PresetCameraAccelRate4", (object)(Config.DefaultPresetCamAccel4));
                if (ret != null)
                {
                    dlg.PresetCameraAcceleration4TextBoxAsFloat = float.Parse(ret.ToString()) / 1000f;
                }
                else
                {
                    dlg.PresetCameraAcceleration4TextBoxAsFloat = Config.DefaultPresetCamAccel4 / 1000f;
                }

                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "CameraTurnRate", (object)Config.DefaultCameraTurnRate);
                if (ret != null)
                {
                    dlg.CameraTurnRateTextBoxAsFloat = float.Parse(ret.ToString());
                }
                else
                {
                    dlg.CameraTurnRateTextBoxAsFloat = Config.DefaultCameraTurnRate;
                }

                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "MouseWheelMultiplier", (object)Config.DefaultMouseWheelMultiplier);
                if (ret != null)
                {
                    dlg.MouseWheelMultiplierTextBoxAsFloat = float.Parse(ret.ToString());
                }
                else
                {
                    dlg.MouseWheelMultiplierTextBoxAsFloat = Config.DefaultMouseWheelMultiplier;
                }

                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "MWMPreset1", (object)Config.DefaultPresetMWM1);
                if (ret != null)
                {
                    dlg.Preset1MWMTextBoxAsFloat = float.Parse(ret.ToString());
                }
                else
                {
                    dlg.Preset1MWMTextBoxAsFloat = Config.DefaultPresetMWM1;
                }

                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "MWMPreset2", (object)Config.DefaultPresetMWM2);
                if (ret != null)
                {
                    dlg.Preset2MWMTextBoxAsFloat = float.Parse(ret.ToString());
                }
                else
                {
                    dlg.Preset2MWMTextBoxAsFloat = Config.DefaultPresetMWM2;
                }

                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "MWMPreset3", (object)Config.DefaultPresetMWM3);
                if (ret != null)
                {
                    dlg.Preset3MWMTextBoxAsFloat = float.Parse(ret.ToString());
                }
                else
                {
                    dlg.Preset3MWMTextBoxAsFloat = Config.DefaultPresetMWM3;
                }

                ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "MWMPreset4", (object)Config.DefaultPresetMWM4);
                if (ret != null)
                {
                    dlg.Preset4MWMTextBoxAsFloat = float.Parse(ret.ToString());
                }
                else
                {
                    dlg.Preset4MWMTextBoxAsFloat = Config.DefaultPresetMWM4;
                }
                // Show the dialog and if the dialog returns with an ok, set the registry settings and
                // make them the current settings.

                DialogResult result;
                bool showAgain;
                do
                {
                    result = dlg.ShowDialog();
                    showAgain = false;
                    if (result == DialogResult.OK)
                    {
                        // do validation here
                        // if validation fails, set showAgain to true
                        showAgain = ((result == DialogResult.OK) && (!dlg.okButton_validating()));
                    }
                } while (showAgain);
                if (result == DialogResult.OK)
                {
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "DisplayOcean", (object)dlg.DisplayOceanCheckbox);
                    DisplayOcean = dlg.DisplayOceanCheckbox;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "DisplayFog", (object)dlg.DisplayFogEffects);
                    displayFog = dlg.DisplayFogEffects;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "DisplayLight", (object)dlg.LightEffectsDisplay);
                    displayLights = dlg.LightEffectsDisplay;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "DisplayShadows", (object)dlg.ShadowsDisplay);
                    if (Axiom.SceneManagers.Multiverse.TerrainManager.Instance.ShadowConfig.ShadowTechnique == Axiom.SceneManagers.Multiverse.ShadowTechnique.Depth && !dlg.ShadowsDisplay)
                    {
                        Axiom.SceneManagers.Multiverse.TerrainManager.Instance.ShadowConfig.ShadowTechnique = Axiom.SceneManagers.Multiverse.ShadowTechnique.None;
                    }
                    if (Axiom.SceneManagers.Multiverse.TerrainManager.Instance.ShadowConfig.ShadowTechnique == Axiom.SceneManagers.Multiverse.ShadowTechnique.None && dlg.ShadowsDisplay)
                    {
                        Axiom.SceneManagers.Multiverse.TerrainManager.Instance.ShadowConfig.ShadowTechnique = Axiom.SceneManagers.Multiverse.ShadowTechnique.Depth;
                    }
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "DisplayRegionMarkers", (object)dlg.DisplayRegionMarkers);
                    displayBoundaryMarkers = dlg.DisplayRegionMarkers;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "DisplayRoadMarkers", (object)dlg.DisplayRoadMarkers);
                    displayRoadMarkers = dlg.DisplayRoadMarkers;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "DisplayMarkerPoints", (object)dlg.DisplayMarkerPoints);
                    displayMarkerPoints = dlg.DisplayMarkerPoints;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "DisplayPointLightMarkers", (object)dlg.DisplayPointLightMarkers);
                    displayPointLightMarker = dlg.DisplayPointLightMarkers;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "DisableAllMarkers", (object)dlg.DisableAllMarkerPoints);
                    disableAllMarkers = dlg.DisableAllMarkerPoints;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "Display Terrain Decals", (object)dlg.DisplayTerrainDecals);
                    displayTerrainDecals = dlg.DisplayTerrainDecals;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "Disable Video Playback", (object)dlg.DisableVideoPlayback);
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "CameraFollowsTerrain", (object)dlg.CameraFollowsTerrain);
                    cameraTerrainFollow = dlg.CameraFollowsTerrain;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "CameraStaysAboveTerrain", (object)dlg.CameraStaysAboveTerrain);
                    cameraAboveTerrain = dlg.CameraStaysAboveTerrain;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "LockCameraToObject", (object)dlg.LockCameraToObject);
                    lockCameraToObject = dlg.LockCameraToObject;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "CameraNearDistance", (object)dlg.CameraNearDistanceFloat);
                    float nearDistance = dlg.CameraNearDistanceFloat;
                    if (nearDistance > 20)
                    {
                        CameraNear = oneMeter * 10f * (nearDistance - 20f) / 20f;
                    }
                    else
                    {
                        CameraNear = oneMeter / 10f * (float)Math.Pow(10.0f, (double)nearDistance / 20.0f);
                    }
                    if (dlg.MaxFramesPerSecondEnabled)
                    {
                        Registry.SetValue(Config.WorldEditorBaseRegistryKey, "MaxFPS", (object)dlg.MaxFramesPerSesconduInt);
                    }
                    else
                    {
                        Registry.SetValue(Config.WorldEditorBaseRegistryKey, "MaxFPS", (object)0);
                    }
                    Root.Instance.MaxFramesPerSecond = (int)dlg.MaxFramesPerSesconduInt;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "AutoSaveEnable", (object)dlg.AutoSaveEnabled);
                    autoSaveEnabled = dlg.AutoSaveEnabled;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "AutoSaveTime", ((object)(dlg.AutoSaveTimeuInt * 60000)));
                    autoSaveTime = dlg.AutoSaveTimeuInt * 60000;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "CameraDefaultSpeed", (object)(dlg.CameraDefaultSpeedTextBoxAsFloat * 1000f));
                    camSpeed = dlg.CameraDefaultSpeedTextBoxAsFloat * 1000f;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "CameraSpeedIncrement", (object)(dlg.CameraSpeedIncrementTextBoxAsFloat * 1000f));
                    camSpeedIncrement = dlg.CameraSpeedIncrementTextBoxAsFloat * 1000f;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "PresetCameraSpeed1", (object)(dlg.PresetCameraSpeed1TextBoxAsFloat * 1000f));
                    presetCameraSpeed1 = dlg.PresetCameraSpeed1TextBoxAsFloat * 1000f;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "PresetCameraSpeed2", (object)(dlg.PresetCameraSpeed2TextBoxAsFloat * 1000f));
                    presetCameraSpeed2 = dlg.PresetCameraSpeed2TextBoxAsFloat * 1000f;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "PresetCameraSpeed3", (object)(dlg.PresetCameraSpeed3TextBoxAsFloat * 1000f));
                    presetCameraSpeed3 = dlg.PresetCameraSpeed3TextBoxAsFloat * 1000f;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "PresetCameraSpeed4", (object)(dlg.PresetCameraSpeed4TextBoxAsFloat * 1000f));
                    presetCameraSpeed4 = dlg.PresetCameraSpeed4TextBoxAsFloat * 1000f;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "CameraAccelerate", (object)dlg.AccelerateCameraCheckBoxChecked);
                    accelerateCamera = dlg.AccelerateCameraCheckBoxChecked;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "CameraAccelerationRate", (object)(dlg.CameraAccelerationRateTextBoxAsFloat * 1000f));
                    camAccel = dlg.CameraAccelerationRateTextBoxAsFloat * 1000f;
                    defaultCamAccelSpeed = dlg.CameraAccelerationRateTextBoxAsFloat * 1000f;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "CameraAccelerationIncrement", (object)(dlg.CameraAccelerationIncrementTextBoxAsFloat * 1000f));
                    camAccelIncrement = dlg.CameraAccelerationIncrementTextBoxAsFloat * 1000f;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "PresetCameraAccelRate1", (object)(dlg.PresetCameraAcceleration1TextBoxAsFloat * 1000f));
                    presetCameraAccel1 = dlg.PresetCameraAcceleration1TextBoxAsFloat * 1000f;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "PresetCameraAccelRate2", (object)(dlg.PresetCameraAcceleration2TextBoxAsFloat * 1000f));
                    presetCameraAccel2 = dlg.PresetCameraAcceleration2TextBoxAsFloat * 1000f;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "PresetCameraAccelRate3", (object)(dlg.PresetCameraAcceleration3TextBoxAsFloat * 1000f));
                    presetCameraAccel3 = dlg.PresetCameraAcceleration3TextBoxAsFloat * 1000f;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "PresetCameraAccelRate4", (object)(dlg.PresetCameraAcceleration4TextBoxAsFloat * 1000f));
                    presetCameraAccel4 = dlg.PresetCameraAcceleration4TextBoxAsFloat * 1000f;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "CameraTurnRate", (object)dlg.CameraTurnRateTextBoxAsFloat);
                    cameraTurnIncrement = dlg.CameraTurnRateTextBoxAsFloat;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "MouseWheelMultiplier", (object)dlg.MouseWheelMultiplierTextBoxAsFloat);
                    mouseWheelMultiplier = dlg.MouseWheelMultiplierTextBoxAsFloat;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "MWMPreset1", (object)dlg.Preset1MWMTextBoxAsFloat);
                    presetMWM1 = dlg.Preset1MWMTextBoxAsFloat;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "MWMPreset2", (object)dlg.Preset2MWMTextBoxAsFloat);
                    presetMWM2 = dlg.Preset2MWMTextBoxAsFloat;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "MWMPreset3", (object)dlg.Preset3MWMTextBoxAsFloat);
                    presetMWM3 = dlg.Preset3MWMTextBoxAsFloat;
                    Registry.SetValue(Config.WorldEditorBaseRegistryKey, "MWMPreset4", (object)dlg.Preset4MWMTextBoxAsFloat);
                    presetMWM4 = dlg.Preset4MWMTextBoxAsFloat;
                    setToolStripMWMDropDownMenu();
                    setToolStripAccelSpeedDropDownMenu();
                    List<string> newDirs = dlg.RepositoryDirectoryList;
                    if (RepositoryClass.Instance.DifferentDirectoryList(newDirs))
                    {
                        RepositoryClass.Instance.SetRepositoryDirectoriesInRegistry(newDirs);
                        MessageBox.Show("The Asset Repository has been successfully set.  The World Editor must shut down.", "Repository Set", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        EventArgs ea = new EventArgs();
                        exitToolStripMenuItem_Click(this, ea);
                    }
                }
            }
        }
        public bool ValidateAssetRepository(List<string> paths, Preferences_Dialog dlg)
        {
            List<string> validityLog = RepositoryClass.Instance.CheckForValidRepository(paths);

            if (validityLog.Count == 0)
            {
                // repository has been successfully set
                return true;
            }
            else
            {
                ErrorLogPopup(validityLog, "The directories you selected do not make up a valid repository.  The following errors were generated:\n\n", "Invalid Repository", MessageBoxButtons.OK);
                dlg.RepositoryDirectoryList = new List<string>(RepositoryClass.Instance.RepositoryDirectoryList);
                return false;
            }
        }