diff options
Diffstat (limited to 'src/mscorlib/corefx/System/Globalization')
37 files changed, 131 insertions, 211 deletions
diff --git a/src/mscorlib/corefx/System/Globalization/Calendar.cs b/src/mscorlib/corefx/System/Globalization/Calendar.cs index 78e9f00d08..0ff5040c74 100644 --- a/src/mscorlib/corefx/System/Globalization/Calendar.cs +++ b/src/mscorlib/corefx/System/Globalization/Calendar.cs @@ -29,7 +29,6 @@ namespace System.Globalization // since most of the calendars (or all?) have the same way of calcuating hour/minute/second. [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] public abstract partial class Calendar : ICloneable { // Number of 100ns (10E-7 second) ticks per time unit @@ -77,7 +76,6 @@ namespace System.Globalization // The minimum supported DateTime range for the calendar. - [System.Runtime.InteropServices.ComVisible(false)] public virtual DateTime MinSupportedDateTime { get @@ -88,7 +86,6 @@ namespace System.Globalization // The maximum supported DateTime range for the calendar. - [System.Runtime.InteropServices.ComVisible(false)] public virtual DateTime MaxSupportedDateTime { get @@ -97,7 +94,6 @@ namespace System.Globalization } } - [System.Runtime.InteropServices.ComVisible(false)] public virtual CalendarAlgorithmType AlgorithmType { get @@ -138,7 +134,6 @@ namespace System.Globalization // Detect if the object is readonly. // //////////////////////////////////////////////////////////////////////// - [System.Runtime.InteropServices.ComVisible(false)] public bool IsReadOnly { get { return (_isReadOnly); } @@ -151,7 +146,6 @@ namespace System.Globalization // Is the implementation of ICloneable. // //////////////////////////////////////////////////////////////////////// - [System.Runtime.InteropServices.ComVisible(false)] public virtual object Clone() { object o = MemberwiseClone(); @@ -167,7 +161,6 @@ namespace System.Globalization // readonly. // //////////////////////////////////////////////////////////////////////// - [System.Runtime.InteropServices.ComVisible(false)] public static Calendar ReadOnly(Calendar calendar) { if (calendar == null) { throw new ArgumentNullException(nameof(calendar)); } @@ -708,7 +701,6 @@ namespace System.Globalization // if this calendar does not have leap month, or this year is not a leap year. // - [System.Runtime.InteropServices.ComVisible(false)] public virtual int GetLeapMonth(int year) { return (GetLeapMonth(year, CurrentEra)); @@ -718,7 +710,6 @@ namespace System.Globalization // if this calendar does not have leap month, or this year is not a leap year. // - [System.Runtime.InteropServices.ComVisible(false)] public virtual int GetLeapMonth(int year, int era) { if (!IsLeapYear(year, era)) diff --git a/src/mscorlib/corefx/System/Globalization/CalendarData.Unix.cs b/src/mscorlib/corefx/System/Globalization/CalendarData.Unix.cs index 270d62f143..19c81f17b0 100644 --- a/src/mscorlib/corefx/System/Globalization/CalendarData.Unix.cs +++ b/src/mscorlib/corefx/System/Globalization/CalendarData.Unix.cs @@ -64,7 +64,6 @@ namespace System.Globalization } // Call native side to figure out which calendars are allowed - [SecuritySafeCritical] internal static int GetCalendars(string localeName, bool useUserOverride, CalendarId[] calendars) { // NOTE: there are no 'user overrides' on Linux @@ -87,7 +86,6 @@ namespace System.Globalization // PAL Layer ends here - [SecuritySafeCritical] private static bool GetCalendarInfo(string localeName, CalendarId calendarId, CalendarDataType dataType, out string calendarString) { return Interop.CallStringMethod( @@ -239,7 +237,6 @@ namespace System.Globalization return index - startIndex; } - [SecuritySafeCritical] private static bool EnumMonthNames(string localeName, CalendarId calendarId, CalendarDataType dataType, out string[] monthNames) { monthNames = null; @@ -261,7 +258,6 @@ namespace System.Globalization return result; } - [SecuritySafeCritical] private static bool EnumEraNames(string localeName, CalendarId calendarId, CalendarDataType dataType, out string[] eraNames) { bool result = EnumCalendarInfo(localeName, calendarId, dataType, out eraNames); @@ -277,7 +273,6 @@ namespace System.Globalization return result; } - [SecuritySafeCritical] internal static bool EnumCalendarInfo(string localeName, CalendarId calendarId, CalendarDataType dataType, out string[] calendarData) { calendarData = null; @@ -292,7 +287,6 @@ namespace System.Globalization return result; } - [SecuritySafeCritical] private static bool EnumCalendarInfo(string localeName, CalendarId calendarId, CalendarDataType dataType, CallbackContext callbackContext) { GCHandle context = GCHandle.Alloc(callbackContext); @@ -306,7 +300,6 @@ namespace System.Globalization } } - [SecuritySafeCritical] private static void EnumCalendarInfoCallback(string calendarString, IntPtr context) { CallbackContext callbackContext = (CallbackContext)((GCHandle)context).Target; diff --git a/src/mscorlib/corefx/System/Globalization/CalendarWeekRule.cs b/src/mscorlib/corefx/System/Globalization/CalendarWeekRule.cs index 490951e1f0..4013ce7237 100644 --- a/src/mscorlib/corefx/System/Globalization/CalendarWeekRule.cs +++ b/src/mscorlib/corefx/System/Globalization/CalendarWeekRule.cs @@ -7,7 +7,6 @@ using System; namespace System.Globalization { [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] public enum CalendarWeekRule { FirstDay = 0, // Week 1 begins on the first day of the year diff --git a/src/mscorlib/corefx/System/Globalization/CalendricalCalculationsHelper.cs b/src/mscorlib/corefx/System/Globalization/CalendricalCalculationsHelper.cs index 149e63c689..7de75d6aee 100644 --- a/src/mscorlib/corefx/System/Globalization/CalendricalCalculationsHelper.cs +++ b/src/mscorlib/corefx/System/Globalization/CalendricalCalculationsHelper.cs @@ -22,8 +22,8 @@ namespace System.Globalization private const int SecondsPerMinute = 60; private const int MinutesPerDegree = 60; - private static readonly long StartOf1810 = GetNumberOfDays(new DateTime(1810, 1, 1)); - private static readonly long StartOf1900Century = GetNumberOfDays(new DateTime(1900, 1, 1)); + private static readonly long s_startOf1810 = GetNumberOfDays(new DateTime(1810, 1, 1)); + private static readonly long s_startOf1900Century = GetNumberOfDays(new DateTime(1900, 1, 1)); private static readonly double[] s_coefficients1900to1987 = new double[] { -0.00002, 0.000297, 0.025184, -0.181133, 0.553040, -0.861938, 0.677066, -0.212591 }; private static readonly double[] s_coefficients1800to1899 = new double[] { -0.000009, 0.003844, 0.083563, 0.865736, 4.867575, 15.845535, 31.332267, 38.291999, 28.316289, 11.636204, 2.043794 }; @@ -146,7 +146,7 @@ namespace System.Globalization private static double CenturiesFrom1900(int gregorianYear) { long july1stOfYear = GetNumberOfDays(new DateTime(gregorianYear, 7, 1)); - return (double)(july1stOfYear - StartOf1900Century) / DaysInUniformLengthCentury; + return (double)(july1stOfYear - s_startOf1900Century) / DaysInUniformLengthCentury; } // the following formulas defines a polynomial function which gives us the amount that the earth is slowing down for specific year ranges @@ -154,7 +154,7 @@ namespace System.Globalization { Debug.Assert(gregorianYear < 1620 || 2020 <= gregorianYear); long january1stOfYear = GetNumberOfDays(new DateTime(gregorianYear, 1, 1)); - double daysSinceStartOf1810 = january1stOfYear - StartOf1810; + double daysSinceStartOf1810 = january1stOfYear - s_startOf1810; double x = TwelveHours + daysSinceStartOf1810; return ((Math.Pow(x, 2) / 41048480) - 15) / SecondsPerDay; } diff --git a/src/mscorlib/corefx/System/Globalization/CharUnicodeInfo.cs b/src/mscorlib/corefx/System/Globalization/CharUnicodeInfo.cs index dc38ca405b..38ce441a78 100644 --- a/src/mscorlib/corefx/System/Globalization/CharUnicodeInfo.cs +++ b/src/mscorlib/corefx/System/Globalization/CharUnicodeInfo.cs @@ -194,7 +194,7 @@ namespace System.Globalization // Get the level 2 WORD offset from the 4 - 7 bit of ch. This provides the base offset of the level 3 table. // Note that & has the lower precedence than addition, so don't forget the parathesis. index = s_pNumericLevel1Index[index + ((ch >> 4) & 0x000f)]; - + fixed (ushort* pUshortPtr = &(s_pNumericLevel1Index[index])) { byte* pBytePtr = (byte*)pUshortPtr; @@ -238,46 +238,46 @@ namespace System.Globalization return (InternalGetNumericValue(InternalConvertToUtf32(s, index))); } - public static int GetDecimalDigitValue(char ch) + public static int GetDecimalDigitValue(char ch) { - return (sbyte) (InternalGetDigitValues(ch) >> 8); + return (sbyte)(InternalGetDigitValues(ch) >> 8); } - public static int GetDecimalDigitValue(String s, int index) + public static int GetDecimalDigitValue(String s, int index) { - if (s == null) + if (s == null) { throw new ArgumentNullException(nameof(s)); } - - if (index < 0 || index >= s.Length) + + if (index < 0 || index >= s.Length) { throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_Index); } Contract.EndContractBlock(); - return (sbyte) (InternalGetDigitValues(InternalConvertToUtf32(s, index)) >> 8); + return (sbyte)(InternalGetDigitValues(InternalConvertToUtf32(s, index)) >> 8); } - + public static int GetDigitValue(char ch) { - return (sbyte) (InternalGetDigitValues(ch) & 0x00FF); + return (sbyte)(InternalGetDigitValues(ch) & 0x00FF); } - public static int GetDigitValue(String s, int index) + public static int GetDigitValue(String s, int index) { - if (s == null) + if (s == null) { throw new ArgumentNullException(nameof(s)); } - - if (index < 0 || index >= s.Length) + + if (index < 0 || index >= s.Length) { throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_Index); } - + Contract.EndContractBlock(); - return (sbyte) (InternalGetDigitValues(InternalConvertToUtf32(s, index)) & 0x00FF); + return (sbyte)(InternalGetDigitValues(InternalConvertToUtf32(s, index)) & 0x00FF); } public static UnicodeCategory GetUnicodeCategory(char ch) diff --git a/src/mscorlib/corefx/System/Globalization/ChineseLunisolarCalendar.cs b/src/mscorlib/corefx/System/Globalization/ChineseLunisolarCalendar.cs index 271d9802ce..5002555384 100644 --- a/src/mscorlib/corefx/System/Globalization/ChineseLunisolarCalendar.cs +++ b/src/mscorlib/corefx/System/Globalization/ChineseLunisolarCalendar.cs @@ -42,7 +42,6 @@ namespace System.Globalization internal static DateTime minDate = new DateTime(MIN_GREGORIAN_YEAR, MIN_GREGORIAN_MONTH, MIN_GREGORIAN_DAY); internal static DateTime maxDate = new DateTime((new DateTime(MAX_GREGORIAN_YEAR, MAX_GREGORIAN_MONTH, MAX_GREGORIAN_DAY, 23, 59, 59, 999)).Ticks + 9999); - [System.Runtime.InteropServices.ComVisible(false)] public override DateTime MinSupportedDateTime { get @@ -52,7 +51,6 @@ namespace System.Globalization } - [System.Runtime.InteropServices.ComVisible(false)] public override DateTime MaxSupportedDateTime { get @@ -318,9 +316,9 @@ namespace System.Globalization } } - internal override int GetYearInfo(int LunarYear, int Index) + internal override int GetYearInfo(int lunarYear, int index) { - if ((LunarYear < MIN_LUNISOLAR_YEAR) || (LunarYear > MAX_LUNISOLAR_YEAR)) + if ((lunarYear < MIN_LUNISOLAR_YEAR) || (lunarYear > MAX_LUNISOLAR_YEAR)) { throw new ArgumentOutOfRangeException( "year", @@ -330,7 +328,7 @@ namespace System.Globalization } Contract.EndContractBlock(); - return s_yinfo[LunarYear - MIN_LUNISOLAR_YEAR, Index]; + return s_yinfo[lunarYear - MIN_LUNISOLAR_YEAR, index]; } internal override int GetYear(int year, DateTime time) @@ -362,7 +360,6 @@ namespace System.Globalization { } - [System.Runtime.InteropServices.ComVisible(false)] public override int GetEra(DateTime time) { CheckTicksRange(time.Ticks); @@ -387,7 +384,6 @@ namespace System.Globalization } - [System.Runtime.InteropServices.ComVisible(false)] public override int[] Eras { get diff --git a/src/mscorlib/corefx/System/Globalization/CompareInfo.Windows.cs b/src/mscorlib/corefx/System/Globalization/CompareInfo.Windows.cs index 4ebaf9cb10..d4936522dd 100644 --- a/src/mscorlib/corefx/System/Globalization/CompareInfo.Windows.cs +++ b/src/mscorlib/corefx/System/Globalization/CompareInfo.Windows.cs @@ -351,7 +351,7 @@ namespace System.Globalization private unsafe SortKey CreateSortKey(String source, CompareOptions options) { - if (source==null) { throw new ArgumentNullException(nameof(source)); } + if (source == null) { throw new ArgumentNullException(nameof(source)); } Contract.EndContractBlock(); if ((options & ValidSortkeyCtorMaskOffFlags) != 0) @@ -362,7 +362,7 @@ namespace System.Globalization throw new NotImplementedException(); } - private static unsafe bool IsSortable(char *text, int length) + private static unsafe bool IsSortable(char* text, int length) { // CompareInfo c = CultureInfo.InvariantCulture.CompareInfo; // return (InternalIsSortable(c.m_dataHandle, c.m_handleOrigin, c.m_sortName, text, text.Length)); diff --git a/src/mscorlib/corefx/System/Globalization/CultureData.Unix.cs b/src/mscorlib/corefx/System/Globalization/CultureData.Unix.cs index 7f2f17d9f5..ba96189458 100644 --- a/src/mscorlib/corefx/System/Globalization/CultureData.Unix.cs +++ b/src/mscorlib/corefx/System/Globalization/CultureData.Unix.cs @@ -24,7 +24,6 @@ namespace System.Globalization /// This method uses the sRealName field (which is initialized by the constructor before this is called) to /// initialize the rest of the state of CultureData based on the underlying OS globalization library. /// </summary> - [SecuritySafeCritical] private unsafe bool InitCultureData() { Debug.Assert(_sRealName != null); @@ -87,7 +86,6 @@ namespace System.Globalization return true; } - [SecuritySafeCritical] internal static bool GetLocaleName(string localeName, out string windowsName) { // Get the locale name from ICU @@ -104,7 +102,6 @@ namespace System.Globalization return true; } - [SecuritySafeCritical] internal static bool GetDefaultLocaleName(out string windowsName) { // Get the default (system) locale name from ICU @@ -129,7 +126,6 @@ namespace System.Globalization // For LOCALE_SPARENT we need the option of using the "real" name (forcing neutral names) instead of the // "windows" name, which can be specific for downlevel (< windows 7) os's. - [SecuritySafeCritical] private string GetLocaleInfo(string localeName, LocaleStringData type) { Debug.Assert(localeName != null, "[CultureData.GetLocaleInfo] Expected localeName to be not be null"); @@ -155,7 +151,6 @@ namespace System.Globalization return StringBuilderCache.GetStringAndRelease(sb); } - [SecuritySafeCritical] private int GetLocaleInfo(LocaleNumberData type) { Debug.Assert(_sWindowsName != null, "[CultureData.GetLocaleInfo(LocaleNumberData)] Expected _sWindowsName to be populated already"); @@ -179,7 +174,6 @@ namespace System.Globalization return value; } - [SecuritySafeCritical] private int[] GetLocaleInfo(LocaleGroupingData type) { Debug.Assert(_sWindowsName != null, "[CultureData.GetLocaleInfo(LocaleGroupingData)] Expected _sWindowsName to be populated already"); @@ -205,7 +199,6 @@ namespace System.Globalization return GetTimeFormatString(false); } - [SecuritySafeCritical] private string GetTimeFormatString(bool shortFormat) { Debug.Assert(_sWindowsName != null, "[CultureData.GetTimeFormatString(bool shortFormat)] Expected _sWindowsName to be populated already"); diff --git a/src/mscorlib/corefx/System/Globalization/CultureData.Windows.cs b/src/mscorlib/corefx/System/Globalization/CultureData.Windows.cs index d1c99da607..0c264e5f8b 100644 --- a/src/mscorlib/corefx/System/Globalization/CultureData.Windows.cs +++ b/src/mscorlib/corefx/System/Globalization/CultureData.Windows.cs @@ -663,11 +663,10 @@ namespace System.Globalization { get { throw new NotImplementedException(); } } - + internal bool IsReplacementCulture { get { throw new NotImplementedException(); } } - } } diff --git a/src/mscorlib/corefx/System/Globalization/CultureNotFoundException.cs b/src/mscorlib/corefx/System/Globalization/CultureNotFoundException.cs index 64782d28c0..d296ad88e5 100644 --- a/src/mscorlib/corefx/System/Globalization/CultureNotFoundException.cs +++ b/src/mscorlib/corefx/System/Globalization/CultureNotFoundException.cs @@ -3,14 +3,13 @@ // See the LICENSE file in the project root for more information. using System; -using System.Threading; using System.Runtime.Serialization; +using System.Threading; namespace System.Globalization { [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] - public partial class CultureNotFoundException : ArgumentException, ISerializable + public class CultureNotFoundException : ArgumentException, ISerializable { private string _invalidCultureName; // unrecognized culture name private int? _invalidCultureId; // unrecognized culture Lcid @@ -66,14 +65,8 @@ namespace System.Globalization _invalidCultureName = (string)info.GetValue("InvalidCultureName", typeof(string)); } - [System.Security.SecurityCritical] // auto-generated_required public override void GetObjectData(SerializationInfo info, StreamingContext context) { - if (info == null) - { - throw new ArgumentNullException(nameof(info)); - } - base.GetObjectData(info, context); info.AddValue("InvalidCultureId", _invalidCultureId, typeof(int?)); info.AddValue("InvalidCultureName", _invalidCultureName, typeof(string)); diff --git a/src/mscorlib/corefx/System/Globalization/CultureTypes.cs b/src/mscorlib/corefx/System/Globalization/CultureTypes.cs index 80b588aabb..35ddff6086 100644 --- a/src/mscorlib/corefx/System/Globalization/CultureTypes.cs +++ b/src/mscorlib/corefx/System/Globalization/CultureTypes.cs @@ -7,7 +7,7 @@ // the rest are obsolete or not valid on Linux namespace System.Globalization -{ +{ [Serializable] [Flags] public enum CultureTypes @@ -25,4 +25,4 @@ namespace System.Globalization [Obsolete("This value has been deprecated. Please use other values in CultureTypes.")] FrameworkCultures = 0x0040, // will return only the v2 cultures marked as Framework culture. } -} +} diff --git a/src/mscorlib/corefx/System/Globalization/DateTimeFormatInfo.cs b/src/mscorlib/corefx/System/Globalization/DateTimeFormatInfo.cs index 216fc603d0..b79ce90424 100644 --- a/src/mscorlib/corefx/System/Globalization/DateTimeFormatInfo.cs +++ b/src/mscorlib/corefx/System/Globalization/DateTimeFormatInfo.cs @@ -514,7 +514,6 @@ namespace System.Globalization public String AMDesignator { - // auto-generated get { if (this.amDesignator == null) @@ -1031,7 +1030,6 @@ namespace System.Globalization public String PMDesignator { - // auto-generated get { if (this.pmDesignator == null) @@ -2163,7 +2161,7 @@ namespace System.Globalization // // Positive TimeSpan Pattern // - + [NonSerialized] private string _fullTimeSpanPositivePattern; internal String FullTimeSpanPositivePattern { @@ -2187,7 +2185,7 @@ namespace System.Globalization // // Negative TimeSpan Pattern // - + [NonSerialized] private string _fullTimeSpanNegativePattern; internal String FullTimeSpanNegativePattern { @@ -2343,7 +2341,7 @@ namespace System.Globalization // // DateTimeFormatInfo tokenizer. This is used by DateTime.Parse() to break input string into tokens. // - + [NonSerialized] private TokenHashValue[] _dtfiTokenHash; private const int TOKEN_HASH_SIZE = 199; diff --git a/src/mscorlib/corefx/System/Globalization/DigitShapes.cs b/src/mscorlib/corefx/System/Globalization/DigitShapes.cs index 7e40033a2f..0e4dcc87c3 100644 --- a/src/mscorlib/corefx/System/Globalization/DigitShapes.cs +++ b/src/mscorlib/corefx/System/Globalization/DigitShapes.cs @@ -5,6 +5,7 @@ // // The enumeration constants used in NumberFormatInfo.DigitSubstitution. // + namespace System.Globalization { [Serializable] diff --git a/src/mscorlib/corefx/System/Globalization/EastAsianLunisolarCalendar.cs b/src/mscorlib/corefx/System/Globalization/EastAsianLunisolarCalendar.cs index 84a44a990d..f82fad8e5b 100644 --- a/src/mscorlib/corefx/System/Globalization/EastAsianLunisolarCalendar.cs +++ b/src/mscorlib/corefx/System/Globalization/EastAsianLunisolarCalendar.cs @@ -14,7 +14,6 @@ namespace System.Globalization //////////////////////////////////////////////////////////////////////////// [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] public abstract class EastAsianLunisolarCalendar : Calendar { internal const int LeapMonth = 0; diff --git a/src/mscorlib/corefx/System/Globalization/GregorianCalendar.cs b/src/mscorlib/corefx/System/Globalization/GregorianCalendar.cs index c2ed2e012b..be5b65b385 100644 --- a/src/mscorlib/corefx/System/Globalization/GregorianCalendar.cs +++ b/src/mscorlib/corefx/System/Globalization/GregorianCalendar.cs @@ -19,7 +19,6 @@ namespace System.Globalization // 1 BeforeCurrentEra (BC) [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] public class GregorianCalendar : Calendar { @@ -66,7 +65,6 @@ namespace System.Globalization } } - [System.Runtime.InteropServices.ComVisible(false)] public override DateTime MinSupportedDateTime { get @@ -75,7 +73,6 @@ namespace System.Globalization } } - [System.Runtime.InteropServices.ComVisible(false)] public override DateTime MaxSupportedDateTime { get @@ -84,7 +81,6 @@ namespace System.Globalization } } - [System.Runtime.InteropServices.ComVisible(false)] public override CalendarAlgorithmType AlgorithmType { get @@ -510,7 +506,6 @@ namespace System.Globalization // if this calendar does not have leap month, or this year is not a leap year. // - [System.Runtime.InteropServices.ComVisible(false)] public override int GetLeapMonth(int year, int era) { if (era != CurrentEra && era != ADEra) diff --git a/src/mscorlib/corefx/System/Globalization/HebrewCalendar.cs b/src/mscorlib/corefx/System/Globalization/HebrewCalendar.cs index 7e63708382..b4f54f8fbb 100644 --- a/src/mscorlib/corefx/System/Globalization/HebrewCalendar.cs +++ b/src/mscorlib/corefx/System/Globalization/HebrewCalendar.cs @@ -63,7 +63,6 @@ namespace System.Globalization [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] public class HebrewCalendar : Calendar { public static readonly int HebrewEra = 1; diff --git a/src/mscorlib/corefx/System/Globalization/HijriCalendar.Win32.cs b/src/mscorlib/corefx/System/Globalization/HijriCalendar.Win32.cs index 5f46dce61d..869b809bff 100644 --- a/src/mscorlib/corefx/System/Globalization/HijriCalendar.Win32.cs +++ b/src/mscorlib/corefx/System/Globalization/HijriCalendar.Win32.cs @@ -8,9 +8,10 @@ namespace System.Globalization { public partial class HijriCalendar : Calendar { - private static int GetHijriDateAdjustment() + private int GetHijriDateAdjustment() { - if (_hijriAdvance == Int32.MinValue) { + if (_hijriAdvance == Int32.MinValue) + { // Never been set before. Use the system value from registry. _hijriAdvance = GetAdvanceHijriDate(); } @@ -36,11 +37,13 @@ namespace System.Globalization ** "AddHijriDate+1" => Add +1 days to the current calculated Hijri date. ** "AddHijriDate+2" => Add +2 days to the current calculated Hijri date. ============================================================================*/ - private static int GetAdvanceHijriDate() { + private static int GetAdvanceHijriDate() + { int hijriAdvance = 0; Microsoft.Win32.RegistryKey key = null; - try { + try + { // Open in read-only mode. // Use InternalOpenSubKey so that we avoid the security check. key = RegistryKey.GetBaseKey(RegistryKey.HKEY_CURRENT_USER).OpenSubKey(InternationalRegKey, false); @@ -49,21 +52,28 @@ namespace System.Globalization catch (ObjectDisposedException) { return 0; } catch (ArgumentException) { return 0; } - if (key != null) { - try { + if (key != null) + { + try + { Object value = key.InternalGetValue(HijriAdvanceRegKeyEntry, null, false, false); - if (value == null) { + if (value == null) + { return (0); } String str = value.ToString(); - if (String.Compare(str, 0, HijriAdvanceRegKeyEntry, 0, HijriAdvanceRegKeyEntry.Length, StringComparison.OrdinalIgnoreCase) == 0) { + if (String.Compare(str, 0, HijriAdvanceRegKeyEntry, 0, HijriAdvanceRegKeyEntry.Length, StringComparison.OrdinalIgnoreCase) == 0) + { if (str.Length == HijriAdvanceRegKeyEntry.Length) hijriAdvance = -1; - else { + else + { str = str.Substring(HijriAdvanceRegKeyEntry.Length); - try { + try + { int advance = Int32.Parse(str.ToString(), CultureInfo.InvariantCulture); - if ((advance >= MinAdvancedHijri) && (advance <= MaxAdvancedHijri)) { + if ((advance >= MinAdvancedHijri) && (advance <= MaxAdvancedHijri)) + { hijriAdvance = advance; } } @@ -75,10 +85,10 @@ namespace System.Globalization } } } - finally { + finally + { key.Close(); } - } return (hijriAdvance); } diff --git a/src/mscorlib/corefx/System/Globalization/HijriCalendar.cs b/src/mscorlib/corefx/System/Globalization/HijriCalendar.cs index 156b2104bd..0c72d9eaf5 100644 --- a/src/mscorlib/corefx/System/Globalization/HijriCalendar.cs +++ b/src/mscorlib/corefx/System/Globalization/HijriCalendar.cs @@ -45,7 +45,6 @@ namespace System.Globalization */ [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] public partial class HijriCalendar : Calendar { public static readonly int HijriEra = 1; @@ -72,7 +71,6 @@ namespace System.Globalization internal static readonly DateTime calendarMaxValue = DateTime.MaxValue; - [System.Runtime.InteropServices.ComVisible(false)] public override DateTime MinSupportedDateTime { get @@ -82,7 +80,6 @@ namespace System.Globalization } - [System.Runtime.InteropServices.ComVisible(false)] public override DateTime MaxSupportedDateTime { get @@ -91,7 +88,6 @@ namespace System.Globalization } } - [System.Runtime.InteropServices.ComVisible(false)] public override CalendarAlgorithmType AlgorithmType { get @@ -565,7 +561,6 @@ namespace System.Globalization // if this calendar does not have leap month, or this year is not a leap year. // - [System.Runtime.InteropServices.ComVisible(false)] public override int GetLeapMonth(int year, int era) { CheckYearRange(year, era); diff --git a/src/mscorlib/corefx/System/Globalization/IdnMapping.Windows.cs b/src/mscorlib/corefx/System/Globalization/IdnMapping.Windows.cs index f39457b750..3d3292e3db 100644 --- a/src/mscorlib/corefx/System/Globalization/IdnMapping.Windows.cs +++ b/src/mscorlib/corefx/System/Globalization/IdnMapping.Windows.cs @@ -7,7 +7,7 @@ using System.Runtime.InteropServices; namespace System.Globalization { - sealed partial class IdnMapping + public sealed partial class IdnMapping { private unsafe string GetAsciiCore(char* unicode, int count) { diff --git a/src/mscorlib/corefx/System/Globalization/JapaneseCalendar.Win32.cs b/src/mscorlib/corefx/System/Globalization/JapaneseCalendar.Win32.cs index bbde320041..a83c4fad9e 100644 --- a/src/mscorlib/corefx/System/Globalization/JapaneseCalendar.Win32.cs +++ b/src/mscorlib/corefx/System/Globalization/JapaneseCalendar.Win32.cs @@ -33,7 +33,7 @@ namespace System.Globalization // Look in the registry key and see if we can find any ranges int iFoundEras = 0; EraInfo[] registryEraRanges = null; - + try { // Need to access registry @@ -59,7 +59,7 @@ namespace System.Globalization // Remember we found one. registryEraRanges[iFoundEras] = era; - iFoundEras++; + iFoundEras++; } } } @@ -109,7 +109,7 @@ namespace System.Globalization else { // Rest are until the next era (remember most recent era is first in array) - registryEraRanges[i].maxEraYear = registryEraRanges[i-1].yearOffset + 1 - registryEraRanges[i].yearOffset; + registryEraRanges[i].maxEraYear = registryEraRanges[i - 1].yearOffset + 1 - registryEraRanges[i].yearOffset; } } @@ -147,7 +147,7 @@ namespace System.Globalization { // Need inputs if (value == null || data == null) return null; - + // // Get Date // @@ -159,9 +159,9 @@ namespace System.Globalization int month; int day; - if (!Int32.TryParse(value.Substring(0,4), NumberStyles.None, NumberFormatInfo.InvariantInfo, out year) || - !Int32.TryParse(value.Substring(5,2), NumberStyles.None, NumberFormatInfo.InvariantInfo, out month) || - !Int32.TryParse(value.Substring(8,2), NumberStyles.None, NumberFormatInfo.InvariantInfo, out day)) + if (!Int32.TryParse(value.Substring(0, 4), NumberStyles.None, NumberFormatInfo.InvariantInfo, out year) || + !Int32.TryParse(value.Substring(5, 2), NumberStyles.None, NumberFormatInfo.InvariantInfo, out month) || + !Int32.TryParse(value.Substring(8, 2), NumberStyles.None, NumberFormatInfo.InvariantInfo, out day)) { // Couldn't convert integer, fail return null; @@ -171,7 +171,7 @@ namespace System.Globalization // Get Strings // // Needs to be a certain length e_a_E_A at least (7 chars, exactly 4 groups) - String[] names = data.Split(new char[] {'_'}); + String[] names = data.Split('_'); // Should have exactly 4 parts // 0 - Era Name @@ -192,18 +192,18 @@ namespace System.Globalization // Note that the era # and max era year need cleaned up after sorting // Don't use the full English Era Name (names[2]) // - return new EraInfo( 0, year, month, day, year - 1, 1, 0, + return new EraInfo(0, year, month, day, year - 1, 1, 0, names[0], names[1], names[3]); } // PAL Layer ends here - private static string[] JapaneseErasEnglishNames = new String[] { "M", "T", "S", "H" }; + private static string[] s_japaneseErasEnglishNames = new String[] { "M", "T", "S", "H" }; private static string GetJapaneseEnglishEraName(int era) { Debug.Assert(era > 0); - return era <= JapaneseErasEnglishNames.Length ? JapaneseErasEnglishNames[era - 1] : " "; + return era <= s_japaneseErasEnglishNames.Length ? s_japaneseErasEnglishNames[era - 1] : " "; } } } diff --git a/src/mscorlib/corefx/System/Globalization/JapaneseCalendar.cs b/src/mscorlib/corefx/System/Globalization/JapaneseCalendar.cs index 0b0fa77fc0..f0216c8f51 100644 --- a/src/mscorlib/corefx/System/Globalization/JapaneseCalendar.cs +++ b/src/mscorlib/corefx/System/Globalization/JapaneseCalendar.cs @@ -39,13 +39,11 @@ namespace System.Globalization [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] public partial class JapaneseCalendar : Calendar { internal static readonly DateTime calendarMinValue = new DateTime(1868, 9, 8); - [System.Runtime.InteropServices.ComVisible(false)] public override DateTime MinSupportedDateTime { get @@ -54,7 +52,6 @@ namespace System.Globalization } } - [System.Runtime.InteropServices.ComVisible(false)] public override DateTime MaxSupportedDateTime { get @@ -63,7 +60,6 @@ namespace System.Globalization } } - [System.Runtime.InteropServices.ComVisible(false)] public override CalendarAlgorithmType AlgorithmType { get @@ -233,7 +229,6 @@ namespace System.Globalization [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems. - [System.Runtime.InteropServices.ComVisible(false)] public override int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek) { return (helper.GetWeekOfYear(time, rule, firstDayOfWeek)); @@ -281,7 +276,6 @@ namespace System.Globalization // if this calendar does not have leap month, or this year is not a leap year. // - [System.Runtime.InteropServices.ComVisible(false)] public override int GetLeapMonth(int year, int era) { return (helper.GetLeapMonth(year, era)); diff --git a/src/mscorlib/corefx/System/Globalization/JapaneseLunisolarCalendar.cs b/src/mscorlib/corefx/System/Globalization/JapaneseLunisolarCalendar.cs index ecdaced2d7..cc3d34954d 100644 --- a/src/mscorlib/corefx/System/Globalization/JapaneseLunisolarCalendar.cs +++ b/src/mscorlib/corefx/System/Globalization/JapaneseLunisolarCalendar.cs @@ -206,9 +206,9 @@ namespace System.Globalization } } - internal override int GetYearInfo(int LunarYear, int Index) + internal override int GetYearInfo(int lunarYear, int index) { - if ((LunarYear < MIN_LUNISOLAR_YEAR) || (LunarYear > MAX_LUNISOLAR_YEAR)) + if ((lunarYear < MIN_LUNISOLAR_YEAR) || (lunarYear > MAX_LUNISOLAR_YEAR)) { throw new ArgumentOutOfRangeException( "year", @@ -220,7 +220,7 @@ namespace System.Globalization } Contract.EndContractBlock(); - return s_yinfo[LunarYear - MIN_LUNISOLAR_YEAR, Index]; + return s_yinfo[lunarYear - MIN_LUNISOLAR_YEAR, index]; } internal override int GetYear(int year, DateTime time) diff --git a/src/mscorlib/corefx/System/Globalization/JulianCalendar.cs b/src/mscorlib/corefx/System/Globalization/JulianCalendar.cs index a4277c6d49..43e6ad07a2 100644 --- a/src/mscorlib/corefx/System/Globalization/JulianCalendar.cs +++ b/src/mscorlib/corefx/System/Globalization/JulianCalendar.cs @@ -19,7 +19,6 @@ namespace System.Globalization //* Julia 0001/01/03 9999/10/19 [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] public class JulianCalendar : Calendar { public static readonly int JulianEra = 1; @@ -49,7 +48,6 @@ namespace System.Globalization internal int MaxYear = 9999; - [System.Runtime.InteropServices.ComVisible(false)] public override DateTime MinSupportedDateTime { get @@ -58,7 +56,6 @@ namespace System.Globalization } } - [System.Runtime.InteropServices.ComVisible(false)] public override DateTime MaxSupportedDateTime { get @@ -67,7 +64,6 @@ namespace System.Globalization } } - [System.Runtime.InteropServices.ComVisible(false)] public override CalendarAlgorithmType AlgorithmType { get @@ -346,7 +342,6 @@ namespace System.Globalization // if this calendar does not have leap month, or this year is not a leap year. // - [System.Runtime.InteropServices.ComVisible(false)] public override int GetLeapMonth(int year, int era) { CheckYearEraRange(year, era); diff --git a/src/mscorlib/corefx/System/Globalization/KoreanCalendar.cs b/src/mscorlib/corefx/System/Globalization/KoreanCalendar.cs index 27d0aa812a..b015aa0716 100644 --- a/src/mscorlib/corefx/System/Globalization/KoreanCalendar.cs +++ b/src/mscorlib/corefx/System/Globalization/KoreanCalendar.cs @@ -25,7 +25,6 @@ namespace System.Globalization [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] public class KoreanCalendar : Calendar { // @@ -51,7 +50,6 @@ namespace System.Globalization internal GregorianCalendarHelper helper; - [System.Runtime.InteropServices.ComVisible(false)] public override DateTime MinSupportedDateTime { get @@ -60,7 +58,6 @@ namespace System.Globalization } } - [System.Runtime.InteropServices.ComVisible(false)] public override DateTime MaxSupportedDateTime { get @@ -69,7 +66,6 @@ namespace System.Globalization } } - [System.Runtime.InteropServices.ComVisible(false)] public override CalendarAlgorithmType AlgorithmType { get @@ -160,7 +156,6 @@ namespace System.Globalization [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems. - [System.Runtime.InteropServices.ComVisible(false)] public override int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek) { return (helper.GetWeekOfYear(time, rule, firstDayOfWeek)); @@ -199,7 +194,6 @@ namespace System.Globalization // if this calendar does not have leap month, or this year is not a leap year. // - [System.Runtime.InteropServices.ComVisible(false)] public override int GetLeapMonth(int year, int era) { return (helper.GetLeapMonth(year, era)); diff --git a/src/mscorlib/corefx/System/Globalization/KoreanLunisolarCalendar.cs b/src/mscorlib/corefx/System/Globalization/KoreanLunisolarCalendar.cs index 07d85a461e..6d091285b2 100644 --- a/src/mscorlib/corefx/System/Globalization/KoreanLunisolarCalendar.cs +++ b/src/mscorlib/corefx/System/Globalization/KoreanLunisolarCalendar.cs @@ -1251,9 +1251,9 @@ namespace System.Globalization } } - internal override int GetYearInfo(int LunarYear, int Index) + internal override int GetYearInfo(int lunarYear, int index) { - if ((LunarYear < MIN_LUNISOLAR_YEAR) || (LunarYear > MAX_LUNISOLAR_YEAR)) + if ((lunarYear < MIN_LUNISOLAR_YEAR) || (lunarYear > MAX_LUNISOLAR_YEAR)) { throw new ArgumentOutOfRangeException( "year", @@ -1264,7 +1264,7 @@ namespace System.Globalization MAX_LUNISOLAR_YEAR)); } Contract.EndContractBlock(); - return s_yinfo[LunarYear - MIN_LUNISOLAR_YEAR, Index]; + return s_yinfo[lunarYear - MIN_LUNISOLAR_YEAR, index]; } internal override int GetYear(int year, DateTime time) diff --git a/src/mscorlib/corefx/System/Globalization/NumberFormatInfo.cs b/src/mscorlib/corefx/System/Globalization/NumberFormatInfo.cs index 813554fd21..54cf492135 100644 --- a/src/mscorlib/corefx/System/Globalization/NumberFormatInfo.cs +++ b/src/mscorlib/corefx/System/Globalization/NumberFormatInfo.cs @@ -289,7 +289,7 @@ namespace System.Globalization if (value < 0 || value > 99) { throw new ArgumentOutOfRangeException( - "CurrencyDecimalDigits", + nameof(CurrencyDecimalDigits), String.Format( CultureInfo.CurrentCulture, SR.ArgumentOutOfRange_Range, @@ -357,14 +357,14 @@ namespace System.Globalization { if (value == null) { - throw new ArgumentNullException("CurrencyGroupSizes", + throw new ArgumentNullException(nameof(CurrencyGroupSizes), SR.ArgumentNull_Obj); } Contract.EndContractBlock(); VerifyWritable(); Int32[] inputSizes = (Int32[])value.Clone(); - CheckGroupSize("CurrencyGroupSizes", inputSizes); + CheckGroupSize(nameof(CurrencyGroupSizes), inputSizes); currencyGroupSizes = inputSizes; } } @@ -381,14 +381,14 @@ namespace System.Globalization { if (value == null) { - throw new ArgumentNullException("NumberGroupSizes", + throw new ArgumentNullException(nameof(NumberGroupSizes), SR.ArgumentNull_Obj); } Contract.EndContractBlock(); VerifyWritable(); Int32[] inputSizes = (Int32[])value.Clone(); - CheckGroupSize("NumberGroupSizes", inputSizes); + CheckGroupSize(nameof(NumberGroupSizes), inputSizes); numberGroupSizes = inputSizes; } } @@ -422,7 +422,7 @@ namespace System.Globalization set { VerifyWritable(); - VerifyGroupSeparator(value, "CurrencyGroupSeparator"); + VerifyGroupSeparator(value, nameof(CurrencyGroupSeparator)); currencyGroupSeparator = value; } } @@ -435,7 +435,7 @@ namespace System.Globalization { if (value == null) { - throw new ArgumentNullException("CurrencySymbol", + throw new ArgumentNullException(nameof(CurrencySymbol), SR.ArgumentNull_String); } Contract.EndContractBlock(); @@ -475,7 +475,7 @@ namespace System.Globalization { if (value == null) { - throw new ArgumentNullException("NaNSymbol", + throw new ArgumentNullException(nameof(NaNSymbol), SR.ArgumentNull_String); } Contract.EndContractBlock(); @@ -494,7 +494,7 @@ namespace System.Globalization if (value < 0 || value > 15) { throw new ArgumentOutOfRangeException( - "CurrencyNegativePattern", + nameof(CurrencyNegativePattern), String.Format( CultureInfo.CurrentCulture, SR.ArgumentOutOfRange_Range, @@ -519,7 +519,7 @@ namespace System.Globalization if (value < 0 || value > 4) { throw new ArgumentOutOfRangeException( - "NumberNegativePattern", + nameof(NumberNegativePattern), String.Format( CultureInfo.CurrentCulture, SR.ArgumentOutOfRange_Range, @@ -544,7 +544,7 @@ namespace System.Globalization if (value < 0 || value > 3) { throw new ArgumentOutOfRangeException( - "PercentPositivePattern", + nameof(PercentPositivePattern), String.Format( CultureInfo.CurrentCulture, SR.ArgumentOutOfRange_Range, @@ -569,7 +569,7 @@ namespace System.Globalization if (value < 0 || value > 11) { throw new ArgumentOutOfRangeException( - "PercentNegativePattern", + nameof(PercentNegativePattern), String.Format( CultureInfo.CurrentCulture, SR.ArgumentOutOfRange_Range, @@ -593,7 +593,7 @@ namespace System.Globalization { if (value == null) { - throw new ArgumentNullException("NegativeInfinitySymbol", + throw new ArgumentNullException(nameof(NegativeInfinitySymbol), SR.ArgumentNull_String); } Contract.EndContractBlock(); @@ -610,7 +610,7 @@ namespace System.Globalization { if (value == null) { - throw new ArgumentNullException("NegativeSign", + throw new ArgumentNullException(nameof(NegativeSign), SR.ArgumentNull_String); } Contract.EndContractBlock(); @@ -628,7 +628,7 @@ namespace System.Globalization if (value < 0 || value > 99) { throw new ArgumentOutOfRangeException( - "NumberDecimalDigits", + nameof(NumberDecimalDigits), String.Format( CultureInfo.CurrentCulture, SR.ArgumentOutOfRange_Range, @@ -648,7 +648,7 @@ namespace System.Globalization set { VerifyWritable(); - VerifyDecimalSeparator(value, "NumberDecimalSeparator"); + VerifyDecimalSeparator(value, nameof(NumberDecimalSeparator)); numberDecimalSeparator = value; } } @@ -660,7 +660,7 @@ namespace System.Globalization set { VerifyWritable(); - VerifyGroupSeparator(value, "NumberGroupSeparator"); + VerifyGroupSeparator(value, nameof(NumberGroupSeparator)); numberGroupSeparator = value; } } @@ -674,7 +674,7 @@ namespace System.Globalization if (value < 0 || value > 3) { throw new ArgumentOutOfRangeException( - "CurrencyPositivePattern", + nameof(CurrencyPositivePattern), String.Format( CultureInfo.CurrentCulture, SR.ArgumentOutOfRange_Range, @@ -698,7 +698,7 @@ namespace System.Globalization { if (value == null) { - throw new ArgumentNullException("PositiveInfinitySymbol", + throw new ArgumentNullException(nameof(PositiveInfinitySymbol), SR.ArgumentNull_String); } Contract.EndContractBlock(); @@ -715,7 +715,7 @@ namespace System.Globalization { if (value == null) { - throw new ArgumentNullException("PositiveSign", + throw new ArgumentNullException(nameof(PositiveSign), SR.ArgumentNull_String); } Contract.EndContractBlock(); @@ -733,7 +733,7 @@ namespace System.Globalization if (value < 0 || value > 99) { throw new ArgumentOutOfRangeException( - "PercentDecimalDigits", + nameof(PercentDecimalDigits), String.Format( CultureInfo.CurrentCulture, SR.ArgumentOutOfRange_Range, @@ -753,7 +753,7 @@ namespace System.Globalization set { VerifyWritable(); - VerifyDecimalSeparator(value, "PercentDecimalSeparator"); + VerifyDecimalSeparator(value, nameof(PercentDecimalSeparator)); percentDecimalSeparator = value; } } @@ -765,7 +765,7 @@ namespace System.Globalization set { VerifyWritable(); - VerifyGroupSeparator(value, "PercentGroupSeparator"); + VerifyGroupSeparator(value, nameof(PercentGroupSeparator)); percentGroupSeparator = value; } } @@ -781,7 +781,7 @@ namespace System.Globalization { if (value == null) { - throw new ArgumentNullException("PercentSymbol", + throw new ArgumentNullException(nameof(PercentSymbol), SR.ArgumentNull_String); } Contract.EndContractBlock(); @@ -798,7 +798,7 @@ namespace System.Globalization { if (value == null) { - throw new ArgumentNullException("PerMilleSymbol", + throw new ArgumentNullException(nameof(PerMilleSymbol), SR.ArgumentNull_String); } Contract.EndContractBlock(); @@ -813,7 +813,7 @@ namespace System.Globalization set { VerifyWritable(); - VerifyNativeDigits(value, "NativeDigits"); + VerifyNativeDigits(value, nameof(NativeDigits)); nativeDigits = value; } } @@ -824,7 +824,7 @@ namespace System.Globalization set { VerifyWritable(); - VerifyDigitSubstitution(value, "DigitSubstitution"); + VerifyDigitSubstitution(value, nameof(DigitSubstitution)); digitSubstitution = (int) value; } } diff --git a/src/mscorlib/corefx/System/Globalization/RegionInfo.cs b/src/mscorlib/corefx/System/Globalization/RegionInfo.cs index 0645ded0ab..15679d24dd 100644 --- a/src/mscorlib/corefx/System/Globalization/RegionInfo.cs +++ b/src/mscorlib/corefx/System/Globalization/RegionInfo.cs @@ -87,7 +87,6 @@ namespace System.Globalization SetName(name); } - [System.Security.SecuritySafeCritical] // auto-generated public RegionInfo(int culture) { if (culture == CultureInfo.LOCALE_INVARIANT) //The InvariantCulture has no matching region @@ -132,7 +131,6 @@ namespace System.Globalization [OnSerializing] private void OnSerializing(StreamingContext ctx) { } - [System.Security.SecurityCritical] // auto-generated [OnDeserialized] private void OnDeserialized(StreamingContext ctx) { diff --git a/src/mscorlib/corefx/System/Globalization/SortKey.cs b/src/mscorlib/corefx/System/Globalization/SortKey.cs index fc151fa37e..9e22a6f332 100644 --- a/src/mscorlib/corefx/System/Globalization/SortKey.cs +++ b/src/mscorlib/corefx/System/Globalization/SortKey.cs @@ -19,7 +19,6 @@ namespace System.Globalization { using System.Diagnostics; using System.Diagnostics.Contracts; - [System.Runtime.InteropServices.ComVisible(true)] [Serializable] public partial class SortKey { diff --git a/src/mscorlib/corefx/System/Globalization/SortVersion.cs b/src/mscorlib/corefx/System/Globalization/SortVersion.cs index 72aa6d6b7b..983179c149 100644 --- a/src/mscorlib/corefx/System/Globalization/SortVersion.cs +++ b/src/mscorlib/corefx/System/Globalization/SortVersion.cs @@ -5,7 +5,7 @@ using System; using System.Diagnostics.Contracts; -namespace System.Globalization +namespace System.Globalization { [Serializable] public sealed class SortVersion : IEquatable<SortVersion> @@ -13,48 +13,48 @@ namespace System.Globalization private int _nlsVersion; private Guid _sortId; - public int FullVersion + public int FullVersion { - get + get { return _nlsVersion; } } - public Guid SortId + public Guid SortId { - get + get { return _sortId; } } - public SortVersion(int fullVersion, Guid sortId) - { + public SortVersion(int fullVersion, Guid sortId) + { _sortId = sortId; _nlsVersion = fullVersion; } - internal SortVersion(int nlsVersion, int effectiveId, Guid customVersion) + internal SortVersion(int nlsVersion, int effectiveId, Guid customVersion) { _nlsVersion = nlsVersion; - if (customVersion == Guid.Empty) + if (customVersion == Guid.Empty) { - byte b1 = (byte) (effectiveId >> 24); - byte b2 = (byte) ((effectiveId & 0x00FF0000) >> 16); - byte b3 = (byte) ((effectiveId & 0x0000FF00) >> 8); - byte b4 = (byte) (effectiveId & 0xFF); - customVersion = new Guid(0,0,0,0,0,0,0,b1,b2,b3,b4); + byte b1 = (byte)(effectiveId >> 24); + byte b2 = (byte)((effectiveId & 0x00FF0000) >> 16); + byte b3 = (byte)((effectiveId & 0x0000FF00) >> 8); + byte b4 = (byte)(effectiveId & 0xFF); + customVersion = new Guid(0, 0, 0, 0, 0, 0, 0, b1, b2, b3, b4); } _sortId = customVersion; } - public override bool Equals(object obj) + public override bool Equals(object obj) { SortVersion n = obj as SortVersion; - if (n != null) + if (n != null) { return this.Equals(n); } @@ -62,9 +62,9 @@ namespace System.Globalization return false; } - public bool Equals(SortVersion other) + public bool Equals(SortVersion other) { - if (other == null) + if (other == null) { return false; } @@ -72,19 +72,19 @@ namespace System.Globalization return _nlsVersion == other._nlsVersion && _sortId == other._sortId; } - public override int GetHashCode() - { - return _nlsVersion * 7 | _sortId.GetHashCode(); + public override int GetHashCode() + { + return _nlsVersion * 7 | _sortId.GetHashCode(); } - public static bool operator ==(SortVersion left, SortVersion right) + public static bool operator ==(SortVersion left, SortVersion right) { - if (((object) left) != null) + if (((object)left) != null) { return left.Equals(right); } - if (((object) right) != null) + if (((object)right) != null) { return right.Equals(left); } @@ -93,7 +93,7 @@ namespace System.Globalization return true; } - public static bool operator !=(SortVersion left, SortVersion right) + public static bool operator !=(SortVersion left, SortVersion right) { return !(left == right); } diff --git a/src/mscorlib/corefx/System/Globalization/StringInfo.cs b/src/mscorlib/corefx/System/Globalization/StringInfo.cs index 7558002413..f1dd30561b 100644 --- a/src/mscorlib/corefx/System/Globalization/StringInfo.cs +++ b/src/mscorlib/corefx/System/Globalization/StringInfo.cs @@ -20,7 +20,6 @@ using System.Runtime.Serialization; namespace System.Globalization { [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] public class StringInfo { [OptionalField(VersionAdded = 2)] @@ -53,7 +52,6 @@ namespace System.Globalization } } - [System.Runtime.InteropServices.ComVisible(false)] public override bool Equals(Object value) { StringInfo that = value as StringInfo; @@ -64,7 +62,6 @@ namespace System.Globalization return (false); } - [System.Runtime.InteropServices.ComVisible(false)] public override int GetHashCode() { return _str.GetHashCode(); diff --git a/src/mscorlib/corefx/System/Globalization/TaiwanCalendar.cs b/src/mscorlib/corefx/System/Globalization/TaiwanCalendar.cs index 36edd5b2fd..2e735e0cb9 100644 --- a/src/mscorlib/corefx/System/Globalization/TaiwanCalendar.cs +++ b/src/mscorlib/corefx/System/Globalization/TaiwanCalendar.cs @@ -22,7 +22,6 @@ namespace System.Globalization ============================================================================*/ [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] public class TaiwanCalendar : Calendar { // @@ -65,7 +64,6 @@ namespace System.Globalization internal static readonly DateTime calendarMinValue = new DateTime(1912, 1, 1); - [System.Runtime.InteropServices.ComVisible(false)] public override DateTime MinSupportedDateTime { get @@ -74,7 +72,6 @@ namespace System.Globalization } } - [System.Runtime.InteropServices.ComVisible(false)] public override DateTime MaxSupportedDateTime { get @@ -83,7 +80,6 @@ namespace System.Globalization } } - [System.Runtime.InteropServices.ComVisible(false)] public override CalendarAlgorithmType AlgorithmType { get @@ -166,7 +162,6 @@ namespace System.Globalization [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems. - [System.Runtime.InteropServices.ComVisible(false)] public override int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek) { return (helper.GetWeekOfYear(time, rule, firstDayOfWeek)); @@ -205,7 +200,6 @@ namespace System.Globalization // if this calendar does not have leap month, or this year is not a leap year. // - [System.Runtime.InteropServices.ComVisible(false)] public override int GetLeapMonth(int year, int era) { return (helper.GetLeapMonth(year, era)); diff --git a/src/mscorlib/corefx/System/Globalization/TaiwanLunisolarCalendar.cs b/src/mscorlib/corefx/System/Globalization/TaiwanLunisolarCalendar.cs index 42b7f2473b..1f75ac9a04 100644 --- a/src/mscorlib/corefx/System/Globalization/TaiwanLunisolarCalendar.cs +++ b/src/mscorlib/corefx/System/Globalization/TaiwanLunisolarCalendar.cs @@ -264,9 +264,9 @@ namespace System.Globalization } } - internal override int GetYearInfo(int LunarYear, int Index) + internal override int GetYearInfo(int lunarYear, int index) { - if ((LunarYear < MIN_LUNISOLAR_YEAR) || (LunarYear > MAX_LUNISOLAR_YEAR)) + if ((lunarYear < MIN_LUNISOLAR_YEAR) || (lunarYear > MAX_LUNISOLAR_YEAR)) { throw new ArgumentOutOfRangeException( "year", @@ -278,7 +278,7 @@ namespace System.Globalization } Contract.EndContractBlock(); - return s_yinfo[LunarYear - MIN_LUNISOLAR_YEAR, Index]; + return s_yinfo[lunarYear - MIN_LUNISOLAR_YEAR, index]; } internal override int GetYear(int year, DateTime time) diff --git a/src/mscorlib/corefx/System/Globalization/TextElementEnumerator.cs b/src/mscorlib/corefx/System/Globalization/TextElementEnumerator.cs index c0ffc65307..464897b03f 100644 --- a/src/mscorlib/corefx/System/Globalization/TextElementEnumerator.cs +++ b/src/mscorlib/corefx/System/Globalization/TextElementEnumerator.cs @@ -21,7 +21,6 @@ namespace System.Globalization // [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] public class TextElementEnumerator : IEnumerator { private String _str; diff --git a/src/mscorlib/corefx/System/Globalization/TextInfo.Unix.cs b/src/mscorlib/corefx/System/Globalization/TextInfo.Unix.cs index 3d9b777f64..67836d89d6 100644 --- a/src/mscorlib/corefx/System/Globalization/TextInfo.Unix.cs +++ b/src/mscorlib/corefx/System/Globalization/TextInfo.Unix.cs @@ -33,7 +33,6 @@ namespace System.Globalization { } - [SecuritySafeCritical] private unsafe string ChangeCase(string s, bool toUpper) { Debug.Assert(s != null); @@ -78,7 +77,6 @@ namespace System.Globalization return result; } - [SecuritySafeCritical] private unsafe char ChangeCase(char c, bool toUpper) { char dst = default(char); diff --git a/src/mscorlib/corefx/System/Globalization/TextInfo.cs b/src/mscorlib/corefx/System/Globalization/TextInfo.cs index 5bb376f19c..172bbd25b2 100644 --- a/src/mscorlib/corefx/System/Globalization/TextInfo.cs +++ b/src/mscorlib/corefx/System/Globalization/TextInfo.cs @@ -188,7 +188,6 @@ namespace System.Globalization } } - [System.Runtime.InteropServices.ComVisible(false)] public int LCID { get @@ -220,7 +219,6 @@ namespace System.Globalization // Detect if the object is readonly. // //////////////////////////////////////////////////////////////////////// - [System.Runtime.InteropServices.ComVisible(false)] public bool IsReadOnly { get { return (_isReadOnly); } @@ -248,7 +246,6 @@ namespace System.Globalization // readonly. // //////////////////////////////////////////////////////////////////////// - [System.Runtime.InteropServices.ComVisible(false)] public static TextInfo ReadOnly(TextInfo textInfo) { if (textInfo == null) { throw new ArgumentNullException(nameof(textInfo)); } diff --git a/src/mscorlib/corefx/System/Globalization/ThaiBuddhistCalendar.cs b/src/mscorlib/corefx/System/Globalization/ThaiBuddhistCalendar.cs index 8ebbfa0a69..9e6e30406c 100644 --- a/src/mscorlib/corefx/System/Globalization/ThaiBuddhistCalendar.cs +++ b/src/mscorlib/corefx/System/Globalization/ThaiBuddhistCalendar.cs @@ -21,7 +21,6 @@ namespace System.Globalization ============================================================================*/ [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] public class ThaiBuddhistCalendar : Calendar { // Initialize our era info. @@ -38,7 +37,6 @@ namespace System.Globalization internal GregorianCalendarHelper helper; - [System.Runtime.InteropServices.ComVisible(false)] public override DateTime MinSupportedDateTime { get @@ -47,7 +45,6 @@ namespace System.Globalization } } - [System.Runtime.InteropServices.ComVisible(false)] public override DateTime MaxSupportedDateTime { get @@ -56,7 +53,6 @@ namespace System.Globalization } } - [System.Runtime.InteropServices.ComVisible(false)] public override CalendarAlgorithmType AlgorithmType { get @@ -128,7 +124,6 @@ namespace System.Globalization [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems. - [System.Runtime.InteropServices.ComVisible(false)] public override int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek) { return (helper.GetWeekOfYear(time, rule, firstDayOfWeek)); @@ -167,7 +162,6 @@ namespace System.Globalization // if this calendar does not have leap month, or this year is not a leap year. // - [System.Runtime.InteropServices.ComVisible(false)] public override int GetLeapMonth(int year, int era) { return (helper.GetLeapMonth(year, era)); diff --git a/src/mscorlib/corefx/System/Globalization/UmAlQuraCalendar.cs b/src/mscorlib/corefx/System/Globalization/UmAlQuraCalendar.cs index 997c5f2316..7b47d9c02b 100644 --- a/src/mscorlib/corefx/System/Globalization/UmAlQuraCalendar.cs +++ b/src/mscorlib/corefx/System/Globalization/UmAlQuraCalendar.cs @@ -41,7 +41,7 @@ namespace System.Globalization private static DateMapping[] InitDateMapping() { - short[] rawData = new short[] + short[] rawData = new short[] { //These data is taken from Tables/Excel/UmAlQura.xls please make sure that the two places are in sync /* DaysPerM GY GM GD D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 |