You've already forked linux-packaging-mono
Imported Upstream version 3.12.0
Former-commit-id: cf92446697332992ec36726e78eb8703e1f259d7
This commit is contained in:
@@ -1354,6 +1354,11 @@ namespace System {
|
||||
DomainUnload(this, null);
|
||||
}
|
||||
|
||||
internal void DoUnhandledException (UnhandledExceptionEventArgs args) {
|
||||
if (UnhandledException != null)
|
||||
UnhandledException (this, args);
|
||||
}
|
||||
|
||||
internal byte[] GetMarshalledDomainObjRef ()
|
||||
{
|
||||
ObjRef oref = RemotingServices.Marshal (AppDomain.CurrentDomain, null, typeof (AppDomain));
|
||||
@@ -1405,6 +1410,10 @@ namespace System {
|
||||
[method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
|
||||
public event UnhandledExceptionEventHandler UnhandledException;
|
||||
|
||||
#if NET_4_5
|
||||
public event EventHandler<FirstChanceExceptionEventArgs> FirstChanceException;
|
||||
#endif
|
||||
|
||||
#if NET_4_0
|
||||
[MonoTODO]
|
||||
public bool IsHomogenous {
|
||||
|
@@ -107,7 +107,7 @@ namespace System
|
||||
"H:mzzz",
|
||||
"H:m",
|
||||
"H tt", // Specifies AM to disallow '8'.
|
||||
"H'\u6642'm'\u5206's'\u79D2'",
|
||||
"H'\u6642'm'\u5206's'\u79D2'"
|
||||
};
|
||||
|
||||
// DateTime.Parse date patterns extend ParseExact patterns as follows:
|
||||
@@ -885,6 +885,9 @@ namespace System
|
||||
if (_DoParse (s, firstPart, ParseTimeFormats [j], false, out result, out dto, dfi, styles, true, ref incompleteFormat, ref longYear))
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_DoParse (s, firstPart, "zzz", false, out result, out dto, dfi, styles, true, ref incompleteFormat, ref longYear))
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1466,6 +1469,25 @@ namespace System
|
||||
if (num_parsed == -1)
|
||||
return false;
|
||||
fractionalSeconds = decimalNumber / Math.Pow(10.0, num_parsed);
|
||||
|
||||
//Parse ISO8601 with an unlimited number of fractional digits.
|
||||
if (!exact && num == 6 && hour != -1 && minute != -1 && second != -1) {
|
||||
var total_num_parsed = num_parsed;
|
||||
while (true) {
|
||||
valuePos += num_parsed;
|
||||
decimalNumber = (double) _ParseNumber (s, valuePos, 0, 1, leading_zeros, sloppy_parsing, out num_parsed);
|
||||
if (num_parsed < 1) {
|
||||
num_parsed = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
total_num_parsed += num_parsed;
|
||||
if (total_num_parsed > 15)
|
||||
continue; //not enough precision, ignore additional digits.
|
||||
|
||||
fractionalSeconds += decimalNumber / Math.Pow (10.0, total_num_parsed);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 't':
|
||||
if (!_ParseAmPm (s, valuePos, num > 0 ? 0 : 1, dfi, exact, out num_parsed, ref ampm))
|
||||
@@ -1722,7 +1744,7 @@ namespace System
|
||||
if (tzsign == -1) {
|
||||
if (result != DateTime.MinValue) {
|
||||
try {
|
||||
if ((style & DateTimeStyles.AssumeUniversal) != 0) {
|
||||
if (((style & DateTimeStyles.AssumeUniversal) != 0) || useutc) {
|
||||
dto = new DateTimeOffset (result, TimeSpan.Zero);
|
||||
} else if ((style & DateTimeStyles.AssumeLocal) != 0) {
|
||||
var offset = use_invariant ?
|
||||
|
@@ -44,7 +44,7 @@ using System.Threading;
|
||||
namespace System {
|
||||
|
||||
[ComVisible (true)]
|
||||
public static class Environment {
|
||||
public static partial class Environment {
|
||||
|
||||
/*
|
||||
* This is the version number of the corlib-runtime interface. When
|
||||
@@ -475,9 +475,6 @@ namespace System {
|
||||
}
|
||||
#endif
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
private extern static string GetWindowsFolderPath (int folder);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the fully qualified path of the
|
||||
/// folder specified by the "folder" parameter
|
||||
@@ -486,6 +483,12 @@ namespace System {
|
||||
{
|
||||
return GetFolderPath (folder, SpecialFolderOption.None);
|
||||
}
|
||||
|
||||
// for monotouch, not monotouch_runtime
|
||||
#if !(MONOTOUCH && FULL_AOT_RUNTIME)
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
private extern static string GetWindowsFolderPath (int folder);
|
||||
|
||||
#if NET_4_0
|
||||
public
|
||||
#endif
|
||||
@@ -577,38 +580,15 @@ namespace System {
|
||||
|
||||
// personal == ~
|
||||
case SpecialFolder.Personal:
|
||||
#if MONOTOUCH
|
||||
return Path.Combine (home, "Documents");
|
||||
#else
|
||||
return home;
|
||||
#endif
|
||||
|
||||
// use FDO's CONFIG_HOME. This data will be synced across a network like the windows counterpart.
|
||||
case SpecialFolder.ApplicationData:
|
||||
#if MONOTOUCH
|
||||
{
|
||||
string dir = Path.Combine (Path.Combine (home, "Documents"), ".config");
|
||||
if (option == SpecialFolderOption.Create){
|
||||
if (!Directory.Exists (dir))
|
||||
Directory.CreateDirectory (dir);
|
||||
}
|
||||
return dir;
|
||||
}
|
||||
#else
|
||||
return config;
|
||||
#endif
|
||||
|
||||
//use FDO's DATA_HOME. This is *NOT* synced
|
||||
case SpecialFolder.LocalApplicationData:
|
||||
#if MONOTOUCH
|
||||
{
|
||||
string dir = Path.Combine (home, "Documents");
|
||||
if (!Directory.Exists (dir))
|
||||
Directory.CreateDirectory (dir);
|
||||
|
||||
return dir;
|
||||
}
|
||||
#else
|
||||
return data;
|
||||
#endif
|
||||
|
||||
case SpecialFolder.Desktop:
|
||||
case SpecialFolder.DesktopDirectory:
|
||||
@@ -705,8 +685,9 @@ namespace System {
|
||||
return "/usr/share";
|
||||
default:
|
||||
throw new ArgumentException ("Invalid SpecialFolder");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
[EnvironmentPermission (SecurityAction.Demand, Unrestricted=true)]
|
||||
@@ -884,7 +865,7 @@ namespace System {
|
||||
}
|
||||
|
||||
// private methods
|
||||
#if MOBILE
|
||||
#if (MONOTOUCH || MONODROID || XAMMAC)
|
||||
internal const bool IsRunningOnWindows = false;
|
||||
#else
|
||||
internal static bool IsRunningOnWindows {
|
||||
|
44
mcs/class/corlib/System/FirstChanceExceptionEventArgs.cs
Normal file
44
mcs/class/corlib/System/FirstChanceExceptionEventArgs.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// System.FirstChangeExceptionEventArgs.cs
|
||||
//
|
||||
// Copyright 2014 Xamarin Inc (http://www.xamarin.com).
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#if NET_4_5
|
||||
using System;
|
||||
|
||||
public class FirstChanceExceptionEventArgs : EventArgs
|
||||
{
|
||||
Exception exception;
|
||||
|
||||
public FirstChanceExceptionEventArgs (Exception exception) {
|
||||
this.exception = exception;
|
||||
}
|
||||
|
||||
public Exception Exception {
|
||||
get {
|
||||
return exception;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@@ -24,8 +24,6 @@
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#if NET_4_0
|
||||
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace System
|
||||
@@ -36,7 +34,10 @@ namespace System
|
||||
#elif NET_4_0
|
||||
[TypeForwardedFrom (Consts.AssemblySystemCore_3_5)]
|
||||
#endif
|
||||
public class InvalidTimeZoneException : Exception
|
||||
#if NET_4_0
|
||||
public
|
||||
#endif
|
||||
class InvalidTimeZoneException : Exception
|
||||
{
|
||||
public InvalidTimeZoneException () : base ()
|
||||
{}
|
||||
@@ -51,5 +52,3 @@ namespace System
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -2688,24 +2688,8 @@ namespace System
|
||||
}
|
||||
}
|
||||
|
||||
internal unsafe void InternalSetLength (int newLength)
|
||||
{
|
||||
if (newLength > length)
|
||||
throw new ArgumentOutOfRangeException ("newLength", "newLength as to be <= length");
|
||||
|
||||
// zero terminate, we can pass string objects directly via pinvoke
|
||||
// we also zero the rest of the string, since the new GC needs to be
|
||||
// able to handle the changing size (it will skip the 0 bytes).
|
||||
fixed (char * pStr = &start_char) {
|
||||
char *p = pStr + newLength;
|
||||
char *end = pStr + length;
|
||||
while (p < end) {
|
||||
p [0] = '\0';
|
||||
p++;
|
||||
}
|
||||
}
|
||||
length = newLength;
|
||||
}
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
internal extern void InternalSetLength (int newLength);
|
||||
|
||||
[ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.MayFail)]
|
||||
// When modifying it, GetCaseInsensitiveHashCode() should be modified as well.
|
||||
|
@@ -614,41 +614,76 @@ namespace System
|
||||
|
||||
element = parser.GetNextElement ();
|
||||
switch (element.Type) {
|
||||
case FormatElementType.Days:
|
||||
value = Math.Abs (Days);
|
||||
break;
|
||||
case FormatElementType.Hours:
|
||||
value = Math.Abs (Hours);
|
||||
break;
|
||||
case FormatElementType.Minutes:
|
||||
value = Math.Abs (Minutes);
|
||||
break;
|
||||
case FormatElementType.Seconds:
|
||||
value = Math.Abs (Seconds);
|
||||
break;
|
||||
case FormatElementType.Ticks:
|
||||
case FormatElementType.TicksUppercase:
|
||||
value = Math.Abs (Milliseconds);
|
||||
if (value == 0) {
|
||||
if (element.Type == FormatElementType.Ticks)
|
||||
break;
|
||||
case FormatElementType.Days:
|
||||
value = Math.Abs (Days);
|
||||
break;
|
||||
case FormatElementType.Hours:
|
||||
value = Math.Abs (Hours);
|
||||
break;
|
||||
case FormatElementType.Minutes:
|
||||
value = Math.Abs (Minutes);
|
||||
break;
|
||||
case FormatElementType.Seconds:
|
||||
value = Math.Abs (Seconds);
|
||||
break;
|
||||
case FormatElementType.Ticks:
|
||||
case FormatElementType.TicksUppercase:
|
||||
//
|
||||
// TODO: Unify with datetime ticks formatting
|
||||
//
|
||||
value = (int)(_ticks % TicksPerSecond);
|
||||
if (value == 0) {
|
||||
if (element.Type == FormatElementType.Ticks)
|
||||
break;
|
||||
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
int threshold = (int)Math.Pow (10, element.IntValue);
|
||||
while (value >= threshold)
|
||||
int total_length = element.IntValue;
|
||||
const int max_length = 7;
|
||||
int digits = max_length;
|
||||
for (var dv = (int)Math.Pow (10, max_length - 1); dv > value; dv /= 10, --digits)
|
||||
;
|
||||
|
||||
//
|
||||
// Skip only leading zeros in F format
|
||||
//
|
||||
if (element.Type == FormatElementType.TicksUppercase && max_length - digits >= total_length)
|
||||
continue;
|
||||
|
||||
//
|
||||
// Add leading zeros
|
||||
//
|
||||
int leading = 0;
|
||||
for (; leading < total_length && leading < max_length - digits; ++leading) {
|
||||
sb.Append ("0");
|
||||
}
|
||||
|
||||
if (total_length == leading)
|
||||
continue;
|
||||
|
||||
//
|
||||
// Remove trailing zeros
|
||||
//
|
||||
if (element.Type == FormatElementType.TicksUppercase) {
|
||||
while (value % 10 == 0)
|
||||
value /= 10;
|
||||
sb.Append (value.ToString ());
|
||||
continue;
|
||||
case FormatElementType.EscapedChar:
|
||||
sb.Append (element.CharValue);
|
||||
continue;
|
||||
case FormatElementType.Literal:
|
||||
sb.Append (element.StringValue);
|
||||
continue;
|
||||
default:
|
||||
throw new FormatException ("The format is not recognized.");
|
||||
}
|
||||
|
||||
var max_value = (int)Math.Pow (10, total_length - leading);
|
||||
while (value >= max_value)
|
||||
value /= 10;
|
||||
|
||||
sb.Append (value.ToString (CultureInfo.InvariantCulture));
|
||||
continue;
|
||||
case FormatElementType.EscapedChar:
|
||||
sb.Append (element.CharValue);
|
||||
continue;
|
||||
case FormatElementType.Literal:
|
||||
sb.Append (element.StringValue);
|
||||
continue;
|
||||
default:
|
||||
throw new FormatException ("The format is not recognized.");
|
||||
}
|
||||
|
||||
sb.Append (value.ToString ("D" + element.IntValue.ToString ()));
|
||||
|
@@ -144,22 +144,7 @@ namespace System
|
||||
return DateTime.SpecifyKind (DateTime.MinValue, DateTimeKind.Local);
|
||||
}
|
||||
|
||||
DateTime local = DateTime.SpecifyKind (time.Add (utcOffset), DateTimeKind.Local);
|
||||
DaylightTime dlt = GetDaylightChanges (time.Year);
|
||||
if (dlt.Delta.Ticks == 0)
|
||||
return DateTime.SpecifyKind (local, DateTimeKind.Local);
|
||||
|
||||
// FIXME: check all of the combination of
|
||||
// - basis: local-based or UTC-based
|
||||
// - hemisphere: Northern or Southern
|
||||
// - offset: positive or negative
|
||||
|
||||
// PST should work fine here.
|
||||
if (local < dlt.End && dlt.End.Subtract (dlt.Delta) <= local)
|
||||
return DateTime.SpecifyKind (local, DateTimeKind.Local);
|
||||
|
||||
TimeSpan localOffset = GetUtcOffset (local);
|
||||
return DateTime.SpecifyKind (time.Add (localOffset), DateTimeKind.Local);
|
||||
return DateTime.SpecifyKind (time.Add (utcOffset), DateTimeKind.Local);
|
||||
}
|
||||
|
||||
public virtual DateTime ToUniversalTime (DateTime time)
|
||||
@@ -252,17 +237,6 @@ namespace System
|
||||
// A yearwise cache of DaylightTime.
|
||||
private Dictionary<int, DaylightTime> m_CachedDaylightChanges = new Dictionary<int, DaylightTime> (1);
|
||||
|
||||
// the offset when daylightsaving is not on (in ticks)
|
||||
private long m_ticksOffset;
|
||||
|
||||
// the offset when daylightsaving is not on.
|
||||
[NonSerialized]
|
||||
private TimeSpan utcOffsetWithOutDLS;
|
||||
|
||||
// the offset when daylightsaving is on.
|
||||
[NonSerialized]
|
||||
private TimeSpan utcOffsetWithDLS;
|
||||
|
||||
internal enum TimeZoneData
|
||||
{
|
||||
DaylightSavingStartIdx,
|
||||
@@ -315,8 +289,6 @@ namespace System
|
||||
m_standardName = Locale.GetText (names[(int)TimeZoneNames.StandardNameIdx]);
|
||||
m_daylightName = Locale.GetText (names[(int)TimeZoneNames.DaylightNameIdx]);
|
||||
|
||||
m_ticksOffset = data[(int)TimeZoneData.UtcOffsetIdx];
|
||||
|
||||
DaylightTime dlt = GetDaylightTimeFromData (data);
|
||||
m_CachedDaylightChanges.Add (now.Year, dlt);
|
||||
OnDeserialization (dlt);
|
||||
@@ -366,20 +338,7 @@ namespace System
|
||||
if (time.Kind == DateTimeKind.Utc)
|
||||
return TimeSpan.Zero;
|
||||
|
||||
if (IsDaylightSavingTime (time) && !IsAmbiguousTime (time))
|
||||
return utcOffsetWithDLS;
|
||||
|
||||
return utcOffsetWithOutDLS;
|
||||
}
|
||||
|
||||
private bool IsAmbiguousTime (DateTime time)
|
||||
{
|
||||
if (time.Kind == DateTimeKind.Utc)
|
||||
return false;
|
||||
|
||||
DaylightTime changes = GetDaylightChanges (time.Year);
|
||||
|
||||
return time < changes.End && time >= changes.End - changes.Delta;
|
||||
return TimeZoneInfo.Local.GetUtcOffset (time);
|
||||
}
|
||||
|
||||
void IDeserializationCallback.OnDeserialization (object sender)
|
||||
@@ -400,8 +359,6 @@ namespace System
|
||||
} else
|
||||
this_year = dlt.Start.Year;
|
||||
|
||||
utcOffsetWithOutDLS = new TimeSpan (m_ticksOffset);
|
||||
utcOffsetWithDLS = new TimeSpan (m_ticksOffset + dlt.Delta.Ticks);
|
||||
this_year_dlt = dlt;
|
||||
}
|
||||
|
||||
|
@@ -24,7 +24,6 @@
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#if NET_4_0
|
||||
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
@@ -36,7 +35,10 @@ namespace System
|
||||
#elif NET_4_0
|
||||
[TypeForwardedFrom (Consts.AssemblySystemCore_3_5)]
|
||||
#endif
|
||||
public class TimeZoneNotFoundException : Exception
|
||||
#if NET_4_0
|
||||
public
|
||||
#endif
|
||||
class TimeZoneNotFoundException : Exception
|
||||
{
|
||||
public TimeZoneNotFoundException () : base ()
|
||||
{}
|
||||
@@ -51,5 +53,3 @@ namespace System
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user