removed broken signed numeric parser

This commit is contained in:
uberhalit 2019-04-11 02:53:11 +02:00
parent fc06f8530e
commit e33a1f97f2
2 changed files with 7 additions and 32 deletions

View file

@ -23,7 +23,7 @@
<DockPanel Margin="0,5,0,0" LastChildFill="False">
<CheckBox x:Name="cbFov" DockPanel.Dock="Left" Margin="0,0,0,0" Height="25" FontSize="14 px" VerticalContentAlignment="Center" Content="Change FOV by (%):" Checked="CbFov_Check_Handler" Unchecked="CbFov_Check_Handler" />
<Button x:Name="bFovHigher" DockPanel.Dock="Right" Content="&gt;" Margin="0,0,0,0" Width="25" Height="25" FontSize="14 px" BorderThickness="1" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Focusable="False" Click="BFovHigher_Click" />
<TextBox x:Name="tbFov" DockPanel.Dock="Right" Margin="0,0,3,0" Width="30" Height="25" FontSize="14 px" VerticalContentAlignment="Center" Text="25" TextAlignment="Center" MaxLength="3" PreviewTextInput="SignedNumeric_PreviewTextInput" DataObject.Pasting="SignedNumeric_PastingHandler" />
<TextBox x:Name="tbFov" DockPanel.Dock="Right" Margin="0,0,3,0" Width="30" Height="25" FontSize="14 px" VerticalContentAlignment="Center" Text="25" TextAlignment="Center" MaxLength="3" PreviewTextInput="Numeric_PreviewTextInput" DataObject.Pasting="Numeric_PastingHandler" />
<Button x:Name="bFovLower" DockPanel.Dock="Right" Content="&lt;" Margin="0,0,3,0" Width="25" Height="25" FontSize="14 px" BorderThickness="1" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Focusable="False" Click="BFovLower_Click" />
<Button x:Name="bFov0" DockPanel.Dock="Right" Content="0" Margin="0,0,3,0" Width="27" Height="25" FontSize="14 px" BorderThickness="1" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Focusable="False" Click="BFov0_Click" />
</DockPanel>

View file

@ -180,21 +180,21 @@ namespace SekiroFpsUnlockAndMore
private void SaveConfiguration()
{
_settingsService.ApplicationSettings.cbFramelock = this.cbFramelock.IsChecked == true;
_settingsService.ApplicationSettings.tbFramelock = Convert.ToInt32(this.tbFramelock.Text);
_settingsService.ApplicationSettings.tbFramelock = this.tbFramelock.Text != "" && !this.tbFramelock.Text.Contains(" ") ? Convert.ToInt32(this.tbFramelock.Text) : 144;
_settingsService.ApplicationSettings.cbAddResolution = this.cbAddResolution.IsChecked == true;
_settingsService.ApplicationSettings.tbWidth = Convert.ToInt32(this.tbWidth.Text);
_settingsService.ApplicationSettings.tbHeight = Convert.ToInt32(this.tbHeight.Text);
_settingsService.ApplicationSettings.tbWidth = this.tbWidth.Text != "" && !this.tbWidth.Text.Contains(" ") ? Convert.ToInt32(this.tbWidth.Text) : 2560;
_settingsService.ApplicationSettings.tbHeight = this.tbHeight.Text != "" && !this.tbHeight.Text.Contains(" ") ? Convert.ToInt32(this.tbHeight.Text) : 1080;
_settingsService.ApplicationSettings.cbFov = this.cbFov.IsChecked == true;
_settingsService.ApplicationSettings.tbFov = Convert.ToInt32(this.tbFov.Text);
_settingsService.ApplicationSettings.tbFov = this.tbFov.Text != "" && !this.tbFov.Text.Contains(" ") ? Convert.ToInt32(this.tbFov.Text) : 25;
_settingsService.ApplicationSettings.cbBorderless = this.cbBorderless.IsChecked == true;
_settingsService.ApplicationSettings.cbBorderlessStretch = this.cbBorderlessStretch.IsChecked == true;
_settingsService.ApplicationSettings.cbCamAdjust = this.cbCamAdjust.IsChecked == true;
_settingsService.ApplicationSettings.cbLogStats = this.cbLogStats.IsChecked == true;
_settingsService.ApplicationSettings.exGameMods = this.exGameMods.IsExpanded;
_settingsService.ApplicationSettings.cbGameSpeed = this.cbGameSpeed.IsChecked == true;
_settingsService.ApplicationSettings.tbGameSpeed = Convert.ToInt32(this.tbGameSpeed.Text);
_settingsService.ApplicationSettings.tbGameSpeed = this.tbGameSpeed.Text != "" && !this.tbGameSpeed.Text.Contains(" ") ? Convert.ToInt32(this.tbGameSpeed.Text) : 100;
_settingsService.ApplicationSettings.cbPlayerSpeed = this.cbPlayerSpeed.IsChecked == true;
_settingsService.ApplicationSettings.tbPlayerSpeed = Convert.ToInt32(this.tbPlayerSpeed.Text);
_settingsService.ApplicationSettings.tbPlayerSpeed = this.tbPlayerSpeed.Text != "" && !this.tbPlayerSpeed.Text.Contains(" ") ? Convert.ToInt32(this.tbPlayerSpeed.Text) : 100;
_settingsService.Save();
}
@ -1146,16 +1146,6 @@ namespace SekiroFpsUnlockAndMore
return Regex.IsMatch(text, "[^0-9]+");
}
/// <summary>
/// Check whether input is (signed) numeric only.
/// </summary>
/// <param name="text">The text to check.</param>
/// <returns>True if input is (signed) numeric only.</returns>
private static bool IsSignedNumericInput(string text)
{
return Regex.IsMatch(text, "[-+]?[0-9]+");
}
/// <summary>
/// Logs messages to log file.
/// </summary>
@ -1218,21 +1208,6 @@ namespace SekiroFpsUnlockAndMore
else e.CancelCommand();
}
private void SignedNumeric_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
e.Handled = IsSignedNumericInput(e.Text);
}
private void SignedNumeric_PastingHandler(object sender, DataObjectPastingEventArgs e)
{
if (e.DataObject.GetDataPresent(typeof(string)))
{
string text = (string)e.DataObject.GetData(typeof(string));
if (IsSignedNumericInput(text)) e.CancelCommand();
}
else e.CancelCommand();
}
private void CbFramelock_Check_Handler(object sender, RoutedEventArgs e)
{
PatchFramelock();