You've already forked linux-packaging-mono
Imported Upstream version 3.12.0
Former-commit-id: cf92446697332992ec36726e78eb8703e1f259d7
This commit is contained in:
@@ -466,6 +466,11 @@ static class CCGregorianCalendar {
|
||||
/// <returns>An integer value representing the fixed day number.
|
||||
/// </returns>
|
||||
public static int fixed_from_dmy(int day, int month, int year) {
|
||||
if (month > 12) {
|
||||
year += CCMath.div_mod (out month, month - 1, 12);
|
||||
month++;
|
||||
}
|
||||
|
||||
int k = epoch - 1;
|
||||
k += 365 * (year-1);
|
||||
k += CCMath.div(year-1, 4);
|
||||
@@ -944,6 +949,12 @@ static class CCJulianCalendar {
|
||||
/// </returns>
|
||||
public static int fixed_from_dmy(int day, int month, int year) {
|
||||
int y = year < 0 ? year+1 : year;
|
||||
|
||||
if (month > 12) {
|
||||
y += CCMath.div_mod (out month, month - 1, 12);
|
||||
month++;
|
||||
}
|
||||
|
||||
int k = epoch - 1;
|
||||
k += 365 * (y-1);
|
||||
k += CCMath.div(y-1, 4);
|
||||
@@ -1371,6 +1382,13 @@ static class CCHebrewCalendar {
|
||||
/// <returns>An integer value representing the fixed day number.
|
||||
/// </returns>
|
||||
public static int fixed_from_dmy(int day, int month, int year) {
|
||||
var lastMonth = last_month_of_year (year);
|
||||
while (month > lastMonth) {
|
||||
year++;
|
||||
month -= lastMonth;
|
||||
lastMonth = last_month_of_year (year);
|
||||
}
|
||||
|
||||
int m;
|
||||
int k = epoch-1;
|
||||
k += elapsed_days(year);
|
||||
@@ -1686,6 +1704,11 @@ static class CCHijriCalendar {
|
||||
/// <returns>An integer value representing the fixed day number.
|
||||
/// </returns>
|
||||
public static int fixed_from_dmy(int day, int month, int year) {
|
||||
if (month > 12) {
|
||||
year += CCMath.div_mod (out month, month - 1, 12);
|
||||
month++;
|
||||
}
|
||||
|
||||
int k = epoch - 1;
|
||||
k += 354 * (year-1);
|
||||
k += CCMath.div(3+11*year, 30);
|
||||
|
@@ -6,10 +6,12 @@
|
||||
// Jim Richardson, develop@wtfo-guru.com
|
||||
// Dan Lewis, dihlewis@yahoo.co.uk
|
||||
// Sebastien Pouliot <sebastien@ximian.com>
|
||||
// Marek Safar <marek.safar@gmail.com>
|
||||
//
|
||||
// Copyright (C) 2002 Ximian, Inc.
|
||||
// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
|
||||
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
|
||||
// Copyright (C) 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
|
||||
@@ -441,25 +443,19 @@ namespace System.IO {
|
||||
throw MonoIO.GetException (Path.GetDirectoryName (path_with_pattern), (MonoIOError) error);
|
||||
|
||||
try {
|
||||
if (((rattr & FileAttributes.ReparsePoint) == 0)){
|
||||
if ((rattr & FileAttributes.Directory) != 0)
|
||||
yield return new DirectoryInfo (s);
|
||||
else
|
||||
yield return new FileInfo (s);
|
||||
}
|
||||
|
||||
while ((s = MonoIO.FindNext (handle, out rattr, out error)) != null){
|
||||
if ((rattr & FileAttributes.ReparsePoint) != 0)
|
||||
continue;
|
||||
if ((rattr & FileAttributes.Directory) != 0)
|
||||
yield return new DirectoryInfo (s);
|
||||
else
|
||||
yield return new FileInfo (s);
|
||||
|
||||
do {
|
||||
if (((rattr & FileAttributes.ReparsePoint) == 0)){
|
||||
if ((rattr & FileAttributes.Directory) != 0)
|
||||
yield return new DirectoryInfo (s);
|
||||
else
|
||||
yield return new FileInfo (s);
|
||||
}
|
||||
|
||||
if (((rattr & FileAttributes.Directory) != 0) && subdirs)
|
||||
foreach (FileSystemInfo child in EnumerateFileSystemInfos (s, searchPattern, searchOption))
|
||||
yield return child;
|
||||
}
|
||||
|
||||
} while ((s = MonoIO.FindNext (handle, out rattr, out error)) != null);
|
||||
} finally {
|
||||
MonoIO.FindClose (handle);
|
||||
}
|
||||
|
@@ -495,11 +495,15 @@ namespace System.Reflection
|
||||
|
||||
public override object [] GetCustomAttributes (bool inherit)
|
||||
{
|
||||
if (IsCreated)
|
||||
return generic_type.GetCustomAttributes (inherit);
|
||||
throw new NotSupportedException ();
|
||||
}
|
||||
|
||||
public override object [] GetCustomAttributes (Type attributeType, bool inherit)
|
||||
{
|
||||
if (IsCreated)
|
||||
return generic_type.GetCustomAttributes (attributeType, inherit);
|
||||
throw new NotSupportedException ();
|
||||
}
|
||||
|
||||
|
@@ -117,6 +117,7 @@ namespace System.Security.Cryptography {
|
||||
protected override void Dispose (bool disposing)
|
||||
{
|
||||
if (!_disposed) {
|
||||
_disposed = true;
|
||||
base.Dispose (disposing);
|
||||
}
|
||||
}
|
||||
|
@@ -436,7 +436,7 @@ fail_no_space:
|
||||
private unsafe static int InternalGetCharCount (
|
||||
byte[] bytes, int index, int count, uint leftOverBits,
|
||||
uint leftOverCount, object provider,
|
||||
ref DecoderFallbackBuffer fallbackBuffer, ref byte [] bufferArg, bool flush)
|
||||
ref DecoderFallbackBuffer fallbackBuffer, bool flush)
|
||||
{
|
||||
// Validate the parameters.
|
||||
if (bytes == null) {
|
||||
@@ -453,22 +453,22 @@ fail_no_space:
|
||||
return 0;
|
||||
fixed (byte *bptr = bytes)
|
||||
return InternalGetCharCount (bptr + index, count,
|
||||
leftOverBits, leftOverCount, provider, ref fallbackBuffer, ref bufferArg, flush);
|
||||
leftOverBits, leftOverCount, provider, ref fallbackBuffer, flush);
|
||||
}
|
||||
|
||||
private unsafe static int InternalGetCharCount (
|
||||
byte* bytes, int count, uint leftOverBits,
|
||||
byte* bytes, int byteCount, uint leftOverBits,
|
||||
uint leftOverCount, object provider,
|
||||
ref DecoderFallbackBuffer fallbackBuffer, ref byte [] bufferArg, bool flush)
|
||||
ref DecoderFallbackBuffer fallbackBuffer, bool flush)
|
||||
{
|
||||
int index = 0;
|
||||
int byteIndex = 0;
|
||||
|
||||
int length = 0;
|
||||
|
||||
if (leftOverCount == 0) {
|
||||
int end = index + count;
|
||||
for (; index < end; index++, count--) {
|
||||
if (bytes [index] < 0x80)
|
||||
int end = byteIndex + byteCount;
|
||||
for (; byteIndex < end; byteIndex++, byteCount--) {
|
||||
if (bytes [byteIndex] < 0x80)
|
||||
length++;
|
||||
else
|
||||
break;
|
||||
@@ -480,9 +480,11 @@ fail_no_space:
|
||||
uint leftBits = leftOverBits;
|
||||
uint leftSoFar = (leftOverCount & (uint)0x0F);
|
||||
uint leftSize = ((leftOverCount >> 4) & (uint)0x0F);
|
||||
while (count > 0) {
|
||||
ch = (uint)(bytes[index++]);
|
||||
--count;
|
||||
|
||||
int byteEnd = byteIndex + byteCount;
|
||||
for(; byteIndex < byteEnd; byteIndex++) {
|
||||
// Fetch the next character from the byte buffer.
|
||||
ch = (uint)(bytes[byteIndex]);
|
||||
if (leftSize == 0) {
|
||||
// Process a UTF-8 start character.
|
||||
if (ch < (uint)0x0080) {
|
||||
@@ -515,7 +517,7 @@ fail_no_space:
|
||||
leftSize = 6;
|
||||
} else {
|
||||
// Invalid UTF-8 start character.
|
||||
length += Fallback (provider, ref fallbackBuffer, ref bufferArg, bytes, index - 1, 1);
|
||||
length += Fallback (provider, ref fallbackBuffer, bytes, byteIndex, 1);
|
||||
}
|
||||
} else {
|
||||
// Process an extra byte in a multi-byte sequence.
|
||||
@@ -544,34 +546,34 @@ fail_no_space:
|
||||
break;
|
||||
}
|
||||
if (overlong) {
|
||||
length += Fallback (provider, ref fallbackBuffer, ref bufferArg, bytes, index - leftSoFar, leftSoFar);
|
||||
length += Fallback (provider, ref fallbackBuffer, bytes, byteIndex - leftSoFar, leftSoFar);
|
||||
--byteIndex; //process byte again
|
||||
}
|
||||
else if ((leftBits & 0xF800) == 0xD800) {
|
||||
// UTF-8 doesn't use surrogate characters
|
||||
length += Fallback (provider, ref fallbackBuffer, ref bufferArg, bytes, index - leftSoFar, leftSoFar);
|
||||
length += Fallback (provider, ref fallbackBuffer, bytes, byteIndex - leftSoFar, leftSoFar);
|
||||
}
|
||||
else
|
||||
++length;
|
||||
} else if (leftBits < (uint)0x110000) {
|
||||
length += 2;
|
||||
} else {
|
||||
length += Fallback (provider, ref fallbackBuffer, ref bufferArg, bytes, index - leftSoFar, leftSoFar);
|
||||
length += Fallback (provider, ref fallbackBuffer, bytes, byteIndex - leftSoFar, leftSoFar);
|
||||
}
|
||||
leftSize = 0;
|
||||
}
|
||||
} else {
|
||||
// Invalid UTF-8 sequence: clear and restart.
|
||||
length += Fallback (provider, ref fallbackBuffer, ref bufferArg, bytes, index - leftSoFar, leftSoFar);
|
||||
length += Fallback (provider, ref fallbackBuffer, bytes, byteIndex - leftSoFar, leftSoFar);
|
||||
leftSize = 0;
|
||||
--index;
|
||||
++count;
|
||||
--byteIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (flush && leftSize != 0) {
|
||||
// We had left-over bytes that didn't make up
|
||||
// a complete UTF-8 character sequence.
|
||||
length += Fallback (provider, ref fallbackBuffer, ref bufferArg, bytes, index - leftSoFar, leftSoFar);
|
||||
length += Fallback (provider, ref fallbackBuffer, bytes, byteIndex - leftSoFar, leftSoFar);
|
||||
}
|
||||
|
||||
// Return the final length to the caller.
|
||||
@@ -579,7 +581,7 @@ fail_no_space:
|
||||
}
|
||||
|
||||
// for GetCharCount()
|
||||
static unsafe int Fallback (object provider, ref DecoderFallbackBuffer buffer, ref byte [] bufferArg, byte* bytes, long index, uint size)
|
||||
static unsafe int Fallback (object provider, ref DecoderFallbackBuffer buffer, byte* bytes, long index, uint size)
|
||||
{
|
||||
if (buffer == null) {
|
||||
DecoderFallback fb = provider as DecoderFallback;
|
||||
@@ -588,20 +590,21 @@ fail_no_space:
|
||||
else
|
||||
buffer = ((Decoder) provider).FallbackBuffer;
|
||||
}
|
||||
if (bufferArg == null)
|
||||
bufferArg = new byte [1];
|
||||
int ret = 0;
|
||||
for (int i = 0; i < size; i++) {
|
||||
bufferArg [0] = bytes [(int) index + i];
|
||||
buffer.Fallback (bufferArg, 0);
|
||||
ret += buffer.Remaining;
|
||||
buffer.Reset ();
|
||||
}
|
||||
|
||||
var bufferArg = new byte [size];
|
||||
|
||||
for (int i = 0; i < size; i++)
|
||||
bufferArg [i] = bytes [(int) index + i];
|
||||
|
||||
buffer.Fallback (bufferArg, 0);
|
||||
int ret = buffer.Remaining;
|
||||
buffer.Reset ();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// for GetChars()
|
||||
static unsafe void Fallback (object provider, ref DecoderFallbackBuffer buffer, ref byte [] bufferArg, byte* bytes, long byteIndex, uint size,
|
||||
static unsafe void Fallback (object provider, ref DecoderFallbackBuffer buffer, byte* bytes, long byteIndex, uint size,
|
||||
char* chars, ref int charIndex)
|
||||
{
|
||||
if (buffer == null) {
|
||||
@@ -611,23 +614,23 @@ fail_no_space:
|
||||
else
|
||||
buffer = ((Decoder) provider).FallbackBuffer;
|
||||
}
|
||||
if (bufferArg == null)
|
||||
bufferArg = new byte [1];
|
||||
for (int i = 0; i < size; i++) {
|
||||
bufferArg [0] = bytes [byteIndex + i];
|
||||
buffer.Fallback (bufferArg, 0);
|
||||
while (buffer.Remaining > 0)
|
||||
chars [charIndex++] = buffer.GetNextChar ();
|
||||
buffer.Reset ();
|
||||
}
|
||||
|
||||
var bufferArg = new byte [size];
|
||||
|
||||
for (int i = 0; i < size; i++)
|
||||
bufferArg [i] = bytes [byteIndex + i];
|
||||
|
||||
buffer.Fallback (bufferArg, 0);
|
||||
while (buffer.Remaining > 0)
|
||||
chars [charIndex++] = buffer.GetNextChar ();
|
||||
buffer.Reset ();
|
||||
}
|
||||
|
||||
// Get the number of characters needed to decode a byte buffer.
|
||||
public override int GetCharCount (byte[] bytes, int index, int count)
|
||||
{
|
||||
DecoderFallbackBuffer buf = null;
|
||||
byte [] bufferArg = null;
|
||||
return InternalGetCharCount (bytes, index, count, 0, 0, DecoderFallback, ref buf, ref bufferArg, true);
|
||||
return InternalGetCharCount (bytes, index, count, 0, 0, DecoderFallback, ref buf, true);
|
||||
}
|
||||
|
||||
[CLSCompliant (false)]
|
||||
@@ -635,8 +638,7 @@ fail_no_space:
|
||||
public unsafe override int GetCharCount (byte* bytes, int count)
|
||||
{
|
||||
DecoderFallbackBuffer buf = null;
|
||||
byte [] bufferArg = null;
|
||||
return InternalGetCharCount (bytes, count, 0, 0, DecoderFallback, ref buf, ref bufferArg, true);
|
||||
return InternalGetCharCount (bytes, count, 0, 0, DecoderFallback, ref buf, true);
|
||||
}
|
||||
|
||||
// Get the characters that result from decoding a byte buffer.
|
||||
@@ -644,7 +646,7 @@ fail_no_space:
|
||||
byte[] bytes, int byteIndex, int byteCount, char[] chars,
|
||||
int charIndex, ref uint leftOverBits, ref uint leftOverCount,
|
||||
object provider,
|
||||
ref DecoderFallbackBuffer fallbackBuffer, ref byte [] bufferArg, bool flush)
|
||||
ref DecoderFallbackBuffer fallbackBuffer, bool flush)
|
||||
{
|
||||
// Validate the parameters.
|
||||
if (bytes == null) {
|
||||
@@ -668,10 +670,10 @@ fail_no_space:
|
||||
|
||||
fixed (char* cptr = chars) {
|
||||
if (byteCount == 0 || byteIndex == bytes.Length)
|
||||
return InternalGetChars (null, 0, cptr + charIndex, chars.Length - charIndex, ref leftOverBits, ref leftOverCount, provider, ref fallbackBuffer, ref bufferArg, flush);
|
||||
return InternalGetChars (null, 0, cptr + charIndex, chars.Length - charIndex, ref leftOverBits, ref leftOverCount, provider, ref fallbackBuffer, flush);
|
||||
// otherwise...
|
||||
fixed (byte* bptr = bytes)
|
||||
return InternalGetChars (bptr + byteIndex, byteCount, cptr + charIndex, chars.Length - charIndex, ref leftOverBits, ref leftOverCount, provider, ref fallbackBuffer, ref bufferArg, flush);
|
||||
return InternalGetChars (bptr + byteIndex, byteCount, cptr + charIndex, chars.Length - charIndex, ref leftOverBits, ref leftOverCount, provider, ref fallbackBuffer, flush);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -679,7 +681,7 @@ fail_no_space:
|
||||
byte* bytes, int byteCount, char* chars, int charCount,
|
||||
ref uint leftOverBits, ref uint leftOverCount,
|
||||
object provider,
|
||||
ref DecoderFallbackBuffer fallbackBuffer, ref byte [] bufferArg, bool flush)
|
||||
ref DecoderFallbackBuffer fallbackBuffer, bool flush)
|
||||
{
|
||||
int charIndex = 0, byteIndex = 0;
|
||||
int length = charCount;
|
||||
@@ -744,7 +746,7 @@ fail_no_space:
|
||||
leftSize = 6;
|
||||
} else {
|
||||
// Invalid UTF-8 start character.
|
||||
Fallback (provider, ref fallbackBuffer, ref bufferArg, bytes, byteIndex, 1, chars, ref posn);
|
||||
Fallback (provider, ref fallbackBuffer, bytes, byteIndex, 1, chars, ref posn);
|
||||
}
|
||||
} else {
|
||||
// Process an extra byte in a multi-byte sequence.
|
||||
@@ -773,11 +775,12 @@ fail_no_space:
|
||||
break;
|
||||
}
|
||||
if (overlong) {
|
||||
Fallback (provider, ref fallbackBuffer, ref bufferArg, bytes, byteIndex - leftSoFar, leftSoFar, chars, ref posn);
|
||||
Fallback (provider, ref fallbackBuffer, bytes, byteIndex - leftSoFar, leftSoFar, chars, ref posn);
|
||||
--byteIndex; //process byte again
|
||||
}
|
||||
else if ((leftBits & 0xF800) == 0xD800) {
|
||||
// UTF-8 doesn't use surrogate characters
|
||||
Fallback (provider, ref fallbackBuffer, ref bufferArg, bytes, byteIndex - leftSoFar, leftSoFar, chars, ref posn);
|
||||
Fallback (provider, ref fallbackBuffer, bytes, byteIndex - leftSoFar, leftSoFar, chars, ref posn);
|
||||
}
|
||||
else {
|
||||
if (posn >= length) {
|
||||
@@ -797,13 +800,13 @@ fail_no_space:
|
||||
chars[posn++] =
|
||||
(char)((leftBits & (uint)0x3FF) + (uint)0xDC00);
|
||||
} else {
|
||||
Fallback (provider, ref fallbackBuffer, ref bufferArg, bytes, byteIndex - leftSoFar, leftSoFar, chars, ref posn);
|
||||
Fallback (provider, ref fallbackBuffer, bytes, byteIndex - leftSoFar, leftSoFar, chars, ref posn);
|
||||
}
|
||||
leftSize = 0;
|
||||
}
|
||||
} else {
|
||||
// Invalid UTF-8 sequence: clear and restart.
|
||||
Fallback (provider, ref fallbackBuffer, ref bufferArg, bytes, byteIndex - leftSoFar, leftSoFar, chars, ref posn);
|
||||
Fallback (provider, ref fallbackBuffer, bytes, byteIndex - leftSoFar, leftSoFar, chars, ref posn);
|
||||
leftSize = 0;
|
||||
--byteIndex;
|
||||
}
|
||||
@@ -812,7 +815,7 @@ fail_no_space:
|
||||
if (flush && leftSize != 0) {
|
||||
// We had left-over bytes that didn't make up
|
||||
// a complete UTF-8 character sequence.
|
||||
Fallback (provider, ref fallbackBuffer, ref bufferArg, bytes, byteIndex - leftSoFar, leftSoFar, chars, ref posn);
|
||||
Fallback (provider, ref fallbackBuffer, bytes, byteIndex - leftSoFar, leftSoFar, chars, ref posn);
|
||||
}
|
||||
leftOverBits = leftBits;
|
||||
leftOverCount = (leftSoFar | (leftSize << 4));
|
||||
@@ -828,9 +831,8 @@ fail_no_space:
|
||||
uint leftOverBits = 0;
|
||||
uint leftOverCount = 0;
|
||||
DecoderFallbackBuffer buf = null;
|
||||
byte [] bufferArg = null;
|
||||
return InternalGetChars (bytes, byteIndex, byteCount, chars,
|
||||
charIndex, ref leftOverBits, ref leftOverCount, DecoderFallback, ref buf, ref bufferArg, true);
|
||||
charIndex, ref leftOverBits, ref leftOverCount, DecoderFallback, ref buf, true);
|
||||
}
|
||||
|
||||
[CLSCompliant (false)]
|
||||
@@ -838,11 +840,10 @@ fail_no_space:
|
||||
public unsafe override int GetChars (byte* bytes, int byteCount, char* chars, int charCount)
|
||||
{
|
||||
DecoderFallbackBuffer buf = null;
|
||||
byte [] bufferArg = null;
|
||||
uint leftOverBits = 0;
|
||||
uint leftOverCount = 0;
|
||||
return InternalGetChars (bytes, byteCount, chars,
|
||||
charCount, ref leftOverBits, ref leftOverCount, DecoderFallback, ref buf, ref bufferArg, true);
|
||||
charCount, ref leftOverBits, ref leftOverCount, DecoderFallback, ref buf, true);
|
||||
}
|
||||
|
||||
// Get the maximum number of bytes needed to encode a
|
||||
@@ -952,17 +953,15 @@ fail_no_space:
|
||||
public override int GetCharCount (byte[] bytes, int index, int count)
|
||||
{
|
||||
DecoderFallbackBuffer buf = null;
|
||||
byte [] bufferArg = null;
|
||||
return InternalGetCharCount (bytes, index, count,
|
||||
leftOverBits, leftOverCount, this, ref buf, ref bufferArg, false);
|
||||
leftOverBits, leftOverCount, this, ref buf, false);
|
||||
}
|
||||
public override int GetChars (byte[] bytes, int byteIndex,
|
||||
int byteCount, char[] chars, int charIndex)
|
||||
{
|
||||
DecoderFallbackBuffer buf = null;
|
||||
byte [] bufferArg = null;
|
||||
return InternalGetChars (bytes, byteIndex, byteCount,
|
||||
chars, charIndex, ref leftOverBits, ref leftOverCount, this, ref buf, ref bufferArg, false);
|
||||
chars, charIndex, ref leftOverBits, ref leftOverCount, this, ref buf, false);
|
||||
}
|
||||
|
||||
} // class UTF8Decoder
|
||||
|
@@ -345,7 +345,7 @@ public class UnicodeEncoding : Encoding
|
||||
if (charCount < 0) {
|
||||
throw new ArgumentOutOfRangeException ("charCount", _("ArgRange_NonNegative"));
|
||||
}
|
||||
return charCount * 2;
|
||||
return charCount * 2 + 2;
|
||||
}
|
||||
|
||||
// Get the maximum number of characters needed to decode a
|
||||
@@ -356,7 +356,7 @@ public class UnicodeEncoding : Encoding
|
||||
throw new ArgumentOutOfRangeException
|
||||
("byteCount", _("ArgRange_NonNegative"));
|
||||
}
|
||||
return byteCount / 2;
|
||||
return (byteCount + 1) / 2 + 1;
|
||||
}
|
||||
|
||||
// Get a Unicode-specific decoder that is attached to this instance.
|
||||
|
@@ -635,7 +635,7 @@ namespace System.Threading.Tasks
|
||||
|
||||
#region Cancel and Wait related method
|
||||
|
||||
internal void CancelReal ()
|
||||
internal void CancelReal (bool notifyParent = false)
|
||||
{
|
||||
Status = TaskStatus.Canceled;
|
||||
|
||||
@@ -643,6 +643,9 @@ namespace System.Threading.Tasks
|
||||
wait_handle.Set ();
|
||||
|
||||
ProcessCompleteDelegates ();
|
||||
|
||||
if (notifyParent && parent != null && NotifyParentOnFinish ())
|
||||
parent = null;
|
||||
}
|
||||
|
||||
void HandleGenericException (Exception e)
|
||||
|
@@ -94,7 +94,7 @@ namespace System.Threading.Tasks
|
||||
public void Execute ()
|
||||
{
|
||||
if (!ContinuationStatusCheck (continuationOptions)) {
|
||||
task.CancelReal ();
|
||||
task.CancelReal (notifyParent : true);
|
||||
task.Dispose ();
|
||||
return;
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -8,7 +8,7 @@ using Mono;
|
||||
using NUnit.Framework.SyntaxHelpers;
|
||||
#endif
|
||||
|
||||
namespace MonoTests {
|
||||
namespace MonoTests.Mono {
|
||||
|
||||
[TestFixture]
|
||||
public class DataConverterTest
|
||||
@@ -50,9 +50,9 @@ namespace MonoTests {
|
||||
[Test]
|
||||
public void StringAlignment ()
|
||||
{
|
||||
byte[] packed = Mono.DataConverter.Pack ("bz8", 1, TEST_STRING);
|
||||
byte[] packed = global::Mono.DataConverter.Pack ("bz8", 1, TEST_STRING);
|
||||
|
||||
IList unpacked = Mono.DataConverter.Unpack ("bz8", packed, 0);
|
||||
IList unpacked = global::Mono.DataConverter.Unpack ("bz8", packed, 0);
|
||||
|
||||
Assert.AreEqual(1, (byte) unpacked[0]);
|
||||
Assert.AreEqual(TEST_STRING, new string((char[]) unpacked[1]));
|
||||
@@ -65,4 +65,4 @@ namespace MonoTests {
|
||||
Assert.That ((f - 3.14f), Is.LessThanOrEqualTo (Single.Epsilon));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -3,6 +3,7 @@
|
||||
// (C) 2002 Ulrich Kunitz
|
||||
//
|
||||
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
@@ -797,6 +798,44 @@ public class CalendarTest {
|
||||
Assert.AreEqual (4363, kc.ToFourDigitYear (4363), "#4-4");
|
||||
}
|
||||
|
||||
public void TestDaysInYear (Calendar calendar, int year)
|
||||
{
|
||||
var daysInYear = calendar.GetDaysInYear (year);
|
||||
var daysInMonths = 0;
|
||||
var monthInYear = calendar.GetMonthsInYear (year);
|
||||
for (var m = 1; m <= monthInYear; m++)
|
||||
daysInMonths += calendar.GetDaysInMonth (year, m);
|
||||
|
||||
Assert.AreEqual (daysInYear, daysInMonths, string.Format("Calendar:{0} Year:{1}",calendar.GetType(), year));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DaysInYear ()
|
||||
{
|
||||
var calendars = new List<Calendar> (acal) {
|
||||
new UmAlQuraCalendar ()
|
||||
};
|
||||
|
||||
foreach (var calendar in calendars) {
|
||||
var minYear = calendar.GetYear (calendar.MinSupportedDateTime);
|
||||
var maxYear = calendar.GetYear (calendar.MaxSupportedDateTime) - 1 ;
|
||||
var midYear = calendar.GetYear (DateTime.Now);
|
||||
var yearsTested = Math.Min (1000, (maxYear - minYear) / 2);
|
||||
|
||||
midYear -= yearsTested / 2;
|
||||
|
||||
int y1 = minYear, y2 = maxYear, y3 = midYear;
|
||||
for (var i = 0; i < yearsTested; i++) {
|
||||
TestDaysInYear (calendar, y1);
|
||||
TestDaysInYear (calendar, y2);
|
||||
if (y3 > minYear && y3 < maxYear)
|
||||
TestDaysInYear (calendar, y3);
|
||||
|
||||
y1++; y2--; y3++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: more tests :-)
|
||||
} // class CalendarTest
|
||||
|
||||
|
@@ -10,6 +10,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
@@ -1059,6 +1060,23 @@ namespace MonoTests.System.IO
|
||||
Assert.AreEqual (TempFolder + DSC + "ToString.Test", info.ToString ());
|
||||
}
|
||||
|
||||
#if NET_4_0
|
||||
[Test]
|
||||
public void EnumerateFileSystemInfosTest ()
|
||||
{
|
||||
var dirInfo = new DirectoryInfo (TempFolder);
|
||||
dirInfo.CreateSubdirectory ("1").CreateSubdirectory ("a");
|
||||
dirInfo.CreateSubdirectory ("2").CreateSubdirectory ("b");
|
||||
|
||||
var l = new List<string> ();
|
||||
foreach (var info in dirInfo.EnumerateFileSystemInfos ("*", SearchOption.AllDirectories))
|
||||
l.Add (info.Name);
|
||||
|
||||
l.Sort ();
|
||||
Assert.AreEqual ("1,2,a,b", string.Join (",", l), "#1");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !MOBILE
|
||||
[Test]
|
||||
public void Serialization ()
|
||||
@@ -1111,7 +1129,7 @@ namespace MonoTests.System.IO
|
||||
try {
|
||||
Directory.CreateDirectory (path);
|
||||
Directory.CreateDirectory (dir);
|
||||
Mono.Unix.UnixSymbolicLinkInfo li = new Mono.Unix.UnixSymbolicLinkInfo (link);
|
||||
global::Mono.Unix.UnixSymbolicLinkInfo li = new global::Mono.Unix.UnixSymbolicLinkInfo (link);
|
||||
li.CreateSymbolicLinkTo (dir);
|
||||
|
||||
DirectoryInfo info = new DirectoryInfo (path);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user