mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-08 01:05:01 +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).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
- Added a method for converting 24 hour to 12 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
|
||||
- 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
|
||||
### Added
|
||||
|
||||
@@ -204,16 +204,17 @@ namespace ICD.Common.Utils.Globalization
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_IsResident)
|
||||
return base.DateTimeFormat;
|
||||
|
||||
ThrowIfNeutralCulture(this);
|
||||
|
||||
if (m_DatetimeFormat == null)
|
||||
{
|
||||
if (m_IsResident)
|
||||
return base.DateTimeFormat;
|
||||
|
||||
ThrowIfNeutralCulture(this);
|
||||
|
||||
DateTimeFormatInfo dateTimeFormatInfo = GetDateTimeFormat(m_DatetimeFormatId);
|
||||
if (IsReadOnly)
|
||||
dateTimeFormatInfo = DateTimeFormatInfo.ReadOnly(dateTimeFormatInfo);
|
||||
|
||||
m_DatetimeFormat = dateTimeFormatInfo;
|
||||
}
|
||||
return m_DatetimeFormat;
|
||||
@@ -221,13 +222,13 @@ namespace ICD.Common.Utils.Globalization
|
||||
set
|
||||
{
|
||||
if (m_IsResident)
|
||||
{
|
||||
base.DateTimeFormat = value;
|
||||
return;
|
||||
}
|
||||
|
||||
ThrowIfReadOnly();
|
||||
|
||||
if (value == null)
|
||||
throw new ArgumentException("value");
|
||||
|
||||
m_DatetimeFormat = value;
|
||||
}
|
||||
}
|
||||
@@ -246,16 +247,17 @@ namespace ICD.Common.Utils.Globalization
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_IsResident)
|
||||
return base.NumberFormat;
|
||||
|
||||
ThrowIfNeutralCulture(this);
|
||||
|
||||
if (m_NumberFormat == null)
|
||||
{
|
||||
if (m_IsResident)
|
||||
return base.NumberFormat;
|
||||
|
||||
ThrowIfNeutralCulture(this);
|
||||
|
||||
NumberFormatInfo numberFormatInfo = GetNumberFormat(m_NumberFormatId);
|
||||
if (IsReadOnly)
|
||||
numberFormatInfo = NumberFormatInfo.ReadOnly(numberFormatInfo);
|
||||
|
||||
m_NumberFormat = numberFormatInfo;
|
||||
}
|
||||
return m_NumberFormat;
|
||||
@@ -263,13 +265,13 @@ namespace ICD.Common.Utils.Globalization
|
||||
set
|
||||
{
|
||||
if (m_IsResident)
|
||||
{
|
||||
base.NumberFormat = value;
|
||||
return;
|
||||
}
|
||||
|
||||
ThrowIfReadOnly();
|
||||
|
||||
if (value == null)
|
||||
throw new ArgumentException("value");
|
||||
|
||||
m_NumberFormat = value;
|
||||
}
|
||||
}
|
||||
@@ -851,24 +853,25 @@ namespace ICD.Common.Utils.Globalization
|
||||
try
|
||||
{
|
||||
m_CompareInfo = ci.CompareInfo;
|
||||
goto IL_CE;
|
||||
}
|
||||
catch (PlatformNotSupportedException)
|
||||
{
|
||||
m_CompareInfo = CultureInfo.InvariantCulture.CompareInfo;
|
||||
goto IL_CE;
|
||||
}
|
||||
}
|
||||
m_Calendar = icdCultureInfo.m_Calendar;
|
||||
m_CalendarType = icdCultureInfo.m_CalendarType;
|
||||
m_GregorianCalendarType = icdCultureInfo.m_GregorianCalendarType;
|
||||
m_OptionalCalendars = icdCultureInfo.m_OptionalCalendars;
|
||||
m_OptionalCalendarTypes = icdCultureInfo.m_OptionalCalendarTypes;
|
||||
m_OptionalGregorianCalendarTypes = icdCultureInfo.m_OptionalGregorianCalendarTypes;
|
||||
m_Parent = icdCultureInfo.m_Parent;
|
||||
m_TextInfo = icdCultureInfo.m_TextInfo;
|
||||
m_CompareInfo = icdCultureInfo.m_CompareInfo;
|
||||
IL_CE:
|
||||
else
|
||||
{
|
||||
m_Calendar = icdCultureInfo.m_Calendar;
|
||||
m_CalendarType = icdCultureInfo.m_CalendarType;
|
||||
m_GregorianCalendarType = icdCultureInfo.m_GregorianCalendarType;
|
||||
m_OptionalCalendars = icdCultureInfo.m_OptionalCalendars;
|
||||
m_OptionalCalendarTypes = icdCultureInfo.m_OptionalCalendarTypes;
|
||||
m_OptionalGregorianCalendarTypes = icdCultureInfo.m_OptionalGregorianCalendarTypes;
|
||||
m_Parent = icdCultureInfo.m_Parent;
|
||||
m_TextInfo = icdCultureInfo.m_TextInfo;
|
||||
m_CompareInfo = icdCultureInfo.m_CompareInfo;
|
||||
}
|
||||
|
||||
m_EnglishName = ci.EnglishName;
|
||||
m_IsNeutralCulture = ci.IsNeutralCulture;
|
||||
m_Lcid = ci.LCID;
|
||||
@@ -877,19 +880,21 @@ namespace ICD.Common.Utils.Globalization
|
||||
m_ThreeLetterIsoLanguageName = ci.ThreeLetterISOLanguageName;
|
||||
m_ThreeLetterWindowsLanguageName = ci.ThreeLetterWindowsLanguageName;
|
||||
m_TwoLetterIsoLanguageName = ci.TwoLetterISOLanguageName;
|
||||
if (!m_IsNeutralCulture)
|
||||
|
||||
if (m_IsNeutralCulture)
|
||||
return;
|
||||
|
||||
if (icdCultureInfo == null)
|
||||
{
|
||||
if (icdCultureInfo == null)
|
||||
{
|
||||
m_DatetimeFormat = ci.DateTimeFormat;
|
||||
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_DatetimeFormat = ci.DateTimeFormat.Clone() as DateTimeFormatInfo;
|
||||
m_NumberFormat = ci.NumberFormat.Clone() as NumberFormatInfo;
|
||||
return;
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user