Imported Upstream version 4.6.0.125

Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-08-03 10:59:49 +00:00
parent a569aebcfd
commit e79aa3c0ed
17047 changed files with 3137615 additions and 392334 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -5,14 +5,15 @@ LIBRARY = WindowsBase.dll
LIB_REFS = System System.Xml
LIB_MCS_FLAGS = -unsafe
TEST_MCS_FLAGS = -unsafe -r:WindowsBase.dll -r:System.dll -r:System.Xml.dll -r:System.Core.dll
TEST_MCS_FLAGS = -unsafe
TEST_LIB_REFS = WindowsBase System System.Xml System.Core System.IO.Compression
ifeq (2.0, $(FRAMEWORK_VERSION))
LIB_MCS_FLAGS += -d:NET_3_0
endif
ifeq (4, $(FRAMEWORK_VERSION_MAJOR))
LIB_REFS += System.Xaml
TEST_MCS_FLAGS += -r:System.Xaml.dll
TEST_LIB_REFS += System.Xaml
endif
include ../../build/library.make

View File

@@ -1,14 +0,0 @@
2009-11-21 Raja R Harinath <harinath@hurrynot.org>
* INotifyCollectionChanged.cs [NET_4_0]: Forward type to System.dll.
* NotifyCollectionChangedAction.cs: Likewise.
* NotifyCollectionChangedEventArgs.cs: Likewise.
* NotifyCollectionChangedEventHandler.cs: Likewise.
2008-11-04 Chris Toshok <toshok@ximian.com>
* CollectionChangedEventManager.cs: implement this using the msdn
docs. Unfortunately we lack the ability to write unit tests at
the moment, as there's no (that I can find) public use of this
type in the api. Certainly not in WindowsBase.

View File

@@ -457,6 +457,8 @@ namespace System.IO.Packaging {
internal static void WriteRelationships (Dictionary <string, PackageRelationship> relationships, Stream stream)
{
stream.SetLength(0);
XmlDocument doc = new XmlDocument ();
XmlNamespaceManager manager = new XmlNamespaceManager (doc.NameTable);
manager.AddNamespace ("rel", RelationshipNamespace);

View File

@@ -95,8 +95,10 @@ namespace System.IO.Packaging {
{
// Ensure that all the data has been read out of the package
// stream already. Otherwise we'll lose data when we recreate the zip
foreach (ZipPackagePart part in Parts.Values)
part.GetStream ().Dispose ();
foreach (ZipPackagePart part in Parts.Values) {
if (part.Package != null)
part.GetStream ().Dispose ();
}
// Empty the package stream
PackageStream.Position = 0;
@@ -107,6 +109,9 @@ namespace System.IO.Packaging {
// Write all the part streams
foreach (ZipPackagePart part in Parts.Values) {
if (part.Package == null)
continue;
Stream partStream = part.GetStream ();
partStream.Seek (0, SeekOrigin.Begin);

View File

@@ -36,12 +36,12 @@ namespace System.Windows.Media {
[ValueSerializer (typeof (MatrixValueSerializer))]
public struct Matrix : IFormattable {
double m11;
double m12;
double m21;
double m22;
double offsetX;
double offsetY;
double _m11;
double _m12;
double _m21;
double _m22;
double _offsetX;
double _offsetY;
public Matrix (double m11,
double m12,
@@ -50,12 +50,12 @@ namespace System.Windows.Media {
double offsetX,
double offsetY)
{
this.m11 = m11;
this.m12 = m12;
this.m21 = m21;
this.m22 = m22;
this.offsetX = offsetX;
this.offsetY = offsetY;
this._m11 = m11;
this._m12 = m12;
this._m21 = m21;
this._m22 = m22;
this._offsetX = offsetX;
this._offsetY = offsetY;
}
public void Append (Matrix matrix)
@@ -67,30 +67,30 @@ namespace System.Windows.Media {
double _offsetX;
double _offsetY;
_m11 = m11 * matrix.M11 + m12 * matrix.M21;
_m12 = m11 * matrix.M12 + m12 * matrix.M22;
_m21 = m21 * matrix.M11 + m22 * matrix.M21;
_m22 = m21 * matrix.M12 + m22 * matrix.M22;
_m11 = this._m11 * matrix.M11 + this._m12 * matrix.M21;
_m12 = this._m11 * matrix.M12 + this._m12 * matrix.M22;
_m21 = this._m21 * matrix.M11 + this._m22 * matrix.M21;
_m22 = this._m21 * matrix.M12 + this._m22 * matrix.M22;
_offsetX = offsetX * matrix.M11 + offsetY * matrix.M21 + matrix.OffsetX;
_offsetY = offsetX * matrix.M12 + offsetY * matrix.M22 + matrix.OffsetY;
_offsetX = this._offsetX * matrix.M11 + this._offsetY * matrix.M21 + matrix.OffsetX;
_offsetY = this._offsetX * matrix.M12 + this._offsetY * matrix.M22 + matrix.OffsetY;
m11 = _m11;
m12 = _m12;
m21 = _m21;
m22 = _m22;
offsetX = _offsetX;
offsetY = _offsetY;
this._m11 = _m11;
this._m12 = _m12;
this._m21 = _m21;
this._m22 = _m22;
this._offsetX = _offsetX;
this._offsetY = _offsetY;
}
public bool Equals (Matrix value)
{
return (m11 == value.M11 &&
m12 == value.M12 &&
m21 == value.M21 &&
m22 == value.M22 &&
offsetX == value.OffsetX &&
offsetY == value.OffsetY);
return (_m11 == value.M11 &&
_m12 == value.M12 &&
_m21 == value.M21 &&
_m22 == value.M22 &&
_offsetX == value.OffsetX &&
_offsetY == value.OffsetY);
}
public override bool Equals (object o)
@@ -121,20 +121,20 @@ namespace System.Windows.Media {
/* 1/(ad-bc)[d -b; -c a] */
double _m11 = m22;
double _m12 = -m12;
double _m21 = -m21;
double _m22 = m11;
double _m11 = this._m22;
double _m12 = -this._m12;
double _m21 = -this._m21;
double _m22 = this._m11;
double _offsetX = m21 * offsetY - m22 * offsetX;
double _offsetY = m12 * offsetX - m11 * offsetY;
double _offsetX = this._m21 * this._offsetY - this._m22 * this._offsetX;
double _offsetY = this._m12 * this._offsetX - this._m11 * this._offsetY;
m11 = _m11 / d;
m12 = _m12 / d;
m21 = _m21 / d;
m22 = _m22 / d;
offsetX = _offsetX / d;
offsetY = _offsetY / d;
this._m11 = _m11 / d;
this._m12 = _m12 / d;
this._m21 = _m21 / d;
this._m22 = _m22 / d;
this._offsetX = _offsetX / d;
this._offsetY = _offsetY / d;
}
public static Matrix Multiply (Matrix trans1,
@@ -179,20 +179,20 @@ namespace System.Windows.Media {
double _offsetX;
double _offsetY;
_m11 = matrix.M11 * m11 + matrix.M12 * m21;
_m12 = matrix.M11 * m12 + matrix.M12 * m22;
_m21 = matrix.M21 * m11 + matrix.M22 * m21;
_m22 = matrix.M21 * m12 + matrix.M22 * m22;
_m11 = matrix.M11 * this._m11 + matrix.M12 * this._m21;
_m12 = matrix.M11 * this._m12 + matrix.M12 * this._m22;
_m21 = matrix.M21 * this._m11 + matrix.M22 * this._m21;
_m22 = matrix.M21 * this._m12 + matrix.M22 * this._m22;
_offsetX = matrix.OffsetX * m11 + matrix.OffsetY * m21 + offsetX;
_offsetY = matrix.OffsetX * m12 + matrix.OffsetY * m22 + offsetY;
_offsetX = matrix.OffsetX * this._m11 + matrix.OffsetY * this._m21 + this._offsetX;
_offsetY = matrix.OffsetX * this._m12 + matrix.OffsetY * this._m22 + this._offsetY;
m11 = _m11;
m12 = _m12;
m21 = _m21;
m22 = _m22;
offsetX = _offsetX;
offsetY = _offsetY;
this._m11 = _m11;
this._m12 = _m12;
this._m21 = _m21;
this._m22 = _m22;
this._offsetX = _offsetX;
this._offsetY = _offsetY;
}
public void Rotate (double angle)
@@ -272,9 +272,9 @@ namespace System.Windows.Media {
public void SetIdentity ()
{
m11 = m22 = 1.0;
m12 = m21 = 0.0;
offsetX = offsetY = 0.0;
_m11 = _m22 = 1.0;
_m12 = _m21 = 0.0;
_offsetX = _offsetY = 0.0;
}
public void Skew (double skewX,
@@ -306,7 +306,7 @@ namespace System.Windows.Media {
return "Identity";
else
return string.Format ("{0},{1},{2},{3},{4},{5}",
m11, m12, m21, m22, offsetX, offsetY);
_m11, _m12, _m21, _m22, _offsetX, _offsetY);
}
public string ToString (IFormatProvider provider)
@@ -339,8 +339,8 @@ namespace System.Windows.Media {
public void Translate (double offsetX,
double offsetY)
{
this.offsetX += offsetX;
this.offsetY += offsetY;
this._offsetX += offsetX;
this._offsetY += offsetY;
}
public void TranslatePrepend (double offsetX,
@@ -352,7 +352,7 @@ namespace System.Windows.Media {
}
public double Determinant {
get { return m11 * m22 - m12 * m21; }
get { return _m11 * _m22 - _m12 * _m21; }
}
public bool HasInverse {
@@ -368,28 +368,28 @@ namespace System.Windows.Media {
}
public double M11 {
get { return m11; }
set { m11 = value; }
get { return _m11; }
set { _m11 = value; }
}
public double M12 {
get { return m12; }
set { m12 = value; }
get { return _m12; }
set { _m12 = value; }
}
public double M21 {
get { return m21; }
set { m21 = value; }
get { return _m21; }
set { _m21 = value; }
}
public double M22 {
get { return m22; }
set { m22 = value; }
get { return _m22; }
set { _m22 = value; }
}
public double OffsetX {
get { return offsetX; }
set { offsetX = value; }
get { return _offsetX; }
set { _offsetX = value; }
}
public double OffsetY {
get { return offsetY; }
set { offsetY = value; }
get { return _offsetY; }
set { _offsetY = value; }
}
}

View File

@@ -1,54 +0,0 @@
2007-01-25 Miguel de Icaza <miguel@novell.com>
* DispatcherTimer.cs: Add new class.
* Dispatcher.cs (ExitAllframes): Implement.
(everywhere): Add support for hooks.
* DispatcherHooks: Implement
* DispatcherOperation.cs: Store result.
* Dispatcher.cs:
Check frame.Continue for early termination.
PokableQueue: new class used so we can move DispatcherOperation
tasks from one thread to another.
2007-01-24 Miguel de Icaza <miguel@novell.com>
* Dispatcher.cs: Implement reprioritization.
We now take locks instead of using a separate async queue, as
things like DispatcherOperation.Priority (reprioritization) can be
called from a separate thread without crashing.
2007-01-23 Miguel de Icaza <miguel@novell.com>
* Dispatcher.cs: Start with the Async methods.
2007-01-20 Miguel de Icaza <miguel@novell.com>
* Dispatcher.cs: Move all tasks, not only the first one from the
async queue into the proper priority queues.
Eliminate the `Task' class, it is mostly redundant, instead move
all the data into DispatcherOperation.
* DispatcherOperation.cs, DispatcherOperationStatus.cs: Add new
files.
* Dispatcher.cs: Make our class `Task' internal, so we can pass
that to DispatcherOperation.
* Dispatcher.cs: Queue will now queue
locally (if same thread) or post to the dispatcher queue if
invoked from a different thread.
2007-01-13 Miguel de Icaza <miguel@novell.com>
* Dispatcher.cs: Initially I thought this
was a stroke of genius. Looking at the actual results, it does
not seem as brilliant as I had hoped.

View File

@@ -1,22 +1,22 @@
// TODO:
// DispatcherObject returned by BeginInvoke must allow:
// * Waiting until delegate is invoked.
// See: BeginInvoke documentation for details
// DispatcherObject returned by BeginInvoke must allow:
// * Waiting until delegate is invoked.
// See: BeginInvoke documentation for details
//
// Implement the "Invoke" methods, they are currently not working.
// Implement the "Invoke" methods, they are currently not working.
//
// Add support for disabling the dispatcher and resuming it.
// Add support for Waiting for new tasks to be pushed, so that we dont busy loop.
// Add support for aborting an operation (emit the hook.operationaborted too)
// Add support for disabling the dispatcher and resuming it.
// Add support for Waiting for new tasks to be pushed, so that we dont busy loop.
// Add support for aborting an operation (emit the hook.operationaborted too)
//
// Very confusing information about Shutdown: it states that shutdown is
// not over, until all events are unwinded, and also states that all events
// are aborted at that point. See 'Dispatcher.InvokeShutdown' docs,
//
// Testing reveals that
// -> InvokeShutdown() stops processing, even if events are available,
// there is no "unwinding" of events, even of higher priority events,
// they are just ignored.
// -> InvokeShutdown() stops processing, even if events are available,
// there is no "unwinding" of events, even of higher priority events,
// they are just ignored.
//
// The documentation for the Dispatcher family is poorly written, complete
// sections are cut-and-pasted that add no value and the important pieces
@@ -43,9 +43,11 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
// Copyright (c) 2016 Quamotion (http://quamotion.mobi)
//
// Authors:
// Miguel de Icaza (miguel@novell.com)
// Frederik Carlier (frederik.carlier@quamotion.mobi)
//
using System;
using System.Collections;
@@ -181,6 +183,21 @@ namespace System.Windows.Threading {
return op;
}
public DispatcherOperation InvokeAsync (Action callback)
{
return this.BeginInvoke(callback);
}
public DispatcherOperation InvokeAsync (Action callback, DispatcherPriority priority)
{
return this.BeginInvoke(callback, priority);
}
public DispatcherOperation InvokeAsync (Action callback, DispatcherPriority priority, CancellationToken cancellationToken)
{
return this.BeginInvoke(callback, priority);
}
public object Invoke (Delegate method, params object[] args)
{
throw new NotImplementedException ();
@@ -521,32 +538,33 @@ namespace System.Windows.Threading {
public void Enqueue (object obj)
{
if (size == array.Length)
Grow ();
array[tail] = obj;
tail = (tail+1) % array.Length;
size++;
if (size == array.Length)
Grow ();
array[tail] = obj;
tail = (tail+1) % array.Length;
size++;
}
public object Dequeue ()
{
if (size < 1)
throw new InvalidOperationException ();
object result = array[head];
array [head] = null;
head = (head + 1) % array.Length;
size--;
return result;
}
{
if (size < 1)
throw new InvalidOperationException ();
object result = array[head];
array [head] = null;
head = (head + 1) % array.Length;
size--;
return result;
}
void Grow () {
int newc = array.Length * 2;
object[] new_contents = new object[newc];
array.CopyTo (new_contents, 0);
array = new_contents;
head = 0;
tail = head + size;
}
void Grow ()
{
int newc = array.Length * 2;
object[] new_contents = new object[newc];
array.CopyTo (new_contents, 0);
array = new_contents;
head = 0;
tail = head + size;
}
public int Count {
get {

View File

@@ -29,6 +29,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Security;
using System.Threading;
using System.Threading.Tasks;
namespace System.Windows.Threading {
@@ -90,6 +91,12 @@ namespace System.Windows.Threading {
throw new NotImplementedException ();
}
public Task Task {
get {
throw new NotImplementedException();
}
}
public DispatcherOperationStatus Status {
get {
return status;

View File

@@ -38,14 +38,14 @@ namespace System.Windows {
[ValueSerializer (typeof(Int32RectValueSerializer))]
public struct Int32Rect : IFormattable
{
int x, y, width, height;
int _x, _y, _width, _height;
public Int32Rect (int x, int y, int width, int height)
{
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this._x = x;
this._y = y;
this._width = width;
this._height = height;
}
public static bool operator != (Int32Rect int32Rect1, Int32Rect int32Rect2)
@@ -63,35 +63,35 @@ namespace System.Windows {
}
public int Height {
get { return height; }
set { height = value; }
get { return _height; }
set { _height = value; }
}
public bool IsEmpty {
get { return width == 0 && height == 0; }
get { return _width == 0 && _height == 0; }
}
public int Width {
get { return width; }
set { width = value; }
get { return _width; }
set { _width = value; }
}
public int X {
get { return x; }
set { x = value; }
get { return _x; }
set { _x = value; }
}
public int Y {
get { return y; }
set { y = value; }
get { return _y; }
set { _y = value; }
}
public bool Equals (Int32Rect value)
{
return (x == value.x &&
y == value.y &&
width == value.width &&
height == value.height);
return (_x == value._x &&
_y == value._y &&
_width == value._width &&
_height == value._height);
}
public override bool Equals (object o)
@@ -121,7 +121,7 @@ namespace System.Windows {
{
if (IsEmpty)
return "Empty";
return String.Format ("{0},{1},{2},{3}", x, y, width, height);
return String.Format ("{0},{1},{2},{3}", _x, _y, _width, _height);
}
public string ToString (IFormatProvider provider)

View File

@@ -39,18 +39,18 @@ namespace System.Windows {
{
public Point (double x, double y)
{
this.x = x;
this.y = y;
this._x = x;
this._y = y;
}
public double X {
get { return x; }
set { x = value; }
get { return _x; }
set { _x = value; }
}
public double Y {
get { return y; }
set { y = value; }
get { return _y; }
set { _y = value; }
}
public override bool Equals (object o)
@@ -62,19 +62,19 @@ namespace System.Windows {
public bool Equals (Point value)
{
return x == value.X && y == value.Y;
return _x == value.X && _y == value.Y;
}
public override int GetHashCode ()
{
return (x.GetHashCode() ^ y.GetHashCode());
return (_x.GetHashCode() ^ _y.GetHashCode());
}
public void Offset (double offsetX, double offsetY)
{
x += offsetX;
y += offsetY;
_x += offsetX;
_y += offsetY;
}
public static Point Add (Point point, Vector vector)
@@ -179,7 +179,7 @@ namespace System.Windows {
seperator = ";";
else
seperator = ",";
object[] ob = { this.x, seperator, this.y };
object[] ob = { this._x, seperator, this._y };
return string.Format(formatProvider, "{0:" + format + "}{1}{2:" + format + "}", ob);
}
@@ -189,7 +189,7 @@ namespace System.Windows {
return this.ToString(format, formatProvider);
}
double x;
double y;
double _x;
double _y;
}
}

View File

@@ -41,9 +41,9 @@ namespace System.Windows {
{
public Rect (Size size)
{
x = y = 0.0;
width = size.Width;
height = size.Height;
_x = _y = 0.0;
_width = size.Width;
_height = size.Height;
}
public Rect (Point point, Vector vector) : this (point, Point.Add (point, vector))
@@ -52,21 +52,21 @@ namespace System.Windows {
public Rect (Point point1, Point point2)
{
if (point1.X < point2.X) {
x = point1.X;
width = point2.X - point1.X;
_x = point1.X;
_width = point2.X - point1.X;
}
else {
x = point2.X;
width = point1.X - point2.X;
_x = point2.X;
_width = point1.X - point2.X;
}
if (point1.Y < point2.Y) {
y = point1.Y;
height = point2.Y - point1.Y;
_y = point1.Y;
_height = point2.Y - point1.Y;
}
else {
y = point2.Y;
height = point1.Y - point2.Y;
_y = point2.Y;
_height = point1.Y - point2.Y;
}
}
@@ -74,26 +74,26 @@ namespace System.Windows {
{
if (width < 0 || height < 0)
throw new ArgumentException ("width and height must be non-negative.");
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this._x = x;
this._y = y;
this._width = width;
this._height = height;
}
public Rect (Point location, Size size)
{
x = location.X;
y = location.Y;
width = size.Width;
height = size.Height;
_x = location.X;
_y = location.Y;
_width = size.Width;
_height = size.Height;
}
public bool Equals (Rect value)
{
return (x == value.X &&
y == value.Y &&
width == value.Width &&
height == value.Height);
return (_x == value.X &&
_y == value.Y &&
_width == value.Width &&
_height == value.Height);
}
public static bool operator != (Rect rect1, Rect rect2)
@@ -172,11 +172,11 @@ namespace System.Windows {
public void Inflate (double width, double height)
{
// XXX any error checking like in the static case?
x -= width;
y -= height;
_x -= width;
_y -= height;
this.width += 2*width;
this.height += 2*height;
this._width += 2*width;
this._height += 2*height;
}
public void Inflate (Size size)
@@ -192,20 +192,20 @@ namespace System.Windows {
public void Intersect(Rect rect)
{
double _x = Math.Max (x, rect.x);
double _y = Math.Max (y, rect.y);
double _x = Math.Max (this._x, rect._x);
double _y = Math.Max (this._y, rect._y);
double _width = Math.Min (Right, rect.Right) - _x;
double _height = Math.Min (Bottom, rect.Bottom) - _y;
if (_width < 0 || _height < 0) {
x = y = Double.PositiveInfinity;
width = height = Double.NegativeInfinity;
this._x = this._y = Double.PositiveInfinity;
this._width = this._height = Double.NegativeInfinity;
}
else {
x = _x;
y = _y;
width = _width;
height = _height;
this._x = _x;
this._y = _y;
this._width = _width;
this._height = _height;
}
}
@@ -218,8 +218,8 @@ namespace System.Windows {
public void Offset(double offsetX, double offsetY)
{
x += offsetX;
y += offsetY;
_x += offsetX;
_y += offsetY;
}
public static Rect Offset(Rect rect, double offsetX, double offsetY)
@@ -231,8 +231,8 @@ namespace System.Windows {
public void Offset (Vector offsetVector)
{
x += offsetVector.X;
y += offsetVector.Y;
_x += offsetVector.X;
_y += offsetVector.Y;
}
public static Rect Offset (Rect rect, Vector offsetVector)
@@ -244,10 +244,10 @@ namespace System.Windows {
public void Scale(double scaleX, double scaleY)
{
x *= scaleX;
y *= scaleY;
width *= scaleX;
height *= scaleY;
_x *= scaleX;
_y *= scaleY;
_width *= scaleX;
_height *= scaleY;
}
public void Transform (Matrix matrix)
@@ -283,10 +283,10 @@ namespace System.Windows {
var right = Math.Max (Right, rect.Right);
var bottom = Math.Max (Bottom, rect.Bottom);
x = left;
y = top;
width = right - left;
height = bottom - top;
_x = left;
_y = top;
_width = right - left;
_height = bottom - top;
}
public void Union(Point point)
@@ -336,37 +336,37 @@ namespace System.Windows {
"{{0:{0}}}{1}{{1:{0}}}{1}{{2:{0}}}{1}{{3:{0}}}",
format, separator);
return String.Format (provider, rectFormat,
x, y, width, height);
_x, _y, _width, _height);
}
public static Rect Empty {
get {
Rect r = new Rect ();
r.x = r.y = Double.PositiveInfinity;
r.width = r.height = Double.NegativeInfinity;
r._x = r._y = Double.PositiveInfinity;
r._width = r._height = Double.NegativeInfinity;
return r;
}
}
public bool IsEmpty {
get {
return (x == Double.PositiveInfinity &&
y == Double.PositiveInfinity &&
width == Double.NegativeInfinity &&
height == Double.NegativeInfinity);
return (_x == Double.PositiveInfinity &&
_y == Double.PositiveInfinity &&
_width == Double.NegativeInfinity &&
_height == Double.NegativeInfinity);
}
}
public Point Location {
get {
return new Point (x, y);
return new Point (_x, _y);
}
set {
if (IsEmpty)
throw new InvalidOperationException ("Cannot modify this property on the Empty Rect.");
x = value.X;
y = value.Y;
_x = value.X;
_y = value.Y;
}
}
@@ -374,39 +374,39 @@ namespace System.Windows {
get {
if (IsEmpty)
return Size.Empty;
return new Size (width, height);
return new Size (_width, _height);
}
set {
if (IsEmpty)
throw new InvalidOperationException ("Cannot modify this property on the Empty Rect.");
width = value.Width;
height = value.Height;
_width = value.Width;
_height = value.Height;
}
}
public double X {
get { return x; }
get { return _x; }
set {
if (IsEmpty)
throw new InvalidOperationException ("Cannot modify this property on the Empty Rect.");
x = value;
_x = value;
}
}
public double Y {
get { return y; }
get { return _y; }
set {
if (IsEmpty)
throw new InvalidOperationException ("Cannot modify this property on the Empty Rect.");
y = value;
_y = value;
}
}
public double Width {
get { return width; }
get { return _width; }
set {
if (IsEmpty)
throw new InvalidOperationException ("Cannot modify this property on the Empty Rect.");
@@ -414,12 +414,12 @@ namespace System.Windows {
if (value < 0)
throw new ArgumentException ("width must be non-negative.");
width = value;
_width = value;
}
}
public double Height {
get { return height; }
get { return _height; }
set {
if (IsEmpty)
throw new InvalidOperationException ("Cannot modify this property on the Empty Rect.");
@@ -427,24 +427,24 @@ namespace System.Windows {
if (value < 0)
throw new ArgumentException ("height must be non-negative.");
height = value;
_height = value;
}
}
public double Left {
get { return x; }
get { return _x; }
}
public double Top {
get { return y; }
get { return _y; }
}
public double Right {
get { return x + width; }
get { return _x + _width; }
}
public double Bottom {
get { return y + height; }
get { return _y + _height; }
}
public Point TopLeft {
@@ -463,9 +463,9 @@ namespace System.Windows {
get { return new Point (Right, Bottom); }
}
double x;
double y;
double width;
double height;
double _x;
double _y;
double _width;
double _height;
}
}

View File

@@ -40,13 +40,13 @@ namespace System.Windows {
if (width < 0 || height < 0)
throw new ArgumentException ("Width and Height must be non-negative.");
this.width = width;
this.height = height;
this._width = width;
this._height = height;
}
public bool Equals (Size value)
{
return width == value.Width && height == value.Height;
return _width == value.Width && _height == value.Height;
}
public override bool Equals (object o)
@@ -76,7 +76,7 @@ namespace System.Windows {
{
if (IsEmpty)
return "Empty";
return String.Format ("{0},{1}", width, height);
return String.Format ("{0},{1}", _width, _height);
}
public string ToString (IFormatProvider provider)
@@ -91,13 +91,13 @@ namespace System.Windows {
public bool IsEmpty {
get {
return (width == Double.NegativeInfinity &&
height == Double.NegativeInfinity);
return (_width == Double.NegativeInfinity &&
_height == Double.NegativeInfinity);
}
}
public double Height {
get { return height; }
get { return _height; }
set {
if (IsEmpty)
throw new InvalidOperationException ("Cannot modify this property on the Empty Size.");
@@ -105,12 +105,12 @@ namespace System.Windows {
if (value < 0)
throw new ArgumentException ("height must be non-negative.");
height = value;
_height = value;
}
}
public double Width {
get { return width; }
get { return _width; }
set {
if (IsEmpty)
throw new InvalidOperationException ("Cannot modify this property on the Empty Size.");
@@ -118,14 +118,14 @@ namespace System.Windows {
if (value < 0)
throw new ArgumentException ("width must be non-negative.");
width = value;
_width = value;
}
}
public static Size Empty {
get {
Size s = new Size ();
s.width = s.height = Double.NegativeInfinity;
s._width = s._height = Double.NegativeInfinity;
return s;
}
}
@@ -151,7 +151,7 @@ namespace System.Windows {
return !size1.Equals (size2);
}
double width;
double height;
double _width;
double _height;
}
}

View File

@@ -38,13 +38,13 @@ namespace System.Windows {
{
public Vector (double x, double y)
{
this.x = x;
this.y = y;
this._x = x;
this._y = y;
}
public bool Equals (Vector value)
{
return x == value.X && y == value.Y;
return _x == value.X && _y == value.Y;
}
public override bool Equals (object o)
@@ -62,7 +62,7 @@ namespace System.Windows {
string IFormattable.ToString (string format, IFormatProvider provider)
{
return string.Format (provider, "{0:" + format + "},{1:" + format + "}", x, y);
return string.Format (provider, "{0:" + format + "},{1:" + format + "}", _x, _y);
}
public static bool Equals (Vector vector1, Vector vector2)
@@ -128,8 +128,8 @@ namespace System.Windows {
public void Negate ()
{
x = -x;
y = -y;
_x = -_x;
_y = -_y;
}
public void Normalize ()
@@ -139,8 +139,8 @@ namespace System.Windows {
return;
double l = Math.Sqrt (ls);
x /= l;
y /= l;
_x /= l;
_y /= l;
}
public static Vector Subtract (Vector vector1, Vector vector2)
@@ -155,7 +155,7 @@ namespace System.Windows {
public override string ToString ()
{
return String.Format ("{0},{1}", x, y);
return String.Format ("{0},{1}", _x, _y);
}
public string ToString (IFormatProvider provider)
@@ -168,17 +168,17 @@ namespace System.Windows {
}
public double LengthSquared {
get { return x * x + y * y; }
get { return _x * _x + _y * _y; }
}
public double X {
get { return x; }
set { x = value; }
get { return _x; }
set { _x = value; }
}
public double Y {
get { return y; }
set { y = value; }
get { return _y; }
set { _y = value; }
}
/* operators */
@@ -249,8 +249,8 @@ namespace System.Windows {
return Add (vector1, vector2);
}
double x;
double y;
double _x;
double _y;
}
}

View File

@@ -184,5 +184,33 @@ namespace MonoTests.System.IO.Packaging {
d.RelationshipType == node.Attributes["Type"].InnerText));
}
}
[Test]
public void CheckRelationshipDeletion ()
{
AddThreeRelationShips ();
package.Flush ();
foreach (PackageRelationship p in new List<PackageRelationship> (package.GetRelationships ()).Skip(1))
package.DeleteRelationship (p.Id);
PackagePart part = package.GetPart (new Uri ("/_rels/.rels", UriKind.Relative));
Assert.IsNotNull (package.GetPart (new Uri ("/_RELS/.RELS", UriKind.Relative)), "#0");
package.Flush ();
Assert.IsNotNull (part, "#1");
Stream stream = part.GetStream ();
Assert.IsTrue (stream.Length > 0, "#2a");
XmlDocument doc = new XmlDocument ();
XmlNamespaceManager manager = new XmlNamespaceManager (doc.NameTable);
manager.AddNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships");
doc.Load (new StreamReader (stream));
Assert.IsNotNull (doc.SelectSingleNode ("/rel:Relationships", manager), "#2b");
XmlNodeList list = doc.SelectNodes ("/rel:Relationships/*", manager);
Assert.AreEqual (1, list.Count);
}
}
}

View File

@@ -27,6 +27,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.IO.Packaging;
using System.Linq;
using System.Text;
@@ -116,7 +117,7 @@ namespace MonoTests.System.IO.Packaging {
package = Package.Open (path);
package.Close ();
package = Package.Open (path);
}
}
[Test]
public void Close_FileStreamNotClosed ()
@@ -416,5 +417,27 @@ namespace MonoTests.System.IO.Packaging {
File.Create (path).Close ();
package = Package.Open (path, FileMode.OpenOrCreate, FileAccess.Write);
}
[Test]
public void Check_ZipDateTime ()
{
using (var zipStream = new FileStream (path, FileMode.OpenOrCreate, FileAccess.ReadWrite))
using (package = Package.Open (zipStream, FileMode.OpenOrCreate)) {
var part = package.CreatePart (new Uri ("/test", UriKind.Relative), "test/type");
using (var stream = part.GetStream ())
stream.Write (new byte [1024 * 1024], 0, 1024 * 1024);
}
using (var stream = new FileStream (path, FileMode.Open, FileAccess.Read))
using (var archive = new ZipArchive(stream))
{
foreach (var entry in archive.Entries)
{
Assert.AreEqual (DateTime.Now.Year, entry.LastWriteTime.Year);
Assert.AreEqual (DateTime.Now.Month, entry.LastWriteTime.Month);
Assert.AreEqual (DateTime.Now.Day, entry.LastWriteTime.Day);
}
}
}
}
}

View File

@@ -42,4 +42,4 @@ System.Windows.Markup/MarkupExtensionReturnTypeAttributeTest.cs
System.Windows.Markup/ValueSerializerTest.cs
System.Windows.Media/MatrixTest.cs
System.Windows.Threading/DispatcherTest.cs
System.Windows.Threading/DispatcherTimerTest.cs
System.Windows.Threading/DispatcherTimerTest.cs

View File

@@ -5,9 +5,11 @@
//
using System;
using System.Runtime.InteropServices;
namespace zipsharp
{
[StructLayoutAttribute (LayoutKind.Sequential)]
struct ZipFileInfo
{
ZipTime date;
@@ -38,7 +40,7 @@ namespace zipsharp
public ZipFileInfo (DateTime fileTime)
{
date = new ZipTime (fileTime);
dosDate = new IntPtr ((int)fileTime.ToFileTime ());
dosDate = IntPtr.Zero;
internalFileAttributes = IntPtr.Zero;
externalFileAttributes = IntPtr.Zero;
}

View File

@@ -25,13 +25,13 @@ namespace zipsharp
minute = (uint) time.Minute;
hour = (uint) time.Hour;
day = (uint) time.Day;
month = (uint) time.Month;
month = (uint) time.Month - 1;
year = (uint) time.Year;
}
public DateTime Date
{
get { return new DateTime ((int) year, (int) month, (int) day, (int) hour, (int) minute, (int) second); }
get { return new DateTime ((int) year, (int) month + 1, (int) day, (int) hour, (int) minute, (int) second); }
}
}
}