Moving WindowsBase into the mcs tree
authorAlan McGovern <alan.mcgovern@gmail.com>
Mon, 3 Nov 2008 19:30:08 +0000 (19:30 -0000)
committerAlan McGovern <alan.mcgovern@gmail.com>
Mon, 3 Nov 2008 19:30:08 +0000 (19:30 -0000)
svn path=/trunk/mcs/; revision=117800

226 files changed:
mcs/class/WindowsBase/Assembly/AssemblyInfo.cs [new file with mode: 0644]
mcs/class/WindowsBase/ChangeLog [new file with mode: 0644]
mcs/class/WindowsBase/Makefile [new file with mode: 0644]
mcs/class/WindowsBase/System.Collections.ObjectModel/ObservableCollection.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Collections.ObjectModel/ReadOnlyObservableCollection.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Collections.Specialized/CollectionChangedEventManager.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Collections.Specialized/INotifyCollectionChanged.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Collections.Specialized/NotifyCollectionChangedAction.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Collections.Specialized/NotifyCollectionChangedEventArgs.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Collections.Specialized/NotifyCollectionChangedEventHandler.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.ComponentModel/CurrentChangedEventManager.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.ComponentModel/CurrentChangingEventArgs.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.ComponentModel/CurrentChangingEventHandler.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.ComponentModel/CurrentChangingEventManager.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.ComponentModel/DependencyPropertyDescriptor.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.ComponentModel/GroupDescription.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.ComponentModel/ICollectionView.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.ComponentModel/ICollectionViewFactory.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.ComponentModel/PropertyChangedEventManager.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.ComponentModel/PropertyFilterAttribute.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.ComponentModel/PropertyFilterOptions.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.ComponentModel/SortDescription.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.ComponentModel/SortDescriptionCollection.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Diagnostics/PresentationTraceLevel.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Diagnostics/PresentationTraceSources.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/CertificateEmbeddingOption.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/Check.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/CompressionOption.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/EncryptedPackageEnvelope.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/EncryptionOption.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/InvalidSignatureEventHandler.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/PackUriHelper.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/PackUriParser.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/Package.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/PackageDigitalSignature.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/PackageDigitalSignatureManager.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/PackagePart.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/PackagePartCollection.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/PackageProperties.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/PackageRelationship.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/PackageRelationshipCollection.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/PackageRelationshipSelector.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/PackageRelationshipSelectorType.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/RightsManagementInformation.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/SignatureVerificationEventArgs.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/StorageInfo.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/StreamInfo.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/TargetMode.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/VerifyResult.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/ZipPackage.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/ZipPackagePart.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO.Packaging/ZipPartStream.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.IO/FileFormatException.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Security.Permissions/MediaPermission.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Security.Permissions/MediaPermissionAttribute.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Security.Permissions/MediaPermissionAudio.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Security.Permissions/MediaPermissionImage.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Security.Permissions/MediaPermissionVideo.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Security.Permissions/WebBrowserPermission.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Security.Permissions/WebBrowserPermissionAttribute.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Security.Permissions/WebBrowserPermissionLevel.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Security.RightsManagement/AuthenticationType.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Security.RightsManagement/ContentGrant.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Security.RightsManagement/ContentRight.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Security.RightsManagement/ContentUser.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Security.RightsManagement/CryptoProvider.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Security.RightsManagement/LocalizedNameDescriptionPair.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Security.RightsManagement/PublishLicense.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Security.RightsManagement/RightsManagementException.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Security.RightsManagement/RightsManagementFailureCode.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Security.RightsManagement/SecureEnvironment.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Security.RightsManagement/UnsignedPublishLicense.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Security.RightsManagement/UseLicense.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Security.RightsManagement/UserActivationMode.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Converters/Int32RectValueSerializer.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Converters/PointValueSerializer.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Converters/RectValueSerializer.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Converters/SizeValueSerializer.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Converters/VectorValueSerializer.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Data/DataSourceProvider.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Input/FocusNavigationDirection.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Input/Key.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Input/KeyConverter.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Input/KeyInterop.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Input/KeyValueSerializer.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Input/ModifierKeys.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Input/ModifierKeysConverter.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Input/ModifierKeysValueSerializer.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Input/TraversalRequest.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Interop/ComponentDispatcher.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Interop/IKeyboardInputSink.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Interop/IKeyboardInputSite.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Interop/MSG.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Interop/ThreadMessageEventHandler.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup.Primitives/MarkupObject.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup.Primitives/MarkupProperty.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup/ConstructorArgumentAttribute.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup/ContentPropertyAttribute.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup/ContentWrapperAttribute.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup/DateTimeValueSerializer.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup/DependsOnAttribute.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup/DesignerSerializationOptions.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup/DesignerSerializationOptionsAttribute.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup/IComponentConnector.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup/INameScope.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup/IValueSerializerContext.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup/IXamlTypeResolver.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup/InternalTypeHelper.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup/MarkupExtension.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup/MarkupExtensionReturnTypeAttribute.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup/RootNamespaceAttribute.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup/RuntimeNamePropertyAttribute.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup/ServiceProviders.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup/TrimSurroundingWhitespaceAttribute.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup/ValueSerializer.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup/ValueSerializerAttribute.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup/WhitespaceSignificantCollectionAttribute.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup/XmlLangPropertyAttribute.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup/XmlnsCompatibleWithAttribute.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup/XmlnsDefinitionAttribute.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Markup/XmlnsPrefixAttribute.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Media.Converters/MatrixValueSerializer.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Media/DisableDpiAwarenessAttribute.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Media/Matrix.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Media/MatrixConverter.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Threading/ChangeLog [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Threading/Dispatcher.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Threading/DispatcherEventArgs.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Threading/DispatcherFrame.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Threading/DispatcherHookEventArgs.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Threading/DispatcherHookEventHandler.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Threading/DispatcherHooks.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Threading/DispatcherObject.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Threading/DispatcherOperation.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Threading/DispatcherOperationCallback.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Threading/DispatcherOperationStatus.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Threading/DispatcherPriority.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Threading/DispatcherProcessingDisabled.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Threading/DispatcherSynchronizationContext.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Threading/DispatcherTimer.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Threading/DispatcherUnhandledExceptionEventArgs.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Threading/DispatcherUnhandledExceptionEventHandler.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Threading/DispatcherUnhandledExceptionFilterEventArgs.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows.Threading/DispatcherUnhandledExceptionFilterEventHandler.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/AttachedPropertyBrowsableAttribute.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/AttachedPropertyBrowsableForTypeAttribute.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/AttachedPropertyBrowsableWhenAttributePresentAttribute.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/CoerceValueCallback.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/DependencyObject.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/DependencyObjectType.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/DependencyProperty.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/DependencyPropertyChangedEventArgs.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/DependencyPropertyChangedEventHandler.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/DependencyPropertyKey.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/Expression.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/ExpressionConverter.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/Freezable.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/IWeakEventListener.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/Int32Rect.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/Int32RectConverter.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/LocalValueEntry.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/LocalValueEnumerator.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/Point.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/PointConverter.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/PropertyChangedCallback.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/PropertyMetadata.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/Rect.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/RectConverter.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/Size.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/SizeConverter.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/ValidateValueCallback.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/Vector.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/VectorConverter.cs [new file with mode: 0644]
mcs/class/WindowsBase/System.Windows/WeakEventManager.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.Collections.ObjectModel/ObservableCollectionTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.IO.Packaging/FakePackage.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.IO.Packaging/FakePackagePart.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.IO.Packaging/FakePackagePartTests.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.IO.Packaging/FakePackageTests.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.IO.Packaging/FakeStream.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.IO.Packaging/PackUriHelperTests.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.IO.Packaging/PackagePartStreamTests.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.IO.Packaging/PackagePartTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.IO.Packaging/PackageRelationshipTests.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.IO.Packaging/PackageTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.IO.Packaging/TestBase.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.Windows.Markup/ConstructorArgumentAttributeTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.Windows.Markup/ContentPropertyAttributeTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.Windows.Markup/ContentWrapperAttributeTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.Windows.Markup/DateTimeValueSerializerTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.Windows.Markup/DependsOnAttributeTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.Windows.Markup/MarkupExtensionReturnTypeAttributeTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.Windows.Markup/ValueSerializerTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.Windows.Media/MatrixTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.Windows.Threading/DispatcherTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.Windows/DependencyObjectTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.Windows/DependencyObjectTypeTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.Windows/DependencyPropertyTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.Windows/FreezableTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.Windows/Int32RectConverterTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.Windows/Int32RectTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.Windows/PointConverterTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.Windows/PointTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.Windows/PropertyMetadataTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.Windows/RectConverterTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.Windows/RectTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.Windows/SizeConverterTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.Windows/SizeTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.Windows/VectorConverterTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/Test/System.Windows/VectorTest.cs [new file with mode: 0644]
mcs/class/WindowsBase/WindowsBase.dll.sources [new file with mode: 0644]
mcs/class/WindowsBase/WindowsBase_test.dll.sources [new file with mode: 0644]
mcs/class/WindowsBase/ZipSharp/IOFunctions.cs [new file with mode: 0644]
mcs/class/WindowsBase/ZipSharp/NativeUnzip.cs [new file with mode: 0644]
mcs/class/WindowsBase/ZipSharp/NativeZip.cs [new file with mode: 0644]
mcs/class/WindowsBase/ZipSharp/UnzipArchive.cs [new file with mode: 0644]
mcs/class/WindowsBase/ZipSharp/UnzipFileInfo.cs [new file with mode: 0644]
mcs/class/WindowsBase/ZipSharp/UnzipHandle.cs [new file with mode: 0644]
mcs/class/WindowsBase/ZipSharp/UnzipReadStream.cs [new file with mode: 0644]
mcs/class/WindowsBase/ZipSharp/ZipArchive.cs [new file with mode: 0644]
mcs/class/WindowsBase/ZipSharp/ZipFileInfo.cs [new file with mode: 0644]
mcs/class/WindowsBase/ZipSharp/ZipHandle.cs [new file with mode: 0644]
mcs/class/WindowsBase/ZipSharp/ZipStream.cs [new file with mode: 0644]
mcs/class/WindowsBase/ZipSharp/ZipTime.cs [new file with mode: 0644]
mcs/class/WindowsBase/ZipSharp/ZipWriteStream.cs [new file with mode: 0644]
mcs/class/WindowsBase/samples/dis.cs [new file with mode: 0644]

diff --git a/mcs/class/WindowsBase/Assembly/AssemblyInfo.cs b/mcs/class/WindowsBase/Assembly/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..8ff6492
--- /dev/null
@@ -0,0 +1,83 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+//   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2003 Ximian, Inc.  http://www.ximian.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.
+//
+
+using System;
+using System.Reflection;
+using System.Resources;
+using System.Security;
+using System.Security.Permissions;
+using System.Diagnostics;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows.Markup;
+
+// General Information about the WindowsBase assembly
+// v3.0 Assembly
+
+[assembly: AssemblyCompany (Consts.MonoCompany)]
+[assembly: AssemblyProduct (Consts.MonoProduct)]
+[assembly: AssemblyCopyright (Consts.MonoCopyright)]
+[assembly: AssemblyVersion (Consts.FxVersion)]
+[assembly: AssemblyFileVersion (Consts.WinFileVersion)]
+
+[assembly: NeutralResourcesLanguage ("en")]
+[assembly: CLSCompliant (true)]
+[assembly: AssemblyDelaySign (true)]
+[assembly: AssemblyKeyFile ("../winfx3.pub")]
+
+[assembly: ComVisible (false)]
+[assembly: AllowPartiallyTrustedCallers]
+
+[assembly: CompilationRelaxations (CompilationRelaxations.NoStringInterning)]
+[assembly: Debuggable (DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints |
+                       DebuggableAttribute.DebuggingModes.Default)]
+[assembly: RuntimeCompatibility (WrapNonExceptionThrows = true)]
+[assembly: Dependency ("System,", LoadHint.Always)]
+[assembly: SecurityCritical]
+[assembly: PermissionSet (SecurityAction.RequestMinimum, Name = "FullTrust")]
+[assembly: SecurityPermission (SecurityAction.RequestMinimum, SkipVerification = true)]
+
+[assembly: XmlnsPrefixAttribute ("http://schemas.microsoft.com/xps/2005/06", "metro")]
+[assembly: XmlnsPrefixAttribute ("http://schemas.microsoft.com/netfx/2007/xaml/presentation", "wpf")]
+[assembly: XmlnsPrefixAttribute ("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "av")]
+
+[assembly: XmlnsDefinitionAttribute ("http://schemas.microsoft.com/xps/2005/06", "System.Windows.Media")]
+[assembly: XmlnsDefinitionAttribute ("http://schemas.microsoft.com/xps/2005/06", "System.Windows.Input")]
+[assembly: XmlnsDefinitionAttribute ("http://schemas.microsoft.com/xps/2005/06", "System.Windows")]
+
+[assembly: XmlnsDefinitionAttribute ("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "System.Windows.Media")]
+[assembly: XmlnsDefinitionAttribute ("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "System.Windows.Input")]
+[assembly: XmlnsDefinitionAttribute ("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "System.Windows")]
+
+[assembly: XmlnsDefinitionAttribute ("http://schemas.microsoft.com/winfx/2006/xaml/composite-font", "System.Windows.Media")]
+
+[assembly: XmlnsDefinitionAttribute ("http://schemas.microsoft.com/netfx/2007/xaml/presentation", "System.Windows.Media")]
+[assembly: XmlnsDefinitionAttribute ("http://schemas.microsoft.com/netfx/2007/xaml/presentation", "System.Windows.Input")]
+[assembly: XmlnsDefinitionAttribute ("http://schemas.microsoft.com/netfx/2007/xaml/presentation", "System.Windows")]
diff --git a/mcs/class/WindowsBase/ChangeLog b/mcs/class/WindowsBase/ChangeLog
new file mode 100644 (file)
index 0000000..1b7d9d5
--- /dev/null
@@ -0,0 +1,380 @@
+2008-11-03  Alan McGovern  <alan.mcgovern@gmail.com>
+
+       * System.Windows/WeakEventManager.cs:
+       * System.IO.Packaging/ZipPackagePart.cs: Fix the two remaining API
+       points which shouldn't be exposed.
+
+2008-11-03  Alan McGovern  <alan.mcgovern@gmail.com>
+
+       * System.IO.Packaging/Package.cs: Temporary fix test failure until a
+       proper solution can be worked out.
+
+2008-11-03  Alan McGovern  <alan.mcgovern@gmail.com>
+
+       * Test/System.IO.Packaging/PackageTest.cs: Enable test now that it works
+
+2008-11-03  Alan McGovern  <alan.mcgovern@gmail.com>
+
+       * System.IO.Packaging/Package.cs: Fix build and also test that the
+       archive is valid when loading an existing archive.
+
+2008-11-03  Alan McGovern  <amcgovern@novell.com>
+
+       * System.IO.Packaging/Check.cs:
+       * System.IO.Packaging/Package.cs:
+       * System.IO.Packaging/PackagePart.cs:
+       * System.IO.Packaging/ZipPartStream.cs:
+       * Test/System.IO.Packaging/PackageTest.cs: Add tests to ensure that if a
+       package is readonly it won't be written to
+
+2008-11-03  Alan McGovern  <amcgovern@novell.com>
+
+       * ZipSharp/NativeZip.cs:
+       * ZipSharp/ZipArchive.cs:
+       * ZipSharp/NativeUnzip.cs:
+       * ZipSharp/IOFunctions.cs:
+       * ZipSharp/UnzipArchive.cs:
+       * System.IO.Packaging/Package.cs:
+       * System.IO.Packaging/PackagePartCollection.cs: Ensure we don't expose
+       more API than we should.
+
+2008-11-03  Alan McGovern  <amcgovern@novell.com>
+
+       * System.IO.Packaging/PackUriHelper.cs: Generate the new Uri properly
+
+2008-11-03  Alan McGovern  <amcgovern@novell.com>
+
+       * ZipSharp/NativeUnzip.cs:
+       * ZipSharp/UnzipArchive.cs:
+       * System.IO.Packaging/Check.cs:
+       * System.IO.Packaging/ZipPackage.cs:
+       * System.IO.Packaging/PackagePart.cs:
+       * System.IO.Packaging/PackUriHelper.cs:
+       * Test/System.IO.Packaging/PackageTest.cs:
+       * Test/System.IO.Packaging/PackagePartTest.cs:
+       * Test/System.IO.Packaging/FakePackagePartTests.cs:
+       * Test/System.IO.Packaging/PackageRelationshipTests.cs: Filenames should
+       be case insensitive. Fixed issues generating the correct relationship
+       uri for package parts.
+
+2008-11-03  Alan McGovern  <amcgovern@novell.com>
+
+       * System.IO.Packaging/Package.cs:
+       * System.IO.Packaging/ZipPackage.cs:
+       * System.IO.Packaging/ZipPackagePart.cs: Files are stored in the zip
+       archive with the leading '/' stripped. When loading relationships
+       from the archive, i shouldn't try updating the archive.
+
+2008-11-03  Alan McGovern  <amcgovern@novell.com>
+
+       
+
+
+
+2008-10-30  Alan McGovern  <amcgovern@novell.com>
+
+       * WindowsBase_test.dll.sources:
+       * System.IO.Packaging/PackUriHelper.cs:
+       * Test/System.IO.Packaging/PackUriHelperTests.cs: Commit partial
+       implementation of PackUriHelper along with associated NUnit tests.
+
+2008-10-28  Alan McGovern  <amcgovern@novell.com>
+
+       * System.IO.Packaging/PackagePart.cs: Cosmetic changes
+
+       * System.IO.Packaging/Package.cs: Do not remove the relationship part
+       from the package if it exists, just mark it disposed. All NUnit tests
+       pass now.
+
+2008-10-28  Alan McGovern  <amcgovern@novell.com>
+
+       * System.IO.Packaging/Package.cs:
+       * System.IO.Packaging/ZipPackage.cs:
+       * System.IO.Packaging/PackagePart.cs:
+       * Test/System.IO.Packaging/PackagePartTest.cs:
+       * System.IO.Packaging/PackagePartCollection.cs:
+       * Test/System.IO.Packaging/FakePackageTests.cs:
+       * System.IO.Packaging/PackageRelationshipCollection.cs: Implemented
+       loading/saving of relationships from PackageParts. Removed excess
+       debug spew.
+
+2008-10-29  Alan McGovern  <amcgovern@novell.com>
+
+       * ZipSharp/NativeZip.cs: Remove a Console.WriteLine
+
+       * System.IO.Packaging/Package.cs:
+       * System.IO.Packaging/ZipPackage.cs:
+       * System.IO.Packaging/PackagePart.cs:
+       * System.IO.Packaging/ZipPartStream.cs:
+       * System.IO.Packaging/ZipPackagePart.cs:
+       * Test/System.IO.Packaging/PackageTest.cs:
+       * Test/System.IO.Packaging/PackagePartTest.cs:
+       * Test/System.IO.Packaging/FakePackagePartTests.cs:
+       * Test/System.IO.Packaging/PackagePartStreamTests.cs:
+       * Test/System.IO.Packaging/PackageRelationshipTests.cs: Implement
+       parsing of PackageParts and PackageRelationships when loading
+       existing packages and write that data when creating a package.
+
+2008-10-29  Alan McGovern  <amcgovern@novell.com>
+
+       * System.IO.Packaging/Package.cs:
+       * System.IO.Packaging/ZipPackage.cs: Write relationships to the zipfile
+
+2008-10-28  Alan McGovern  <amcgovern@novell.com>
+
+       * Test/System.IO.Packaging/PackagePartStreamTests.cs: Disable these
+       tests until I can figure out if they're stupid or not.
+
+2008-10-28  Alan McGovern  <amcgovern@novell.com>
+
+       * System.IO.Packaging/ZipPackage.cs:
+       * System.IO.Packaging/ZipPartStream.cs:
+       * System.IO.Packaging/ZipPackagePart.cs:
+       * Test/System.IO.Packaging/PackagePartStreamTests.cs: Implement the
+       PartStream logic.
+
+       * Makefile: Need unsafe code to build the zip wrapper. Review this later
+       maybe.
+
+       * ZipSharp:
+       * ZipSharp/ZipTime.cs:
+       * ZipSharp/ZipHandle.cs:
+       * ZipSharp/ZipStream.cs:
+       * ZipSharp/NativeZip.cs:
+       * ZipSharp/ZipArchive.cs:
+       * ZipSharp/UnzipHandle.cs:
+       * ZipSharp/IOFunctions.cs:
+       * ZipSharp/NativeUnzip.cs:
+       * WindowsBase.dll.sources:
+       * ZipSharp/ZipFileInfo.cs:
+       * ZipSharp/UnzipArchive.cs:
+       * ZipSharp/UnzipFileInfo.cs:
+       * ZipSharp/ZipWriteStream.cs:
+       * ZipSharp/UnzipReadStream.cs: Add the minizip binding to SVN.
+
+2008-10-27  Mario Carrion <mcarrion@novell.com>
+
+       * System.Windows/Rect.cs: Operator != and == implementation.
+       * Test/System.Windows/RectTest.cs: New test: Equals_Operator.
+
+2008-10-17  Alan McGovern  <amcgovern@novell.com>
+
+       * Test/System.IO.Packaging/PackagePartStreamTests.cs: Uncomment the test
+       as compiling with mono-head fixes the issue.
+
+2008-10-17  Alan McGovern  <amcgovern@novell.com>
+
+       * Test/System.IO.Packaging/FakePackageTests.cs: Add missing license
+       header
+
+       * WindowsBase_test.dll.sources:
+       * Test/System.IO.Packaging/PackagePartStreamTests.cs: Added new tests
+       for the PackagePart stream code
+
+2008-10-17  Alan McGovern  <amcgovern@novell.com>
+
+       * Test/System.IO.Packaging/FakePackageTests.cs: Make the test cover all
+       Relationship based methods
+
+2008-10-17  Alan McGovern  <amcgovern@novell.com>
+
+       * Test/System.IO.Packaging/FakePackageTests.cs: Enable the
+       FakePackageTests
+
+       * System.IO.Packaging/Package.cs: Automatically add the relationship
+       PackagePart as per unit test.
+
+       * System.IO.Packaging/PackagePart.cs: A part which is a relationship
+       should throw when trying to access it's relationships.
+
+2008-10-17  Alan McGovern  <amcgovern@novell.com>
+
+       * WindowsBase_test.dll.sources:
+       * System.IO.Packaging/Package.cs:
+       * System.IO.Packaging/PackagePart.cs:
+       * Test/System.IO.Packaging/PackageTest.cs:
+       * Test/System.IO.Packaging/FakePackagePart.cs:
+       * Test/System.IO.Packaging/FakePackagePartTests.cs: Add more tests to
+       check the behaviour of PackagePart.GetStream () and also
+       PacakageParts which are automatically added.
+
+2008-10-17  Alan McGovern  <amcgovern@novell.com>
+
+       * Test/System.IO.Packaging/FakePackageTests.cs: Added test to see what
+       parts are automatically added/removed
+
+       * Test/System.IO.Packaging/TestBase.cs:
+       * Test/System.IO.Packaging/FakeStream.cs:
+       * Test/System.IO.Packaging/PackageTest.cs:
+       * Test/System.IO.Packaging/FakePackagePart.cs:
+       * Test/System.IO.Packaging/PackagePartTest.cs:
+       * Test/System.IO.Packaging/FakePackagePartTests.cs:
+       * Test/System.IO.Packaging/PackageRelationshipTests.cs: fixing
+       whitespace
+
+       * Test/System.IO.Packaging/FakePackage.cs: Monitor what parts are
+       added/removed from the package.
+
+2008-10-16  Alan McGovern  <amcgovern@novell.com>
+
+       * System.IO.Packaging/Package.cs:
+       * System.IO.Packaging/PackagePart.cs:
+       * System.IO.Packaging/PackageRelationship.cs: Use automatic properties
+
+2008-10-16  Alan McGovern  <amcgovern@novell.com>
+
+       * Test/System.IO.Packaging/FakePackage.cs: Updated the implementation so
+       it can be used in the NUnit tests
+
+       * System.IO.Packaging/Package.cs: Implemented GetParts and fixed a bug
+       with the constructor
+
+       * Test/System.IO.Packaging/PackageTest.cs:
+       * Test/System.IO.Packaging/PackagePartTest.cs: Enabled tests which now
+       pass
+
+       * System.IO.Packaging/PackagePartCollection.cs: Implement
+       PackagePartCollection so that it passes the NUnit tests.
+
+       * Makefile: Need reference to System.Xml
+
+       * System.IO.Packaging/PackagePart.cs: If there's a dupe relationship ID,
+       throw an XmlException
+
+       * System.IO.Packaging/ZipPackage.cs: Implemented Dispose/Close and
+       partial support for PartStreams
+
+       * Test/System.IO.Packaging/FakePackagePartTests.cs: Added new test for
+       Package.GetParts to verify behaviours. Enabled tests which now pass
+
+2008-10-16  Alan McGovern  <amcgovern@novell.com>
+
+       * Test/System.IO.Packaging/PackageRelationshipTests.cs: Enable the
+       PackageRelationship tests
+
+       * System.IO.Packaging/Check.cs:
+       * System.IO.Packaging/Package.cs: Add additional checks for uris
+
+2008-10-16  Alan McGovern  <amcgovern@novell.com>
+
+       * System.IO.Packaging/Check.cs:
+       * System.IO.Packaging/Package.cs:
+       * System.IO.Packaging/ZipPackage.cs:
+       * System.IO.Packaging/PackagePart.cs:
+       * System.IO.Packaging/ZipPackagePart.cs:
+       * Test/System.IO.Packaging/PackagePartTest.cs:
+       * System.IO.Packaging/PackagePartCollection.cs: Began the implementation
+       of both PackageRelationship and ZipPackagePart. Enabled tests for
+       these classes.
+
+2008-10-15  Alan McGovern  <amcgovern@novell.com>
+
+       * Test/System.IO.Packaging/FakePackagePartTests.cs: Add NotWorking
+       attribute to test.
+
+2008-10-15  Alan McGovern  <amcgovern@novell.com>
+
+       * System.IO.Packaging/PackagePart.cs:
+       * System.IO.Packaging/PackageRelationship.cs:
+       * System.IO.Packaging/PackageRelationshipCollection.cs: Began
+       implementing the PackageRelationship code
+
+       * System.IO.Packaging/Check.cs: Added check for SourceUri
+
+2008-10-15  Alan McGovern  <amcgovern@novell.com>
+
+       * System.IO.Packaging/Check.cs: Created class for doing argument checks
+
+       * System.IO.Packaging/Package.cs:
+       * System.IO.Packaging/ZipPackage.cs: Implemented enough of
+       Package/ZipPackage to allow the NUnit tests to function
+
+       * WindowsBase.dll.sources:
+       * WindowsBase_test.dll.sources:
+       * System.IO.Packaging/PackagePart.cs:
+       * Test/System.IO.Packaging/FakePackagePart.cs:
+       * Test/System.IO.Packaging/FakePackagePartTests.cs: Began implementing
+       the PackagePart class
+
+       * Test/System.IO.Packaging/TestBase.cs:
+       * Test/System.IO.Packaging/PackageTest.cs: Added temporary workarounds
+       for unimplemented methods in Package
+
+2008-10-15  Alan McGovern  <amcgovern@novell.com>
+
+       * System.IO.Packaging/Package.cs: Use the FileInfo object rather than
+       calling File.Exists. Comply with coding guidelines better.
+
+2008-10-15  Alan McGovern  <amcgovern@novell.com>
+
+       * Test/System.IO.Packaging/PackageTest.cs: Cosmetic fixes and added
+       three new tests
+
+       * System.IO.Packaging/Package.cs: If the file already exists, throw an
+       exception if it's length is zero.
+
+2008-10-15  Alan McGovern  <amcgovern@novell.com>
+
+       * System.IO.Packaging/Package.cs:
+       * System.IO/FileFormatException.cs:
+       * Test/System.IO.Packaging/PackageTest.cs: Added more NUnit tests and
+       implemented the necessary argument checking to pass these tests.
+
+2008-10-14  Alan McGovern  <amcgovern@novell.com>
+
+       * Test/System.IO.Packaging/PackageTest.cs,
+       Test/System.IO.Packaging/PackageRelationshipTests.cs,
+       Test/System.IO.Packaging/PackagePartTest.cs,
+       Test/System.IO.Packaging/FakePackage.cs,
+       Test/System.IO.Packaging/FakeStream.cs,
+       Test/System.IO.Packaging/TestBase.cs: Cosmetic changes to follow
+       coding guidelines
+
+2008-10-14  Alan McGovern  <amcgovern@novell.com>
+
+       * Test/System.IO.Packaging
+       * Test/System.IO.Packaging/PackageTest.cs
+       * Test/System.IO.Packaging/PackageRelationshipTests.cs
+       * Test/System.IO.Packaging/PackagePartTest.cs
+       * Test/System.IO.Packaging/FakePackage.cs
+       * Test/System.IO.Packaging/FakeStream.cs
+       * Test/System.IO.Packaging/TestBase.cs
+       * WindowsBase_test.dll.sources: Implemented some NUnit tests for
+       the System.IO.Packaging API.
+
+2007-11-18  Chris Toshok  <toshok@ximian.com>
+
+       * System.Windows/DependencyObjectType.cs: implement such that it
+       passes all unit tests.
+
+2007-01-25  Miguel de Icaza  <miguel@novell.com>
+
+       * Assembly/AssemblyInfo.cs: Use the right key to sign things so we
+       can test on Windows the resulting nunit tests.
+
+2005-07-24  Iain McCoy  <iain@mccoy.id.au>
+
+       * Test/AttachedProperties.cs: made LocalValueEnumerator test not
+       depend on unstable implementation details
+
+2005-07-19  Iain McCoy  <iain@mccoy.id.au>
+
+       * System.Windows/DependencyObject.cs,
+         System.Windows/LocalValueEnumerator.cs: implemented
+       GetLocalValueEnumerator() and the LocalValueEnumerator class to
+       support it.
+       * Test/DependencyObject.cs: added test for LocalValueEnumerator
+       
+
+2005-07-06  Iain McCoy  <iain@mccoy.id.au>
+
+       * System.Windows/DependencyObject.cs,
+         System.Windows/DependencyProperty.cs,
+         System.Windows/PropertyMetadata.cs,
+         System.Windows/Callbacks.cs: Added constructors to PropertyMetadata,
+         added support for default values of properties
+
+2005-07-02  Iain McCoy  <iain@mccoy.id.au>
+
+       * whole folder: initial implementation of the DependencyProperty
+       system
diff --git a/mcs/class/WindowsBase/Makefile b/mcs/class/WindowsBase/Makefile
new file mode 100644 (file)
index 0000000..1970823
--- /dev/null
@@ -0,0 +1,9 @@
+thisdir = class/WindowsBase
+include ../../build/rules.make
+
+LIBRARY = WindowsBase.dll
+
+LIB_MCS_FLAGS = -unsafe -r:System -r:System.Xml
+TEST_MCS_FLAGS = -unsafe -r:WindowsBase.dll
+
+include ../../build/library.make
diff --git a/mcs/class/WindowsBase/System.Collections.ObjectModel/ObservableCollection.cs b/mcs/class/WindowsBase/System.Collections.ObjectModel/ObservableCollection.cs
new file mode 100644 (file)
index 0000000..54df9ec
--- /dev/null
@@ -0,0 +1,98 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@novell.com)
+//
+
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.ComponentModel;
+
+namespace System.Collections.ObjectModel {
+
+       [Serializable]
+       public class ObservableCollection<T> : Collection<T>, INotifyCollectionChanged, INotifyPropertyChanged
+       {
+               public ObservableCollection()
+               {
+               }
+
+               public ObservableCollection(List<T> list)
+                       : base (list)
+               {
+               }
+
+               public virtual event NotifyCollectionChangedEventHandler CollectionChanged;
+               protected virtual event PropertyChangedEventHandler PropertyChanged;
+
+               event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged {
+                       add { this.PropertyChanged += value; }
+                       remove { this.PropertyChanged -= value; }
+               }
+
+               protected IDisposable BlockReentrancy ()
+               {
+                       return null;
+               }
+
+               protected void CheckReentrancy ()
+               {
+               }
+
+               protected override void ClearItems ()
+               {
+               }
+
+               protected override void InsertItem (int index, T item)
+               {
+               }
+
+               public void Move (int oldIndex, int newIndex)
+               {
+               }
+
+               protected virtual void MoveItem (int oldIndex, int newIndex)
+               {
+               }
+
+               protected virtual void OnCollectionChanged (NotifyCollectionChangedEventArgs e)
+               {
+                       if (CollectionChanged != null)
+                               CollectionChanged (this, e);
+               }
+
+               protected virtual void OnPropertyChanged (PropertyChangedEventArgs e)
+               {
+                       if (PropertyChanged != null)
+                               PropertyChanged (this, e);
+               }
+
+               protected override void RemoveItem (int index)
+               {
+               }
+
+               protected override void SetItem (int index, T item)
+               {
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Collections.ObjectModel/ReadOnlyObservableCollection.cs b/mcs/class/WindowsBase/System.Collections.ObjectModel/ReadOnlyObservableCollection.cs
new file mode 100644 (file)
index 0000000..18f5a02
--- /dev/null
@@ -0,0 +1,65 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@novell.com)
+//
+
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.ComponentModel;
+
+namespace System.Collections.ObjectModel {
+
+       public class ReadOnlyObservableCollection<T> : ReadOnlyCollection<T>, INotifyCollectionChanged, INotifyPropertyChanged
+       {
+               public ReadOnlyObservableCollection (ObservableCollection<T> list)
+                       : base (list)
+               {
+               }
+
+               protected virtual event NotifyCollectionChangedEventHandler CollectionChanged;
+               protected virtual event PropertyChangedEventHandler PropertyChanged;
+
+               event NotifyCollectionChangedEventHandler INotifyCollectionChanged.CollectionChanged {
+                       add { this.CollectionChanged += value; }
+                       remove { this.CollectionChanged -= value; }
+               }
+               event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged {
+                       add { this.PropertyChanged += value; }
+                       remove { this.PropertyChanged -= value; }
+               }
+
+               protected virtual void OnCollectionChanged (NotifyCollectionChangedEventArgs args)
+               {
+                       if (CollectionChanged != null)
+                               CollectionChanged (this, args);
+               }
+
+               protected virtual void OnPropertyChanged (PropertyChangedEventArgs args)
+               {
+                       if (PropertyChanged != null)
+                               PropertyChanged (this, args);
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.Collections.Specialized/CollectionChangedEventManager.cs b/mcs/class/WindowsBase/System.Collections.Specialized/CollectionChangedEventManager.cs
new file mode 100644 (file)
index 0000000..b4d7e42
--- /dev/null
@@ -0,0 +1,54 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows;
+
+namespace System.Collections.Specialized {
+
+       public class CollectionChangedEventManager : WeakEventManager
+       {
+               internal CollectionChangedEventManager ()
+               {
+               }
+
+               public static void AddListener (INotifyCollectionChanged source, IWeakEventListener listener)
+               {
+               }
+
+               public static void RemoveListener (INotifyCollectionChanged source, IWeakEventListener listener)
+               {
+               }
+
+               protected override void StartListening (object source)
+               {
+               }
+
+               protected override void StopListening (object source)
+               {
+               }
+       }
+}
+
diff --git a/mcs/class/WindowsBase/System.Collections.Specialized/INotifyCollectionChanged.cs b/mcs/class/WindowsBase/System.Collections.Specialized/INotifyCollectionChanged.cs
new file mode 100644 (file)
index 0000000..544380c
--- /dev/null
@@ -0,0 +1,36 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows;
+
+namespace System.Collections.Specialized {
+
+       public interface INotifyCollectionChanged {
+
+               event NotifyCollectionChangedEventHandler CollectionChanged;
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.Collections.Specialized/NotifyCollectionChangedAction.cs b/mcs/class/WindowsBase/System.Collections.Specialized/NotifyCollectionChangedAction.cs
new file mode 100644 (file)
index 0000000..a6ec65c
--- /dev/null
@@ -0,0 +1,38 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Collections.Specialized {
+
+       public enum NotifyCollectionChangedAction {
+               Add,
+               Remove,
+               Replace,
+               Move,
+               Reset
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.Collections.Specialized/NotifyCollectionChangedEventArgs.cs b/mcs/class/WindowsBase/System.Collections.Specialized/NotifyCollectionChangedEventArgs.cs
new file mode 100644 (file)
index 0000000..982d6c8
--- /dev/null
@@ -0,0 +1,110 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Collections;
+
+namespace System.Collections.Specialized {
+
+       public class NotifyCollectionChangedEventArgs : EventArgs {
+
+               NotifyCollectionChangedAction action;
+
+               public NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction action)
+               {
+                       this.action = action;
+               }
+
+               public NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction action, IList changedItems)
+                       : this (action)
+               {
+               }
+
+               public NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction action, object changedItem)
+                       : this (action)
+               {
+               }
+
+               public NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction action, IList newItems, IList oldItems)
+                       : this (action)
+               {
+               }
+
+               public NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction action, IList changedItems, int startingIndex)
+                       : this (action)
+               {
+               }
+
+               public NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction action, object changedItem, int index)
+                       : this (action)
+               {
+               }
+
+               public NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction action, object newItem, object oldItem)
+                       : this (action)
+               {
+               }
+
+               public NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction action, IList newItems, IList oldItems, int startingIndex)
+                       : this (action)
+               {
+               }
+
+               public NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction action, IList changedItem, int index, int oldIndex)
+                       : this (action)
+               {
+               }
+
+               public NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction action, object changedItem, int index, int oldIndex)
+                       : this (action)
+               {
+               }
+
+               public NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction action, object newItem, object oldItem, int index)
+                       : this (action)
+               {
+               }
+
+               public NotifyCollectionChangedAction Action {
+                       get { return action; }
+               }
+
+               public IList NewItems {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public int NewStartingIndex {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public IList OldItems {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public int OldStartingIndex {
+                       get { throw new NotImplementedException (); }
+               }
+       }       
+}
diff --git a/mcs/class/WindowsBase/System.Collections.Specialized/NotifyCollectionChangedEventHandler.cs b/mcs/class/WindowsBase/System.Collections.Specialized/NotifyCollectionChangedEventHandler.cs
new file mode 100644 (file)
index 0000000..0a52296
--- /dev/null
@@ -0,0 +1,32 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Collections.Specialized {
+
+       public delegate void NotifyCollectionChangedEventHandler (object sender, NotifyCollectionChangedEventArgs e);
+
+}
diff --git a/mcs/class/WindowsBase/System.ComponentModel/CurrentChangedEventManager.cs b/mcs/class/WindowsBase/System.ComponentModel/CurrentChangedEventManager.cs
new file mode 100644 (file)
index 0000000..2a504d0
--- /dev/null
@@ -0,0 +1,59 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows;
+
+namespace System.ComponentModel {
+
+       public class CurrentChangedEventManager : WeakEventManager
+       {
+               internal CurrentChangedEventManager ()
+               {
+               }
+
+               public static void AddListener (ICollectionView source, IWeakEventListener listener)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static void RemoveListener (ICollectionView source, IWeakEventListener listener)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void StartListening (object source)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void StopListening (object source)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
+
diff --git a/mcs/class/WindowsBase/System.ComponentModel/CurrentChangingEventArgs.cs b/mcs/class/WindowsBase/System.ComponentModel/CurrentChangingEventArgs.cs
new file mode 100644 (file)
index 0000000..dcca8b1
--- /dev/null
@@ -0,0 +1,52 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows;
+
+namespace System.ComponentModel {
+
+       public class CurrentChangingEventArgs : EventArgs
+       {
+               public CurrentChangingEventArgs ()
+               {
+               }
+
+               public CurrentChangingEventArgs (bool isCancelable)
+               {
+               }
+
+               public bool Cancel {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
+
+               public bool IsCancelable {
+                       get { throw new NotImplementedException (); }
+               }
+               
+       }
+
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.ComponentModel/CurrentChangingEventHandler.cs b/mcs/class/WindowsBase/System.ComponentModel/CurrentChangingEventHandler.cs
new file mode 100644 (file)
index 0000000..7ff0ef3
--- /dev/null
@@ -0,0 +1,32 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.ComponentModel {
+
+       public delegate void CurrentChangingEventHandler (object sender, CurrentChangingEventArgs args);
+
+}
diff --git a/mcs/class/WindowsBase/System.ComponentModel/CurrentChangingEventManager.cs b/mcs/class/WindowsBase/System.ComponentModel/CurrentChangingEventManager.cs
new file mode 100644 (file)
index 0000000..a9ad4ce
--- /dev/null
@@ -0,0 +1,59 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows;
+
+namespace System.ComponentModel {
+
+       public class CurrentChangingEventManager : WeakEventManager
+       {
+               internal CurrentChangingEventManager ()
+               {
+               }
+
+               public static void AddListener (ICollectionView source, IWeakEventListener listener)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static void RemoveListener (ICollectionView source, IWeakEventListener listener)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void StartListening (object source)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void StopListening (object source)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
+
diff --git a/mcs/class/WindowsBase/System.ComponentModel/DependencyPropertyDescriptor.cs b/mcs/class/WindowsBase/System.ComponentModel/DependencyPropertyDescriptor.cs
new file mode 100644 (file)
index 0000000..1c3a231
--- /dev/null
@@ -0,0 +1,161 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows;
+
+namespace System.ComponentModel {
+
+       public sealed class DependencyPropertyDescriptor : PropertyDescriptor {
+               internal DependencyPropertyDescriptor () : base (null)
+               {
+               }
+
+               public override AttributeCollection Attributes
+               {
+                       get { throw new NotImplementedException (); }
+               }
+               public override string Category
+               {
+                       get { throw new NotImplementedException (); }
+               }
+               public override Type ComponentType
+               {
+                       get { throw new NotImplementedException (); }
+               }
+               public override TypeConverter Converter
+               {
+                       get { throw new NotImplementedException (); }
+               }
+               public DependencyProperty DependencyProperty
+               {
+                       get { throw new NotImplementedException (); }
+               }
+               public override string Description
+               {
+                       get { throw new NotImplementedException (); }
+               }
+               public override bool DesignTimeOnly
+               {
+                       get { throw new NotImplementedException (); }
+               }
+               public override string DisplayName
+               {
+                       get { throw new NotImplementedException (); }
+               }
+               public bool IsAttached
+               {
+                       get { throw new NotImplementedException (); }
+               }
+               public override bool IsBrowsable
+               {
+                       get { throw new NotImplementedException (); }
+               }
+               public override bool IsLocalizable
+               {
+                       get { throw new NotImplementedException (); }
+               }
+               public override bool IsReadOnly
+               {
+                       get { throw new NotImplementedException (); }
+               }
+               public PropertyMetadata Metadata
+               {
+                       get { throw new NotImplementedException (); }
+               }
+               public override Type PropertyType
+               {
+                       get { throw new NotImplementedException (); }
+               }
+               public override bool SupportsChangeEvents
+               {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public override void AddValueChanged (object component, EventHandler handler)
+               {
+                       throw new NotImplementedException ();
+               }
+               public override bool CanResetValue (object component)
+               {
+                       throw new NotImplementedException ();
+               }
+               public override bool Equals (object obj)
+               {
+                       throw new NotImplementedException ();
+               }
+               public override PropertyDescriptorCollection GetChildProperties (object instance, Attribute[] filter)
+               {
+                       throw new NotImplementedException ();
+               }
+               public override object GetEditor (Type editorBaseType)
+               {
+                       throw new NotImplementedException ();
+               }
+               public override int GetHashCode ()
+               {
+                       throw new NotImplementedException ();
+               }
+               public override object GetValue (object component)
+               {
+                       throw new NotImplementedException ();
+               }
+               public override void RemoveValueChanged (object component, EventHandler handler)
+               {
+                       throw new NotImplementedException ();
+               }
+               public override void ResetValue (object component)
+               {
+                       throw new NotImplementedException ();
+               }
+               public override void SetValue (object component, object value)
+               {
+                       throw new NotImplementedException ();
+               }
+               public override bool ShouldSerializeValue (object component)
+               {
+                       throw new NotImplementedException ();
+               }
+               public override string ToString ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static DependencyPropertyDescriptor FromName (string name, Type ownerType, Type targetType)
+               {
+                       throw new NotImplementedException ();
+               }
+               public static DependencyPropertyDescriptor FromProperty (PropertyDescriptor Property)
+               {
+                       throw new NotImplementedException ();
+               }
+               public static DependencyPropertyDescriptor FromProperty (DependencyProperty dependencyProperty, Type targetType)
+               {
+                       throw new NotImplementedException ();
+               }
+
+       }
+
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.ComponentModel/GroupDescription.cs b/mcs/class/WindowsBase/System.ComponentModel/GroupDescription.cs
new file mode 100644 (file)
index 0000000..4cd981a
--- /dev/null
@@ -0,0 +1,70 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Collections.ObjectModel;
+using System.Globalization;
+
+namespace System.ComponentModel {
+
+       public abstract class GroupDescription : INotifyPropertyChanged
+       {
+               protected GroupDescription ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public ObservableCollection<object> GroupNames {
+                       get { throw new NotImplementedException (); }
+               }
+
+               event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged {
+                       add { PropertyChanged += value; }
+                       remove { PropertyChanged -= value; }
+               }
+
+               protected virtual event PropertyChangedEventHandler PropertyChanged;
+
+               public virtual bool NamesMatch (object groupName, object itemName)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected virtual void OnPropertyChanged (PropertyChangedEventArgs e)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public bool ShouldSerializeGroupNames ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public abstract object GroupNameFromItem (object item, int level, CultureInfo culture);
+
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.ComponentModel/ICollectionView.cs b/mcs/class/WindowsBase/System.ComponentModel/ICollectionView.cs
new file mode 100644 (file)
index 0000000..e9a860f
--- /dev/null
@@ -0,0 +1,65 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Collections;
+using System.Collections.ObjectModel;
+using System.Collections.Specialized;
+using System.Globalization;
+
+namespace System.ComponentModel {
+
+       public interface ICollectionView : IEnumerable, INotifyCollectionChanged
+       {
+               bool CanFilter { get; }
+               bool CanGroup { get; }
+               bool CanSort { get; }
+               CultureInfo Culture { get; set; }
+               object CurrentItem { get; }
+               int CurrentPosition { get; }
+               Predicate<object> Filter {get; set; }
+               ObservableCollection<GroupDescription> GroupDescriptions { get; }
+               ReadOnlyObservableCollection<object> Groups { get; }
+               bool IsCurrentAfterLast { get; }
+               bool IsCurrentBeforeFirst { get; }
+               bool IsEmpty { get; }
+               SortDescriptionCollection SortDescriptions { get; }
+               IEnumerable SourceCollection { get; }
+
+               event EventHandler CurrentChanged;
+               event CurrentChangingEventHandler CurrentChanging;
+
+               bool Contains (object item);
+               IDisposable DeferRefresh ();
+               bool MoveCurrentTo (object item);
+               bool MoveCurrentToFirst ();
+               bool MoveCurrentToLast ();
+               bool MoveCurrentToNext ();
+               bool MoveCurrentToPosition (int position);
+               bool MoveCurrentToPrevious ();
+               void Refresh ();
+       }
+
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.ComponentModel/ICollectionViewFactory.cs b/mcs/class/WindowsBase/System.ComponentModel/ICollectionViewFactory.cs
new file mode 100644 (file)
index 0000000..5401985
--- /dev/null
@@ -0,0 +1,33 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+namespace System.ComponentModel {
+
+       public interface ICollectionViewFactory {
+               ICollectionView CreateView ();
+       }
+
+}
+
diff --git a/mcs/class/WindowsBase/System.ComponentModel/PropertyChangedEventManager.cs b/mcs/class/WindowsBase/System.ComponentModel/PropertyChangedEventManager.cs
new file mode 100644 (file)
index 0000000..c43685b
--- /dev/null
@@ -0,0 +1,63 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows;
+
+namespace System.ComponentModel {
+
+       public class PropertyChangedEventManager : WeakEventManager
+       {
+               internal PropertyChangedEventManager ()
+               {
+               }
+
+               public static void AddListener (INotifyPropertyChanged source, IWeakEventListener listener, string propertyName)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static void RemoveListener (INotifyPropertyChanged source, IWeakEventListener listener, string propertyName)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override bool Purge (object source, object data, bool purgeAll)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void StartListening (object source)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void StopListening (object source)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.ComponentModel/PropertyFilterAttribute.cs b/mcs/class/WindowsBase/System.ComponentModel/PropertyFilterAttribute.cs
new file mode 100644 (file)
index 0000000..bea4cdf
--- /dev/null
@@ -0,0 +1,58 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.ComponentModel {
+
+       public sealed class PropertyFilterAttribute : Attribute
+       {
+               public static readonly PropertyFilterAttribute Default;
+
+               public PropertyFilterAttribute (PropertyFilterOptions filter)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public PropertyFilterOptions Filter {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public override bool Equals (object value)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override int GetHashCode ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override bool Match (object value)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.ComponentModel/PropertyFilterOptions.cs b/mcs/class/WindowsBase/System.ComponentModel/PropertyFilterOptions.cs
new file mode 100644 (file)
index 0000000..973ca3f
--- /dev/null
@@ -0,0 +1,40 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.ComponentModel {
+
+       [Flags]
+       public enum PropertyFilterOptions {
+               None = 0,
+               Invalid = 1,
+               SetValues = 2,
+               UnsetValues = 4,
+               Valid = 8,
+               All = 15
+       }
+}
+
diff --git a/mcs/class/WindowsBase/System.ComponentModel/SortDescription.cs b/mcs/class/WindowsBase/System.ComponentModel/SortDescription.cs
new file mode 100644 (file)
index 0000000..1a1bc6f
--- /dev/null
@@ -0,0 +1,71 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.ComponentModel {
+
+       public struct SortDescription
+       {
+               public SortDescription (string propertyName, ListSortDirection direction)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static bool operator!= (SortDescription sd1, SortDescription sd2)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static bool operator== (SortDescription sd1, SortDescription sd2)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public ListSortDirection Direction {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
+
+               public bool IsSealed {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public string PropertyName {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
+
+               public override bool Equals (object obj)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override int GetHashCode ()
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.ComponentModel/SortDescriptionCollection.cs b/mcs/class/WindowsBase/System.ComponentModel/SortDescriptionCollection.cs
new file mode 100644 (file)
index 0000000..0446507
--- /dev/null
@@ -0,0 +1,69 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Collections.ObjectModel;
+using System.Collections.Specialized;
+
+namespace System.ComponentModel {
+
+       public class SortDescriptionCollection : Collection<SortDescription>, INotifyCollectionChanged
+       {
+               public static readonly SortDescriptionCollection Empty = new SortDescriptionCollection ();
+
+               public SortDescriptionCollection ()
+               {
+               }
+
+               event NotifyCollectionChangedEventHandler INotifyCollectionChanged.CollectionChanged {
+                       add { CollectionChanged += value; }
+                       remove { CollectionChanged -= value; }
+               }
+                       
+               protected event NotifyCollectionChangedEventHandler CollectionChanged;
+
+               protected override void ClearItems ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void InsertItem (int index, SortDescription item)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void RemoveItem (int index)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void SetItem (int index, SortDescription item)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
+
diff --git a/mcs/class/WindowsBase/System.Diagnostics/PresentationTraceLevel.cs b/mcs/class/WindowsBase/System.Diagnostics/PresentationTraceLevel.cs
new file mode 100644 (file)
index 0000000..f6fcc5f
--- /dev/null
@@ -0,0 +1,35 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+namespace System.Diagnostics {
+
+       public enum PresentationTraceLevel {
+               None,
+               Low,
+               Medium,
+               High
+       }
+}
+
diff --git a/mcs/class/WindowsBase/System.Diagnostics/PresentationTraceSources.cs b/mcs/class/WindowsBase/System.Diagnostics/PresentationTraceSources.cs
new file mode 100644 (file)
index 0000000..7956fc1
--- /dev/null
@@ -0,0 +1,89 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows;
+
+namespace System.Diagnostics {
+
+       public static class PresentationTraceSources {
+               public static readonly DependencyProperty TraceLevelProperty;
+
+               public static TraceSource AnimationSource {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public static TraceSource DataBindingSource {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public static TraceSource DependencyPropertySource {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public static TraceSource DocumentsSource {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public static TraceSource FreezableSource {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public static TraceSource HwndHostSource {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public static TraceSource MarkupSource {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public static TraceSource NameScopeSource {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public static TraceSource ResourceDictionarySource {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public static TraceSource RoutedEventSource {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public static PresentationTraceLevel GetTraceLevel (object element)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static void Refresh ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static void SetTraceLevel (object element, PresentationTraceLevel traceLevel)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/CertificateEmbeddingOption.cs b/mcs/class/WindowsBase/System.IO.Packaging/CertificateEmbeddingOption.cs
new file mode 100644 (file)
index 0000000..9cd15c2
--- /dev/null
@@ -0,0 +1,35 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+namespace System.IO.Packaging {
+
+       public enum CertificateEmbeddingOption {
+               InCertificatePart,
+               InSignaturePart,
+               NotEmbedded
+       }
+
+}
+
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/Check.cs b/mcs/class/WindowsBase/System.IO.Packaging/Check.cs
new file mode 100644 (file)
index 0000000..c7cee85
--- /dev/null
@@ -0,0 +1,158 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Alan McGovern (amcgovern@novell.com)
+//
+
+using System;
+
+namespace System.IO.Packaging
+{
+       internal static class Check
+       {
+               static void NotNull (object o, string name)
+               {
+                       if (o == null)
+                               throw new ArgumentNullException (name);
+               }
+               
+               public static void ContentTypeIsValid (string contentType)
+               {
+                       if (string.IsNullOrEmpty (contentType))
+                               return;
+
+                       // Must be in form of: type/subtype
+                       int index = contentType.IndexOf ('/');
+                       bool result = (index > 0) && contentType.Length > (index + 1) && contentType.IndexOf ('/', index + 1) == -1;
+
+                       if(!result)
+                               throw new ArgumentException ("contentType", "contentType must be in the form of 'type/subtype'");
+               }
+
+               public static void Id (object id)
+               {
+                       NotNull (id, "id");
+               }
+               
+               public static void IdIsValid (string id)
+               {
+                       if (id == null)
+                               return;
+
+                       // If the ID is a zero string, need to throw a ArgNullEx
+                       if (id.Length == 0)
+                               throw new ArgumentNullException ("id", "Cannot be whitespace or empty");
+
+                       // FIXME: I need to XSD parse this to make sure it's valid
+                       // If it's not, throw an XmlException
+               }
+
+               private static bool EmptyOrBlank (string s)
+               {
+                       return (s != null && (s == "" || s.Trim ().Length == 0));
+               }
+               
+               public static void Package(object package)
+               {
+                       if (package == null)
+                               throw new ArgumentNullException ("package");
+               }
+
+
+               public static void PackageUri (object packageUri)
+               {
+                       NotNull (packageUri, "packageUri");
+               }
+
+               public static void PackageUriIsValid (Uri packageUri)
+               {
+                       if (!packageUri.IsAbsoluteUri)
+                               throw new ArgumentException ("packageUri", "Uri must be absolute");
+               }
+               
+               public static void PackUriIsValid (Uri packUri)
+               {
+                       if (packUri.Scheme != PackUriHelper.PackScheme)
+                               throw new ArgumentException ("packUri", "Uri scheme is not a valid PackUri scheme");
+                           
+                       if (!packUri.IsAbsoluteUri)
+                               throw new ArgumentException ("packUri", "PackUris must be absolute");
+               }
+
+               public static void PartUri (object partUri)
+               {
+                       if (partUri == null)
+                               throw new ArgumentNullException ("partUri");
+               }
+
+               public static void PartUriIsValid (Uri partUri)
+               {
+                       if (!partUri.OriginalString.StartsWith ("/"))
+                               throw new UriFormatException ("PartUris must start with '/'");
+
+                       if (partUri.IsAbsoluteUri)
+                               throw new UriFormatException ("PartUris cannot be absolute");
+               }
+
+               public static void RelationshipTypeIsValid (string relationshipType)
+               {
+                       if (relationshipType == null)
+                               throw new ArgumentNullException ("relationshipType");
+                       if (EmptyOrBlank (relationshipType))
+                               throw new ArgumentException ("relationshipType", "Cannot be whitespace or empty");
+               }
+
+               public static void PartUri (Uri partUri)
+               {
+                       if (partUri == null)
+                               throw new ArgumentNullException ("partUri");
+                       if (partUri.IsAbsoluteUri)
+                               throw new ArgumentException ("partUri", "Absolute URIs are not supported");
+                       if (string.IsNullOrEmpty (partUri.OriginalString))
+                               throw new ArgumentException ("partUri", "Part uri cannot be an empty string");
+               }
+
+               public static void SourcePartUri (Uri sourcePartUri)
+               {
+                       NotNull(sourcePartUri, "sourcePartUri");
+               }
+               public static void SourceUri (Uri sourceUri)
+               {
+                       if (sourceUri == null)
+                               throw new ArgumentNullException ("sourceUri");
+                       if (sourceUri.IsAbsoluteUri)
+                               throw new ArgumentException ("sourceUri", "Absolute URIs are not supported");
+                       if (string.IsNullOrEmpty (sourceUri.OriginalString))
+                               throw new ArgumentException ("sourceUri", "Part uri cannot be an empty string");
+               }
+
+               public static void TargetUri (Uri targetUri)
+               {
+                       if (targetUri == null)
+                               throw new ArgumentNullException ("targetUri");
+                       if (targetUri.IsAbsoluteUri)
+                               throw new ArgumentException ("targetUri", "Absolute URIs are not supported");
+                       if (string.IsNullOrEmpty (targetUri.OriginalString))
+                               throw new ArgumentException ("targetUri", "Part uri cannot be an empty string");
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/CompressionOption.cs b/mcs/class/WindowsBase/System.IO.Packaging/CompressionOption.cs
new file mode 100644 (file)
index 0000000..3cf9ee8
--- /dev/null
@@ -0,0 +1,37 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+namespace System.IO.Packaging {
+
+       public enum CompressionOption {
+               NotCompressed = -1,
+               Normal,
+               Maximum,
+               Fast,
+               SuperFast,
+       }
+
+}
+
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/EncryptedPackageEnvelope.cs b/mcs/class/WindowsBase/System.IO.Packaging/EncryptedPackageEnvelope.cs
new file mode 100644 (file)
index 0000000..04ca7fe
--- /dev/null
@@ -0,0 +1,117 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.IO;
+using System.Security.RightsManagement;
+
+namespace System.IO.Packaging {
+
+       public class EncryptedPackageEnvelope : IDisposable
+       {
+               internal EncryptedPackageEnvelope ()
+               {
+               }
+
+               public FileAccess FileOpenAccess {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public PackageProperties PackageProperties {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public RightsManagementInformation RightsManagementInformation {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public StorageInfo StorageInfo {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public void Close ()
+               {
+                       throw new NotImplementedException ();
+               }
+               public void Dispose ()
+               {
+                       throw new NotImplementedException ();
+               }
+               public void Flush ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public Package GetPackage ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static bool IsEncryptedPackageEnvelope (Stream stream)
+               {
+                       throw new NotImplementedException ();
+               }
+               public static bool IsEncryptedPackageEnvelope (string fileName)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static EncryptedPackageEnvelope Create (Stream envelopeStream, PublishLicense publishLicense, CryptoProvider cryptoProvider)
+               {
+                       throw new NotImplementedException ();
+               }
+               public static EncryptedPackageEnvelope Create (string envelopeFileName, PublishLicense publishLicense, CryptoProvider cryptoProvider)
+               {
+                       throw new NotImplementedException ();
+               }
+               public static EncryptedPackageEnvelope CreateFromPackage (Stream envelopeStream, Stream packageStream, PublishLicense publishLicense, CryptoProvider cryptoProvider)
+               {
+                       throw new NotImplementedException ();
+               }
+               public static EncryptedPackageEnvelope CreateFromPackage (string envelopeFileName, Stream packageStream, PublishLicense publishLicense, CryptoProvider cryptoProvider)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static EncryptedPackageEnvelope Open (Stream envelopeStream)
+               {
+                       throw new NotImplementedException ();
+               }
+               public static EncryptedPackageEnvelope Open (string envelopeFileName)
+               {
+                       throw new NotImplementedException ();
+               }
+               public static EncryptedPackageEnvelope Open (string envelopeFileName, FileAccess access)
+               {
+                       throw new NotImplementedException ();
+               }
+               public static EncryptedPackageEnvelope Open (string envelopeFileName, FileAccess access, FileShare sharing)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
+
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/EncryptionOption.cs b/mcs/class/WindowsBase/System.IO.Packaging/EncryptionOption.cs
new file mode 100644 (file)
index 0000000..d0843bc
--- /dev/null
@@ -0,0 +1,33 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+namespace System.IO.Packaging {
+
+       public enum EncryptionOption {
+               None,
+               RightsManagement
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/InvalidSignatureEventHandler.cs b/mcs/class/WindowsBase/System.IO.Packaging/InvalidSignatureEventHandler.cs
new file mode 100644 (file)
index 0000000..0042cb1
--- /dev/null
@@ -0,0 +1,32 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.IO.Packaging {
+
+       public delegate void InvalidSignatureEventHandler (object sender, SignatureVerificationEventArgs e);
+
+}
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/PackUriHelper.cs b/mcs/class/WindowsBase/System.IO.Packaging/PackUriHelper.cs
new file mode 100644 (file)
index 0000000..8b8dbfa
--- /dev/null
@@ -0,0 +1,175 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.IO.Packaging {
+
+       public static class PackUriHelper
+       {
+               internal const string PackScheme = "pack";
+               static readonly Uri PackSchemeUri = new Uri("pack://", UriKind.Absolute);
+               
+               static PackUriHelper ()
+               {
+                       if (!UriParser.IsKnownScheme (PackScheme))
+                               UriParser.Register (new PackUriParser (), PackScheme, -1);
+               }
+               
+               public static int ComparePackUri (Uri firstPackUri, Uri secondPackUri)
+               {
+                       // FIXME: Do i need to do validation that it is a pack:// uri?
+                       if (firstPackUri == null)
+                               return secondPackUri == null ? 0 : -1;
+                       if (secondPackUri == null)
+                               return 1;
+
+                       // FIXME: What exactly is compared. Lets assume originalstring
+                       return firstPackUri.OriginalString.CompareTo (secondPackUri.OriginalString);
+               }
+
+               public static int ComparePartUri (Uri firstPartUri, Uri secondPartUri)
+               {
+                       // FIXME: Do i need to do validation that it is a part URI?
+                       if (firstPartUri == null)
+                               return secondPartUri == null ? 0 : -1;
+                       if (secondPartUri == null)
+                               return 1;
+
+                       return firstPartUri.OriginalString.CompareTo (secondPartUri.OriginalString);
+               }
+
+               public static Uri Create (Uri packageUri)
+               {
+                       return Create (packageUri, null, null);
+               }
+
+               public static Uri Create (Uri packageUri, Uri partUri)
+               {
+                       return Create (packageUri, partUri, null);
+               }
+
+               public static Uri Create (Uri packageUri, Uri partUri, string fragment)
+               {
+                       Check.PackageUri (packageUri);
+                       Check.PackageUriIsValid (packageUri);
+                       
+                       if (partUri != null)
+                               Check.PartUriIsValid (partUri);
+                       
+                       if (fragment != null && (fragment.Length == 0 || fragment[0] != '#'))
+                               throw new ArgumentException ("Fragment", "Fragment must not be empty and must start with '#'");
+
+                       // FIXME: Validate that partUri is a valid one? Must be relative, must start with '/'
+
+                       // First replace the slashes, then escape the special characters
+                       string orig = packageUri.OriginalString.Replace ('/', ',');
+                       
+                       if (partUri != null)
+                               orig += partUri.OriginalString;
+
+//                     if (sb[sb.Length - 1] != '/')
+//                             sb.Append ('/');
+
+                       if (fragment != null)
+                               orig += fragment;
+                       
+                       return new Uri ("pack://" + orig);
+               }
+
+               public static Uri CreatePartUri (Uri partUri)
+               {
+                       Check.PartUri (partUri);
+                       
+                       if (partUri.OriginalString[0] != '/')
+                               partUri = new Uri("/" + partUri.ToString (), UriKind.Relative);
+                       return partUri;
+               }
+
+               public static Uri GetNormalizedPartUri (Uri partUri)
+               {
+                       Check.PartUri (partUri);
+                       return new Uri (partUri.ToString ().ToUpperInvariant (), UriKind.Relative);
+               }
+
+               public static Uri GetPackageUri (Uri packUri)
+               {
+                       //Check.PackUri (packUri);
+                       string s = packUri.Host.Replace (',', '/');
+                       return new Uri (s, UriKind.Relative);
+               }
+
+               public static Uri GetPartUri (Uri packUri)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static Uri GetRelationshipPartUri (Uri partUri)
+               {
+                       Check.PartUri (partUri);
+                       Check.PartUriIsValid (partUri);
+                       
+                       int index = partUri.OriginalString.LastIndexOf ("/");
+                       string s = partUri.OriginalString.Substring (0, index);
+                       s += "/_rels" + partUri.OriginalString.Substring (index) + ".rels";
+                       return new Uri (s, UriKind.Relative);
+               }
+
+               public static Uri GetRelativeUri (Uri sourcePartUri, Uri targetPartUri)
+               {
+                       //Check.SourcePartUri (sourcePartUri);
+                       //Check.TargetPartUri (targetPartUri);
+
+                       return sourcePartUri;
+               }
+
+               public static Uri GetSourcePartUriFromRelationshipPartUri (Uri relationshipPartUri)
+               {
+                       //Check.RelationshipPartUri (relationshipPartUri);
+                       if (!IsRelationshipPartUri (relationshipPartUri))
+                               throw new Exception  ("is not a relationship part!?");
+                       return null;
+               }
+
+               public static bool IsRelationshipPartUri (Uri partUri)
+               {
+                       Check.PartUri (partUri);
+                       return partUri.OriginalString.StartsWith ("/_rels") && partUri.OriginalString.EndsWith (".rels");
+               }
+
+               public static Uri ResolvePartUri (Uri sourcePartUri, Uri targetUri)
+               {
+                       Check.SourcePartUri (sourcePartUri);
+                       Check.TargetUri (targetUri);
+                       
+                       Check.PartUriIsValid (sourcePartUri);
+                       Check.PartUriIsValid (targetUri);
+
+                       Console.WriteLine ("Merged to: {0}", new Uri (sourcePartUri, targetUri).OriginalString.Substring(7));
+                       return new Uri (new Uri(sourcePartUri, targetUri).OriginalString.Substring(7), UriKind.Relative);
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/PackUriParser.cs b/mcs/class/WindowsBase/System.IO.Packaging/PackUriParser.cs
new file mode 100644 (file)
index 0000000..f60c529
--- /dev/null
@@ -0,0 +1,111 @@
+// PackUriParser.cs created with MonoDevelop
+// User: alan at 14:50 31/10/2008
+//
+// To change standard headers go to Edit->Preferences->Coding->Standard Headers
+//
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace System.IO.Packaging
+{
+    class PackUriParser : System.GenericUriParser
+    {
+        const string SchemaName = "pack";
+
+        StringBuilder builder = new StringBuilder();
+
+        public PackUriParser ()
+            : base (GenericUriParserOptions.Default)
+        {
+        }
+        
+        protected override string GetComponents(Uri uri, UriComponents components, UriFormat format)
+        {
+            string s = uri.OriginalString;
+            builder.Remove(0, builder.Length);
+
+            if ((components & UriComponents.Scheme) == UriComponents.Scheme)
+            {
+                int start = 0;
+                int end = s.IndexOf(':');
+                builder.Append(s, start, end - start);
+            }
+
+            if ((components & UriComponents.Host) == UriComponents.Host)
+            {
+                // Skip past pack://
+                int start = 7;
+                int end = s.IndexOf('/', start);
+                if (end == -1)
+                    end = s.Length;
+
+                if (builder.Length > 0)
+                    builder.Append("://");
+
+                builder.Append(s, start, end - start);
+            }
+
+            // Port is always -1, so i think i can ignore both Port and StrongPort
+            // Normally they'd get parsed here
+
+            if ((components & UriComponents.Path) == UriComponents.Path)
+            {
+                // Skip past pack://
+                int start = s.IndexOf('/', 7);
+                int end = s.IndexOf('?');
+                if (end == -1)
+                    end = s.IndexOf('#');
+                if (end == -1)
+                    end = s.Length;
+
+                if ((components & UriComponents.KeepDelimiter) != UriComponents.KeepDelimiter &&
+                    builder.Length == 0)
+                    start++;
+
+                builder.Append(s, start, end - start);
+            }
+
+            if ((components & UriComponents.Query) == UriComponents.Query)
+            {
+                int index = s.IndexOf('?');
+                if (index == -1)
+                    return null;
+
+                if ((components & UriComponents.KeepDelimiter) != UriComponents.KeepDelimiter &&
+                    builder.Length == 0)
+                    index++;
+
+                int fragIndex = s.IndexOf('#');
+                int end = fragIndex == -1 ? s.Length : fragIndex;
+                builder.Append(s, index, end - index);
+            }
+
+            if ((components & UriComponents.Fragment) == UriComponents.Fragment)
+            {
+                int index = s.IndexOf('#');
+                if (index == -1)
+                    return null;
+
+                if ((components & UriComponents.KeepDelimiter) != UriComponents.KeepDelimiter &&
+                    builder.Length == 0)
+                    index++;
+
+                builder.Append(s, index, s.Length - index);
+            }
+
+            return builder.ToString();
+        }
+        
+        protected override void InitializeAndValidate(Uri uri, out UriFormatException parsingError)
+        {
+            parsingError = null;
+        }
+
+        protected override UriParser OnNewUri()
+        {
+            return new PackUriParser();
+        }
+    }
+}
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/Package.cs b/mcs/class/WindowsBase/System.IO.Packaging/Package.cs
new file mode 100644 (file)
index 0000000..83b6922
--- /dev/null
@@ -0,0 +1,435 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//     Alan McGovern (amcgovern@novell.com)
+//
+
+using System;
+using System.Collections.Generic;
+using System.Xml;
+
+namespace System.IO.Packaging {
+
+       public abstract class Package : IDisposable
+       {
+               internal const string RelationshipContentType = "application/vnd.openxmlformats-package.relationships+xml";
+               internal const string RelationshipNamespace = "http://schemas.openxmlformats.org/package/2006/relationships";
+               internal static readonly Uri RelationshipUri = new Uri ("/_rels/.rels", UriKind.Relative);
+               
+               PackagePartCollection partsCollection = new PackagePartCollection ();
+               PackageRelationshipCollection relationshipsCollection = new PackageRelationshipCollection ();
+               
+               Dictionary<string, PackageRelationship> relationships;
+               
+               Dictionary<string, PackageRelationship> Relationships {
+                       get {
+                               if (relationships == null) {
+                                       relationships = new Dictionary<string, PackageRelationship> ();
+                                       
+                                       if (PartExists (RelationshipUri))
+                                               using (Stream stream = GetPart (RelationshipUri).GetStream ())
+                                                       LoadRelationships (relationships, stream);
+                               }
+                               return relationships;
+                       }
+               }
+               
+               Uri Uri = new Uri ("/", UriKind.Relative);
+               
+               protected Package (FileAccess fileOpenAccess)
+                       : this (fileOpenAccess, false)
+               {
+                       
+               }
+
+               protected Package (FileAccess fileOpenAccess, bool streaming)
+               {
+                       FileOpenAccess = fileOpenAccess;
+                       Streaming = streaming;
+               }
+
+               void IDisposable.Dispose ()
+               {
+                       Flush ();
+                       Dispose (true);
+               }
+
+               protected virtual void Dispose (bool disposing)
+               {
+                       // Nothing here needs to be disposed of
+               }
+
+               public FileAccess FileOpenAccess {
+                       get; private set;
+               }
+
+               public PackageProperties PackageProperties {
+                       get; private set;
+               }
+
+               private int RelationshipId {
+                       get; set;
+               }
+
+               private bool Streaming {
+                       get; set;
+               }
+
+               internal void CheckIsReadOnly ()
+               {
+                       if (FileOpenAccess == FileAccess.Read)
+                               throw new IOException ("Operation not valid when package is read-only");
+               }
+               
+               public void Close ()
+               {
+                       // FIXME: Ensure that Flush is actually called before dispose
+                       Flush ();
+                       Dispose (true);
+               }
+
+               public void Flush ()
+               {
+                       // I should have a dirty boolean
+                       if (FileOpenAccess != FileAccess.Read)
+                               FlushCore ();
+               }
+
+               protected abstract void FlushCore ();
+
+               public PackagePart CreatePart (Uri partUri, string contentType)
+               {
+                       return CreatePart (partUri, contentType, CompressionOption.NotCompressed);
+               }
+
+               public PackagePart CreatePart (Uri partUri, string contentType, CompressionOption compressionOption)
+               {
+                       CheckIsReadOnly ();
+                       Check.PartUri (partUri);
+                       Check.ContentTypeIsValid (contentType);
+
+                       if (PartExists (partUri))
+                               throw new InvalidOperationException ("This partUri is already contained in the package");
+                       
+                       PackagePart part = CreatePartCore (partUri, contentType, compressionOption);
+                       partsCollection.Parts.Add (part);
+                       return part;
+               }
+
+               public void DeletePart (Uri partUri)
+               {
+                       CheckIsReadOnly ();
+                       Check.PartUri (partUri);
+
+                       PackagePart part = GetPart (partUri);
+                       if (part != null)
+                       {
+                               if (part.Package == null)
+                                       throw new InvalidOperationException ("This part has already been removed");
+                               
+                               // FIXME: MS.NET doesn't remove the relationship part
+                               // Instead it throws an exception if you try to use it
+                               if (PartExists (part.RelationshipsPartUri))
+                                       GetPart (part.RelationshipsPartUri).Package = null;
+
+                               part.Package = null;
+                               DeletePartCore (partUri);
+                               partsCollection.Parts.RemoveAll (p => p.Uri == partUri);
+                       }
+               }
+
+               protected abstract PackagePart CreatePartCore (Uri parentUri, string contentType, CompressionOption compressionOption);
+               protected abstract void DeletePartCore (Uri partUri);
+
+               public PackageRelationship CreateRelationship (Uri targetUri, TargetMode targetMode, string relationshipType)
+               {
+                       return CreateRelationship (targetUri, targetMode, relationshipType, null);
+               }
+
+               public PackageRelationship CreateRelationship (Uri targetUri, TargetMode targetMode, string relationshipType, string id)
+               {
+                       return CreateRelationship (targetUri, targetMode, relationshipType, id, false);
+               }
+
+               internal PackageRelationship CreateRelationship (Uri targetUri, TargetMode targetMode, string relationshipType, string id, bool loading)
+               {
+                       CheckIsReadOnly ();
+                       Check.TargetUri (targetUri);
+                       
+                       Check.RelationshipTypeIsValid (relationshipType);
+                       Check.IdIsValid (id);
+
+                       if (id == null)
+                               id = NextId ();
+
+                       PackageRelationship r = new PackageRelationship (id, this, relationshipType, Uri, targetMode, targetUri);
+
+                       if (!PartExists (RelationshipUri))
+                               CreatePart (RelationshipUri, RelationshipContentType).IsRelationship = true;
+                       
+                       Relationships.Add (r.Id, r);
+                       relationshipsCollection.Relationships.Add (r);
+
+                       if (!loading) {
+                               using (Stream s = GetPart (RelationshipUri).GetStream ())
+                                       WriteRelationships (relationships, s);
+                       }
+                       
+                       return r;
+               }
+
+               public void DeleteRelationship (string id)
+               {
+                       Check.Id (id);
+                       CheckIsReadOnly ();
+                       
+                       Relationships.Remove (id);
+
+                       relationshipsCollection.Relationships.RemoveAll (r => r.Id == id);
+                       if (Relationships.Count > 0)
+                               using (Stream s = GetPart (RelationshipUri).GetStream ())
+                                       WriteRelationships (relationships, s);
+                       else
+                               DeletePart (RelationshipUri);
+               }
+
+               public PackagePart GetPart (Uri partUri)
+               {
+                       Check.PartUri (partUri);
+                       return GetPartCore (partUri);
+               }
+
+               protected abstract PackagePart GetPartCore (Uri partUri);
+
+               public PackagePartCollection GetParts ()
+               {
+                       partsCollection.Parts.Clear ();
+                       partsCollection.Parts.AddRange (GetPartsCore());
+                       return partsCollection;
+               }
+
+               protected abstract PackagePart [] GetPartsCore ();
+
+
+               public virtual bool PartExists (Uri partUri)
+               {
+                       return GetPart (partUri) != null;
+               }
+
+               public PackageRelationship GetRelationship (string id)
+               {
+                       return Relationships [id];
+               }
+
+               public PackageRelationshipCollection GetRelationships ()
+               {
+                       relationshipsCollection.Relationships.Clear ();
+                       relationshipsCollection.Relationships.AddRange (Relationships.Values);
+                       return relationshipsCollection;
+               }
+
+               public PackageRelationshipCollection GetRelationshipsByType (string relationshipType)
+               {
+                       PackageRelationshipCollection collection = new PackageRelationshipCollection ();
+                       foreach (PackageRelationship r in Relationships.Values)
+                               if (r.RelationshipType == relationshipType)
+                                       collection.Relationships.Add (r);
+                       
+                       return collection;
+               }
+
+               public bool RelationshipExists (string id)
+               {
+                       return Relationships.ContainsKey (id);
+               }
+
+               void LoadRelationships (Dictionary<string, PackageRelationship> relationships, Stream stream)
+               {
+                       XmlDocument doc = new XmlDocument ();
+                       doc.Load (stream);
+                       XmlNamespaceManager manager = new XmlNamespaceManager (doc.NameTable);
+                       manager.AddNamespace ("rel", RelationshipNamespace);
+
+                       foreach (XmlNode node in doc.SelectNodes ("/rel:Relationships/*", manager))
+                       {
+                               
+                               TargetMode mode = TargetMode.Internal;
+                               if (node.Attributes["TargetMode"] != null)
+                                       mode = (TargetMode) Enum.Parse (typeof(TargetMode), node.Attributes ["TargetMode"].Value);
+                               
+                               CreateRelationship (new Uri (node.Attributes ["Target"].Value.ToString(), UriKind.Relative),
+                                                   mode,
+                                                   node.Attributes["Type"].Value.ToString (),
+                                                   node.Attributes["Id"].Value.ToString (),
+                                                   true);
+                       }
+               }
+               
+               private string NextId ()
+               {
+                       while (true)
+                       {
+                               string s = RelationshipId.ToString ();
+                               if (!Relationships.ContainsKey (s))
+                                       return s;
+                               
+                               RelationshipId++;
+                       }
+               }
+
+               public static Package Open (Stream stream)
+               {
+                       return Open (stream, FileMode.Open);
+               }
+
+               public static Package Open (string path)
+               {
+                       return Open (path, FileMode.OpenOrCreate);
+               }
+
+               public static Package Open (Stream stream, FileMode packageMode)
+               {
+                       FileAccess access = packageMode == FileMode.Open ? FileAccess.Read : FileAccess.ReadWrite;
+                       return Open (stream, packageMode, access);
+               }
+
+               public static Package Open (string path, FileMode packageMode)
+               {
+                       return Open (path, packageMode, FileAccess.ReadWrite);
+               }
+
+               public static Package Open (Stream stream, FileMode packageMode, FileAccess packageAccess)
+               {
+                       return OpenCore (stream, packageMode, packageAccess);
+               }
+
+               public static Package Open (string path, FileMode packageMode, FileAccess packageAccess)
+               {
+                       return Open (path, packageMode, packageAccess, FileShare.None);
+               }
+
+               public static Package Open (string path, FileMode packageMode, FileAccess packageAccess, FileShare packageShare)
+               {
+                       if (packageShare != FileShare.Read && packageShare != FileShare.None)
+                               throw new NotSupportedException ("FileShare.Read and FileShare.None are the only supported options");
+
+                       FileInfo info = new FileInfo (path);
+                       
+                       // Bug - MS.NET appears to test for FileAccess.ReadWrite, not FileAccess.Write
+                       if (packageAccess != FileAccess.ReadWrite && !info.Exists)
+                               throw new ArgumentException ("packageAccess", "Cannot create stream with FileAccess.Read");
+
+                       
+                       if (info.Exists && packageMode == FileMode.OpenOrCreate && info.Length == 0)
+                               throw new FileFormatException ("Stream length cannot be zero with FileMode.Open");
+
+                       Stream s = File.Open (path, packageMode, packageAccess, packageShare);
+                       return Open (s, packageMode, packageAccess);
+               }
+
+               private static Package OpenCore (Stream stream, FileMode packageMode, FileAccess packageAccess)
+               {
+                       if ((packageAccess & FileAccess.Read) == FileAccess.Read && !stream.CanRead)
+                               throw new IOException ("Stream does not support reading");
+
+                       if ((packageAccess & FileAccess.Write) == FileAccess.Write && !stream.CanWrite)
+                               throw new IOException ("Stream does not support reading");
+                       
+                       if (!stream.CanSeek)
+                               throw new ArgumentException ("stream", "Stream must support seeking");
+                       
+                       if (packageMode == FileMode.Open && stream.Length == 0)
+                               throw new FileFormatException("Stream length cannot be zero with FileMode.Open");
+
+                       if (packageMode == FileMode.CreateNew && stream.Length > 0)
+                               throw new IOException ("Cannot use CreateNew when stream contains data");
+
+                       if (packageMode == FileMode.Append || packageMode == FileMode.Truncate)
+                       {
+                               if (stream.CanWrite)
+                                       throw new NotSupportedException (string.Format("PackageMode.{0} is not supported", packageMode));
+                               else
+                                       throw new IOException (string.Format("PackageMode.{0} is not supported", packageMode));
+                       }
+
+                       // Test to see if archive is valid
+                       if (stream.Length > 0 && packageAccess == FileAccess.Read) {
+                               try {
+                                       using (zipsharp.UnzipArchive a = new zipsharp.UnzipArchive (stream)) {
+                                       }
+                               } catch {
+                                       throw new FileFormatException ("The specified archive is invalid.");
+                               }
+                       }
+                       
+                       // FIXME: MS docs say that a ZipPackage is returned by default.
+                       // It looks like if you create a custom package, you cannot use Package.Open.
+
+                       // FIXME: This is a horrible hack. If a package is opened in readonly mode, i
+                       // need to pretend i have read/write mode so i can load the PackageParts
+                       // and PackageRelations. I think the 'streaming' boolean might be used for this.
+                       ZipPackage package = new ZipPackage (packageAccess);
+                       package.PackageStream = stream;
+                       package.FileOpenAccess = FileAccess.ReadWrite;
+                       package.GetParts ();
+                       package.GetRelationships();
+                       package.FileOpenAccess = packageAccess;
+                       return package;
+               }
+
+               internal static void WriteRelationships (Dictionary <string, PackageRelationship> relationships, Stream stream)
+               {
+                       XmlDocument doc = new XmlDocument ();
+                       XmlNamespaceManager manager = new XmlNamespaceManager (doc.NameTable);
+                       manager.AddNamespace ("rel", RelationshipNamespace);
+
+                       doc.AppendChild (doc.CreateNode (XmlNodeType.XmlDeclaration, "", ""));
+                       
+                       XmlNode root = doc.CreateNode (XmlNodeType.Element, "Relationships", RelationshipNamespace);
+                       doc.AppendChild (root);
+                       
+                       foreach (PackageRelationship relationship in relationships.Values)
+                       {
+                               XmlNode node = doc.CreateNode (XmlNodeType.Element, "Relationship", RelationshipNamespace);
+                               
+                               XmlAttribute idAtt = doc.CreateAttribute ("Id");
+                               idAtt.Value = relationship.Id;
+                               node.Attributes.Append(idAtt);
+                               
+                               XmlAttribute targetAtt = doc.CreateAttribute ("Target");
+                               targetAtt.Value = relationship.TargetUri.ToString ();
+                               node.Attributes.Append(targetAtt);
+                               
+                               XmlAttribute typeAtt = doc.CreateAttribute ("Type");
+                               typeAtt.Value = relationship.RelationshipType;
+                               node.Attributes.Append(typeAtt);
+                               
+                               root.AppendChild (node);
+                       }
+
+                       using (XmlTextWriter writer = new XmlTextWriter (stream, System.Text.Encoding.UTF8))
+                               doc.WriteTo (writer);
+               }
+       }
+}
+
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/PackageDigitalSignature.cs b/mcs/class/WindowsBase/System.IO.Packaging/PackageDigitalSignature.cs
new file mode 100644 (file)
index 0000000..6431a6b
--- /dev/null
@@ -0,0 +1,101 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Security;
+using System.Security.Cryptography.X509Certificates;
+
+namespace System.IO.Packaging {
+
+       public class PackageDigitalSignature
+       {
+               internal PackageDigitalSignature ()
+               {
+               }
+
+               public CertificateEmbeddingOption CertificateEmbeddingOption {
+                       get { throw new NotImplementedException (); }
+               }
+
+#if notyet
+               public System.Security.Cryptography.Xml.Signature Signature {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
+#endif
+
+               public PackagePart SignaturePart {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public string SignatureType {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public byte[] SignatureValue {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public ReadOnlyCollection<Uri> SignedParts {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public ReadOnlyCollection<PackageRelationshipSelector> SignedRelationshipSelectors {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public X509Certificate Signer {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public DateTime SigningTime {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public string TimeFormat {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public List<string> GetPartTransformList(Uri partName)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public VerifyResult Verify()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [SecurityCritical]
+               [SecurityTreatAsSafe]
+               public VerifyResult Verify(X509Certificate signingCertificate)
+               {
+                       throw new NotImplementedException ();
+               }
+
+       }
+}
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/PackageDigitalSignatureManager.cs b/mcs/class/WindowsBase/System.IO.Packaging/PackageDigitalSignatureManager.cs
new file mode 100644 (file)
index 0000000..1d72eb6
--- /dev/null
@@ -0,0 +1,164 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Security;
+using System.Security.Cryptography.X509Certificates;
+
+namespace System.IO.Packaging {
+
+       public class PackageDigitalSignatureManager
+       {
+               public static string DefaultHashAlgorithm {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public static string SignatureOriginRelationshipType {
+                       get { throw new NotImplementedException (); }
+               }
+
+
+               public PackageDigitalSignatureManager (Package package)
+               {
+                       throw new NotImplementedException ();
+               }
+
+
+               public CertificateEmbeddingOption CertificateOption {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
+
+               public string HashAlgorithm {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
+
+               public bool IsSigned {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public IntPtr ParentWindow {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
+
+               public Uri SignatureOrigin {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public ReadOnlyCollection<PackageDigitalSignature> Signatures {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public string TimeFormat {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public Dictionary<string, string> TransformMapping {
+                       get { throw new NotImplementedException (); }
+               }
+
+
+               public event InvalidSignatureEventHandler InvalidSignatureEvent;
+
+               public PackageDigitalSignature Countersign()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public PackageDigitalSignature Countersign(X509Certificate certificate)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public PackageDigitalSignature Countersign(X509Certificate certificate, IEnumerable<Uri> signatures)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public PackageDigitalSignature GetSignature (Uri signatureUri)
+               {
+                       throw new NotImplementedException ();
+               }
+
+
+               public void RemoveSignature (Uri signatureUri)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public void RemoveAllSignatures ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+
+               public PackageDigitalSignature Sign (IEnumerable<Uri> parts)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public PackageDigitalSignature Sign (IEnumerable<Uri> parts, X509Certificate certificate)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public PackageDigitalSignature Sign (IEnumerable<Uri> parts, X509Certificate certificate, IEnumerable<PackageRelationshipSelector> relationshipSelectors)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public PackageDigitalSignature Sign (IEnumerable<Uri> parts, X509Certificate certificate, IEnumerable<PackageRelationshipSelector> relationshipSelectors,
+                                                    string signatureId)
+               {
+                       throw new NotImplementedException ();
+               }
+
+#if notyet
+               public PackageDigitalSignature Sign (IEnumerable<Uri> parts, X509Certificate certificate, IEnumerable<PackageRelationshipSelector> relationshipSelectors,
+                                                    string signatureId,
+                                                    IEnumerable<System.Security.Cryptography.Xml.DataObject> signatureObjects,
+                                                    IEnumerable<System.Security.Cryptography.Xml.Reference> objectReferences)
+               {
+                       throw new NotImplementedException ();
+               }
+#endif
+
+               [SecurityCritical]
+               public static X509ChainStatusFlags VerifyCertificate (X509Certificate certificate)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public VerifyResult VerifySignatures (bool exitOnFailure)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/PackagePart.cs b/mcs/class/WindowsBase/System.IO.Packaging/PackagePart.cs
new file mode 100644 (file)
index 0000000..98c116c
--- /dev/null
@@ -0,0 +1,260 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//  Alan McGovern (amcgovern@novell.com)
+//
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Xml;
+
+namespace System.IO.Packaging {
+
+       public abstract class PackagePart
+       {
+               string contentType;
+               
+               internal bool IsRelationship { get; set; }
+               
+               int relationshipId;
+               Dictionary<string, PackageRelationship> relationships;
+               PackageRelationshipCollection relationshipsCollection = new PackageRelationshipCollection ();
+               
+               Dictionary<string, PackageRelationship> Relationships {
+                       get {
+                               if (relationships == null) {
+                                       relationships = new Dictionary<string, PackageRelationship> (StringComparer.OrdinalIgnoreCase);
+                                       if (Package.PartExists (RelationshipsPartUri))
+                                               using (Stream s = Package.GetPart (RelationshipsPartUri).GetStream ())
+                                                       LoadRelationships (relationships, s);
+                               }
+
+                               return relationships;
+                       }
+               }
+               Stream PartStream { get; set;  }
+
+               internal Uri RelationshipsPartUri {
+                       get; set;
+               }
+               
+               protected PackagePart (Package package, Uri partUri)
+                       : this(package, partUri, null)
+               {
+                       
+               }
+
+               protected internal PackagePart (Package package, Uri partUri, string contentType)
+                       : this (package, partUri, contentType, CompressionOption.Normal)
+               {
+                       
+               }
+
+               protected internal PackagePart (Package package, Uri partUri, string contentType, CompressionOption compressionOption)
+               {
+                       Check.Package (package);
+                       Check.PartUri (partUri);
+                       Check.ContentTypeIsValid (contentType);
+
+                       Package = package;
+                       Uri = partUri;
+                       ContentType = contentType;
+                       CompressionOption = compressionOption;
+                       RelationshipsPartUri = PackUriHelper.GetRelationshipPartUri(Uri);
+               }
+
+               public CompressionOption CompressionOption {
+                       get; private set;
+               }
+
+               public string ContentType {
+                       get {
+                               if (contentType == null && (contentType = GetContentTypeCore()) == null)
+                                       throw new NotSupportedException ("If contentType is not supplied in the constructor, GetContentTypeCore must be overridden");
+                               return contentType;
+                       }
+                       private set {
+                               contentType = value;
+                       }
+               }
+
+               public Package Package {
+                       get; internal set;
+               }
+
+               public Uri Uri {
+                       get; private set;
+               }
+
+               private void CheckIsRelationship ()
+               {
+                       if (IsRelationship)
+                               throw new InvalidOperationException ("A relationship cannot have relationships to other parts"); 
+               }
+
+               public PackageRelationship CreateRelationship (Uri targetUri, TargetMode targetMode, string relationshipType)
+               {
+                       return CreateRelationship (targetUri, targetMode, relationshipType, null);
+               }
+
+               public PackageRelationship CreateRelationship (Uri targetUri, TargetMode targetMode, string relationshipType, string id)
+               {
+                       return CreateRelationship (targetUri, targetMode, relationshipType, id, false);
+               }
+
+               private PackageRelationship CreateRelationship (Uri targetUri, TargetMode targetMode, string relationshipType, string id, bool loading)
+               {
+                       Package.CheckIsReadOnly ();
+                       Check.TargetUri (targetUri);
+                       Check.RelationshipTypeIsValid (relationshipType);
+                       Check.IdIsValid (id);
+
+                       if (id == null)
+                               id = NextId ();
+
+                       if (Relationships.ContainsKey (id))
+                               throw new XmlException ("A relationship with this ID already exists");
+                       
+                       PackageRelationship r = new PackageRelationship (id, Package, relationshipType, Uri, targetMode, targetUri);
+                       Relationships.Add (r.Id, r);
+
+                       if (!loading)
+                               WriteRelationships ();
+                       return r;
+               }
+
+               public void DeleteRelationship (string id)
+               {
+                       Package.CheckIsReadOnly ();
+                       CheckIsRelationship ();
+                       Relationships.Remove (id);
+                       WriteRelationships ();
+               }
+
+               void LoadRelationships (Dictionary<string, PackageRelationship> relationships, Stream stream)
+               {
+                       XmlDocument doc = new XmlDocument ();
+                       doc.Load (stream);
+                       XmlNamespaceManager manager = new XmlNamespaceManager (doc.NameTable);
+                       manager.AddNamespace ("rel", Package.RelationshipNamespace);
+
+                       foreach (XmlNode node in doc.SelectNodes ("/rel:Relationships/*", manager))
+                       {
+                               TargetMode mode = TargetMode.Internal;
+                               if (node.Attributes["TargetMode"] != null)
+                                       mode = (TargetMode) Enum.Parse (typeof(TargetMode), node.Attributes ["TargetMode"].Value);
+                               
+                               CreateRelationship (new Uri ("/" + node.Attributes["Target"].Value.ToString(), UriKind.Relative),
+                                                   mode,
+                                                   node.Attributes["Type"].Value.ToString (),
+                                                   node.Attributes["Id"].Value.ToString (),
+                                                   true);
+                       }
+               }
+
+               public bool RelationshipExists (string id)
+               {
+                       CheckIsRelationship ();
+                       return Relationships.ContainsKey (id);
+               }
+
+               public PackageRelationship GetRelationship (string id)
+               {
+                       CheckIsRelationship ();
+                       return Relationships [id];
+               }
+
+               public PackageRelationshipCollection GetRelationships ()
+               {
+                       CheckIsRelationship ();
+                       relationshipsCollection.Relationships.Clear ();
+                       relationshipsCollection.Relationships.AddRange (Relationships.Values);
+                       return relationshipsCollection;
+               }
+
+               public PackageRelationshipCollection GetRelationshipsByType (string relationshipType)
+               {
+                       CheckIsRelationship ();
+                       PackageRelationshipCollection collection = new PackageRelationshipCollection ();
+                       foreach (PackageRelationship r in Relationships.Values)
+                               if (r.RelationshipType == relationshipType)
+                                       collection.Relationships.Add (r);
+                       
+                       return collection;
+               }
+
+               public Stream GetStream ()
+               {
+                       // FIXME: Need to find out what kind of access the streams are usually opened with
+                       // Appears to be read/write/seek == true.
+                       return GetStream (Package.FileOpenAccess == FileAccess.Read && !IsRelationship ? FileMode.Open : FileMode.OpenOrCreate);
+               }
+
+               public Stream GetStream (FileMode mode)
+               {
+                       return GetStream (mode, IsRelationship ? FileAccess.ReadWrite : Package.FileOpenAccess);
+               }
+
+               public Stream GetStream (FileMode mode, FileAccess access)
+               {
+                       return GetStreamCore (mode, access);
+               }
+
+               protected abstract Stream GetStreamCore (FileMode mode, FileAccess access);
+
+               protected virtual string GetContentTypeCore ()
+               {
+                       return null;
+               }
+
+               private string NextId ()
+               {
+                       while (true)
+                       {
+                               string s = relationshipId.ToString ();
+                               if (!RelationshipExists (s))
+                                       return s;
+                               relationshipId ++;
+                       }
+               }
+
+               void WriteRelationships ()
+               {
+                       bool exists = Package.PartExists (RelationshipsPartUri);
+                       if (exists && Relationships.Count == 0)
+                       {
+                               Package.DeletePart (RelationshipsPartUri);
+                               return;
+                       }
+                       
+                       if (!exists)
+                       {
+                               PackagePart part = Package.CreatePart (RelationshipsPartUri, Package.RelationshipContentType);
+                               part.IsRelationship = true;
+                       }
+                       using (Stream s = Package.GetPart (RelationshipsPartUri).GetStream ())
+                               Package.WriteRelationships (Relationships, s);
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/PackagePartCollection.cs b/mcs/class/WindowsBase/System.IO.Packaging/PackagePartCollection.cs
new file mode 100644 (file)
index 0000000..2ce5cdf
--- /dev/null
@@ -0,0 +1,52 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Chris Toshok (toshok@ximian.com)
+// Alan McGovern (amcgovern@novell.com)
+//
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+namespace System.IO.Packaging {
+
+       public class PackagePartCollection : IEnumerable<PackagePart>, IEnumerable
+       {
+               internal List<PackagePart> Parts { get; private set; }
+               
+               internal PackagePartCollection ()
+               {
+                       Parts = new List<PackagePart> ();
+               }
+
+               IEnumerator<PackagePart> IEnumerable<PackagePart>.GetEnumerator ()
+               {
+                       return Parts.GetEnumerator ();
+               }
+
+               IEnumerator IEnumerable.GetEnumerator ()
+               {
+                       return Parts.GetEnumerator ();
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/PackageProperties.cs b/mcs/class/WindowsBase/System.IO.Packaging/PackageProperties.cs
new file mode 100644 (file)
index 0000000..a850019
--- /dev/null
@@ -0,0 +1,65 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.IO.Packaging {
+
+       public abstract class PackageProperties : IDisposable
+       {
+               protected PackageProperties ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public void Dispose ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected virtual void Dispose (bool disposing)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public abstract string Category { get; set; }
+               public abstract string ContentStatus { get; set; }
+               public abstract string ContentType { get; set; }
+               public abstract DateTime? Created { get; set; }
+               public abstract string Creator { get; set; }
+               public abstract string Description { get; set; }
+               public abstract string Identifier { get; set; }
+               public abstract string Keywords { get; set; }
+               public abstract string Language { get; set; }
+               public abstract string LastModifiedBy { get; set; }
+               public abstract DateTime? LastPrinted { get; set; }
+               public abstract DateTime? Modified { get; set; }
+               public abstract string Revision { get; set; }
+               public abstract string Subject { get; set; }
+               public abstract string Title { get; set; }
+               public abstract string Version { get; set; }
+       }
+
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/PackageRelationship.cs b/mcs/class/WindowsBase/System.IO.Packaging/PackageRelationship.cs
new file mode 100644 (file)
index 0000000..9e0df5e
--- /dev/null
@@ -0,0 +1,68 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.IO.Packaging {
+
+       public class PackageRelationship
+       {
+               internal PackageRelationship (string id, Package package, string relationshipType,
+                                             Uri sourceUri, TargetMode targetMode, Uri targetUri)
+               {
+                       Check.IdIsValid (id);
+                       Check.Package (package);
+                       Check.RelationshipTypeIsValid (relationshipType);
+                       Check.SourceUri (sourceUri);
+                       Check.TargetUri (targetUri);
+
+                       Id = id;
+                       Package = package;
+                       RelationshipType = relationshipType;
+                       SourceUri = sourceUri;
+                       TargetMode = targetMode;
+                       TargetUri = targetUri;
+               }
+
+               public string Id {
+                       get; private set;
+               }
+               public Package Package {
+                       get; private set;
+               }
+               public string RelationshipType {
+                       get; private set;
+               }
+               public Uri SourceUri {
+                       get; private set;
+               }
+               public TargetMode TargetMode {
+                       get; private set;
+               }
+               public Uri TargetUri  {
+                       get; private set;
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/PackageRelationshipCollection.cs b/mcs/class/WindowsBase/System.IO.Packaging/PackageRelationshipCollection.cs
new file mode 100644 (file)
index 0000000..9d1b19b
--- /dev/null
@@ -0,0 +1,52 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Chris Toshok (toshok@ximian.com)
+// Alan McGovern (amcgovern@novell.com)
+//
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+namespace System.IO.Packaging {
+
+       public class PackageRelationshipCollection : IEnumerable<PackageRelationship>, IEnumerable
+       {
+               internal List<PackageRelationship> Relationships { get; private set; }
+               
+               internal PackageRelationshipCollection ()
+               {
+                       Relationships = new List<PackageRelationship> ();
+               }
+
+               public IEnumerator<PackageRelationship> GetEnumerator ()
+               {
+                       return Relationships.GetEnumerator ();
+               }
+
+               IEnumerator IEnumerable.GetEnumerator ()
+               {
+                       return GetEnumerator();
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/PackageRelationshipSelector.cs b/mcs/class/WindowsBase/System.IO.Packaging/PackageRelationshipSelector.cs
new file mode 100644 (file)
index 0000000..087adf0
--- /dev/null
@@ -0,0 +1,55 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Collections.Generic;
+
+namespace System.IO.Packaging {
+       public sealed class PackageRelationshipSelector {
+               public PackageRelationshipSelector (Uri sourceUri, PackageRelationshipSelectorType selectorType, string selectionCriteria)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public string SelectionCriteria {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public PackageRelationshipSelectorType SelectorType {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public Uri SourceUri {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public List<PackageRelationship> Select(Package package)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
+
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/PackageRelationshipSelectorType.cs b/mcs/class/WindowsBase/System.IO.Packaging/PackageRelationshipSelectorType.cs
new file mode 100644 (file)
index 0000000..bf354df
--- /dev/null
@@ -0,0 +1,33 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+namespace System.IO.Packaging {
+
+       public enum PackageRelationshipSelectorType {
+               Id,
+               Type
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/RightsManagementInformation.cs b/mcs/class/WindowsBase/System.IO.Packaging/RightsManagementInformation.cs
new file mode 100644 (file)
index 0000000..48c1180
--- /dev/null
@@ -0,0 +1,74 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Collections.Generic;
+using System.Security.RightsManagement;
+
+namespace System.IO.Packaging {
+
+       public class RightsManagementInformation
+       {
+               internal RightsManagementInformation ()
+               {
+               }
+
+               public CryptoProvider CryptoProvider {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
+
+               public void DeleteUseLicense (ContentUser userKey)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public IDictionary<ContentUser, UseLicense> GetEmbeddedUseLicenses()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public PublishLicense LoadPublishLicense ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public UseLicense LoadUseLicense (ContentUser userKey)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public void SavePublishLicense (PublishLicense publishLicense)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public void SaveUseLicense (ContentUser userKey, UseLicense useLicense)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/SignatureVerificationEventArgs.cs b/mcs/class/WindowsBase/System.IO.Packaging/SignatureVerificationEventArgs.cs
new file mode 100644 (file)
index 0000000..eb7dd01
--- /dev/null
@@ -0,0 +1,45 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.IO.Packaging {
+
+       public class SignatureVerificationEventArgs : EventArgs
+       {
+               internal SignatureVerificationEventArgs ()
+               {
+               }
+
+               public PackageDigitalSignature Signature {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public VerifyResult VerifyResult {
+                       get { throw new NotImplementedException (); }
+               }
+       }
+
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/StorageInfo.cs b/mcs/class/WindowsBase/System.IO.Packaging/StorageInfo.cs
new file mode 100644 (file)
index 0000000..a81906f
--- /dev/null
@@ -0,0 +1,98 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.IO.Packaging {
+
+       public class StorageInfo
+       {
+               internal StorageInfo ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public string Name {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public StreamInfo CreateStream (string name)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public StreamInfo CreateStream (string name, CompressionOption compressionOption, EncryptionOption encryptionOption)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public StorageInfo CreateSubStorage (string name)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public void DeleteStream (string name)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public void DeleteSubStorage (string name)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public StreamInfo GetStreamInfo (string name)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public StreamInfo[] GetStreams ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public StorageInfo GetSubStorageInfo (string name)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public StorageInfo[] GetSubStorages ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public bool StreamExists (string name)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public bool SubStorageExists (string name)
+               {
+                       throw new NotImplementedException ();
+               }
+
+       }
+
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/StreamInfo.cs b/mcs/class/WindowsBase/System.IO.Packaging/StreamInfo.cs
new file mode 100644 (file)
index 0000000..bd122ad
--- /dev/null
@@ -0,0 +1,65 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.IO;
+
+namespace System.IO.Packaging {
+
+       public class StreamInfo
+       {
+               internal StreamInfo ()
+               {
+               }
+
+               public CompressionOption CompressionOption {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public EncryptionOption EncryptionOption {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public string Name {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public Stream GetStream ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public Stream GetStream (FileMode mode)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public Stream GetStream (FileMode mode, FileAccess access)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/TargetMode.cs b/mcs/class/WindowsBase/System.IO.Packaging/TargetMode.cs
new file mode 100644 (file)
index 0000000..cee3a01
--- /dev/null
@@ -0,0 +1,33 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+namespace System.IO.Packaging {
+
+       public enum TargetMode {
+               Internal,
+               External
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/VerifyResult.cs b/mcs/class/WindowsBase/System.IO.Packaging/VerifyResult.cs
new file mode 100644 (file)
index 0000000..9c70565
--- /dev/null
@@ -0,0 +1,38 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+namespace System.IO.Packaging {
+
+       public enum VerifyResult {
+               Success,
+
+               InvalidSignature,
+               CertificateRequired,
+               InvalidCertificate,
+               ReferenceNotFound,
+               NotSigned
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/ZipPackage.cs b/mcs/class/WindowsBase/System.IO.Packaging/ZipPackage.cs
new file mode 100644 (file)
index 0000000..28acee8
--- /dev/null
@@ -0,0 +1,221 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Xml;
+using zipsharp;
+
+namespace System.IO.Packaging {
+
+       class UriComparer : IEqualityComparer<Uri>
+       {
+               public int GetHashCode(Uri uri)
+               {
+                       return 1;
+               }
+               
+               public bool Equals(Uri x, Uri y)
+               {
+                       return x.OriginalString.Equals (y.OriginalString, StringComparison.OrdinalIgnoreCase);
+               }
+       }
+       
+       public sealed class ZipPackage : Package
+       {
+               private const string ContentNamespace = "http://schemas.openxmlformats.org/package/2006/content-types";
+               private const string ContentUri = "[Content_Types].xml";
+               
+               Dictionary<Uri, ZipPackagePart> parts;
+               internal Dictionary<Uri, MemoryStream> PartStreams = new Dictionary<Uri, MemoryStream> (new  UriComparer());
+
+               internal Stream PackageStream { get; set; }
+
+               Dictionary<Uri, ZipPackagePart> Parts {
+                       get {
+                               if (parts == null)
+                                       LoadParts ();
+                               return parts;
+                       }
+               }
+               internal ZipPackage (FileAccess access)
+                       : base (access)
+               {
+
+               }
+
+               internal ZipPackage (FileAccess access, bool streaming)
+                       : base (access, streaming)
+               {
+
+               }
+               
+               protected override void Dispose (bool disposing)
+               {
+                       foreach (Stream s in PartStreams.Values)
+                               s.Close ();
+                       
+                       PackageStream.Close ();
+               }
+
+               protected override void FlushCore ()
+               {
+                       // 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 ();
+
+                       // Empty the package stream
+                       PackageStream.Position = 0;
+                       PackageStream.SetLength (0);
+
+                       // Recreate the zip file
+                       using (ZipArchive archive = new ZipArchive(PackageStream, Append.Create, false)) {
+
+                               // Write all the part streams
+                               foreach (ZipPackagePart part in Parts.Values) {
+                                       Stream partStream = part.GetStream ();
+                                       partStream.Seek (0, SeekOrigin.Begin);
+                                       
+                                       using (Stream destination = archive.GetStream (part.Uri.ToString ().Substring(1))) {
+                                               int count = (int) Math.Min (2048, partStream.Length);
+                                               byte[] buffer = new byte [count];
+
+                                               while ((count = partStream.Read (buffer, 0, buffer.Length)) != 0)
+                                                       destination.Write (buffer, 0, count);
+                                       }
+                               }
+
+                               using (Stream s = archive.GetStream (ContentUri))
+                                       WriteContentType (s);
+                       }
+               }
+
+               protected override PackagePart CreatePartCore (Uri partUri, string contentType, CompressionOption compressionOption)
+               {
+                       ZipPackagePart part = new ZipPackagePart (this, partUri, contentType, compressionOption);
+                       Parts.Add (part.Uri, part);
+                       return part;
+               }
+
+               protected override void DeletePartCore (Uri partUri)
+               {
+                       Parts.Remove (partUri);
+               }
+
+               protected override PackagePart GetPartCore (Uri partUri)
+               {
+                       ZipPackagePart part;
+                       Parts.TryGetValue (partUri, out part);
+                       return part;
+               }
+
+               protected override PackagePart[] GetPartsCore ()
+               {
+                       ZipPackagePart[] p = new ZipPackagePart [Parts.Count];
+                       Parts.Values.CopyTo (p, 0);
+                       return p;
+               }
+               
+               void LoadParts ()
+               {
+                       parts = new Dictionary<Uri, ZipPackagePart> (new  UriComparer());
+                       try {
+                               using (UnzipArchive archive = new UnzipArchive (PackageStream)) {
+
+                                       // Load the content type map file
+                                       XmlDocument doc = new XmlDocument ();
+                                       using (Stream s = archive.GetStream (ContentUri))
+                                               doc.Load (s);
+
+                                       doc.WriteContentTo (new XmlTextWriter (Console.Out));
+                                       XmlNamespaceManager manager = new XmlNamespaceManager (doc.NameTable);
+                                       manager.AddNamespace ("content", ContentNamespace);
+
+                                       foreach (string file in archive.GetFiles ()) {
+                                               XmlNode node;
+
+                                               if (file == RelationshipUri.ToString ().Substring (1))
+                                               {
+                                                       CreatePart (RelationshipUri, RelationshipContentType);
+                                                       continue;
+                                               }
+
+                                               string xPath = string.Format ("/content:Types/content:Override[@PartName='{0}']", file);
+                                               node = doc.SelectSingleNode (xPath, manager);
+
+                                               if (node == null)
+                                               {
+                                                       string ext = Path.GetExtension (file);
+                                                       if (ext.StartsWith("."))
+                                                               ext = ext.Substring (1);
+                                                       xPath = string.Format("/content:Types/content:Default[@Extension='{0}']", ext);
+                                                       node = doc.SelectSingleNode (xPath, manager);
+                                               }
+
+                                               // What do i do if the node is null? This means some has tampered with the
+                                               // package file manually
+                                               if (node != null)
+                                                       CreatePart (new Uri ("/" + file, UriKind.Relative), node.Attributes["ContentType"].Value);
+                                       }
+                               }
+                       } catch {
+                               // The archive is invalid - therefore no parts
+                       }
+               }
+
+               void WriteContentType (Stream s)
+               {
+                       XmlDocument doc = new XmlDocument ();
+                       XmlNamespaceManager manager = new XmlNamespaceManager (doc.NameTable);
+                       manager.AddNamespace ("content", ContentNamespace);
+
+                       doc.AppendChild(doc.CreateNode (XmlNodeType.XmlDeclaration, "", ""));
+                       
+                       XmlNode root = doc.CreateNode (XmlNodeType.Element, "Types", ContentNamespace);
+                       doc.AppendChild (root);
+                       foreach (ZipPackagePart part in Parts.Values)
+                       {
+                               XmlNode node = doc.CreateNode (XmlNodeType.Element, "Override", ContentNamespace);
+                               
+                               XmlAttribute contentType = doc.CreateAttribute ("ContentType");
+                               contentType.Value = part.ContentType;
+                               
+                               XmlAttribute name = doc.CreateAttribute ("PartName");
+                               name.Value = part.Uri.ToString ().Substring(1);
+                               
+
+                               node.Attributes.Append (contentType);
+                               node.Attributes.Append (name);
+
+                               root.AppendChild (node);                                
+                       }
+
+                       using (XmlTextWriter writer = new XmlTextWriter (s, System.Text.Encoding.UTF8))
+                               doc.WriteTo (writer);
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/ZipPackagePart.cs b/mcs/class/WindowsBase/System.IO.Packaging/ZipPackagePart.cs
new file mode 100644 (file)
index 0000000..c624859
--- /dev/null
@@ -0,0 +1,93 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.IO;
+using zipsharp;
+
+namespace System.IO.Packaging {
+
+       public sealed class ZipPackagePart : PackagePart
+       {
+               new ZipPackage Package {
+                       get { return (ZipPackage)base.Package; }
+               }
+               
+               internal ZipPackagePart (Package package, Uri partUri)
+                       : base (package, partUri)
+               {
+                       
+               }
+
+               internal ZipPackagePart (Package package, Uri partUri, string contentType)
+                       : base (package, partUri, contentType)
+               {
+                       
+               }
+
+               internal ZipPackagePart (Package package, Uri partUri, string contentType, CompressionOption compressionOption )
+                       : base (package, partUri, contentType, compressionOption)
+               {
+                       
+               }
+
+               protected override Stream GetStreamCore (FileMode mode, FileAccess access)
+               {
+                       ZipPartStream zps;
+                       MemoryStream stream;
+                       if (Package.PartStreams.TryGetValue (Uri, out stream))
+                               return new ZipPartStream (Package, stream, access);
+                       
+                       stream = new MemoryStream ();
+
+                       try
+                       {
+                               using (UnzipArchive archive = new UnzipArchive (Package.PackageStream)) {
+                                       foreach (string file in archive.GetFiles ()) {
+                                               if (file != Uri.ToString ().Substring (1))
+                                                       continue;
+                                               
+                                               using (Stream archiveStream = archive.GetStream (file)) {
+                                                       int read = 0;
+                                                       byte[] buffer = new byte [Math.Min (archiveStream.Length, 2 * 1024)];
+                                                       while ((read = archiveStream.Read (buffer, 0, buffer.Length)) != 0)
+                                                               stream.Write (buffer, 0, read);
+                                               }
+                                       }
+                               }
+                       }
+                       catch
+                       {
+                               // The zipfile is invalid, so just create the file
+                               // as if it didn't exist
+                               stream.SetLength (0);
+                       }
+
+                       Package.PartStreams.Add (Uri, stream);
+                       return new ZipPartStream (Package, stream, access);
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/ZipPartStream.cs b/mcs/class/WindowsBase/System.IO.Packaging/ZipPartStream.cs
new file mode 100644 (file)
index 0000000..2f0c888
--- /dev/null
@@ -0,0 +1,117 @@
+// ZipPartStream.cs created with MonoDevelop
+// User: alan at 13:13 23/10/2008
+//
+// To change standard headers go to Edit->Preferences->Coding->Standard Headers
+//
+
+using System;
+using System.IO;
+using zipsharp;
+
+namespace System.IO.Packaging
+{
+       internal class ZipPartStream : Stream
+       {
+               public MemoryStream BaseStream { get; private set; }
+               public ZipPackage Package { get; private set; }
+               
+               public override bool CanRead {
+                       get {
+                               return BaseStream.CanRead;
+                       }
+               }
+               
+               public override bool CanSeek {
+                       get {
+                               return BaseStream.CanSeek;
+                       }
+               }
+
+               public override bool CanTimeout {
+                       get { return BaseStream.CanTimeout; }
+               }
+
+               public override bool CanWrite {
+                       get { return Writeable; }
+               }
+
+               public override long Length {
+                       get { return BaseStream.Length; }
+               }
+               
+               public override long Position {
+                       get; set;
+               }
+
+               public bool Writeable {
+                       get; set;
+               }
+
+               public override int WriteTimeout {
+                       get {
+                               return BaseStream.WriteTimeout;
+                       }
+                       set {
+                               BaseStream.WriteTimeout = value;
+                       }
+               }
+               
+               public override int ReadTimeout {
+                       get {
+                               return BaseStream.ReadTimeout;
+                       }
+                       set {
+                               BaseStream.ReadTimeout = value;
+                       }
+               }
+
+               public ZipPartStream (ZipPackage package, MemoryStream stream, FileAccess access)
+               {
+                       BaseStream = stream;
+                       Package = package;
+                       Writeable = access != FileAccess.Read;
+               }
+
+               public override void Flush ()
+               {
+                       // If the user flushes any of the part streams,
+                       // we need to flush the entire package
+                       
+                       // FIXME: Ensure that this actually happens with a testcase
+                       // ...if possible
+                       Package.Flush ();
+               }
+               
+               public override int Read (byte[] buffer, int offset, int count)
+               {
+                       Seek (Position, SeekOrigin.Begin);
+                       int read = BaseStream.Read (buffer, offset, count);
+                       Position += read;
+                       return read;
+               }
+
+               public override long Seek (long offset, SeekOrigin origin)
+               {
+                       Position = BaseStream.Seek (offset, origin);
+                       return Position;
+               }
+
+               public override void SetLength (long value)
+               {
+                       if (!CanWrite)
+                               throw new InvalidOperationException ("Stream is not writeable");
+                       
+                       BaseStream.SetLength (value);
+               }
+
+               public override void Write(byte[] buffer, int offset, int count)
+               {
+                       if (!CanWrite)
+                               throw new InvalidOperationException ("Stream is not writeable");
+                       
+                       Seek (Position, SeekOrigin.Begin);
+                       BaseStream.Write (buffer, offset, count);
+                       Position += count;
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.IO/FileFormatException.cs b/mcs/class/WindowsBase/System.IO/FileFormatException.cs
new file mode 100644 (file)
index 0000000..38ae5d5
--- /dev/null
@@ -0,0 +1,95 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//     Miguel de Icaza (miguel@ximian.com)
+//
+
+using System;
+using System.Runtime.Serialization;
+using System.Security;
+
+namespace System.IO {
+
+       [Serializable]
+       public class FileFormatException : FormatException, ISerializable
+       {
+               Uri source_uri;
+               
+               public FileFormatException () : base ()
+               {
+               }
+
+               public FileFormatException (string message) : base (message)
+               {
+               }
+
+               public FileFormatException (Uri sourceUri)
+               {
+                       this.source_uri = sourceUri;
+               }
+
+               protected FileFormatException (SerializationInfo info, StreamingContext context)
+                       : base (info, context)
+               {
+                       if (info == null)
+                               throw new ArgumentNullException ("info");
+                       
+                       source_uri = (Uri) info.GetValue ("sourceUri", typeof (Uri));
+               }
+
+               public FileFormatException (string message, Exception innerException)
+                       : base (message, innerException)
+               {
+               }
+
+               public FileFormatException (Uri sourceUri, Exception innerException)
+                       : base ("", innerException)
+               {
+                       source_uri = sourceUri;
+               }
+
+               public FileFormatException (Uri sourceUri, string message)
+                       : base (message)
+               {
+                       source_uri = sourceUri;
+               }
+
+               public FileFormatException (Uri sourceUri, string message, Exception innerException)
+                       : base (message, innerException)
+               {
+                       source_uri = sourceUri;
+               }
+
+               public Uri SourceUri {
+                       get { return source_uri; }
+               }
+
+               [SecurityCritical]
+               public override void GetObjectData (SerializationInfo info, StreamingContext context)
+               {
+                       base.GetObjectData (info, context);
+                       info.AddValue ("sourceUri", source_uri);
+               }
+       }
+}
+
diff --git a/mcs/class/WindowsBase/System.Security.Permissions/MediaPermission.cs b/mcs/class/WindowsBase/System.Security.Permissions/MediaPermission.cs
new file mode 100644 (file)
index 0000000..1ded5c7
--- /dev/null
@@ -0,0 +1,111 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Security;
+
+namespace System.Security.Permissions {
+
+       public class MediaPermission : CodeAccessPermission, IUnrestrictedPermission
+       {
+               public MediaPermission ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public MediaPermission (MediaPermissionAudio permissionAudio)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public MediaPermission (MediaPermissionImage permissionImage)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public MediaPermission (MediaPermissionVideo permissionVideo)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public MediaPermission (PermissionState state)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public MediaPermission (MediaPermissionAudio permissionAudio, MediaPermissionVideo permissionVideo, MediaPermissionImage permissionImage)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public MediaPermissionAudio Audio {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public MediaPermissionVideo Video {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public MediaPermissionImage Image {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public override IPermission Copy ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override void FromXml (SecurityElement securityElement)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override IPermission Intersect (IPermission target)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override bool IsSubsetOf (IPermission target)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public bool IsUnrestricted ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override SecurityElement ToXml ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override IPermission Union (IPermission target)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.Security.Permissions/MediaPermissionAttribute.cs b/mcs/class/WindowsBase/System.Security.Permissions/MediaPermissionAttribute.cs
new file mode 100644 (file)
index 0000000..8062331
--- /dev/null
@@ -0,0 +1,60 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Security;
+
+namespace System.Security.Permissions {
+
+       public class MediaPermissionAttribute : CodeAccessSecurityAttribute
+       {
+               public MediaPermissionAttribute (SecurityAction action)
+                       : base (action)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public MediaPermissionAudio Audio {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
+
+               public MediaPermissionVideo Video {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
+
+               public MediaPermissionImage Image {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
+
+               public override IPermission CreatePermission ()
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.Security.Permissions/MediaPermissionAudio.cs b/mcs/class/WindowsBase/System.Security.Permissions/MediaPermissionAudio.cs
new file mode 100644 (file)
index 0000000..93a7cd0
--- /dev/null
@@ -0,0 +1,36 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+namespace System.Security.Permissions {
+
+       public enum MediaPermissionAudio {
+               NoAudio,
+               SiteOfOriginAudio,
+               SafeAudio,
+               AllAudio
+       }
+
+}
+
diff --git a/mcs/class/WindowsBase/System.Security.Permissions/MediaPermissionImage.cs b/mcs/class/WindowsBase/System.Security.Permissions/MediaPermissionImage.cs
new file mode 100644 (file)
index 0000000..d0c8f11
--- /dev/null
@@ -0,0 +1,36 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+namespace System.Security.Permissions {
+
+       public enum MediaPermissionImage {
+               NoImage,
+               SiteOfOriginImage,
+               SafeImage,
+               AllImage
+       }
+
+}
+
diff --git a/mcs/class/WindowsBase/System.Security.Permissions/MediaPermissionVideo.cs b/mcs/class/WindowsBase/System.Security.Permissions/MediaPermissionVideo.cs
new file mode 100644 (file)
index 0000000..8a07645
--- /dev/null
@@ -0,0 +1,36 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+namespace System.Security.Permissions {
+
+       public enum MediaPermissionVideo {
+               NoVideo,
+               SiteOfOriginVideo,
+               SafeVideo,
+               AllVideo
+       }
+
+}
+
diff --git a/mcs/class/WindowsBase/System.Security.Permissions/WebBrowserPermission.cs b/mcs/class/WindowsBase/System.Security.Permissions/WebBrowserPermission.cs
new file mode 100644 (file)
index 0000000..2b8dc68
--- /dev/null
@@ -0,0 +1,90 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Security;
+
+namespace System.Security.Permissions {
+
+       public sealed class WebBrowserPermission : CodeAccessPermission, IUnrestrictedPermission
+       {
+               public WebBrowserPermission ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public WebBrowserPermission (PermissionState state)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public WebBrowserPermission (WebBrowserPermissionLevel webBrowserPermissionLevel)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public WebBrowserPermissionLevel Level {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
+
+               public override IPermission Copy ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override void FromXml (SecurityElement securityElement)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override IPermission Intersect (IPermission target)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override bool IsSubsetOf (IPermission target)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public bool IsUnrestricted ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override SecurityElement ToXml ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override IPermission Union (IPermission target)
+               {
+                       throw new NotImplementedException ();
+               }
+
+       }
+
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.Security.Permissions/WebBrowserPermissionAttribute.cs b/mcs/class/WindowsBase/System.Security.Permissions/WebBrowserPermissionAttribute.cs
new file mode 100644 (file)
index 0000000..57ee042
--- /dev/null
@@ -0,0 +1,50 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Security;
+
+namespace System.Security.Permissions {
+
+       public sealed class WebBrowserPermissionAttribute : CodeAccessSecurityAttribute
+       {
+               public WebBrowserPermissionAttribute (SecurityAction action)
+                       : base (action)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public WebBrowserPermissionLevel Level {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
+
+               public override IPermission CreatePermission ()
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.Security.Permissions/WebBrowserPermissionLevel.cs b/mcs/class/WindowsBase/System.Security.Permissions/WebBrowserPermissionLevel.cs
new file mode 100644 (file)
index 0000000..4fdb446
--- /dev/null
@@ -0,0 +1,34 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+namespace System.Security.Permissions {
+
+       public enum WebBrowserPermissionLevel {
+               None,
+               Safe,
+               Unrestricted
+       }
+
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.Security.RightsManagement/AuthenticationType.cs b/mcs/class/WindowsBase/System.Security.RightsManagement/AuthenticationType.cs
new file mode 100644 (file)
index 0000000..0636218
--- /dev/null
@@ -0,0 +1,35 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+namespace System.Security.RightsManagement {
+
+       public enum AuthenticationType {
+               Windows,
+               Passport,
+               WindowsPassport,
+               Internal
+       }
+
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.Security.RightsManagement/ContentGrant.cs b/mcs/class/WindowsBase/System.Security.RightsManagement/ContentGrant.cs
new file mode 100644 (file)
index 0000000..5d5817d
--- /dev/null
@@ -0,0 +1,61 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Security;
+
+namespace System.Security.RightsManagement {
+
+       [SecurityCritical (SecurityCriticalScope.Everything)]
+       public class ContentGrant
+       {
+               public ContentGrant (ContentUser user, ContentRight right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public ContentGrant (ContentUser user, ContentRight right, DateTime validFrom, DateTime validUntil)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public ContentRight Right {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public ContentUser User {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public DateTime ValidFrom {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public DateTime ValidUntil {
+                       get { throw new NotImplementedException (); }
+               }
+       }
+}
+
diff --git a/mcs/class/WindowsBase/System.Security.RightsManagement/ContentRight.cs b/mcs/class/WindowsBase/System.Security.RightsManagement/ContentRight.cs
new file mode 100644 (file)
index 0000000..15a2869
--- /dev/null
@@ -0,0 +1,44 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+namespace System.Security.RightsManagement {
+
+       public enum ContentRight {
+               View,
+               Edit,
+               Print,
+               Extract,
+               ObjectModel,
+               Owner,
+               ViewRightsData,
+               Forward,
+               Reply,
+               ReplyAll,
+               Sign,
+               DocumentEdit,
+               Export
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.Security.RightsManagement/ContentUser.cs b/mcs/class/WindowsBase/System.Security.RightsManagement/ContentUser.cs
new file mode 100644 (file)
index 0000000..200df69
--- /dev/null
@@ -0,0 +1,71 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Security;
+
+namespace System.Security.RightsManagement {
+
+       [SecurityCritical (SecurityCriticalScope.Everything)]
+       public class ContentUser
+       {
+               public ContentUser (string name, AuthenticationType authenticationType)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static ContentUser AnyoneUser {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public AuthenticationType AuthenticationType {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public string Name {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public static ContentUser OwnerUser {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public override bool Equals (object obj)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override int GetHashCode ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public bool IsAuthenticated ()
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.Security.RightsManagement/CryptoProvider.cs b/mcs/class/WindowsBase/System.Security.RightsManagement/CryptoProvider.cs
new file mode 100644 (file)
index 0000000..0622404
--- /dev/null
@@ -0,0 +1,84 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Security;
+using System.Collections.ObjectModel;
+
+namespace System.Security.RightsManagement {
+
+       [SecurityCritical (SecurityCriticalScope.Everything)]
+       public class CryptoProvider : IDisposable
+       {
+               internal CryptoProvider ()
+               {
+               }
+
+               ~CryptoProvider ()
+               {
+               }
+
+               public int BlockSize {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public ReadOnlyCollection<ContentGrant> BoundGrants {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public bool CanDecrypt {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public bool CanEncrypt {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public bool CanMergeBlocks {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public byte[] Decrypt (byte[] cryptoText)
+               {
+                       throw new NotImplementedException ();                   
+               }
+
+               public byte[] Encrypt (byte[] clearText)
+               {
+                       throw new NotImplementedException ();                   
+               }
+
+               protected virtual void Dispose (bool disposing)
+               {
+                       throw new NotImplementedException ();                   
+               }
+
+               public void Dispose ()
+               {
+                       throw new NotImplementedException ();                   
+               }
+       }
+
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.Security.RightsManagement/LocalizedNameDescriptionPair.cs b/mcs/class/WindowsBase/System.Security.RightsManagement/LocalizedNameDescriptionPair.cs
new file mode 100644 (file)
index 0000000..c917bb0
--- /dev/null
@@ -0,0 +1,57 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Security;
+
+namespace System.Security.RightsManagement {
+
+       [SecurityCritical (SecurityCriticalScope.Everything)]
+       public class LocalizedNameDescriptionPair
+       {
+               public LocalizedNameDescriptionPair (string name, string description)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public string Name {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public string Description {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public override bool Equals (object obj)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override int GetHashCode ()
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Security.RightsManagement/PublishLicense.cs b/mcs/class/WindowsBase/System.Security.RightsManagement/PublishLicense.cs
new file mode 100644 (file)
index 0000000..b4390a7
--- /dev/null
@@ -0,0 +1,77 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Security;
+
+namespace System.Security.RightsManagement {
+
+       [SecurityCritical (SecurityCriticalScope.Everything)]
+       public class PublishLicense
+       {
+               public PublishLicense (string signedPublishLicense)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public Guid ContentId {
+                       get { throw new NotImplementedException (); }
+
+               }
+
+               public string ReferralInfoName {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public Uri ReferralInfoUri {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public Uri UseLicenseAcquisitionUrl {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public UseLicense AcquireUseLicense (SecureEnvironment secureEnvironment)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public UseLicense AcquireUseLicenseNoUI (SecureEnvironment secureEnvironment)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public UnsignedPublishLicense DecryptUnsignedPublishLicense (CryptoProvider cryptoProvider)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override string ToString ()
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.Security.RightsManagement/RightsManagementException.cs b/mcs/class/WindowsBase/System.Security.RightsManagement/RightsManagementException.cs
new file mode 100644 (file)
index 0000000..9174ac9
--- /dev/null
@@ -0,0 +1,86 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Runtime.Serialization;
+using System.Security;
+
+namespace System.Security.RightsManagement {
+
+       [Serializable]
+       public class RightsManagementException : Exception
+       {
+               public RightsManagementException ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public RightsManagementException (RightsManagementFailureCode failureCode)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public RightsManagementException (string message)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public RightsManagementException (RightsManagementFailureCode failureCode, Exception innerException)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public RightsManagementException (RightsManagementFailureCode failureCode, string message)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public RightsManagementException (string message, Exception innerException)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public RightsManagementException (RightsManagementFailureCode failureCode, string message, Exception innerException)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected RightsManagementException (SerializationInfo info, StreamingContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public RightsManagementFailureCode FailureCode {
+                       get { throw new NotImplementedException (); }
+               }
+
+               [SecurityCritical]
+               public override void GetObjectData (SerializationInfo info, StreamingContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.Security.RightsManagement/RightsManagementFailureCode.cs b/mcs/class/WindowsBase/System.Security.RightsManagement/RightsManagementFailureCode.cs
new file mode 100644 (file)
index 0000000..0b55ba5
--- /dev/null
@@ -0,0 +1,139 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Security.RightsManagement {
+
+       public enum RightsManagementFailureCode
+       {
+               ManifestPolicyViolation = -2147183860,
+
+               InvalidLicense = -2147168512,
+               InfoNotInLicense,
+               InvalidLicenseSignature,
+
+               EncryptionNotPermitted = -2147168508,
+               RightNotGranted,
+               InvalidVersion,
+               InvalidEncodingType,
+               InvalidNumericalValue,
+               InvalidAlgorithmType,
+               EnvironmentNotLoaded,
+               EnvironmentCannotLoad,
+               TooManyLoadedEnvironments,
+
+               IncompatibleObjects = -2147168498,
+               LibraryFail,
+               EnablingPrincipalFailure,
+               InfoNotPresent,
+               BadGetInfoQuery,
+               KeyTypeUnsupported,
+               CryptoOperationUnsupported,
+               ClockRollbackDetected,
+               QueryReportsNoResults,
+               UnexpectedException,
+               BindValidityTimeViolated,
+               BrokenCertChain,
+
+               BindPolicyViolation = -2147168485,
+               BindRevokedLicense,
+               BindRevokedIssuer,
+               BindRevokedPrincipal,
+               BindRevokedResource,
+               BindRevokedModule,
+               BindContentNotInEndUseLicense,
+               BindAccessPrincipalNotEnabling,
+               BindAccessUnsatisfied,
+               BindIndicatedPrincipalMissing,
+               BindMachineNotFoundInGroupIdentity,
+               LibraryUnsupportedPlugIn,
+               BindRevocationListStale,
+               BindNoApplicableRevocationList,
+
+               InvalidHandle = -2147168468,
+
+               BindIntervalTimeViolated = -2147168465,
+               BindNoSatisfiedRightsGroup,
+               BindSpecifiedWorkMissing,
+
+               NoMoreData = -2147168461,
+               LicenseAcquisitionFailed,
+               IdMismatch,
+               TooManyCertificates,
+               NoDistributionPointUrlFound,
+               AlreadyInProgress,
+               GroupIdentityNotSet,
+               RecordNotFound,
+               NoConnect,
+               NoLicense,
+               NeedsMachineActivation,
+               NeedsGroupIdentityActivation,
+
+               ActivationFailed = -2147168448,
+               Aborted,
+               OutOfQuota,
+               AuthenticationFailed,
+               ServerError,
+               InstallationFailed,
+               HidCorrupted,
+               InvalidServerResponse,
+               ServiceNotFound,
+               UseDefault,
+               ServerNotFound,
+               InvalidEmail,
+               ValidityTimeViolation,
+               OutdatedModule,
+               NotSet,
+               MetadataNotSet,
+               RevocationInfoNotSet,
+               InvalidTimeInfo,
+               RightNotSet,
+               LicenseBindingToWindowsIdentityFailed,
+               InvalidIssuanceLicenseTemplate,
+               InvalidKeyLength,
+
+               ExpiredOfficialIssuanceLicenseTemplate = -2147168425,
+               InvalidClientLicensorCertificate,
+               HidInvalid,
+               EmailNotVerified,
+               ServiceMoved,
+               ServiceGone,
+               AdEntryNotFound,
+               NotAChain,
+               RequestDenied,
+               DebuggerDetected,
+
+               InvalidLockboxType = -2147168400,
+               InvalidLockboxPath,
+               InvalidRegistryPath,
+               NoAesCryptoProvider,
+               GlobalOptionAlreadySet,
+               OwnerLicenseNotFound,
+
+               Success = 0
+       }
+
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.Security.RightsManagement/SecureEnvironment.cs b/mcs/class/WindowsBase/System.Security.RightsManagement/SecureEnvironment.cs
new file mode 100644 (file)
index 0000000..d0566ff
--- /dev/null
@@ -0,0 +1,84 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Collections.ObjectModel;
+using System.Security;
+
+namespace System.Security.RightsManagement {
+
+       [SecurityCritical (SecurityCriticalScope.Everything)]
+       public class SecureEnvironment : IDisposable
+       {
+               internal SecureEnvironment ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public string ApplicationManifest {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public ContentUser User {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public static SecureEnvironment Create (string applicationManifest, ContentUser user)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static SecureEnvironment Create (string applicationManifest, AuthenticationType authentication, UserActivationMode userActivationMode)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public void Dispose ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected virtual void Dispose (bool disposing)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static ReadOnlyCollection<ContentUser> GetActivatedUsers ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static bool IsUserActivated (ContentUser user)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static void RemoveActivatedUser (ContentUser user)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.Security.RightsManagement/UnsignedPublishLicense.cs b/mcs/class/WindowsBase/System.Security.RightsManagement/UnsignedPublishLicense.cs
new file mode 100644 (file)
index 0000000..d398eda
--- /dev/null
@@ -0,0 +1,84 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Collections.Generic;
+using System.Security;
+
+namespace System.Security.RightsManagement {
+
+       [SecurityCritical (SecurityCriticalScope.Everything)]
+       public class UnsignedPublishLicense
+       {
+               public UnsignedPublishLicense ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public UnsignedPublishLicense (string publishLicenseTemplate)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public Guid ContentId {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
+
+               public ICollection<ContentGrant> Grants {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public IDictionary<int, LocalizedNameDescriptionPair> LocalizedNameDescriptionDictionary {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public ContentUser Owner {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
+
+               public string ReferralInfoName {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
+
+               public Uri ReferralInfoUri {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
+
+               public PublishLicense Sign (SecureEnvironment secureEnvironment, out UseLicense authorUseLicense)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override string ToString ()
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.Security.RightsManagement/UseLicense.cs b/mcs/class/WindowsBase/System.Security.RightsManagement/UseLicense.cs
new file mode 100644 (file)
index 0000000..6865b99
--- /dev/null
@@ -0,0 +1,72 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Collections.Generic;
+using System.Security;
+
+namespace System.Security.RightsManagement {
+
+       [SecurityCritical (SecurityCriticalScope.Everything)]
+       public class UseLicense
+       {
+               public UseLicense (string useLicense)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public IDictionary<string, string> ApplicationData {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public Guid ContentId {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public ContentUser Owner {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public CryptoProvider Bind (SecureEnvironment secureEnvironment)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override bool Equals (object x)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override int GetHashCode ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override string ToString ()
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.Security.RightsManagement/UserActivationMode.cs b/mcs/class/WindowsBase/System.Security.RightsManagement/UserActivationMode.cs
new file mode 100644 (file)
index 0000000..c5e7de0
--- /dev/null
@@ -0,0 +1,33 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+namespace System.Security.RightsManagement {
+
+       public enum UserActivationMode {
+               Permanent,
+               Temporary
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Converters/Int32RectValueSerializer.cs b/mcs/class/WindowsBase/System.Windows.Converters/Int32RectValueSerializer.cs
new file mode 100644 (file)
index 0000000..a668178
--- /dev/null
@@ -0,0 +1,55 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows.Markup;
+
+namespace System.Windows.Converters {
+
+       public class Int32RectValueSerializer : ValueSerializer
+       {
+               public override bool CanConvertFromString (string value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override bool CanConvertToString (object value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override object ConvertFromString (string value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override string ConvertToString (object value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
+
diff --git a/mcs/class/WindowsBase/System.Windows.Converters/PointValueSerializer.cs b/mcs/class/WindowsBase/System.Windows.Converters/PointValueSerializer.cs
new file mode 100644 (file)
index 0000000..86f5ae7
--- /dev/null
@@ -0,0 +1,55 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows.Markup;
+
+namespace System.Windows.Converters {
+
+       public class PointValueSerializer : ValueSerializer
+       {
+               public override bool CanConvertFromString (string value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override bool CanConvertToString (object value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override object ConvertFromString (string value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override string ConvertToString (object value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
+
diff --git a/mcs/class/WindowsBase/System.Windows.Converters/RectValueSerializer.cs b/mcs/class/WindowsBase/System.Windows.Converters/RectValueSerializer.cs
new file mode 100644 (file)
index 0000000..1a60776
--- /dev/null
@@ -0,0 +1,55 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows.Markup;
+
+namespace System.Windows.Converters {
+
+       public class RectValueSerializer : ValueSerializer
+       {
+               public override bool CanConvertFromString (string value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override bool CanConvertToString (object value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override object ConvertFromString (string value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override string ConvertToString (object value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
+
diff --git a/mcs/class/WindowsBase/System.Windows.Converters/SizeValueSerializer.cs b/mcs/class/WindowsBase/System.Windows.Converters/SizeValueSerializer.cs
new file mode 100644 (file)
index 0000000..280c662
--- /dev/null
@@ -0,0 +1,55 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows.Markup;
+
+namespace System.Windows.Converters {
+
+       public class SizeValueSerializer : ValueSerializer
+       {
+               public override bool CanConvertFromString (string value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override bool CanConvertToString (object value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override object ConvertFromString (string value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override string ConvertToString (object value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
+
diff --git a/mcs/class/WindowsBase/System.Windows.Converters/VectorValueSerializer.cs b/mcs/class/WindowsBase/System.Windows.Converters/VectorValueSerializer.cs
new file mode 100644 (file)
index 0000000..c9feb17
--- /dev/null
@@ -0,0 +1,55 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows.Markup;
+
+namespace System.Windows.Converters {
+
+       public class VectorValueSerializer : ValueSerializer
+       {
+               public override bool CanConvertFromString (string value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override bool CanConvertToString (object value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override object ConvertFromString (string value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override string ConvertToString (object value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
+
diff --git a/mcs/class/WindowsBase/System.Windows.Data/DataSourceProvider.cs b/mcs/class/WindowsBase/System.Windows.Data/DataSourceProvider.cs
new file mode 100644 (file)
index 0000000..2f0c66e
--- /dev/null
@@ -0,0 +1,126 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Windows.Threading;
+
+namespace System.Windows.Data {
+
+       public abstract class DataSourceProvider : INotifyPropertyChanged, ISupportInitialize
+       {
+               protected DataSourceProvider ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+               public object Data {
+                       get { throw new NotImplementedException (); }
+               }
+
+               protected Dispatcher Dispatcher {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
+
+               public Exception Error {
+                       get { throw new NotImplementedException (); }
+               }
+
+               [DefaultValue (true)]
+               public bool IsInitialLoadEnabled {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
+
+               protected bool IsRefreshDeferred {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public event EventHandler DataChanged;
+
+               protected virtual event PropertyChangedEventHandler PropertyChanged;
+
+               event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged {
+                       add { PropertyChanged += value; }
+                       remove { PropertyChanged -= value; }
+               }
+
+               protected virtual void BeginInit ()
+               {
+                       throw new NotImplementedException ();
+               }
+               void ISupportInitialize.BeginInit ()
+               {
+                       BeginInit ();
+               }
+
+               protected virtual void EndInit ()
+               {
+                       throw new NotImplementedException ();
+               }
+               void ISupportInitialize.EndInit ()
+               {
+                       EndInit ();
+               }
+
+               protected virtual void BeginQuery ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public virtual IDisposable DeferRefresh ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public void InitialLoad ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected virtual void OnPropertyChanged (PropertyChangedEventArgs e)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected void OnQueryFinished (object newData)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected virtual void OnQueryFinished (object newData, Exception error, DispatcherOperationCallback completionWork, object callbackArguments)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public void Refresh ()
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
+
diff --git a/mcs/class/WindowsBase/System.Windows.Input/FocusNavigationDirection.cs b/mcs/class/WindowsBase/System.Windows.Input/FocusNavigationDirection.cs
new file mode 100644 (file)
index 0000000..45e22bf
--- /dev/null
@@ -0,0 +1,41 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@novell.com)
+//
+
+using System;
+
+namespace System.Windows.Input {
+
+       public enum FocusNavigationDirection
+       {
+               Next,
+               Previous,
+               First,
+               Last,
+               Left,
+               Right,
+               Up,
+               Down
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Input/Key.cs b/mcs/class/WindowsBase/System.Windows.Input/Key.cs
new file mode 100644 (file)
index 0000000..ba590a9
--- /dev/null
@@ -0,0 +1,238 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Windows.Markup;
+
+namespace System.Windows.Input {
+
+       [ValueSerializer (typeof (KeyValueSerializer))]
+       [TypeConverter (typeof (KeyConverter))]
+       public enum Key
+       {
+               None,
+               Cancel,
+               Back,
+               Tab,
+               LineFeed,
+               Clear,
+               Return,
+               Enter = Return,
+               Pause,
+               CapsLock,
+               Capital = CapsLock,
+               HangulMode,
+               KanaMode = HangulMode,
+               JunjaMode,
+               FinalMode,
+               KanjiMode,
+               HanjaMode = KanjiMode,
+               Escape,
+               ImeConvert,
+               ImeNonConvert,
+               ImeAccept,
+               ImeModeChange,
+               Space,
+               PageUp,
+               Prior = PageUp,
+               PageDown,
+               Next = PageDown,
+               End,
+               Home,
+               Left,
+               Up,
+               Right,
+               Down,
+               Select,
+               Print,
+               Execute,
+               PrintScreen,
+               Snapshot = PrintScreen,
+               Insert,
+               Delete,
+               Help,
+               D0,
+               D1,
+               D2,
+               D3,
+               D4,
+               D5,
+               D6,
+               D7,
+               D8,
+               D9,
+               A,
+               B,
+               C,
+               D,
+               E,
+               F,
+               G,
+               H,
+               I,
+               J,
+               K,
+               L,
+               M,
+               N,
+               O,
+               P,
+               Q,
+               R,
+               S,
+               T,
+               U,
+               V,
+               W,
+               X,
+               Y,
+               Z,
+               LWin,
+               RWin,
+               Apps,
+               Sleep,
+               NumPad0,
+               NumPad1,
+               NumPad2,
+               NumPad3,
+               NumPad4,
+               NumPad5,
+               NumPad6,
+               NumPad7,
+               NumPad8,
+               NumPad9,
+               Multiply,
+               Add,
+               Separator,
+               Subtract,
+               Decimal,
+               Divide,
+               F1,
+               F2,
+               F3,
+               F4,
+               F5,
+               F6,
+               F7,
+               F8,
+               F9,
+               F10,
+               F11,
+               F12,
+               F13,
+               F14,
+               F15,
+               F16,
+               F17,
+               F18,
+               F19,
+               F20,
+               F21,
+               F22,
+               F23,
+               F24,
+               NumLock,
+               Scroll,
+               LeftShift,
+               RightShift,
+               LeftCtrl,
+               RightCtrl,
+               LeftAlt,
+               RightAlt,
+               BrowserBack,
+               BrowserForward,
+               BrowserRefresh,
+               BrowserStop,
+               BrowserSearch,
+               BrowserFavorites,
+               BrowserHome,
+               VolumeMute,
+               VolumeDown,
+               VolumeUp,
+               MediaNextTrack,
+               MediaPreviousTrack,
+               MediaStop,
+               MediaPlayPause,
+               LaunchMail,
+               SelectMedia,
+               LaunchApplication1,
+               LaunchApplication2,
+               Oem1,
+               OemSemicolon = Oem1,
+               OemPlus,
+               OemComma,
+               OemMinus,
+               OemPeriod,
+               Oem2,
+               OemQuestion = Oem2,
+               Oem3,
+               OemTilde = Oem3,
+               AbntC1,
+               AbntC2,
+               Oem4,
+               OemOpenBrackets = Oem4,
+               Oem5,
+               OemPipe = Oem5,
+               Oem6,
+               OemCloseBrackets = Oem6,
+               Oem7,
+               OemQuotes = Oem7,
+               Oem8,
+               Oem102,
+               OemBackslash = Oem102,
+               ImeProcessed,
+               System,
+               OemAttn,
+               DbeAlphanumeric = OemAttn,
+               OemFinish,
+               DbeKatakana = OemFinish,
+               OemCopy,
+               DbeHiragana = OemCopy,
+               OemAuto,
+               DbeSbcsChar = OemAuto,
+               OemEnlw,
+               DbeDbcsChar = OemEnlw,
+               OemBackTab,
+               DbeRoman = OemBackTab,
+               Attn,
+               DbeNoRoman = Attn,
+               CrSel,
+               DbeEnterWordRegisterMode = CrSel,
+               ExSel,
+               DbeEnterImeConfigureMode = ExSel,
+               EraseEof,
+               DbeFlushString = EraseEof,
+               Play,
+               DbeCodeInput = Play,
+               Zoom,
+               DbeNoCodeInput = Zoom,
+               NoName,
+               DbeDetermineString = NoName,
+               Pa1,
+               DbeEnterDialogConversionMode = Pa1,
+               OemClear
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Input/KeyConverter.cs b/mcs/class/WindowsBase/System.Windows.Input/KeyConverter.cs
new file mode 100644 (file)
index 0000000..6c4ca4f
--- /dev/null
@@ -0,0 +1,56 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Globalization;
+
+namespace System.Windows.Input {
+
+       public class KeyConverter : TypeConverter
+       {
+               public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
+
diff --git a/mcs/class/WindowsBase/System.Windows.Input/KeyInterop.cs b/mcs/class/WindowsBase/System.Windows.Input/KeyInterop.cs
new file mode 100644 (file)
index 0000000..b69e13d
--- /dev/null
@@ -0,0 +1,43 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Input {
+
+       public static class KeyInterop
+       {
+               public static Key KeyFromVirtualKey (int virtualKey)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static int VirtualKeyFromKey (Key key)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Input/KeyValueSerializer.cs b/mcs/class/WindowsBase/System.Windows.Input/KeyValueSerializer.cs
new file mode 100644 (file)
index 0000000..d7b3d07
--- /dev/null
@@ -0,0 +1,55 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows.Markup;
+
+namespace System.Windows.Input {
+
+       public class KeyValueSerializer : ValueSerializer
+       {
+               public override bool CanConvertFromString (string value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override bool CanConvertToString (object value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override object ConvertFromString (string value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override string ConvertToString (object value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
+
diff --git a/mcs/class/WindowsBase/System.Windows.Input/ModifierKeys.cs b/mcs/class/WindowsBase/System.Windows.Input/ModifierKeys.cs
new file mode 100644 (file)
index 0000000..cd78943
--- /dev/null
@@ -0,0 +1,43 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Windows.Markup;
+
+namespace System.Windows.Input {
+
+       [Flags]
+       [ValueSerializer (typeof (ModifierKeysValueSerializer))]
+       [TypeConverter (typeof (ModifierKeysConverter))]
+       public enum ModifierKeys {
+               None = 0,
+               Alt = 1,
+               Control = 2,
+               Shift = 4,
+               Windows = 8
+       }
+}
+
diff --git a/mcs/class/WindowsBase/System.Windows.Input/ModifierKeysConverter.cs b/mcs/class/WindowsBase/System.Windows.Input/ModifierKeysConverter.cs
new file mode 100644 (file)
index 0000000..e7495ab
--- /dev/null
@@ -0,0 +1,61 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Globalization;
+
+namespace System.Windows.Input {
+
+       public class ModifierKeysConverter : TypeConverter
+       {
+               public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static bool IsDefinedModifierKeys (ModifierKeys modifierKeys)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
+
diff --git a/mcs/class/WindowsBase/System.Windows.Input/ModifierKeysValueSerializer.cs b/mcs/class/WindowsBase/System.Windows.Input/ModifierKeysValueSerializer.cs
new file mode 100644 (file)
index 0000000..11310ad
--- /dev/null
@@ -0,0 +1,55 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows.Markup;
+
+namespace System.Windows.Input {
+
+       public class ModifierKeysValueSerializer : ValueSerializer
+       {
+               public override bool CanConvertFromString (string value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override bool CanConvertToString (object value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override object ConvertFromString (string value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override string ConvertToString (object value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
+
diff --git a/mcs/class/WindowsBase/System.Windows.Input/TraversalRequest.cs b/mcs/class/WindowsBase/System.Windows.Input/TraversalRequest.cs
new file mode 100644 (file)
index 0000000..a132971
--- /dev/null
@@ -0,0 +1,49 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@novell.com)
+//
+
+using System;
+
+namespace System.Windows.Input {
+
+       public class TraversalRequest
+       {
+               bool wrapped;
+               FocusNavigationDirection focusNavigationDirection;
+
+               public TraversalRequest (FocusNavigationDirection focusNavigationDirection)
+               {
+                       this.focusNavigationDirection = focusNavigationDirection;
+               }
+
+               public FocusNavigationDirection FocusNavigationDirection {
+                       get { return focusNavigationDirection; }
+               }
+
+               public bool Wrapped {
+                       get { return wrapped; }
+                       set { wrapped = value; }
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Interop/ComponentDispatcher.cs b/mcs/class/WindowsBase/System.Windows.Interop/ComponentDispatcher.cs
new file mode 100644 (file)
index 0000000..0665b4d
--- /dev/null
@@ -0,0 +1,73 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Security;
+
+namespace System.Windows.Interop {
+
+       public static class ComponentDispatcher
+       {
+               public static MSG CurrentKeyboardMessage {
+                       [SecurityCritical]
+                       get { throw new NotImplementedException (); }
+               }
+
+               public static bool IsThreadModal {
+                       [SecurityCritical]
+                       get { throw new NotImplementedException (); }
+               }
+
+               public static event EventHandler EnterThreadModal;
+               public static event EventHandler LeaveThreadModal;
+               public static event ThreadMessageEventHandler ThreadFilterMessage;
+               public static event EventHandler ThreadIdle;
+               public static event ThreadMessageEventHandler ThreadPreprocessMessage;
+
+               [SecurityCritical]
+               public static void PopModal()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [SecurityCritical]
+               public static void PushModal()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [SecurityCritical]
+               public static void RaiseIdle()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [SecurityCritical]
+               public static bool RaiseThreadMessage (ref MSG msg)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Interop/IKeyboardInputSink.cs b/mcs/class/WindowsBase/System.Windows.Interop/IKeyboardInputSink.cs
new file mode 100644 (file)
index 0000000..fa8f4fe
--- /dev/null
@@ -0,0 +1,55 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Security;
+using System.Windows.Input;
+
+namespace System.Windows.Interop {
+
+       public interface IKeyboardInputSink
+       {
+               IKeyboardInputSite KeyboardInputSite {
+                       get;
+                       [SecurityCritical]
+                       set;
+               }
+
+               bool TabInto (TraversalRequest request);
+               bool HasFocusWithin ();
+
+               [SecurityCritical]
+               bool OnMnemonic (ref MSG msg, ModifierKeys modifiers);
+
+               [SecurityCritical]
+               IKeyboardInputSite RegisterKeyboardInputSink (IKeyboardInputSink sink);
+
+               [SecurityCritical]
+               bool TranslateAccelerator (ref MSG msg, ModifierKeys modifiers);
+
+               [SecurityCritical]
+               bool TranslateChar (ref MSG msg, ModifierKeys modifiers);
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Interop/IKeyboardInputSite.cs b/mcs/class/WindowsBase/System.Windows.Interop/IKeyboardInputSite.cs
new file mode 100644 (file)
index 0000000..8ffa1e0
--- /dev/null
@@ -0,0 +1,42 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Security;
+using System.Windows.Input;
+
+namespace System.Windows.Interop {
+
+       public interface IKeyboardInputSite
+       {
+               IKeyboardInputSink Sink { get; }
+
+               bool OnNoMoreTabStops (TraversalRequest request);
+
+               [SecurityCritical]
+               void Unregister ();
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Interop/MSG.cs b/mcs/class/WindowsBase/System.Windows.Interop/MSG.cs
new file mode 100644 (file)
index 0000000..abcbd52
--- /dev/null
@@ -0,0 +1,84 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Security;
+
+namespace System.Windows.Interop {
+
+       [Serializable]
+       public struct MSG
+       {
+               public IntPtr hwnd {
+                       [SecurityCritical]
+                       get { throw new NotImplementedException (); }
+                       [SecurityCritical]
+                       set { throw new NotImplementedException (); }
+               }
+
+               public IntPtr lParam {
+                       [SecurityCritical]
+                       get { throw new NotImplementedException (); }
+                       [SecurityCritical]
+                       set { throw new NotImplementedException (); }
+               }
+
+
+               public IntPtr wParam {
+                       [SecurityCritical]
+                       get { throw new NotImplementedException (); }
+                       [SecurityCritical]
+                       set { throw new NotImplementedException (); }
+               }
+               public int message {
+                       [SecurityCritical]
+                       get { throw new NotImplementedException (); }
+                       [SecurityCritical]
+                       set { throw new NotImplementedException (); }
+               }
+
+               public int pt_x {
+                       [SecurityCritical]
+                       get { throw new NotImplementedException (); }
+                       [SecurityCritical]
+                       set { throw new NotImplementedException (); }
+               }
+
+               public int pt_y {
+                       [SecurityCritical]
+                       get { throw new NotImplementedException (); }
+                       [SecurityCritical]
+                       set { throw new NotImplementedException (); }
+               }
+
+               public int time {
+                       [SecurityCritical]
+                       get { throw new NotImplementedException (); }
+                       [SecurityCritical]
+                       set { throw new NotImplementedException (); }
+               }
+       }
+}
+
diff --git a/mcs/class/WindowsBase/System.Windows.Interop/ThreadMessageEventHandler.cs b/mcs/class/WindowsBase/System.Windows.Interop/ThreadMessageEventHandler.cs
new file mode 100644 (file)
index 0000000..638c8e3
--- /dev/null
@@ -0,0 +1,32 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Interop {
+
+       public delegate void ThreadMessageEventHandler (ref MSG msg, ref bool handled);
+
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Markup.Primitives/MarkupObject.cs b/mcs/class/WindowsBase/System.Windows.Markup.Primitives/MarkupObject.cs
new file mode 100644 (file)
index 0000000..6a3d2a5
--- /dev/null
@@ -0,0 +1,50 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Windows;
+using System.Windows.Markup;
+
+namespace System.Windows.Markup.Primitives {
+
+       public abstract class MarkupObject {
+               internal MarkupObject ()
+               {
+               }
+
+               public abstract AttributeCollection Attributes { get; }
+               public abstract object Instance { get; }
+               public abstract Type ObjectType { get; }
+
+               public virtual IEnumerable<MarkupProperty> Properties {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public abstract void AssignRootContext (IValueSerializerContext context);
+       }
+}
+
diff --git a/mcs/class/WindowsBase/System.Windows.Markup.Primitives/MarkupProperty.cs b/mcs/class/WindowsBase/System.Windows.Markup.Primitives/MarkupProperty.cs
new file mode 100644 (file)
index 0000000..71d0a74
--- /dev/null
@@ -0,0 +1,80 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Windows;
+using System.Windows.Markup;
+
+namespace System.Windows.Markup.Primitives {
+
+       public abstract class MarkupProperty {
+               internal MarkupProperty ()
+               {
+               }
+
+               public abstract AttributeCollection Attributes { get; }
+               public abstract IEnumerable<MarkupObject> Items { get; }
+               public abstract string Name { get; }
+               public abstract Type PropertyType { get; }
+               public abstract string StringValue { get; }
+               public abstract IEnumerable<Type> TypeReferences { get; }
+               public abstract object Value { get; }
+
+               public virtual DependencyProperty DependencyProperty {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public virtual bool IsAttached {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public virtual bool IsComposite {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public virtual bool IsConstructorArgument {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public virtual bool IsContent {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public virtual bool IsKey {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public virtual bool IsValueAsString {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public virtual PropertyDescriptor PropertyDescriptor {
+                       get { throw new NotImplementedException (); }
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Markup/ConstructorArgumentAttribute.cs b/mcs/class/WindowsBase/System.Windows.Markup/ConstructorArgumentAttribute.cs
new file mode 100644 (file)
index 0000000..07ebd9c
--- /dev/null
@@ -0,0 +1,45 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Markup {
+
+       [AttributeUsage (AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
+       public sealed class ConstructorArgumentAttribute : Attribute
+       {
+               public ConstructorArgumentAttribute (string argumentName)
+               {
+                       this.argumentName = argumentName;
+               }
+
+               public string ArgumentName {
+                       get { return argumentName; }
+               }
+
+               string argumentName;
+       }
+
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.Windows.Markup/ContentPropertyAttribute.cs b/mcs/class/WindowsBase/System.Windows.Markup/ContentPropertyAttribute.cs
new file mode 100644 (file)
index 0000000..23f85a1
--- /dev/null
@@ -0,0 +1,48 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Markup {
+
+       [AttributeUsage (AttributeTargets.Class)]
+       public sealed class ContentPropertyAttribute : Attribute
+       {
+               string name;
+
+               public ContentPropertyAttribute ()
+               {
+               }
+
+               public ContentPropertyAttribute (string name)
+               {
+                       this.name = name;
+               }
+
+               public string Name {
+                       get { return name; }
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Markup/ContentWrapperAttribute.cs b/mcs/class/WindowsBase/System.Windows.Markup/ContentWrapperAttribute.cs
new file mode 100644 (file)
index 0000000..8dbb4f6
--- /dev/null
@@ -0,0 +1,64 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Markup {
+
+       [AttributeUsage (AttributeTargets.Property, AllowMultiple = true, Inherited = true)]
+       public sealed class ContentWrapperAttribute : Attribute
+       {
+               public ContentWrapperAttribute (Type contentWrapper)
+               {
+                       this.contentWrapper = contentWrapper;
+               }
+
+               public Type ContentWrapper {
+                       get { return contentWrapper; }
+               }
+
+               public override object TypeId {
+                       get { return this; }
+               }
+
+               public override bool Equals (object obj)
+               {
+                       if (obj is ContentWrapperAttribute) {
+                               if (((ContentWrapperAttribute)obj).ContentWrapper == contentWrapper)
+                                       return true;
+                       }
+
+                       return false;
+               }
+
+               public override int GetHashCode ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               Type contentWrapper;
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Markup/DateTimeValueSerializer.cs b/mcs/class/WindowsBase/System.Windows.Markup/DateTimeValueSerializer.cs
new file mode 100644 (file)
index 0000000..3c92141
--- /dev/null
@@ -0,0 +1,66 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Globalization;
+
+namespace System.Windows.Markup {
+
+       public class DateTimeValueSerializer : ValueSerializer
+       {
+               public override bool CanConvertFromString (string value, IValueSerializerContext context)
+               {
+                       // seems to return for any value
+                       return true;
+               }
+
+               public override bool CanConvertToString (object value, IValueSerializerContext context)
+               {
+                       if (!(value is DateTime))
+                               throw new ArgumentException ("Can only convert objects of type 'DateTime'");
+
+                       return true;
+               }
+
+               public override object ConvertFromString (string value, IValueSerializerContext context)
+               {
+                       if (value == null)
+                               throw new NotSupportedException ("DateTimeValueSerializer cannot convert from null value.");
+                       return DateTime.Parse (value);
+               }
+
+               public override string ConvertToString (object value, IValueSerializerContext context)
+               {
+                       if (value == null)
+                               throw new NotSupportedException ("Cannot convert null value to string.");
+
+                       if (!(value is DateTime))
+                               throw new NotSupportedException ("only objects of type 'DateTime' can be converted.");
+
+                       return ((DateTime)value).ToString("s", CultureInfo.InvariantCulture);
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Markup/DependsOnAttribute.cs b/mcs/class/WindowsBase/System.Windows.Markup/DependsOnAttribute.cs
new file mode 100644 (file)
index 0000000..6e19d6e
--- /dev/null
@@ -0,0 +1,49 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Markup {
+
+       [AttributeUsage (AttributeTargets.Property | AttributeTargets.Method, AllowMultiple = true)]
+       public sealed class DependsOnAttribute : Attribute
+       {
+               public DependsOnAttribute (string name)
+               {
+                       this.name = name;
+               }
+
+               public string Name {
+                       get { return name; }
+               }
+
+               public override object TypeId {
+                       get { return this; }
+               }
+
+               string name;
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Markup/DesignerSerializationOptions.cs b/mcs/class/WindowsBase/System.Windows.Markup/DesignerSerializationOptions.cs
new file mode 100644 (file)
index 0000000..ea4621f
--- /dev/null
@@ -0,0 +1,35 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Markup {
+
+       [Flags]
+       public enum DesignerSerializationOptions {
+               SerializeAsAttribute = 1
+       }
+}
+
diff --git a/mcs/class/WindowsBase/System.Windows.Markup/DesignerSerializationOptionsAttribute.cs b/mcs/class/WindowsBase/System.Windows.Markup/DesignerSerializationOptionsAttribute.cs
new file mode 100644 (file)
index 0000000..00c90c1
--- /dev/null
@@ -0,0 +1,44 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Markup {
+
+       [AttributeUsage (AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
+       public sealed class DesignerSerializationOptionsAttribute : Attribute
+       {
+               public DesignerSerializationOptionsAttribute (DesignerSerializationOptions designerSerializationOptions)
+               {
+                       this.designerSerializationOptions = designerSerializationOptions;
+               }
+
+               public DesignerSerializationOptions DesignerSerializationOptions {
+                       get { return designerSerializationOptions; }
+               }
+
+               DesignerSerializationOptions designerSerializationOptions;
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.Windows.Markup/IComponentConnector.cs b/mcs/class/WindowsBase/System.Windows.Markup/IComponentConnector.cs
new file mode 100644 (file)
index 0000000..ed4832c
--- /dev/null
@@ -0,0 +1,35 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Markup {
+
+       public interface IComponentConnector {
+               void Connect (int connectionId, object target);
+
+               void InitializeComponent ();
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.Windows.Markup/INameScope.cs b/mcs/class/WindowsBase/System.Windows.Markup/INameScope.cs
new file mode 100644 (file)
index 0000000..5124eca
--- /dev/null
@@ -0,0 +1,36 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Markup {
+
+       public interface INameScope {
+               object FindName (string name);
+
+               void RegisterName (string name, object scopedElement);
+               void UnregisterName (string name);
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.Windows.Markup/IValueSerializerContext.cs b/mcs/class/WindowsBase/System.Windows.Markup/IValueSerializerContext.cs
new file mode 100644 (file)
index 0000000..58e8e50
--- /dev/null
@@ -0,0 +1,35 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+
+namespace System.Windows.Markup {
+
+       public interface IValueSerializerContext : ITypeDescriptorContext, IServiceProvider {
+               ValueSerializer GetValueSerializerFor (PropertyDescriptor descriptor);
+               ValueSerializer GetValueSerializerFor (Type type);
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.Windows.Markup/IXamlTypeResolver.cs b/mcs/class/WindowsBase/System.Windows.Markup/IXamlTypeResolver.cs
new file mode 100644 (file)
index 0000000..a7dce69
--- /dev/null
@@ -0,0 +1,33 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Markup {
+
+       public interface IXamlTypeResolver {
+               Type Resolve (string qualifiedTypeName);
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.Windows.Markup/InternalTypeHelper.cs b/mcs/class/WindowsBase/System.Windows.Markup/InternalTypeHelper.cs
new file mode 100644 (file)
index 0000000..99c0f4c
--- /dev/null
@@ -0,0 +1,45 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Globalization;
+using System.Reflection;
+
+namespace System.Windows.Markup {
+
+       public abstract class InternalTypeHelper
+       {
+               protected InternalTypeHelper()
+               {
+               }
+
+               protected internal abstract void AddEventHandler (EventInfo eventInfo, object target, Delegate handler);
+               protected internal abstract Delegate CreateDelegate (Type delegateTYpe, object target, string handler);
+               protected internal abstract object CreateInstance (Type type, CultureInfo culture);
+               protected internal abstract object GetPropertyValue (PropertyInfo propertyInfo, object target, CultureInfo culture);
+               protected internal abstract void SetPropertyValue (PropertyInfo propertyInfo, object target, object value, CultureInfo culture);
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Markup/MarkupExtension.cs b/mcs/class/WindowsBase/System.Windows.Markup/MarkupExtension.cs
new file mode 100644 (file)
index 0000000..195e88e
--- /dev/null
@@ -0,0 +1,38 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Markup {
+
+       public abstract class MarkupExtension
+       {
+               protected MarkupExtension ()
+               {
+               }
+
+               public abstract object ProvideValue (IServiceProvider serviceProvider);
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Markup/MarkupExtensionReturnTypeAttribute.cs b/mcs/class/WindowsBase/System.Windows.Markup/MarkupExtensionReturnTypeAttribute.cs
new file mode 100644 (file)
index 0000000..fd74e2c
--- /dev/null
@@ -0,0 +1,49 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Markup {
+
+       [AttributeUsage (AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
+       public sealed class MarkupExtensionReturnTypeAttribute : Attribute
+       {
+               public MarkupExtensionReturnTypeAttribute ()
+               {
+               }
+
+               public MarkupExtensionReturnTypeAttribute (Type returnType)
+               {
+                       this.returnType = returnType;
+               }
+
+               public Type ReturnType {
+                       get { return returnType; }
+               }
+
+               Type returnType;
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Markup/RootNamespaceAttribute.cs b/mcs/class/WindowsBase/System.Windows.Markup/RootNamespaceAttribute.cs
new file mode 100644 (file)
index 0000000..656c35d
--- /dev/null
@@ -0,0 +1,44 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Markup {
+
+       [AttributeUsage (AttributeTargets.Assembly)]
+       public sealed class RootNamespaceAttribute : Attribute
+       {
+               public RootNamespaceAttribute (string nameSpace)
+               {
+                       this.nameSpace = nameSpace;
+               }
+
+               public string Namespace {
+                       get { return nameSpace; }
+               }
+
+               string nameSpace;
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.Windows.Markup/RuntimeNamePropertyAttribute.cs b/mcs/class/WindowsBase/System.Windows.Markup/RuntimeNamePropertyAttribute.cs
new file mode 100644 (file)
index 0000000..23d41bf
--- /dev/null
@@ -0,0 +1,44 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Markup {
+
+       [AttributeUsage (AttributeTargets.Assembly)]
+       public sealed class RuntimeNamePropertyAttribute : Attribute
+       {
+               public RuntimeNamePropertyAttribute (string name)
+               {
+                       this.name = name;
+               }
+
+               public string Name {
+                       get { return name; }
+               }
+
+               string name;
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.Windows.Markup/ServiceProviders.cs b/mcs/class/WindowsBase/System.Windows.Markup/ServiceProviders.cs
new file mode 100644 (file)
index 0000000..d41f6e2
--- /dev/null
@@ -0,0 +1,51 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+
+namespace System.Windows.Markup {
+
+       [EditorBrowsable (EditorBrowsableState.Never)]
+       [Browsable (false)]
+       public class ServiceProviders : IServiceProvider
+       {
+               public ServiceProviders ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public void AddService (Type serviceType, object service)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public object GetService (Type serviceType)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.Windows.Markup/TrimSurroundingWhitespaceAttribute.cs b/mcs/class/WindowsBase/System.Windows.Markup/TrimSurroundingWhitespaceAttribute.cs
new file mode 100644 (file)
index 0000000..71676dc
--- /dev/null
@@ -0,0 +1,34 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Markup {
+
+       [AttributeUsage (AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
+       public sealed class TrimSurroundingWhitespaceAttribute : Attribute
+       {
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.Windows.Markup/ValueSerializer.cs b/mcs/class/WindowsBase/System.Windows.Markup/ValueSerializer.cs
new file mode 100644 (file)
index 0000000..38bc4a6
--- /dev/null
@@ -0,0 +1,169 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Windows.Converters;
+
+namespace System.Windows.Markup {
+
+       // I don't like the idea of hardcoding the types in here, but
+       // I'm not sure what else to do about it..
+       class DefaultValueSerializerContext : IValueSerializerContext
+       {
+               public ValueSerializer GetValueSerializerFor (PropertyDescriptor descriptor)
+               {
+                       Attribute attribute = (Attribute)descriptor.Attributes[typeof (ValueSerializerAttribute)];
+                       if (attribute != null)
+                               return (ValueSerializer)Activator.CreateInstance (((ValueSerializerAttribute)attribute).ValueSerializerType);
+
+                       return GetValueSerializerFor (descriptor.PropertyType);
+               }
+
+               public ValueSerializer GetValueSerializerFor (Type type)
+               {
+                       Attribute attribute = (Attribute)TypeDescriptor.GetAttributes (type)[typeof (ValueSerializerAttribute)];
+                       if (attribute != null)
+                               return (ValueSerializer)Activator.CreateInstance (((ValueSerializerAttribute)attribute).ValueSerializerType);
+
+                       if (typeof (DateTime).IsAssignableFrom (type))
+                               return new DateTimeValueSerializer();
+                       else if (typeof (Int32Rect).IsAssignableFrom (type))
+                               return new Int32RectValueSerializer ();
+                       else if (typeof (Point).IsAssignableFrom (type))
+                               return new PointValueSerializer ();
+                       else if (typeof (Rect).IsAssignableFrom (type))
+                               return new RectValueSerializer ();
+                       else if (typeof (Size).IsAssignableFrom (type))
+                               return new SizeValueSerializer ();
+                       else if (typeof (Vector).IsAssignableFrom (type))
+                               return new VectorValueSerializer ();
+                       else
+                               return null;
+               }
+
+               public void OnComponentChanged ()
+               {
+               }
+
+               public bool OnComponentChanging ()
+               {
+                       return false;
+               }
+
+               public IContainer Container {
+                       get { return null; }
+               }
+
+               public object Instance {
+                       get { return null; }
+               }
+
+               public PropertyDescriptor PropertyDescriptor {
+                       get { return null; }
+               }
+
+               public object GetService (Type serviceType)
+               {
+                       return null;
+               }
+       }
+
+       public abstract class ValueSerializer
+       {
+               protected ValueSerializer ()
+               {
+               }
+
+               public virtual bool CanConvertFromString (string value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public virtual bool CanConvertToString (object value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public virtual object ConvertFromString (string value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public virtual string ConvertToString (object value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected Exception GetConvertFromException (object value)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected Exception GetConvertToException (object value, Type destinationType)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public virtual IEnumerable<Type> TypeReferences (object value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static ValueSerializer GetSerializerFor (PropertyDescriptor descriptor)
+               {
+                       DefaultValueSerializerContext defaultContext = new DefaultValueSerializerContext();
+                       return defaultContext.GetValueSerializerFor (descriptor);
+               }
+
+               public static ValueSerializer GetSerializerFor (Type type)
+               {
+                       DefaultValueSerializerContext defaultContext = new DefaultValueSerializerContext();
+                       return defaultContext.GetValueSerializerFor (type);
+               }
+
+               public static ValueSerializer GetSerializerFor (PropertyDescriptor descriptor, IValueSerializerContext context)
+               {
+                       ValueSerializer s = context.GetValueSerializerFor (descriptor);
+                       if (s == null) {
+                               DefaultValueSerializerContext defaultContext = new DefaultValueSerializerContext();
+                               s = defaultContext.GetValueSerializerFor (descriptor);
+                       }
+                       return s;
+               }
+
+               public static ValueSerializer GetSerializerFor (Type type, IValueSerializerContext context)
+               {
+                       ValueSerializer s = context.GetValueSerializerFor (type);
+                       if (s == null) {
+                               DefaultValueSerializerContext defaultContext = new DefaultValueSerializerContext();
+                               s = defaultContext.GetValueSerializerFor (type);
+                       }
+                       return s;
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Markup/ValueSerializerAttribute.cs b/mcs/class/WindowsBase/System.Windows.Markup/ValueSerializerAttribute.cs
new file mode 100644 (file)
index 0000000..0c1d704
--- /dev/null
@@ -0,0 +1,58 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Markup {
+
+       [AttributeUsage (AttributeTargets.Class |
+                        AttributeTargets.Struct |
+                        AttributeTargets.Enum |
+                        AttributeTargets.Method |
+                        AttributeTargets.Property |
+                        AttributeTargets.Interface, AllowMultiple = false, Inherited = true)]
+       public sealed class ValueSerializerAttribute : Attribute
+       {
+               public ValueSerializerAttribute (string valueSerializerTypeName)
+               {
+                       valueSerializerType = Type.GetType (valueSerializerTypeName);
+               }
+
+               public ValueSerializerAttribute (Type valueSerializerType)
+               {
+                       this.valueSerializerType = valueSerializerType;
+               }
+
+               public Type ValueSerializerType {
+                       get { return valueSerializerType; }
+               }
+
+               public string ValueSerializerTypeName {
+                       get { return valueSerializerType.Name; }
+               }
+
+               Type valueSerializerType;
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.Windows.Markup/WhitespaceSignificantCollectionAttribute.cs b/mcs/class/WindowsBase/System.Windows.Markup/WhitespaceSignificantCollectionAttribute.cs
new file mode 100644 (file)
index 0000000..899f8c2
--- /dev/null
@@ -0,0 +1,34 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Markup {
+
+       [AttributeUsage (AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
+       public sealed class WhitespaceSignificantCollectionAttribute : Attribute
+       {
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.Windows.Markup/XmlLangPropertyAttribute.cs b/mcs/class/WindowsBase/System.Windows.Markup/XmlLangPropertyAttribute.cs
new file mode 100644 (file)
index 0000000..914ecc7
--- /dev/null
@@ -0,0 +1,44 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Markup {
+
+       [AttributeUsage (AttributeTargets.Class, AllowMultiple = false)]
+       public sealed class XmlLangPropertyAttribute : Attribute
+       {
+               public XmlLangPropertyAttribute (string name)
+               {
+                       this.name = name;
+               }
+
+               public string Name {
+                       get { return name; }
+               }
+
+               string name;
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.Windows.Markup/XmlnsCompatibleWithAttribute.cs b/mcs/class/WindowsBase/System.Windows.Markup/XmlnsCompatibleWithAttribute.cs
new file mode 100644 (file)
index 0000000..2377c32
--- /dev/null
@@ -0,0 +1,50 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Markup {
+
+       [AttributeUsage (AttributeTargets.Assembly, AllowMultiple = true)]
+       public sealed class XmlnsCompatibleWithAttribute : Attribute
+       {
+               public XmlnsCompatibleWithAttribute (string oldNamespace, string newNamespace)
+               {
+                       this.oldNamespace = oldNamespace;
+                       this.newNamespace = newNamespace;
+               }
+
+               public string NewNamespace {
+                       get { return newNamespace; }
+               }
+
+               public string OldNamespace {
+                       get { return oldNamespace; }
+               }
+
+               string newNamespace;
+               string oldNamespace;
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.Windows.Markup/XmlnsDefinitionAttribute.cs b/mcs/class/WindowsBase/System.Windows.Markup/XmlnsDefinitionAttribute.cs
new file mode 100644 (file)
index 0000000..88acdc6
--- /dev/null
@@ -0,0 +1,56 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Markup {
+
+       [AttributeUsage (AttributeTargets.Assembly, AllowMultiple = true)]
+       public sealed class XmlnsDefinitionAttribute : Attribute
+       {
+               public XmlnsDefinitionAttribute (string xmlNamespace, string clrNamespace)
+               {
+                       this.xmlNamespace = xmlNamespace;
+                       this.clrNamespace = clrNamespace;
+               }
+
+               public string AssemblyName {
+                       get { return assemblyName; }
+                       set { assemblyName = value; }
+               }
+
+               public string ClrNamespace {
+                       get { return clrNamespace; }
+               }
+
+               public string XmlNamespace {
+                       get { return xmlNamespace; }
+               }
+
+               string xmlNamespace;
+               string clrNamespace;
+               string assemblyName;
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.Windows.Markup/XmlnsPrefixAttribute.cs b/mcs/class/WindowsBase/System.Windows.Markup/XmlnsPrefixAttribute.cs
new file mode 100644 (file)
index 0000000..0d77d67
--- /dev/null
@@ -0,0 +1,50 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Markup {
+
+       [AttributeUsage (AttributeTargets.Assembly, AllowMultiple = true)]
+       public sealed class XmlnsPrefixAttribute : Attribute
+       {
+               public XmlnsPrefixAttribute (string xmlNamespace, string prefix)
+               {
+                       this.xmlNamespace = xmlNamespace;
+                       this.prefix = prefix;
+               }
+
+               public string Prefix {
+                       get { return prefix; }
+               }
+
+               public string XmlNamespace {
+                       get { return xmlNamespace; }
+               }
+
+               string prefix;
+               string xmlNamespace;
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/System.Windows.Media.Converters/MatrixValueSerializer.cs b/mcs/class/WindowsBase/System.Windows.Media.Converters/MatrixValueSerializer.cs
new file mode 100644 (file)
index 0000000..0d039c6
--- /dev/null
@@ -0,0 +1,55 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows.Markup;
+
+namespace System.Windows.Media.Converters {
+
+       public class MatrixValueSerializer : ValueSerializer
+       {
+               public override bool CanConvertFromString (string value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override bool CanConvertToString (object value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override object ConvertFromString (string value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override string ConvertToString (object value, IValueSerializerContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
+
diff --git a/mcs/class/WindowsBase/System.Windows.Media/DisableDpiAwarenessAttribute.cs b/mcs/class/WindowsBase/System.Windows.Media/DisableDpiAwarenessAttribute.cs
new file mode 100644 (file)
index 0000000..5934b0a
--- /dev/null
@@ -0,0 +1,35 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Media {
+
+       [AttributeUsage (AttributeTargets.Assembly, AllowMultiple = false)]
+       public class DisableDpiAwarenessAttribute : Attribute
+       {
+       }
+}
+
diff --git a/mcs/class/WindowsBase/System.Windows.Media/Matrix.cs b/mcs/class/WindowsBase/System.Windows.Media/Matrix.cs
new file mode 100644 (file)
index 0000000..84fa6f6
--- /dev/null
@@ -0,0 +1,393 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Windows.Threading;
+
+namespace System.Windows.Media {
+
+       [SerializableAttribute] 
+       //[TypeConverterAttribute(typeof(MatrixConverter))] 
+       public struct Matrix : IFormattable {
+
+               double m11;
+               double m12;
+               double m21;
+               double m22;
+               double offsetX;
+               double offsetY;
+
+               public Matrix (double m11,
+                              double m12,
+                              double m21,
+                              double m22,
+                              double offsetX,
+                              double offsetY)
+               {
+                       this.m11 = m11;
+                       this.m12 = m12;
+                       this.m21 = m21;
+                       this.m22 = m22;
+                       this.offsetX = offsetX;
+                       this.offsetY = offsetY;
+               }
+
+               public void Append (Matrix matrix)
+               {
+                       double _m11;
+                       double _m21;
+                       double _m12;
+                       double _m22;
+                       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;
+
+                       _offsetX = offsetX * matrix.M11 + offsetY * matrix.M21 + matrix.OffsetX;
+                       _offsetY = offsetX * matrix.M12 + offsetY * matrix.M22 + matrix.OffsetY;
+
+                       m11 = _m11;
+                       m12 = _m12;
+                       m21 = _m21;
+                       m22 = _m22;
+                       offsetX = _offsetX;
+                       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);
+               }
+
+               public override bool Equals (object o)
+               {
+                       if (!(o is Matrix))
+                               return false;
+
+                       return Equals ((Matrix)o);
+               }
+
+               public static bool Equals (Matrix matrix1,
+                                          Matrix matrix2)
+               {
+                       return matrix1.Equals (matrix2);
+               }
+
+               public override int GetHashCode ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public void Invert ()
+               {
+                       if (!HasInverse)
+                               throw new InvalidOperationException ("Transform is not invertible.");
+
+                       double d = Determinant;
+
+                       /* 1/(ad-bc)[d -b; -c a] */
+
+                       double _m11 = m22;
+                       double _m12 = -m12;
+                       double _m21 = -m21;
+                       double _m22 = m11;
+
+                       double _offsetX = m21 * offsetY - m22 * offsetX;
+                       double _offsetY = m12 * offsetX - m11 * offsetY;
+
+                       m11 = _m11 / d;
+                       m12 = _m12 / d;
+                       m21 = _m21 / d;
+                       m22 = _m22 / d;
+                       offsetX = _offsetX / d;
+                       offsetY = _offsetY / d;
+               }
+
+               public static Matrix Multiply (Matrix trans1,
+                                              Matrix trans2)
+               {
+                       Matrix m = trans1;
+                       m.Append (trans2);
+                       return m;
+               }
+
+               public static bool operator == (Matrix matrix1,
+                                               Matrix matrix2)
+               {
+                       return matrix1.Equals (matrix2);
+               }
+
+               public static bool operator != (Matrix matrix1,
+                                               Matrix matrix2)
+               {
+                       return !matrix1.Equals (matrix2);
+               }
+
+               public static Matrix operator * (Matrix trans1,
+                                                Matrix trans2)
+               {
+                       Matrix result = trans1;
+                       result.Append (trans2);
+                       return result;
+               }
+
+               public static Matrix Parse (string source)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public void Prepend (Matrix matrix)
+               {
+                       double _m11;
+                       double _m21;
+                       double _m12;
+                       double _m22;
+                       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;
+
+                       _offsetX = matrix.OffsetX * m11 + matrix.OffsetY * m21 + offsetX;
+                       _offsetY = matrix.OffsetX * m12 + matrix.OffsetY * m22 + offsetY;
+
+                       m11 = _m11;
+                       m12 = _m12;
+                       m21 = _m21;
+                       m22 = _m22;
+                       offsetX = _offsetX;
+                       offsetY = _offsetY;
+               }
+
+               public void Rotate (double angle)
+               {
+                       // R_theta==[costheta -sintheta; sintheta costheta],    
+                       double theta = angle * Math.PI / 180;
+
+                       Matrix r_theta = new Matrix (Math.Cos (theta), Math.Sin(theta),
+                                                    -Math.Sin (theta), Math.Cos(theta),
+                                                    0, 0);
+
+                       Append (r_theta);
+               }
+
+               public void RotateAt (double angle,
+                                     double centerX,
+                                     double centerY)
+               {
+                       Translate (-centerX, -centerY);
+                       Rotate (angle);
+                       Translate (centerX, centerY);
+               }
+
+               public void RotateAtPrepend (double angle,
+                                            double centerX,
+                                            double centerY)
+               {
+                       Matrix m = Matrix.Identity;
+                       m.RotateAt (angle, centerX, centerY);
+                       Prepend (m);
+               }
+
+               public void RotatePrepend (double angle)
+               {
+                       Matrix m = Matrix.Identity;
+                       m.Rotate (angle);
+                       Prepend (m);
+               }
+
+               public void Scale (double scaleX,
+                                  double scaleY)
+               {
+                       Matrix scale = new Matrix (scaleX, 0,
+                                                  0, scaleY,
+                                                  0, 0);
+
+                       Append (scale);
+               }
+
+               public void ScaleAt (double scaleX,
+                                    double scaleY,
+                                    double centerX,
+                                    double centerY)
+               {
+                       Translate (-centerX, -centerY);
+                       Scale (scaleX, scaleY);
+                       Translate (centerX, centerY);
+               }
+
+               public void ScaleAtPrepend (double scaleX,
+                                           double scaleY,
+                                           double centerX,
+                                           double centerY)
+               {
+                       Matrix m = Matrix.Identity;
+                       m.ScaleAt (scaleX, scaleY, centerX, centerY);
+                       Prepend (m);
+               }
+
+               public void ScalePrepend (double scaleX,
+                                         double scaleY)
+               {
+                       Matrix m = Matrix.Identity;
+                       m.Scale (scaleX, scaleY);
+                       Prepend (m);
+               }
+
+               public void SetIdentity ()
+               {
+                       m11 = m22 = 1.0;
+                       m12 = m21 = 0.0;
+                       offsetX = offsetY = 0.0;
+               }
+
+               public void Skew (double skewX,
+                                 double skewY)
+               {
+                       Matrix skew_m = new Matrix (1, Math.Tan (skewY * Math.PI / 180),
+                                                   Math.Tan (skewX * Math.PI / 180), 1,
+                                                   0, 0);
+                       Append (skew_m);
+               }
+
+               public void SkewPrepend (double skewX,
+                                        double skewY)
+               {
+                       Matrix m = Matrix.Identity;
+                       m.Skew (skewX, skewY);
+                       Prepend (m);
+               }
+
+               string IFormattable.ToString (string format,
+                                             IFormatProvider provider)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override string ToString ()
+               {
+                       if (IsIdentity)
+                               return "Identity";
+                       else
+                               return string.Format ("{0},{1},{2},{3},{4},{5}",
+                                                     m11, m12, m21, m22, offsetX, offsetY);
+               }
+
+               public string ToString (IFormatProvider provider)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public Point Transform (Point point)
+               {
+                       return Point.Multiply (point, this);
+               }
+
+               public void Transform (Point[] points)
+               {
+                       for (int i = 0; i < points.Length; i ++)
+                               points[i] = Transform (points[i]);
+               }
+
+               public Vector Transform (Vector vector)
+               {
+                       return Vector.Multiply (vector, this);
+               }
+
+               public void Transform (Vector[] vectors)
+               {
+                       for (int i = 0; i < vectors.Length; i ++)
+                               vectors[i] = Transform (vectors[i]);
+               }
+
+               public void Translate (double offsetX,
+                                      double offsetY)
+               {
+                       this.offsetX += offsetX;
+                       this.offsetY += offsetY;
+               }
+
+               public void TranslatePrepend (double offsetX,
+                                             double offsetY)
+               {
+                       Matrix m = Matrix.Identity;
+                       m.Translate (offsetX, offsetY);
+                       Prepend (m);
+               }
+
+               public double Determinant {
+                       get { return m11 * m22 - m12 * m21; }
+               }
+
+               public bool HasInverse {
+                       get { return Determinant != 0; }
+               }
+
+               public static Matrix Identity {
+                       get { return new Matrix (1.0, 0.0, 0.0, 1.0, 0.0, 0.0); }
+               }
+
+               public bool IsIdentity {
+                       get { return Equals (Matrix.Identity); }
+               }
+
+               public double M11 { 
+                       get { return m11; }
+                       set { m11 = value; }
+               }
+               public double M12 { 
+                       get { return m12; }
+                       set { m12 = value; }
+               }
+               public double M21 { 
+                       get { return m21; }
+                       set { m21 = value; }
+               }
+               public double M22 { 
+                       get { return m22; }
+                       set { m22 = value; }
+               }
+               public double OffsetX { 
+                       get { return offsetX; }
+                       set { offsetX = value; }
+               }
+               public double OffsetY { 
+                       get { return offsetY; }
+                       set { offsetY = value; }
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Media/MatrixConverter.cs b/mcs/class/WindowsBase/System.Windows.Media/MatrixConverter.cs
new file mode 100644 (file)
index 0000000..61ede28
--- /dev/null
@@ -0,0 +1,56 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Globalization;
+
+namespace System.Windows.Media {
+
+       public class MatrixConverter : TypeConverter
+       {
+               public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
+
diff --git a/mcs/class/WindowsBase/System.Windows.Threading/ChangeLog b/mcs/class/WindowsBase/System.Windows.Threading/ChangeLog
new file mode 100644 (file)
index 0000000..3d7df88
--- /dev/null
@@ -0,0 +1,54 @@
+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.
+
+
diff --git a/mcs/class/WindowsBase/System.Windows.Threading/Dispatcher.cs b/mcs/class/WindowsBase/System.Windows.Threading/Dispatcher.cs
new file mode 100644 (file)
index 0000000..01d1cc6
--- /dev/null
@@ -0,0 +1,516 @@
+// TODO:
+//    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.
+//
+//    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.
+//
+// The documentation for the Dispatcher family is poorly written, complete
+// sections are cut-and-pasted that add no value and the important pieces
+// like (what is a frame) is not on the APIs, but scattered everywhere else
+//
+// -----------------------------------------------------------------------
+// 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.
+//
+// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Miguel de Icaza (miguel@novell.com)
+//
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Security;
+using System.Threading;
+
+namespace System.Windows.Threading {
+
+       [Flags]
+       internal enum Flags {
+               ShutdownStarted = 1,
+               Shutdown = 2,
+               Disabled = 4
+       }
+       
+       public sealed class Dispatcher {
+               static Dictionary<Thread, Dispatcher> dispatchers = new Dictionary<Thread, Dispatcher> ();
+               static object olock = new object ();
+               static DispatcherFrame main_execution_frame = new DispatcherFrame ();
+               
+               const int TOP_PRIO = (int)DispatcherPriority.Send;
+               Thread base_thread;
+               PokableQueue [] priority_queues = new PokableQueue [TOP_PRIO+1];
+
+               Flags flags;
+               int queue_bits;
+
+               //
+               // Used to notify the dispatcher thread that new data is available
+               //
+               EventWaitHandle wait;
+
+               //
+               // The hooks for this Dispatcher
+               //
+               DispatcherHooks hooks;
+
+               //
+               // The current DispatcherFrame active in a given Dispatcher, we use this to
+               // keep a linked list of all active frames, so we can "ExitAll" frames when
+               // requested
+               DispatcherFrame current_frame;
+               
+               Dispatcher (Thread t)
+               {
+                       base_thread = t;
+                       for (int i = 1; i <= (int) DispatcherPriority.Send; i++)
+                               priority_queues [i] = new PokableQueue ();
+                       wait = new EventWaitHandle (false, EventResetMode.AutoReset);
+                       hooks = new DispatcherHooks (this);
+               }
+
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public bool CheckAccess ()
+               {
+                       return Thread.CurrentThread == base_thread;
+               }
+
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public void VerifyAccess ()
+               {
+                       if (Thread.CurrentThread != base_thread)
+                               throw new InvalidOperationException ("Invoked from a different thread");
+               }
+
+               public static void ValidatePriority (DispatcherPriority priority, string parameterName)
+               {
+                       if (priority < DispatcherPriority.Inactive || priority > DispatcherPriority.Send)
+                               throw new InvalidEnumArgumentException (parameterName);
+               }
+               
+               public DispatcherOperation BeginInvoke (DispatcherPriority priority, Delegate method)
+               {
+                       if (priority < 0 || priority > DispatcherPriority.Send)
+                               throw new InvalidEnumArgumentException ("priority");
+                       if (priority == DispatcherPriority.Inactive)
+                               throw new ArgumentException ("priority can not be inactive", "priority");
+                       if (method == null)
+                               throw new ArgumentNullException ("method");
+
+                       DispatcherOperation op = new DispatcherOperation (this, priority, method);
+                       Queue (priority, op);
+
+                       return op;
+               }
+
+               public DispatcherOperation BeginInvoke (DispatcherPriority priority, Delegate method, object arg)
+               {
+                       if (priority < 0 || priority > DispatcherPriority.Send)
+                               throw new InvalidEnumArgumentException ("priority");
+                       if (priority == DispatcherPriority.Inactive)
+                               throw new ArgumentException ("priority can not be inactive", "priority");
+                       if (method == null)
+                               throw new ArgumentNullException ("method");
+
+                       DispatcherOperation op = new DispatcherOperation (this, priority, method, arg);
+                       
+                       Queue (priority, op);
+                       
+                       return op;
+               }
+               
+               public DispatcherOperation BeginInvoke (DispatcherPriority priority, Delegate method, object arg, params object [] args)
+               {
+                       if (priority < 0 || priority > DispatcherPriority.Send)
+                               throw new InvalidEnumArgumentException ("priority");
+                       if (priority == DispatcherPriority.Inactive)
+                               throw new ArgumentException ("priority can not be inactive", "priority");
+                       if (method == null)
+                               throw new ArgumentNullException ("method");
+
+                       DispatcherOperation op = new DispatcherOperation (this, priority, method, arg, args);
+                       Queue (priority, op);
+
+                       return op;
+               }
+
+               public object Invoke (DispatcherPriority priority, Delegate method)
+               {
+                       if (priority < 0 || priority > DispatcherPriority.Send)
+                               throw new InvalidEnumArgumentException ("priority");
+                       if (priority == DispatcherPriority.Inactive)
+                               throw new ArgumentException ("priority can not be inactive", "priority");
+                       if (method == null)
+                               throw new ArgumentNullException ("method");
+
+                       DispatcherOperation op = new DispatcherOperation (this, priority, method);
+                       Queue (priority, op);
+                       PushFrame (new DispatcherFrame ());
+                       
+                       throw new NotImplementedException ();
+               }
+
+               public object Invoke (DispatcherPriority priority, Delegate method, object arg)
+               {
+                       if (priority < 0 || priority > DispatcherPriority.Send)
+                               throw new InvalidEnumArgumentException ("priority");
+                       if (priority == DispatcherPriority.Inactive)
+                               throw new ArgumentException ("priority can not be inactive", "priority");
+                       if (method == null)
+                               throw new ArgumentNullException ("method");
+
+                       Queue (priority, new DispatcherOperation (this, priority, method, arg));
+                       throw new NotImplementedException ();
+               }
+               
+               public object Invoke (DispatcherPriority priority, Delegate method, object arg, params object [] args)
+               {
+                       if (priority < 0 || priority > DispatcherPriority.Send)
+                               throw new InvalidEnumArgumentException ("priority");
+                       if (priority == DispatcherPriority.Inactive)
+                               throw new ArgumentException ("priority can not be inactive", "priority");
+                       if (method == null)
+                               throw new ArgumentNullException ("method");
+
+                       Queue (priority, new DispatcherOperation (this, priority, method, arg, args));
+
+                       throw new NotImplementedException ();
+               }
+
+               public object Invoke (DispatcherPriority priority, TimeSpan timeout, Delegate method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public object Invoke (DispatcherPriority priority, TimeSpan timeout, Delegate method, object arg)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public object Invoke (DispatcherPriority priority, TimeSpan timeout, Delegate method, object arg, params object [] args)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               void Queue (DispatcherPriority priority, DispatcherOperation x)
+               {
+                       int p = ((int) priority);
+                       PokableQueue q = priority_queues [p];
+                       
+                       lock (q){
+                               int flag = 1 << p;
+                               q.Enqueue (x);
+                               queue_bits |= flag;
+                       }
+                       hooks.EmitOperationPosted (x);
+
+                       if (Thread.CurrentThread != base_thread)
+                               wait.Set ();
+               }
+
+               internal void Reprioritize (DispatcherOperation op, DispatcherPriority oldpriority)
+               {
+                       int oldp = (int) oldpriority;
+                       PokableQueue q = priority_queues [oldp];
+
+                       lock (q){
+                               q.Remove (op);
+                       }
+                       Queue (op.Priority, op);
+                       hooks.EmitOperationPriorityChanged (op);
+               }
+               
+               public static Dispatcher CurrentDispatcher {
+                       get {
+                               lock (olock){
+                                       Thread t = Thread.CurrentThread;
+                                       Dispatcher dis = FromThread (t);
+
+                                       if (dis != null)
+                                               return dis;
+                               
+                                       dis = new Dispatcher (t);
+                                       dispatchers [t] = dis;
+                                       return dis;
+                               }
+                       }
+               }
+
+               public static Dispatcher FromThread (Thread thread)
+               {
+                       Dispatcher dis;
+                       
+                       if (dispatchers.TryGetValue (thread, out dis))
+                               return dis;
+
+                       return null;
+               }
+
+               public Thread Thread {
+                       get {
+                               return base_thread;
+                       }
+               }
+
+               [SecurityCritical]
+               public static void Run ()
+               {
+                       PushFrame (main_execution_frame);
+               }
+               
+               [SecurityCritical]
+               public static void PushFrame (DispatcherFrame frame)
+               {
+                       if (frame == null)
+                               throw new ArgumentNullException ("frame");
+
+                       Dispatcher dis = CurrentDispatcher;
+
+                       if (dis.HasShutdownFinished)
+                               throw new InvalidOperationException ("The Dispatcher has shut down");
+                       if (frame.dispatcher != null)
+                               throw new InvalidOperationException ("Frame is already running on a different dispatcher");
+                       if ((dis.flags & Flags.Disabled) != 0)
+                               throw new InvalidOperationException ("Dispatcher processing has been disabled");
+
+                       frame.ParentFrame = dis.current_frame;
+                       dis.current_frame = frame;
+                       
+                       frame.dispatcher = dis;
+
+                       dis.RunFrame (frame);
+               }
+
+               void PerformShutdown ()
+               {
+                       EventHandler h;
+                       
+                       h = ShutdownStarted;
+                       if (h != null)
+                               h (this, new EventArgs ());
+                       
+                       flags |= Flags.Shutdown;
+                       
+                       h = ShutdownFinished;
+                       if (h != null)
+                               h (this, new EventArgs ());
+
+                       priority_queues = null;
+                       wait = null;
+               }
+               
+               void RunFrame (DispatcherFrame frame)
+               {
+                       do {
+                               while (queue_bits != 0){
+                                       for (int i = TOP_PRIO; i > 0 && queue_bits != 0; i--){
+                                               int current_bit = queue_bits & (1 << i);
+                                               if (current_bit != 0){
+                                                       PokableQueue q = priority_queues [i];
+
+                                                       do {
+                                                               DispatcherOperation task;
+                                                               
+                                                               lock (q){
+                                                                       task = (DispatcherOperation) q.Dequeue ();
+                                                               }
+                                                               
+                                                               task.Invoke ();
+
+                                                               //
+                                                               // call hooks.
+                                                               //
+                                                               if (task.Status == DispatcherOperationStatus.Aborted)
+                                                                       hooks.EmitOperationAborted (task);
+                                                               else
+                                                                       hooks.EmitOperationCompleted (task);
+
+                                                               if (!frame.Continue)
+                                                                       return;
+                                                               
+                                                               if (HasShutdownStarted){
+                                                                       PerformShutdown ();
+                                                                       return;
+                                                               }
+                                                               
+                                                               // if we are done with this queue, leave.
+                                                               lock (q){
+                                                                       if (q.Count == 0){
+                                                                               queue_bits &= ~(1 << i);
+                                                                               break;
+                                                                       }
+                                                               }
+
+                                                               //
+                                                               // If a higher-priority task comes in, go do that
+                                                               //
+                                                               if (current_bit < (queue_bits & ~current_bit))
+                                                                       break;
+                                                       } while (true);
+                                               }
+                                       }
+                               }
+                               hooks.EmitInactive ();
+                               
+                               wait.WaitOne ();
+                               wait.Reset ();
+                       } while (frame.Continue);
+               }
+
+               [EditorBrowsable (EditorBrowsableState.Advanced)]
+               public DispatcherHooks Hooks {
+                       [SecurityCritical]
+                       get { throw new NotImplementedException (); }
+               }
+
+               public bool HasShutdownStarted {
+                       get {
+                               return (flags & Flags.ShutdownStarted) != 0;
+                       }
+               }
+
+               public bool HasShutdownFinished {
+                       get {
+                               return (flags & Flags.Shutdown) != 0;
+                       }
+               }
+
+               //
+               // Do no work here, so that any events are thrown on the owning thread
+               //
+               [SecurityCritical]
+               public void InvokeShutdown ()
+               {
+                       flags |= Flags.ShutdownStarted;
+               }
+
+               [SecurityCritical]
+               public void BeginInvokeShutdown (DispatcherPriority priority)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [SecurityCritical]
+               public static void ExitAllFrames ()
+               {
+                       Dispatcher dis = CurrentDispatcher;
+                       
+                       for (DispatcherFrame frame = dis.current_frame; frame != null; frame = frame.ParentFrame){
+                               if (frame.exit_on_request)
+                                       frame.Continue = false;
+                               else {
+                                       //
+                                       // Stop unwinding the frames at the first frame that is
+                                       // long running
+                                       break;
+                               }
+                       }
+               }
+
+               public DispatcherProcessingDisabled DisableProcessing ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public event EventHandler ShutdownStarted;
+               public event EventHandler ShutdownFinished;
+               public event DispatcherUnhandledExceptionEventHandler UnhandledException;
+               public event DispatcherUnhandledExceptionFilterEventHandler UnhandledExceptionFilter;
+       }
+
+       internal class PokableQueue {
+               const int initial_capacity = 32;
+
+               int size, head, tail;
+               object [] array;
+
+               internal PokableQueue (int capacity) 
+               {
+                       array = new object [capacity];
+               }
+
+               internal PokableQueue () : this (initial_capacity)
+               {
+               }
+
+               public void Enqueue (object obj)
+               {
+                        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;
+                }
+
+               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 {
+                               return size;
+                       }
+               }
+
+               public void Remove (object obj)
+               {
+                       for (int i = 0; i < size; i++){
+                               if (array [(head+i) % array.Length] == obj){
+                                       for (int j = i; j < size-i; j++)
+                                               array [(head +j) % array.Length] = array [(head+j+1) % array.Length];
+                                       size--;
+                                       if (size < 0)
+                                               size = array.Length-1;
+                                       tail--;
+                               }
+                       }
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Threading/DispatcherEventArgs.cs b/mcs/class/WindowsBase/System.Windows.Threading/DispatcherEventArgs.cs
new file mode 100644 (file)
index 0000000..ec2c538
--- /dev/null
@@ -0,0 +1,43 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Threading {
+
+       public class DispatcherEventArgs : EventArgs
+       {
+               Dispatcher dispatcher;
+
+               internal DispatcherEventArgs (Dispatcher dispatcher)
+               {
+                       this.dispatcher = dispatcher;
+               }
+
+               public Dispatcher Dispatcher {
+                       get { return dispatcher; }
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Threading/DispatcherFrame.cs b/mcs/class/WindowsBase/System.Windows.Threading/DispatcherFrame.cs
new file mode 100644 (file)
index 0000000..bdfd428
--- /dev/null
@@ -0,0 +1,74 @@
+// 
+// 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.
+//
+// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Miguel de Icaza (miguel@novell.com)
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Security;
+using System.Threading;
+
+namespace System.Windows.Threading {
+
+       public class DispatcherFrame : DispatcherObject  {
+               DispatcherFrame parent_frame;
+               
+               internal bool exit_on_request;
+               bool cont;
+               internal Dispatcher dispatcher;
+               
+               public DispatcherFrame ()
+               {
+                       exit_on_request = true;
+                       cont = true;
+               }
+
+               public DispatcherFrame (bool exitWhenRequested)
+               {
+                       exit_on_request = exitWhenRequested;
+                       cont = true;
+               }
+
+               public bool Continue {
+                       get {
+                               return cont;
+                       }
+
+                       [SecurityCritical]
+                       set {
+                               cont = value;
+                       }
+               }
+
+               internal DispatcherFrame ParentFrame {
+                       get {
+                               return parent_frame;
+                       }
+
+                       set {
+                               parent_frame = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Threading/DispatcherHookEventArgs.cs b/mcs/class/WindowsBase/System.Windows.Threading/DispatcherHookEventArgs.cs
new file mode 100644 (file)
index 0000000..be66853
--- /dev/null
@@ -0,0 +1,49 @@
+// 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.
+//
+// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Miguel de Icaza (miguel@novell.com)
+//
+using System;
+
+namespace System.Windows.Threading {
+
+       public sealed class DispatcherHookEventArgs : EventArgs {
+               DispatcherOperation operation;
+               
+               public DispatcherHookEventArgs (DispatcherOperation operation)
+               {
+                       this.operation = operation;
+               }
+
+               public Dispatcher Dispatcher {
+                       get {
+                               return operation.Dispatcher;
+                       }
+               }
+
+               public DispatcherOperation Operation {
+                       get {
+                               return operation;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Threading/DispatcherHookEventHandler.cs b/mcs/class/WindowsBase/System.Windows.Threading/DispatcherHookEventHandler.cs
new file mode 100644 (file)
index 0000000..4fd1d84
--- /dev/null
@@ -0,0 +1,32 @@
+// 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.
+//
+// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Miguel de Icaza (miguel@novell.com)
+//
+using System;
+
+namespace System.Windows.Threading {
+
+       public delegate void DispatcherHookEventHandler (object sender, DispatcherHookEventArgs e);
+
+}
+
diff --git a/mcs/class/WindowsBase/System.Windows.Threading/DispatcherHooks.cs b/mcs/class/WindowsBase/System.Windows.Threading/DispatcherHooks.cs
new file mode 100644 (file)
index 0000000..5dc423d
--- /dev/null
@@ -0,0 +1,82 @@
+// 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.
+//
+// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Miguel de Icaza (miguel@novell.com)
+//
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Threading;
+
+namespace System.Windows.Threading {
+
+       public sealed class DispatcherHooks {
+               Dispatcher owner;
+
+               internal DispatcherHooks (Dispatcher owner)
+               {
+                       this.owner = owner;
+               }
+               
+               public event EventHandler DispatcherInactive;
+               public event DispatcherHookEventHandler OperationAborted;
+               public event DispatcherHookEventHandler OperationCompleted;
+               public event DispatcherHookEventHandler OperationPosted;
+               public event DispatcherHookEventHandler OperationPriorityChanged;
+
+               internal void EmitOperationPosted (DispatcherOperation op)
+               {
+                       DispatcherHookEventHandler posted = OperationPosted;
+                       if (posted != null)
+                               posted (owner, new DispatcherHookEventArgs (op));
+               }
+
+               internal void EmitOperationCompleted (DispatcherOperation op)
+               {
+                       DispatcherHookEventHandler completed = OperationCompleted;
+                       if (completed != null)
+                               completed (owner, new DispatcherHookEventArgs (op));
+               }
+
+               internal void EmitOperationAborted (DispatcherOperation op)
+               {
+                       DispatcherHookEventHandler aborted = OperationAborted;
+                       if (aborted != null)
+                               aborted (owner, new DispatcherHookEventArgs (op));
+               }
+
+               internal void EmitOperationPriorityChanged (DispatcherOperation op)
+               {
+                       DispatcherHookEventHandler prio = OperationPriorityChanged;
+                       if (prio != null)
+                               prio (owner, new DispatcherHookEventArgs (op));
+               }
+
+               internal void EmitInactive ()
+               {
+                       EventHandler inactive = DispatcherInactive;
+                       if (inactive != null)
+                               inactive (owner, EventArgs.Empty);
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Threading/DispatcherObject.cs b/mcs/class/WindowsBase/System.Windows.Threading/DispatcherObject.cs
new file mode 100644 (file)
index 0000000..9abfa0b
--- /dev/null
@@ -0,0 +1,59 @@
+// 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.
+//
+// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Miguel de Icaza (miguel@novell.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Threading;
+
+namespace System.Windows.Threading {
+
+       public abstract class DispatcherObject {
+               Thread base_thread;
+               
+               protected DispatcherObject ()
+               {
+                       base_thread = Thread.CurrentThread;
+               }
+               
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public bool CheckAccess ()
+               {
+                       return Thread.CurrentThread == base_thread;
+               }
+
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public void VerifyAccess ()
+               {
+                       throw new InvalidOperationException ("The calling thread is not the same as the creation thread");
+               }
+
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public Dispatcher Dispatcher {
+                       get {
+                               return Dispatcher.FromThread (base_thread);
+                       }
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Threading/DispatcherOperation.cs b/mcs/class/WindowsBase/System.Windows.Threading/DispatcherOperation.cs
new file mode 100644 (file)
index 0000000..34bb93d
--- /dev/null
@@ -0,0 +1,149 @@
+//
+// 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.
+//
+// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Miguel de Icaza (miguel@novell.com)
+//
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Security;
+using System.Threading;
+
+namespace System.Windows.Threading {
+
+       public sealed class DispatcherOperation {
+               DispatcherOperationStatus status;
+               DispatcherPriority priority;
+               Dispatcher dispatcher;
+               object result;
+               Delegate delegate_method;
+               object [] delegate_args;
+
+               internal DispatcherOperation (Dispatcher dis, DispatcherPriority prio)
+               {
+                       dispatcher = dis;
+                       priority = prio;
+                       if (Dispatcher.HasShutdownFinished)
+                               status = DispatcherOperationStatus.Aborted;
+                       else
+                               status = DispatcherOperationStatus.Pending;
+               }
+               
+               internal DispatcherOperation (Dispatcher dis, DispatcherPriority prio, Delegate d)
+                       : this (dis, prio)
+               {
+                       delegate_method = d;
+               }
+
+               internal DispatcherOperation (Dispatcher dis, DispatcherPriority prio, Delegate d, object arg)
+                       : this (dis, prio)
+               {
+                       delegate_method = d;
+                       delegate_args = new object [1];
+                       delegate_args [0] = arg;
+               }
+
+               internal DispatcherOperation (Dispatcher dis, DispatcherPriority prio, Delegate d, object arg, object [] args)
+                       : this (dis, prio)
+               {
+                       delegate_method = d;
+                       delegate_args = new object [args.Length + 1];
+                       delegate_args [0] = arg;
+                       Array.Copy (args, 1, delegate_args, 0, args.Length);
+               }
+
+               internal void Invoke ()
+               {
+                       status = DispatcherOperationStatus.Executing;
+                       result = delegate_method.DynamicInvoke (delegate_args);
+                               
+                       status = DispatcherOperationStatus.Completed;
+
+                       if (Completed != null)
+                               Completed (this, EventArgs.Empty);
+               }
+               
+               public bool Abort ()
+               {
+                       status = DispatcherOperationStatus.Aborted;
+                       throw new NotImplementedException ();
+               }
+
+               public DispatcherOperationStatus Status {
+                       get {
+                               return status;
+                       }
+
+                       internal set {
+                               status = value;
+                       }
+               }
+
+               public Dispatcher Dispatcher {
+                       get {
+                               return dispatcher;
+                       }
+               }
+
+               public DispatcherPriority Priority {
+                       get {
+                               return priority;
+                       }
+
+                       set {
+                               if (priority != value){
+                                       DispatcherPriority old = priority;
+                                       priority = value;
+                                       dispatcher.Reprioritize (this, old);
+                               }
+                       }
+               }
+
+               public object Result {
+                       get {
+                               return result;
+                       }
+               }
+
+               public DispatcherOperationStatus Wait ()
+               {
+                       if (status == DispatcherOperationStatus.Executing)
+                               throw new InvalidOperationException ("Already executing");
+
+                       throw new NotImplementedException ();
+               }
+
+               [SecurityCritical]
+               public DispatcherOperationStatus Wait (TimeSpan timeout)
+               {
+                       if (status == DispatcherOperationStatus.Executing)
+                               throw new InvalidOperationException ("Already executing");
+
+                       throw new NotImplementedException ();
+               }
+               
+               public event EventHandler Aborted;
+               public event EventHandler Completed;
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Threading/DispatcherOperationCallback.cs b/mcs/class/WindowsBase/System.Windows.Threading/DispatcherOperationCallback.cs
new file mode 100644 (file)
index 0000000..c5b44bd
--- /dev/null
@@ -0,0 +1,30 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+namespace System.Windows.Threading {
+
+       public delegate object DispatcherOperationCallback (object arg);
+
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Threading/DispatcherOperationStatus.cs b/mcs/class/WindowsBase/System.Windows.Threading/DispatcherOperationStatus.cs
new file mode 100644 (file)
index 0000000..9f7e35a
--- /dev/null
@@ -0,0 +1,35 @@
+//
+// 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.
+//
+// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Miguel de Icaza (miguel@novell.com)
+//
+
+namespace System.Windows.Threading {
+
+       public enum DispatcherOperationStatus {
+               Pending = 0,
+               Aborted = 1,
+               Completed = 2,
+               Executing = 3
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Threading/DispatcherPriority.cs b/mcs/class/WindowsBase/System.Windows.Threading/DispatcherPriority.cs
new file mode 100644 (file)
index 0000000..7ef73cb
--- /dev/null
@@ -0,0 +1,47 @@
+// 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.
+//
+// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Miguel de Icaza (miguel@novell.com)
+//
+
+using System;
+using System.Threading;
+
+namespace System.Windows.Threading {
+
+       public enum DispatcherPriority {
+               Invalid = -1,
+               Inactive = 0,
+               SystemIdle = 1,
+               ApplicationIdle = 2,
+               ContextIdle = 3,
+               Background = 4,
+               Input = 5,
+               Loaded = 6,
+               Render = 7,
+               DataBind = 8,
+
+               Normal = 9,
+
+               Send = 10,
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Threading/DispatcherProcessingDisabled.cs b/mcs/class/WindowsBase/System.Windows.Threading/DispatcherProcessingDisabled.cs
new file mode 100644 (file)
index 0000000..6aa7a14
--- /dev/null
@@ -0,0 +1,62 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Threading {
+
+       public struct DispatcherProcessingDisabled : IDisposable
+       {
+               internal DispatcherProcessingDisabled (int foo)
+               {
+               }
+
+               public void Dispose ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override bool Equals (object obj)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override int GetHashCode ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static bool operator != (DispatcherProcessingDisabled left, DispatcherProcessingDisabled right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static bool operator == (DispatcherProcessingDisabled left, DispatcherProcessingDisabled right)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Threading/DispatcherSynchronizationContext.cs b/mcs/class/WindowsBase/System.Windows.Threading/DispatcherSynchronizationContext.cs
new file mode 100644 (file)
index 0000000..e914b94
--- /dev/null
@@ -0,0 +1,66 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Security;
+using System.Threading;
+
+namespace System.Windows.Threading {
+
+       public class DispatcherSynchronizationContext : SynchronizationContext
+       {
+               public DispatcherSynchronizationContext ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public DispatcherSynchronizationContext (Dispatcher dispatcher)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override SynchronizationContext CreateCopy ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override void Post (SendOrPostCallback d, object state)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override void Send (SendOrPostCallback d, object state)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [SecurityCritical]
+               public override int Wait (IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Threading/DispatcherTimer.cs b/mcs/class/WindowsBase/System.Windows.Threading/DispatcherTimer.cs
new file mode 100644 (file)
index 0000000..1068b83
--- /dev/null
@@ -0,0 +1,139 @@
+// 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.
+//
+// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Miguel de Icaza (miguel@novell.com)
+//
+using System;
+using System.Collections;
+using System.Threading;
+
+namespace System.Windows.Threading {
+
+       public class DispatcherTimer {
+               DispatcherPriority priority;
+               Dispatcher target_dispatcher;
+               long interval;
+               EventHandler callback;
+               Timer timer;
+               object tag;
+               
+               public DispatcherTimer ()
+                       : this (DispatcherPriority.Background, Dispatcher.CurrentDispatcher)
+               {
+               }
+
+               public DispatcherTimer (DispatcherPriority priority)
+                       : this (priority, Dispatcher.CurrentDispatcher)
+               {
+               }
+              
+               public DispatcherTimer (DispatcherPriority priority, Dispatcher dispatcher)
+                       : this (TimeSpan.Zero, priority, null, dispatcher)
+               {
+               }
+              
+               public DispatcherTimer (TimeSpan interval, DispatcherPriority priority,
+                                       EventHandler callback, Dispatcher dispatcher)
+               {
+                       this.priority = priority;
+                       this.target_dispatcher = dispatcher;
+                       this.interval = interval.Ticks;
+                       this.callback = callback;
+               }
+
+               public void Start ()
+               {
+                       if (timer == null){
+                               long repeat_interval = interval;
+                               if (repeat_interval == 0)
+                                       repeat_interval = 1;
+                               timer = new Timer (new TimerCallback (timer_tick), null, interval, repeat_interval);
+                       }
+               }
+
+               void timer_tick (object state)
+               {
+                       target_dispatcher.BeginInvoke (priority, (ThreadStart) delegate {
+                               EventHandler h = Tick;
+                               if (h != null)
+                                       h (this, EventArgs.Empty);
+                               if (callback != null)
+                                       callback (this, EventArgs.Empty);
+                       });
+               }
+
+               public void Stop ()
+               {
+                       if (timer == null)
+                               return;
+                       
+                       timer.Dispose ();
+                       timer = null;
+               }
+               
+               public Dispatcher Dispatcher {
+                       get {
+                               return target_dispatcher;
+                       }
+               }
+
+               public TimeSpan Interval {
+                       get {
+                               return new TimeSpan (interval);
+                       }
+
+                       set {
+                               if (interval == value.Ticks)
+                                       return;
+
+                               interval = value.Ticks;
+                               
+                               if (timer != null)
+                                       timer.Change (interval, interval);
+                       }
+               }
+
+               public bool IsEnabled {
+                       get {
+                               return timer != null;
+                       }
+
+                       set {
+                               if (value && timer == null)
+                                       Start ();
+                               if (value == false && timer != null)
+                                       Stop ();
+                       }
+               }
+
+               public object Tag {
+                       get {
+                               return tag;
+                       }
+
+                       set {
+                               tag = value;
+                       }
+               }
+               public event EventHandler Tick; 
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Threading/DispatcherUnhandledExceptionEventArgs.cs b/mcs/class/WindowsBase/System.Windows.Threading/DispatcherUnhandledExceptionEventArgs.cs
new file mode 100644 (file)
index 0000000..e02ee1a
--- /dev/null
@@ -0,0 +1,51 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Threading {
+       public sealed class DispatcherUnhandledExceptionEventArgs : DispatcherEventArgs
+       {
+               Exception exception;
+               bool handled;
+
+               internal DispatcherUnhandledExceptionEventArgs (Dispatcher dispatcher,
+                                                               Exception exception)
+                       : base (dispatcher)
+               {
+                       this.exception = exception;
+               }
+
+               public Exception Exception {
+                       get { return exception; }
+               }
+
+               public bool Handled {
+                       get { return handled; }
+                       set { handled = value; }
+               }
+
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Threading/DispatcherUnhandledExceptionEventHandler.cs b/mcs/class/WindowsBase/System.Windows.Threading/DispatcherUnhandledExceptionEventHandler.cs
new file mode 100644 (file)
index 0000000..a988a55
--- /dev/null
@@ -0,0 +1,30 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+namespace System.Windows.Threading {
+
+       public delegate void DispatcherUnhandledExceptionEventHandler (object sender,
+                                                                      DispatcherUnhandledExceptionEventArgs e);
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Threading/DispatcherUnhandledExceptionFilterEventArgs.cs b/mcs/class/WindowsBase/System.Windows.Threading/DispatcherUnhandledExceptionFilterEventArgs.cs
new file mode 100644 (file)
index 0000000..5df152f
--- /dev/null
@@ -0,0 +1,52 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Threading {
+
+       public sealed class DispatcherUnhandledExceptionFilterEventArgs : DispatcherEventArgs
+       {
+               Exception exception;
+               bool requestCatch;
+
+               internal DispatcherUnhandledExceptionFilterEventArgs (Dispatcher dispatcher,
+                                                                     Exception exception)
+                       : base (dispatcher)
+               {
+                       this.exception = exception;
+               }
+
+               public Exception Exception {
+                       get { return exception; }
+               }
+
+               public bool RequestCatch {
+                       get { return requestCatch; }
+                       set { requestCatch = value; }
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.Windows.Threading/DispatcherUnhandledExceptionFilterEventHandler.cs b/mcs/class/WindowsBase/System.Windows.Threading/DispatcherUnhandledExceptionFilterEventHandler.cs
new file mode 100644 (file)
index 0000000..e7eb723
--- /dev/null
@@ -0,0 +1,33 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows.Threading {
+
+       public delegate void DispatcherUnhandledExceptionFilterEventHandler (object sender,
+                                                                            DispatcherUnhandledExceptionFilterEventArgs e);
+
+}
diff --git a/mcs/class/WindowsBase/System.Windows/AttachedPropertyBrowsableAttribute.cs b/mcs/class/WindowsBase/System.Windows/AttachedPropertyBrowsableAttribute.cs
new file mode 100644 (file)
index 0000000..e78ac8c
--- /dev/null
@@ -0,0 +1,36 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows {
+
+       public abstract class AttachedPropertyBrowsableAttribute : Attribute
+       {
+               protected AttachedPropertyBrowsableAttribute ()
+               {
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows/AttachedPropertyBrowsableForTypeAttribute.cs b/mcs/class/WindowsBase/System.Windows/AttachedPropertyBrowsableForTypeAttribute.cs
new file mode 100644 (file)
index 0000000..d1f77f6
--- /dev/null
@@ -0,0 +1,59 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows {
+
+       [AttributeUsage (AttributeTargets.Method, AllowMultiple = true)]
+       public sealed class AttachedPropertyBrowsableForTypeAttribute : AttachedPropertyBrowsableAttribute
+       {
+               Type targetType;
+
+               public AttachedPropertyBrowsableForTypeAttribute (Type targetType)
+               {
+                       this.targetType = targetType;
+               }
+
+               public Type TargetType {
+                       get { return targetType; }
+               }
+
+               public override object TypeId {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public override bool Equals (object obj)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override int GetHashCode ()
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.Windows/AttachedPropertyBrowsableWhenAttributePresentAttribute.cs b/mcs/class/WindowsBase/System.Windows/AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
new file mode 100644 (file)
index 0000000..6796520
--- /dev/null
@@ -0,0 +1,54 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows {
+
+       [AttributeUsage (AttributeTargets.Method, AllowMultiple = false)]
+       public sealed class AttachedPropertyBrowsableWhenAttributePresentAttribute : AttachedPropertyBrowsableAttribute
+       {
+               Type attributeType;
+
+               public AttachedPropertyBrowsableWhenAttributePresentAttribute (Type attributeType)
+               {
+                       this.attributeType = attributeType;
+               }
+
+               public Type AttributeType {
+                       get { return attributeType; }
+               }
+
+               public override bool Equals (object obj)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override int GetHashCode ()
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows/CoerceValueCallback.cs b/mcs/class/WindowsBase/System.Windows/CoerceValueCallback.cs
new file mode 100644 (file)
index 0000000..33eee8c
--- /dev/null
@@ -0,0 +1,29 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+namespace System.Windows {
+
+       public delegate object CoerceValueCallback (DependencyObject d, object baseValue);
+}
diff --git a/mcs/class/WindowsBase/System.Windows/DependencyObject.cs b/mcs/class/WindowsBase/System.Windows/DependencyObject.cs
new file mode 100644 (file)
index 0000000..943e240
--- /dev/null
@@ -0,0 +1,145 @@
+//
+// DependencyObject.cs
+//
+// Author:
+//   Iain McCoy (iain@mccoy.id.au)
+//   Chris Toshok (toshok@ximian.com)
+//
+// (C) 2005 Iain McCoy
+// (C) 2007 Novell, Inc.
+//
+// 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.
+//
+
+using System.Collections.Generic;
+using System.Windows.Threading;
+
+namespace System.Windows {
+       public class DependencyObject : DispatcherObject {
+               private static Dictionary<Type,Dictionary<string,DependencyProperty>> propertyDeclarations = new Dictionary<Type,Dictionary<string,DependencyProperty>>();
+               private Dictionary<DependencyProperty,object> properties = new Dictionary<DependencyProperty,object>();
+
+               [MonoTODO]
+               public bool IsSealed {
+                       get { return false; }
+               }
+
+               public DependencyObjectType DependencyObjectType { 
+                       get { return DependencyObjectType.FromSystemType (GetType()); }
+               }
+
+               public void ClearValue(DependencyProperty dp)
+               {
+                       if (IsSealed)
+                               throw new InvalidOperationException ("Cannot manipulate property values on a sealed DependencyObject");
+
+                       properties[dp] = null;
+               }
+               
+               public void ClearValue(DependencyPropertyKey key)
+               {
+                       ClearValue (key.DependencyProperty);
+               }
+
+               public void CoerceValue (DependencyProperty dp)
+               {
+                       PropertyMetadata pm = dp.GetMetadata (this);
+                       if (pm.CoerceValueCallback != null)
+                               pm.CoerceValueCallback (this, GetValue (dp));
+               }
+
+               public sealed override bool Equals (object obj)
+               {
+                       throw new NotImplementedException("Equals");
+               }
+
+               public sealed override int GetHashCode ()
+               {
+                       throw new NotImplementedException("GetHashCode");
+               }
+
+               [MonoTODO]
+               public LocalValueEnumerator GetLocalValueEnumerator()
+               {
+                       return new LocalValueEnumerator(properties);
+               }
+               
+               public object GetValue(DependencyProperty dp)
+               {
+                       object val = properties[dp];
+                       return val == null ? dp.DefaultMetadata.DefaultValue : val;
+               }
+               
+               [MonoTODO]
+               public void InvalidateProperty(DependencyProperty dp)
+               {
+                       throw new NotImplementedException("InvalidateProperty(DependencyProperty dp)");
+               }
+               
+               protected virtual void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
+               {
+                       PropertyMetadata pm = e.Property.GetMetadata (this);
+                       if (pm.PropertyChangedCallback != null)
+                               pm.PropertyChangedCallback (this, e);
+               }
+               
+               public object ReadLocalValue(DependencyProperty dp)
+               {
+                       object val = properties[dp];
+                       return val == null ? DependencyProperty.UnsetValue : val;
+               }
+               
+               public void SetValue(DependencyProperty dp, object value)
+               {
+                       if (IsSealed)
+                               throw new InvalidOperationException ("Cannot manipulate property values on a sealed DependencyObject");
+
+                       if (!dp.IsValidType (value))
+                               throw new ArgumentException ("value not of the correct type for this DependencyProperty");
+
+                       ValidateValueCallback validate = dp.ValidateValueCallback;
+                       if (validate != null && !validate(value))
+                               throw new Exception("Value does not validate");
+                       else
+                               properties[dp] = value;
+               }
+               
+               public void SetValue(DependencyPropertyKey key, object value)
+               {
+                       SetValue (key.DependencyProperty, value);
+               }
+
+               protected virtual bool ShouldSerializeProperty (DependencyProperty dp)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               internal static void register(Type t, DependencyProperty dp)
+               {
+                       if (!propertyDeclarations.ContainsKey (t))
+                               propertyDeclarations[t] = new Dictionary<string,DependencyProperty>();
+                       Dictionary<string,DependencyProperty> typeDeclarations = propertyDeclarations[t];
+                       if (!typeDeclarations.ContainsKey(dp.Name))
+                               typeDeclarations[dp.Name] = dp;
+                       else
+                               throw new ArgumentException("A property named " + dp.Name + " already exists on " + t.Name);
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows/DependencyObjectType.cs b/mcs/class/WindowsBase/System.Windows/DependencyObjectType.cs
new file mode 100644 (file)
index 0000000..e8280d4
--- /dev/null
@@ -0,0 +1,89 @@
+// 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.
+//
+// (C) 2005 Iain McCoy
+// (C) 2007 Novell, Inc.
+//
+// Authors:
+//   Iain McCoy (iain@mccoy.id.au)
+//   Chris Toshok (toshok@ximian.com)
+//
+//
+
+using System.Collections.Generic;
+
+namespace System.Windows {
+       public class DependencyObjectType {
+
+               private static Dictionary<Type,DependencyObjectType> typeMap = new Dictionary<Type,DependencyObjectType>();
+               private static int current_id;
+
+               private int id;
+               private Type systemType;
+               
+               private DependencyObjectType (int id, Type systemType)
+               {
+                       this.id = id;
+                       this.systemType = systemType;
+               }
+
+               public DependencyObjectType BaseType { 
+                       get { return DependencyObjectType.FromSystemType (systemType.BaseType); }
+               }
+
+               public int Id { 
+                       get { return id; }
+               }
+
+               public string Name { 
+                       get { return systemType.Name; }
+               }
+
+               public Type SystemType {
+                       get { return systemType; }
+               }
+
+               public static DependencyObjectType FromSystemType(Type systemType)
+               {
+                       if (typeMap.ContainsKey (systemType))
+                               return typeMap[systemType];
+
+                       DependencyObjectType dot;
+
+                       typeMap[systemType] = dot = new DependencyObjectType (current_id++, systemType);
+
+                       return dot;
+               }
+
+               public bool IsInstanceOfType(DependencyObject d)
+               {
+                       return systemType.IsInstanceOfType (d);
+               }
+
+               public bool IsSubclassOf(DependencyObjectType dependencyObjectType)
+               {
+                       return systemType.IsSubclassOf (dependencyObjectType.SystemType);
+               }
+
+               public override int GetHashCode ()
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows/DependencyProperty.cs b/mcs/class/WindowsBase/System.Windows/DependencyProperty.cs
new file mode 100644 (file)
index 0000000..97950b3
--- /dev/null
@@ -0,0 +1,251 @@
+// 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.
+//
+// (C) 2005 Iain McCoy
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Iain McCoy (iain@mccoy.id.au)
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System.Collections.Generic;
+
+namespace System.Windows {
+       public sealed class DependencyProperty {
+               private Dictionary<Type,PropertyMetadata> metadataByType = new Dictionary<Type,PropertyMetadata>();
+               private PropertyMetadata defaultMetadata;
+               private string name;
+               private Type ownerType;
+               private Type propertyType;
+               private ValidateValueCallback validateValueCallback;
+
+               private bool isReadOnly;
+               private bool isAttached;
+               internal bool IsAttached { get { return isAttached; } }
+
+               public static readonly object UnsetValue = new object ();
+
+               private DependencyProperty (bool isAttached, string name, Type propertyType, Type ownerType,
+                                           PropertyMetadata defaultMetadata,
+                                           ValidateValueCallback validateValueCallback)
+               {
+                       this.isAttached = isAttached;
+                       this.defaultMetadata = (defaultMetadata == null ? new PropertyMetadata() : defaultMetadata);
+                       this.name = name;
+                       this.ownerType = ownerType;
+                       this.propertyType = propertyType;
+                       this.validateValueCallback = validateValueCallback;
+               }
+
+               public PropertyMetadata DefaultMetadata { 
+                       get { return defaultMetadata; }
+               }
+
+               public int GlobalIndex {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public string Name {
+                       get { return name; }
+               }
+               public Type OwnerType {
+                       get { return ownerType; }
+               }
+               public Type PropertyType {
+                       get { return propertyType; }
+               }
+
+               public bool ReadOnly {
+                       get { return isReadOnly; }
+               }
+
+               public ValidateValueCallback ValidateValueCallback {
+                       get { return validateValueCallback; }
+               }
+
+               public DependencyProperty AddOwner(Type ownerType)
+               {
+                       return AddOwner (ownerType, null);
+               }
+
+               public DependencyProperty AddOwner(Type ownerType, PropertyMetadata typeMetadata)
+               {
+                       if (typeMetadata == null) typeMetadata = new PropertyMetadata ();
+                       OverrideMetadata (ownerType, typeMetadata);
+
+                       // MS seems to always return the same DependencyProperty
+                       return this;
+               }
+               
+               public PropertyMetadata GetMetadata(Type forType)
+               {
+                       if (metadataByType.ContainsKey (forType))
+                               return metadataByType[forType];
+                       return null;
+               }
+
+               public PropertyMetadata GetMetadata(DependencyObject d)
+               {
+                       if (metadataByType.ContainsKey (d.GetType()))
+                               return metadataByType[d.GetType()];
+                       return null;
+               }
+
+               public PropertyMetadata GetMetadata(DependencyObjectType dependencyObjectType)
+               {
+                       if (metadataByType.ContainsKey (dependencyObjectType.SystemType))
+                               return metadataByType[dependencyObjectType.SystemType];
+                       return null;
+               }
+
+
+               public bool IsValidType(object value)
+               {
+                       return propertyType.IsInstanceOfType (value);
+               }
+
+               public bool IsValidValue(object value)
+               {
+                       if (!IsValidType (value))
+                               return false;
+                       if (validateValueCallback == null)
+                               return true;
+                       return validateValueCallback (value);
+               }
+               
+               public void OverrideMetadata(Type forType, PropertyMetadata typeMetadata)
+               {
+                       if (forType == null)
+                               throw new ArgumentNullException ("forType");
+                       if (typeMetadata == null)
+                               throw new ArgumentNullException ("typeMetadata");
+
+                       if (ReadOnly)
+                               throw new InvalidOperationException (String.Format ("Cannot override metadata on readonly property '{0}' without using a DependencyPropertyKey", name));
+
+                       typeMetadata.DoMerge (DefaultMetadata, this, forType);
+                       metadataByType.Add (forType, typeMetadata);
+               }
+
+               public void OverrideMetadata (Type forType, PropertyMetadata typeMetadata, DependencyPropertyKey key)
+               {
+                       if (forType == null)
+                               throw new ArgumentNullException ("forType");
+                       if (typeMetadata == null)
+                               throw new ArgumentNullException ("typeMetadata");
+
+
+                       // further checking?  should we check
+                       // key.DependencyProperty == this?
+
+                       typeMetadata.DoMerge (DefaultMetadata, this, forType);
+                       metadataByType.Add (forType, typeMetadata);
+               }
+
+               public override string ToString ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override int GetHashCode ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static DependencyProperty Register(string name, Type propertyType, Type ownerType)
+               {
+                       return Register(name, propertyType, ownerType, null, null);
+               }
+
+               public static DependencyProperty Register(string name, Type propertyType, Type ownerType,
+                                                         PropertyMetadata typeMetadata)
+               {
+                       return Register(name, propertyType, ownerType, typeMetadata, null);
+               }
+
+               public static DependencyProperty Register(string name, Type propertyType, Type ownerType,
+                                                         PropertyMetadata typeMetadata,
+                                                         ValidateValueCallback validateValueCallback)
+               {
+                       if (typeMetadata == null)
+                               typeMetadata = new PropertyMetadata();
+
+                       DependencyProperty dp = new DependencyProperty(false, name, propertyType, ownerType,
+                                                                      typeMetadata, validateValueCallback);
+                       DependencyObject.register(ownerType, dp);
+
+                       dp.OverrideMetadata (ownerType, typeMetadata);
+
+                       return dp;
+               }
+               
+               public static DependencyProperty RegisterAttached(string name, Type propertyType, Type ownerType)
+               {
+                       return RegisterAttached(name, propertyType, ownerType, null, null);
+               }
+
+               public static DependencyProperty RegisterAttached(string name, Type propertyType, Type ownerType,
+                                                                 PropertyMetadata defaultMetadata)
+               {
+                       return RegisterAttached(name, propertyType, ownerType, defaultMetadata, null);
+               }
+               
+               public static DependencyProperty RegisterAttached(string name, Type propertyType, Type ownerType,
+                                                                 PropertyMetadata defaultMetadata,
+                                                                 ValidateValueCallback validateValueCallback)
+               {
+                       DependencyProperty dp = new DependencyProperty(true, name, propertyType, ownerType,
+                                                                      defaultMetadata, validateValueCallback);
+                       DependencyObject.register(ownerType, dp);
+                       return dp;
+               }
+
+               public static DependencyPropertyKey RegisterAttachedReadOnly(string name, Type propertyType, Type ownerType,
+                                                                            PropertyMetadata defaultMetadata)
+               {
+                       throw new NotImplementedException("RegisterAttachedReadOnly(string name, Type propertyType, Type ownerType, PropertyMetadata defaultMetadata)");
+               }
+
+               public static DependencyPropertyKey RegisterAttachedReadOnly(string name, Type propertyType, Type ownerType,
+                                                                            PropertyMetadata defaultMetadata,
+                                                                            ValidateValueCallback validateValueCallback)
+               {
+                       throw new NotImplementedException("RegisterAttachedReadOnly(string name, Type propertyType, Type ownerType, PropertyMetadata defaultMetadata, ValidateValueCallback validateValueCallback)");
+               }
+
+               public static DependencyPropertyKey RegisterReadOnly(string name, Type propertyType, Type ownerType,
+                                                                    PropertyMetadata typeMetadata)
+               {
+                       return RegisterReadOnly (name, propertyType, ownerType, typeMetadata, null);
+               }
+
+
+               public static DependencyPropertyKey RegisterReadOnly(string name, Type propertyType, Type ownerType,
+                                                                    PropertyMetadata typeMetadata,
+                                                                    ValidateValueCallback validateValueCallback)
+               {
+                       DependencyProperty prop = Register (name, propertyType, ownerType, typeMetadata, validateValueCallback);
+                       prop.isReadOnly = true;
+                       return new DependencyPropertyKey (prop);
+               }
+
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows/DependencyPropertyChangedEventArgs.cs b/mcs/class/WindowsBase/System.Windows/DependencyPropertyChangedEventArgs.cs
new file mode 100644 (file)
index 0000000..89bc8dd
--- /dev/null
@@ -0,0 +1,86 @@
+//
+// DependencyPropertyChangedEventArgs.cs
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+// (C) 2007 Novell, Inc.
+//
+// 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.
+//
+
+namespace System.Windows {
+       public struct DependencyPropertyChangedEventArgs {
+
+               DependencyProperty property;
+               object oldValue;
+               object newValue;
+
+               public DependencyPropertyChangedEventArgs (DependencyProperty property, object oldValue, object newValue)
+               {
+                       this.property = property;
+                       this.oldValue = oldValue;
+                       this.newValue = newValue;
+               }
+
+               public object NewValue {
+                       get { return newValue; }
+               }
+
+               public object OldValue {
+                       get { return oldValue; }
+               }
+
+               public DependencyProperty Property {
+                       get { return property; }
+               }
+
+               public override bool Equals (object obj)
+               {
+                       if (!(obj is DependencyPropertyChangedEventArgs))
+                               return false;
+
+                       return Equals ((DependencyPropertyChangedEventArgs)obj);
+               }
+
+               public bool Equals (DependencyPropertyChangedEventArgs args)
+               {
+                       return (property == args.Property &&
+                               newValue == args.NewValue &&
+                               oldValue == args.OldValue);
+               }
+
+               public static bool operator != (DependencyPropertyChangedEventArgs left, DependencyPropertyChangedEventArgs right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static bool operator == (DependencyPropertyChangedEventArgs left, DependencyPropertyChangedEventArgs right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override int GetHashCode()
+               {
+                       throw new NotImplementedException ();
+               }
+
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows/DependencyPropertyChangedEventHandler.cs b/mcs/class/WindowsBase/System.Windows/DependencyPropertyChangedEventHandler.cs
new file mode 100644 (file)
index 0000000..7673af4
--- /dev/null
@@ -0,0 +1,31 @@
+//
+// DependencyPropertyChangedEventHandler.cs
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+// (C) 2007 Novell, Inc.
+//
+// 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.
+//
+
+namespace System.Windows {
+       public delegate void DependencyPropertyChangedEventHandler (object sender, DependencyPropertyChangedEventArgs e);
+}
diff --git a/mcs/class/WindowsBase/System.Windows/DependencyPropertyKey.cs b/mcs/class/WindowsBase/System.Windows/DependencyPropertyKey.cs
new file mode 100644 (file)
index 0000000..7f530ed
--- /dev/null
@@ -0,0 +1,46 @@
+//
+// DependencyPropertyKey.cs
+//
+// Author:
+//   Iain McCoy (iain@mccoy.id.au)
+//
+// (C) 2005 Iain McCoy
+//
+// 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.
+//
+
+namespace System.Windows {
+       public sealed class DependencyPropertyKey {
+               internal DependencyPropertyKey (DependencyProperty dependencyProperty)
+               {
+                       this.dependencyProperty = dependencyProperty;
+               }
+
+               private DependencyProperty dependencyProperty;
+               public DependencyProperty DependencyProperty {
+                       get { return dependencyProperty; }
+               }
+
+               public void OverrideMetadata(Type forType, PropertyMetadata typeMetadata)
+               {
+                       dependencyProperty.OverrideMetadata (forType, typeMetadata, this);
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows/Expression.cs b/mcs/class/WindowsBase/System.Windows/Expression.cs
new file mode 100644 (file)
index 0000000..8873c5a
--- /dev/null
@@ -0,0 +1,40 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+
+namespace System.Windows {
+
+#if notyet
+       [TypeConverter (typeof (ExpressionConverter))]
+#endif
+       public class Expression
+       {
+               internal Expression ()
+               {
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.Windows/ExpressionConverter.cs b/mcs/class/WindowsBase/System.Windows/ExpressionConverter.cs
new file mode 100644 (file)
index 0000000..480424e
--- /dev/null
@@ -0,0 +1,60 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Globalization;
+
+namespace System.Windows {
+
+       public class ExpressionConverter : TypeConverter
+       {
+               public ExpressionConverter ()
+               {
+               }
+
+               public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+}
+
diff --git a/mcs/class/WindowsBase/System.Windows/Freezable.cs b/mcs/class/WindowsBase/System.Windows/Freezable.cs
new file mode 100644 (file)
index 0000000..0369052
--- /dev/null
@@ -0,0 +1,148 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+namespace System.Windows {
+
+       public abstract class Freezable : DependencyObject {
+               protected Freezable () {
+               }
+
+               public Freezable Clone ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected virtual void CloneCore (Freezable sourceFreezable)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public new Freezable CloneCurrentValue ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected virtual void CloneCurrentValueCore (Freezable sourceFreezable)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected Freezable CreateInstance ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected abstract Freezable CreateInstanceCore ();
+
+               public void Freeze ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected static bool Freeze (Freezable freezable,
+                                             bool isChecking)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected virtual bool FreezeCore (bool isChecking)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public Freezable GetAsFrozen ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected virtual void GetAsFrozenCore (Freezable sourceFreezable)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public Freezable GetCurrentValueAsFrozen ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected virtual void GetCurrentValueAsFrozenCore (Freezable sourceFreezable)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected virtual void OnChanged ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected void OnFreezablePropertyChanged (DependencyObject oldValue,
+                                                          DependencyObject newValue)
+
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected void OnFreezablePropertyChanged (DependencyObject oldValue,
+                                                          DependencyObject newValue,
+                                                          DependencyProperty property)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void OnPropertyChanged (DependencyPropertyChangedEventArgs e)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected void ReadPreamble ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected void WritePostscript ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected void WritePreamble ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public bool CanFreeze {
+                       get { return FreezeCore (true); }
+               }
+
+               public bool IsFrozen {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public event EventHandler Changed;
+       }
+
+}
+       
diff --git a/mcs/class/WindowsBase/System.Windows/IWeakEventListener.cs b/mcs/class/WindowsBase/System.Windows/IWeakEventListener.cs
new file mode 100644 (file)
index 0000000..95c2365
--- /dev/null
@@ -0,0 +1,32 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok <toshok@novell.com>
+//
+
+using System;
+
+namespace System.Windows {
+       public interface IWeakEventListener {
+               bool ReceiveWeakEvent (Type managerType, object sender, EventArgs e);
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows/Int32Rect.cs b/mcs/class/WindowsBase/System.Windows/Int32Rect.cs
new file mode 100644 (file)
index 0000000..13ac91c
--- /dev/null
@@ -0,0 +1,138 @@
+//
+// DependencyPropertyChangedEventArgs.cs
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+// (C) 2007 Novell, Inc.
+//
+// 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.
+//
+
+using System;
+using System.ComponentModel;
+using System.Windows.Converters;
+using System.Windows.Markup;
+
+namespace System.Windows {
+
+       [Serializable]
+       [TypeConverter (typeof(Int32RectConverter))]
+       [ValueSerializer (typeof(Int32RectValueSerializer))]
+       public struct Int32Rect : IFormattable
+       {
+               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;
+               }
+
+               public static bool operator != (Int32Rect int32Rect1, Int32Rect int32Rect2)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static bool operator == (Int32Rect int32Rect1, Int32Rect int32Rect2)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static Int32Rect Empty {
+                       get { return new Int32Rect (0, 0, 0, 0); }
+               }
+
+               public int Height {
+                       get { return height; }
+                       set { height = value; }
+               }
+
+               public bool IsEmpty {
+                       get { return width == 0 && height == 0; }
+               }
+
+               public int Width {
+                       get { return width; }
+                       set { width = value; }
+               }
+
+               public int X {
+                       get { return x; }
+                       set { x = value; }
+               }
+
+               public int Y {
+                       get { return y; }
+                       set { y = value; }
+               }
+
+               public bool Equals (Int32Rect value)
+               {
+                       return (x == value.x &&
+                               y == value.y &&
+                               width == value.width &&
+                               height == value.height);
+               }
+
+               public override bool Equals (object o)
+               {
+                       if (!(o is Int32Rect))
+                               return false;
+
+                       return Equals ((Int32Rect)o);
+               }
+
+               public static bool Equals (Int32Rect int32Rect1, Int32Rect int32Rect2)
+               {
+                       return int32Rect1.Equals (int32Rect2);
+               }
+
+               public override int GetHashCode ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static Int32Rect Parse (string source)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override string ToString ()
+               {
+                       if (IsEmpty)
+                               return "Empty";
+                       return String.Format ("{0},{1},{2},{3}", x, y, width, height);
+               }
+
+               public string ToString (IFormatProvider provider)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               string IFormattable.ToString (string format, IFormatProvider provider)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
+
diff --git a/mcs/class/WindowsBase/System.Windows/Int32RectConverter.cs b/mcs/class/WindowsBase/System.Windows/Int32RectConverter.cs
new file mode 100644 (file)
index 0000000..990b385
--- /dev/null
@@ -0,0 +1,57 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok <toshok@novell.com>
+//
+
+using System;
+using System.ComponentModel;
+using System.Globalization;
+
+namespace System.Windows {
+
+       public sealed class Int32RectConverter : TypeConverter
+       {
+               public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
+               {
+                       return sourceType == typeof (string);
+               }
+
+               public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
+               {
+                       return destinationType == typeof (string);
+               }
+
+               public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
+               {
+                       if (!(value is string))
+                               throw new NotSupportedException ("Int32RectConvert only supports converting from strings");
+
+                       return Int32Rect.Parse ((string)value);
+               }
+
+               public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+               {
+                       return ((Int32Rect)value).ToString (culture);
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows/LocalValueEntry.cs b/mcs/class/WindowsBase/System.Windows/LocalValueEntry.cs
new file mode 100644 (file)
index 0000000..8ef695a
--- /dev/null
@@ -0,0 +1,68 @@
+//
+// LocalValueEntry.cs
+//
+// Author:
+//   Iain McCoy (iain@mccoy.id.au)
+//
+// (C) 2005 Iain McCoy
+//
+// 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.
+//
+
+namespace System.Windows {
+       public struct LocalValueEntry {
+               private DependencyProperty property;
+               private object value;
+
+               internal LocalValueEntry(DependencyProperty property, object value)
+               {
+                       this.property = property;
+                       this.value = value;
+               }
+               
+               public DependencyProperty Property {
+                       get { return property; }
+               }
+
+               public object Value {
+                       get { return value; }
+               }
+
+               public static bool operator != (LocalValueEntry obj1, LocalValueEntry obj2)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static bool operator == (LocalValueEntry obj1, LocalValueEntry obj2)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override bool Equals (object obj)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override int GetHashCode ()
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows/LocalValueEnumerator.cs b/mcs/class/WindowsBase/System.Windows/LocalValueEnumerator.cs
new file mode 100644 (file)
index 0000000..bbabfca
--- /dev/null
@@ -0,0 +1,88 @@
+//
+// LocalValueEnumerator.cs
+//
+// Author:
+//   Iain McCoy (iain@mccoy.id.au)
+//
+// (C) 2005 Iain McCoy
+//
+// 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.
+//
+
+
+using System.Collections;
+using System.Collections.Generic;
+
+namespace System.Windows {
+       public struct LocalValueEnumerator : IEnumerator {
+               private IDictionaryEnumerator propertyEnumerator;
+               private Dictionary<DependencyProperty,object> properties;
+
+               private int count;
+
+               internal LocalValueEnumerator(Dictionary<DependencyProperty,object> properties)
+               {
+                       this.count = properties.Count;
+                       this.properties = properties;
+                       this.propertyEnumerator = properties.GetEnumerator();
+               }
+
+               public int Count {
+                       get { return count; }
+               }
+
+               public LocalValueEntry Current {
+                       get { return new LocalValueEntry((DependencyProperty)propertyEnumerator.Key, 
+                                       propertyEnumerator.Value); }
+               }
+               object IEnumerator.Current {
+                       get { return this.Current; }
+               }
+
+               public bool MoveNext()
+               {
+                       return propertyEnumerator.MoveNext();
+               }
+               public void Reset()
+               {
+                       propertyEnumerator.Reset();
+               }
+
+               public static bool operator != (LocalValueEnumerator obj1, LocalValueEnumerator obj2)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static bool operator == (LocalValueEnumerator obj1, LocalValueEnumerator obj2)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override bool Equals (object obj)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override int GetHashCode ()
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows/Point.cs b/mcs/class/WindowsBase/System.Windows/Point.cs
new file mode 100644 (file)
index 0000000..511f201
--- /dev/null
@@ -0,0 +1,170 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@novell.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Windows.Converters;
+using System.Windows.Markup;
+using System.Windows.Media;
+
+namespace System.Windows {
+
+       [Serializable]
+       [TypeConverter (typeof (PointConverter))]
+       [ValueSerializer (typeof (PointValueSerializer))]
+       public struct Point : IFormattable
+       {
+               public Point (double x, double y)
+               {
+                       this.x = x;
+                       this.y = y;
+               }
+
+               public double X {
+                       get { return x; }
+                       set { x = value; }
+               }
+
+               public double Y {
+                       get { return y; }
+                       set { y = value; }
+               }
+
+               public override bool Equals (object o)
+               {
+                       if (!(o is Point))
+                               return false;
+                       return Equals ((Point)o);
+               }
+
+               public bool Equals (Point value)
+               {
+                       return x == value.X && y == value.Y;
+               }
+
+               public override int GetHashCode ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+
+               public void Offset (double offsetX, double offsetY)
+               {
+                       x += offsetX;
+                       y += offsetY;
+               }
+
+               public static Point Add (Point point, Vector vector)
+               {
+                       return new Point (point.X + vector.X, point.Y + vector.Y);
+               }
+
+               public static bool Equals (Point point1, Point point2)
+               {
+                       return point1.Equals (point2);
+               }
+
+               public static Point Multiply (Point point, Matrix matrix)
+               {
+                       return new Point (point.X * matrix.M11 + point.Y * matrix.M21 + matrix.OffsetX,
+                                         point.X * matrix.M12 + point.Y * matrix.M22 + matrix.OffsetY);
+               }
+
+               public static Vector Subtract (Point point1, Point point2)
+               {
+                       return new Vector (point1.X - point2.X, point1.Y - point2.Y);
+               }
+
+               public static Point Subtract (Point point, Vector vector)
+               {
+                       return new Point (point.X - vector.X, point.Y - vector.Y);
+               }
+
+               /* operators */
+
+               public static Vector operator -(Point point1, Point point2)
+               {
+                       return Subtract (point1, point2);
+               }
+
+               public static Point operator -(Point point, Vector vector)
+               {
+                       return Subtract (point, vector);
+               }
+
+               public static Point operator + (Point point, Vector vector)
+               {
+                       return Add (point, vector);
+               }
+
+               public static Point operator * (Point point, Matrix matrix)
+               {
+                       return Multiply (point, matrix);
+               }
+
+               public static bool operator != (Point point1, Point point2)
+               {
+                       return !point1.Equals(point2);
+               }
+
+               public static bool operator == (Point point1, Point point2)
+               {
+                       return point1.Equals(point2);
+               }
+
+               public static explicit operator Size (Point point)
+               {
+                       return new Size (point.X, point.Y);
+               }
+
+               public static explicit operator Vector (Point point)
+               {
+                       return new Vector (point.X, point.Y);
+               }
+
+               public static Point Parse (string source)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override string ToString ()
+               {
+                       return String.Format ("{0},{1}", x, y);
+               }
+
+               public string ToString (IFormatProvider formatProvider)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               string IFormattable.ToString (string format, IFormatProvider formatProvider)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               double x;
+               double y;
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows/PointConverter.cs b/mcs/class/WindowsBase/System.Windows/PointConverter.cs
new file mode 100644 (file)
index 0000000..7391bae
--- /dev/null
@@ -0,0 +1,57 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok <toshok@novell.com>
+//
+
+using System;
+using System.ComponentModel;
+using System.Globalization;
+
+namespace System.Windows {
+
+       public sealed class PointConverter : TypeConverter
+       {
+               public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
+               {
+                       return sourceType == typeof (string);
+               }
+
+               public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
+               {
+                       return destinationType == typeof (string);
+               }
+
+               public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
+               {
+                       if (!(value is string))
+                               throw new NotSupportedException ("RectConverter only supports converting from strings");
+
+                       return Point.Parse ((string)value);
+               }
+
+               public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+               {
+                       return ((Point)value).ToString (culture);
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows/PropertyChangedCallback.cs b/mcs/class/WindowsBase/System.Windows/PropertyChangedCallback.cs
new file mode 100644 (file)
index 0000000..dfcfee2
--- /dev/null
@@ -0,0 +1,29 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+namespace System.Windows {
+
+       public delegate void PropertyChangedCallback (DependencyObject d, DependencyPropertyChangedEventArgs e);
+}
diff --git a/mcs/class/WindowsBase/System.Windows/PropertyMetadata.cs b/mcs/class/WindowsBase/System.Windows/PropertyMetadata.cs
new file mode 100644 (file)
index 0000000..1432b0b
--- /dev/null
@@ -0,0 +1,121 @@
+// 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.
+//
+// (C) 2005 Iain McCoy
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//   Iain McCoy (iain@mccoy.id.au)
+//   Chris Toshok (toshok@ximian.com)
+//
+
+namespace System.Windows {
+       public class PropertyMetadata {
+               private object defaultValue;
+               private bool isSealed;
+               private PropertyChangedCallback propertyChangedCallback;
+               private CoerceValueCallback coerceValueCallback;
+               
+               protected bool IsSealed {
+                       get { return isSealed; }
+               }
+
+               public object DefaultValue {
+                       get { return defaultValue; }
+                       set {
+                               if (IsSealed)
+                                       throw new InvalidOperationException ("Cannot change metadata once it has been applied to a property");
+                               if (value == DependencyProperty.UnsetValue)
+                                       throw new ArgumentException ("Cannot set property metadata's default value to 'Unset'");
+
+                               defaultValue = value;
+                       }
+               }
+
+               public PropertyChangedCallback PropertyChangedCallback {
+                       get { return propertyChangedCallback; }
+                       set {
+                               if (IsSealed)
+                                       throw new InvalidOperationException ("Cannot change metadata once it has been applied to a property");
+                               propertyChangedCallback = value;
+                       }
+               }
+
+               public CoerceValueCallback CoerceValueCallback {
+                       get { return coerceValueCallback; }
+                       set {
+                               if (IsSealed)
+                                       throw new InvalidOperationException ("Cannot change metadata once it has been applied to a property");
+                               coerceValueCallback = value;
+                       }
+               }
+
+               public PropertyMetadata()
+                       : this (null, null, null)
+               {
+               }
+
+               public PropertyMetadata(object defaultValue)
+                       : this (defaultValue, null, null)
+               {
+               }
+
+               public PropertyMetadata (PropertyChangedCallback propertyChangedCallback)
+                       : this (null, propertyChangedCallback, null)
+               {
+               }
+
+               public PropertyMetadata (object defaultValue, PropertyChangedCallback propertyChangedCallback)
+                       : this (defaultValue, propertyChangedCallback, null)
+               {
+               }
+
+               public PropertyMetadata (object defaultValue, PropertyChangedCallback propertyChangedCallback, CoerceValueCallback coerceValueCallback)
+               {
+                       if (defaultValue == DependencyProperty.UnsetValue)
+                               throw new ArgumentException ("Cannot initialize property metadata's default value to 'Unset'");
+
+                       this.defaultValue = defaultValue;
+                       this.propertyChangedCallback = propertyChangedCallback;
+                       this.coerceValueCallback = coerceValueCallback;
+               }
+               
+               protected virtual void Merge (PropertyMetadata baseMetadata, DependencyProperty dp)
+               {
+                       if (defaultValue == null)
+                               defaultValue = baseMetadata.defaultValue;
+                       if (propertyChangedCallback == null)
+                               propertyChangedCallback = baseMetadata.propertyChangedCallback;
+                       if (coerceValueCallback == null)
+                               coerceValueCallback = baseMetadata.coerceValueCallback;
+               }
+               
+               protected virtual void OnApply (DependencyProperty dp, Type targetType)
+               {
+               }
+
+               internal void DoMerge (PropertyMetadata baseMetadata, DependencyProperty dp, Type targetType)
+               {
+                       Merge (baseMetadata, dp);
+                       OnApply (dp, targetType);
+                       isSealed = true;
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows/Rect.cs b/mcs/class/WindowsBase/System.Windows/Rect.cs
new file mode 100644 (file)
index 0000000..fb8d41d
--- /dev/null
@@ -0,0 +1,441 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok <toshok@novell.com>
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+
+using System;
+using System.ComponentModel;
+using System.Windows.Converters;
+using System.Windows.Markup;
+using System.Windows.Media;
+
+namespace System.Windows {
+
+       [Serializable]
+       [ValueSerializer (typeof (RectValueSerializer))]
+       [TypeConverter (typeof (RectConverter))]
+       public struct Rect : IFormattable
+       {
+               public Rect (Size size)
+               {
+                       x = y = 0.0;
+                       width = size.Width;
+                       height = size.Height;
+               }
+
+               public Rect (Point point, Vector vector) : this (point, Point.Add (point, vector))
+               { }
+
+               public Rect (Point point1, Point point2)
+               {
+                       if (point1.X < point2.X) {
+                               x = point1.X;
+                               width = point2.X - point1.X;
+                       }
+                       else {
+                               x = point2.X;
+                               width = point1.X - point2.X;
+                       }
+
+                       if (point1.Y < point2.Y) {
+                               y = point1.Y;
+                               height = point2.Y - point1.Y;
+                       }
+                       else {
+                               y = point2.Y;
+                               height = point1.Y - point2.Y;
+                       }
+               }
+
+               public Rect (double x, double y, double width, double height)
+               {
+                       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;
+               }
+
+               public Rect (Point location, Size size)
+               {
+                       x = location.X;
+                       y = location.Y;
+                       width = size.Width;
+                       height = size.Height;
+               }
+
+               public bool Equals (Rect rect)
+               {
+                       return (x == rect.X &&
+                               y == rect.Y &&
+                               width == rect.Width &&
+                               height == rect.Height);
+               }
+
+               public static bool operator != (Rect rect1, Rect rect2)
+               {
+                       return !(rect1.Location == rect2.Location && rect1.Size == rect2.Size);
+               }
+
+               public static bool operator == (Rect rect1, Rect rect2)
+               {
+                       return rect1.Location == rect2.Location && rect1.Size == rect2.Size;
+               }
+
+               public override bool Equals (object o)
+               {
+                       if (!(o is Rect))
+                               return false;
+
+                       return Equals ((Rect)o);
+               }
+
+               public static bool Equals (Rect rect1, Rect rect2)
+               {
+                       return rect1.Equals (rect2);
+               }
+
+               public override int GetHashCode ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public bool Contains (Rect rect)
+               {
+                       if (rect.Left < this.Left ||
+                           rect.Right > this.Right)
+                               return false;
+
+                       if (rect.Top < this.Top ||
+                           rect.Bottom > this.Bottom)
+                               return false;
+
+                       return true;
+               }
+
+               public bool Contains (double x, double y)
+               {
+                       if (x < Left || x > Right)
+                               return false;
+                       if (y < Top || y > Bottom)
+                               return false;
+
+                       return true;
+               }
+
+               public bool Contains (Point p)
+               {
+                       return Contains (p.X, p.Y);
+               }
+
+               public static Rect Inflate (Rect rect, double width, double height)
+               {
+                       if (width < rect.Width * -2)
+                               return Rect.Empty;
+                       if (height < rect.Height * -2)
+                               return Rect.Empty;
+
+                       Rect result = rect;
+                       result.Inflate (width, height);
+                       return result;
+               }
+
+               public static Rect Inflate (Rect rect, Size size)
+               {
+                       return Rect.Inflate (rect, size.Width, size.Height);
+               }
+
+               public void Inflate (double width, double height)
+               {
+                       // XXX any error checking like in the static case?
+                       x -= width;
+                       y -= height;
+
+                       this.width += 2*width;
+                       this.height += 2*height;
+               }
+
+               public void Inflate (Size size)
+               {
+                       Inflate (size.Width, size.Height);
+               }
+
+               public bool IntersectsWith(Rect rect)
+               {
+                       return !((Left >= rect.Right) || (Right <= rect.Left) ||
+                           (Top >= rect.Bottom) || (Bottom <= rect.Top));
+               }
+
+               public void Intersect(Rect rect)
+               {
+                       double _x = Math.Max (x, rect.x);
+                       double _y = Math.Max (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;
+                       }
+                       else {
+                               x = _x;
+                               y = _y;
+                               width = _width;
+                               height = _height;
+                       }
+               }
+
+               public static Rect Intersect(Rect rect1, Rect rect2)
+               {
+                       Rect result = rect1;
+                       result.Intersect (rect2);
+                       return result;
+               }
+
+               public void Offset(double offsetX, double offsetY)
+               {
+                       x += offsetX;
+                       y += offsetY;
+               }
+
+               public static Rect Offset(Rect rect, double offsetX, double offsetY)
+               {
+                       Rect result = rect;
+                       result.Offset (offsetX, offsetY);
+                       return result;
+               }
+
+               public void Offset (Vector offsetVector)
+               {
+                       x += offsetVector.X;
+                       y += offsetVector.Y;
+               }
+
+               public static Rect Offset (Rect rect, Vector offsetVector)
+               {
+                       Rect result = rect;
+                       result.Offset (offsetVector);
+                       return result;
+               }
+
+               public void Scale(double scaleX, double scaleY)
+               {
+                       x *= scaleX;
+                       y *= scaleY;
+                       width *= scaleX;
+                       height *= scaleY;
+               }
+
+               public void Transform (Matrix matrix)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static Rect Transform (Rect rect, Matrix matrix)
+               {
+                       Rect result = rect;
+                       result.Transform (matrix);
+                       return result;
+               }
+
+               public static Rect Union(Rect rect1, Rect rect2)
+               {
+                       Rect result = rect1;
+                       result.Union (rect2);
+                       return result;
+               }
+
+               public static Rect Union(Rect rect, Point point)
+               {
+                       Rect result = rect;
+                       result.Union (point);
+                       return result;
+               }
+               
+               public void Union(Rect rect)
+               {
+                       x = Math.Min (x, rect.x);
+                       y = Math.Min (y, rect.y);
+                       width = Math.Max (Right, rect.Right) - x;
+                       height = Math.Max (Bottom, rect.Bottom) - y;
+               }
+
+               public void Union(Point point)
+               {
+                       Union (new Rect (point, point));
+               }
+
+               public static Rect Parse (string source)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override string ToString ()
+               {
+                       if (IsEmpty)
+                               return "Empty";
+
+                       return String.Format ("{0},{1},{2},{3}",
+                                             x, y, width, height);
+               }
+
+               public string ToString (IFormatProvider provider)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               string IFormattable.ToString (string format, IFormatProvider provider)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static Rect Empty { 
+                       get {
+                               Rect r = new Rect ();
+                               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);
+                       }
+               }
+               
+               public Point Location { 
+                       get {
+                               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;
+                       }
+               }
+               
+               public Size Size { 
+                       get { 
+                               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;
+                       }
+               }
+
+               public double X {
+                       get { return x; }
+                       set {
+                               if (IsEmpty)
+                                       throw new InvalidOperationException ("Cannot modify this property on the Empty Rect.");
+
+                               x = value;
+                       }
+               }
+
+               public double Y {
+                       get { return y; }
+                       set {
+                               if (IsEmpty)
+                                       throw new InvalidOperationException ("Cannot modify this property on the Empty Rect.");
+
+                               y = value;
+                       }
+               }
+
+               public double Width {
+                       get { return width; }
+                       set {
+                               if (IsEmpty)
+                                       throw new InvalidOperationException ("Cannot modify this property on the Empty Rect.");
+
+                               if (value < 0)
+                                       throw new ArgumentException ("width must be non-negative.");
+
+                               width = value;
+                       }
+               }
+
+               public double Height {
+                       get { return height; }
+                       set {
+                               if (IsEmpty)
+                                       throw new InvalidOperationException ("Cannot modify this property on the Empty Rect.");
+
+                               if (value < 0)
+                                       throw new ArgumentException ("height must be non-negative.");
+
+                               height = value;
+                       }
+               }
+
+               public double Left { 
+                       get { return x; }
+               }
+
+               public double Top { 
+                       get { return y; }
+               }
+               
+               public double Right { 
+                       get { return x + width; }
+               }
+               
+               public double Bottom { 
+                       get { return y + height; }
+               }
+               
+               public Point TopLeft { 
+                       get { return new Point (Left, Top); }
+               }
+               
+               public Point TopRight { 
+                       get { return new Point (Right, Top); }
+               }
+               
+               public Point BottomLeft { 
+                       get { return new Point (Left, Bottom); }
+               }
+
+               public Point BottomRight { 
+                       get { return new Point (Right, Bottom); }
+               }
+               
+               double x;
+               double y;
+               double width;
+               double height;
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows/RectConverter.cs b/mcs/class/WindowsBase/System.Windows/RectConverter.cs
new file mode 100644 (file)
index 0000000..07fe262
--- /dev/null
@@ -0,0 +1,57 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok <toshok@novell.com>
+//
+
+using System;
+using System.ComponentModel;
+using System.Globalization;
+
+namespace System.Windows {
+
+       public sealed class RectConverter : TypeConverter
+       {
+               public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
+               {
+                       return sourceType == typeof (string);
+               }
+
+               public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
+               {
+                       return destinationType == typeof (string);
+               }
+
+               public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
+               {
+                       if (!(value is string))
+                               throw new NotSupportedException ("RectConverter only supports converting from strings");
+
+                       return Rect.Parse ((string)value);
+               }
+
+               public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+               {
+                       return ((Rect)value).ToString (culture);
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows/Size.cs b/mcs/class/WindowsBase/System.Windows/Size.cs
new file mode 100644 (file)
index 0000000..d5345f5
--- /dev/null
@@ -0,0 +1,157 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@novell.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Windows.Converters;
+using System.Windows.Markup;
+
+namespace System.Windows {
+
+       [Serializable]
+       [ValueSerializer (typeof (SizeValueSerializer))]
+       [TypeConverter (typeof (SizeConverter))]
+       public struct Size : IFormattable
+       {
+               public Size (double width, double height)
+               {
+                       if (width < 0 || height < 0)
+                               throw new ArgumentException ("Width and Height must be non-negative.");
+
+                       this.width = width;
+                       this.height = height;
+               }
+
+               public bool Equals (Size value)
+               {
+                       return width == value.Width && height == value.Height;
+               }
+               
+               public override bool Equals (object o)
+               {
+                       if (!(o is Size))
+                               return false;
+
+                       return Equals ((Size)o);
+               }
+
+               public static bool Equals (Size size1, Size size2)
+               {
+                       return size1.Equals (size2);
+               }
+
+               public override int GetHashCode ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static Size Parse (string source)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override string ToString ()
+               {
+                       if (IsEmpty)
+                               return "Empty";
+                       return String.Format ("{0},{1}", width, height);
+               }
+
+               public string ToString (IFormatProvider formatProvider)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               string IFormattable.ToString (string format, IFormatProvider provider)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public bool IsEmpty {
+                       get {
+                               return (width == Double.NegativeInfinity &&
+                                       height == Double.NegativeInfinity);
+                       }
+               }
+
+               public double Height {
+                       get { return height; }
+                       set {
+                               if (IsEmpty)
+                                       throw new InvalidOperationException ("Cannot modify this property on the Empty Size.");
+
+                               if (value < 0)
+                                       throw new ArgumentException ("height must be non-negative.");
+
+                               height = value;
+                       }
+               }
+
+               public double Width {
+                       get { return width; }
+                       set {
+                               if (IsEmpty)
+                                       throw new InvalidOperationException ("Cannot modify this property on the Empty Size.");
+
+                               if (value < 0)
+                                       throw new ArgumentException ("width must be non-negative.");
+
+                               width = value;
+                       }
+               }
+
+               public static Size Empty {
+                       get {
+                               Size s = new Size ();
+                               s.width = s.height = Double.NegativeInfinity;
+                               return s;
+                       }
+               }
+
+               /* operators */
+               public static explicit operator Point (Size size)
+               {
+                       return new Point (size.Width, size.Height);
+               }
+
+               public static explicit operator Vector (Size size)
+               {
+                       return new Vector (size.Width, size.Height);
+               }
+
+               public static bool operator ==(Size size1, Size size2)
+               {
+                       return size1.Equals (size2);
+               }
+
+               public static bool operator !=(Size size1, Size size2)
+               {
+                       return !size1.Equals (size2);
+               }
+
+               double width;
+               double height;
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows/SizeConverter.cs b/mcs/class/WindowsBase/System.Windows/SizeConverter.cs
new file mode 100644 (file)
index 0000000..59a2c0d
--- /dev/null
@@ -0,0 +1,57 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok <toshok@novell.com>
+//
+
+using System;
+using System.ComponentModel;
+using System.Globalization;
+
+namespace System.Windows {
+
+       public sealed class SizeConverter : TypeConverter
+       {
+               public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
+               {
+                       return sourceType == typeof (string);
+               }
+
+               public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
+               {
+                       return destinationType == typeof (string);
+               }
+
+               public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
+               {
+                       if (!(value is string))
+                               throw new NotSupportedException ("SizeConverter only supports converting from strings");
+
+                       return Size.Parse ((string)value);
+               }
+
+               public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+               {
+                       return ((Size)value).ToString (culture);
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows/ValidateValueCallback.cs b/mcs/class/WindowsBase/System.Windows/ValidateValueCallback.cs
new file mode 100644 (file)
index 0000000..30be3df
--- /dev/null
@@ -0,0 +1,29 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+namespace System.Windows {
+
+       public delegate bool ValidateValueCallback (object value);
+}
diff --git a/mcs/class/WindowsBase/System.Windows/Vector.cs b/mcs/class/WindowsBase/System.Windows/Vector.cs
new file mode 100644 (file)
index 0000000..606f38b
--- /dev/null
@@ -0,0 +1,255 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@novell.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Windows.Converters;
+using System.Windows.Markup;
+using System.Windows.Media;
+
+namespace System.Windows {
+
+       [Serializable]
+       [ValueSerializer (typeof (VectorValueSerializer))]
+       [TypeConverter (typeof (VectorConverter))]
+       public struct Vector : IFormattable
+       {
+               public Vector (double x, double y)
+               {
+                       this.x = x;
+                       this.y = y;
+               }
+
+               public bool Equals (Vector value)
+               {
+                       return x == value.X && y == value.Y;
+               }
+
+               public override bool Equals (object o)
+               {
+                       if (!(o is Vector))
+                               return false;
+
+                       return Equals ((Vector)o);
+               }
+
+               public override int GetHashCode ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               string IFormattable.ToString(string format, IFormatProvider formatProvider) {
+                       throw new NotImplementedException ();
+               }
+
+               public static bool Equals (Vector vector1, Vector vector2)
+               {
+                       return vector1.Equals (vector2);
+               }
+
+               public static Point Add (Vector vector, Point point)
+               {
+                       return new Point (vector.X + point.X, vector.Y + point.Y);
+               }
+
+               public static Vector Add (Vector vector1, Vector vector2)
+               {
+                       return new Vector (vector1.X + vector2.X,
+                                          vector1.Y + vector2.Y);
+               }
+
+               public static double AngleBetween (Vector vector1, Vector vector2)
+               {
+                       double cos_theta = (vector1.X * vector2.X + vector1.Y * vector2.Y) / (vector1.Length * vector2.Length);
+
+                       return Math.Acos (cos_theta) / Math.PI * 180;
+               }
+
+               public static double CrossProduct (Vector vector1, Vector vector2)
+               {
+                       // ... what operation is this exactly?
+                       return vector1.X * vector2.Y - vector1.Y * vector2.X;
+               }
+
+               public static double Determinant (Vector vector1, Vector vector2)
+               {
+                       // same as CrossProduct, it appears.
+                       return vector1.X * vector2.Y - vector1.Y * vector2.X;
+               }
+
+               public static Vector Divide (Vector vector, double scalar)
+               {
+                       return new Vector (vector.X / scalar, vector.Y / scalar);
+               }
+
+               public static double Multiply (Vector vector1, Vector vector2)
+               {
+                       return vector1.X * vector2.X + vector1.Y * vector2.Y;
+               }
+
+               public static Vector Multiply (Vector vector, Matrix matrix)
+               {
+                       return new Vector (vector.X * matrix.M11 + vector.Y * matrix.M21,
+                                          vector.X * matrix.M12 + vector.Y * matrix.M22);
+               }
+
+               public static Vector Multiply (double scalar, Vector vector)
+               {
+                       return new Vector (scalar * vector.X, scalar * vector.Y);
+               }
+
+               public static Vector Multiply (Vector vector, double scalar)
+               {
+                       return new Vector (scalar * vector.X, scalar * vector.Y);
+               }
+
+               public void Negate ()
+               {
+                       x = -x;
+                       y = -y;
+               }
+
+               public void Normalize ()
+               {
+                       double ls = LengthSquared;
+                       if (ls == 1)
+                               return;
+
+                       double l = Math.Sqrt (ls);
+                       x /= l;
+                       y /= l;
+               }
+
+               public static Vector Subtract (Vector vector1, Vector vector2)
+               {
+                       return new Vector (vector1.X - vector2.X, vector1.Y - vector2.Y);
+               }
+
+               public static Vector Parse (string source)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override string ToString ()
+               {
+                       return String.Format ("{0},{1}", x, y);
+               }
+
+               public string ToString (IFormatProvider provider)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public double Length {
+                       get { return Math.Sqrt (LengthSquared); }
+               }
+
+               public double LengthSquared {
+                       get { return x * x + y * y; }
+               }
+
+               public double X {
+                       get { return x; }
+                       set { x = value; }
+               }
+
+               public double Y {
+                       get { return y; }
+                       set { y = value; }
+               }
+
+               /* operators */
+               public static explicit operator Point (Vector vector)
+               {
+                       return new Point (vector.X, vector.Y);
+               }
+
+               public static explicit operator Size (Vector vector)
+               {
+                       return new Size (vector.X, vector.Y);
+               }
+
+               public static Vector operator - (Vector vector1, Vector vector2)
+               {
+                       return Subtract (vector1, vector2);
+               }
+
+               public static Vector operator - (Vector vector)
+               {
+                       Vector result = vector;
+                       result.Negate ();
+                       return result;
+               }
+
+               public static bool operator != (Vector vector1, Vector vector2)
+               {
+                       return !Equals (vector1, vector2);
+               }
+
+               public static bool operator == (Vector vector1, Vector vector2)
+               {
+                       return Equals (vector1, vector2);
+               }
+
+               public static double operator * (Vector vector1, Vector vector2)
+               {
+                       return Multiply (vector1, vector2);
+               }
+
+               public static Vector operator * (Vector vector, Matrix matrix)
+               {
+                       return Multiply (vector, matrix);
+               }
+
+               public static Vector operator * (double scalar, Vector vector)
+               {
+                       return Multiply (scalar, vector);
+               }
+
+               public static Vector operator * (Vector vector, double scalar)
+               {
+                       return Multiply (vector, scalar);
+               }
+
+               public static Vector operator / (Vector vector, double scalar)
+               {
+                       return Divide (vector, scalar);
+               }
+
+               public static Point operator + (Vector vector, Point point)
+               {
+                       return Add (vector, point);
+               }
+
+               public static Vector operator + (Vector vector1, Vector vector2)
+               {
+                       return Add (vector1, vector2);
+               }
+
+               double x;
+               double y;
+       }
+
+}
diff --git a/mcs/class/WindowsBase/System.Windows/VectorConverter.cs b/mcs/class/WindowsBase/System.Windows/VectorConverter.cs
new file mode 100644 (file)
index 0000000..69823c1
--- /dev/null
@@ -0,0 +1,57 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok <toshok@novell.com>
+//
+
+using System;
+using System.ComponentModel;
+using System.Globalization;
+
+namespace System.Windows {
+
+       public sealed class VectorConverter : TypeConverter
+       {
+               public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
+               {
+                       return sourceType == typeof (string);
+               }
+
+               public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
+               {
+                       return destinationType == typeof (string);
+               }
+
+               public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
+               {
+                       if (!(value is string))
+                               throw new NotSupportedException ("VectorConverter only supports converting from strings");
+
+                       return Vector.Parse ((string)value);
+               }
+
+               public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+               {
+                       return ((Vector)value).ToString (culture);
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/System.Windows/WeakEventManager.cs b/mcs/class/WindowsBase/System.Windows/WeakEventManager.cs
new file mode 100644 (file)
index 0000000..1660457
--- /dev/null
@@ -0,0 +1,168 @@
+//
+// WeakEventManager.cs
+//
+// Author:
+//   Chris Toshok (toshok@ximian.com)
+//
+// (C) 2007 Novell, Inc.
+//
+// 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.
+//
+
+using System.Windows.Threading;
+
+namespace System.Windows {
+
+       public abstract class WeakEventManager : DispatcherObject
+       {
+               protected WeakEventManager ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected IDisposable ReadLock {
+                       get { throw new NotImplementedException (); }
+               }
+
+               protected IDisposable WriteLock {
+                       get { throw new NotImplementedException (); }
+               }
+
+               protected object this [object source] {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
+
+               protected void DeliverEvent (object sender, EventArgs args)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected void DeliverEventToList (object sender, EventArgs args, WeakEventManager.ListenerList list)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected void ProtectedAddListener (object source, IWeakEventListener listener)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected void ProtectedRemoveListener (object source, IWeakEventListener listener)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected virtual bool Purge (object source, object data, bool purgeAll)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected void Remove (object source)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected void ScheduleCleanup ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected abstract void StartListening (object source);
+               protected abstract void StopListening (object source);
+
+
+               protected static WeakEventManager GetCurrentManager (Type managerType)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected static void SetCurrentManager (Type managerType, WeakEventManager manager)
+               {
+                       throw new NotImplementedException ();
+               }
+
+
+               protected class ListenerList
+               {
+                       public ListenerList ()
+                       {
+                               throw new NotImplementedException ();
+                       }
+
+                       public ListenerList (int capacity)
+                       {
+                               throw new NotImplementedException ();
+                       }
+
+                       public int Count {
+                               get { throw new NotImplementedException (); }
+                       }
+
+                       public static WeakEventManager.ListenerList Empty {
+                               get { throw new NotImplementedException (); }
+                       }
+
+                       public bool IsEmpty {
+                               get { throw new NotImplementedException (); }
+                       }
+
+                       public IWeakEventListener this[int index] {
+                               get { throw new NotImplementedException (); }
+                       }
+
+                       public void Add (IWeakEventListener listener)
+                       {
+                               throw new NotImplementedException ();
+                       }
+
+                       private void BeginUse ()
+                       {
+                               throw new NotImplementedException ();
+                       }
+
+                       public WeakEventManager.ListenerList Clone ()
+                       {
+                               throw new NotImplementedException ();
+                       }
+
+                       public void EndUse ()
+                       {
+                               throw new NotImplementedException ();
+                       }
+
+                       public static bool PrepareForWriting (ref WeakEventManager.ListenerList list)
+                       {
+                               throw new NotImplementedException ();
+                       }
+
+                       public bool Purge ()
+                       {
+                               throw new NotImplementedException ();
+                       }
+
+                       public void Remove (IWeakEventListener listener)
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/Test/System.Collections.ObjectModel/ObservableCollectionTest.cs b/mcs/class/WindowsBase/Test/System.Collections.ObjectModel/ObservableCollectionTest.cs
new file mode 100644 (file)
index 0000000..149f0d3
--- /dev/null
@@ -0,0 +1,97 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Collections.ObjectModel;
+using System.Collections.Specialized;
+using NUnit.Framework;
+
+namespace MonoTests.System.Collections.ObjectModel {
+
+       [TestFixture]
+       [Category ("NotWorking")]
+       public class ObservableCollectionTest {
+               [Test]
+               public void InsertItem ()
+               {
+                       bool reached = false;
+                       ObservableCollection<int> col = new ObservableCollection<int>();
+                       col.CollectionChanged += delegate (object sender, NotifyCollectionChangedEventArgs e) {
+                               reached = true;
+                               Assert.AreEqual (NotifyCollectionChangedAction.Add, e.Action);
+                               Assert.AreEqual (0, e.NewStartingIndex);
+                               Assert.AreEqual (-1, e.OldStartingIndex);
+                               Assert.AreEqual (1, e.NewItems.Count);
+                               Assert.AreEqual (5, (int)e.NewItems[0]);
+                               Assert.AreEqual (null, e.OldItems);
+                       };
+                       col.Insert (0, 5);
+                       Assert.IsTrue (reached);
+               }
+
+               [Test]
+               public void Remove ()
+               {
+                       bool reached = false;
+                       ObservableCollection<int> col = new ObservableCollection<int>();
+                       col.Insert (0, 5);
+                       col.CollectionChanged += delegate (object sender, NotifyCollectionChangedEventArgs e) {
+                               reached = true;
+                               Assert.AreEqual (NotifyCollectionChangedAction.Remove, e.Action);
+                               Assert.AreEqual (-1, e.NewStartingIndex);
+                               Assert.AreEqual (0, e.OldStartingIndex);
+                               Assert.AreEqual (null, e.NewItems);
+                               Assert.AreEqual (1, e.OldItems.Count);
+                               Assert.AreEqual (5, (int)e.OldItems[0]);
+                       };
+                       col.RemoveAt (0);
+                       Assert.IsTrue (reached, "reached");
+               }
+
+               [Test]
+               public void Move ()
+               {
+                       bool reached = false;
+                       ObservableCollection<int> col = new ObservableCollection<int>();
+                       col.Insert (0, 0);
+                       col.Insert (1, 1);
+                       col.Insert (2, 2);
+                       col.Insert (3, 3);
+                       col.CollectionChanged += delegate (object sender, NotifyCollectionChangedEventArgs e) {
+                               reached = true;
+                               Assert.AreEqual (NotifyCollectionChangedAction.Move, e.Action, "1");
+                               Assert.AreEqual (3, e.NewStartingIndex, "2");
+                               Assert.AreEqual (1, e.OldStartingIndex, "3");
+                               Assert.AreEqual (1, e.NewItems.Count, "4");
+                               Assert.AreEqual (1, e.NewItems[0], "5");
+                               Assert.AreEqual (1, e.OldItems.Count, "6");
+                               Assert.AreEqual (1, e.OldItems[0], "7");
+                       };
+                       col.Move (1, 3);
+                       Assert.IsTrue (reached, "8");
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/Test/System.IO.Packaging/FakePackage.cs b/mcs/class/WindowsBase/Test/System.IO.Packaging/FakePackage.cs
new file mode 100644 (file)
index 0000000..9ed70c7
--- /dev/null
@@ -0,0 +1,76 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Alan McGovern (amcgovern@novell.com)
+//
+
+
+using System;
+using System.Collections.Generic;
+
+namespace System.IO.Packaging.Tests {
+       
+    public class FakePackage : Package {
+        Dictionary<Uri, PackagePart> Parts { get; set; }
+        public List<Uri> CreatedParts { get; private set; }
+        public List<Uri> DeletedParts { get; private set; }
+
+        public FakePackage (FileAccess access, bool streaming)
+            : base (access, streaming)
+        {
+            CreatedParts = new List<Uri> ();
+            DeletedParts = new List<Uri> ();
+            Parts = new Dictionary<Uri, PackagePart> ();
+        }
+
+        protected override PackagePart CreatePartCore (Uri partUri, string contentType, CompressionOption compressionOption)
+        {
+            FakePackagePart p = new FakePackagePart (this, partUri, contentType, compressionOption);
+            Parts.Add (p.Uri, p);
+            CreatedParts.Add (partUri);
+            return p;
+        }
+
+        protected override void DeletePartCore (Uri partUri)
+        {
+            DeletedParts.Add (partUri);
+            Parts.Remove (partUri);
+        }
+
+        protected override void FlushCore ()
+        {
+            throw new NotImplementedException ();
+        }
+        
+        protected override PackagePart GetPartCore (Uri partUri)
+        {
+            return Parts.ContainsKey(partUri) ?  Parts [partUri] : null;
+        }
+
+        protected override PackagePart [] GetPartsCore ()
+        {
+            PackagePart [] p = new PackagePart [Parts.Count];
+            Parts.Values.CopyTo (p, 0);
+            return p;
+        }
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/Test/System.IO.Packaging/FakePackagePart.cs b/mcs/class/WindowsBase/Test/System.IO.Packaging/FakePackagePart.cs
new file mode 100644 (file)
index 0000000..9a7871c
--- /dev/null
@@ -0,0 +1,67 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Alan McGovern (amcgovern@novell.com)
+//
+
+using System;
+using System.Collections.Generic;
+
+namespace System.IO.Packaging.Tests {
+    
+    class FakePackagePart : PackagePart {
+
+        public List<FileAccess> Accesses { get; private set; }
+        public List<FileMode> Modes { get; private set; }
+
+        public FakePackagePart (Package package, Uri partUri)
+            : base (package, partUri)
+        {
+            Init ();
+        }
+
+        public FakePackagePart (Package package, Uri partUri, string contentType)
+            : base(package, partUri, contentType)
+        {
+            Init ();
+        }
+
+        public FakePackagePart (Package package, Uri partUri, string contentType, CompressionOption compressionOption)
+            : base (package, partUri, contentType, compressionOption)
+        {
+            Init ();
+        }
+
+        private void Init ()
+        {
+            Accesses = new List<FileAccess> ();
+            Modes = new List<FileMode> ();
+        }
+
+        protected override Stream GetStreamCore (FileMode mode, FileAccess access)
+        {
+            Accesses.Add (access);
+            Modes.Add (mode);
+            return new MemoryStream ();
+        }
+    }
+}
diff --git a/mcs/class/WindowsBase/Test/System.IO.Packaging/FakePackagePartTests.cs b/mcs/class/WindowsBase/Test/System.IO.Packaging/FakePackagePartTests.cs
new file mode 100644 (file)
index 0000000..23a08c3
--- /dev/null
@@ -0,0 +1,236 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//    Alan McGovern (amcgovern@novell.com)
+//
+
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using NUnit.Framework;
+
+namespace System.IO.Packaging.Tests {
+
+    [TestFixture]
+    public class FakePackagePartTests : TestBase {
+
+        static void Main (string [] args)
+        {
+            FakePackagePartTests t = new FakePackagePartTests ();
+            t.FixtureSetup ();
+            t.Setup ();
+            t.GetStream2 ();
+        }
+
+        FakePackagePart part;
+        public override void Setup ()
+        {
+            base.Setup ();
+            part = (FakePackagePart) new FakePackagePart(package, uris [0], contentType);
+        }
+
+        [Test]
+        [ExpectedException (typeof (ArgumentNullException))]
+        public void Constructor1 ()
+        {
+            FakePackagePart p = new FakePackagePart (null, null);
+        }
+
+        [Test]
+        [ExpectedException (typeof (ArgumentNullException))]
+        public void Constructor2 ()
+        {
+            FakePackagePart p = new FakePackagePart (package, null);
+        }
+
+        [Test]
+        [ExpectedException (typeof (ArgumentNullException))]
+        public void Constructor3 ()
+        {
+            FakePackagePart p = new FakePackagePart (null, uris [0]);
+        }
+
+        [Test]
+        public void Constructor4 ()
+        {
+            new FakePackagePart (package, uris [0], null);
+        }
+
+        [Test]
+        public void Constructor5 ()
+        {
+            new FakePackagePart (package, uris [0], "");
+        }
+
+        [Test]
+        [ExpectedException (typeof (ArgumentException))]
+        public void Constructor6 ()
+        {
+            new FakePackagePart (package, uris [0], "dgsdgdfgd");
+        }
+
+        [Test]
+        [ExpectedException (typeof (ArgumentNullException))]
+        public void CreateRelationship1 ()
+        {
+            part.CreateRelationship (null, TargetMode.External, null);
+        }
+
+        [Test]
+        [ExpectedException (typeof (ArgumentNullException))]
+        public void CreateRelationship2 ()
+        {
+            part.CreateRelationship (uris [1], TargetMode.External, null);
+        }
+
+        [Test]
+        [ExpectedException (typeof (ArgumentException))]
+        public void CreateRelationship3a ()
+        {
+            part.CreateRelationship (uris [1], TargetMode.External, "");
+        }
+
+        [Test]
+        [ExpectedException (typeof (ArgumentException))]
+        public void CreateRelationship3b ()
+        {
+            part.CreateRelationship (uris [1], TargetMode.External, "    ");
+        }
+
+        [Test]
+        public void CreateRelationship4 ()
+        {
+            part.CreateRelationship (uris [1], TargetMode.External, "blah");
+        }
+
+
+        [Test]
+        public void CreateRelationship5 ()
+        {
+            PackageRelationship r = part.CreateRelationship (uris [1], TargetMode.External, "blah", null);
+            Assert.IsNotNull (r.Id, "#1");
+            Assert.AreEqual (part.Uri, r.SourceUri, "#2");
+            Assert.AreEqual (uris [1], r.TargetUri, "#3");
+        }
+
+        [Test]
+        [ExpectedException (typeof (ArgumentNullException))]
+        public void CreateRelationship6 ()
+        {
+            part.CreateRelationship (uris [1], TargetMode.External, "blah", "");
+        }
+
+        [Test]
+        public void CreateRelationship7 ()
+        {
+            part.CreateRelationship (uris [1], TargetMode.External, "blah", "asda");
+        }
+
+        [Test]
+        [ExpectedException (typeof (Xml.XmlException))]
+        public void CreateDupeRelationship ()
+        {
+            part.CreateRelationship (uris [1], TargetMode.External, "blah", "asda");
+            part.CreateRelationship (uris [1], TargetMode.External, "blah", "asda");
+        }
+
+        [Test]
+        [ExpectedException (typeof (Xml.XmlException))]
+        public void CreateDupeRelationshipId ()
+        {
+            part.CreateRelationship (uris [1], TargetMode.External, "blah", "asda");
+            part.CreateRelationship (uris [2], TargetMode.Internal, "aaa", "asda");
+        }
+
+        [Test]
+        public void EnumeratePartsBreak ()
+        {
+            FakePackage package = new FakePackage (FileAccess.ReadWrite, false);
+
+            package.CreatePart (uris [0], "a/a");
+            package.CreatePart (uris [1], "a/a");
+            package.CreatePart (uris [2], "a/a");
+
+            Assert.IsTrue (package.GetParts () == package.GetParts (), "#1");
+            try {
+                foreach (PackagePart part in package.GetParts ())
+                    package.DeletePart (part.Uri);
+                Assert.Fail ("This should throw an exception");
+            } catch {
+            }
+
+            PackagePartCollection c = package.GetParts ();
+            package.CreatePart (new Uri ("/dfds", UriKind.Relative), "a/a");
+            int count = 0;
+            foreach (PackagePart p in c) { count++; }
+            Assert.AreEqual (3, count, "Three added, one deleted, one added");
+        }
+
+        [Test]
+        public void GetStream1 ()
+        {
+            part.GetStream ();
+            Assert.AreEqual (FileMode.OpenOrCreate, part.Modes [0], "#1");
+            Assert.AreEqual (package.FileOpenAccess, part.Accesses [0], "#2");
+        }
+
+        [Test]
+        [ExpectedException(typeof(NotSupportedException))]
+        public void PackagePartNoContentType ()
+        {
+            string s = new FakePackagePart (package, uris [0]).ContentType;
+        }
+
+        [Test]
+        public void GetStream2 ()
+        {
+            Assert.IsNotNull (package.CreatePart (uris[1], contentType));
+            Assert.AreEqual (1, new List<PackagePart> (package.GetParts()).Count, "#0a");
+            package.Flush ();
+                       package.Close ();
+
+            using (Package p = Package.Open (new MemoryStream (stream.ToArray ()))) {
+                               PackagePart part = new List<PackagePart>(p.GetParts ())[0];
+                Stream s = part.GetStream ();
+                Assert.IsTrue (s.CanRead, "#1");
+                Assert.IsTrue (s.CanSeek, "#2");
+                Assert.IsFalse (s.CanWrite, "#3");
+            }
+                       
+            using (Package p = Package.Open (new MemoryStream (stream.ToArray ()), FileMode.OpenOrCreate)) {
+                PackagePart part = new List<PackagePart> (p.GetParts ()) [0];
+                Stream s = part.GetStream ();
+                Assert.IsTrue (s.CanRead, "#4");
+                Assert.IsTrue (s.CanSeek, "#5");
+                Assert.IsTrue (s.CanWrite, "#6");
+            }
+
+            using (Package p = Package.Open (new MemoryStream (stream.ToArray ()), FileMode.OpenOrCreate, FileAccess.ReadWrite)) {
+                PackagePart part = new List<PackagePart> (p.GetParts ()) [0];
+                Stream s = part.GetStream ();
+                Assert.IsTrue (s.CanRead, "#7");
+                Assert.IsTrue (s.CanSeek, "#8");
+                Assert.IsTrue (s.CanWrite, "#9");
+            }
+        }
+    }
+}
diff --git a/mcs/class/WindowsBase/Test/System.IO.Packaging/FakePackageTests.cs b/mcs/class/WindowsBase/Test/System.IO.Packaging/FakePackageTests.cs
new file mode 100644 (file)
index 0000000..0cccd40
--- /dev/null
@@ -0,0 +1,126 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Alan McGovern (amcgovern@novell.com)
+//
+
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using NUnit.Framework;
+
+namespace System.IO.Packaging.Tests {
+
+    [TestFixture]
+    public class FakePackageTests : TestBase {
+
+        //static void Main (string [] args)
+        //{
+        //    FakePackageTests t = new FakePackageTests ();
+        //    t.FixtureSetup ();
+        //    t.Setup ();
+        //    t.RelationshipPartGetStream ();
+        //}
+        
+        private new FakePackage package;
+        public override void Setup ()
+        {
+            package = new FakePackage (FileAccess.ReadWrite, true);
+        }
+
+        [Test]
+        public void CheckAutomaticParts ()
+        {
+            package.CreatePart (uris [0], contentType);
+            Assert.AreEqual (1, package.CreatedParts.Count (), "#1");
+            Assert.AreEqual (uris [0], package.CreatedParts [0], "#2");
+            Assert.AreEqual (0, package.DeletedParts.Count (), "#3");
+            Assert.AreEqual (1, package.GetParts ().Count (), "#4");
+        }
+
+        [Test]
+        public void CheckAutomaticParts2 ()
+        {
+            package.CreateRelationship (uris [0], TargetMode.External, "relationship");
+            Assert.AreEqual (1, package.CreatedParts.Count (), "#1");
+            Assert.AreEqual (relationshipUri, package.CreatedParts [0], "#2");
+            Assert.AreEqual (0, package.DeletedParts.Count (), "#3");
+            Assert.AreEqual (1, package.GetParts ().Count (), "#4");
+
+            PackagePart p = package.GetPart (relationshipUri);
+            Assert.AreEqual (package, p.Package, "#5");
+            Assert.AreEqual (CompressionOption.NotCompressed, p.CompressionOption, "#6");
+            Assert.AreEqual ("application/vnd.openxmlformats-package.relationships+xml", p.ContentType, "#7");
+        }
+
+        [Test]
+        public void RelationshipPartGetRelationships ()
+        {
+            CheckAutomaticParts2 ();
+            PackagePart p = package.GetPart (relationshipUri);
+
+            try {
+                p.CreateRelationship (uris[0], TargetMode.Internal, "asdas");
+                Assert.Fail ("This should fail 1");
+            } catch (InvalidOperationException) {
+
+            }
+
+            try {
+                p.DeleteRelationship("aa");
+                Assert.Fail ("This should fail 2");
+            } catch (InvalidOperationException) {
+
+            }
+
+            try {
+                p.GetRelationship ("id");
+                Assert.Fail ("This should fail 3");
+            } catch (InvalidOperationException) {
+
+            }
+
+            try {
+                p.GetRelationships ();
+                Assert.Fail ("This should fail 4");
+            } catch (InvalidOperationException) {
+
+            }
+
+            try {
+                p.GetRelationshipsByType ("type");
+                Assert.Fail ("This should fail 5");
+            } catch (InvalidOperationException) {
+
+            }
+            
+            try {
+                p.RelationshipExists ("id");
+                Assert.Fail ("This should fail 6");
+            } catch (InvalidOperationException) {
+                
+            }
+        }
+    }
+}
diff --git a/mcs/class/WindowsBase/Test/System.IO.Packaging/FakeStream.cs b/mcs/class/WindowsBase/Test/System.IO.Packaging/FakeStream.cs
new file mode 100644 (file)
index 0000000..b095375
--- /dev/null
@@ -0,0 +1,62 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Alan McGovern (amcgovern@novell.com)
+//
+
+
+using System;
+using System.Collections.Generic;
+
+namespace System.IO.Packaging.Tests {
+
+    public class FakeStream : MemoryStream {
+        public bool canRead;
+        public bool canSeek;
+        public bool canWrite;
+
+        public FakeStream ()
+            : this (true, true, true)
+        {
+
+        }
+
+        public FakeStream (bool canread, bool canWrite, bool canSeek)
+        {
+            this.canRead = canread;
+            this.canSeek = canSeek;
+            this.canWrite = canWrite;
+        }
+
+        public override bool CanRead {
+            get { return canRead; }
+        }
+
+        public override bool CanSeek {
+            get { return canSeek; }
+        }
+
+        public override bool CanWrite {
+            get { return canWrite; }
+        }
+    }
+}
diff --git a/mcs/class/WindowsBase/Test/System.IO.Packaging/PackUriHelperTests.cs b/mcs/class/WindowsBase/Test/System.IO.Packaging/PackUriHelperTests.cs
new file mode 100644 (file)
index 0000000..d42f5c8
--- /dev/null
@@ -0,0 +1,282 @@
+// PackUriHelperTests.cs created with MonoDevelop
+// User: alan at 13:39 28/10/2008
+//
+// To change standard headers go to Edit->Preferences->Coding->Standard Headers
+//
+
+using System;
+using System.IO.Packaging;
+using NUnit.Framework;
+
+namespace WindowsBase {
+       
+    [TestFixture]
+    [Category ("NotWorking")]
+    [Ignore ("This depends on a fix to System.Uri to support the UriParser API")]
+    public class PackUriHelperTests {
+        static void Main (string [] args)
+        {
+            PackUriHelperTests t = new PackUriHelperTests ();
+            t.ResolvePartUri2 ();
+        }
+
+
+        Uri a;
+        Uri b;
+        Uri part1 = new Uri ("/file1", UriKind.Relative);
+        Uri part2 = new Uri ("/file2", UriKind.Relative);
+        Uri main = new Uri ("/main.html", UriKind.Relative);
+
+               [SetUpAttribute]
+               public void Setup()
+               {
+                       a = PackUriHelper.Create (new Uri ("http://www.test.com/pack1.pkg"));
+                       b = PackUriHelper.Create (new Uri ("http://www.test.com/pack2.pkg"));
+                       Console.WriteLine ("A is: {0}", a);
+                       Console.WriteLine("B is: {0}", b);
+               }
+               
+        [Test]
+        public void ComparePackUriTest ()
+        {
+            Assert.AreEqual (0, PackUriHelper.ComparePackUri (null, null), "#1");
+            Assert.IsTrue (PackUriHelper.ComparePackUri (a, null) > 0, "#2");
+            Assert.AreEqual (0, PackUriHelper.ComparePackUri (a, a), "#3");
+            Assert.IsTrue (PackUriHelper.ComparePackUri (a, b) < 0, "#4");
+        }
+
+        [Test]
+        [ExpectedException(typeof(UriFormatException))]
+        public void CompareInvalidTest ()
+        {
+            Uri a = new Uri ("pack://url1");
+            PackUriHelper.ComparePackUri (a, a);
+        }
+
+        [Test]
+        [ExpectedException (typeof (ArgumentException))]
+        public void NonPackUriCompareTest ()
+        {
+            PackUriHelper.ComparePackUri (new Uri ("http://wtest.com"), a);
+        }
+
+        [Test]
+        [ExpectedException (typeof (ArgumentException))]
+        public void NonPackUriCompareRelativeTest ()
+        {
+            PackUriHelper.ComparePackUri (new Uri ("wtest.com", UriKind.Relative), a);
+        }
+
+        [Test]
+        [ExpectedException (typeof (ArgumentException))]
+        public void InvalidPartUriCompareTest ()
+        {
+            PackUriHelper.ComparePartUri (a, b);
+        }
+
+        [Test]
+        public void PartUriCompareTest ()
+        {
+            Assert.AreEqual (0, PackUriHelper.ComparePartUri (null, null), "#1");
+            Assert.IsTrue (PackUriHelper.ComparePartUri (part1, null) > 0, "#2");
+            Assert.IsTrue (PackUriHelper.ComparePartUri (part1, part2) < 0, "#3");
+        }
+
+        [Test]
+        public void CreateTest ()
+        {
+            Assert.AreEqual ("pack://http:,,www.test.com,pack.pkg",
+                             PackUriHelper.Create (new Uri ("http://www.test.com/pack.pkg")).ToString (), "#1");
+            Assert.AreEqual ("pack://http:,,www.test.com,pack.pkg",
+                             PackUriHelper.Create (new Uri ("http://www.test.com/pack.pkg"), null, null).ToString (), "#2");
+            Assert.AreEqual ("pack://http:,,www.test.com,pack.pkg/main.html#frag",
+                             PackUriHelper.Create (new Uri ("http://www.test.com/pack.pkg"),
+                                                              new Uri ("/main.html", UriKind.Relative), "#frag").ToString (), "#3");
+            Assert.AreEqual ("pack://http:,,www.test.com,pack.pkg/main.html#frag",
+                             PackUriHelper.Create (new Uri ("http://www.test.com/pack.pkg"),
+                                                              new Uri ("/main.html", UriKind.Relative), "#frag").ToString (), "#3");
+        }
+
+        [Test]
+        [ExpectedException (typeof (ArgumentException))]
+        public void CreateInvalidTest ()
+        {
+            PackUriHelper.Create (new Uri ("http://www.test.com/pack.pkg"), new Uri ("/main.html", UriKind.Relative), "notfrag");
+        }
+
+        [Test]
+        [ExpectedException (typeof (ArgumentException))]
+        public void CreateInvalidTest2 ()
+        {
+            PackUriHelper.Create (new Uri ("http://www.test.com/pack.pkg"), new Uri ("/main.html", UriKind.Relative), "");
+        }
+
+        [Test]
+        [ExpectedException (typeof (ArgumentException))]
+        public void CreateInvalidTest3 ()
+        {
+            PackUriHelper.Create (new Uri ("http://www.test.com/pack.pkg"), new Uri ("/main.html", UriKind.Relative), "");
+        }
+
+        [Test]
+        public void CreateInvalidTest4 ()
+        {
+            PackUriHelper.Create (new Uri ("http://www.test.com/pack.pkg"), new Uri ("/main.html", UriKind.Relative));
+        }
+
+        [Test]
+        public void CreatePartUri ()
+        {
+            Assert.IsFalse (PackUriHelper.CreatePartUri (part1).IsAbsoluteUri, "#1");
+            Assert.AreEqual (new Uri (part1.ToString (), UriKind.Relative), PackUriHelper.CreatePartUri (part1), "#2");
+        }
+
+        [Test]
+        [ExpectedException (typeof (ArgumentNullException))]
+        public void CreatePartUri2 ()
+        {
+            PackUriHelper.CreatePartUri (null);
+        }
+
+        [Test]
+        public void GetNormalizedPartUriTest ()
+        {
+            Uri uri = new Uri ("/test.com".ToUpperInvariant (), UriKind.Relative);
+            Assert.IsTrue (uri == PackUriHelper.GetNormalizedPartUri (uri));
+        }
+        [Test]
+        public void GetNormalisedPartUritest4 ()
+        {
+            PackUriHelper.GetNormalizedPartUri (part1);
+        }
+
+        [Test]
+        [ExpectedException (typeof (ArgumentNullException))]
+        public void GetNormalizedPartUriTest2 ()
+        {
+            PackUriHelper.GetNormalizedPartUri (null);
+        }
+
+        [Test]
+        [ExpectedException (typeof (UriFormatException))]
+        public void GetNormalizedPartUriTest3 ()
+        {
+            Assert.AreEqual (new Uri (a.ToString ().ToUpperInvariant (), UriKind.Relative), PackUriHelper.GetNormalizedPartUri (a));
+        }
+
+        [Test]
+        public void GetPackageUriTest ()
+        {
+            Assert.AreEqual (a, PackUriHelper.GetPackageUri (PackUriHelper.Create (a, new Uri ("/test.html", UriKind.Relative))));
+        }
+
+        [Test]
+        [ExpectedException (typeof (ArgumentNullException))]
+        public void GetPackageUri2 ()
+        {
+            PackUriHelper.GetPackageUri (null);
+        }
+
+        [Test]
+        [ExpectedException (typeof (ArgumentException))]
+        public void GetPackageUri3 ()
+        {
+            PackUriHelper.GetPackageUri (part1);
+        }
+
+        [Test]
+        public void GetPartUriTest ()
+        {
+            Assert.IsNull (PackUriHelper.GetPartUri (a), "#1");
+            Assert.AreEqual (main, PackUriHelper.GetPartUri (PackUriHelper.Create (a, main)), "#2");
+        }
+
+        [Test]
+        [ExpectedException (typeof (ArgumentNullException))]
+        public void GetPartUriTest2 ()
+        {
+            PackUriHelper.GetPartUri (null);
+        }
+
+        [Test]
+        [ExpectedException (typeof (ArgumentException))]
+        public void GetPartUriTest3 ()
+        {
+            PackUriHelper.GetPartUri (part1);
+        }
+
+        [Test]
+        public void GetRelationshipPartUriTest ()
+        {
+            Assert.AreEqual ("/_rels/file1.rels", PackUriHelper.GetRelationshipPartUri (part1).ToString());
+        }
+
+        [Test]
+        [ExpectedException (typeof (ArgumentNullException))]
+        public void GetRelationshipPartUriTest2 ()
+        {
+            PackUriHelper.GetRelationshipPartUri (null);
+        }
+
+        [Test]
+        public void GetRelativeUriTest ()
+        {
+            Uri src = new Uri ("/1/2/3/file.jpg", UriKind.Relative);
+            Uri dest = new Uri ("/file2.png", UriKind.Relative);
+            Assert.AreEqual (new Uri ("../../../file2.png", UriKind.Relative), PackUriHelper.GetRelativeUri (src, dest), "#1");
+
+            dest = new Uri ("/1/2", UriKind.Relative);
+            Assert.AreEqual (new Uri ("../../2", UriKind.Relative), PackUriHelper.GetRelativeUri (src, dest), "#2");
+
+            dest = new Uri ("/1/2/", UriKind.Relative);
+            Assert.AreEqual (new Uri ("", UriKind.Relative), PackUriHelper.GetRelativeUri (src, src), "#4");
+        }
+
+        [Test]
+        [ExpectedException (typeof(ArgumentException))]
+        public void GetRelativeUriTest2 ()
+        {
+            Uri src = new Uri ("/1/2/3/file.jpg", UriKind.Relative);
+            Uri dest = new Uri ("/1/2/", UriKind.Relative);
+            Assert.AreEqual (new Uri ("../file2.png", UriKind.Relative), PackUriHelper.GetRelativeUri (src, dest), "#3");
+        }
+
+        [Test]
+        public void IsRelationshipPartUriTest ()
+        {
+            Assert.IsFalse (PackUriHelper.IsRelationshipPartUri (new Uri ("/_rels/Whatever", UriKind.Relative)));
+            Assert.IsTrue (PackUriHelper.IsRelationshipPartUri (new Uri ("/_rels/Whatever.rels", UriKind.Relative)));
+        }
+
+        [Test]
+        public void IsRelationshipPartUriTest2 ()
+        {
+            Uri uri = new Uri ("/test/uri", UriKind.Relative);
+            PackUriHelper.IsRelationshipPartUri (uri);
+        }
+
+        [Test]
+        [ExpectedException(typeof(UriFormatException))]
+        public void ResolvePartUri ()
+        {
+            Uri src = new Uri ("/1/2/3/4", UriKind.Relative);
+            Uri dest = new Uri ("/MyFile", UriKind.Relative);
+
+            // Can't be empty url
+            Assert.AreEqual (new Uri (""), PackUriHelper.ResolvePartUri (src, dest), "#1");
+        }
+
+
+        [Test]
+        [ExpectedException (typeof (UriFormatException))]
+        public void ResolvePartUri2 ()
+        {
+            Uri src = new Uri ("/1/2/3/4", UriKind.Relative);
+            Uri dest = new Uri ("/1/2/MyFile", UriKind.Relative);
+
+            // Can't be empty url
+            Assert.AreEqual (new Uri ("/1/2/MyFile", UriKind.Relative), PackUriHelper.ResolvePartUri (src, dest), "#1");
+            Assert.AreEqual (new Uri ("/1/2/3/4", UriKind.Relative), PackUriHelper.ResolvePartUri (dest, src), "#1");
+        }
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/Test/System.IO.Packaging/PackagePartStreamTests.cs b/mcs/class/WindowsBase/Test/System.IO.Packaging/PackagePartStreamTests.cs
new file mode 100644 (file)
index 0000000..04ae134
--- /dev/null
@@ -0,0 +1,193 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Alan McGovern (amcgovern@novell.com)
+//
+
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using NUnit.Framework;
+
+namespace System.IO.Packaging.Tests {
+    
+    [TestFixture]
+    public class PackagePartStreamTests : TestBase {
+
+        byte [] buffer;
+        List<PackagePart> Parts = new List<PackagePart> ();
+        static void Main (string [] args)
+        {
+            PackagePartStreamTests t = new PackagePartStreamTests ();
+            t.FixtureSetup ();
+            t.Setup ();
+            t.CheckFlushTest ();
+        }
+
+        public override void FixtureSetup ()
+        {
+            base.FixtureSetup ();
+
+            Random r = new Random ();
+            buffer = new byte [1000];
+            r.NextBytes (buffer);
+        }
+
+        public override void Setup ()
+        {
+            base.Setup ();
+
+            Parts.Clear ();
+            foreach (Uri u in uris)
+                Parts.Add (package.CreatePart (u, "mime/type"));
+        }
+
+        [Test]
+        public void SameStreamTest ()
+        {
+            Assert.AreEqual (0, stream.Length, "#a");
+            package.Flush ();
+            Assert.IsTrue (stream.Length > 0, "#b");
+
+            Stream s1 = Parts [0].GetStream ();
+            Stream s2 = Parts [0].GetStream ();
+            Assert.IsFalse (s1 == s2, "#1");
+            s1.WriteByte (5);
+            Assert.AreEqual (1, s1.Position, "#2");
+            Assert.AreEqual (0, s2.Position, "#3");
+            Assert.AreEqual (s1.Length, s2.Length, "#4");
+            Assert.AreEqual (5, s2.ReadByte (), "#5");
+            s2.SetLength (0);
+            Assert.AreEqual (0, s1.Length);
+        }
+
+        [Test]
+        public void NoFlushTest ()
+        {
+            Parts [0].GetStream ().Write (buffer, 0, buffer.Length);
+            Assert.AreEqual (0, stream.Length);
+        }
+
+        [Test]
+        public void FlushIndividualTest ()
+        {
+            Parts [0].GetStream ().Write (buffer, 0, buffer.Length);
+            Parts [0].GetStream ().Flush ();
+            Assert.AreEqual (buffer.Length, Parts [0].GetStream ().Length, "#1");
+            Assert.IsTrue (stream.Length > buffer.Length, "#2");
+        }
+
+        [Test]
+        [Category ("NotWorking")]
+        [Ignore ("This test only works on MS.NET. Behaviour probably not easily replicatable")]
+        public void FlushPackageTest1 ()
+        {
+            FlushIndividualTest ();
+
+            long count = stream.Length;
+            package.Flush ();
+            Assert.IsTrue (stream.Length > count, "#1");
+        }
+
+        [Test]
+        [Category ("NotWorking")]
+        [Ignore ("This test is useless i believe")]
+        public void FlushOnlyPackage ()
+        {
+            NoFlushTest ();
+            package.Flush ();
+            long count = stream.Length;
+            TearDown ();
+            Setup ();
+           // FlushPackageTest1 ();
+            Assert.AreEqual (count, stream.Length, "#1");
+        }
+
+        [Test]
+        public void GetMultipleStreams ()
+        {
+            foreach (PackagePart p in Parts) {
+                p.GetStream ().Write (buffer, 0, buffer.Length);
+                p.GetStream ().Flush ();
+                Stream ssss = p.GetStream ();
+                bool equal = p.GetStream () == p.GetStream ();
+                stream.Flush ();
+            }
+            long position = stream.Length;
+        }
+
+        [Test]
+        public void FlushThenTruncate ()
+        {
+            Parts [0].GetStream ().Write (buffer, 0, buffer.Length);
+            package.Flush ();
+            Assert.IsTrue (stream.Length > buffer.Length, "#1");
+            
+            Parts [0].GetStream ().SetLength (0);
+            package.Flush ();
+            Assert.IsTrue (stream.Length < buffer.Length, "#2");
+
+            long length = stream.Length;
+            foreach (PackagePart p in package.GetParts ().ToArray ())
+                package.DeletePart (p.Uri);
+            package.Flush ();
+
+            Assert.IsTrue (stream.Length < length, "#3");
+        }
+
+        [Test]
+//        [Category ("NotWorking")]
+        public void CheckFlushTest ()
+        {
+            buffer = new byte [1024 * 1024];
+            Assert.AreEqual (0, stream.Length, "#1");
+            Parts [0].GetStream ().Write (buffer, 0, buffer.Length);
+            Assert.AreEqual (0, stream.Length, "#2");
+            Assert.AreEqual (Parts[0].GetStream ().Length, buffer.Length, "#2b");
+            Parts [1].GetStream ().Write (buffer, 0, buffer.Length);
+            Assert.AreEqual (0, stream.Length, "#3");
+            Assert.AreEqual (Parts[1].GetStream ().Length, buffer.Length, "#3b");
+            Parts [0].GetStream ().Flush ();
+            Assert.IsTrue (stream.Length > buffer.Length * 2, "#4");
+            long count = stream.Length;
+            package.Flush ();
+
+            // FIXME: On MS.NET this works. I don't think it's worth replicating
+            //Assert.IsTrue (count < stream.Length, "#5");
+        }
+
+        [Test]
+        public void CheckFlushTest2 ()
+        {
+            buffer = new byte [1024 * 1024];
+            Assert.AreEqual (0, stream.Length, "#1");
+            Parts [0].GetStream ().Write (buffer, 0, buffer.Length);
+            Assert.AreEqual (0, stream.Length, "#2");
+            Parts [1].GetStream ().Write (buffer, 0, buffer.Length);
+            Assert.AreEqual (0, stream.Length, "#3");
+            package.Flush ();
+            Assert.IsTrue (stream.Length > buffer.Length * 2, "#4");
+        }
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/Test/System.IO.Packaging/PackagePartTest.cs b/mcs/class/WindowsBase/Test/System.IO.Packaging/PackagePartTest.cs
new file mode 100644 (file)
index 0000000..0af4ce5
--- /dev/null
@@ -0,0 +1,275 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//    Alan McGovern (amcgovern@novell.com)
+//
+
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using NUnit.Framework;
+using System.Xml;
+
+namespace System.IO.Packaging.Tests {
+
+    [TestFixture]
+    public class PackagePartTest : TestBase {
+
+        //static void Main (string [] args)
+        //{
+        //    PackagePartTest t = new PackagePartTest ();
+        //    t.FixtureSetup ();
+        //    t.Setup ();
+
+        //    t.AddThreeParts ();
+        //}
+        [Test]
+        [ExpectedException (typeof (ArgumentException))]
+        public void AddAbsoluteUri ()
+        {
+            package.CreatePart (new Uri ("file://lo/asd.asm", UriKind.Absolute), "aa/aa");
+        }
+
+        [Test]
+        [Category ("NotWorking")]
+        [Ignore ("This is a bug in the MS implementation. I don't think i can/should replicate it")]
+        public void AddInvalidPartTwice ()
+        {
+            try {
+                package.CreatePart (new Uri ("/file1.bmp", UriKind.Relative), "bmp");
+            } catch (ArgumentException) {
+                try {
+                    package.CreatePart (new Uri ("/file1.bmp", UriKind.Relative), "bmp");
+                } catch (InvalidOperationException) {
+                    Assert.AreEqual (1, package.GetParts ().Count (), "Need to be buggy and return null");
+                    Assert.AreEqual (null, package.GetParts ().ToArray () [0], "Be buggy and add null to the internal list");
+
+                    return; // Success
+                }
+            }
+
+            Assert.Fail ("Should have thrown an ArgumentException then InvalidOperationException");
+        }
+
+        [Test]
+        public void AddThreeParts ()
+        {
+            foreach (Uri u in uris)
+                package.CreatePart (u, "mime/type");
+
+            Assert.AreEqual (3, package.GetParts ().Count (), "Should be three parts");
+            PackagePartCollection c1 = package.GetParts ();
+            package.CreatePart (new Uri ("/asdasdas", UriKind.Relative), "asa/s");
+            PackagePartCollection c2 = package.GetParts ();
+            bool eq = c1 == c2;
+                       Assert.IsNotNull (package.GetPart (new Uri (uris[0].ToString ().ToUpper (), UriKind.Relative)));
+        }
+
+        [Test]
+        public void CheckPartProperties ()
+        {
+            AddThreeParts ();
+            PackagePart part = package.GetPart (uris [0]);
+            Assert.AreEqual (CompressionOption.NotCompressed, part.CompressionOption, "Compress option wrong");
+            Assert.AreEqual ("mime/type", part.ContentType, "Content type wrong");
+            Assert.AreEqual (package, part.Package, "Wrong package");
+            Assert.AreEqual (uris [0], part.Uri, "Wrong package selected");
+        }
+
+        [Test]
+        public void CheckPartRelationships ()
+        {
+            AddThreeParts ();
+            Assert.AreEqual (4, package.GetParts ().Count (), "#a");
+            PackagePart part = package.GetPart (uris [0]);
+            PackageRelationship r1 = part.CreateRelationship (part.Uri, TargetMode.Internal, "self");
+            PackageRelationship r2 = package.CreateRelationship (part.Uri, TargetMode.Internal, "fake");
+            PackageRelationship r3 = package.CreateRelationship (new Uri ("/fake/uri", UriKind.Relative), TargetMode.Internal, "self");
+
+            Assert.AreEqual (6, package.GetParts ().Count (), "#b");
+            Assert.AreEqual (1, part.GetRelationships ().Count (), "#1");
+            Assert.AreEqual (1, part.GetRelationshipsByType ("self").Count (), "#2");
+            Assert.AreEqual (r1, part.GetRelationship (r1.Id), "#3");
+            Assert.AreEqual (2, package.GetRelationships ().Count (), "#4");
+            Assert.AreEqual (1, package.GetRelationshipsByType ("self").Count (), "#5");
+            Assert.AreEqual (r3, package.GetRelationship (r3.Id), "#6");
+
+            Assert.AreEqual (6, package.GetParts ().Count (), "#c");
+            Assert.AreEqual (part.Uri, r1.SourceUri, "#7");
+            Assert.AreEqual (new Uri ("/", UriKind.Relative), r3.SourceUri, "#8");
+
+            PackageRelationship r4 = part.CreateRelationship (uris [2], TargetMode.Internal, "other");
+            Assert.AreEqual (part.Uri, r4.SourceUri);
+
+            PackageRelationshipCollection relations = package.GetPart (uris [2]).GetRelationships ();
+            Assert.AreEqual (0, relations.Count ());
+            Assert.AreEqual (6, package.GetParts ().Count (), "#d");
+        }
+
+               [Test]
+        public void CheckIndividualRelationships ()
+        {
+            PackagePart part = package.CreatePart (uris [0], contentType);
+            part.CreateRelationship (uris [1], TargetMode.Internal, "relType");
+            part.CreateRelationship (uris [2], TargetMode.External, "relType");
+
+            package.Flush ();
+            Assert.AreEqual (2, package.GetParts ().Count(), "#1");
+            part = package.GetPart (new Uri ("/_rels" + uris [0].ToString () + ".rels", UriKind.Relative));
+            Assert.IsNotNull (part);
+        }
+
+        [Test]
+        [ExpectedException (typeof (InvalidOperationException))]
+        public void DeletePartsAfterAddingRelationships ()
+        {
+            CheckPartRelationships ();
+            foreach (PackagePart p in new List<PackagePart> (package.GetParts ()))
+                package.DeletePart (p.Uri);
+        }
+
+        [Test]
+        [ExpectedException (typeof (InvalidOperationException))]
+        public void DeleteRelsThenParts ()
+        {
+            CheckPartRelationships ();
+            foreach (PackageRelationship r in new List<PackageRelationship> (package.GetRelationships ()))
+                package.DeleteRelationship (r.Id);
+            foreach (PackagePart p in new List<PackagePart> (package.GetParts ()))
+                package.DeletePart (p.Uri);
+        }
+
+        [Test]
+        public void CreateValidPart ()
+        {
+            PackagePart part = package.CreatePart (uris [0], "img/bmp");
+        }
+
+        [Test]
+        [ExpectedException (typeof (InvalidOperationException))]
+        public void CreateDuplicatePart ()
+        {
+            CreateValidPart ();
+            CreateValidPart ();
+        }
+
+        [Test]
+        public void CreateValidPartTwice ()
+        {
+            CreateValidPart ();
+            package.DeletePart (uris [0]);
+            CreateValidPart ();
+
+            Assert.AreEqual (1, package.GetParts ().Count (), "#1");
+            Assert.AreEqual (uris [0], package.GetParts ().ToArray () [0].Uri, "#2");
+            package.DeletePart (uris [0]);
+            package.DeletePart (uris [0]);
+            package.DeletePart (uris [0]);
+        }
+
+        [Test]
+        public void IterateParts ()
+        {
+            List<PackagePart> parts = new List<PackagePart> ();
+            parts.Add (package.CreatePart (new Uri ("/a", UriKind.Relative), "mime/type"));
+            parts.Add (package.CreatePart (new Uri ("/b", UriKind.Relative), "mime/type"));
+            List<PackagePart> found = new List<PackagePart> (package.GetParts ());
+            Assert.AreEqual (parts.Count, found.Count, "Invalid number of parts");
+            Assert.IsTrue (found.Contains (parts [0]), "Doesn't contain first part");
+            Assert.IsTrue (found.Contains (parts [1]), "Doesn't contain second part");
+
+            Assert.IsTrue (found [0] == parts [0] || found [0] == parts [1], "Same object reference should be used");
+            Assert.IsTrue (found [1] == parts [0] || found [1] == parts [1], "Same object reference should be used");
+        }
+
+        [Test]
+        [ExpectedException (typeof (ArgumentException))]
+        public void NoStartingSlashPartialUri ()
+        {
+            PackagePart part = package.CreatePart (new Uri ("file1.bmp", UriKind.Relative), "bmp");
+        }
+
+        [Test]
+        public void PartExists ()
+        {
+            CreateValidPart ();
+            Assert.IsNotNull (package.GetPart (uris [0]), "Part could not be found");
+            Assert.IsTrue (package.PartExists (uris [0]), "Part didn't exist");
+            Assert.AreEqual (1, package.GetParts ().Count (), "Only one part");
+        }
+
+        [Test]
+        public void RemoveThreeParts ()
+        {
+            AddThreeParts ();
+            foreach (PackagePart p in new List<PackagePart> (package.GetParts ()))
+                package.DeletePart (p.Uri);
+            Assert.AreEqual (0, package.GetParts ().Count (), "Should contain no parts");
+        }
+
+        [Test]
+        [ExpectedException (typeof (InvalidOperationException))]
+        public void RemoveThreePartsBreak ()
+        {
+            AddThreeParts ();
+            foreach (PackagePart p in package.GetParts ())
+                package.DeletePart (p.Uri);
+        }
+
+        [Test]
+        [Category ("NotWorking")]
+        [Ignore ("Content_Type is never added as a part - need to test this indirectly")]
+        public void CheckContentTypes ()
+        {
+            Uri contentUri = new Uri ("/[Content_Types].xml", UriKind.Relative);
+            string contentNamespace = "http://schemas.openxmlformats.org/package/2006/content-types";
+            AddThreeParts ();
+
+            // FIXME: This isn't actually created as a PackagePart
+            Assert.IsTrue (package.PartExists (contentUri), "#0");
+            XmlDocument doc = new XmlDocument ();
+            XmlNamespaceManager manager = new XmlNamespaceManager (doc.NameTable);
+            manager.AddNamespace ("content", contentNamespace);
+            doc.Load (package.GetPart (contentUri).GetStream ());
+
+            Assert.IsNotNull (doc.SelectSingleNode ("/content:Types", manager), "#1");
+
+            XmlNodeList nodes = doc.SelectNodes ("/content:Types/*", manager);
+            Assert.AreEqual (2, nodes.Count, "#2");
+
+            foreach (XmlNode node in nodes) {
+                if (node.Name == "Default") {
+                    Assert.AreEqual (node.Attributes["Extension"].Value, "png", "#3");
+                    Assert.AreEqual (node.Attributes["ContentType"].Value, "mime/type", "#4");
+                } else if (node.Name == "Override") {
+                    Assert.AreEqual (node.Attributes["PartName"].Value, "/asdasdas", "#5");
+                    Assert.AreEqual (node.Attributes["ContentType"].Value, "asa/s", "#6");
+                } else {
+                    Assert.Fail ("Invalid node found");
+                }
+            }
+        }
+    }
+}
diff --git a/mcs/class/WindowsBase/Test/System.IO.Packaging/PackageRelationshipTests.cs b/mcs/class/WindowsBase/Test/System.IO.Packaging/PackageRelationshipTests.cs
new file mode 100644 (file)
index 0000000..cf6943d
--- /dev/null
@@ -0,0 +1,143 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//    Alan McGovern (amcgovern@novell.com)
+//
+
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+using NUnit.Framework;
+
+namespace System.IO.Packaging.Tests {
+    
+    [TestFixture]
+    public class PackageRelationshipTests : TestBase {
+        [Test]
+        public void AddInvalidRelationshipTwice ()
+        {
+            try {
+                package.CreateRelationship (new Uri ("", UriKind.Relative), TargetMode.Internal, "bmp");
+            } catch (ArgumentException) {
+                try {
+                    package.CreateRelationship (new Uri ("", UriKind.Relative), TargetMode.Internal, "bmp");
+                } catch (ArgumentException) {
+                    Assert.AreEqual (0, package.GetRelationships ().Count (), "Need to be buggy and return null");
+                    return; // Success
+                }
+            }
+
+            Assert.Fail ("Should have thrown an ArgumentException then InvalidOperationException");
+        }
+
+        [Test]
+        public void AddThreeRelationShips ()
+        {
+            PackageRelationship r1 = package.CreateRelationship (uris [0], TargetMode.Internal, "a");
+            PackageRelationship r2 = package.CreateRelationship (uris [1], TargetMode.Internal, "b");
+            PackageRelationship r3 = package.CreateRelationship (uris [2], TargetMode.Internal, "a");
+
+            Assert.AreEqual (3, package.GetRelationships ().Count (), "#1");
+            Assert.AreEqual (2, package.GetRelationshipsByType ("a").Count (), "#2");
+                       Assert.AreEqual (0, package.GetRelationshipsByType ("A").Count (), "#3");
+        }
+
+        [Test]
+        public void CheckProperties ()
+        {
+            AddThreeRelationShips ();
+            PackageRelationship r = package.GetRelationshipsByType ("b").ToArray () [0];
+            Assert.AreEqual (uris [1], r.TargetUri, "#1");
+            Assert.AreEqual (TargetMode.Internal, r.TargetMode, "#2");
+            Assert.AreEqual (new Uri ("/", UriKind.Relative), r.SourceUri, "#3");
+            Assert.AreEqual ("b", r.RelationshipType, "#4");
+            Assert.AreEqual (package, r.Package, "#5");
+            Assert.IsTrue (package == r.Package, "#6");
+            Assert.IsTrue (!string.IsNullOrEmpty (r.Id), "#7");
+        }
+
+        [Test]
+        public void RemoveById ()
+        {
+            AddThreeRelationShips ();
+            PackageRelationship r = package.GetRelationshipsByType ("a").ToArray () [0];
+            package.DeleteRelationship (r.Id);
+            Assert.AreEqual (2, package.GetRelationships ().Count (), "#1");
+            Assert.AreEqual (1, package.GetRelationshipsByType ("a").Count (), "#2");
+        }
+
+        [Test]
+        public void RemoveThreeRelationships ()
+        {
+            AddThreeRelationShips ();
+            foreach (PackageRelationship p in new List<PackageRelationship> (package.GetRelationships ()))
+                package.DeleteRelationship (p.Id);
+            Assert.AreEqual (0, package.GetRelationships ().Count (), "Should contain no relationships");
+        }
+
+        [Test]
+        [ExpectedException (typeof (InvalidOperationException))]
+        public void RemoveThreeRelationshipsBreak ()
+        {
+            AddThreeRelationShips ();
+            foreach (PackageRelationship p in package.GetRelationships ())
+                package.DeleteRelationship (p.Id);
+        }
+
+        [Test]
+        public void CheckRelationshipData ()
+        {
+            AddThreeRelationShips ();
+            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 (3, list.Count);
+
+            List<PackageRelationship> relationships = new List<PackageRelationship>(package.GetRelationships ());
+            foreach (XmlNode node in list) {
+                Assert.AreEqual (3, node.Attributes.Count, "#3");
+                Assert.IsNotNull (node.Attributes ["Id"], "#4");
+                Assert.IsNotNull (node.Attributes ["Target"], "#5");
+                Assert.IsNotNull (node.Attributes ["Type"], "#6");
+                Assert.IsTrue(relationships.Exists(d => d.Id == node.Attributes["Id"].InnerText &&
+                                                        d.TargetUri == new Uri (node.Attributes["Target"].InnerText, UriKind.Relative) &&
+                                                        d.RelationshipType == node.Attributes["Type"].InnerText));
+            }
+        }
+    }
+}
diff --git a/mcs/class/WindowsBase/Test/System.IO.Packaging/PackageTest.cs b/mcs/class/WindowsBase/Test/System.IO.Packaging/PackageTest.cs
new file mode 100644 (file)
index 0000000..cd23ba4
--- /dev/null
@@ -0,0 +1,342 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//    Alan McGovern (amcgovern@novell.com)
+//
+
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using NUnit.Framework;
+
+namespace System.IO.Packaging.Tests {
+
+    [TestFixture]
+    public class PackageTest : TestBase {
+
+        //static void Main (string [] args)
+        //{
+        //    PackageTest t = new PackageTest ();
+        //    t.FixtureSetup ();
+        //    t.Setup ();
+        //    t.RelationshipPartGetStream ();
+        //}
+        string path = "test.package";
+
+        public override void Setup ()
+        {
+            if (File.Exists (path))
+                File.Delete (path);
+        }
+
+        public override void TearDown ()
+        {
+            try {
+                if (package != null)
+                    package.Close ();
+            } catch {
+                // FIXME: This shouldn't be required when i implement this
+            }
+            if (File.Exists (path))
+                File.Delete (path);
+        }
+
+        [Test]
+        [ExpectedException (typeof (FileFormatException))]
+        public void CorruptStream ()
+        {
+            stream = new FakeStream (true, true, true);
+            stream.Write (new byte [1024], 0, 1024);
+            package = Package.Open (stream);
+        }
+
+        [Test]
+        [ExpectedException (typeof (NotSupportedException))]
+        public void FileShareReadWrite ()
+        {
+            package = Package.Open (path, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite);
+        }
+
+        [Test]
+        [ExpectedException (typeof (FileNotFoundException))]
+        public void OpenNonExistantPath ()
+        {
+            package = Package.Open (path, FileMode.Open);
+        }
+
+        [Test]
+        public void NonExistantPath ()
+        {
+            package = Package.Open (path);
+        }
+
+        [Test]
+        public void PreExistingPath ()
+        {
+            package = Package.Open (path);
+            package.Close ();
+            package = Package.Open (path);
+        }
+
+        [Test]
+        public void CreatePath ()
+        {
+            package = Package.Open (path, FileMode.Create);
+            Assert.AreEqual (FileAccess.ReadWrite, package.FileOpenAccess, "#1");
+        }
+
+        [Test]
+        [ExpectedException (typeof (ArgumentException))]
+        public void CreatePathReadonly ()
+        {
+            package = Package.Open (path, FileMode.Create, FileAccess.Read);
+            package.Close ();
+        }
+
+        [Test]
+        public void CreatePathTwice ()
+        {
+            package = Package.Open (path, FileMode.Create);
+            package.Close ();
+            package = Package.Open (path, FileMode.Open);
+            Assert.AreEqual (FileAccess.ReadWrite, package.FileOpenAccess);
+        }
+
+        [Test]
+        public void OpenPathReadonly ()
+        {
+            package = Package.Open (path, FileMode.Create);
+            package.Close ();
+            package = Package.Open (path, FileMode.Open, FileAccess.Read);
+            Assert.AreEqual (FileAccess.Read, package.FileOpenAccess, "Should be read access");
+            try {
+                package.CreatePart (uris [0], contentType);
+                Assert.Fail ("Cannot modify a read-only package");
+            } catch (IOException) {
+
+            }
+
+            try {
+                package.CreateRelationship (uris [0], TargetMode.Internal, contentType);
+                Assert.Fail ("Cannot modify a read-only package");
+            } catch (IOException) {
+
+            }
+
+            try {
+                package.DeletePart (uris [0]);
+                Assert.Fail ("Cannot modify a read-only package");
+            } catch (IOException) {
+
+            }
+
+            try {
+                package.DeleteRelationship (contentType);
+                Assert.Fail ("Cannot modify a read-only package");
+            } catch (IOException) {
+
+            }
+        }
+
+        [Test]
+        [ExpectedException (typeof (ArgumentException))]
+        public void ReadableStream ()
+        {
+            stream = new FakeStream (true, false, false);
+            package = Package.Open (stream);
+        }
+
+        [Test]
+        [ExpectedException (typeof (FileFormatException))]
+        public void ReadableSeekableStream ()
+        {
+            stream = new FakeStream (true, false, true);
+            package = Package.Open (stream);
+
+            try {
+                package.DeleteRelationship (contentType);
+                Assert.Fail ("Cannot modify a read-only package");
+            } catch (IOException) {
+
+            }
+        }
+
+        [Test]
+        [ExpectedException (typeof (FileFormatException))]
+        public void ReadableSeekableFullStream ()
+        {
+            stream = new FakeStream (true, false, true);
+            stream.Write (new byte [10], 0, 10);
+            package = Package.Open (stream);
+        }
+
+        [Test]
+        [ExpectedException (typeof (ArgumentException))]
+        public void ReadOnlyAccess ()
+        {
+            stream = new FakeStream (true, false, true);
+            package = Package.Open (path, FileMode.CreateNew, FileAccess.Read);
+
+            try {
+                package.DeleteRelationship (contentType);
+                Assert.Fail ("Cannot modify a read-only package");
+            } catch (IOException) {
+
+            }
+        }
+
+        [Test]
+        [Category ("NotWorking")]
+        [Ignore ("I'm not supposed to write to the relation stream unless i'm flushing")]
+        public void RelationshipPartGetStream ()
+        {
+            package = Package.Open (path);
+            package.CreateRelationship (uris [0], TargetMode.External, "rel");
+            PackagePart p = package.GetPart (relationshipUri);
+            Assert.IsNotNull (p, "#0");
+            Stream s = p.GetStream ();
+            Assert.AreEqual (0, s.Length, "#1");
+            Assert.IsTrue (s.CanRead, "#2");
+            Assert.IsTrue (s.CanSeek, "#3");
+            Assert.IsFalse (s.CanTimeout, "#4");
+            Assert.IsTrue (s.CanWrite, "#5");
+        }
+
+        [Test]
+        [ExpectedException (typeof (IOException))]
+        public void SetFileModeOnUnwriteableStream ()
+        {
+            stream = new FakeStream (true, false, true);
+            package = Package.Open (stream, FileMode.Truncate);
+        }
+
+        [Test]
+        [ExpectedException (typeof (NotSupportedException))]
+        public void SetAppendOnWriteableStream ()
+        {
+            stream = new FakeStream (true, true, true);
+            package = Package.Open (stream, FileMode.Append);
+        }
+
+        [Test]
+        public void SetCreateNewOnWriteableStream ()
+        {
+            package = Package.Open (stream, FileMode.CreateNew);
+        }
+
+        [Test]
+        [ExpectedException(typeof(IOException))]
+        public void SetCreateNewOnWriteableStream2 ()
+        {
+            stream = new FakeStream (true, true, true);
+            stream.Write (new byte [1000], 0, 1000);
+            package = Package.Open (stream, FileMode.CreateNew);
+            Assert.AreEqual (0, stream.Length, "#1");
+        }
+
+        [Test]
+        public void SetCreateOnWriteableStream ()
+        {
+            stream = new FakeStream (true, true, true);
+            package = Package.Open (stream, FileMode.Create);
+        }
+
+        [Test]
+        [ExpectedException (typeof (FileFormatException))]
+        public void SetOpenOnWriteableStream ()
+        {
+            stream = new FakeStream (true, true, true);
+            package = Package.Open (stream, FileMode.Open);
+        }
+
+        [Test]
+        public void SetOpenOrCreateOnWriteableStream ()
+        {
+            stream = new FakeStream (true, true, true);
+            package = Package.Open (stream, FileMode.OpenOrCreate);
+        }
+
+        [Test]
+        [ExpectedException (typeof (NotSupportedException))]
+        public void SetTruncateOnWriteableStream ()
+        {
+            stream = new FakeStream (true, true, true);
+            package = Package.Open (stream, FileMode.Truncate);
+        }
+
+        [Test]
+        [ExpectedException (typeof (NotSupportedException))]
+        public void SetTruncateOnWriteablePath ()
+        {
+            stream = new FakeStream (true, true, true);
+            File.Create (path).Close ();
+            package = Package.Open (path, FileMode.Truncate);
+        }
+
+        [Test]
+        [ExpectedException (typeof (FileFormatException))]
+        public void StreamOpen ()
+        {
+            stream = new FakeStream (true, true, true);
+            package = Package.Open (stream, FileMode.Open);
+        }
+
+        [Test]
+        public void StreamCreate ()
+        {
+            stream = new FakeStream (true, true, true);
+            package = Package.Open (stream, FileMode.Create);
+        }
+
+        [Test]
+        [ExpectedException (typeof (IOException))]
+        public void UnusableStream ()
+        {
+            stream = new FakeStream (false, false, false);
+            package = Package.Open (stream);
+        }
+
+        // Bug - I'm passing in FileAccess.Write but it thinks I've passed FileAccess.Read
+        [Test]
+        [ExpectedException (typeof (ArgumentException))]
+        public void WriteAccessDoesntExist ()
+        {
+            package = Package.Open (path, FileMode.OpenOrCreate, FileAccess.Write);
+        }
+
+        [Test]
+        public void ReadWriteAccessDoesntExist ()
+        {
+            package = Package.Open (path, FileMode.OpenOrCreate, FileAccess.ReadWrite);
+        }
+
+        [Test]
+        [ExpectedException (typeof (FileFormatException))]
+        public void WriteOnlyAccessExists ()
+        {
+            System.IO.File.Create (path).Close ();
+            package = Package.Open (path, FileMode.OpenOrCreate, FileAccess.Write);
+        }
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/Test/System.IO.Packaging/TestBase.cs b/mcs/class/WindowsBase/Test/System.IO.Packaging/TestBase.cs
new file mode 100644 (file)
index 0000000..6d8b43d
--- /dev/null
@@ -0,0 +1,77 @@
+// 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.
+//
+// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Alan McGovern (amcgovern@novell.com)
+//
+
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using NUnit.Framework;
+
+namespace System.IO.Packaging.Tests {
+    public abstract class TestBase {
+
+        protected string contentType = "mime/type";
+        protected Package package;
+        protected Uri relationshipUri = new Uri ("/_rels/.rels", UriKind.Relative);
+        protected FakeStream stream;
+        protected Uri [] uris = { new Uri("/file1.png", UriKind.Relative),
+                       new Uri("/file2.png", UriKind.Relative),
+                       new Uri("/file3.png", UriKind.Relative) };
+
+        [TestFixtureSetUp]
+        public virtual void FixtureSetup ()
+        {
+
+        }
+
+        [SetUp]
+        public virtual void Setup ()
+        {
+            stream = new FakeStream ();
+            package = Package.Open (stream, FileMode.Create);
+        }
+
+        [TearDown]
+        public virtual void TearDown ()
+        {
+                       try {
+                   if (package != null)
+                       package.Close ();
+                       } catch {
+                               
+                       }
+                       
+            if (stream != null)
+                stream.Close ();
+        }
+
+        [TestFixtureTearDown]
+        public virtual void FixtureTeardown ()
+        {
+
+        }
+    }
+}
diff --git a/mcs/class/WindowsBase/Test/System.Windows.Markup/ConstructorArgumentAttributeTest.cs b/mcs/class/WindowsBase/Test/System.Windows.Markup/ConstructorArgumentAttributeTest.cs
new file mode 100644 (file)
index 0000000..142155b
--- /dev/null
@@ -0,0 +1,50 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Windows;
+using System.Windows.Converters;
+using System.Windows.Markup;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Markup {
+
+       [TestFixture]
+       public class ConstructorArgumentAttributeTest
+       {
+               [Test]
+               public void CtorTest ()
+               {
+                       ConstructorArgumentAttribute attr = new ConstructorArgumentAttribute ("argName");
+                       Assert.AreEqual ("argName", attr.ArgumentName);
+
+                       attr = new ConstructorArgumentAttribute (null);
+                       Assert.IsNull (attr.ArgumentName);
+               }
+
+       }
+
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/Test/System.Windows.Markup/ContentPropertyAttributeTest.cs b/mcs/class/WindowsBase/Test/System.Windows.Markup/ContentPropertyAttributeTest.cs
new file mode 100644 (file)
index 0000000..48c1c7b
--- /dev/null
@@ -0,0 +1,50 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Windows;
+using System.Windows.Converters;
+using System.Windows.Markup;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Markup {
+
+       [TestFixture]
+       public class ContentPropertyAttributeTest
+       {
+               [Test]
+               public void CtorTest ()
+               {
+                       ContentPropertyAttribute attr = new ContentPropertyAttribute ("name");
+                       Assert.AreEqual ("name", attr.Name);
+
+                       attr = new ContentPropertyAttribute ();
+                       Assert.IsNull (attr.Name);
+               }
+
+       }
+
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/Test/System.Windows.Markup/ContentWrapperAttributeTest.cs b/mcs/class/WindowsBase/Test/System.Windows.Markup/ContentWrapperAttributeTest.cs
new file mode 100644 (file)
index 0000000..a730278
--- /dev/null
@@ -0,0 +1,57 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Windows;
+using System.Windows.Converters;
+using System.Windows.Markup;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Markup {
+
+       [TestFixture]
+       public class ContentWrapperAttributeTest
+       {
+               [Test]
+               public void CtorTest1 ()
+               {
+                       ContentWrapperAttribute attr = new ContentWrapperAttribute (typeof (ValueSerializer));
+                       Assert.AreEqual ("ValueSerializer", attr.ContentWrapper.Name);
+
+                       attr = new ContentWrapperAttribute (null);
+                       Assert.IsNull (attr.ContentWrapper);
+               }
+
+               [Test]
+               public void TypeId ()
+               {
+                       ContentWrapperAttribute attr = new ContentWrapperAttribute (typeof (ValueSerializer));
+                       Assert.AreSame (attr, attr.TypeId);
+               }
+
+       }
+
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/Test/System.Windows.Markup/DateTimeValueSerializerTest.cs b/mcs/class/WindowsBase/Test/System.Windows.Markup/DateTimeValueSerializerTest.cs
new file mode 100644 (file)
index 0000000..baf932b
--- /dev/null
@@ -0,0 +1,187 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Windows;
+using System.Windows.Converters;
+using System.Windows.Markup;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Markup {
+
+       [TestFixture]
+       [NUnit.Framework.CategoryAttribute ("NotWorking")]
+       public class DateTimeValueSerializerTest
+       {
+               class Context : IValueSerializerContext {
+                       public ValueSerializer GetValueSerializerFor (PropertyDescriptor descriptor)
+                       {
+                               return null;
+                       }
+
+                       public ValueSerializer GetValueSerializerFor (Type type)
+                       {
+                               return null;
+                       }
+
+                       public void OnComponentChanged ()
+                       {
+                       }
+
+                       public bool OnComponentChanging ()
+                       {
+                               return false;
+                       }
+
+                       public IContainer Container {
+                               get { return null; }
+                       }
+
+                       public object Instance {
+                               get { return null; }
+                       }
+
+                       public PropertyDescriptor PropertyDescriptor {
+                               get { return null; }
+                       }
+
+                       public object GetService (Type serviceType)
+                       {
+                               return null;
+                       }
+               }
+
+               [Test]
+               public void CanConvertFromStringNullContext ()
+               {
+                       ValueSerializer serializer = (ValueSerializer)ValueSerializer.GetSerializerFor (typeof (DateTime));
+                       Assert.IsTrue (serializer.CanConvertFromString (null, null));
+               }
+
+               [Test]
+               public void CanConvertToStringNullContext ()
+               {
+                       ValueSerializer serializer = (ValueSerializer)ValueSerializer.GetSerializerFor (typeof (DateTime));
+                       Assert.IsTrue (serializer.CanConvertToString (DateTime.Now, null));
+               }
+
+               [Test]
+               public void CanConvertFromString ()
+               {
+                       Context context = new Context ();
+                       ValueSerializer serializer = (ValueSerializer)ValueSerializer.GetSerializerFor (typeof (DateTime), context);
+
+                       Assert.AreEqual ("DateTimeValueSerializer", serializer.GetType().Name, "1");
+
+                       Assert.IsTrue (serializer.CanConvertFromString (null, context), "2");
+                       Assert.IsTrue (serializer.CanConvertFromString ("2008-01-18T10:39:27.106426-08:00", context), "3");
+                       Assert.IsTrue (serializer.CanConvertFromString ("2008-01-.106426-08:00", context), "4");
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))] // Expected object of type 'DateTime'.
+               public void CanConvertToString1 ()
+               {
+                       ValueSerializer serializer = (ValueSerializer)ValueSerializer.GetSerializerFor (typeof (DateTime));
+                       Context context = new Context ();
+
+                       serializer.CanConvertToString (null, context);
+               }
+               [Test]
+               public void CanConvertToString2 ()
+               {
+                       ValueSerializer serializer = (ValueSerializer)ValueSerializer.GetSerializerFor (typeof (DateTime));
+                       Context context = new Context ();
+
+                       DateTime dt = DateTime.Parse ("2008-01-18T10:39:27.106426-08:00");
+
+                       Assert.IsTrue (serializer.CanConvertToString (dt, context), "6");
+               }
+
+               [Test]
+               public void ConvertFromString1 ()
+               {
+                       ValueSerializer serializer = (ValueSerializer)ValueSerializer.GetSerializerFor (typeof (DateTime));
+                       Context context = new Context ();
+
+                       DateTime dt = DateTime.Parse ("2008-01-18T10:39:27.106426-08:00");
+
+                       Assert.AreEqual (dt, serializer.ConvertFromString ("2008-01-18T10:39:27.106426-08:00", context), "2");
+               }
+
+               [Test]
+               [ExpectedException (typeof (NotSupportedException))] // 'DateTimeValueSerializer' ValueSerializer cannot convert from '(null)'
+               public void ConvertFromString2 ()
+               {
+                       ValueSerializer serializer = (ValueSerializer)ValueSerializer.GetSerializerFor (typeof (DateTime));
+                       Context context = new Context ();
+
+                       serializer.ConvertFromString (null, context);
+               }
+
+               [Test]
+               [ExpectedException (typeof (FormatException))] // String was not recognized as a valid DateTime.
+               public void ConvertFromString3 ()
+               {
+                       ValueSerializer serializer = (ValueSerializer)ValueSerializer.GetSerializerFor (typeof (DateTime));
+                       Context context = new Context ();
+
+                       serializer.ConvertFromString ("2008-01-.106426-08:00", context);
+               }
+
+               [Test]
+               public void ConvertToString1 ()
+               {
+                       ValueSerializer serializer = (ValueSerializer)ValueSerializer.GetSerializerFor (typeof (DateTime));
+                       Context context = new Context ();
+
+                       DateTime dt = DateTime.Parse ("2008-01-18T10:39:27.106426-08:00");
+
+                       Assert.AreEqual ("2008-01-18T10:39:27.106426-08:00", serializer.ConvertToString (dt, context), "1");
+               }
+
+               [Test]
+               [ExpectedException (typeof (NotSupportedException))]
+               public void ConvertToString2 ()
+               {
+                       ValueSerializer serializer = (ValueSerializer)ValueSerializer.GetSerializerFor (typeof (DateTime));
+                       Context context = new Context ();
+
+                       serializer.ConvertToString (null, context);
+               }
+
+               [Test]
+               [ExpectedException (typeof (NotSupportedException))]
+               public void ConvertToString3 ()
+               {
+                       ValueSerializer serializer = (ValueSerializer)ValueSerializer.GetSerializerFor (typeof (DateTime));
+                       Context context = new Context ();
+
+                       serializer.ConvertToString (1, context);
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/Test/System.Windows.Markup/DependsOnAttributeTest.cs b/mcs/class/WindowsBase/Test/System.Windows.Markup/DependsOnAttributeTest.cs
new file mode 100644 (file)
index 0000000..4f0da86
--- /dev/null
@@ -0,0 +1,57 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Windows;
+using System.Windows.Converters;
+using System.Windows.Markup;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Markup {
+
+       [TestFixture]
+       public class DependsOnAttributeTest
+       {
+               [Test]
+               public void CtorTest ()
+               {
+                       DependsOnAttribute attr = new DependsOnAttribute ("name");
+                       Assert.AreEqual ("name", attr.Name);
+
+                       attr = new DependsOnAttribute (null);
+                       Assert.IsNull (attr.Name);
+               }
+
+               [Test]
+               public void TypeId ()
+               {
+                       DependsOnAttribute attr = new DependsOnAttribute ("name");
+                       Assert.AreSame (attr, attr.TypeId);
+               }
+
+       }
+
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/Test/System.Windows.Markup/MarkupExtensionReturnTypeAttributeTest.cs b/mcs/class/WindowsBase/Test/System.Windows.Markup/MarkupExtensionReturnTypeAttributeTest.cs
new file mode 100644 (file)
index 0000000..02c0480
--- /dev/null
@@ -0,0 +1,50 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Windows;
+using System.Windows.Converters;
+using System.Windows.Markup;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Markup {
+
+       [TestFixture]
+       public class MarkupExtensionReturnTypeAttributeTest
+       {
+               [Test]
+               public void CtorTest ()
+               {
+                       MarkupExtensionReturnTypeAttribute attr = new MarkupExtensionReturnTypeAttribute (typeof (void));
+                       Assert.AreEqual (typeof (void), attr.ReturnType);
+
+                       attr = new MarkupExtensionReturnTypeAttribute ();
+                       Assert.IsNull (attr.ReturnType);
+               }
+
+       }
+
+}
\ No newline at end of file
diff --git a/mcs/class/WindowsBase/Test/System.Windows.Markup/ValueSerializerTest.cs b/mcs/class/WindowsBase/Test/System.Windows.Markup/ValueSerializerTest.cs
new file mode 100644 (file)
index 0000000..8fc069d
--- /dev/null
@@ -0,0 +1,88 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Windows;
+using System.Windows.Converters;
+using System.Windows.Markup;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Markup {
+
+       [TestFixture]
+       public class ValueSerializerTest
+       {
+               class Context : IValueSerializerContext {
+                       public ValueSerializer GetValueSerializerFor (PropertyDescriptor descriptor)
+                       {
+                               Console.WriteLine ("GetValueSerializerFor ({0})", descriptor);
+                               return null;
+                       }
+
+                       public ValueSerializer GetValueSerializerFor (Type type)
+                       {
+                               Console.WriteLine ("GetValueSerializerFor ({0})", type);
+                               return null;
+                       }
+
+                       public void OnComponentChanged ()
+                       {
+                       }
+
+                       public bool OnComponentChanging ()
+                       {
+                               return false;
+                       }
+
+                       public IContainer Container {
+                               get { return null; }
+                       }
+
+                       public object Instance {
+                               get { return null; }
+                       }
+
+                       public PropertyDescriptor PropertyDescriptor {
+                               get { return null; }
+                       }
+
+                       public object GetService (Type serviceType)
+                       {
+                               return null;
+                       }
+               }
+
+               [Test]
+               public void GetSerializerForType ()
+               {
+                       Assert.IsNull (ValueSerializer.GetSerializerFor (typeof (DependencyObject)));
+
+                       Assert.AreEqual ("VectorValueSerializer", ValueSerializer.GetSerializerFor (typeof (Vector)).GetType().Name);
+                       Assert.AreEqual ("Int32RectValueSerializer", ValueSerializer.GetSerializerFor (typeof (Int32Rect)).GetType().Name);
+               }
+       }
+}
+
diff --git a/mcs/class/WindowsBase/Test/System.Windows.Media/MatrixTest.cs b/mcs/class/WindowsBase/Test/System.Windows.Media/MatrixTest.cs
new file mode 100644 (file)
index 0000000..5506d67
--- /dev/null
@@ -0,0 +1,419 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows;
+using System.Windows.Media;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Media {
+
+       [TestFixture]
+       [Category ("NotWorking")]
+       public class MatrixTest {
+
+               void CheckMatrix (Matrix expected, Matrix actual)
+               {
+                       Assert.AreEqual (expected.M11, actual.M11);
+                       Assert.AreEqual (expected.M12, actual.M12);
+                       Assert.AreEqual (expected.M21, actual.M21);
+                       Assert.AreEqual (expected.M22, actual.M22);
+                       Assert.AreEqual (expected.OffsetX, actual.OffsetX);
+                       Assert.AreEqual (expected.OffsetY, actual.OffsetY);
+               }
+
+               [Test]
+               public void TestAccessors ()
+               {
+                       Matrix m = new Matrix (1, 2, 3, 4, 5, 6);
+                       Assert.AreEqual (1, m.M11);
+                       Assert.AreEqual (2, m.M12);
+                       Assert.AreEqual (3, m.M21);
+                       Assert.AreEqual (4, m.M22);
+                       Assert.AreEqual (5, m.OffsetX);
+                       Assert.AreEqual (6, m.OffsetY);
+               }
+
+               [Test]
+               public void Append ()
+               {
+                       Matrix m = new Matrix (1, 2, 3, 4, 5, 6);
+                       m.Append (m);
+                       CheckMatrix (new Matrix (7, 10, 15, 22, 28, 40), m);
+               }
+
+               [Test]
+               public void Equals ()
+               {
+                       Matrix m = new Matrix (1, 2, 3, 4, 5, 6);
+                       Assert.IsTrue  (m.Equals (new Matrix (1, 2, 3, 4, 5, 6)));
+                       Assert.IsFalse (m.Equals (new Matrix (0, 2, 3, 4, 5, 6)));
+                       Assert.IsFalse (m.Equals (new Matrix (1, 0, 3, 4, 5, 6)));
+                       Assert.IsFalse (m.Equals (new Matrix (1, 2, 0, 4, 5, 6)));
+                       Assert.IsFalse (m.Equals (new Matrix (1, 2, 3, 0, 5, 6)));
+                       Assert.IsFalse (m.Equals (new Matrix (1, 2, 3, 4, 0, 6)));
+                       Assert.IsFalse (m.Equals (new Matrix (1, 2, 3, 4, 5, 0)));
+
+                       Assert.IsFalse (m.Equals (0));
+                       Assert.IsTrue (m.Equals ((object)m));
+               }
+
+               [Test]
+               public void Determinant ()
+               {
+                       Assert.AreEqual (0, (new Matrix (2, 2, 2, 2, 0, 0)).Determinant);
+                       Assert.AreEqual (-6, (new Matrix (1, 4, 2, 2, 0, 0)).Determinant);
+                       Assert.AreEqual (1, (new Matrix (1, 0, 0, 1, 0, 0)).Determinant);
+                       Assert.AreEqual (1, (new Matrix (1, 0, 0, 1, 5, 5)).Determinant);
+                       Assert.AreEqual (-1, (new Matrix (0, 1, 1, 0, 5, 5)).Determinant);
+               }
+
+               [Test]
+               public void HasInverse ()
+               {
+                       /* same matrices as in Determinant() */
+                       Assert.IsFalse ((new Matrix (2, 2, 2, 2, 0, 0)).HasInverse);
+                       Assert.IsTrue ((new Matrix (1, 4, 2, 2, 0, 0)).HasInverse);
+                       Assert.IsTrue  ((new Matrix (1, 0, 0, 1, 0, 0)).HasInverse);
+                       Assert.IsTrue  ((new Matrix (1, 0, 0, 1, 5, 5)).HasInverse);
+                       Assert.IsTrue  ((new Matrix (0, 1, 1, 0, 5, 5)).HasInverse);
+               }
+
+               [Test]
+               public void IsIdentity ()
+               {
+                       Assert.IsTrue (Matrix.Identity.IsIdentity);;
+                       Assert.IsFalse ((new Matrix (1, 0, 0, 1, 5, 5)).IsIdentity);
+                       Assert.IsFalse ((new Matrix (5, 5, 5, 5, 5, 5)).IsIdentity);
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))] // "Transform is not invertible."
+               public void InvertException1 ()
+               {
+                       Matrix m = new Matrix (2, 2, 2, 2, 0, 0);
+                       m.Invert ();
+               }
+
+               [Test]
+               public void Invert ()
+               {
+                       Matrix m;
+
+                       m = new Matrix (1, 0, 0, 1, 0, 0);
+                       m.Invert ();
+                       CheckMatrix (new Matrix (1, 0, 0, 1, 0, 0), m);
+
+                       m = new Matrix (1, 0, 0, 1, 5, 5);
+                       m.Invert ();
+                       CheckMatrix (new Matrix (1, 0, 0, 1, -5, -5), m);
+
+                       m = new Matrix (1, 0, 0, 2, 5, 5);
+                       m.Invert ();
+                       CheckMatrix (new Matrix (1, 0, 0, 0.5, -5, -2.5), m);
+
+                       m = new Matrix (0, 2, 4, 0, 5, 5);
+                       m.Invert ();
+                       CheckMatrix (new Matrix (0, 0.25, 0.5, 0, -2.5, -1.25), m);
+               }
+
+               [Test]
+               public void Identity ()
+               {
+                       CheckMatrix (new Matrix (1, 0, 0, 1, 0, 0), Matrix.Identity);
+               }
+
+               [Test]
+               public void Multiply ()
+               {
+                       CheckMatrix (new Matrix (5, 0, 0, 5, 10, 10),
+                                    Matrix.Multiply (new Matrix (1, 0, 0, 1, 2, 2),
+                                                     new Matrix (5, 0, 0, 5, 0, 0)));
+
+                       CheckMatrix (new Matrix (0, 0, 0, 0, 10, 10),
+                                    Matrix.Multiply (new Matrix (1, 0, 0, 1, 0, 0),
+                                                     new Matrix (0, 0, 0, 0, 10, 10)));
+               }
+
+               [Test]
+               public void Parse ()
+               {
+                       CheckMatrix (Matrix.Identity, Matrix.Parse ("Identity"));
+                       CheckMatrix (new Matrix (1, 0, 0, 1, 0, 0), Matrix.Parse ("1, 0, 0, 1, 0, 0"));
+                       CheckMatrix (new Matrix (0.1, 0.2, 0.3, 0.4, 0.5, 0.6), Matrix.Parse ("0.1,0.2,0.3,0.4,0.5,0.6"));
+                       // XXX what about locales where . and , are switched?
+               }
+
+               [Test]
+               public void Prepend ()
+               {
+                       Matrix m = new Matrix (1, 2, 3, 4, 5, 6);
+                       m.Prepend (new Matrix (2, 4, 6, 8, 10, 12));
+
+                       CheckMatrix (new Matrix (14, 20, 30, 44, 51, 74), m);
+               }
+
+               [Test]
+               public void Rotate ()
+               {
+                       Matrix m = Matrix.Identity;
+                       m.Rotate (45);
+                       CheckMatrix (new Matrix (0.707106781186548,
+                                                0.707106781186547,
+                                                -0.707106781186547,
+                                                0.707106781186548, 0, 0), m);
+
+                       m = new Matrix (1, 2, 3, 4, 5, 6);
+                       m.Rotate (33);
+                       CheckMatrix (new Matrix (-0.25060750208463,
+                                                2.22198017090588,
+                                                0.337455563776164,
+                                                4.98859937682678,
+                                                0.925518629636958,
+                                                7.75521858274768), m);
+               }
+
+               [Test]
+               public void RotateAt ()
+               {
+                       Matrix m = new Matrix (1, 2, 3, 4, 5, 6);
+                       m.RotateAt (33, 5, 5);
+
+                       CheckMatrix (new Matrix (-0.25060750208463,
+                                                2.22198017090588,
+                                                0.337455563776164,
+                                                4.98859937682678,
+                                                4.45536096498497,
+                                                5.83867056794542), m);
+               }
+
+               [Test]
+               public void RotateAtPrepend ()
+               {
+                       Matrix m = new Matrix (1, 2, 3, 4, 5, 6);
+                       m.RotateAtPrepend (33, 5, 5);
+
+                       CheckMatrix (new Matrix (2.47258767299051,
+                                                3.85589727595096,
+                                                1.97137266882125,
+                                                2.26540420175164,
+                                                2.78019829094125,
+                                                5.39349261148701), m);
+               }
+
+               [Test]
+               public void RotatePrepend ()
+               {
+                       Matrix m = new Matrix (1, 2, 3, 4, 5, 6);
+                       m.RotatePrepend (33);
+
+                       CheckMatrix (new Matrix (2.47258767299051,
+                                                3.85589727595096,
+                                                1.97137266882125,
+                                                2.26540420175164,
+                                                5, 6), m);
+               }
+
+               [Test]
+               public void Scale ()
+               {
+                       Matrix m = Matrix.Identity;
+
+                       m.Scale (5, 6);
+                       CheckMatrix (new Matrix (5, 0, 0, 6, 0, 0), m);
+
+                       m = new Matrix (1, 2, 2, 1, 3, 3);
+                       m.Scale (5, 5);
+                       CheckMatrix (new Matrix (5, 10, 10, 5, 15, 15), m);
+               }
+
+               [Test]
+               public void ScaleAt ()
+               {
+                       Matrix m = new Matrix (1, 0, 0, 1, 2, 2);
+                       m.ScaleAt (2, 2, 0, 0);
+                       CheckMatrix (new Matrix (2, 0, 0, 2, 4, 4), m);
+
+                       m = new Matrix (1, 0, 0, 1, 2, 2);
+                       m.ScaleAt (2, 2, 4, 4);
+                       CheckMatrix (new Matrix (2, 0, 0, 2, 0, 0), m);
+
+                       m = new Matrix (1, 0, 0, 1, 2, 2);
+                       m.ScaleAt (2, 2, 2, 2);
+                       CheckMatrix (new Matrix (2, 0, 0, 2, 2, 2), m);
+               }
+
+               [Test]
+               public void ScaleAtPrepend ()
+               {
+                       Matrix m = new Matrix (1, 0, 0, 1, 2, 2);
+                       m.ScaleAtPrepend (2, 2, 0, 0);
+                       CheckMatrix (new Matrix (2, 0, 0, 2, 2, 2), m);
+
+                       m = new Matrix (1, 0, 0, 1, 2, 2);
+                       m.ScaleAtPrepend (2, 2, 4, 4);
+                       CheckMatrix (new Matrix (2, 0, 0, 2, -2, -2), m);
+
+                       m = new Matrix (1, 0, 0, 1, 2, 2);
+                       m.ScaleAtPrepend (2, 2, 2, 2);
+                       CheckMatrix (new Matrix (2, 0, 0, 2, 0, 0), m);
+               }
+
+               [Test]
+               public void ScalePrepend ()
+               {
+                       Matrix m = Matrix.Identity;
+
+                       m.ScalePrepend (5, 6);
+                       CheckMatrix (new Matrix (5, 0, 0, 6, 0, 0), m);
+
+                       m = new Matrix (1, 2, 2, 1, 3, 3);
+                       m.ScalePrepend (5, 5);
+                       CheckMatrix (new Matrix (5, 10, 10, 5, 3, 3), m);
+               }
+
+               [Test]
+               public void SetIdentity ()
+               {
+                       Matrix m = new Matrix (5, 5, 5, 5, 5, 5);
+                       m.SetIdentity ();
+                       CheckMatrix (Matrix.Identity, m);
+               }
+
+               [Test]
+               public void Skew ()
+               {
+                       Matrix m = Matrix.Identity;
+
+                       m.Skew (10, 15);
+                       CheckMatrix (new Matrix (1,
+                                                0.267949192431123,
+                                                0.176326980708465,
+                                                1, 0, 0), m);
+
+                       m = new Matrix (1, 2, 2, 1, 3, 3);
+                       m.Skew (10, 15);
+                       CheckMatrix (new Matrix (1.35265396141693,
+                                                2.26794919243112,
+                                                2.17632698070847,
+                                                1.53589838486225,
+                                                3.52898094212539,
+                                                3.80384757729337), m);
+               }
+
+               [Test]
+               public void SkewPrepend ()
+               {
+                       Matrix m = Matrix.Identity;
+
+                       m.SkewPrepend (10, 15);
+                       CheckMatrix (new Matrix (1,
+                                                0.267949192431123,
+                                                0.176326980708465,
+                                                1, 0, 0), m);
+
+                       m = new Matrix (1, 2, 2, 1, 3, 3);
+                       m.SkewPrepend (10, 15);
+                       CheckMatrix (new Matrix (1.53589838486225,
+                                                2.26794919243112,
+                                                2.17632698070847,
+                                                1.35265396141693,
+                                                3, 3), m);
+               }
+
+               [Test]
+               public void ToStringTest ()
+               {
+                       Matrix m = new Matrix (1, 2, 3, 4, 5, 6);
+                       Assert.AreEqual ("1,2,3,4,5,6", m.ToString());
+                       m = Matrix.Identity;
+                       Assert.AreEqual ("Identity", m.ToString());
+               }
+
+               [Test]
+               public void PointTransform ()
+               {
+                       Matrix m = new Matrix (2, 0, 0, 2, 4, 4);
+
+                       Point p = new Point (5, 6);
+
+                       Assert.AreEqual (new Point (14, 16), m.Transform (p));
+
+                       Point[] ps = new Point[10];
+                       for (int i = 0; i < ps.Length; i ++)
+                               ps[i] = new Point (3 * i, 2 * i);
+
+                       m.Transform (ps);
+
+                       for (int i = 0; i < ps.Length; i ++)
+                               Assert.AreEqual (m.Transform (new Point (3 * i, 2 * i)), ps[i]);
+               }
+
+               [Test]
+               public void VectorTransform ()
+               {
+                       Matrix m = new Matrix (2, 0, 0, 2, 4, 4);
+
+                       Vector p = new Vector (5, 6);
+
+                       Assert.AreEqual (new Vector (10, 12), m.Transform (p));
+
+                       Vector[] ps = new Vector[10];
+                       for (int i = 0; i < ps.Length; i ++)
+                               ps[i] = new Vector (3 * i, 2 * i);
+
+                       m.Transform (ps);
+
+                       for (int i = 0; i < ps.Length; i ++)
+                               Assert.AreEqual (m.Transform (new Vector (3 * i, 2 * i)), ps[i]);
+               }
+
+               [Test]
+               public void Translate ()
+               {
+                       Matrix m = new Matrix (1, 0, 0, 1, 0, 0);
+                       m.Translate (5, 5);
+                       CheckMatrix (new Matrix (1, 0, 0, 1, 5, 5), m);
+
+                       m = new Matrix (2, 0, 0, 2, 0, 0);
+                       m.Translate (5, 5);
+                       CheckMatrix (new Matrix (2, 0, 0, 2, 5, 5), m);
+               }
+
+               [Test]
+               public void TranslatePrepend ()
+               {
+                       Matrix m = new Matrix (1, 0, 0, 1, 0, 0);
+                       m.TranslatePrepend (5, 5);
+                       CheckMatrix (new Matrix (1, 0, 0, 1, 5, 5), m);
+
+                       m = new Matrix (2, 0, 0, 2, 0, 0);
+                       m.TranslatePrepend (5, 5);
+                       CheckMatrix (new Matrix (2, 0, 0, 2, 10, 10), m);
+               }
+
+       }
+}
+
diff --git a/mcs/class/WindowsBase/Test/System.Windows.Threading/DispatcherTest.cs b/mcs/class/WindowsBase/Test/System.Windows.Threading/DispatcherTest.cs
new file mode 100644 (file)
index 0000000..629d342
--- /dev/null
@@ -0,0 +1,140 @@
+//
+// Tests for System.Windows.Threading.Dispatcher.cs
+//
+// Author:
+//    Miguel de Icaza (miguel@novell.com)
+//
+
+//
+// Copyright (C) 2006 Novell, Inc (http://www.novell.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.
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Globalization;
+using System.Windows.Threading;
+using System.Threading;
+
+namespace MonoTests.System.Windows.Threading
+{
+
+       delegate void Action ();
+       
+       [TestFixture]
+       public class DispatcherTest {
+               EventWaitHandle wait, wait2;
+               DispatcherOperation op;
+               
+               [SetUp]
+               public void DispatcherSetup ()
+               {
+                       wait = new EventWaitHandle (false, EventResetMode.AutoReset);
+                       wait2 = new EventWaitHandle (false, EventResetMode.AutoReset);
+               }
+
+               //
+               // Tests that fields in a DispatcherOperation can be issued from
+               // a separate thread
+               //
+               [Test]
+               public void TestDispatcherOpOnThread ()
+               {
+                       Thread t = new Thread (new ThreadStart (thread));
+                       Dispatcher d = Dispatcher.CurrentDispatcher;
+                       
+                       t.Start ();
+                       op = Dispatcher.CurrentDispatcher.BeginInvoke (DispatcherPriority.Normal, (Action) delegate {
+                               Console.WriteLine ("Some methods");
+                       });
+                       wait.Set ();
+                       wait2.WaitOne ();
+               }
+
+               void thread ()
+               {
+                       wait.WaitOne ();
+                       op.Priority = DispatcherPriority.DataBind;
+                       wait2.Set ();
+               }
+
+               [Test]
+               public void TestDispatcherOrder ()
+               {
+                       Dispatcher d = Dispatcher.CurrentDispatcher;
+
+                       DispatcherFrame frame = new DispatcherFrame ();
+                       bool fail = true;
+                       int next = 1;
+                       
+                       d.BeginInvoke (DispatcherPriority.Normal, (Action) delegate {
+                               if (next != 3)
+                                       throw new Exception ("Expected state 3, got " + next.ToString ());
+
+                               next = 4;
+                               Console.WriteLine ("First");
+                       });
+                       d.BeginInvoke (DispatcherPriority.Normal, (Action) delegate {
+                               if (next != 4)
+                                       throw new Exception ("Expected state 4, got " + next.ToString ());
+
+                               next = 5;
+                               Console.WriteLine ("Second");
+                       });
+                       d.BeginInvoke (DispatcherPriority.Send, (Action) delegate {
+                               if (next != 1)
+                                       throw new Exception ("Expected state 1, got " + next.ToString ());
+                               next = 2;
+                               Console.WriteLine ("High Priority");
+                               d.BeginInvoke (DispatcherPriority.Send, (Action) delegate {
+                                       if (next != 2)
+                                               throw new Exception ("Expected state 2, got " + next.ToString ());
+
+                                       next = 3;
+                                       Console.WriteLine ("INSERTED");
+                               });
+                       });
+                       d.BeginInvoke (DispatcherPriority.SystemIdle, (Action) delegate {
+                               if (next != 6)
+                                       throw new Exception ("Expected state 6, got " + next.ToString ());
+                               
+                               Console.WriteLine ("Idle");
+                               frame.Continue = false;
+                               fail = false;
+                       });
+                       
+                       d.BeginInvoke (DispatcherPriority.Normal, (Action) delegate {
+                               if (next != 5)
+                                       throw new Exception ("Expected state 5, got " + next.ToString ());
+                               next = 6;
+                               Console.WriteLine ("Last normal");
+                       });
+                       
+                       Dispatcher.PushFrame (frame);
+
+                       if (fail)
+                               throw new Exception ("Expected all states to run");
+               }
+       }
+}
+
+
diff --git a/mcs/class/WindowsBase/Test/System.Windows/DependencyObjectTest.cs b/mcs/class/WindowsBase/Test/System.Windows/DependencyObjectTest.cs
new file mode 100644 (file)
index 0000000..91e39e1
--- /dev/null
@@ -0,0 +1,107 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// (C) iain@mccoy.id.au
+//
+// Authors:
+//     Iain McCoy (iain@mccoy.id.au)
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows;
+using System.Windows.Media;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows {
+
+       class X {
+               public static readonly DependencyProperty AProperty = DependencyProperty.RegisterAttached("A", typeof(int), typeof(X));
+               public static void SetA(DependencyObject obj, int value)
+               {
+                       obj.SetValue(AProperty, value);
+               }
+               public static int GetA(DependencyObject obj)
+               {
+                       return (int)obj.GetValue(AProperty);
+               }
+
+               public static readonly DependencyProperty BProperty = DependencyProperty.RegisterAttached("B", typeof(string), typeof(X));
+               public static void SetB(DependencyObject obj, string value)
+               {
+                       obj.SetValue(BProperty, value);
+               }
+               public static string GetB(DependencyObject obj)
+               {
+                       return (string)obj.GetValue(BProperty);
+               }
+
+       }
+
+       class Y : DependencyObject {
+       }
+
+       [TestFixture]
+       [Category ("NotWorking")]
+       public class DependencyObjectTest {
+               [Test]
+               public void TestAttachedProperty()
+               {
+                       Y y1 = new Y();
+                       X.SetA(y1, 2);
+                       Assert.AreEqual(2, X.GetA(y1));
+               }
+       
+               [Test]
+               public void Test2AttachedProperties()
+               {
+                       Y y1 = new Y();
+                       Y y2 = new Y();
+                       X.SetA(y1, 2);
+                       X.SetA(y2, 3);
+                       Assert.AreEqual(2, X.GetA(y1));
+                       Assert.AreEqual(3, X.GetA(y2));
+               }
+
+               [Test]
+               public void TestEnumerationOfAttachedProperties()
+               {
+                       int count = 0;
+                       Y y = new Y();
+                       X.SetA(y, 2);
+                       X.SetB(y, "Hi");
+
+                       LocalValueEnumerator e = y.GetLocalValueEnumerator();
+                       while (e.MoveNext()) {
+                               count++;
+                               if (e.Current.Property == X.AProperty)
+                                       Assert.AreEqual(e.Current.Value, 2);
+                               else if (e.Current.Property == X.BProperty)
+                                       Assert.AreEqual(e.Current.Value, "Hi");
+                               else
+                                       Assert.Fail("Wrong sort of property" + e.Current.Property);
+                       }
+
+                       Assert.AreEqual(2, count);
+               }
+
+       }
+}
diff --git a/mcs/class/WindowsBase/Test/System.Windows/DependencyObjectTypeTest.cs b/mcs/class/WindowsBase/Test/System.Windows/DependencyObjectTypeTest.cs
new file mode 100644 (file)
index 0000000..b79d2c8
--- /dev/null
@@ -0,0 +1,66 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows;
+using System.Windows.Media;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows {
+
+       [TestFixture]
+       public class DependencyObjectTypeTest {
+
+               [Test]
+               public void Accessors ()
+               {
+                       DependencyObjectType t = DependencyObjectType.FromSystemType (typeof (TestDepObj));
+                       Assert.AreEqual ("TestDepObj", t.Name);
+                       Assert.AreEqual (typeof (TestDepObj), t.SystemType);
+                       Assert.AreEqual (typeof (DependencyObject), t.BaseType.SystemType);
+                       // we can't test the Id field's value, as it's
+                       // not guaranteed to be anything in
+                       // particular.
+               }
+
+               [Test]
+               public void IsInstanceOfType ()
+               {
+                       DependencyObjectType t = DependencyObjectType.FromSystemType (typeof (TestDepObj));
+                       DependencyObjectType t2 = DependencyObjectType.FromSystemType (typeof (TestSubclass));
+                       Assert.IsTrue (t.IsInstanceOfType (new TestSubclass()));
+                       Assert.IsTrue (t2.IsSubclassOf (t));
+                       Assert.IsFalse (t.IsSubclassOf (t2));
+               }
+
+               [Test]
+               public void TestCache ()
+               {
+                       DependencyObjectType t = DependencyObjectType.FromSystemType (typeof (TestDepObj));
+                       DependencyObjectType t2 = DependencyObjectType.FromSystemType (typeof (TestDepObj));
+                       Assert.AreSame (t, t2);
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/Test/System.Windows/DependencyPropertyTest.cs b/mcs/class/WindowsBase/Test/System.Windows/DependencyPropertyTest.cs
new file mode 100644 (file)
index 0000000..84bd472
--- /dev/null
@@ -0,0 +1,118 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows;
+using System.Windows.Media;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows {
+
+       [TestFixture]
+       public class DependencyPropertyTest {
+               class ObjectPoker : DependencyObject {
+                       public static readonly DependencyProperty TestProp1 = DependencyProperty.Register ("property1", typeof (string), typeof (ObjectPoker));
+               }
+
+               class SubclassPoker : ObjectPoker {
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))] // "'p1' property was already registered by 'ObjectPoker'."
+               public void TestMultipleRegisters ()
+               {
+                       DependencyProperty.Register ("p1", typeof (string), typeof (ObjectPoker));
+                       DependencyProperty.Register ("p1", typeof (string), typeof (ObjectPoker));
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))] // "'property1' property was already registered by 'SubclassPoker'."
+               public void TestMultipleAddOwner ()
+               {
+                       ObjectPoker.TestProp1.AddOwner (typeof (SubclassPoker), new PropertyMetadata());
+                       ObjectPoker.TestProp1.AddOwner (typeof (SubclassPoker), new PropertyMetadata());
+               }
+
+               [Test]
+               public void TestDefaultMetadata ()
+               {
+                       DependencyProperty p;
+                       p = DependencyProperty.Register ("TestDefaultMetadata1", typeof (string), typeof (ObjectPoker));
+                       Assert.IsNotNull (p.DefaultMetadata);
+
+                       p = DependencyProperty.Register ("TestDefaultMetadata2", typeof (string), typeof (ObjectPoker), new PropertyMetadata ("hi"));
+                       Assert.IsNotNull (p.DefaultMetadata);
+                       Assert.AreEqual ("hi", p.DefaultMetadata.DefaultValue);
+               }
+
+               [Test]
+               public void TestAddOwnerNullMetadata()
+               {
+                       DependencyProperty p = DependencyProperty.Register ("TestAddOwnerNullMetadata", typeof (string), typeof (ObjectPoker));
+                       p.AddOwner (typeof (SubclassPoker), null);
+
+                       PropertyMetadata pm = p.GetMetadata (typeof (SubclassPoker));
+                       Assert.IsNotNull (pm);
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void TestOverrideMetadataNullMetadata()
+               {
+                       DependencyProperty p = DependencyProperty.Register ("TestOverrideMetadataNullMetadata", typeof (string), typeof (ObjectPoker));
+                       p.OverrideMetadata (typeof (SubclassPoker), null);
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void TestOverrideMetadataNullType()
+               {
+                       DependencyProperty p = DependencyProperty.Register ("TestOverrideMetadataNullType", typeof (string), typeof (ObjectPoker));
+                       p.OverrideMetadata (null, new PropertyMetadata());
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void TestReadonlyOverrideMetadata ()
+               {
+                       DependencyPropertyKey ro_key = DependencyProperty.RegisterReadOnly ("readonly-prop1",
+                                                                                           typeof(double),
+                                                                                           typeof(ObjectPoker),
+                                                                                           new PropertyMetadata(double.NaN));
+                       ro_key.DependencyProperty.OverrideMetadata (typeof (SubclassPoker), new PropertyMetadataPoker());
+               }
+
+               [Test]
+               public void TestReadonlyOverrideMetadataFromKey ()
+               {
+                       DependencyPropertyKey ro_key = DependencyProperty.RegisterReadOnly ("readonly-prop2",
+                                                                                           typeof(double),
+                                                                                           typeof(ObjectPoker),
+                                                                                           new PropertyMetadata(double.NaN));
+                       ro_key.OverrideMetadata (typeof (SubclassPoker), new PropertyMetadataPoker ());
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/Test/System.Windows/FreezableTest.cs b/mcs/class/WindowsBase/Test/System.Windows/FreezableTest.cs
new file mode 100644 (file)
index 0000000..3dc0470
--- /dev/null
@@ -0,0 +1,42 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// (C) iain@mccoy.id.au
+//
+// Authors:
+//     Iain McCoy (iain@mccoy.id.au)
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows;
+using System.Windows.Media;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows {
+
+       class FreezablePoker {
+       };
+
+       [TestFixture]
+       public class FreezableTest {
+       }
+}
diff --git a/mcs/class/WindowsBase/Test/System.Windows/Int32RectConverterTest.cs b/mcs/class/WindowsBase/Test/System.Windows/Int32RectConverterTest.cs
new file mode 100644 (file)
index 0000000..8dddbc9
--- /dev/null
@@ -0,0 +1,105 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows;
+using System.Windows.Media;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows {
+
+       [TestFixture]
+       [Category ("NotWorking")]
+       public class Int32RectConverterTest
+       {
+               [Test]
+               public void CanConvertFrom ()
+               {
+                       Int32RectConverter r = new Int32RectConverter ();
+
+                       Assert.IsTrue (r.CanConvertFrom (typeof (string)));
+                       Assert.IsFalse (r.CanConvertFrom (typeof (Int32Rect)));
+                       Assert.IsFalse (r.CanConvertFrom (typeof (Size)));
+               }
+
+               [Test]
+               public void CanConvertTo ()
+               {
+                       Int32RectConverter r = new Int32RectConverter ();
+
+                       Assert.IsTrue (r.CanConvertTo (typeof (string)));
+                       Assert.IsFalse (r.CanConvertTo (typeof (Int32Rect)));
+                       Assert.IsFalse (r.CanConvertTo (typeof (Size)));
+               }
+
+               [Test]
+               public void ConvertFrom ()
+               {
+                       Int32RectConverter r = new Int32RectConverter ();
+
+                       object or = r.ConvertFrom ("1, 2, 3, 4");
+                       
+                       Assert.AreEqual (typeof (Int32Rect), or.GetType());
+                       Assert.AreEqual (new Int32Rect (1, 2, 3, 4), or);
+
+                       or = r.ConvertFrom ("Empty");
+                       Assert.AreEqual (typeof (Int32Rect), or.GetType());
+                       Assert.IsTrue (((Int32Rect)or).IsEmpty);
+               }
+
+               [Test]
+               [ExpectedException (typeof (NotSupportedException))]
+               public void ConvertFrom_size ()
+               {
+                       Int32RectConverter r = new Int32RectConverter ();
+
+                       r.ConvertFrom (new Size (10, 20));
+               }
+
+               [Test]
+               public void ConvertFrom_negative ()
+               {
+                       Int32RectConverter r = new Int32RectConverter ();
+                       object or = r.ConvertFrom ("1, 2, -4, -5");
+
+                       Assert.AreEqual (typeof (Int32Rect), or.GetType());
+                       Assert.AreEqual (new Int32Rect (1, 2, -4, -5), or);
+               }
+
+               [Test]
+               public void ConvertTo ()
+               {
+                       Int32RectConverter r = new Int32RectConverter ();
+
+                       Int32Rect rect = new Int32Rect (0, 0, 1, 2);
+
+                       object o = r.ConvertTo (rect, typeof (string));
+                       
+                       Assert.AreEqual (typeof (string), o.GetType());
+                       Assert.AreEqual ("0,0,1,2", (string)o);
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/Test/System.Windows/Int32RectTest.cs b/mcs/class/WindowsBase/Test/System.Windows/Int32RectTest.cs
new file mode 100644 (file)
index 0000000..38712a3
--- /dev/null
@@ -0,0 +1,185 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows;
+using System.Windows.Media;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows {
+
+       [TestFixture]
+       [Category ("NotWorking")]
+       public class Int32RectTest
+       {
+               [Test]
+               public void Ctor_Accessor ()
+               {
+                       Int32Rect r;
+
+                       r = new Int32Rect (10, 15, 20, 30);
+                       Assert.AreEqual (10, r.X);
+                       Assert.AreEqual (15, r.Y);
+                       Assert.AreEqual (20, r.Width);
+                       Assert.AreEqual (30, r.Height);
+               }
+
+               [Test]
+               public void Ctor_NegativeWidth ()
+               {
+                       new Int32Rect (10, 10, -10, 10);
+               }
+
+               [Test]
+               public void Ctor_NegativeHeight ()
+               {
+                       new Int32Rect (10, 10, 10, -10);
+               }
+
+               [Test]
+               public void Empty ()
+               {
+                       Int32Rect r = Int32Rect.Empty;
+                       Assert.AreEqual (0, r.X);
+                       Assert.AreEqual (0, r.Y);
+                       Assert.AreEqual (0, r.Width);
+                       Assert.AreEqual (0, r.Height);
+               }
+
+               [Test]
+               public void ModifyEmpty_x ()
+               {
+                       Int32Rect r = Int32Rect.Empty;
+                       r.X = 5;
+               }
+
+               [Test]
+               public void ModifyEmpty_y ()
+               {
+                       Int32Rect r = Int32Rect.Empty;
+                       r.Y = 5;
+               }
+
+               [Test]
+               public void ModifyEmpty_width ()
+               {
+                       Int32Rect r = Int32Rect.Empty;
+                       r.Width = 5;
+               }
+
+               [Test]
+               public void ModifyEmpty_height ()
+               {
+                       Int32Rect r = Int32Rect.Empty;
+                       r.Height = 5;
+               }
+
+               [Test]
+               public void ModifyEmpty_negative_width ()
+               {
+                       Int32Rect r = Int32Rect.Empty;
+                       r.Width = -5;
+               }
+
+               [Test]
+               public void ModifyEmpty_negative_height ()
+               {
+                       Int32Rect r = Int32Rect.Empty;
+                       r.Height = -5;
+               }
+
+
+               [Test]
+               public void Modify_negative_width ()
+               {
+                       Int32Rect r = new Int32Rect (0, 0, 10, 10);
+                       r.Width = -5;
+               }
+
+               [Test]
+               public void Modify_negative_height ()
+               {
+                       Int32Rect r = new Int32Rect (0, 0, 10, 10);
+                       r.Height = -5;
+               }
+
+               [Test]
+               public void IsEmpty ()
+               {
+                       Assert.IsTrue (Int32Rect.Empty.IsEmpty);
+                       Assert.IsTrue ((new Int32Rect (0, 0, 0, 0)).IsEmpty);
+                       Assert.IsFalse ((new Int32Rect (5, 5, 5, 5)).IsEmpty);
+               }
+
+               [Test]
+               public void ToStringTest ()
+               {
+                       Int32Rect r = new Int32Rect (1, 2, 3, 4);
+                       Assert.AreEqual ("1,2,3,4", r.ToString());
+
+                       Assert.AreEqual ("Empty", Int32Rect.Empty.ToString());
+               }
+
+               [Test]
+               public void Parse ()
+               {
+                       Int32Rect r = Int32Rect.Parse ("1, 2, 3, 4");
+                       Assert.AreEqual (new Int32Rect (1, 2, 3, 4), r);
+               }
+
+               [Test]
+               public void ParseNegative ()
+               {
+                       Int32Rect.Parse ("1, 2, -3, -4");
+               }
+
+               [Test]
+               public void Equals ()
+               {
+                       Int32Rect r1 = new Int32Rect (1, 2, 3, 4);
+                       Int32Rect r2 = r1;
+
+                       Assert.IsTrue (r1.Equals (r1));
+
+                       r2.X = 0;
+                       Assert.IsFalse (r1.Equals (r2));
+                       r2.X = r1.X;
+
+                       r2.Y = 0;
+                       Assert.IsFalse (r1.Equals (r2));
+                       r2.Y = r1.Y;
+
+                       r2.Width = 0;
+                       Assert.IsFalse (r1.Equals (r2));
+                       r2.Width = r1.Width;
+
+                       r2.Height = 0;
+                       Assert.IsFalse (r1.Equals (r2));
+                       r2.Height = r1.Height;
+
+                       Assert.IsFalse (r1.Equals (new object()));
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/Test/System.Windows/PointConverterTest.cs b/mcs/class/WindowsBase/Test/System.Windows/PointConverterTest.cs
new file mode 100644 (file)
index 0000000..23d3bfa
--- /dev/null
@@ -0,0 +1,93 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows;
+using System.Windows.Media;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows {
+
+       [TestFixture]
+       [Category ("NotWorking")]
+       public class PointConverterTest
+       {
+               [Test]
+               public void CanConvertFrom ()
+               {
+                       PointConverter r = new PointConverter ();
+
+                       Assert.IsTrue (r.CanConvertFrom (typeof (string)));
+                       Assert.IsFalse (r.CanConvertFrom (typeof (Point)));
+               }
+
+               [Test]
+               public void CanConvertTo ()
+               {
+                       PointConverter r = new PointConverter ();
+
+                       Assert.IsTrue (r.CanConvertTo (typeof (string)));
+                       Assert.IsFalse (r.CanConvertTo (typeof (Point)));
+               }
+
+               [Test]
+               public void ConvertFrom ()
+               {
+                       PointConverter r = new PointConverter ();
+
+                       object or = r.ConvertFrom ("3, 4");
+                       
+                       Assert.AreEqual (typeof (Point), or.GetType());
+                       Assert.AreEqual (new Point (3, 4), or);
+
+                       or = r.ConvertFrom ("-1, -4");
+                       Assert.AreEqual (typeof (Point), or.GetType());
+                       Assert.AreEqual (new Point (-1, -4), or);
+               }
+
+               [Test]
+               [ExpectedException (typeof (NotSupportedException))]
+               public void ConvertFrom_size ()
+               {
+                       PointConverter r = new PointConverter ();
+
+                       r.ConvertFrom (new Point (10, 20));
+               }
+
+               [Test]
+               public void ConvertTo ()
+               {
+                       PointConverter r = new PointConverter ();
+
+                       Point rect = new Point (1, 2);
+
+                       object o = r.ConvertTo (rect, typeof (string));
+                       
+                       Assert.AreEqual (typeof (string), o.GetType());
+                       Assert.AreEqual ("1,2", (string)o);
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/Test/System.Windows/PointTest.cs b/mcs/class/WindowsBase/Test/System.Windows/PointTest.cs
new file mode 100644 (file)
index 0000000..e5065ed
--- /dev/null
@@ -0,0 +1,116 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows;
+using System.Windows.Media;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows {
+
+       [TestFixture]
+       [Category ("NotWorking")]
+       public class PointTest {
+
+               [Test]
+               public void Accessors ()
+               {
+                       Point p = new Point (4, 5);
+                       Assert.AreEqual (4, p.X);
+                       Assert.AreEqual (5, p.Y);
+               }
+
+               [Test]
+               public void Equals ()
+               {
+                       Point p = new Point (4, 5);
+                       Assert.IsTrue (p.Equals (new Point (4, 5)));
+                       Assert.IsFalse (p.Equals (new Point (5, 4)));
+                       Assert.IsFalse (p.Equals (new object()));
+               }
+
+               [Test]
+               public void ToStringTest ()
+               {
+                       Point p = new Point (4, 5);
+                       Assert.AreEqual ("4,5", p.ToString());
+               }
+
+               [Test]
+               public void Parse ()
+               {
+                       Point p = Point.Parse ("4,5");
+                       Assert.AreEqual (new Point (4, 5), p);
+
+                       p = Point.Parse ("-4,-5");
+                       Assert.AreEqual (new Point (-4, -5), p);
+
+                       p = Point.Parse ("-4.4,-5.5");
+                       Assert.AreEqual (new Point (-4.4, -5.5), p);
+               }
+
+               [Test]
+               public void Offset ()
+               {
+                       Point p = new Point (4, 5);
+                       p.Offset (3, 4);
+                       Assert.AreEqual (new Point (7, 9), p);
+               }
+
+               [Test]
+               public void Add ()
+               {
+                       Point p = Point.Add (new Point (4, 5), new Vector (2, 3));
+                       Assert.AreEqual (new Point (6, 8), p);
+               }
+
+               [Test]
+               public void Subtract1 ()
+               {
+                       Point p = Point.Subtract (new Point (4, 5), new Vector (2, 3));
+                       Assert.AreEqual (new Point (2, 2), p);
+               }
+
+               [Test]
+               public void Subtract2 ()
+               {
+                       Vector v = Point.Subtract (new Point (4, 5), new Point (2, 3));
+                       Assert.AreEqual (new Vector (2, 2), v);
+               }
+
+               [Test]
+               public void Multiply ()
+               {
+                       Matrix m = Matrix.Identity;
+                       m.Scale (2, 2);
+
+                       Point p = Point.Multiply (new Point (2, 3), m);
+
+                       Assert.AreEqual (new Point (4, 6), p);
+               }
+       }
+
+}
+
diff --git a/mcs/class/WindowsBase/Test/System.Windows/PropertyMetadataTest.cs b/mcs/class/WindowsBase/Test/System.Windows/PropertyMetadataTest.cs
new file mode 100644 (file)
index 0000000..97b8ad6
--- /dev/null
@@ -0,0 +1,202 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows;
+using System.Windows.Media;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows {
+
+       class TestDepObj : DependencyObject {
+               public static readonly DependencyProperty TestProp1 = DependencyProperty.Register ("property1", typeof (string), typeof (TestDepObj));
+               public static readonly DependencyProperty TestProp2 = DependencyProperty.Register ("property2", typeof (string), typeof (TestDepObj));
+               public static readonly DependencyProperty TestProp3 = DependencyProperty.Register ("property3", typeof (string), typeof (TestDepObj));
+
+               public static readonly DependencyProperty TestProp4 = DependencyProperty.Register ("property4", typeof (string), typeof (TestDepObj), new PropertyMetadata ("default", changed, coerce));
+
+               static void changed (DependencyObject d, DependencyPropertyChangedEventArgs e) { }
+               static object coerce (DependencyObject d, object baseValue) { return baseValue; }
+       }
+
+       class TestSubclass : TestDepObj {
+       }
+       
+
+       public class PropertyMetadataPoker : PropertyMetadata {
+
+               public bool BaseIsSealed {
+                       get { return base.IsSealed; }
+               }
+
+               public void CallApply ()
+               {
+                       OnApply (TestDepObj.TestProp1, typeof (TestDepObj));
+               }
+
+               public void CallMerge (PropertyMetadata baseMetadata, DependencyProperty dp)
+               {
+                       Merge (baseMetadata, dp);
+               }
+
+               protected override void Merge (PropertyMetadata baseMetadata, DependencyProperty dp)
+               {
+                       Console.WriteLine (Environment.StackTrace);
+                       base.Merge (baseMetadata, dp);
+               }
+
+               protected override void OnApply (DependencyProperty dp, Type targetType)
+               {
+                       base.OnApply (dp, targetType);
+                       Console.WriteLine ("IsSealed in OnApply? {0}", IsSealed);
+                       Console.WriteLine (Environment.StackTrace);
+               }
+       }
+
+
+       [TestFixture]
+       public class PropertyMetadataTest {
+
+               [Test]
+               public void DefaultValues ()
+               {
+                       PropertyMetadataPoker m = new PropertyMetadataPoker ();
+                       Assert.AreEqual (null, m.DefaultValue);
+                       Assert.AreEqual (null, m.PropertyChangedCallback);
+                       Assert.AreEqual (null, m.CoerceValueCallback);
+               }
+
+               [Test]
+               public void IsSealed ()
+               {
+                       PropertyMetadataPoker m;
+
+                       Console.WriteLine (1);
+                       // calling OnApply isn't what sets the metadata to be sealed
+                       m = new PropertyMetadataPoker();
+                       Assert.IsFalse (m.BaseIsSealed);
+                       m.CallApply ();
+                       Assert.IsFalse (m.BaseIsSealed);
+
+                       Console.WriteLine (2);
+                       // calling OverrideMetadata does, however
+                       m = new PropertyMetadataPoker ();
+                       TestDepObj.TestProp1.OverrideMetadata (typeof (TestSubclass), m);
+                       Assert.IsTrue (m.BaseIsSealed);
+
+                       Console.WriteLine (3);
+                       // calling DependencyProperty.AddOwner does too, but only because it calls OverrideMetadata
+                       m = new PropertyMetadataPoker ();
+                       TestDepObj.TestProp2.AddOwner (typeof (TestSubclass), m);
+                       Assert.IsTrue (m.BaseIsSealed);
+
+                       Console.WriteLine (4);
+                       // lastly, calling DependencyProperty.Register does.
+                       m = new PropertyMetadataPoker ();
+                       DependencyProperty.Register ("xxx", typeof (string), typeof (TestDepObj), m);
+                       Assert.IsTrue (m.BaseIsSealed);
+               }
+
+               [Test]
+               public void TestAddOwnerResult()
+               {
+                       PropertyMetadataPoker m = new PropertyMetadataPoker ();
+                       DependencyProperty p = TestDepObj.TestProp3.AddOwner (typeof (TestSubclass), m);
+
+                       // they're the same object
+                       Assert.AreSame (p, TestDepObj.TestProp3);
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void ModifyAfterSealed1 ()
+               {
+                       PropertyMetadataPoker m = new PropertyMetadataPoker ();
+                       DependencyProperty.Register ("p1", typeof (string), typeof (TestDepObj), m);
+                       Assert.IsTrue (m.BaseIsSealed);
+
+                       m.CoerceValueCallback = null;
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void ModifyAfterSealed2 ()
+               {
+                       PropertyMetadataPoker m = new PropertyMetadataPoker ();
+                       DependencyProperty.Register ("p2", typeof (string), typeof (TestDepObj), m);
+                       Assert.IsTrue (m.BaseIsSealed);
+
+                       m.PropertyChangedCallback = null;
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void ModifyAfterSealed3 ()
+               {
+                       PropertyMetadataPoker m = new PropertyMetadataPoker ();
+                       DependencyProperty.Register ("p3", typeof (string), typeof (TestDepObj), m);
+                       Assert.IsTrue (m.BaseIsSealed);
+
+                       m.DefaultValue = "hi";
+               }
+
+               [Test]
+               public void TestMerge ()
+               {
+                       PropertyMetadataPoker m = new PropertyMetadataPoker ();
+                       m.CallMerge (TestDepObj.TestProp4.GetMetadata (typeof (TestDepObj)), TestDepObj.TestProp4);
+                       Assert.AreEqual ("default", m.DefaultValue);
+                       Assert.IsNotNull (m.CoerceValueCallback);
+                       Assert.IsNotNull (m.PropertyChangedCallback);
+
+                       m = new PropertyMetadataPoker ();
+                       m.DefaultValue = "non-default";
+                       m.CallMerge (TestDepObj.TestProp4.GetMetadata (typeof (TestDepObj)), TestDepObj.TestProp4);
+                       Assert.AreEqual ("non-default", m.DefaultValue);
+                       Assert.IsNotNull (m.CoerceValueCallback);
+                       Assert.IsNotNull (m.PropertyChangedCallback);
+
+                       // XXX should check overriding of coerce and
+                       // property changed callbacks, but we'll trust
+                       // they behave the same..
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))] // "Default value cannot be 'Unset'."
+               public void TestSetDefaultToUnsetValue ()
+               {
+                       PropertyMetadata m = new PropertyMetadata ();
+                       m.DefaultValue = DependencyProperty.UnsetValue;
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))] // "Default value cannot be 'Unset'."
+               public void TestInitDefaultToUnsetValue ()
+               {
+                       new PropertyMetadata (DependencyProperty.UnsetValue);
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/Test/System.Windows/RectConverterTest.cs b/mcs/class/WindowsBase/Test/System.Windows/RectConverterTest.cs
new file mode 100644 (file)
index 0000000..c2ee94a
--- /dev/null
@@ -0,0 +1,103 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows;
+using System.Windows.Media;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows {
+
+       [TestFixture]
+       [Category ("NotWorking")]
+       public class RectConverterTest
+       {
+               [Test]
+               public void CanConvertFrom ()
+               {
+                       RectConverter r = new RectConverter ();
+
+                       Assert.IsTrue (r.CanConvertFrom (typeof (string)));
+                       Assert.IsFalse (r.CanConvertFrom (typeof (Rect)));
+                       Assert.IsFalse (r.CanConvertFrom (typeof (Size)));
+               }
+
+               [Test]
+               public void CanConvertTo ()
+               {
+                       RectConverter r = new RectConverter ();
+
+                       Assert.IsTrue (r.CanConvertTo (typeof (string)));
+                       Assert.IsFalse (r.CanConvertTo (typeof (Rect)));
+                       Assert.IsFalse (r.CanConvertTo (typeof (Size)));
+               }
+
+               [Test]
+               public void ConvertFrom ()
+               {
+                       RectConverter r = new RectConverter ();
+
+                       object or = r.ConvertFrom ("1, 2, 3, 4");
+                       
+                       Assert.AreEqual (typeof (Rect), or.GetType());
+                       Assert.AreEqual (new Rect (1, 2, 3, 4), or);
+
+                       or = r.ConvertFrom ("Empty");
+                       Assert.AreEqual (typeof (Rect), or.GetType());
+                       Assert.IsTrue (((Rect)or).IsEmpty);
+               }
+
+               [Test]
+               [ExpectedException (typeof (NotSupportedException))]
+               public void ConvertFrom_size ()
+               {
+                       RectConverter r = new RectConverter ();
+
+                       r.ConvertFrom (new Size (10, 20));
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void ConvertFrom_negative ()
+               {
+                       RectConverter r = new RectConverter ();
+                       r.ConvertFrom ("1, 2, -4, -5");
+               }
+
+               [Test]
+               public void ConvertTo ()
+               {
+                       RectConverter r = new RectConverter ();
+
+                       Rect rect = new Rect (0, 0, 1, 2);
+
+                       object o = r.ConvertTo (rect, typeof (string));
+                       
+                       Assert.AreEqual (typeof (string), o.GetType());
+                       Assert.AreEqual ("0,0,1,2", (string)o);
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/Test/System.Windows/RectTest.cs b/mcs/class/WindowsBase/Test/System.Windows/RectTest.cs
new file mode 100644 (file)
index 0000000..41b611e
--- /dev/null
@@ -0,0 +1,543 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows;
+using System.Windows.Media;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows {
+
+       [TestFixture]
+       [Category ("NotWorking")]
+       public class RectTest
+       {
+               [Test]
+               public void Ctor_Accessor ()
+               {
+                       Rect r;
+
+                       r = new Rect (new Size (40, 50));
+                       Assert.AreEqual (0, r.X);
+                       Assert.AreEqual (0, r.Y);
+                       Assert.AreEqual (40, r.Width);
+                       Assert.AreEqual (50, r.Height);
+                       Assert.AreEqual (0, r.Left);
+                       Assert.AreEqual (0, r.Top);
+                       Assert.AreEqual (40, r.Right);
+                       Assert.AreEqual (50, r.Bottom);
+                       Assert.AreEqual (new Point (0, 0), r.TopLeft);
+                       Assert.AreEqual (new Point (40, 0), r.TopRight);
+                       Assert.AreEqual (new Point (0, 50), r.BottomLeft);
+                       Assert.AreEqual (new Point (40, 50), r.BottomRight);
+                       Assert.AreEqual (new Point (0, 0), r.Location);
+                       Assert.AreEqual (new Size (40, 50), r.Size);
+
+                       r = new Rect (new Point (4, 5), new Vector (20, 30));
+                       Assert.AreEqual (4, r.X);
+                       Assert.AreEqual (5, r.Y);
+                       Assert.AreEqual (20, r.Width);
+                       Assert.AreEqual (30, r.Height);
+                       Assert.AreEqual (4, r.Left);
+                       Assert.AreEqual (5, r.Top);
+                       Assert.AreEqual (24, r.Right);
+                       Assert.AreEqual (35, r.Bottom);
+                       Assert.AreEqual (new Point (4, 5), r.TopLeft);
+                       Assert.AreEqual (new Point (24, 5), r.TopRight);
+                       Assert.AreEqual (new Point (4, 35), r.BottomLeft);
+                       Assert.AreEqual (new Point (24, 35), r.BottomRight);
+                       Assert.AreEqual (new Point (4, 5), r.Location);
+                       Assert.AreEqual (new Size (20, 30), r.Size);
+
+                       r = new Rect (new Point (4, 5), new Point (20, 30));
+                       Assert.AreEqual (4, r.X);
+                       Assert.AreEqual (5, r.Y);
+                       Assert.AreEqual (16, r.Width);
+                       Assert.AreEqual (25, r.Height);
+                       Assert.AreEqual (4, r.Left);
+                       Assert.AreEqual (5, r.Top);
+                       Assert.AreEqual (20, r.Right);
+                       Assert.AreEqual (30, r.Bottom);
+                       Assert.AreEqual (new Point (4, 5), r.TopLeft);
+                       Assert.AreEqual (new Point (20, 5), r.TopRight);
+                       Assert.AreEqual (new Point (4, 30), r.BottomLeft);
+                       Assert.AreEqual (new Point (20, 30), r.BottomRight);
+                       Assert.AreEqual (new Point (4, 5), r.Location);
+                       Assert.AreEqual (new Size (16,25), r.Size);
+
+                       r = new Rect (new Point (20, 30), new Point (4, 5));
+                       Assert.AreEqual (4, r.X);
+                       Assert.AreEqual (5, r.Y);
+                       Assert.AreEqual (16, r.Width);
+                       Assert.AreEqual (25, r.Height);
+                       Assert.AreEqual (4, r.Left);
+                       Assert.AreEqual (5, r.Top);
+                       Assert.AreEqual (20, r.Right);
+                       Assert.AreEqual (30, r.Bottom);
+                       Assert.AreEqual (new Point (4, 5), r.TopLeft);
+                       Assert.AreEqual (new Point (20, 5), r.TopRight);
+                       Assert.AreEqual (new Point (4, 30), r.BottomLeft);
+                       Assert.AreEqual (new Point (20, 30), r.BottomRight);
+                       Assert.AreEqual (new Point (4, 5), r.Location);
+                       Assert.AreEqual (new Size (16,25), r.Size);
+
+                       r = new Rect (10, 15, 20, 30);
+                       Assert.AreEqual (10, r.X);
+                       Assert.AreEqual (15, r.Y);
+                       Assert.AreEqual (20, r.Width);
+                       Assert.AreEqual (30, r.Height);
+                       Assert.AreEqual (10, r.Left);
+                       Assert.AreEqual (15, r.Top);
+                       Assert.AreEqual (30, r.Right);
+                       Assert.AreEqual (45, r.Bottom);
+                       Assert.AreEqual (new Point (10, 15), r.TopLeft);
+                       Assert.AreEqual (new Point (30, 15), r.TopRight);
+                       Assert.AreEqual (new Point (10, 45), r.BottomLeft);
+                       Assert.AreEqual (new Point (30, 45), r.BottomRight);
+                       Assert.AreEqual (new Point (10, 15), r.Location);
+                       Assert.AreEqual (new Size (20, 30), r.Size);
+
+                       r = new Rect (new Point (10, 15), new Size (20, 30));
+                       Assert.AreEqual (10, r.X);
+                       Assert.AreEqual (15, r.Y);
+                       Assert.AreEqual (20, r.Width);
+                       Assert.AreEqual (30, r.Height);
+                       Assert.AreEqual (10, r.Left);
+                       Assert.AreEqual (15, r.Top);
+                       Assert.AreEqual (30, r.Right);
+                       Assert.AreEqual (45, r.Bottom);
+                       Assert.AreEqual (new Point (10, 15), r.TopLeft);
+                       Assert.AreEqual (new Point (30, 15), r.TopRight);
+                       Assert.AreEqual (new Point (10, 45), r.BottomLeft);
+                       Assert.AreEqual (new Point (30, 45), r.BottomRight);
+                       Assert.AreEqual (new Point (10, 15), r.Location);
+                       Assert.AreEqual (new Size (20, 30), r.Size);
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void Ctor_NegativeWidth ()
+               {
+                       new Rect (10, 10, -10, 10);
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void Ctor_NegativeHeight ()
+               {
+                       new Rect (10, 10, 10, -10);
+               }
+
+               [Test]
+               public void Empty ()
+               {
+                       Rect r = Rect.Empty;
+                       Assert.AreEqual (Double.PositiveInfinity, r.X);
+                       Assert.AreEqual (Double.PositiveInfinity, r.Y);
+                       Assert.AreEqual (Double.NegativeInfinity, r.Width);
+                       Assert.AreEqual (Double.NegativeInfinity, r.Height);
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void ModifyEmpty_x ()
+               {
+                       Rect r = Rect.Empty;
+                       r.X = 5;
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void ModifyEmpty_y ()
+               {
+                       Rect r = Rect.Empty;
+                       r.Y = 5;
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void ModifyEmpty_width ()
+               {
+                       Rect r = Rect.Empty;
+                       r.Width = 5;
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void ModifyEmpty_height ()
+               {
+                       Rect r = Rect.Empty;
+                       r.Height = 5;
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void ModifyEmpty_negative_width ()
+               {
+                       Rect r = Rect.Empty;
+                       r.Width = -5;
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void ModifyEmpty_negative_height ()
+               {
+                       Rect r = Rect.Empty;
+                       r.Height = -5;
+               }
+
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void Modify_negative_width ()
+               {
+                       Rect r = new Rect (0, 0, 10, 10);
+                       r.Width = -5;
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void Modify_negative_height ()
+               {
+                       Rect r = new Rect (0, 0, 10, 10);
+                       r.Height = -5;
+               }
+
+               [Test]
+               public void IsEmpty ()
+               {
+                       Assert.IsTrue (Rect.Empty.IsEmpty);
+                       Assert.IsFalse ((new Rect (5, 5, 5, 5)).IsEmpty);
+               }
+
+               [Test]
+               public void Location ()
+               {
+                       Rect r = new Rect (0, 0, 0, 0);
+
+                       r.Location = new Point (10, 15);
+                       Assert.AreEqual (10, r.X);
+                       Assert.AreEqual (15, r.Y);
+               }
+
+               [Test]
+               public void Size ()
+               {
+                       Rect r = new Rect (0, 0, 5, 5);
+
+                       r.Size = new Size (10, 15);
+                       Assert.AreEqual (10, r.Width);
+                       Assert.AreEqual (15, r.Height);
+               }
+
+               [Test]
+               public void ToStringTest ()
+               {
+                       Rect r = new Rect (1, 2, 3, 4);
+                       Assert.AreEqual ("1,2,3,4", r.ToString());
+
+                       Assert.AreEqual ("Empty", Rect.Empty.ToString());
+               }
+
+               [Test]
+               public void Parse ()
+               {
+                       Rect r = Rect.Parse ("1 , 2, 3, 4");
+                       Assert.AreEqual (new Rect (1, 2, 3, 4), r);
+               }
+
+               [Test]
+               public void Parse2 ()
+               {
+                       Rect r = Rect.Parse ("1 2 3 4");
+                       Assert.AreEqual (new Rect (1, 2, 3, 4), r);
+               }
+
+               [Test]
+               public void Parse3 ()
+               {
+                       Rect r = Rect.Parse ("  1 2 3 4  ");
+                       Assert.AreEqual (new Rect (1, 2, 3, 4), r);
+               }
+
+               [Test]
+               public void ParseWithBothSeparators ()
+               {
+                       Rect.Parse ("1.0, 3 2.0, 5.0");
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void ParseNegative ()
+               {
+                       Rect.Parse ("1, 2, -3, -4");
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))] // "Premature string termination encountered."
+               public void Parse3Doubles ()
+               {
+                       Rect.Parse ("1.0, 3, -5");
+               }
+
+               [Test]
+               [ExpectedException (typeof (FormatException))]
+               public void ParseInvalidString1 ()
+               {
+                       Rect.Parse ("1.0, 3, -x, 5.0");
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void ParseInvalidString3 ()
+               {
+                       Rect.Parse ("1.0, 3, 2.0, 5.0, 2");
+               }
+
+               [Test]
+               [ExpectedException (typeof (FormatException))]
+               public void ParseInvalidString4 ()
+               {
+                       Rect.Parse ("1.0-3, 2.0, 5.0, 2");
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void ParseInvalidString5 ()
+               {
+                       Rect.Parse ("1.0, 2.0, 5.0, 2,");
+               }
+
+               [Test]
+               public void ParseInvalidString6 ()
+               {
+                       Rect.Parse ("\n1.0, 2.0, 5.0, 2");
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void ParseInvalidString7 ()
+               {
+                       Rect r = Rect.Parse ("1,, 2, 3, 4");
+                       Assert.AreEqual (new Rect (1, 2, 3, 4), r);
+               }
+
+               [Test]
+               public void Equals ()
+               {
+                       Rect r1 = new Rect (1, 2, 3, 4);
+                       Rect r2 = r1;
+
+                       Assert.IsTrue (r1.Equals (r1));
+
+                       r2.X = 0;
+                       Assert.IsFalse (r1.Equals (r2));
+                       r2.X = r1.X;
+
+                       r2.Y = 0;
+                       Assert.IsFalse (r1.Equals (r2));
+                       r2.Y = r1.Y;
+
+                       r2.Width = 0;
+                       Assert.IsFalse (r1.Equals (r2));
+                       r2.Width = r1.Width;
+
+                       r2.Height = 0;
+                       Assert.IsFalse (r1.Equals (r2));
+                       r2.Height = r1.Height;
+
+                       Assert.IsFalse (r1.Equals (new object()));
+               }
+
+               [Test]
+               public void ContainsRect ()
+               {
+                       Rect r = new Rect (0, 0, 50, 50);
+
+                       // fully contained
+                       Assert.IsTrue (r.Contains (new Rect (10, 10, 10, 10)));
+
+                       // crosses top side
+                       Assert.IsFalse (r.Contains (new Rect (5, -5, 10, 10)));
+
+                       // crosses right side
+                       Assert.IsFalse (r.Contains (new Rect (5, 5, 50, 10)));
+
+                       // crosses bottom side
+                       Assert.IsFalse (r.Contains (new Rect (5, 5, 10, 50)));
+
+                       // crosses left side
+                       Assert.IsFalse (r.Contains (new Rect (-5, 5, 10, 10)));
+
+                       // completely outside (top)
+                       Assert.IsFalse (r.Contains (new Rect (5, -5, 1, 1)));
+
+                       // completely outside (right)
+                       Assert.IsFalse (r.Contains (new Rect (75, 5, 1, 1)));
+
+                       // completely outside (bottom)
+                       Assert.IsFalse (r.Contains (new Rect (5, 75, 1, 1)));
+
+                       // completely outside (left)
+                       Assert.IsFalse (r.Contains (new Rect (-25, 5, 1, 1)));
+               }
+
+               [Test]
+               public void ContainsDoubles ()
+               {
+                       Rect r = new Rect (0, 0, 50, 50);
+
+                       Assert.IsTrue (r.Contains (10, 10));
+                       Assert.IsFalse (r.Contains (-5, -5));
+               }
+
+               [Test]
+               public void ContainsPoint ()
+               {
+                       Rect r = new Rect (0, 0, 50, 50);
+
+                       Assert.IsTrue (r.Contains (new Point (10, 10)));
+                       Assert.IsFalse (r.Contains (new Point (-5, -5)));
+               }
+
+               [Test]
+               public void Inflate ()
+               {
+                       Rect r = Rect.Inflate (new Rect (0, 0, 20, 20), 10, 15);
+                       Assert.AreEqual (new Rect (-10, -15, 40, 50), r);
+
+                       r = Rect.Inflate (new Rect (0, 0, 20, 20), new Size (10, 15));
+                       Assert.AreEqual (new Rect (-10, -15, 40, 50), r);
+
+                       r = new Rect (0, 0, 20, 20);
+                       r.Inflate (10, 15);
+                       Assert.AreEqual (new Rect (-10, -15, 40, 50), r);
+
+                       r = new Rect (0, 0, 20, 20);
+                       r.Inflate (new Size (10, 15));
+                       Assert.AreEqual (new Rect (-10, -15, 40, 50), r);
+               }
+
+               [Test]
+               public void IntersectsWith ()
+               {
+                       Rect r = new Rect (0, 0, 50, 50);
+
+                       // fully contained
+                       Assert.IsTrue (r.IntersectsWith (new Rect (10, 10, 10, 10)));
+
+                       // crosses top side
+                       Assert.IsTrue (r.IntersectsWith (new Rect (5, -5, 10, 10)));
+
+                       // crosses right side
+                       Assert.IsTrue (r.IntersectsWith (new Rect (5, 5, 50, 10)));
+
+                       // crosses bottom side
+                       Assert.IsTrue (r.IntersectsWith (new Rect (5, 5, 10, 50)));
+
+                       // crosses left side
+                       Assert.IsTrue (r.IntersectsWith (new Rect (-5, 5, 10, 10)));
+
+                       // completely outside (top)
+                       Assert.IsFalse (r.IntersectsWith (new Rect (5, -5, 1, 1)));
+
+                       // completely outside (right)
+                       Assert.IsFalse (r.IntersectsWith (new Rect (75, 5, 1, 1)));
+
+                       // completely outside (bottom)
+                       Assert.IsFalse (r.IntersectsWith (new Rect (5, 75, 1, 1)));
+
+                       // completely outside (left)
+                       Assert.IsFalse (r.IntersectsWith (new Rect (-25, 5, 1, 1)));
+               }
+
+               [Test]
+               public void Intersect ()
+               {
+                       Rect r;
+
+                       // fully contained
+                       r = new Rect (0, 0, 50, 50);
+                       r.Intersect (new Rect (10, 10, 10, 10));
+                       Assert.AreEqual (new Rect (10, 10, 10, 10), r);
+
+                       // crosses top side
+                       r = new Rect (0, 0, 50, 50);
+                       r.Intersect (new Rect (5, -5, 10, 10));
+                       Assert.AreEqual (new Rect (5, 0, 10, 5), r);
+
+                       // crosses right side
+                       r = new Rect (0, 0, 50, 50);
+                       r.Intersect (new Rect (5, 5, 50, 10));
+                       Assert.AreEqual (new Rect (5, 5, 45, 10), r);
+
+                       // crosses bottom side
+                       r = new Rect (0, 0, 50, 50);
+                       r.Intersect (new Rect (5, 5, 10, 50));
+
+                       // crosses left side
+                       r = new Rect (0, 0, 50, 50);
+                       r.Intersect (new Rect (-5, 5, 10, 10));
+
+                       // completely outside (top)
+                       r = new Rect (0, 0, 50, 50);
+                       r.Intersect (new Rect (5, -5, 1, 1));
+                       Assert.AreEqual (Rect.Empty, r);
+
+                       // completely outside (right)
+                       r = new Rect (0, 0, 50, 50);
+                       r.Intersect (new Rect (75, 5, 1, 1));
+                       Assert.AreEqual (Rect.Empty, r);
+
+                       // completely outside (bottom)
+                       r = new Rect (0, 0, 50, 50);
+                       r.Intersect (new Rect (5, 75, 1, 1));
+                       Assert.AreEqual (Rect.Empty, r);
+
+                       // completely outside (left)
+                       r = new Rect (0, 0, 50, 50);
+                       r.Intersect (new Rect (-25, 5, 1, 1));
+                       Assert.AreEqual (Rect.Empty, r);
+               }
+
+
+               [Test]
+               public void Equals_Operator ()
+               {
+                       Rect r1 = new Rect (1, 2, 30, 30);
+                       Rect r2 = new Rect (1, 2, 30, 30);
+
+                       Assert.AreEqual (true,  r1 == r2);
+                       Assert.AreEqual (false, r1 != r2);
+
+                       r2 = new Rect (10, 20, 30, 30);
+
+                       Assert.AreEqual (false, r1 == r2);
+                       Assert.AreEqual (true,  r1 != r2);
+
+               }
+
+       }
+}
diff --git a/mcs/class/WindowsBase/Test/System.Windows/SizeConverterTest.cs b/mcs/class/WindowsBase/Test/System.Windows/SizeConverterTest.cs
new file mode 100644 (file)
index 0000000..f88a5f5
--- /dev/null
@@ -0,0 +1,97 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows;
+using System.Windows.Media;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows {
+
+       [TestFixture]
+       [Category ("NotWorking")]
+       public class SizeConverterTest
+       {
+               [Test]
+               public void CanConvertFrom ()
+               {
+                       SizeConverter r = new SizeConverter ();
+
+                       Assert.IsTrue (r.CanConvertFrom (typeof (string)));
+                       Assert.IsFalse (r.CanConvertFrom (typeof (Size)));
+               }
+
+               [Test]
+               public void CanConvertTo ()
+               {
+                       SizeConverter r = new SizeConverter ();
+
+                       Assert.IsTrue (r.CanConvertTo (typeof (string)));
+                       Assert.IsFalse (r.CanConvertTo (typeof (Size)));
+               }
+
+               [Test]
+               public void ConvertFrom ()
+               {
+                       SizeConverter r = new SizeConverter ();
+
+                       object or = r.ConvertFrom ("3, 4");
+                       
+                       Assert.AreEqual (typeof (Size), or.GetType());
+                       Assert.AreEqual (new Size (3, 4), or);
+               }
+
+               [Test]
+               [ExpectedException (typeof (NotSupportedException))]
+               public void ConvertFrom_size ()
+               {
+                       SizeConverter r = new SizeConverter ();
+
+                       r.ConvertFrom (new Size (10, 20));
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void ConvertFrom_negative ()
+               {
+                       SizeConverter r = new SizeConverter ();
+                       r.ConvertFrom ("-1, -4");
+               }
+
+               [Test]
+               public void ConvertTo ()
+               {
+                       SizeConverter r = new SizeConverter ();
+
+                       Size rect = new Size (1, 2);
+
+                       object o = r.ConvertTo (rect, typeof (string));
+                       
+                       Assert.AreEqual (typeof (string), o.GetType());
+                       Assert.AreEqual ("1,2", (string)o);
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/Test/System.Windows/SizeTest.cs b/mcs/class/WindowsBase/Test/System.Windows/SizeTest.cs
new file mode 100644 (file)
index 0000000..7723bb7
--- /dev/null
@@ -0,0 +1,157 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows;
+using System.Windows.Media;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows {
+
+       [TestFixture]
+       [Category ("NotWorking")]
+       public class SizeTest
+       {
+               [Test]
+               public void Ctor_Accessors ()
+               {
+                       Size s = new Size (10, 20);
+                       Assert.AreEqual (10, s.Width);
+                       Assert.AreEqual (20, s.Height);
+               }
+
+               [Test]
+               public void Equals ()
+               {
+                       Size s = new Size (10, 20);
+
+                       Assert.IsTrue (s.Equals (s));
+                       Assert.IsTrue (s.Equals (new Size (10, 20)));
+
+                       Assert.IsTrue (Size.Equals (s, s));
+
+                       Assert.IsFalse (s.Equals (new Size (5, 10)));
+                       Assert.IsFalse (Size.Equals (s, new Size (5, 10)));
+
+                       Assert.IsFalse (s.Equals (new object()));
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void Ctor_negative_width()
+               {
+                       new Size (-10, 5);
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void Ctor_negative_height()
+               {
+                       new Size (5, -10);
+               }
+
+               [Test]
+               public void Modify_width ()
+               {
+                       Size s = new Size (10, 10);
+                       s.Width = 20;
+                       Assert.AreEqual (new Size (20, 10), s);
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void ModifyEmpty_width ()
+               {
+                       Size s = Size.Empty;
+                       s.Width = 20;
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void Modify_negative_width ()
+               {
+                       Size s = new Size (10, 10);
+                       s.Width = -20;
+               }
+
+               [Test]
+               public void Modify_height ()
+               {
+                       Size s = new Size (10, 10);
+                       s.Height = 20;
+                       Assert.AreEqual (new Size (10, 20), s);
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void ModifyEmpty_height ()
+               {
+                       Size s = Size.Empty;
+                       s.Height = 20;
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void Modify_negative_height ()
+               {
+                       Size s = new Size (10, 10);
+                       s.Height = -20;
+               }
+
+               [Test]
+               public void Parse ()
+               {
+                       Assert.AreEqual (new Size (1, 2), Size.Parse ("1, 2"));
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void ParseNegative ()
+               {
+                       Assert.AreEqual (new Size (-1, 2), Size.Parse ("-1, 2"));
+               }
+
+               [Test]
+               public void ToStringTest ()
+               {
+                       Assert.AreEqual ("1,2", (new Size (1, 2)).ToString());
+               }
+
+               [Test]
+               public void Empty ()
+               {
+                       Assert.AreEqual (Double.NegativeInfinity, Size.Empty.Width);
+                       Assert.AreEqual (Double.NegativeInfinity, Size.Empty.Height);
+               }
+
+               [Test]
+               public void IsEmpty ()
+               {
+                       Assert.IsTrue (Size.Empty.IsEmpty);
+                       Assert.IsFalse ((new Size (10, 10)).IsEmpty);
+                       Assert.IsFalse ((new Size (0, 0)).IsEmpty);
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/Test/System.Windows/VectorConverterTest.cs b/mcs/class/WindowsBase/Test/System.Windows/VectorConverterTest.cs
new file mode 100644 (file)
index 0000000..61a87e6
--- /dev/null
@@ -0,0 +1,93 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows;
+using System.Windows.Media;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows {
+
+       [TestFixture]
+       [Category ("NotWorking")]
+       public class VectorConverterTest
+       {
+               [Test]
+               public void CanConvertFrom ()
+               {
+                       VectorConverter r = new VectorConverter ();
+
+                       Assert.IsTrue (r.CanConvertFrom (typeof (string)));
+                       Assert.IsFalse (r.CanConvertFrom (typeof (Vector)));
+               }
+
+               [Test]
+               public void CanConvertTo ()
+               {
+                       VectorConverter r = new VectorConverter ();
+
+                       Assert.IsTrue (r.CanConvertTo (typeof (string)));
+                       Assert.IsFalse (r.CanConvertTo (typeof (Vector)));
+               }
+
+               [Test]
+               public void ConvertFrom ()
+               {
+                       VectorConverter r = new VectorConverter ();
+
+                       object or = r.ConvertFrom ("3, 4");
+                       
+                       Assert.AreEqual (typeof (Vector), or.GetType());
+                       Assert.AreEqual (new Vector (3, 4), or);
+
+                       or = r.ConvertFrom ("-1, -4");
+                       Assert.AreEqual (typeof (Vector), or.GetType());
+                       Assert.AreEqual (new Vector (-1, -4), or);
+               }
+
+               [Test]
+               [ExpectedException (typeof (NotSupportedException))]
+               public void ConvertFrom_size ()
+               {
+                       VectorConverter r = new VectorConverter ();
+
+                       r.ConvertFrom (new Vector (10, 20));
+               }
+
+               [Test]
+               public void ConvertTo ()
+               {
+                       VectorConverter r = new VectorConverter ();
+
+                       Vector rect = new Vector (1, 2);
+
+                       object o = r.ConvertTo (rect, typeof (string));
+                       
+                       Assert.AreEqual (typeof (string), o.GetType());
+                       Assert.AreEqual ("1,2", (string)o);
+               }
+       }
+
+}
diff --git a/mcs/class/WindowsBase/Test/System.Windows/VectorTest.cs b/mcs/class/WindowsBase/Test/System.Windows/VectorTest.cs
new file mode 100644 (file)
index 0000000..cb299f4
--- /dev/null
@@ -0,0 +1,179 @@
+// 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.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok (toshok@ximian.com)
+//
+
+using System;
+using System.Windows;
+using System.Windows.Media;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows {
+
+       [TestFixture]
+       [Category ("NotWorking")]
+       public class VectorTest
+       {
+               [Test]
+               public void Accessors ()
+               {
+                       Vector v = new Vector (4, 5);
+                       Assert.AreEqual (4, v.X);
+                       Assert.AreEqual (5, v.Y);
+               }
+
+               [Test]
+               public void Equals ()
+               {
+                       Vector v = new Vector (4, 5);
+                       Assert.IsTrue (v.Equals (new Vector (4, 5)));
+                       Assert.IsFalse (v.Equals (new Vector (5, 4)));
+                       Assert.IsFalse (v.Equals (new object()));
+               }
+
+               [Test]
+               public void ToStringTest ()
+               {
+                       Vector v = new Vector (4, 5);
+                       Assert.AreEqual ("4,5", v.ToString());
+               }
+
+               [Test]
+               public void Parse ()
+               {
+                       Vector v = Vector.Parse ("4,5");
+                       Assert.AreEqual (new Vector (4, 5), v);
+
+                       v = Vector.Parse ("-4,-5");
+                       Assert.AreEqual (new Vector (-4, -5), v);
+
+                       v = Vector.Parse ("-4.4,-5.5");
+                       Assert.AreEqual (new Vector (-4.4, -5.5), v);
+               }
+
+               [Test]
+               public void Add ()
+               {
+                       Point p = Vector.Add (new Vector (2, 3), new Point (4, 5));
+                       Assert.AreEqual (new Point (6, 8), p);
+
+                       Vector v = Vector.Add (new Vector (2, 3), new Vector (4, 5));
+                       Assert.AreEqual (new Vector (6, 8), v);
+               }
+
+               [Test]
+               public void Length ()
+               {
+                       Vector v = new Vector (1, 0);
+                       Assert.AreEqual (1, v.LengthSquared);
+                       Assert.AreEqual (1, v.Length);
+
+                       v = new Vector (5, 5);
+                       Assert.AreEqual (50, v.LengthSquared);
+                       Assert.AreEqual (Math.Sqrt(50), v.Length);
+               }
+
+               [Test]
+               public void AngleBetween ()
+               {
+                       double angle = Vector.AngleBetween (new Vector (1, 0), new Vector (0, 1));
+                       Assert.AreEqual (90, angle);
+
+                       angle = Vector.AngleBetween (new Vector (1, 0), new Vector (0.5, 0.5));
+                       Assert.AreEqual (45, angle);
+               }
+
+               [Test]
+               public void CrossProduct ()
+               {
+                       Assert.AreEqual (1, Vector.CrossProduct (new Vector (1, 0), new Vector (0, 1)));
+                       Assert.AreEqual (50, Vector.CrossProduct (new Vector (20, 30), new Vector (45, 70)));
+               }
+
+               [Test]
+               public void Determinant ()
+               {
+                       Assert.AreEqual (1, Vector.Determinant (new Vector (1, 0), new Vector (0, 1)));
+                       Assert.AreEqual (50, Vector.Determinant (new Vector (20, 30), new Vector (45, 70)));
+               }
+
+               [Test]
+               public void Divide ()
+               {
+                       Assert.AreEqual (new Vector (5, 7), Vector.Divide (new Vector (10, 14), 2));
+               }
+
+               [Test]
+               public void Multiply_VV_M ()
+               {
+                       Assert.AreEqual (60, Vector.Multiply (new Vector (5, 7), new Vector (5, 5)));
+               }
+
+               [Test]
+               public void Multiply_VM_V ()
+               {
+                       Matrix m = Matrix.Identity;
+                       m.Rotate (45);
+
+                       Console.WriteLine (Vector.Multiply (new Vector (3, 4), m));
+               }
+
+               [Test]
+               public void Multiply_dV_V ()
+               {
+                       Assert.AreEqual (new Vector (10, 18), Vector.Multiply (2, new Vector (5, 9)));
+               }
+
+               [Test]
+               public void Multiply_Vd_V ()
+               {
+                       Assert.AreEqual (new Vector (10, 18), Vector.Multiply (new Vector (5, 9), 2));
+               }
+
+               [Test]
+               public void Negate ()
+               {
+                       Vector v = new Vector (4, 5);
+                       v.Negate ();
+
+                       Assert.AreEqual (new Vector (-4, -5), v);
+               }
+
+               [Test]
+               public void Normalize ()
+               {
+                       Vector v = new Vector (5, 5);
+                       v.Normalize ();
+
+                       Assert.AreEqual (v.X, v.Y);
+                       Assert.AreEqual (1, v.Length);
+               }
+
+               [Test]
+               public void Subtract ()
+               {
+                       Assert.AreEqual (new Vector (3, 4), Vector.Subtract (new Vector (5, 7), new Vector (2, 3)));
+               }
+       }
+}
+
diff --git a/mcs/class/WindowsBase/WindowsBase.dll.sources b/mcs/class/WindowsBase/WindowsBase.dll.sources
new file mode 100644 (file)
index 0000000..8d24782
--- /dev/null
@@ -0,0 +1,186 @@
+System.Collections.ObjectModel/ObservableCollection.cs
+System.Collections.ObjectModel/ReadOnlyObservableCollection.cs
+System.Collections.Specialized/CollectionChangedEventManager.cs
+System.Collections.Specialized/INotifyCollectionChanged.cs
+System.Collections.Specialized/NotifyCollectionChangedAction.cs
+System.Collections.Specialized/NotifyCollectionChangedEventArgs.cs
+System.Collections.Specialized/NotifyCollectionChangedEventHandler.cs
+System.ComponentModel/CurrentChangedEventManager.cs
+System.ComponentModel/CurrentChangingEventArgs.cs
+System.ComponentModel/CurrentChangingEventManager.cs
+System.ComponentModel/CurrentChangingEventHandler.cs
+System.ComponentModel/DependencyPropertyDescriptor.cs
+System.ComponentModel/GroupDescription.cs
+System.ComponentModel/ICollectionView.cs
+System.ComponentModel/ICollectionViewFactory.cs
+System.ComponentModel/PropertyChangedEventManager.cs
+System.ComponentModel/PropertyFilterAttribute.cs
+System.ComponentModel/PropertyFilterOptions.cs
+System.ComponentModel/SortDescription.cs
+System.ComponentModel/SortDescriptionCollection.cs
+System.Diagnostics/PresentationTraceLevel.cs
+System.Diagnostics/PresentationTraceSources.cs
+System.IO/FileFormatException.cs
+System.IO.Packaging/CertificateEmbeddingOption.cs
+System.IO.Packaging/CompressionOption.cs
+System.IO.Packaging/Check.cs
+System.IO.Packaging/EncryptedPackageEnvelope.cs
+System.IO.Packaging/EncryptionOption.cs
+System.IO.Packaging/InvalidSignatureEventHandler.cs
+System.IO.Packaging/PackUriHelper.cs
+System.IO.Packaging/Package.cs
+System.IO.Packaging/PackageDigitalSignature.cs
+System.IO.Packaging/PackageDigitalSignatureManager.cs
+System.IO.Packaging/PackagePart.cs
+System.IO.Packaging/PackagePartCollection.cs
+System.IO.Packaging/PackageProperties.cs
+System.IO.Packaging/PackageRelationship.cs
+System.IO.Packaging/PackageRelationshipCollection.cs
+System.IO.Packaging/PackageRelationshipSelector.cs
+System.IO.Packaging/PackageRelationshipSelectorType.cs
+System.IO.Packaging/PackUriParser.cs
+System.IO.Packaging/RightsManagementInformation.cs
+System.IO.Packaging/SignatureVerificationEventArgs.cs
+System.IO.Packaging/StorageInfo.cs
+System.IO.Packaging/StreamInfo.cs
+System.IO.Packaging/TargetMode.cs
+System.IO.Packaging/VerifyResult.cs
+System.IO.Packaging/ZipPackage.cs
+System.IO.Packaging/ZipPackagePart.cs
+System.IO.Packaging/ZipPartStream.cs
+System.Security.Permissions/MediaPermission.cs
+System.Security.Permissions/MediaPermissionAttribute.cs
+System.Security.Permissions/MediaPermissionAudio.cs
+System.Security.Permissions/MediaPermissionImage.cs
+System.Security.Permissions/MediaPermissionVideo.cs
+System.Security.Permissions/WebBrowserPermission.cs
+System.Security.Permissions/WebBrowserPermissionAttribute.cs
+System.Security.Permissions/WebBrowserPermissionLevel.cs
+System.Security.RightsManagement/AuthenticationType.cs
+System.Security.RightsManagement/ContentGrant.cs
+System.Security.RightsManagement/ContentRight.cs
+System.Security.RightsManagement/ContentUser.cs
+System.Security.RightsManagement/CryptoProvider.cs
+System.Security.RightsManagement/LocalizedNameDescriptionPair.cs
+System.Security.RightsManagement/PublishLicense.cs
+System.Security.RightsManagement/RightsManagementException.cs
+System.Security.RightsManagement/RightsManagementFailureCode.cs
+System.Security.RightsManagement/SecureEnvironment.cs
+System.Security.RightsManagement/UnsignedPublishLicense.cs
+System.Security.RightsManagement/UseLicense.cs
+System.Security.RightsManagement/UserActivationMode.cs
+System.Windows/AttachedPropertyBrowsableAttribute.cs
+System.Windows/AttachedPropertyBrowsableForTypeAttribute.cs
+System.Windows/AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
+System.Windows/CoerceValueCallback.cs
+System.Windows/DependencyObject.cs
+System.Windows/DependencyObjectType.cs
+System.Windows/DependencyProperty.cs
+System.Windows/DependencyPropertyChangedEventArgs.cs
+System.Windows/DependencyPropertyChangedEventHandler.cs
+System.Windows/DependencyPropertyKey.cs
+System.Windows/Expression.cs
+System.Windows/ExpressionConverter.cs
+System.Windows/Freezable.cs
+System.Windows/Int32Rect.cs
+System.Windows/Int32RectConverter.cs
+System.Windows/IWeakEventListener.cs
+System.Windows/LocalValueEntry.cs
+System.Windows/LocalValueEnumerator.cs
+System.Windows/Point.cs
+System.Windows/PointConverter.cs
+System.Windows/PropertyChangedCallback.cs
+System.Windows/PropertyMetadata.cs
+System.Windows/Rect.cs
+System.Windows/RectConverter.cs
+System.Windows/Size.cs
+System.Windows/SizeConverter.cs
+System.Windows/ValidateValueCallback.cs
+System.Windows/Vector.cs
+System.Windows/VectorConverter.cs
+System.Windows/WeakEventManager.cs
+System.Windows.Converters/Int32RectValueSerializer.cs
+System.Windows.Converters/PointValueSerializer.cs
+System.Windows.Converters/RectValueSerializer.cs
+System.Windows.Converters/SizeValueSerializer.cs
+System.Windows.Converters/VectorValueSerializer.cs
+System.Windows.Data/DataSourceProvider.cs
+System.Windows.Input/Key.cs
+System.Windows.Input/KeyConverter.cs
+System.Windows.Input/KeyValueSerializer.cs
+System.Windows.Input/KeyInterop.cs
+System.Windows.Input/FocusNavigationDirection.cs
+System.Windows.Input/ModifierKeys.cs
+System.Windows.Input/ModifierKeysConverter.cs
+System.Windows.Input/ModifierKeysValueSerializer.cs
+System.Windows.Input/TraversalRequest.cs
+System.Windows.Interop/ComponentDispatcher.cs
+System.Windows.Interop/IKeyboardInputSink.cs
+System.Windows.Interop/IKeyboardInputSite.cs
+System.Windows.Interop/MSG.cs
+System.Windows.Interop/ThreadMessageEventHandler.cs
+System.Windows.Markup/ContentPropertyAttribute.cs
+System.Windows.Markup/ContentWrapperAttribute.cs
+System.Windows.Markup/ConstructorArgumentAttribute.cs
+System.Windows.Markup/DateTimeValueSerializer.cs
+System.Windows.Markup/DependsOnAttribute.cs
+System.Windows.Markup/DesignerSerializationOptions.cs
+System.Windows.Markup/DesignerSerializationOptionsAttribute.cs
+System.Windows.Markup/IComponentConnector.cs
+System.Windows.Markup/INameScope.cs
+System.Windows.Markup/IValueSerializerContext.cs
+System.Windows.Markup/IXamlTypeResolver.cs
+System.Windows.Markup/InternalTypeHelper.cs
+System.Windows.Markup/MarkupExtension.cs
+System.Windows.Markup/MarkupExtensionReturnTypeAttribute.cs
+System.Windows.Markup/RootNamespaceAttribute.cs
+System.Windows.Markup/RuntimeNamePropertyAttribute.cs
+System.Windows.Markup/ServiceProviders.cs
+System.Windows.Markup/TrimSurroundingWhitespaceAttribute.cs
+System.Windows.Markup/ValueSerializer.cs
+System.Windows.Markup/ValueSerializerAttribute.cs
+System.Windows.Markup/WhitespaceSignificantCollectionAttribute.cs
+System.Windows.Markup/XmlLangPropertyAttribute.cs
+System.Windows.Markup/XmlnsCompatibleWithAttribute.cs
+System.Windows.Markup/XmlnsDefinitionAttribute.cs
+System.Windows.Markup/XmlnsPrefixAttribute.cs
+System.Windows.Markup.Primitives/MarkupObject.cs
+System.Windows.Markup.Primitives/MarkupProperty.cs
+System.Windows.Media/DisableDpiAwarenessAttribute.cs
+System.Windows.Media/Matrix.cs
+System.Windows.Media/MatrixConverter.cs
+System.Windows.Media.Converters/MatrixValueSerializer.cs
+System.Windows.Threading/Dispatcher.cs
+System.Windows.Threading/DispatcherEventArgs.cs
+System.Windows.Threading/DispatcherFrame.cs
+System.Windows.Threading/DispatcherHookEventArgs.cs
+System.Windows.Threading/DispatcherHookEventHandler.cs
+System.Windows.Threading/DispatcherHooks.cs
+System.Windows.Threading/DispatcherObject.cs
+System.Windows.Threading/DispatcherOperation.cs
+System.Windows.Threading/DispatcherOperationCallback.cs
+System.Windows.Threading/DispatcherOperationStatus.cs
+System.Windows.Threading/DispatcherPriority.cs
+System.Windows.Threading/DispatcherProcessingDisabled.cs
+System.Windows.Threading/DispatcherSynchronizationContext.cs
+System.Windows.Threading/DispatcherTimer.cs
+System.Windows.Threading/DispatcherUnhandledExceptionEventArgs.cs
+System.Windows.Threading/DispatcherUnhandledExceptionEventHandler.cs
+System.Windows.Threading/DispatcherUnhandledExceptionFilterEventArgs.cs
+System.Windows.Threading/DispatcherUnhandledExceptionFilterEventHandler.cs
+ZipSharp/IOFunctions.cs
+ZipSharp/ZipArchive.cs
+ZipSharp/UnzipArchive.cs
+ZipSharp/NativeUnzip.cs
+ZipSharp/UnzipFileInfo.cs
+ZipSharp/UnzipReadStream.cs
+ZipSharp/ZipHandle.cs
+ZipSharp/UnzipHandle.cs
+ZipSharp/ZipStream.cs
+ZipSharp/ZipFileInfo.cs
+ZipSharp/NativeZip.cs
+ZipSharp/ZipTime.cs
+ZipSharp/ZipWriteStream.cs
+../../build/common/MonoTODOAttribute.cs
+Assembly/AssemblyInfo.cs
+../../build/common/Consts.cs
diff --git a/mcs/class/WindowsBase/WindowsBase_test.dll.sources b/mcs/class/WindowsBase/WindowsBase_test.dll.sources
new file mode 100644 (file)
index 0000000..a120a3a
--- /dev/null
@@ -0,0 +1,35 @@
+System.Collections.ObjectModel/ObservableCollectionTest.cs
+System.IO.Packaging/FakePackage.cs
+System.IO.Packaging/FakePackagePart.cs
+System.IO.Packaging/FakePackagePartTests.cs
+System.IO.Packaging/FakePackageTests.cs
+System.IO.Packaging/FakeStream.cs
+System.IO.Packaging/PackagePartStreamTests.cs
+System.IO.Packaging/PackagePartTest.cs
+System.IO.Packaging/PackageRelationshipTests.cs
+System.IO.Packaging/PackageTest.cs
+System.IO.Packaging/PackUriHelperTests.cs
+System.IO.Packaging/TestBase.cs
+System.Windows/DependencyObjectTest.cs
+System.Windows/DependencyObjectTypeTest.cs
+System.Windows/DependencyPropertyTest.cs
+System.Windows/Int32RectTest.cs
+System.Windows/Int32RectConverterTest.cs
+System.Windows/PointTest.cs
+System.Windows/PointConverterTest.cs
+System.Windows/PropertyMetadataTest.cs
+System.Windows/RectTest.cs
+System.Windows/RectConverterTest.cs
+System.Windows/SizeTest.cs
+System.Windows/SizeConverterTest.cs
+System.Windows/VectorTest.cs
+System.Windows/VectorConverterTest.cs
+System.Windows.Markup/ConstructorArgumentAttributeTest.cs
+System.Windows.Markup/ContentPropertyAttributeTest.cs
+System.Windows.Markup/ContentWrapperAttributeTest.cs
+System.Windows.Markup/DateTimeValueSerializerTest.cs
+System.Windows.Markup/DependsOnAttributeTest.cs
+System.Windows.Markup/MarkupExtensionReturnTypeAttributeTest.cs
+System.Windows.Markup/ValueSerializerTest.cs
+System.Windows.Media/MatrixTest.cs
+System.Windows.Threading/DispatcherTest.cs
diff --git a/mcs/class/WindowsBase/ZipSharp/IOFunctions.cs b/mcs/class/WindowsBase/ZipSharp/IOFunctions.cs
new file mode 100644 (file)
index 0000000..ade29a8
--- /dev/null
@@ -0,0 +1,43 @@
+// IOFunctions.cs created with MonoDevelop
+// User: alan at 14:43 20/10/2008
+//
+// To change standard headers go to Edit->Preferences->Coding->Standard Headers
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace zipsharp
+{
+       // this matches a native 'enum', don't modify
+       enum Append
+       {
+               Create = 0,
+               CreateAfter = 1,
+               AddInZip = 2
+       }
+       
+       internal delegate IntPtr OpenFileFunc (IntPtr opaque, string filename, int mode);
+
+       internal delegate /* ulong */ IntPtr ReadFileFunc (IntPtr opaque, IntPtr stream, IntPtr buffer, /* ulong */ IntPtr size);
+       internal delegate /* ulong */ IntPtr WriteFileFunc (IntPtr opaque, IntPtr stream, IntPtr buffer, /* ulong */ IntPtr size);
+
+       internal delegate /* long */ IntPtr TellFileFunc (IntPtr opaque, IntPtr stream);
+       internal delegate /* long */ IntPtr SeekFileFunc (IntPtr opaque, IntPtr stream, /* ulong */ IntPtr offset, int origin);
+
+       internal delegate int CloseFileFunc (IntPtr opaque, IntPtr stream);
+       internal delegate int TestErrorFileFunc (IntPtr opaque, IntPtr stream);
+
+       [StructLayout (LayoutKind.Sequential)]
+       internal struct ZlibFileFuncDef
+       {
+               [MarshalAs (UnmanagedType.FunctionPtr)] public OpenFileFunc      zopen_file;
+               [MarshalAs (UnmanagedType.FunctionPtr)] public ReadFileFunc      zread_file;
+               [MarshalAs (UnmanagedType.FunctionPtr)] public WriteFileFunc     zwrite_file;
+               [MarshalAs (UnmanagedType.FunctionPtr)] public TellFileFunc      ztell_file;
+               [MarshalAs (UnmanagedType.FunctionPtr)] public SeekFileFunc      zseek_file;
+               [MarshalAs (UnmanagedType.FunctionPtr)] public CloseFileFunc     zclose_file;
+               [MarshalAs (UnmanagedType.FunctionPtr)] public TestErrorFileFunc zerror_file;
+               [MarshalAs (UnmanagedType.FunctionPtr)] public IntPtr            opaque;
+       }
+}
diff --git a/mcs/class/WindowsBase/ZipSharp/NativeUnzip.cs b/mcs/class/WindowsBase/ZipSharp/NativeUnzip.cs
new file mode 100644 (file)
index 0000000..c7134cf
--- /dev/null
@@ -0,0 +1,163 @@
+// NativeUnzip.cs created with MonoDevelop
+// User: alan at 13:11 20/10/2008
+//
+// To change standard headers go to Edit->Preferences->Coding->Standard Headers
+//
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace zipsharp
+{
+       static class NativeUnzip
+       {
+               enum ZipStringComparison
+               {
+                       OSDefault = 0,
+                       CaseSensitive = 1,
+                       CaseInsensitive = 2
+               }
+               
+               public static void CloseArchive (UnzipHandle handle)
+               {
+                       unzClose (handle);
+                       handle.SetHandleAsInvalid ();
+               }
+
+               public static void CloseCurrentFile (UnzipHandle handle)
+               {
+                       if (unzCloseCurrentFile (handle) != 0)
+                               throw new Exception ("Could not close the active file");
+               }
+
+               public static long CurrentFilePosition (UnzipHandle handle)
+               {
+                       return unztell(handle).ToInt64 ();
+               }
+
+               public static long CurrentFileLength (UnzipHandle handle)
+               {
+                       UnzipFileInfo info;
+                       StringBuilder sbName = new StringBuilder (128);
+                       int result = unzGetCurrentFileInfo (handle, out info, sbName, new IntPtr (sbName.Capacity), IntPtr.Zero, IntPtr.Zero, null,  IntPtr.Zero);
+                       
+                       if (result != 0)
+                               return -1;
+                       else
+                               return (long)info.UncompressedSize;
+               }
+               
+               static string GetCurrentFileName (UnzipHandle handle)
+               {
+                       UnzipFileInfo info;
+                       StringBuilder sbName = new StringBuilder (128);
+                       int result = unzGetCurrentFileInfo (handle, out info, sbName, new IntPtr (sbName.Capacity), IntPtr.Zero, new IntPtr (0), null,  IntPtr.Zero);
+                       
+                       if (result != 0)
+                               return null;
+                       else
+                               return sbName.ToString ();
+               }
+
+               public static string[] GetFiles (UnzipHandle handle)
+               {
+                       List<string> files = new List<string> ();
+
+                       GoToFirstFile (handle);
+
+                       string name;
+                       while ((name = GetCurrentFileName(handle)) != null)
+                       {
+                               files.Add (name);
+                               if (!NativeUnzip.GoToNextFile (handle))
+                                       break;
+                       }
+                       
+                       return files.ToArray ();
+               }
+
+               static void GoToFirstFile (UnzipHandle handle)
+               {
+                       if (NativeUnzip.unzGoToFirstFile (handle) != 0)
+                               throw new Exception ("Zip file is invalid");
+               }
+
+               static bool GoToNextFile (UnzipHandle handle)
+               {
+                       return unzGoToNextFile(handle) == 0;
+               }
+               
+               public static UnzipHandle OpenArchive (ZlibFileFuncDef fileFuncs)
+               {
+                       UnzipHandle handle = unzOpen2 ("", ref fileFuncs);
+                       if (handle.IsInvalid)
+                               throw new Exception ("Could not open unzip archive");
+                       return handle;
+               }
+
+               public static void OpenFile (UnzipHandle handle, string name)
+               {
+                       if (unzLocateFile (handle, name, (int) ZipStringComparison.CaseInsensitive) != 0)
+                               throw new Exception ("The file doesn't exist");
+                       if (unzOpenCurrentFile (handle) != 0)
+                               throw new Exception ("The file could not be opened");
+               }
+
+               public static unsafe int Read (UnzipHandle handle, byte[] buffer, int offset, int count)
+               {
+                       if ((buffer.Length - offset) > count)
+                               throw new ArgumentOutOfRangeException ("count", "Buffer is too small to read that amount of data");
+                       
+                       fixed (byte * b = &buffer[offset])
+                               return unzReadCurrentFile (handle, b, (uint)count);
+               }
+
+               [DllImport ("libminizip.dll")]
+               static extern int unzCloseCurrentFile (UnzipHandle handle);
+
+               [DllImport ("libminizip.dll")]
+               static extern IntPtr unztell (UnzipHandle handle);
+               
+               [DllImport ("libminizip.dll")]
+               static extern int unzGoToFirstFile (UnzipHandle handle);
+
+               [DllImport ("libminizip.dll")]
+               static extern UnzipHandle unzOpen2 (string path,
+                                                           ref ZlibFileFuncDef pzlib_filefunc_def);
+
+               [DllImport ("libminizip.dll")]
+               static extern int unzGoToNextFile (UnzipHandle handle);
+
+               [DllImport ("libminizip.dll")]
+               static extern int unzLocateFile (UnzipHandle handle,
+                                                        string szFileName,
+                                                        int iCaseSensitivity);
+
+               [DllImport ("libminizip.dll")]
+               static extern int unzOpenCurrentFile (UnzipHandle handle);
+
+               [DllImport ("libminizip.dll")]
+               static extern int unzGetCurrentFileInfo (UnzipHandle handle,
+                                                                out UnzipFileInfo pfile_info,
+                                                                StringBuilder szFileName,
+                                                                IntPtr fileNameBufferSize,   // uLong
+                                                                IntPtr extraField,           // void *
+                                                                IntPtr extraFieldBufferSize, // uLong
+                                                                StringBuilder szComment,
+                                                                IntPtr commentBufferSize);   // uLong
+
+               [DllImport ("libminizip.dll")]
+               static unsafe extern int unzReadCurrentFile (UnzipHandle handle,
+                                                             byte* buf, // voidp
+                                                             uint len);
+
+               [DllImport ("libminizip.dll")]
+               static extern int unzSetOffset (UnzipHandle handle, IntPtr pos); // uLong
+               
+               [DllImport ("libminizip.dll")]
+               static extern int unzClose (UnzipHandle handle);
+       }
+}
diff --git a/mcs/class/WindowsBase/ZipSharp/NativeZip.cs b/mcs/class/WindowsBase/ZipSharp/NativeZip.cs
new file mode 100644 (file)
index 0000000..c3ccb6f
--- /dev/null
@@ -0,0 +1,90 @@
+// Native.cs created with MonoDevelop
+// User: alan at 12:18 13/10/2008
+//
+// To change standard headers go to Edit->Preferences->Coding->Standard Headers
+//
+
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace zipsharp
+{
+       static class NativeZip
+       {
+               const int DEFAULT_COMPRESSION = 0;
+               const int Z_DEFLATED = 8;
+
+               public static void CloseArchive (ZipHandle handle)
+               {
+                       CloseArchive (handle, null);
+               }
+
+               public static void CloseArchive (ZipHandle handle, string comment)
+               {
+                       zipClose (handle, comment);
+                       handle.SetHandleAsInvalid ();
+               }
+
+               public static void CloseFile (ZipHandle handle)
+               {
+                       zipCloseFileInZip (handle);
+               }
+
+               public static ZipHandle OpenArchive (ZlibFileFuncDef funcDef, Append append)
+               {
+                       ZipHandle h = zipOpen2 ("", (int) append, IntPtr.Zero, ref funcDef);
+                       if (h.IsInvalid)
+                               throw new Exception ("Could not open the zip archive");
+                       return h;
+               }
+               
+               public static int OpenFile (ZipHandle handle, string filename)
+               {
+                       return OpenFile (handle, filename, DEFAULT_COMPRESSION);
+               }
+
+               public static int OpenFile (ZipHandle handle, string filename, int compressionLevel)
+               {
+                       ZipFileInfo fileInfo = new ZipFileInfo (DateTime.Now);
+                       int method = compressionLevel == 0 ? 0 : Z_DEFLATED;
+                       return zipOpenNewFileInZip (handle, filename, ref fileInfo, IntPtr.Zero, 0, IntPtr.Zero, 0, "", method, compressionLevel);
+               }
+
+               public static unsafe void Write (ZipHandle handle, byte[] buffer, int offset, uint count)
+               {
+                       fixed (byte* b = &buffer[offset])
+                               zipWriteInFileInZip (handle, b, count);
+               }
+
+               [DllImport ("libminizip.dll")]
+               static extern unsafe int zipWriteInFileInZip (ZipHandle handle,\r
+                                                              byte* buffer,\r
+                                                              uint len);
+
+               [DllImport ("libminizip.dll")]
+               static extern int zipCloseFileInZip (ZipHandle handle);
+
+               [DllImport ("libminizip.dll")]
+               static extern ZipHandle zipOpen2 (string pathname,
+                                                 int append,
+                                                 IntPtr globalcomment, // zipcharpc*
+                                                 ref ZlibFileFuncDef pzlib_filefunc_def); // zlib_filefunc_def*
+
+               
+               [DllImport ("libminizip.dll")]
+               static extern int zipClose (ZipHandle handle, string globalComment);
+
+               [DllImport ("libminizip.dll")]
+               static extern int zipOpenNewFileInZip (ZipHandle handle,
+                                                      string filename,
+                                                      ref ZipFileInfo zipfi,
+                                                      IntPtr extrafield_local,
+                                                      uint size_extrafield_local,
+                                                      IntPtr extrafield_global,
+                                                      uint size_extrafield_global,
+                                                      string comment,
+                                                      int method,
+                                                      int level);
+       }
+}
diff --git a/mcs/class/WindowsBase/ZipSharp/UnzipArchive.cs b/mcs/class/WindowsBase/ZipSharp/UnzipArchive.cs
new file mode 100644 (file)
index 0000000..a191ddf
--- /dev/null
@@ -0,0 +1,97 @@
+// UnzipArchive.cs
+//
+// Copyright (c) 2008 [copyright holders]
+//
+// 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.
+//
+//
+
+using System;
+using System.IO;
+
+namespace zipsharp
+{
+       class UnzipArchive : IDisposable
+       {
+               string[] files;
+               
+               internal bool FileActive {
+                       get; set;
+               }
+               
+               string[] Files {
+                       get {
+                               if (files == null)
+                                       files = NativeUnzip.GetFiles (Handle);
+                               return files;
+                       }
+               }
+               
+               internal UnzipHandle Handle {
+                       get; private set;
+               }
+               
+               ZipStream Stream {
+                       get; set;
+               }
+
+               public UnzipArchive (string filename)
+                       : this (File.Open (filename, FileMode.Open), true)
+               {
+                       
+               }
+
+               public UnzipArchive (Stream stream)
+                       : this (stream, false)
+               {
+                       
+               }
+
+               public UnzipArchive (Stream stream, bool ownsStream)
+               {
+                       Stream = new ZipStream (stream, ownsStream);
+                       Handle = NativeUnzip.OpenArchive (Stream.IOFunctions);
+               }
+
+               public void Dispose ()
+               {
+                       NativeUnzip.CloseArchive (Handle);
+                       Stream.Close ();
+               }
+
+               public string[] GetFiles ()
+               {
+                       return (string []) Files.Clone ();
+               }
+
+               public Stream GetStream (string name)
+               {
+                       foreach (string file in Files)
+                       {
+                               if (name.Equals(file, StringComparison.OrdinalIgnoreCase))
+                               {
+                                       NativeUnzip.OpenFile (Handle, name);
+                                       return new UnzipReadStream (this);
+                               }
+                       }
+                       
+                       throw new Exception ("The file doesn't exist in the zip archive");
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/ZipSharp/UnzipFileInfo.cs b/mcs/class/WindowsBase/ZipSharp/UnzipFileInfo.cs
new file mode 100644 (file)
index 0000000..ec134d9
--- /dev/null
@@ -0,0 +1,112 @@
+// FileInfo.cs created with MonoDevelop
+// User: alan at 14:47 13/10/2008
+//
+// To change standard headers go to Edit->Preferences->Coding->Standard Headers
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace zipsharp
+{
+       [StructLayout (LayoutKind.Sequential)]
+       struct UnzipFileInfo
+       {\r
+           IntPtr version;              /* version made by                 2 bytes */\r
+           IntPtr version_needed;       /* version needed to extract       2 bytes */\r
+           IntPtr flag;                 /* general purpose bit flag        2 bytes */\r
+           IntPtr compression_method;   /* compression method              2 bytes */\r
+           IntPtr dosDate;              /* last mod file date in Dos fmt   4 bytes */\r
+           IntPtr crc;                  /* crc-32                          4 bytes */\r
+           IntPtr compressed_size;      /* compressed size                 4 bytes */\r
+           IntPtr uncompressed_size;    /* uncompressed size               4 bytes */\r
+           IntPtr size_filename;        /* filename length                 2 bytes */\r
+           IntPtr size_file_extra;      /* extra field length              2 bytes */\r
+           IntPtr size_file_comment;    /* file comment length             2 bytes */\r
+       \r
+           IntPtr disk_num_start;       /* disk number start               2 bytes */\r
+           IntPtr internal_fa;          /* internal file attributes        2 bytes */\r
+           IntPtr external_fa;          /* external file attributes        4 bytes */\r
+       \r
+           ZipTime tmu_date;
+           
+           public ulong VersionNeeded {
+               get { return (ulong)version_needed.ToInt64 (); }
+               set { version_needed = new IntPtr ((int)value); }
+           }
+           
+           public ulong Version {
+               get { return (ulong)version.ToInt64 (); }
+               set { version = new IntPtr ((int)value); }
+           }
+           
+           public ulong UncompressedSize {
+               get { return (ulong)uncompressed_size.ToInt64 (); }
+                       set { uncompressed_size = new IntPtr ((int)value); }
+           }
+           
+           public ZipTime TmuDate {
+               get { return tmu_date; }
+               set { tmu_date = value; }
+           }
+           
+           public ulong SizeFilename {
+               get { return (ulong)size_filename.ToInt64 (); }
+               set { size_filename = new IntPtr ((int)value); }
+           }
+           
+           public ulong SizeFileExtra {
+               get { return (ulong)size_file_extra.ToInt64 (); }
+               set { size_file_extra = new IntPtr ((int)value); }
+           }
+           
+           public ulong SizeFileComment {
+               get {
+                       return (ulong)size_file_comment.ToInt64 ();
+               }
+               set {
+                       size_file_comment = new IntPtr ((int)value);
+               }
+           }
+           
+           public ulong InternalFa {
+               get { return (ulong)internal_fa.ToInt64 (); }
+               set { internal_fa = new IntPtr ((int)value); }
+           }
+           
+           public ulong Flag {
+               get { return (ulong)flag.ToInt64 (); }
+               set { flag = new IntPtr ((int)value); }
+           }
+           
+           public ulong ExternalFa {
+               get { return (ulong)external_fa.ToInt64 (); }
+               set { external_fa = new IntPtr ((int)value); }
+           }
+           
+           public ulong DosDate {
+               get { return (ulong)dosDate.ToInt64 (); }
+               set { dosDate = new IntPtr ((int)value); }
+           }
+           
+           public ulong DiskNumStart {
+               get { return (ulong)disk_num_start.ToInt64 (); }
+               set { disk_num_start = new IntPtr ((int)value); }
+           }
+           
+           public ulong Crc {
+               get { return (ulong)crc.ToInt64 (); }
+               set { crc = new IntPtr ((int)value); }
+           }
+           
+           public ulong CompressionMethod {
+               get { return (ulong)compression_method.ToInt64 (); }
+               set { compression_method = new IntPtr ((int)value); }
+           }
+           
+           public ulong CompressedSize {
+               get { return (ulong)compressed_size.ToInt64 (); }
+               set { compressed_size = new IntPtr ((int)value); }
+           }
+       }
+}
diff --git a/mcs/class/WindowsBase/ZipSharp/UnzipHandle.cs b/mcs/class/WindowsBase/ZipSharp/UnzipHandle.cs
new file mode 100644 (file)
index 0000000..c3432d2
--- /dev/null
@@ -0,0 +1,32 @@
+// UnzipArchive.cs created with MonoDevelop
+// User: alan at 13:13 20/10/2008
+//
+// To change standard headers go to Edit->Preferences->Coding->Standard Headers
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace zipsharp
+{
+       class UnzipHandle : SafeHandle
+       {
+               public override bool IsInvalid {
+                       get {
+                               return handle == IntPtr.Zero;
+                       }
+               }
+
+               public UnzipHandle ()
+                       : base (IntPtr.Zero, true)
+               {
+                       
+               }
+
+               protected override bool ReleaseHandle ()
+               {
+                       NativeUnzip.CloseArchive (this);
+                       return true;
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/ZipSharp/UnzipReadStream.cs b/mcs/class/WindowsBase/ZipSharp/UnzipReadStream.cs
new file mode 100644 (file)
index 0000000..3ac3502
--- /dev/null
@@ -0,0 +1,102 @@
+// ZipReadStream.cs
+//
+// Copyright (c) 2008 [copyright holders]
+//
+// 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.
+//
+//
+
+using System;
+using System.IO;
+
+namespace zipsharp
+{
+       class UnzipReadStream : Stream
+       {
+               long length;
+               
+               UnzipArchive Archive { get; set; }
+
+               public override bool CanRead {
+                       get { return true; }
+               }
+               
+               public override bool CanSeek {
+                       get { return false; }
+               }
+
+               public override bool CanWrite {
+                       get { return false; }
+               }
+
+               public override bool CanTimeout {
+                       get { return false; }
+               }
+
+               public override long Length {
+                       get {
+                               return length;
+                       }
+               }
+
+               public override long Position {
+                       get { return NativeUnzip.CurrentFilePosition (Archive.Handle); }
+                       set { throw new NotSupportedException (); }
+               }
+               
+               public UnzipReadStream (UnzipArchive archive)
+               {
+                       Archive = archive;
+                       Archive.FileActive = true;
+
+                       length = NativeUnzip.CurrentFileLength (Archive.Handle);
+               }
+
+               public override void Close()
+               {
+                       Archive.FileActive = false;
+                       NativeUnzip.CloseCurrentFile (Archive.Handle);
+               }
+
+               public override void Flush()
+               {
+                       
+               }
+               public override int Read(byte[] buffer, int offset, int count)
+               {
+                       return NativeUnzip.Read (Archive.Handle, buffer, offset, count);
+               }
+
+               public override long Seek(long offset, SeekOrigin origin)
+               {
+                       throw new NotSupportedException ();
+               }
+               
+               public override void SetLength(long value)
+               {
+                       throw new NotSupportedException ();
+               }
+               
+               public override void Write(byte[] buffer, int offset, int count)
+               {
+                       throw new NotSupportedException ();
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/ZipSharp/ZipArchive.cs b/mcs/class/WindowsBase/ZipSharp/ZipArchive.cs
new file mode 100644 (file)
index 0000000..75bee25
--- /dev/null
@@ -0,0 +1,51 @@
+// ZipArchive.cs created with MonoDevelop
+// User: alan at 16:31 20/10/2008
+//
+// To change standard headers go to Edit->Preferences->Coding->Standard Headers
+//
+
+using System;
+using System.IO;
+
+namespace zipsharp
+{
+       class ZipArchive : IDisposable
+       {
+               internal bool FileActive { get; set; }
+               internal ZipHandle Handle { get; private set; }
+               ZipStream Stream { get; set; }
+       
+               public ZipArchive (string filename, Append append)
+                       : this (File.Open (filename, FileMode.OpenOrCreate), append)
+               {
+
+               }
+
+               public ZipArchive (Stream stream, Append append)
+                       : this (stream, append, false)
+               {
+                       
+               }
+
+               public ZipArchive (Stream stream, Append append, bool ownsStream)
+               {
+                       Stream = new ZipStream (stream, ownsStream);
+                       Handle = NativeZip.OpenArchive (Stream.IOFunctions, append);
+               }
+
+               public Stream GetStream (string filename)
+               {
+                       if (FileActive)
+                               throw new InvalidOperationException ("A file is already open");
+                       
+                       NativeZip.OpenFile (Handle, filename);
+                       return new ZipWriteStream (this);
+               }
+
+               public void Dispose ()
+               {
+                       NativeZip.CloseArchive (Handle);
+                       Stream.Close ();
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/ZipSharp/ZipFileInfo.cs b/mcs/class/WindowsBase/ZipSharp/ZipFileInfo.cs
new file mode 100644 (file)
index 0000000..2cbea32
--- /dev/null
@@ -0,0 +1,47 @@
+// ZipFileInfo.cs created with MonoDevelop
+// User: alan at 12:14 13/10/2008
+//
+// To change standard headers go to Edit->Preferences->Coding->Standard Headers
+//
+
+using System;
+
+namespace zipsharp
+{
+       struct ZipFileInfo
+       {
+               ZipTime date;
+               IntPtr dosDate;
+               IntPtr internalFileAttributes;
+               IntPtr externalFileAttributes;
+
+               public DateTime FileTime
+               {
+                       get { return date.Date; }
+               }
+
+               public long DosDate
+               {
+                       get { return dosDate.ToInt64 (); }
+               }
+               
+               internal long InternalFileAttributes
+               {
+                       get { return internalFileAttributes.ToInt64 (); }
+               }
+
+               internal long ExternalFileAttributes
+               {
+                       get { return externalFileAttributes.ToInt64 (); }
+               }
+               
+               public ZipFileInfo (DateTime fileTime)
+               {
+                       date = new ZipTime (fileTime);
+                       dosDate = new IntPtr ((int)fileTime.ToFileTime ());
+                       internalFileAttributes = IntPtr.Zero;
+                       externalFileAttributes = IntPtr.Zero;
+               }
+
+       }
+}
diff --git a/mcs/class/WindowsBase/ZipSharp/ZipHandle.cs b/mcs/class/WindowsBase/ZipSharp/ZipHandle.cs
new file mode 100644 (file)
index 0000000..21843eb
--- /dev/null
@@ -0,0 +1,32 @@
+// ZipFile.cs created with MonoDevelop
+// User: alan at 11:54 13/10/2008
+//
+// To change standard headers go to Edit->Preferences->Coding->Standard Headers
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace zipsharp
+{
+       class ZipHandle : SafeHandle
+       {
+               public override bool IsInvalid {
+                       get {
+                               return handle == IntPtr.Zero;
+                       }
+               }
+
+               public ZipHandle ()
+                       : base (IntPtr.Zero, true)
+               {
+                       
+               }
+
+               protected override bool ReleaseHandle()
+               {
+                       NativeZip.CloseArchive (this);
+                       return true;
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/ZipSharp/ZipStream.cs b/mcs/class/WindowsBase/ZipSharp/ZipStream.cs
new file mode 100644 (file)
index 0000000..51d15c5
--- /dev/null
@@ -0,0 +1,202 @@
+// ZipStream.cs created with MonoDevelop
+// User: alan at 15:16 20/10/2008
+//
+// To change standard headers go to Edit->Preferences->Coding->Standard Headers
+//
+
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+
+namespace zipsharp
+{
+       class ZipStream : Stream
+       {
+               const int ZLIB_FILEFUNC_SEEK_CUR = 1;
+               const int ZLIB_FILEFUNC_SEEK_END = 2;
+               const int ZLIB_FILEFUNC_SEEK_SET = 0;
+               
+               bool canRead;
+               bool canSeek;
+               bool canWrite;
+               
+               public override bool CanRead {
+                       get { return canRead; }
+               }
+
+               public override bool CanSeek {
+                       get { return canSeek; }
+               }
+
+               public override bool CanWrite {
+                       get { return canWrite; }
+               }
+
+               public override bool CanTimeout {
+                       get { return false; }
+               }
+               
+               private Stream DataStream {
+                       get; set;
+               }
+
+               public ZlibFileFuncDef IOFunctions {
+                       get; set;
+               }
+
+               public override long Length {
+                       get { return DataStream.Length; }
+               }
+
+               bool OwnsStream {
+                       get; set;
+               }
+               
+               public override long Position {
+                       get { return DataStream.Position; }
+                       set { DataStream.Position = value; }
+               }
+               
+               public ZipStream (Stream dataStream, bool ownsStream)
+               {
+                       // FIXME: Not necessarily true
+                       canRead = true;
+                       canSeek = true;
+                       canWrite = true;
+
+                       DataStream = dataStream;
+                       OwnsStream = ownsStream;
+                       
+                       ZlibFileFuncDef f = new ZlibFileFuncDef();
+                       
+                       f.opaque = IntPtr.Zero;
+                       f.zclose_file = CloseFile_Native;
+                       f.zerror_file = TestError_Native;
+                       f.zopen_file = OpenFile_Native;
+                       f.zread_file = ReadFile_Native;
+                       f.zseek_file = SeekFile_Native;
+                       f.ztell_file = TellFile_Native;
+                       f.zwrite_file = WriteFile_Native;
+
+                       IOFunctions = f;
+               }
+
+               protected override void Dispose(bool disposing)
+               {
+                       if (!disposing)
+                               return;
+
+                       DataStream.Flush ();
+                       if (OwnsStream)
+                               DataStream.Dispose ();
+               }
+
+               public override void Flush()
+               {
+                       DataStream.Flush ();
+               }
+               
+               public override int Read(byte[] buffer, int offset, int count)
+               {
+                       return DataStream.Read (buffer, offset, count);
+               }
+
+               public override long Seek(long offset, SeekOrigin origin)
+               {
+                       DataStream.Seek (offset, origin);
+                       return DataStream.Position;
+               }
+
+               public override void SetLength(long value)
+               {
+                       DataStream.SetLength (value);
+               }
+
+               public override void Write(byte[] buffer, int offset, int count)
+               {
+                       DataStream.Write (buffer, offset, count);
+                       Flush ();
+               }
+
+               int CloseFile_Native (IntPtr opaque, IntPtr stream)
+               {
+                       Close ();
+                       return 0;
+               }
+               
+               IntPtr OpenFile_Native (IntPtr opaque, string filename, int mode)
+               {
+                       // always success. The stream is opened in managed code
+                       return new IntPtr (1);
+               }
+
+               unsafe IntPtr ReadFile_Native (IntPtr opaque, IntPtr stream, IntPtr buffer, IntPtr size)
+               {
+                       int count = size.ToInt32 ();
+                       byte[] b = new byte[count];
+                       int read;
+                       
+                       try {
+                               read = Math.Max (0, Read (b, 0, count));
+                               byte* ptrBuffer = (byte*) buffer.ToPointer ();
+                               for (int i = 0; i < count && i < read; i ++)
+                                       ptrBuffer[i] = b[i];
+                       } catch {
+                               read = -1;
+                       }
+
+                       return new IntPtr (read);
+               }
+
+               IntPtr SeekFile_Native (IntPtr opaque, IntPtr stream, IntPtr offset, int origin)
+               {
+                       SeekOrigin seek;
+                       if (origin == ZipStream.ZLIB_FILEFUNC_SEEK_CUR)
+                               seek = SeekOrigin.Current;
+                       else if (origin == ZLIB_FILEFUNC_SEEK_END)
+                               seek = SeekOrigin.End;
+                       else if (origin == ZLIB_FILEFUNC_SEEK_SET)
+                               seek = SeekOrigin.Begin;
+                       else
+                               return new IntPtr (-1);
+
+                       Seek (offset.ToInt64 (), seek);
+                       
+                       return new IntPtr (0);
+               }
+
+               IntPtr TellFile_Native (IntPtr opaque, IntPtr stream)
+               {
+                       if (IntPtr.Size == 4)
+                               return new IntPtr ((int)Position);
+                       else if (IntPtr.Size == 8)
+                               return new IntPtr (Position);
+                       else
+                               return new IntPtr (-1);
+               }
+
+               int TestError_Native (IntPtr opaque, IntPtr stream)
+               {
+                       // No errors here.
+                       return 0;
+               }
+
+               unsafe IntPtr WriteFile_Native (IntPtr opaque, IntPtr stream, IntPtr buffer, /* ulong */ IntPtr size)
+               {
+                       int count = size.ToInt32 ();
+                       byte[] b = new byte[count];
+
+                       byte* ptrBuffer = (byte*) buffer.ToPointer ();
+                       for (int i = 0; i < count; i ++)
+                               b[i] = ptrBuffer[i];
+
+                       try {
+                               Write (b, 0, count);
+                       } catch {
+                               
+                       }
+
+                       return new IntPtr (count);
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/ZipSharp/ZipTime.cs b/mcs/class/WindowsBase/ZipSharp/ZipTime.cs
new file mode 100644 (file)
index 0000000..2736df9
--- /dev/null
@@ -0,0 +1,37 @@
+// ZipTime.cs created with MonoDevelop
+// User: alan at 11:56 13/10/2008
+//
+// To change standard headers go to Edit->Preferences->Coding->Standard Headers
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace zipsharp
+{
+       [StructLayoutAttribute (LayoutKind.Sequential)]
+       struct ZipTime
+       {
+               uint second;
+               uint minute;
+               uint hour;
+               uint day;
+               uint month;
+               uint year;
+
+               public ZipTime (DateTime time)
+               {
+                       second = (uint) time.Second;
+                       minute = (uint) time.Minute;
+                       hour = (uint) time.Hour;
+                       day = (uint) time.Day;
+                       month = (uint) time.Month;
+                       year = (uint) time.Year;
+               }
+
+               public DateTime Date
+               {
+                       get { return new DateTime ((int) year, (int) month, (int) day, (int) hour, (int) minute, (int) second); }
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/ZipSharp/ZipWriteStream.cs b/mcs/class/WindowsBase/ZipSharp/ZipWriteStream.cs
new file mode 100644 (file)
index 0000000..fbacd9d
--- /dev/null
@@ -0,0 +1,84 @@
+// ZipWriteStream.cs created with MonoDevelop
+// User: alan at 16:54 20/10/2008
+//
+// To change standard headers go to Edit->Preferences->Coding->Standard Headers
+//
+
+using System;
+using System.IO;
+
+namespace zipsharp
+{
+       class ZipWriteStream : Stream
+       {
+               ZipArchive Archive { get; set; }
+               
+               public override bool CanRead {
+                       get { return false; }
+               }
+               
+               public override bool CanSeek {
+                       get { return false; }
+               }
+
+               public override bool CanWrite {
+                       get { return true; }
+               }
+
+               public override bool CanTimeout {
+                       get { return false; }
+               }
+
+               public override long Length {
+                       get {
+                               throw new NotSupportedException ();
+                       }
+               }
+
+               public override long Position {
+                       get {
+                                throw new NotSupportedException ();
+                       }
+                       set {
+                               throw new NotSupportedException ();
+                       }
+               }
+               
+               public ZipWriteStream (ZipArchive archive)
+               {
+                       Archive = archive;
+                       Archive.FileActive = true;
+               }
+
+               public override void Close()
+               {
+                       NativeZip.CloseFile (Archive.Handle);
+                       Archive.FileActive = false;
+               }
+
+               public override void Flush()
+               {
+                       
+               }
+               public override int Read(byte[] buffer, int offset, int count)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               public override long Seek(long offset, SeekOrigin origin)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               public override void SetLength(long value)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               public override void Write(byte[] buffer, int offset, int count)
+               {
+                       NativeZip.Write (Archive.Handle, buffer, offset, (uint)count);
+               }
+       }
+}
diff --git a/mcs/class/WindowsBase/samples/dis.cs b/mcs/class/WindowsBase/samples/dis.cs
new file mode 100644 (file)
index 0000000..d2825a9
--- /dev/null
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Threading;
+
+class Class1 {
+    delegate void Action ();
+
+    static void Main ()
+    {
+        Dispatcher d = Dispatcher.CurrentDispatcher;
+        Action a = delegate {
+               object x = d;
+            d.Invoke (DispatcherPriority.Normal, new Action (mine));
+            Console.WriteLine ("Task");
+        };
+
+       d.BeginInvoke (DispatcherPriority.Normal, (Action) delegate {
+               Console.WriteLine ("First");
+       });
+        d.BeginInvoke (DispatcherPriority.Normal, (Action) delegate {
+               Console.WriteLine ("Second");
+               d.InvokeShutdown ();
+       });
+       d.BeginInvoke (DispatcherPriority.Send, (Action) delegate {
+               Console.WriteLine ("High Priority");
+               d.BeginInvoke (DispatcherPriority.Send, (Action) delegate {
+                       Console.WriteLine ("INSERTED");
+               });
+       });
+       d.BeginInvoke (DispatcherPriority.SystemIdle, (Action) delegate {
+               Console.WriteLine ("Idle");
+       });
+
+       Dispatcher.Run ();
+    }
+
+    static void mine ()
+    {
+        Console.WriteLine ("Mine");
+    }
+}