mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-15 20:54:58 +00:00
fix: Fixed a bug where CultureInfo was not being cloned correctly
This commit is contained in:
@@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|||||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- Added a method for converting 24 hour to 12 hour format
|
- Added a method for converting 24 hour to 12 hour format
|
||||||
- Added a method for determining if a culture uses 24 hour format
|
- Added a method for determining if a culture uses 24 hour format
|
||||||
@@ -13,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- The Root Config path in Net Standard will now be the ICD.Connect folder in the current environments ProgramData directory
|
- The Root Config path in Net Standard will now be the ICD.Connect folder in the current environments ProgramData directory
|
||||||
|
- Fixed a bug where CultureInfo was not being cloned correctly
|
||||||
|
|
||||||
## [9.8.0] - 2019-09-03
|
## [9.8.0] - 2019-09-03
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -204,16 +204,17 @@ namespace ICD.Common.Utils.Globalization
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (m_IsResident)
|
|
||||||
return base.DateTimeFormat;
|
|
||||||
|
|
||||||
ThrowIfNeutralCulture(this);
|
|
||||||
|
|
||||||
if (m_DatetimeFormat == null)
|
if (m_DatetimeFormat == null)
|
||||||
{
|
{
|
||||||
|
if (m_IsResident)
|
||||||
|
return base.DateTimeFormat;
|
||||||
|
|
||||||
|
ThrowIfNeutralCulture(this);
|
||||||
|
|
||||||
DateTimeFormatInfo dateTimeFormatInfo = GetDateTimeFormat(m_DatetimeFormatId);
|
DateTimeFormatInfo dateTimeFormatInfo = GetDateTimeFormat(m_DatetimeFormatId);
|
||||||
if (IsReadOnly)
|
if (IsReadOnly)
|
||||||
dateTimeFormatInfo = DateTimeFormatInfo.ReadOnly(dateTimeFormatInfo);
|
dateTimeFormatInfo = DateTimeFormatInfo.ReadOnly(dateTimeFormatInfo);
|
||||||
|
|
||||||
m_DatetimeFormat = dateTimeFormatInfo;
|
m_DatetimeFormat = dateTimeFormatInfo;
|
||||||
}
|
}
|
||||||
return m_DatetimeFormat;
|
return m_DatetimeFormat;
|
||||||
@@ -221,13 +222,13 @@ namespace ICD.Common.Utils.Globalization
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (m_IsResident)
|
if (m_IsResident)
|
||||||
{
|
|
||||||
base.DateTimeFormat = value;
|
base.DateTimeFormat = value;
|
||||||
return;
|
|
||||||
}
|
|
||||||
ThrowIfReadOnly();
|
ThrowIfReadOnly();
|
||||||
|
|
||||||
if (value == null)
|
if (value == null)
|
||||||
throw new ArgumentException("value");
|
throw new ArgumentException("value");
|
||||||
|
|
||||||
m_DatetimeFormat = value;
|
m_DatetimeFormat = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -246,16 +247,17 @@ namespace ICD.Common.Utils.Globalization
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (m_IsResident)
|
|
||||||
return base.NumberFormat;
|
|
||||||
|
|
||||||
ThrowIfNeutralCulture(this);
|
|
||||||
|
|
||||||
if (m_NumberFormat == null)
|
if (m_NumberFormat == null)
|
||||||
{
|
{
|
||||||
|
if (m_IsResident)
|
||||||
|
return base.NumberFormat;
|
||||||
|
|
||||||
|
ThrowIfNeutralCulture(this);
|
||||||
|
|
||||||
NumberFormatInfo numberFormatInfo = GetNumberFormat(m_NumberFormatId);
|
NumberFormatInfo numberFormatInfo = GetNumberFormat(m_NumberFormatId);
|
||||||
if (IsReadOnly)
|
if (IsReadOnly)
|
||||||
numberFormatInfo = NumberFormatInfo.ReadOnly(numberFormatInfo);
|
numberFormatInfo = NumberFormatInfo.ReadOnly(numberFormatInfo);
|
||||||
|
|
||||||
m_NumberFormat = numberFormatInfo;
|
m_NumberFormat = numberFormatInfo;
|
||||||
}
|
}
|
||||||
return m_NumberFormat;
|
return m_NumberFormat;
|
||||||
@@ -263,13 +265,13 @@ namespace ICD.Common.Utils.Globalization
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (m_IsResident)
|
if (m_IsResident)
|
||||||
{
|
|
||||||
base.NumberFormat = value;
|
base.NumberFormat = value;
|
||||||
return;
|
|
||||||
}
|
|
||||||
ThrowIfReadOnly();
|
ThrowIfReadOnly();
|
||||||
|
|
||||||
if (value == null)
|
if (value == null)
|
||||||
throw new ArgumentException("value");
|
throw new ArgumentException("value");
|
||||||
|
|
||||||
m_NumberFormat = value;
|
m_NumberFormat = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -851,24 +853,25 @@ namespace ICD.Common.Utils.Globalization
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_CompareInfo = ci.CompareInfo;
|
m_CompareInfo = ci.CompareInfo;
|
||||||
goto IL_CE;
|
|
||||||
}
|
}
|
||||||
catch (PlatformNotSupportedException)
|
catch (PlatformNotSupportedException)
|
||||||
{
|
{
|
||||||
m_CompareInfo = CultureInfo.InvariantCulture.CompareInfo;
|
m_CompareInfo = CultureInfo.InvariantCulture.CompareInfo;
|
||||||
goto IL_CE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_Calendar = icdCultureInfo.m_Calendar;
|
else
|
||||||
m_CalendarType = icdCultureInfo.m_CalendarType;
|
{
|
||||||
m_GregorianCalendarType = icdCultureInfo.m_GregorianCalendarType;
|
m_Calendar = icdCultureInfo.m_Calendar;
|
||||||
m_OptionalCalendars = icdCultureInfo.m_OptionalCalendars;
|
m_CalendarType = icdCultureInfo.m_CalendarType;
|
||||||
m_OptionalCalendarTypes = icdCultureInfo.m_OptionalCalendarTypes;
|
m_GregorianCalendarType = icdCultureInfo.m_GregorianCalendarType;
|
||||||
m_OptionalGregorianCalendarTypes = icdCultureInfo.m_OptionalGregorianCalendarTypes;
|
m_OptionalCalendars = icdCultureInfo.m_OptionalCalendars;
|
||||||
m_Parent = icdCultureInfo.m_Parent;
|
m_OptionalCalendarTypes = icdCultureInfo.m_OptionalCalendarTypes;
|
||||||
m_TextInfo = icdCultureInfo.m_TextInfo;
|
m_OptionalGregorianCalendarTypes = icdCultureInfo.m_OptionalGregorianCalendarTypes;
|
||||||
m_CompareInfo = icdCultureInfo.m_CompareInfo;
|
m_Parent = icdCultureInfo.m_Parent;
|
||||||
IL_CE:
|
m_TextInfo = icdCultureInfo.m_TextInfo;
|
||||||
|
m_CompareInfo = icdCultureInfo.m_CompareInfo;
|
||||||
|
}
|
||||||
|
|
||||||
m_EnglishName = ci.EnglishName;
|
m_EnglishName = ci.EnglishName;
|
||||||
m_IsNeutralCulture = ci.IsNeutralCulture;
|
m_IsNeutralCulture = ci.IsNeutralCulture;
|
||||||
m_Lcid = ci.LCID;
|
m_Lcid = ci.LCID;
|
||||||
@@ -877,19 +880,21 @@ namespace ICD.Common.Utils.Globalization
|
|||||||
m_ThreeLetterIsoLanguageName = ci.ThreeLetterISOLanguageName;
|
m_ThreeLetterIsoLanguageName = ci.ThreeLetterISOLanguageName;
|
||||||
m_ThreeLetterWindowsLanguageName = ci.ThreeLetterWindowsLanguageName;
|
m_ThreeLetterWindowsLanguageName = ci.ThreeLetterWindowsLanguageName;
|
||||||
m_TwoLetterIsoLanguageName = ci.TwoLetterISOLanguageName;
|
m_TwoLetterIsoLanguageName = ci.TwoLetterISOLanguageName;
|
||||||
if (!m_IsNeutralCulture)
|
|
||||||
|
if (m_IsNeutralCulture)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (icdCultureInfo == null)
|
||||||
{
|
{
|
||||||
if (icdCultureInfo == null)
|
m_DatetimeFormat = ci.DateTimeFormat.Clone() as DateTimeFormatInfo;
|
||||||
{
|
m_NumberFormat = ci.NumberFormat.Clone() as NumberFormatInfo;
|
||||||
m_DatetimeFormat = ci.DateTimeFormat;
|
return;
|
||||||
m_NumberFormat = ci.NumberFormat;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
m_DatetimeFormatId = icdCultureInfo.m_DatetimeFormatId;
|
|
||||||
m_DatetimeFormat = icdCultureInfo.m_DatetimeFormat;
|
|
||||||
m_NumberFormatId = icdCultureInfo.m_NumberFormatId;
|
|
||||||
m_NumberFormat = icdCultureInfo.m_NumberFormat;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_DatetimeFormatId = icdCultureInfo.m_DatetimeFormatId;
|
||||||
|
m_DatetimeFormat = icdCultureInfo.m_DatetimeFormat.Clone() as DateTimeFormatInfo;
|
||||||
|
m_NumberFormatId = icdCultureInfo.m_NumberFormatId;
|
||||||
|
m_NumberFormat = icdCultureInfo.m_NumberFormat.Clone() as NumberFormatInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
|
|||||||
Reference in New Issue
Block a user