private void CheckOptions(OptionsData optionsData) { if (!optionsData.IsValid()) { waitingForOptions = true; MessageBox.Show(Strings.Invalidvaluepresentinoptions, Strings.Error); optionsWindow.LoadOptions(OptionsData.CreateDefault()); optionsWindow.Show(); while (waitingForOptions) { try { Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate { })); } catch { } Thread.Sleep(50); } } UpdateButtonStatus(razorButton, false); UpdateButtonStatus(steamButton, false); if (optionsData.IsRazorValid()) { UpdateButtonStatus(razorButton, true); } if (optionsData.IsSteamValid()) { UpdateButtonStatus(steamButton, true); } }
private bool SaveOptions() { OptionsData od = new OptionsData(); ushort port; if (ushort.TryParse(textBoxPort.Text, out port)) { od.Port = port; } else { System.Windows.MessageBox.Show("Invalid value for port, please fix.", "Error"); textBoxPort.Text = ""; return(false); } od.Server = textBoxServer.Text; if ((bool)radioButtonNone.IsChecked) { od.CacheLevel = 0; } else if ((bool)radioButtonIndices.IsChecked) { od.CacheLevel = 1; } else if ((bool)radioButtonFull.IsChecked) { od.CacheLevel = 2; } od.PatchClientEncryption = (bool)checkBoxPatchClient.IsChecked; od.EncryptedServer = (bool)checkBoxEncryptedServer.IsChecked; od.PatchClientEncryptionUOM = (bool)checkBoxEncryption.IsChecked; od.PatchStaminaCheck = (bool)checkBoxStamina.IsChecked; od.PatchAlwaysLight = (bool)checkBoxLight.IsChecked; od.UOFolder = textBoxUO.Text; od.UOClientPath = textBoxClient.Text; od.RazorFolder = textBoxRazor.Text; od.UOSFolder = textBoxUOS.Text; od.TextEditorOptions.ConvertTabsToSpaces = (bool)checkBoxConvert.IsChecked; od.TextEditorOptions.CutCopyWholeLine = (bool)checkBoxCopy.IsChecked; od.TextEditorOptions.ShowBoxForControlCharacters = (bool)checkBoxControl.IsChecked; od.TextEditorOptions.ShowSpaces = (bool)checkBoxSpace.IsChecked; od.TextEditorOptions.ShowTabs = (bool)checkBoxTab.IsChecked; int tabSize; try { tabSize = Convert.ToInt32(textBoxSize.Text); } catch { tabSize = od.TextEditorOptions.IndentationSize; } od.TextEditorOptions.IndentationSize = tabSize; if (!od.IsValid()) { System.Windows.MessageBox.Show("Invalid options, please fix.", "Error"); return(false); } OnOptionsChanged(od); OptionsData.Serialize("options.xml", od); return(true); }
private void CheckOptions(OptionsData optionsData) { if (!optionsData.IsValid()) { waitingForOptions = true; MessageBox.Show("Invalid value(s) present in options.xml, please fix.", "Error"); optionsWindow.LoadOptions(OptionsData.CreateDefault()); optionsWindow.Show(); while (waitingForOptions) { try { Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate { })); } catch { } Thread.Sleep(50); } } }
private void OptionsWindow_OptionsChangedEvent(OptionsData optionsData) { if (waitingForOptions) { if (optionsData.IsValid()) { waitingForOptions = false; } else { MessageBox.Show("Invalid value(s) present in options.xml, please fix.", "Error"); optionsWindow.Show(); } } if (optionsData.CacheLevel != myCurrentOptions.CacheLevel) { Map.Initialize(optionsData.UOFolder, optionsData.CacheLevel); } myCurrentOptions = optionsData; scriptTextBox.Options = optionsData.TextEditorOptions; }
private void OptionsWindow_OptionsChangedEvent(OptionsData optionsData) { if (waitingForOptions) { if (optionsData.IsValid()) { waitingForOptions = false; } else { MessageBox.Show(Strings.Invalidvaluepresentinoptions, Strings.Error); optionsWindow.Show(); } } if (optionsData.CacheLevel != myCurrentOptions.CacheLevel) { Map.Initialize(optionsData.UOFolder, optionsData.CacheLevel); } myCurrentOptions = optionsData; CheckOptions(optionsData); scriptTextBox.Options = optionsData.TextEditorOptions; }
private void OptionsWindow_OptionsChangedEvent( OptionsData optionsData ) { if (waitingForOptions) { if (optionsData.IsValid()) { waitingForOptions = false; } else { MessageBox.Show( Strings.Invalidvaluepresentinoptions, Strings.Error ); optionsWindow.Show(); } } if (optionsData.CacheLevel != myCurrentOptions.CacheLevel) Map.Initialize( optionsData.UOFolder, optionsData.CacheLevel ); myCurrentOptions = optionsData; CheckOptions( optionsData ); scriptTextBox.Options = optionsData.TextEditorOptions; }
private void CheckOptions( OptionsData optionsData ) { if (!optionsData.IsValid()) { waitingForOptions = true; MessageBox.Show( Strings.Invalidvaluepresentinoptions, Strings.Error ); optionsWindow.LoadOptions( OptionsData.CreateDefault() ); optionsWindow.Show(); while (waitingForOptions) { try { Application.Current.Dispatcher.Invoke( DispatcherPriority.Background, new ThreadStart( delegate { } ) ); } catch { } Thread.Sleep( 50 ); } } UpdateButtonStatus( razorButton, false ); UpdateButtonStatus( steamButton, false ); if (optionsData.IsRazorValid()) { UpdateButtonStatus( razorButton, true ); } if (optionsData.IsSteamValid()) { UpdateButtonStatus( steamButton, true ); } }
private bool SaveOptions() { OptionsData od = new OptionsData(); ushort port; if (ushort.TryParse(textBoxPort.Text, out port)) od.Port = port; else { System.Windows.MessageBox.Show( Strings.Invalidvalueforport, Strings.Error ); textBoxPort.Text = ""; return false; } od.Server = textBoxServer.Text; if ((bool)radioButtonNone.IsChecked) od.CacheLevel = 0; else if ((bool)radioButtonIndices.IsChecked) od.CacheLevel = 1; else if ((bool)radioButtonFull.IsChecked) od.CacheLevel = 2; od.PatchClientEncryption = (bool)checkBoxPatchClient.IsChecked; od.EncryptedServer = (bool)checkBoxEncryptedServer.IsChecked; od.PatchClientEncryptionUOM = (bool)checkBoxEncryption.IsChecked; od.PatchStaminaCheck = (bool)checkBoxStamina.IsChecked; od.PatchAlwaysLight = (bool)checkBoxLight.IsChecked; od.PatchGameSize = (bool)checkBoxGameSize.IsChecked; od.PatchGameSizeWidth = int.Parse(gameWidth.Text); od.PatchGameSizeHeight = int.Parse(gameHeight.Text); if (od.PatchGameSizeWidth < 800) od.PatchGameSizeWidth = 800; if (od.PatchGameSizeHeight < 600) od.PatchGameSizeHeight = 600; od.UOFolder = textBoxUO.Text; od.UOClientPath = textBoxClient.Text; od.RazorFolder = textBoxRazor.Text; od.UOSFolder = textBoxUOS.Text; od.UOSExePath = textBoxUOSExe.Text; od.TextEditorOptions.ConvertTabsToSpaces = (bool)checkBoxConvert.IsChecked; od.TextEditorOptions.CutCopyWholeLine = (bool)checkBoxCopy.IsChecked; od.TextEditorOptions.ShowBoxForControlCharacters = (bool)checkBoxControl.IsChecked; od.TextEditorOptions.ShowSpaces = (bool)checkBoxSpace.IsChecked; od.TextEditorOptions.ShowTabs = (bool)checkBoxTab.IsChecked; int tabSize; try { tabSize = Convert.ToInt32(textBoxSize.Text); } catch { tabSize = od.TextEditorOptions.IndentationSize; } od.TextEditorOptions.IndentationSize = tabSize; if (!od.IsValid()) { System.Windows.MessageBox.Show( Strings.Invalidvaluepresentinoptions, Strings.Error ); return false; } OnOptionsChanged(od); OptionsData.Serialize("options.xml", od); return true; }