diff --git a/DS4Windows/DS4Control/DTOXml/AppSettingsDTO.cs b/DS4Windows/DS4Control/DTOXml/AppSettingsDTO.cs index bdc292c..0082d13 100644 --- a/DS4Windows/DS4Control/DTOXml/AppSettingsDTO.cs +++ b/DS4Windows/DS4Control/DTOXml/AppSettingsDTO.cs @@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License using System.Collections.Generic; using System.ComponentModel.Design; using System.Diagnostics; +using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -249,10 +250,10 @@ public DateTime LastChecked [XmlElement("LastChecked")] public string LastCheckString { - get => LastChecked.ToString("MM/dd/yyyy HH:mm:ss"); + get => LastChecked.ToString("MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture); set { - if (DateTime.TryParse(value, out DateTime temp)) + if (DateTime.TryParse(value, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime temp)) { LastChecked = temp; } diff --git a/DS4WindowsTests/AppSettingsTests.cs b/DS4WindowsTests/AppSettingsTests.cs index 293ef04..c951cfd 100644 --- a/DS4WindowsTests/AppSettingsTests.cs +++ b/DS4WindowsTests/AppSettingsTests.cs @@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License using System.Configuration; using System; +using System.Globalization; using System.Text; using System.Xml; using System.Xml.Serialization; @@ -132,7 +133,7 @@ public void CheckSettingsRead() dto.MapTo(tempStore); // Check settings - DateTime.TryParse(dto.LastCheckString, out DateTime tempLastChecked); + DateTime.TryParse(dto.LastCheckString, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime tempLastChecked); Assert.AreEqual(tempLastChecked, tempStore.lastChecked); }