diff --git a/EngineLayer/SpectralLibrarySearch/SpectralLibrary.cs b/EngineLayer/SpectralLibrarySearch/SpectralLibrary.cs index 725fcf024..f2d7d61e5 100644 --- a/EngineLayer/SpectralLibrarySearch/SpectralLibrary.cs +++ b/EngineLayer/SpectralLibrarySearch/SpectralLibrary.cs @@ -204,7 +204,7 @@ private LibrarySpectrum ReadLibrarySpectrum(StreamReader reader, bool onlyReadHe int indOfParent = Array.IndexOf(split, "Parent"); if (indOfParent > 0) { - precursorMz = double.Parse(split[indOfParent + 1]); + precursorMz = double.Parse(split[indOfParent + 1], CultureInfo.InvariantCulture); } } @@ -212,7 +212,7 @@ private LibrarySpectrum ReadLibrarySpectrum(StreamReader reader, bool onlyReadHe int indOfRt = Array.IndexOf(split, "iRT"); if (indOfRt > 0) { - rt = double.Parse(split[indOfRt + 1]); + rt = double.Parse(split[indOfRt + 1], CultureInfo.InvariantCulture); } else { @@ -220,7 +220,7 @@ private LibrarySpectrum ReadLibrarySpectrum(StreamReader reader, bool onlyReadHe if (indOfRt > 0) { - rt = double.Parse(split[indOfRt + 1]); + rt = double.Parse(split[indOfRt + 1], CultureInfo.InvariantCulture); } } diff --git a/GUI/MetaDraw/MetaDrawSettingsWindow.xaml.cs b/GUI/MetaDraw/MetaDrawSettingsWindow.xaml.cs index 3a4e42720..ea633181d 100644 --- a/GUI/MetaDraw/MetaDrawSettingsWindow.xaml.cs +++ b/GUI/MetaDraw/MetaDrawSettingsWindow.xaml.cs @@ -2,6 +2,7 @@ using EngineLayer.GlycoSearch; using GuiFunctions; using System.ComponentModel; +using System.Globalization; using System.Windows; namespace MetaMorpheusGUI @@ -55,7 +56,7 @@ private void Save_Click(object sender, RoutedEventArgs e) if (!string.IsNullOrWhiteSpace(qValueBox.Text)) { - if (double.TryParse(qValueBox.Text, out double qValueFilter) && qValueFilter >= 0 && qValueFilter <= 1) + if (double.TryParse(qValueBox.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out double qValueFilter) && qValueFilter >= 0 && qValueFilter <= 1) { MetaDrawSettings.QValueFilter = qValueFilter; } diff --git a/GUI/TaskWindows/GPTMDTaskWindow.xaml.cs b/GUI/TaskWindows/GPTMDTaskWindow.xaml.cs index 94a92b9c3..500d361d8 100644 --- a/GUI/TaskWindows/GPTMDTaskWindow.xaml.cs +++ b/GUI/TaskWindows/GPTMDTaskWindow.xaml.cs @@ -421,7 +421,7 @@ private void SaveButton_Click(object sender, RoutedEventArgs e) double? minimumAllowedIntensityRatioToBasePeak = null; if (!string.IsNullOrWhiteSpace(MinimumAllowedIntensityRatioToBasePeakTexBox.Text)) { - if (double.TryParse(MinimumAllowedIntensityRatioToBasePeakTexBox.Text, out double minimumAllowedIntensityRatio)) + if (double.TryParse(MinimumAllowedIntensityRatioToBasePeakTexBox.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out double minimumAllowedIntensityRatio)) { minimumAllowedIntensityRatioToBasePeak = minimumAllowedIntensityRatio; } diff --git a/GUI/TaskWindows/SearchTaskWindow.xaml.cs b/GUI/TaskWindows/SearchTaskWindow.xaml.cs index 86683d087..0d038676e 100644 --- a/GUI/TaskWindows/SearchTaskWindow.xaml.cs +++ b/GUI/TaskWindows/SearchTaskWindow.xaml.cs @@ -495,13 +495,13 @@ private void SaveButton_Click(object sender, RoutedEventArgs e) } double? minimumAllowedIntensityRatioToBasePeak = null; - if (double.TryParse(MinimumAllowedIntensityRatioToBasePeakTexBox.Text, out double minimumAllowedIntensityRatio)) + if (double.TryParse(MinimumAllowedIntensityRatioToBasePeakTexBox.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out double minimumAllowedIntensityRatio)) { minimumAllowedIntensityRatioToBasePeak = minimumAllowedIntensityRatio; } double? windowWidthThompsons = null; - if (double.TryParse(WindowWidthThomsonsTextBox.Text, out double windowWidth)) + if (double.TryParse(WindowWidthThomsonsTextBox.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out double windowWidth)) { windowWidthThompsons = windowWidth; } diff --git a/GUI/Util/GlobalGuiSettings.cs b/GUI/Util/GlobalGuiSettings.cs index 834b40cfe..51c5a283d 100644 --- a/GUI/Util/GlobalGuiSettings.cs +++ b/GUI/Util/GlobalGuiSettings.cs @@ -277,7 +277,7 @@ public static bool CheckPeakFindingTolerance(string text) public static bool CheckHistogramBinWidth(string text) { - if (!float.TryParse(text, out float binWidth) || binWidth < 0 || binWidth > 1) + if (!double.TryParse(text, NumberStyles.Any, CultureInfo.InvariantCulture, out double binWidth) || binWidth < 0 || binWidth > 1) { MessageBox.Show("The histogram bin width must be between zero and one Daltons. \n You entered " + '"' + text + '"'); return false; diff --git a/GuiFunctions/MetaDraw/PeptideSpectrumMatchPlot.cs b/GuiFunctions/MetaDraw/PeptideSpectrumMatchPlot.cs index 428be9d11..da773bbaa 100644 --- a/GuiFunctions/MetaDraw/PeptideSpectrumMatchPlot.cs +++ b/GuiFunctions/MetaDraw/PeptideSpectrumMatchPlot.cs @@ -394,7 +394,7 @@ protected void AnnotateProperties() text.Append("\r\n"); text.Append("Theoretical Mass: "); - text.Append(double.TryParse(SpectrumMatch.PeptideMonoMass, out var monoMass) ? monoMass.ToString("F3") : SpectrumMatch.PeptideMonoMass); + text.Append(double.TryParse(SpectrumMatch.PeptideMonoMass, NumberStyles.Any, CultureInfo.InvariantCulture, out var monoMass) ? monoMass.ToString("F3") : SpectrumMatch.PeptideMonoMass); text.Append("\r\n"); text.Append("Score: ");