{
get { return Environment.GetResourceString("SpinLock_IsHeldByCurrentThread"); }
}
+
+ internal static string ObjectDisposed_StreamIsClosed
+ {
+ get { return Environment.GetResourceString("ObjectDisposed_StreamIsClosed"); }
+ }
}
// 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
// The minimum supported DateTime range for the calendar.
- [System.Runtime.InteropServices.ComVisible(false)]
public virtual DateTime MinSupportedDateTime
{
get
// The maximum supported DateTime range for the calendar.
- [System.Runtime.InteropServices.ComVisible(false)]
public virtual DateTime MaxSupportedDateTime
{
get
}
}
- [System.Runtime.InteropServices.ComVisible(false)]
public virtual CalendarAlgorithmType AlgorithmType
{
get
// Detect if the object is readonly.
//
////////////////////////////////////////////////////////////////////////
- [System.Runtime.InteropServices.ComVisible(false)]
public bool IsReadOnly
{
get { return (_isReadOnly); }
// Is the implementation of ICloneable.
//
////////////////////////////////////////////////////////////////////////
- [System.Runtime.InteropServices.ComVisible(false)]
public virtual object Clone()
{
object o = MemberwiseClone();
// readonly.
//
////////////////////////////////////////////////////////////////////////
- [System.Runtime.InteropServices.ComVisible(false)]
public static Calendar ReadOnly(Calendar calendar)
{
if (calendar == null) { throw new ArgumentNullException(nameof(calendar)); }
// 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));
// 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))
namespace System.Globalization
{
[Serializable]
- [System.Runtime.InteropServices.ComVisible(true)]
public enum CalendarWeekRule
{
FirstDay = 0, // Week 1 begins on the first day of the year
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 };
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
{
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;
}
// 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;
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)
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
}
- [System.Runtime.InteropServices.ComVisible(false)]
public override DateTime MaxSupportedDateTime
{
get
}
}
- 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",
}
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)
{
}
- [System.Runtime.InteropServices.ComVisible(false)]
public override int GetEra(DateTime time)
{
CheckTicksRange(time.Ticks);
}
- [System.Runtime.InteropServices.ComVisible(false)]
public override int[] Eras
{
get
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)
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));
{
get { throw new NotImplementedException(); }
}
-
+
internal bool IsReplacementCulture
{
get { throw new NotImplementedException(); }
}
-
}
}
// 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
_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));
// the rest are obsolete or not valid on Linux
namespace System.Globalization
-{
+{
[Serializable]
[Flags]
public enum CultureTypes
[Obsolete("This value has been deprecated. Please use other values in CultureTypes.")]
FrameworkCultures = 0x0040, // will return only the v2 cultures marked as Framework culture.
}
-}
+}
//
// The enumeration constants used in NumberFormatInfo.DigitSubstitution.
//
+
namespace System.Globalization
{
[Serializable]
////////////////////////////////////////////////////////////////////////////
[Serializable]
- [System.Runtime.InteropServices.ComVisible(true)]
public abstract class EastAsianLunisolarCalendar : Calendar
{
internal const int LeapMonth = 0;
// 1 BeforeCurrentEra (BC)
[Serializable]
- [System.Runtime.InteropServices.ComVisible(true)]
public class GregorianCalendar : Calendar
{
}
}
- [System.Runtime.InteropServices.ComVisible(false)]
public override DateTime MinSupportedDateTime
{
get
}
}
- [System.Runtime.InteropServices.ComVisible(false)]
public override DateTime MaxSupportedDateTime
{
get
}
}
- [System.Runtime.InteropServices.ComVisible(false)]
public override CalendarAlgorithmType AlgorithmType
{
get
// 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)
[Serializable]
- [System.Runtime.InteropServices.ComVisible(true)]
public class HebrewCalendar : Calendar
{
public static readonly int HebrewEra = 1;
{
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();
}
** "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);
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;
}
}
}
}
}
- finally {
+ finally
+ {
key.Close();
}
-
}
return (hijriAdvance);
}
*/
[Serializable]
- [System.Runtime.InteropServices.ComVisible(true)]
public partial class HijriCalendar : Calendar
{
public static readonly int HijriEra = 1;
internal static readonly DateTime calendarMaxValue = DateTime.MaxValue;
- [System.Runtime.InteropServices.ComVisible(false)]
public override DateTime MinSupportedDateTime
{
get
}
- [System.Runtime.InteropServices.ComVisible(false)]
public override DateTime MaxSupportedDateTime
{
get
}
}
- [System.Runtime.InteropServices.ComVisible(false)]
public override CalendarAlgorithmType AlgorithmType
{
get
// 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);
namespace System.Globalization
{
- sealed partial class IdnMapping
+ public sealed partial class IdnMapping
{
private unsafe string GetAsciiCore(char* unicode, int count)
{
// Look in the registry key and see if we can find any ranges
int iFoundEras = 0;
EraInfo[] registryEraRanges = null;
-
+
try
{
// Need to access registry
// Remember we found one.
registryEraRanges[iFoundEras] = era;
- iFoundEras++;
+ iFoundEras++;
}
}
}
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;
}
}
{
// Need inputs
if (value == null || data == null) return null;
-
+
//
// Get Date
//
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;
// 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
// 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] : " ";
}
}
}
[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
}
}
- [System.Runtime.InteropServices.ComVisible(false)]
public override DateTime MaxSupportedDateTime
{
get
}
}
- [System.Runtime.InteropServices.ComVisible(false)]
public override CalendarAlgorithmType AlgorithmType
{
get
[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));
// 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));
}
}
- 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",
}
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)
//* Julia 0001/01/03 9999/10/19
[Serializable]
- [System.Runtime.InteropServices.ComVisible(true)]
public class JulianCalendar : Calendar
{
public static readonly int JulianEra = 1;
internal int MaxYear = 9999;
- [System.Runtime.InteropServices.ComVisible(false)]
public override DateTime MinSupportedDateTime
{
get
}
}
- [System.Runtime.InteropServices.ComVisible(false)]
public override DateTime MaxSupportedDateTime
{
get
}
}
- [System.Runtime.InteropServices.ComVisible(false)]
public override CalendarAlgorithmType AlgorithmType
{
get
// 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);
[Serializable]
- [System.Runtime.InteropServices.ComVisible(true)]
public class KoreanCalendar : Calendar
{
//
internal GregorianCalendarHelper helper;
- [System.Runtime.InteropServices.ComVisible(false)]
public override DateTime MinSupportedDateTime
{
get
}
}
- [System.Runtime.InteropServices.ComVisible(false)]
public override DateTime MaxSupportedDateTime
{
get
}
}
- [System.Runtime.InteropServices.ComVisible(false)]
public override CalendarAlgorithmType AlgorithmType
{
get
[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));
// 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));
}
}
- 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",
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)
using System.Diagnostics;
using System.Diagnostics.Contracts;
- [System.Runtime.InteropServices.ComVisible(true)]
[Serializable]
public partial class SortKey
{
using System;
using System.Diagnostics.Contracts;
-namespace System.Globalization
+namespace System.Globalization
{
[Serializable]
public sealed class SortVersion : IEquatable<SortVersion>
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);
}
return false;
}
- public bool Equals(SortVersion other)
+ public bool Equals(SortVersion other)
{
- if (other == null)
+ if (other == null)
{
return false;
}
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);
}
return true;
}
- public static bool operator !=(SortVersion left, SortVersion right)
+ public static bool operator !=(SortVersion left, SortVersion right)
{
return !(left == right);
}
namespace System.Globalization
{
[Serializable]
- [System.Runtime.InteropServices.ComVisible(true)]
public class StringInfo
{
[OptionalField(VersionAdded = 2)]
}
}
- [System.Runtime.InteropServices.ComVisible(false)]
public override bool Equals(Object value)
{
StringInfo that = value as StringInfo;
return (false);
}
- [System.Runtime.InteropServices.ComVisible(false)]
public override int GetHashCode()
{
return _str.GetHashCode();
============================================================================*/
[Serializable]
- [System.Runtime.InteropServices.ComVisible(true)]
public class TaiwanCalendar : Calendar
{
//
internal static readonly DateTime calendarMinValue = new DateTime(1912, 1, 1);
- [System.Runtime.InteropServices.ComVisible(false)]
public override DateTime MinSupportedDateTime
{
get
}
}
- [System.Runtime.InteropServices.ComVisible(false)]
public override DateTime MaxSupportedDateTime
{
get
}
}
- [System.Runtime.InteropServices.ComVisible(false)]
public override CalendarAlgorithmType AlgorithmType
{
get
[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));
// 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));
}
}
- 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",
}
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)
//
[Serializable]
- [System.Runtime.InteropServices.ComVisible(true)]
public class TextElementEnumerator : IEnumerator
{
private String _str;
}
}
- [System.Runtime.InteropServices.ComVisible(false)]
public int LCID
{
get
// Detect if the object is readonly.
//
////////////////////////////////////////////////////////////////////////
- [System.Runtime.InteropServices.ComVisible(false)]
public bool IsReadOnly
{
get { return (_isReadOnly); }
// readonly.
//
////////////////////////////////////////////////////////////////////////
- [System.Runtime.InteropServices.ComVisible(false)]
public static TextInfo ReadOnly(TextInfo textInfo)
{
if (textInfo == null) { throw new ArgumentNullException(nameof(textInfo)); }
============================================================================*/
[Serializable]
- [System.Runtime.InteropServices.ComVisible(true)]
public class ThaiBuddhistCalendar : Calendar
{
// Initialize our era info.
internal GregorianCalendarHelper helper;
- [System.Runtime.InteropServices.ComVisible(false)]
public override DateTime MinSupportedDateTime
{
get
}
}
- [System.Runtime.InteropServices.ComVisible(false)]
public override DateTime MaxSupportedDateTime
{
get
}
}
- [System.Runtime.InteropServices.ComVisible(false)]
public override CalendarAlgorithmType AlgorithmType
{
get
[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));
// 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));
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
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Microsoft.Win32.SafeHandles;
-using System.Threading.Tasks;
-using System.Diagnostics;
-using System.Threading;
-
-namespace System.IO
-{
- public partial class FileStream : Stream
- {
- public override IAsyncResult BeginRead(byte[] array, int offset, int numBytes, AsyncCallback callback, object state)
- {
- if (array == null)
- throw new ArgumentNullException(nameof(array));
- if (offset < 0)
- throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
- if (numBytes < 0)
- throw new ArgumentOutOfRangeException(nameof(numBytes), SR.ArgumentOutOfRange_NeedNonNegNum);
- if (array.Length - offset < numBytes)
- throw new ArgumentException(SR.Argument_InvalidOffLen);
-
- if (IsClosed) throw new ObjectDisposedException(SR.ObjectDisposed_FileClosed);
- if (!CanRead) throw new NotSupportedException(SR.NotSupported_UnreadableStream);
-
- if (!IsAsync)
- return base.BeginRead(array, offset, numBytes, callback, state);
- else
- return TaskToApm.Begin(ReadAsyncInternal(array, offset, numBytes, CancellationToken.None), callback, state);
- }
-
- public override IAsyncResult BeginWrite(byte[] array, int offset, int numBytes, AsyncCallback callback, object state)
- {
- if (array == null)
- throw new ArgumentNullException(nameof(array));
- if (offset < 0)
- throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
- if (numBytes < 0)
- throw new ArgumentOutOfRangeException(nameof(numBytes), SR.ArgumentOutOfRange_NeedNonNegNum);
- if (array.Length - offset < numBytes)
- throw new ArgumentException(SR.Argument_InvalidOffLen);
-
- if (IsClosed) throw new ObjectDisposedException(SR.ObjectDisposed_FileClosed);
- if (!CanWrite) throw new NotSupportedException(SR.NotSupported_UnwritableStream);
-
- if (!IsAsync)
- return base.BeginWrite(array, offset, numBytes, callback, state);
- else
- return TaskToApm.Begin(WriteAsyncInternal(array, offset, numBytes, CancellationToken.None), callback, state);
- }
-
- public override int EndRead(IAsyncResult asyncResult)
- {
- if (asyncResult == null)
- throw new ArgumentNullException(nameof(asyncResult));
-
- if (!IsAsync)
- return base.EndRead(asyncResult);
- else
- return TaskToApm.End<int>(asyncResult);
- }
-
- public override void EndWrite(IAsyncResult asyncResult)
- {
- if (asyncResult == null)
- throw new ArgumentNullException(nameof(asyncResult));
-
- if (!IsAsync)
- base.EndWrite(asyncResult);
- else
- TaskToApm.End(asyncResult);
- }
- }
-}
this(path, mode, access, share, bufferSize, useAsync ? FileOptions.Asynchronous : FileOptions.None)
{ }
- internal FileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options, string msgPath, bool bFromProxy)
- : this(path, mode, access, share, bufferSize, options, msgPath, bFromProxy, useLongPath: false)
- {
- }
-
- internal FileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options, string msgPath, bool bFromProxy, bool useLongPath)
- : this(path, mode, access, share, bufferSize, options)
- {
- // msgPath is the path that is handed back to untrusted code, CoreCLR is always full trust
- // bFromProxy is also related to asserting rights for limited trust and also can be ignored
- // useLongPath was used to get around the legacy MaxPath check, this is no longer applicable as everything supports long paths
- // checkHost is also related to limited trust scenarios
- }
-
public FileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options)
{
if (path == null)
return handle.IsAsync.HasValue ? handle.IsAsync.Value : false;
}
- // InternalOpen, InternalCreate, and InternalAppend:
- // Factory methods for FileStream used by File, FileInfo, and ReadLinesIterator
- // Specifies default access and sharing options for FileStreams created by those classes
- internal static FileStream InternalOpen(string path, int bufferSize = DefaultBufferSize, bool useAsync = DefaultIsAsync)
- {
- return new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize, useAsync);
- }
-
- internal static FileStream InternalCreate(string path, int bufferSize = DefaultBufferSize, bool useAsync = DefaultIsAsync)
- {
- return new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read, bufferSize, useAsync);
- }
-
- internal static FileStream InternalAppend(string path, int bufferSize = DefaultBufferSize, bool useAsync = DefaultIsAsync)
- {
- return new FileStream(path, FileMode.Append, FileAccess.Write, FileShare.Read, bufferSize, useAsync);
- }
-
[Obsolete("This property has been deprecated. Please use FileStream's SafeFileHandle property instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public virtual IntPtr Handle { get { return SafeFileHandle.DangerousGetHandle(); } }
// on Dispose(false) call.
Dispose(false);
}
+
+ public override IAsyncResult BeginRead(byte[] array, int offset, int numBytes, AsyncCallback callback, object state)
+ {
+ if (array == null)
+ throw new ArgumentNullException(nameof(array));
+ if (offset < 0)
+ throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
+ if (numBytes < 0)
+ throw new ArgumentOutOfRangeException(nameof(numBytes), SR.ArgumentOutOfRange_NeedNonNegNum);
+ if (array.Length - offset < numBytes)
+ throw new ArgumentException(SR.Argument_InvalidOffLen);
+
+ if (IsClosed) throw new ObjectDisposedException(SR.ObjectDisposed_FileClosed);
+ if (!CanRead) throw new NotSupportedException(SR.NotSupported_UnreadableStream);
+
+ if (!IsAsync)
+ return base.BeginRead(array, offset, numBytes, callback, state);
+ else
+ return TaskToApm.Begin(ReadAsyncInternal(array, offset, numBytes, CancellationToken.None), callback, state);
+ }
+
+ public override IAsyncResult BeginWrite(byte[] array, int offset, int numBytes, AsyncCallback callback, object state)
+ {
+ if (array == null)
+ throw new ArgumentNullException(nameof(array));
+ if (offset < 0)
+ throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
+ if (numBytes < 0)
+ throw new ArgumentOutOfRangeException(nameof(numBytes), SR.ArgumentOutOfRange_NeedNonNegNum);
+ if (array.Length - offset < numBytes)
+ throw new ArgumentException(SR.Argument_InvalidOffLen);
+
+ if (IsClosed) throw new ObjectDisposedException(SR.ObjectDisposed_FileClosed);
+ if (!CanWrite) throw new NotSupportedException(SR.NotSupported_UnwritableStream);
+
+ if (!IsAsync)
+ return base.BeginWrite(array, offset, numBytes, callback, state);
+ else
+ return TaskToApm.Begin(WriteAsyncInternal(array, offset, numBytes, CancellationToken.None), callback, state);
+ }
+
+ public override int EndRead(IAsyncResult asyncResult)
+ {
+ if (asyncResult == null)
+ throw new ArgumentNullException(nameof(asyncResult));
+
+ if (!IsAsync)
+ return base.EndRead(asyncResult);
+ else
+ return TaskToApm.End<int>(asyncResult);
+ }
+
+ public override void EndWrite(IAsyncResult asyncResult)
+ {
+ if (asyncResult == null)
+ throw new ArgumentNullException(nameof(asyncResult));
+
+ if (!IsAsync)
+ base.EndWrite(asyncResult);
+ else
+ TaskToApm.End(asyncResult);
+ }
}
}
</ItemGroup>
<ItemGroup>
<FileStreamSources Include="$(CoreFxSourcesRoot)\System\IO\FileStream.cs" />
- <FileStreamSources Include="$(CoreFxSourcesRoot)\System\IO\FileStream.NetStandard17.cs" />
<FileStreamSources Include="$(CoreFxSourcesRoot)\System\IO\Error.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetsUnix)' == 'true'">
{
byte[] bytes;
using(FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read,
- FileStream.DefaultBufferSize, FileOptions.None, Path.GetFileName(path), false, false)) {
+ FileStream.DefaultBufferSize, FileOptions.None)) {
// Do a blocking read
int index = 0;
long fileLength = fs.Length;
throw new ArgumentOutOfRangeException(nameof(bufferSize), Environment.GetResourceString("ArgumentOutOfRange_NeedPosNum"));
Contract.EndContractBlock();
- Stream stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, DefaultFileStreamBufferSize, FileOptions.SequentialScan, Path.GetFileName(path), false, false);
+ Stream stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, DefaultFileStreamBufferSize, FileOptions.SequentialScan);
Init(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize, false);
}
public ResourceReader(String fileName)
{
_resCache = new Dictionary<String, ResourceLocator>(FastResourceComparer.Default);
- _store = new BinaryReader(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read, DefaultFileStreamBufferSize, FileOptions.RandomAccess, Path.GetFileName(fileName), false), Encoding.UTF8);
+ _store = new BinaryReader(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read, DefaultFileStreamBufferSize, FileOptions.RandomAccess), Encoding.UTF8);
BCLDebug.Log("RESMGRFILEFORMAT", "ResourceReader .ctor(String). UnmanagedMemoryStream: "+(_ums!=null));
try {