Răsfoiți Sursa

Put WindowsBase on mcs/class for System.IO.Packaging

svn path=/trunk/mcs/; revision=141398
Miguel de Icaza 16 ani în urmă
părinte
comite
5e52dab0a6
100 a modificat fișierele cu 8530 adăugiri și 0 ștergeri
  1. 87 0
      mcs/class/WindowsBase/Assembly/AssemblyInfo.cs
  2. 561 0
      mcs/class/WindowsBase/ChangeLog
  3. 13 0
      mcs/class/WindowsBase/Makefile
  4. 182 0
      mcs/class/WindowsBase/System.Collections.ObjectModel/ObservableCollection.cs
  5. 81 0
      mcs/class/WindowsBase/System.Collections.ObjectModel/ReadOnlyObservableCollection.cs
  6. 7 0
      mcs/class/WindowsBase/System.Collections.Specialized/ChangeLog
  7. 80 0
      mcs/class/WindowsBase/System.Collections.Specialized/CollectionChangedEventManager.cs
  8. 36 0
      mcs/class/WindowsBase/System.Collections.Specialized/INotifyCollectionChanged.cs
  9. 38 0
      mcs/class/WindowsBase/System.Collections.Specialized/NotifyCollectionChangedAction.cs
  10. 211 0
      mcs/class/WindowsBase/System.Collections.Specialized/NotifyCollectionChangedEventArgs.cs
  11. 32 0
      mcs/class/WindowsBase/System.Collections.Specialized/NotifyCollectionChangedEventHandler.cs
  12. 59 0
      mcs/class/WindowsBase/System.ComponentModel/CurrentChangedEventManager.cs
  13. 63 0
      mcs/class/WindowsBase/System.ComponentModel/CurrentChangingEventArgs.cs
  14. 32 0
      mcs/class/WindowsBase/System.ComponentModel/CurrentChangingEventHandler.cs
  15. 59 0
      mcs/class/WindowsBase/System.ComponentModel/CurrentChangingEventManager.cs
  16. 165 0
      mcs/class/WindowsBase/System.ComponentModel/DependencyPropertyDescriptor.cs
  17. 70 0
      mcs/class/WindowsBase/System.ComponentModel/GroupDescription.cs
  18. 65 0
      mcs/class/WindowsBase/System.ComponentModel/ICollectionView.cs
  19. 33 0
      mcs/class/WindowsBase/System.ComponentModel/ICollectionViewFactory.cs
  20. 54 0
      mcs/class/WindowsBase/System.ComponentModel/IEditableCollectionView.cs
  21. 34 0
      mcs/class/WindowsBase/System.ComponentModel/IItemProperties.cs
  22. 52 0
      mcs/class/WindowsBase/System.ComponentModel/ItemPropertyInfo.cs
  23. 34 0
      mcs/class/WindowsBase/System.ComponentModel/NewItemPlaceholderPosition.cs
  24. 63 0
      mcs/class/WindowsBase/System.ComponentModel/PropertyChangedEventManager.cs
  25. 70 0
      mcs/class/WindowsBase/System.ComponentModel/PropertyFilterAttribute.cs
  26. 40 0
      mcs/class/WindowsBase/System.ComponentModel/PropertyFilterOptions.cs
  27. 103 0
      mcs/class/WindowsBase/System.ComponentModel/SortDescription.cs
  28. 95 0
      mcs/class/WindowsBase/System.ComponentModel/SortDescriptionCollection.cs
  29. 35 0
      mcs/class/WindowsBase/System.Diagnostics/PresentationTraceLevel.cs
  30. 89 0
      mcs/class/WindowsBase/System.Diagnostics/PresentationTraceSources.cs
  31. 35 0
      mcs/class/WindowsBase/System.IO.Packaging/CertificateEmbeddingOption.cs
  32. 158 0
      mcs/class/WindowsBase/System.IO.Packaging/Check.cs
  33. 37 0
      mcs/class/WindowsBase/System.IO.Packaging/CompressionOption.cs
  34. 122 0
      mcs/class/WindowsBase/System.IO.Packaging/EncryptedPackageEnvelope.cs
  35. 33 0
      mcs/class/WindowsBase/System.IO.Packaging/EncryptionOption.cs
  36. 32 0
      mcs/class/WindowsBase/System.IO.Packaging/InvalidSignatureEventHandler.cs
  37. 176 0
      mcs/class/WindowsBase/System.IO.Packaging/PackUriHelper.cs
  38. 111 0
      mcs/class/WindowsBase/System.IO.Packaging/PackUriParser.cs
  39. 486 0
      mcs/class/WindowsBase/System.IO.Packaging/Package.cs
  40. 101 0
      mcs/class/WindowsBase/System.IO.Packaging/PackageDigitalSignature.cs
  41. 168 0
      mcs/class/WindowsBase/System.IO.Packaging/PackageDigitalSignatureManager.cs
  42. 265 0
      mcs/class/WindowsBase/System.IO.Packaging/PackagePart.cs
  43. 52 0
      mcs/class/WindowsBase/System.IO.Packaging/PackagePartCollection.cs
  44. 110 0
      mcs/class/WindowsBase/System.IO.Packaging/PackageProperties.cs
  45. 297 0
      mcs/class/WindowsBase/System.IO.Packaging/PackagePropertiesPart.cs
  46. 68 0
      mcs/class/WindowsBase/System.IO.Packaging/PackageRelationship.cs
  47. 52 0
      mcs/class/WindowsBase/System.IO.Packaging/PackageRelationshipCollection.cs
  48. 55 0
      mcs/class/WindowsBase/System.IO.Packaging/PackageRelationshipSelector.cs
  49. 33 0
      mcs/class/WindowsBase/System.IO.Packaging/PackageRelationshipSelectorType.cs
  50. 74 0
      mcs/class/WindowsBase/System.IO.Packaging/RightsManagementInformation.cs
  51. 45 0
      mcs/class/WindowsBase/System.IO.Packaging/SignatureVerificationEventArgs.cs
  52. 98 0
      mcs/class/WindowsBase/System.IO.Packaging/StorageInfo.cs
  53. 65 0
      mcs/class/WindowsBase/System.IO.Packaging/StreamInfo.cs
  54. 33 0
      mcs/class/WindowsBase/System.IO.Packaging/TargetMode.cs
  55. 38 0
      mcs/class/WindowsBase/System.IO.Packaging/VerifyResult.cs
  56. 223 0
      mcs/class/WindowsBase/System.IO.Packaging/ZipPackage.cs
  57. 98 0
      mcs/class/WindowsBase/System.IO.Packaging/ZipPackagePart.cs
  58. 117 0
      mcs/class/WindowsBase/System.IO.Packaging/ZipPartStream.cs
  59. 95 0
      mcs/class/WindowsBase/System.IO/FileFormatException.cs
  60. 111 0
      mcs/class/WindowsBase/System.Security.Permissions/MediaPermission.cs
  61. 61 0
      mcs/class/WindowsBase/System.Security.Permissions/MediaPermissionAttribute.cs
  62. 36 0
      mcs/class/WindowsBase/System.Security.Permissions/MediaPermissionAudio.cs
  63. 36 0
      mcs/class/WindowsBase/System.Security.Permissions/MediaPermissionImage.cs
  64. 36 0
      mcs/class/WindowsBase/System.Security.Permissions/MediaPermissionVideo.cs
  65. 90 0
      mcs/class/WindowsBase/System.Security.Permissions/WebBrowserPermission.cs
  66. 51 0
      mcs/class/WindowsBase/System.Security.Permissions/WebBrowserPermissionAttribute.cs
  67. 34 0
      mcs/class/WindowsBase/System.Security.Permissions/WebBrowserPermissionLevel.cs
  68. 35 0
      mcs/class/WindowsBase/System.Security.RightsManagement/AuthenticationType.cs
  69. 61 0
      mcs/class/WindowsBase/System.Security.RightsManagement/ContentGrant.cs
  70. 44 0
      mcs/class/WindowsBase/System.Security.RightsManagement/ContentRight.cs
  71. 71 0
      mcs/class/WindowsBase/System.Security.RightsManagement/ContentUser.cs
  72. 84 0
      mcs/class/WindowsBase/System.Security.RightsManagement/CryptoProvider.cs
  73. 57 0
      mcs/class/WindowsBase/System.Security.RightsManagement/LocalizedNameDescriptionPair.cs
  74. 77 0
      mcs/class/WindowsBase/System.Security.RightsManagement/PublishLicense.cs
  75. 86 0
      mcs/class/WindowsBase/System.Security.RightsManagement/RightsManagementException.cs
  76. 139 0
      mcs/class/WindowsBase/System.Security.RightsManagement/RightsManagementFailureCode.cs
  77. 84 0
      mcs/class/WindowsBase/System.Security.RightsManagement/SecureEnvironment.cs
  78. 84 0
      mcs/class/WindowsBase/System.Security.RightsManagement/UnsignedPublishLicense.cs
  79. 72 0
      mcs/class/WindowsBase/System.Security.RightsManagement/UseLicense.cs
  80. 33 0
      mcs/class/WindowsBase/System.Security.RightsManagement/UserActivationMode.cs
  81. 55 0
      mcs/class/WindowsBase/System.Windows.Converters/Int32RectValueSerializer.cs
  82. 55 0
      mcs/class/WindowsBase/System.Windows.Converters/PointValueSerializer.cs
  83. 55 0
      mcs/class/WindowsBase/System.Windows.Converters/RectValueSerializer.cs
  84. 55 0
      mcs/class/WindowsBase/System.Windows.Converters/SizeValueSerializer.cs
  85. 55 0
      mcs/class/WindowsBase/System.Windows.Converters/VectorValueSerializer.cs
  86. 126 0
      mcs/class/WindowsBase/System.Windows.Data/DataSourceProvider.cs
  87. 41 0
      mcs/class/WindowsBase/System.Windows.Input/FocusNavigationDirection.cs
  88. 238 0
      mcs/class/WindowsBase/System.Windows.Input/Key.cs
  89. 56 0
      mcs/class/WindowsBase/System.Windows.Input/KeyConverter.cs
  90. 43 0
      mcs/class/WindowsBase/System.Windows.Input/KeyInterop.cs
  91. 55 0
      mcs/class/WindowsBase/System.Windows.Input/KeyValueSerializer.cs
  92. 43 0
      mcs/class/WindowsBase/System.Windows.Input/ModifierKeys.cs
  93. 61 0
      mcs/class/WindowsBase/System.Windows.Input/ModifierKeysConverter.cs
  94. 55 0
      mcs/class/WindowsBase/System.Windows.Input/ModifierKeysValueSerializer.cs
  95. 49 0
      mcs/class/WindowsBase/System.Windows.Input/TraversalRequest.cs
  96. 73 0
      mcs/class/WindowsBase/System.Windows.Interop/ComponentDispatcher.cs
  97. 55 0
      mcs/class/WindowsBase/System.Windows.Interop/IKeyboardInputSink.cs
  98. 42 0
      mcs/class/WindowsBase/System.Windows.Interop/IKeyboardInputSite.cs
  99. 84 0
      mcs/class/WindowsBase/System.Windows.Interop/MSG.cs
  100. 32 0
      mcs/class/WindowsBase/System.Windows.Interop/ThreadMessageEventHandler.cs

+ 87 - 0
mcs/class/WindowsBase/Assembly/AssemblyInfo.cs

@@ -0,0 +1,87 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+//   Andreas Nahr ([email protected])
+//
+// (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.FxFileVersion)]
+
+[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", "System.Windows.Markup")]
+
+[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/presentation", "System.Diagnostics")]
+
+[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")]
+[assembly: XmlnsDefinitionAttribute ("http://schemas.microsoft.com/netfx/2007/xaml/presentation", "System.Diagnostics")]

+ 561 - 0
mcs/class/WindowsBase/ChangeLog

@@ -0,0 +1,561 @@
+2009-06-25  Sandy Armstrong  <[email protected]>
+
+	* System.Windows/Rect.cs: Implement unimplemented ToString methods to
+	support custom and culture-based formatting. Fixes bug #516165.
+	* Test/System.Windows/RectTest.cs: Expand ToStringTest to cover above
+	changes. Add new ToString_FormatException test, currently set to
+	NotWorking category because of Mono bug #516172.
+
+2009-03-19  Alan McGovern  <[email protected]>
+
+	* Test/System.IO.Packaging/FakePackageTests.cs:
+	  Test/System.IO.Packaging/PackagePartTest.cs:
+	  Add extra tests to ensure complex packages are loaded
+	  and restored correctly.
+
+2009-03-16  Alan McGovern  <[email protected]>
+
+	* Test/System.IO.Packaging/FakePackage.cs:
+	  Test/System.IO.Packaging/FakePackagePartTests.cs:
+	  Test/System.IO.Packaging/FakePackageTests.cs:
+	  Test/System.IO.Packaging/FakePartStreamTests.cs:
+	  Test/System.IO.Packaging/PackageRelationshipTests.cs:
+	  Test/System.IO.Packaging/PackageTest.cs:
+	  Test/System.IO.Packaging/PackUriHelperTests.cs:
+	  Add a bunch of extra tests to cover reported bugs.
+
+2009-02-26  Sandy Armstrong  <[email protected]>
+
+	* System.Windows/Rect.cs: For Rect.Empty, return Size.Empty for Size.
+	Previously this would throw an exception on Size construction.
+	* Test/System.Windows/RectTest.cs: Add Empty_Size test, include
+	Rect.Empty in equality-related tests, rename Size test to RectSize to
+	avoid build error.
+
+2009-01-12  Michael Hutchinson  <[email protected]>
+
+	* System.Windows/WeakEventManager.cs: Fix build.
+
+2008-11-16  Brian O'Keefe <[email protected]>
+
+	* System.ComponentModel/CurrentChangingEventArgs.cs
+	* System.ComponentModel/PropertyFilterAttribute.cs
+	* System.ComponentModel/SortDescription.cs
+	* System.ComponentModel/SortDescriptionCollection.cs: Implement
+	unimplemented method bodies.
+	
+	* Test/System.ComponentModel/CurrentChangingEventArgsTest.cs
+	* Test/System.ComponentModel/PropertyFilterAttributeTest.cs
+	* Test/System.ComponentModel/SortDescriptionTest.cs
+	* Test/System.ComponentModel/SortDescriptionCollectionTest.cs:
+	Matching NUnit test cases for classes.
+
+2008-11-07  Alan McGovern  <[email protected]>
+
+	* System.IO.Packaging/Package.cs:
+	* System.IO.Packaging/PackagePart.cs: Remove FIXMEs which have been
+	dealt with.
+
+2008-11-07  Alan McGovern  <[email protected]>
+
+	* ZipSharp/ZipArchive.cs:
+	* ZipSharp/NativeUnzip.cs:
+	* ZipSharp/UnzipArchive.cs:
+	* System.IO.Packaging/ZipPackage.cs: Make sure the compression option is
+	preserved between loading/saving files in an archive.
+
+2008-11-07  Alan McGovern  <[email protected]>
+
+	* Test/System.Windows/PointTest.cs:
+	* Test/System.Windows/PointConverterTest.cs: Disable some not-working
+	tests.
+
+2008-11-06  Alan McGovern  <[email protected]>
+
+	* System.IO.Packaging/Package.cs:
+	* System.IO.Packaging/ZipPackage.cs:
+	* System.IO.Packaging/PackagePropertiesPart.cs: Remove horrible hacks to
+	load PackageProperties, PackageRelationships and PackageParts from a
+	read-only stream. Other benefit is that these are now lazily loaded.
+
+2008-11-06  Sandy Armstrong  <[email protected]>
+
+	* Assembly/AssemblyInfo.cs: AssemblyFileVersion now uses
+	Consts.FxFileVersion, which is "3.0.4506.648".
+
+	* Makefile: Define NET_3_0 so that Consts will have the correct values
+	for this assembly.
+
+2008-11-06  Alan McGovern  <[email protected]>
+
+	
+
+
+
+2008-11-06  Alan McGovern  <[email protected]>
+
+	* Test/System.Windows/RectTest.cs:
+	* Test/System.Windows/SizeTest.cs:
+	* Test/System.Windows/VectorTest.cs:
+	* Test/System.Windows/Int32RectTest.cs:
+	* Test/System.Windows.Media/MatrixTest.cs:
+	* Test/System.Windows/SizeConverterTest.cs:
+	* Test/System.Windows/RectConverterTest.cs:
+	* Test/System.Windows/PointConverterTest.cs:
+	* Test/System.Windows/VectorConverterTest.cs:
+	* Test/System.Windows/DependencyObjectTest.cs:
+	* Test/System.Windows/Int32RectConverterTest.cs:
+	* Test/System.Windows.Markup/DateTimeValueSerializerTest.cs: Only
+	disable the tests which do not work.
+
+2008-11-06  Alan McGovern  <[email protected]>
+
+	
+
+
+
+2008-11-06 Felix Eisele <[email protected]>
+	* Test/System.Windows/PointTest.cs:
+	All Tests pass now
+	* System.Windows/Point.cs
+	Complete the implementation of the class
+	
+
+2008-11-05  Brian O'Keefe  <[email protected]>
+ 
+	* System.Collections.ObjectModel/ObservableCollection.cs:
+	* System.Collections.ObjectModel/ReadOnlyObservableCollection.cs: 
+	* System.Collections.ObjectModel/INotifyCollectionChanged.cs:
+	* System.Collections.ObjectModel/INotifyCollectionChanged.cs:
+	* System.Collections.ObjectModel/NotifyCollectionChangedAction.cs:
+	* System.Collections.ObjectModel/NotifyCollectionChangedEventArgs.cs:
+	* System.Collections.ObjectModel/NotifyCollectionChangedEventHandler.cs:
+	Add implementations for ObservableCollection and expand documentation
+
+2008-11-04  Alan McGovern  <[email protected]>
+
+	* Test/System.IO.Packaging/PackagePartTest.cs:
+	* System.IO.Packaging/PackagePropertiesPart.cs: Properties which are
+	null should not be serialized.
+
+2008-11-04  Alan McGovern  <[email protected]>
+
+	* WindowsBase.dll.sources:
+	* System.IO.Packaging/Package.cs:
+	* System.IO.Packaging/ZipPackage.cs:
+	* System.IO.Packaging/PackUriHelper.cs:
+	* Test/System.IO.Packaging/FakePackage.cs:
+	* System.IO.Packaging/PackageProperties.cs:
+	* System.IO.Packaging/PackagePropertiesPart.cs: Complete the
+	implementation of loading/saving PackageProperties. NUnit tests now
+	pass.
+
+2008-11-04  Alan McGovern  <[email protected]>
+
+	* System.IO.Packaging/PackagePropertiesPart.cs: No need to override
+	here.
+
+	* System.IO.Packaging/PackageProperties.cs: Add myself to authors
+
+2008-11-04  Alan McGovern  <[email protected]>
+
+	* WindowsBase.sln:
+	* WindowsBase.csproj: Add solution files to allow working inside MD.
+
+2008-11-04  Alan McGovern  <[email protected]>
+
+	* System.IO.Packaging/PackageProperties.cs:
+	* Test/System.IO.Packaging/PackagePartTest.cs:
+	* System.IO.Packaging/PackagePropertiesPart.cs:
+	* Test/System.IO.Packaging/FakePackageTests.cs: Implement the backend
+	for loading/saving package properties. Add tests for this code.
+
+2008-11-04  Alan McGovern  <[email protected]>
+
+	* ZipSharp/NativeUnzip.cs: Comment out unused method
+
+2008-11-04  Alan McGovern  <[email protected]>
+
+	* System.IO.Packaging/Package.cs: Cosmetic - Make methods alphabetical
+	and group methods/properties together.
+
+2008-11-03  Alan McGovern  <[email protected]>
+
+	* 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  <[email protected]>
+
+	* System.IO.Packaging/Package.cs: Temporary fix test failure until a
+	proper solution can be worked out.
+
+2008-11-03  Alan McGovern  <[email protected]>
+
+	* Test/System.IO.Packaging/PackageTest.cs: Enable test now that it works
+
+2008-11-03  Alan McGovern  <[email protected]>
+
+	* 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  <[email protected]>
+
+	* 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  <[email protected]>
+
+	* 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  <[email protected]>
+
+	* System.IO.Packaging/PackUriHelper.cs: Generate the new Uri properly
+
+2008-11-03  Alan McGovern  <[email protected]>
+
+	* 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  <[email protected]>
+
+	* 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  <[email protected]>
+
+	
+
+
+
+2008-10-30  Alan McGovern  <[email protected]>
+
+	* 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  <[email protected]>
+
+	* 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  <[email protected]>
+
+	* 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  <[email protected]>
+
+	* 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  <[email protected]>
+
+	* System.IO.Packaging/Package.cs:
+	* System.IO.Packaging/ZipPackage.cs: Write relationships to the zipfile
+
+2008-10-28  Alan McGovern  <[email protected]>
+
+	* 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  <[email protected]>
+
+	* 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 <[email protected]>
+
+	* System.Windows/Rect.cs: Operator != and == implementation.
+	* Test/System.Windows/RectTest.cs: New test: Equals_Operator.
+
+2008-10-17  Alan McGovern  <[email protected]>
+
+	* Test/System.IO.Packaging/PackagePartStreamTests.cs: Uncomment the test
+	as compiling with mono-head fixes the issue.
+
+2008-10-17  Alan McGovern  <[email protected]>
+
+	* 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  <[email protected]>
+
+	* Test/System.IO.Packaging/FakePackageTests.cs: Make the test cover all
+	Relationship based methods
+
+2008-10-17  Alan McGovern  <[email protected]>
+
+	* 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  <[email protected]>
+
+	* 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  <[email protected]>
+
+	* 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  <[email protected]>
+
+	* System.IO.Packaging/Package.cs:
+	* System.IO.Packaging/PackagePart.cs:
+	* System.IO.Packaging/PackageRelationship.cs: Use automatic properties
+
+2008-10-16  Alan McGovern  <[email protected]>
+
+	* 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  <[email protected]>
+
+	* 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  <[email protected]>
+
+	* 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  <[email protected]>
+
+	* Test/System.IO.Packaging/FakePackagePartTests.cs: Add NotWorking
+	attribute to test.
+
+2008-10-15  Alan McGovern  <[email protected]>
+
+	* 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  <[email protected]>
+
+	* 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  <[email protected]>
+
+	* System.IO.Packaging/Package.cs: Use the FileInfo object rather than
+	calling File.Exists. Comply with coding guidelines better.
+
+2008-10-15  Alan McGovern  <[email protected]>
+
+	* 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  <[email protected]>
+
+	* 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  <[email protected]>
+
+	* 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  <[email protected]>
+
+	* 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  <[email protected]>
+
+	* System.Windows/DependencyObjectType.cs: implement such that it
+	passes all unit tests.
+
+2007-01-25  Miguel de Icaza  <[email protected]>
+
+	* 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  <[email protected]>
+
+	* Test/AttachedProperties.cs: made LocalValueEnumerator test not
+	depend on unstable implementation details
+
+2005-07-19  Iain McCoy  <[email protected]>
+
+	* 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  <[email protected]>
+
+	* 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  <[email protected]>
+
+	* whole folder: initial implementation of the DependencyProperty
+	system

+ 13 - 0
mcs/class/WindowsBase/Makefile

@@ -0,0 +1,13 @@
+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
+
+ifeq (2.0, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += -d:NET_3_0
+endif
+
+include ../../build/library.make

+ 182 - 0
mcs/class/WindowsBase/System.Collections.ObjectModel/ObservableCollection.cs

@@ -0,0 +1,182 @@
+// 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 ([email protected])
+//	Brian O'Keefe ([email protected])
+//
+
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.ComponentModel;
+
+namespace System.Collections.ObjectModel {
+	[Serializable]
+	public class ObservableCollection<T> : Collection<T>, INotifyCollectionChanged, INotifyPropertyChanged {
+		
+		private class Reentrant : IDisposable {
+			private int count = 0;
+
+			public Reentrant()
+			{
+			}
+
+			public void Enter()
+			{
+				count++;
+			}
+
+			public void Dispose()
+			{
+				count--;
+			}
+
+			public bool Busy
+			{
+				get { return count > 0; }
+			}
+		}
+
+		private Reentrant reentrant = new Reentrant ();
+
+		public ObservableCollection()
+		{
+		}
+
+		public ObservableCollection(IEnumerable<T> collection)
+		{
+			throw new NotImplementedException ();
+		}
+
+		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 ()
+		{
+			reentrant.Enter ();
+			return reentrant;
+		}
+
+		protected void CheckReentrancy ()
+		{
+			NotifyCollectionChangedEventHandler eh = CollectionChanged;
+
+			// Only have a problem if we have more than one event listener.
+			if (reentrant.Busy && eh != null && eh.GetInvocationList ().Length > 1)
+				throw new InvalidOperationException ("Cannot modify the collection while reentrancy is blocked.");
+		}
+
+		protected override void ClearItems ()
+		{
+			CheckReentrancy ();
+
+			base.ClearItems ();
+
+			OnCollectionChanged (new NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction.Reset));
+			OnPropertyChanged (new PropertyChangedEventArgs ("Count"));
+			OnPropertyChanged (new PropertyChangedEventArgs ("Item[]"));
+		}
+
+		protected override void InsertItem (int index, T item)
+		{
+			CheckReentrancy ();
+
+			base.InsertItem (index, item);
+
+			OnCollectionChanged (new NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction.Add, item, index));
+			OnPropertyChanged (new PropertyChangedEventArgs ("Count"));
+			OnPropertyChanged (new PropertyChangedEventArgs ("Item[]"));
+		}
+
+		public void Move (int oldIndex, int newIndex)
+		{
+			MoveItem (oldIndex, newIndex);
+		}
+
+		protected virtual void MoveItem (int oldIndex, int newIndex)
+		{
+			CheckReentrancy ();
+
+			T item = Items [oldIndex];
+			base.RemoveItem (oldIndex);
+			base.InsertItem (newIndex, item);
+
+			OnCollectionChanged (new NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction.Move, item, newIndex, oldIndex));
+			OnPropertyChanged (new PropertyChangedEventArgs ("Item[]"));
+		}
+
+		protected virtual void OnCollectionChanged (NotifyCollectionChangedEventArgs e)
+		{
+			NotifyCollectionChangedEventHandler eh = CollectionChanged;
+
+			if (eh != null) {
+				// Make sure that the invocation is done before the collection changes,
+				// Otherwise there's a chance of data corruption.
+				using (BlockReentrancy ()) {
+					eh (this, e);
+				}
+			}
+		}
+
+		protected virtual void OnPropertyChanged (PropertyChangedEventArgs e)
+		{
+			PropertyChangedEventHandler eh = PropertyChanged;
+
+			if (eh != null)
+				eh (this, e);
+		}
+
+		protected override void RemoveItem (int index)
+		{
+			CheckReentrancy ();
+
+			T item = Items [index];
+
+			base.RemoveItem (index);
+
+			OnCollectionChanged (new NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction.Remove, item, index));
+			OnPropertyChanged (new PropertyChangedEventArgs ("Count"));
+			OnPropertyChanged (new PropertyChangedEventArgs ("Item[]"));
+		}
+
+		protected override void SetItem (int index, T item)
+		{
+			CheckReentrancy ();
+
+			T oldItem = Items [index];
+
+			base.SetItem (index, item);
+
+			OnCollectionChanged (new NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction.Replace, item, oldItem, index));
+			OnPropertyChanged (new PropertyChangedEventArgs ("Item[]"));
+		}
+	}
+}

+ 81 - 0
mcs/class/WindowsBase/System.Collections.ObjectModel/ReadOnlyObservableCollection.cs

@@ -0,0 +1,81 @@
+// 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 ([email protected])
+//	Brian O'Keefe ([email protected])
+//
+
+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)
+		{
+			((INotifyPropertyChanged)list).PropertyChanged += SourceCollection_PropertyChanged;
+			((INotifyCollectionChanged)list).CollectionChanged += SourceCollection_CollectionChanged;
+		}
+
+		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)
+		{
+			NotifyCollectionChangedEventHandler eh = CollectionChanged;
+
+			if (eh != null)
+				eh (this, args);
+		}
+
+		protected virtual void OnPropertyChanged (PropertyChangedEventArgs args)
+		{
+			PropertyChangedEventHandler eh = PropertyChanged;
+
+			if (eh != null)
+				eh (this, args);
+		}
+
+		private void SourceCollection_CollectionChanged (object sender, NotifyCollectionChangedEventArgs e)
+		{
+			OnCollectionChanged (e);
+		}
+
+		private void SourceCollection_PropertyChanged (object sender, PropertyChangedEventArgs e)
+		{
+			OnPropertyChanged (e);
+		}
+	}
+
+}

+ 7 - 0
mcs/class/WindowsBase/System.Collections.Specialized/ChangeLog

@@ -0,0 +1,7 @@
+2008-11-04  Chris Toshok  <[email protected]>
+
+	* CollectionChangedEventManager.cs: implement this using the msdn
+	docs.  Unfortunately we lack the ability to write unit tests at
+	the moment, as there's no (that I can find) public use of this
+	type in the api.  Certainly not in WindowsBase.
+

+ 80 - 0
mcs/class/WindowsBase/System.Collections.Specialized/CollectionChangedEventManager.cs

@@ -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 ([email protected])
+//
+
+using System;
+using System.Windows;
+
+namespace System.Collections.Specialized {
+
+	public class CollectionChangedEventManager : WeakEventManager
+	{
+		internal CollectionChangedEventManager ()
+		{
+		}
+
+		public static void AddListener (INotifyCollectionChanged source, IWeakEventListener listener)
+		{
+			CurrentManager.ProtectedAddListener (source, listener);
+		}
+
+		public static void RemoveListener (INotifyCollectionChanged source, IWeakEventListener listener)
+		{
+			CurrentManager.ProtectedAddListener (source, listener);
+		}
+
+		protected override void StartListening (object source)
+		{
+			INotifyCollectionChanged inotify = (INotifyCollectionChanged) source;
+			inotify.CollectionChanged += OnCollectionChanged;
+		}
+
+		protected override void StopListening (object source)
+		{
+			INotifyCollectionChanged inotify = (INotifyCollectionChanged) source;
+			inotify.CollectionChanged -= OnCollectionChanged;
+		}
+
+		private void OnCollectionChanged (object sender, NotifyCollectionChangedEventArgs e)
+		{
+			DeliverEvent (sender, e);
+		}
+
+		private static object CurrentManagerLock = new object ();
+
+		private static CollectionChangedEventManager CurrentManager {
+			get {
+				lock (CurrentManagerLock) {
+					CollectionChangedEventManager manager = (CollectionChangedEventManager)GetCurrentManager (typeof (CollectionChangedEventManager));
+					if (manager == null) {
+						manager = new CollectionChangedEventManager ();
+						SetCurrentManager (typeof (CollectionChangedEventManager), manager);
+					}
+					return manager;
+				}
+			}
+		}
+	}
+}
+

+ 36 - 0
mcs/class/WindowsBase/System.Collections.Specialized/INotifyCollectionChanged.cs

@@ -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 ([email protected])
+//
+
+using System;
+using System.Windows;
+
+namespace System.Collections.Specialized {
+
+	public interface INotifyCollectionChanged {
+
+		event NotifyCollectionChangedEventHandler CollectionChanged;
+	}
+
+}

+ 38 - 0
mcs/class/WindowsBase/System.Collections.Specialized/NotifyCollectionChangedAction.cs

@@ -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 ([email protected])
+//
+
+using System;
+
+namespace System.Collections.Specialized {
+
+	public enum NotifyCollectionChangedAction {
+		Add,
+		Remove,
+		Replace,
+		Move,
+		Reset
+	}
+
+}

+ 211 - 0
mcs/class/WindowsBase/System.Collections.Specialized/NotifyCollectionChangedEventArgs.cs

@@ -0,0 +1,211 @@
+// 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 ([email protected])
+//	Brian O'Keefe ([email protected])
+//
+
+namespace System.Collections.Specialized {
+	public class NotifyCollectionChangedEventArgs : EventArgs {
+		private NotifyCollectionChangedAction action;
+		private IList oldItems, newItems;
+		private int oldIndex = -1, newIndex = -1;
+
+		#region Constructors
+
+		public NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction action)
+		{
+			this.action = action;
+
+			if (action != NotifyCollectionChangedAction.Reset)
+				throw new ArgumentException ("This constructor can only be used with the Reset action.", "action");
+		}
+
+		public NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction action, IList changedItems)
+			: this (action, changedItems, -1)
+		{
+		}
+
+		public NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction action, object changedItem)
+			: this (action, changedItem, -1)
+		{
+		}
+
+		public NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction action, IList newItems, IList oldItems)
+			: this (action, newItems, oldItems, -1)
+		{
+		}
+
+		public NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction action, IList changedItems, int startingIndex)
+		{
+			this.action = action;
+
+			if (action == NotifyCollectionChangedAction.Add || action == NotifyCollectionChangedAction.Remove) {
+				if (changedItems == null)
+					throw new ArgumentNullException ("changedItems");
+
+				if (startingIndex < -1)
+					throw new ArgumentException ("The value of startingIndex must be -1 or greater.", "startingIndex");
+
+				if (action == NotifyCollectionChangedAction.Add)
+					InitializeAdd (changedItems, startingIndex);
+				else
+					InitializeRemove (changedItems, startingIndex);
+			} else if (action == NotifyCollectionChangedAction.Reset) {
+				if (changedItems != null)
+					throw new ArgumentException ("This constructor can only be used with the Reset action if changedItems is null", "changedItems");
+
+				if (startingIndex != -1)
+					throw new ArgumentException ("This constructor can only be used with the Reset action if startingIndex is -1", "startingIndex");
+			} else {
+				throw new ArgumentException ("This constructor can only be used with the Reset, Add, or Remove actions.", "action");
+			}
+		}
+
+		public NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction action, object changedItem, int index)
+		{
+			IList changedItems = new object [] { changedItem };
+			this.action = action;
+
+			if (action == NotifyCollectionChangedAction.Add)
+				InitializeAdd (changedItems, index);
+			else if (action == NotifyCollectionChangedAction.Remove)
+				InitializeRemove (changedItems, index);
+			else if (action == NotifyCollectionChangedAction.Reset) {
+				if (changedItem != null)
+					throw new ArgumentException ("This constructor can only be used with the Reset action if changedItem is null", "changedItem");
+
+				if (index != -1)
+					throw new ArgumentException ("This constructor can only be used with the Reset action if index is -1", "index");
+			} else {
+				throw new ArgumentException ("This constructor can only be used with the Reset, Add, or Remove actions.", "action");
+			}
+		}
+
+		public NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction action, object newItem, object oldItem)
+			: this (action, newItem, oldItem, -1)
+		{
+		}
+
+		public NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction action, IList newItems, IList oldItems, int index)
+		{
+			this.action = action;
+
+			if (action != NotifyCollectionChangedAction.Replace)
+				throw new ArgumentException ("This constructor can only be used with the Replace action.", "action");
+
+			if (newItems == null)
+				throw new ArgumentNullException ("newItems");
+
+			if (oldItems == null)
+				throw new ArgumentNullException ("oldItems");
+
+			this.oldItems = oldItems;
+			this.newItems = newItems;
+
+			oldIndex = index;
+			newIndex = index;
+		}
+
+		public NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction action, IList changedItems, int index, int oldIndex)
+		{
+			this.action = action;
+
+			if (action != NotifyCollectionChangedAction.Move)
+				throw new ArgumentException ("This constructor can only be used with the Move action.", "action");
+
+			if (index < -1)
+				throw new ArgumentException ("The value of index must be -1 or greater.", "index");
+
+			InitializeMove (changedItems, index, oldIndex);
+		}
+
+		public NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction action, object changedItem, int index, int oldIndex)
+			: this (action, new object [] { changedItem }, index, oldIndex)
+		{
+		}
+
+		public NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction action, object newItem, object oldItem, int index)
+		{
+			this.action = action;
+
+			if (action != NotifyCollectionChangedAction.Replace)
+				throw new ArgumentException ("This constructor can only be used with the Replace action.", "action");
+
+			InitializeReplace (new object [] { newItem }, new object [] { oldItem }, index);
+		}
+
+		#endregion
+
+		#region Accessor Properties
+
+		public NotifyCollectionChangedAction Action {
+			get { return action; }
+		}
+
+		public IList NewItems {
+			get { return newItems; }
+		}
+
+		public int NewStartingIndex {
+			get { return newIndex; }
+		}
+
+		public IList OldItems {
+			get { return oldItems; }
+		}
+
+		public int OldStartingIndex {
+			get { return oldIndex; }
+		}
+
+		#endregion
+
+		#region Initialize Methods
+
+		private void InitializeAdd(IList items, int index)
+		{
+			this.newItems = ArrayList.ReadOnly (items);
+			this.newIndex = index;
+		}
+
+		private void InitializeRemove(IList items, int index)
+		{
+			this.oldItems = ArrayList.ReadOnly (items);
+			this.oldIndex = index;
+		}
+
+		private void InitializeMove(IList changedItems, int newItemIndex, int oldItemIndex)
+		{
+			InitializeAdd (changedItems, newItemIndex);
+			InitializeRemove (changedItems, oldItemIndex);
+		}
+
+		private void InitializeReplace(IList addedItems, IList removedItems, int index)
+		{
+			InitializeAdd (addedItems, index);
+			InitializeRemove (removedItems, index);
+		}
+
+		#endregion
+	}
+}

+ 32 - 0
mcs/class/WindowsBase/System.Collections.Specialized/NotifyCollectionChangedEventHandler.cs

@@ -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 ([email protected])
+//
+
+using System;
+
+namespace System.Collections.Specialized {
+
+	public delegate void NotifyCollectionChangedEventHandler (object sender, NotifyCollectionChangedEventArgs e);
+
+}

+ 59 - 0
mcs/class/WindowsBase/System.ComponentModel/CurrentChangedEventManager.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+
+}
+

+ 63 - 0
mcs/class/WindowsBase/System.ComponentModel/CurrentChangingEventArgs.cs

@@ -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 ([email protected])
+//	Brian O'Keefe ([email protected])
+//
+
+using System;
+using System.Windows;
+
+namespace System.ComponentModel {
+
+	public class CurrentChangingEventArgs : EventArgs
+	{
+		private bool canCancelEvent;
+		private bool canceled;
+	
+		public CurrentChangingEventArgs ()
+			:this(true)
+		{
+		}
+
+		public CurrentChangingEventArgs (bool isCancelable)
+		{
+			canCancelEvent = isCancelable;
+			canceled = false;
+		}
+
+		public bool Cancel {
+			get { return canceled; }
+			set {
+				if(!IsCancelable && value)
+					throw new InvalidOperationException("Cannot cancel an event that is not Cancelable.");
+				canceled = value; 
+			}
+		}
+
+		public bool IsCancelable {
+			get { return canCancelEvent; }
+		}
+		
+	}
+
+}

+ 32 - 0
mcs/class/WindowsBase/System.ComponentModel/CurrentChangingEventHandler.cs

@@ -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 ([email protected])
+//
+
+using System;
+
+namespace System.ComponentModel {
+
+	public delegate void CurrentChangingEventHandler (object sender, CurrentChangingEventArgs args);
+
+}

+ 59 - 0
mcs/class/WindowsBase/System.ComponentModel/CurrentChangingEventManager.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+
+}
+

+ 165 - 0
mcs/class/WindowsBase/System.ComponentModel/DependencyPropertyDescriptor.cs

@@ -0,0 +1,165 @@
+// 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 ([email protected])
+//
+
+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 ();
+		}
+
+		public CoerceValueCallback DesignerCoerceValueCallback {
+			get { throw new NotImplementedException (); }
+			set { throw new NotImplementedException (); }
+		}
+	}
+
+}

+ 70 - 0
mcs/class/WindowsBase/System.ComponentModel/GroupDescription.cs

@@ -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 ([email protected])
+//
+
+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);
+
+	}
+
+}

+ 65 - 0
mcs/class/WindowsBase/System.ComponentModel/ICollectionView.cs

@@ -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 ([email protected])
+//
+
+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 ();
+	}
+
+}

+ 33 - 0
mcs/class/WindowsBase/System.ComponentModel/ICollectionViewFactory.cs

@@ -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 ([email protected])
+//
+
+namespace System.ComponentModel {
+
+	public interface ICollectionViewFactory {
+		ICollectionView CreateView ();
+	}
+
+}
+

+ 54 - 0
mcs/class/WindowsBase/System.ComponentModel/IEditableCollectionView.cs

@@ -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) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+//	Chris Toshok ([email protected])
+//
+
+namespace System.ComponentModel {
+
+	public interface IEditableCollectionView {
+		void EditItem (object item);
+		object AddNew ();
+
+		void CancelEdit ();
+		void CancelNew ();
+
+		void CommitEdit ();
+		void CommitNew ();
+
+		void Remove (object item);
+		void RemoveAt (int index);
+
+		object CurrentAddItem { get; }
+		object CurrentEditItem { get; }
+
+		bool CanAddNew { get; }
+		bool CanCancelEdit { get; }
+		bool CanRemove { get; }
+
+		bool IsAddingNew { get; }
+		bool IsEditingItem { get; }
+
+		NewItemPlaceholderPosition NewItemPlaceholderPosition { get; set; }
+	}
+
+}

+ 34 - 0
mcs/class/WindowsBase/System.ComponentModel/IItemProperties.cs

@@ -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)
+//
+// Author:
+//	Chris Toshok ([email protected])
+//
+
+using System.Collections.ObjectModel;
+
+namespace System.ComponentModel {
+
+	public interface IItemProperties {
+		ReadOnlyCollection<ItemPropertyInfo> ItemProperties { get; }
+	}
+
+}

+ 52 - 0
mcs/class/WindowsBase/System.ComponentModel/ItemPropertyInfo.cs

@@ -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)
+//
+// Author:
+//	Chris Toshok ([email protected])
+//
+
+namespace System.ComponentModel {
+
+	public class ItemPropertyInfo {
+		public ItemPropertyInfo (string name, Type type, object descriptor)
+		{
+			Name = name;
+			PropertyType = type;
+			Descriptor = descriptor;
+		}
+
+		public string Name {
+			get;
+			private set;
+		}
+
+		public Type PropertyType {
+			get;
+			private set;
+		}
+
+		public object Descriptor {
+			get;
+			private set;
+		}
+	}
+
+}

+ 34 - 0
mcs/class/WindowsBase/System.ComponentModel/NewItemPlaceholderPosition.cs

@@ -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)
+//
+// Author:
+//	Chris Toshok ([email protected])
+//
+
+namespace System.ComponentModel {
+
+	public enum NewItemPlaceholderPosition {
+		None,
+		AtBeginning,
+		AtEnd
+	}
+
+}

+ 63 - 0
mcs/class/WindowsBase/System.ComponentModel/PropertyChangedEventManager.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+
+}

+ 70 - 0
mcs/class/WindowsBase/System.ComponentModel/PropertyFilterAttribute.cs

@@ -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 ([email protected])
+//	Brian O'Keefe ([email protected])
+//
+
+using System;
+
+namespace System.ComponentModel {
+
+	[AttributeUsage (AttributeTargets.Property | AttributeTargets.Method)]
+	public sealed class PropertyFilterAttribute : Attribute
+	{
+		public static readonly PropertyFilterAttribute Default = new PropertyFilterAttribute(PropertyFilterOptions.All);
+
+		private PropertyFilterOptions options;
+
+		public PropertyFilterAttribute (PropertyFilterOptions filter)
+		{
+			options = filter;
+		}
+
+		public PropertyFilterOptions Filter {
+			get { return options; }
+		}
+
+		public override bool Equals (object value)
+		{
+			if (!(value is PropertyFilterAttribute))
+				return false;
+			return ((PropertyFilterAttribute)value).options == options;
+		}
+
+		public override int GetHashCode ()
+		{
+			return options.GetHashCode ();
+		}
+
+		public override bool Match (object value)
+		{
+			if (!(value is PropertyFilterAttribute))
+				return false;
+
+			PropertyFilterOptions other = ((PropertyFilterAttribute)value).options;
+			PropertyFilterOptions common = other & options;	
+
+			return common == options;
+		}
+	}
+}

+ 40 - 0
mcs/class/WindowsBase/System.ComponentModel/PropertyFilterOptions.cs

@@ -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 ([email protected])
+//
+
+using System;
+
+namespace System.ComponentModel {
+
+	[Flags]
+	public enum PropertyFilterOptions {
+		None = 0,
+		Invalid = 1,
+		SetValues = 2,
+		UnsetValues = 4,
+		Valid = 8,
+		All = 15
+	}
+}
+

+ 103 - 0
mcs/class/WindowsBase/System.ComponentModel/SortDescription.cs

@@ -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) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//	Chris Toshok ([email protected])
+//	Brian O'Keefe ([email protected])
+//
+
+using System;
+
+namespace System.ComponentModel {
+
+	public struct SortDescription
+	{
+		private string sortPropertyName;
+		private ListSortDirection sortDirection;
+		private bool isSealed;
+
+		public SortDescription (string propertyName, ListSortDirection direction)
+		{
+			if(direction != ListSortDirection.Ascending && direction != ListSortDirection.Descending)
+				throw new InvalidEnumArgumentException("direction", (int)direction, typeof(ListSortDirection));
+
+			sortPropertyName = propertyName;
+			sortDirection = direction;
+			isSealed = false;
+		}
+
+		public static bool operator!= (SortDescription sd1, SortDescription sd2)
+		{
+			return !(sd1 == sd2);
+		}
+
+		public static bool operator== (SortDescription sd1, SortDescription sd2)
+		{
+			return sd1.sortDirection == sd2.sortDirection && sd1.sortPropertyName == sd2.sortPropertyName;
+		}
+
+		public ListSortDirection Direction {
+			get { return sortDirection; }
+			set { 
+				if(isSealed)
+					throw new InvalidOperationException("Cannot change Direction once the SortDescription has been sealed.");
+				
+				if(value != ListSortDirection.Ascending && value != ListSortDirection.Descending)
+					throw new InvalidEnumArgumentException("direction", (int)value, typeof(ListSortDirection));
+				
+				sortDirection = value; 
+			}
+		}
+
+		public bool IsSealed {
+			get { return isSealed; }
+		}
+
+		public string PropertyName {
+			get { return sortPropertyName; }
+			set {
+				if(isSealed)
+					throw new InvalidOperationException("Cannot change Direction once the SortDescription has been sealed.");
+				
+				sortPropertyName = value;
+			}
+		}
+
+		public override bool Equals (object obj)
+		{
+			if (!(obj is SortDescription))
+				return false;
+			return ((SortDescription)obj) == this;
+		}
+
+		public override int GetHashCode ()
+		{
+			if(sortPropertyName == null)
+				return sortDirection.GetHashCode ();
+			return sortPropertyName.GetHashCode () ^ sortDirection.GetHashCode ();
+		}
+
+		internal void Seal()
+		{
+			isSealed = true;
+		}
+	}
+}

+ 95 - 0
mcs/class/WindowsBase/System.ComponentModel/SortDescriptionCollection.cs

@@ -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) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//	Chris Toshok ([email protected])
+//	Brian O'Keefe ([email protected])
+//
+
+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 ()
+		{
+			base.ClearItems ();
+			OnCollectionChanged (NotifyCollectionChangedAction.Reset);
+		}
+
+		protected override void InsertItem (int index, SortDescription item)
+		{
+			item.Seal ();
+			base.InsertItem (index, item);
+			OnCollectionChanged (NotifyCollectionChangedAction.Add, item, index);
+		}
+
+		protected override void RemoveItem (int index)
+		{
+			SortDescription sd = base [index];
+			base.RemoveItem (index);
+			OnCollectionChanged (NotifyCollectionChangedAction.Remove, sd, index);
+		}
+
+		protected override void SetItem (int index, SortDescription item)
+		{
+			SortDescription old = base [index];
+			item.Seal ();
+			base.SetItem (index, item);
+			OnCollectionChanged (NotifyCollectionChangedAction.Remove, old, index);
+			OnCollectionChanged (NotifyCollectionChangedAction.Add, item, index);
+		}
+
+		private void OnCollectionChanged (NotifyCollectionChangedAction action)
+		{
+			NotifyCollectionChangedEventHandler eh = CollectionChanged;
+
+			if (eh != null)
+				eh (this, new NotifyCollectionChangedEventArgs (action));
+		}
+
+		private void OnCollectionChanged (NotifyCollectionChangedAction action, SortDescription item, int index)
+		{
+			NotifyCollectionChangedEventHandler eh = CollectionChanged;
+
+			if (eh != null)
+				eh (this, new NotifyCollectionChangedEventArgs (action, item, index));
+		}
+	}
+
+}
+

+ 35 - 0
mcs/class/WindowsBase/System.Diagnostics/PresentationTraceLevel.cs

@@ -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 ([email protected])
+//
+
+namespace System.Diagnostics {
+
+	public enum PresentationTraceLevel {
+		None,
+		Low,
+		Medium,
+		High
+	}
+}
+

+ 89 - 0
mcs/class/WindowsBase/System.Diagnostics/PresentationTraceSources.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+}

+ 35 - 0
mcs/class/WindowsBase/System.IO.Packaging/CertificateEmbeddingOption.cs

@@ -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 ([email protected])
+//
+
+namespace System.IO.Packaging {
+
+	public enum CertificateEmbeddingOption {
+		InCertificatePart,
+		InSignaturePart,
+		NotEmbedded
+	}
+
+}
+

+ 158 - 0
mcs/class/WindowsBase/System.IO.Packaging/Check.cs

@@ -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 ([email protected])
+//
+
+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.UriSchemePack)
+				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");
+		}
+	}
+}

+ 37 - 0
mcs/class/WindowsBase/System.IO.Packaging/CompressionOption.cs

@@ -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 ([email protected])
+//
+
+namespace System.IO.Packaging {
+
+	public enum CompressionOption {
+		NotCompressed = -1,
+		Normal,
+		Maximum,
+		Fast,
+		SuperFast,
+	}
+
+}
+

+ 122 - 0
mcs/class/WindowsBase/System.IO.Packaging/EncryptedPackageEnvelope.cs

@@ -0,0 +1,122 @@
+// 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 ([email protected])
+//
+
+using System;
+using System.IO;
+using System.Security.RightsManagement;
+
+namespace System.IO.Packaging {
+
+	public class EncryptedPackageEnvelope : IDisposable
+	{
+		internal EncryptedPackageEnvelope ()
+		{
+		}
+
+		protected virtual void Dispose (bool disposing)
+		{
+			throw new NotImplementedException ();
+		}
+
+		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 ();
+		}
+	}
+
+}
+

+ 33 - 0
mcs/class/WindowsBase/System.IO.Packaging/EncryptionOption.cs

@@ -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 ([email protected])
+//
+
+namespace System.IO.Packaging {
+
+	public enum EncryptionOption {
+		None,
+		RightsManagement
+	}
+
+}

+ 32 - 0
mcs/class/WindowsBase/System.IO.Packaging/InvalidSignatureEventHandler.cs

@@ -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 ([email protected])
+//
+
+using System;
+
+namespace System.IO.Packaging {
+
+	public delegate void InvalidSignatureEventHandler (object sender, SignatureVerificationEventArgs e);
+
+}

+ 176 - 0
mcs/class/WindowsBase/System.IO.Packaging/PackUriHelper.cs

@@ -0,0 +1,176 @@
+// 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 ([email protected])
+//
+
+using System;
+
+namespace System.IO.Packaging {
+
+	public static class PackUriHelper
+	{
+		public static readonly string UriSchemePack = "pack";
+		static readonly Uri PackSchemeUri = new Uri("pack://", UriKind.Absolute);
+		
+		static PackUriHelper ()
+		{
+			if (!UriParser.IsKnownScheme (UriSchemePack))
+				UriParser.Register (new PackUriParser (), UriSchemePack, -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);
+			if (targetUri.IsAbsoluteUri)
+				throw new ArgumentException ("targetUri", "Absolute URIs are not supported");
+
+			// Need to trim first 7 chars as they are: "file://"
+			return new Uri (new Uri(sourcePartUri, targetUri).OriginalString.Substring(7), UriKind.Relative);
+		}
+	}
+
+}

+ 111 - 0
mcs/class/WindowsBase/System.IO.Packaging/PackUriParser.cs

@@ -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();
+        }
+    }
+}

+ 486 - 0
mcs/class/WindowsBase/System.IO.Packaging/Package.cs

@@ -0,0 +1,486 @@
+// 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 ([email protected])
+//	Alan McGovern ([email protected])
+//
+
+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);
+
+		PackageProperties packageProperties;
+		PackagePartCollection partsCollection;
+		Dictionary<string, PackageRelationship> relationships;
+		PackageRelationshipCollection relationshipsCollection = new PackageRelationshipCollection ();
+		Uri Uri = new Uri ("/", UriKind.Relative);
+		
+
+		public FileAccess FileOpenAccess {
+			get; private set;
+		}
+
+		public PackageProperties PackageProperties {
+			get {
+				// PackageProperties are loaded when the relationships are loaded.
+				// Therefore ensure we've already loaded the relationships.
+				int count = Relationships.Count;
+				
+				if (packageProperties == null) {
+					packageProperties = new PackagePropertiesPart ();
+					packageProperties.Package = this;
+				}
+				return packageProperties;
+			}
+		}
+
+		PackagePartCollection PartsCollection {
+			get {
+				if (partsCollection == null) {
+					partsCollection = new PackagePartCollection ();
+					partsCollection.Parts.AddRange (GetPartsCore ());
+				}
+				return partsCollection;
+			}
+		}
+		
+		int RelationshipId {
+			get; set;
+		}
+		
+		Dictionary<string, PackageRelationship> Relationships {
+			get {
+				if (relationships == null) {
+					LoadRelationships ();
+				}
+				return relationships;
+			}
+		}
+
+		bool Streaming {
+			get; set;
+		}
+		
+		
+		protected Package (FileAccess fileOpenAccess)
+			: this (fileOpenAccess, false)
+		{
+			
+		}
+
+		protected Package (FileAccess fileOpenAccess, bool streaming)
+		{
+			FileOpenAccess = fileOpenAccess;
+			Streaming = streaming;
+		}
+
+
+		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 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;
+		}
+		
+		protected abstract PackagePart CreatePartCore (Uri parentUri, string contentType, CompressionOption compressionOption);
+
+		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)
+		{
+			if (!loading)
+				CheckIsReadOnly ();
+			
+			Check.TargetUri (targetUri);
+			if (targetUri.IsAbsoluteUri && targetMode == TargetMode.Internal)
+				throw new ArgumentException ("TargetUri cannot be absolute for an internal relationship");
+			
+			Check.RelationshipTypeIsValid (relationshipType);
+			Check.IdIsValid (id);
+
+			if (id == null)
+				id = NextId ();
+
+			PackageRelationship r = new PackageRelationship (id, this, relationshipType, Uri, targetMode, targetUri);
+
+			if (!PartExists (RelationshipUri))
+				CreatePartCore (RelationshipUri, RelationshipContentType, CompressionOption.NotCompressed).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 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 void DeletePartCore (Uri partUri);
+
+		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);
+		}
+		
+		void IDisposable.Dispose ()
+		{
+			Flush ();
+			Dispose (true);
+		}
+
+		protected virtual void Dispose (bool disposing)
+		{
+			// Nothing here needs to be disposed of
+		}
+
+		bool flushing = false;
+		public void Flush ()
+		{
+			if (FileOpenAccess == FileAccess.Read || flushing)
+				return;
+
+			flushing = true;
+
+			// Ensure we've loaded the relationships, parts and properties
+			int count = Relationships.Count;
+			
+			if (packageProperties != null)
+				packageProperties.Flush ();
+			
+			FlushCore ();
+
+			flushing = false;
+		}
+
+		protected abstract void FlushCore ();
+
+		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 PackageRelationship GetRelationship (string id)
+		{
+			return Relationships [id];
+		}
+
+		public PackageRelationshipCollection GetRelationships ()
+		{
+			// Ensure the Relationships dict is instantiated first.
+			ICollection <PackageRelationship> rels = Relationships.Values;
+			relationshipsCollection.Relationships.Clear ();
+			relationshipsCollection.Relationships.AddRange (rels);
+			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;
+		}
+
+		void LoadRelationships ()
+		{
+			relationships = new Dictionary<string, PackageRelationship> ();
+
+			if (!PartExists (RelationshipUri))
+				return;
+			
+			using (Stream stream = GetPart (RelationshipUri).GetStream ()) {
+				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);
+
+					Uri uri;
+					try {
+						uri = new Uri (node.Attributes ["Target"].Value.ToString(), UriKind.Relative);
+					} catch {
+						uri = new Uri (node.Attributes ["Target"].Value.ToString(), UriKind.Absolute);
+					}
+					CreateRelationship (uri,
+					                    mode,
+					                    node.Attributes["Type"].Value.ToString (),
+					                    node.Attributes["Id"].Value.ToString (),
+					                    true);
+				}
+				
+				foreach (PackageRelationship r in relationships.Values) {
+					if (r.RelationshipType == System.IO.Packaging.PackageProperties.NSPackagePropertiesRelation) {
+						PackagePart part = GetPart (PackUriHelper.ResolvePartUri (Uri, r.TargetUri));
+						packageProperties = new PackagePropertiesPart ();
+						packageProperties.Package = this;
+						packageProperties.Part = part;
+						packageProperties.LoadFrom (part.GetStream ());
+					}
+				}
+			}
+		}
+		
+		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);
+		}
+
+		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.");
+				}
+			}
+			
+			return new ZipPackage (packageAccess, stream);
+		}
+		
+		public virtual bool PartExists (Uri partUri)
+		{
+			return GetPart (partUri) != null;
+		}
+		
+		public bool RelationshipExists (string id)
+		{
+			return Relationships.ContainsKey (id);
+		}
+
+		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);
+
+				if (relationship.TargetMode != TargetMode.Internal) {
+					XmlAttribute modeAtt = doc.CreateAttribute ("TargetMode");
+					modeAtt.Value = relationship.TargetMode.ToString ();
+					node.Attributes.Append (modeAtt);
+				}
+				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);
+		}
+	}
+}
+

+ 101 - 0
mcs/class/WindowsBase/System.IO.Packaging/PackageDigitalSignature.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+
+	}
+}

+ 168 - 0
mcs/class/WindowsBase/System.IO.Packaging/PackageDigitalSignatureManager.cs

@@ -0,0 +1,168 @@
+// 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 ([email protected])
+//
+
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Security;
+using System.Security.Cryptography.X509Certificates;
+#if notyet
+using System.Security.Cryptography.Xml;
+#endif
+
+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 (); }
+			set { 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<DataObject> signatureObjects,
+						     IEnumerable<Reference> objectReferences)
+		{
+			throw new NotImplementedException ();
+		}
+#endif
+
+		[SecurityCritical]
+		public static X509ChainStatusFlags VerifyCertificate (X509Certificate certificate)
+		{
+			throw new NotImplementedException ();
+		}
+
+		public VerifyResult VerifySignatures (bool exitOnFailure)
+		{
+			throw new NotImplementedException ();
+		}
+	}
+
+}

+ 265 - 0
mcs/class/WindowsBase/System.IO.Packaging/PackagePart.cs

@@ -0,0 +1,265 @@
+// 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 ([email protected])
+//  Alan McGovern ([email protected])
+//
+
+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 ()
+		{
+			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)
+		{
+			bool notAllowed = mode == FileMode.Append || mode == FileMode.CreateNew || mode == FileMode.Truncate;
+			if (access != FileAccess.Read && notAllowed)
+				throw new ArgumentException (string.Format (string.Format ("FileMode '{0}' not supported", mode)));
+
+			if (access == FileAccess.Read && (notAllowed || mode == FileMode.Create))
+				throw new IOException (string.Format ("FileMode '{0}' not allowed on a readonly stream", mode));
+			
+			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);
+		}
+	}
+}

+ 52 - 0
mcs/class/WindowsBase/System.IO.Packaging/PackagePartCollection.cs

@@ -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 ([email protected])
+// Alan McGovern ([email protected])
+//
+
+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> ();
+		}
+
+		public IEnumerator<PackagePart> GetEnumerator ()
+		{
+			return Parts.GetEnumerator ();
+		}
+
+		IEnumerator IEnumerable.GetEnumerator ()
+		{
+			return Parts.GetEnumerator ();
+		}
+	}
+}

+ 110 - 0
mcs/class/WindowsBase/System.IO.Packaging/PackageProperties.cs

@@ -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 ([email protected])
+//  Alan McGovern ([email protected])
+//
+
+using System;
+using System.Xml;
+
+namespace System.IO.Packaging {
+
+	public abstract class PackageProperties : IDisposable
+	{
+		internal const string NSPackageProperties = "http://schemas.openxmlformats.org/package/2006/metadata/core-properties";
+		internal const string NSPackagePropertiesRelation = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
+		internal const string PackagePropertiesContentType = "application/vnd.openxmlformats-package.core-properties+xml";
+
+
+		static int uuid;
+		
+		protected PackageProperties ()
+		{
+			
+		}
+
+		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; }
+		internal Package Package { get; set; }
+		internal PackagePart Part { 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; }
+				
+		
+		public void Dispose ()
+		{
+			Dispose (true);
+		}
+
+		protected virtual void Dispose (bool disposing)
+		{
+			// Nothing
+		}
+
+		internal void Flush ()
+		{
+			using (MemoryStream temp = new MemoryStream ()) {
+				using (XmlTextWriter writer = new XmlTextWriter (temp, System.Text.Encoding.UTF8)) {
+					WriteTo (writer);
+					writer.Flush ();
+					if (temp.Length == 0)
+						return;
+				}
+			}
+			
+			if (Part == null)
+			{
+				int id = System.Threading.Interlocked.Increment (ref uuid);
+				Uri uri = new Uri (string.Format ("/package/services/metadata/core-properties/{0}.psmdcp", id), UriKind.Relative);
+				Part = Package.CreatePart (uri, PackagePropertiesContentType);
+				PackageRelationship rel = Package.CreateRelationship (uri, TargetMode.Internal, NSPackagePropertiesRelation);
+			}
+			
+			using (Stream s = Part.GetStream (FileMode.Create))
+				using (XmlTextWriter writer = new XmlTextWriter (s, System.Text.Encoding.UTF8))
+					WriteTo (writer);
+		}
+		
+		internal virtual void LoadFrom (Stream stream)
+		{
+
+		}
+
+		internal virtual void WriteTo (XmlTextWriter writer)
+		{
+			
+		}
+	}
+}

+ 297 - 0
mcs/class/WindowsBase/System.IO.Packaging/PackagePropertiesPart.cs

@@ -0,0 +1,297 @@
+// PackagePropertiesPart.cs created with MonoDevelop
+// User: alan at 11:07 04/11/2008
+//
+// To change standard headers go to Edit->Preferences->Coding->Standard Headers
+//
+
+using System;
+using System.Xml;
+
+namespace System.IO.Packaging
+{
+	class PackagePropertiesPart : PackageProperties
+	{
+		const string NSDc = "http://purl.org/dc/elements/1.1/";
+		const string NSDcTerms = "http://purl.org/dc/terms/";
+		const string NSXsi = "http://www.w3.org/2001/XMLSchema-instance";
+		
+		string category;
+		string contentStatus;
+		string contentType;
+		DateTime? created;
+		string creator;
+		string description;
+		string identifier;
+		string keywords;
+		string language;
+		string lastModifiedBy;
+		DateTime? lastPrinted;
+		DateTime? modified;
+		string revision;
+		string subject;
+		string title;
+		string version;
+
+		public PackagePropertiesPart ()
+		{
+			
+		}
+
+		public override string Category {
+			get {
+				return category;
+			}
+			set {
+				Package.CheckIsReadOnly ();
+				category = value;
+			}
+		}
+		public override string ContentStatus {
+			get {
+				return contentStatus;
+			}
+			set {
+				Package.CheckIsReadOnly ();
+				contentStatus = value;
+			}
+		}
+		public override string ContentType {
+			get {
+				return contentType;
+			}
+			set {
+				Package.CheckIsReadOnly ();
+				contentType = value;
+			}
+		}
+		public override DateTime? Created {
+			get {
+				return created;
+			}
+			set {
+				Package.CheckIsReadOnly ();
+				created = value;
+			}
+		}
+		public override string Creator {
+			get {
+				return creator;
+			}
+			set {
+				Package.CheckIsReadOnly ();
+				creator = value;
+			}
+		}
+		public override string Description {
+			get {
+				return description;
+			}
+			set {
+				Package.CheckIsReadOnly ();
+				description = value;
+			}
+		}
+		public override string Identifier {
+			get {
+				return identifier;
+			}
+			set {
+				Package.CheckIsReadOnly ();
+				identifier = value;
+			}
+		}
+		public override string Keywords {
+			get {
+				return keywords;
+			}
+			set {
+				Package.CheckIsReadOnly ();
+				keywords = value;
+			}
+		}
+		public override string Language {
+			get {
+				return language;
+			}
+			set {
+				Package.CheckIsReadOnly ();
+				language = value;
+			}
+		}
+		public override string LastModifiedBy {
+			get {
+				return lastModifiedBy;
+			}
+			set {
+				Package.CheckIsReadOnly ();
+				lastModifiedBy = value;
+			}
+		}
+		public override DateTime? LastPrinted {
+			get {
+				return lastPrinted;
+			}
+			set {
+				Package.CheckIsReadOnly ();
+				lastPrinted = value;
+			}
+		}
+		public override DateTime? Modified {
+			get {
+				return modified;
+			}
+			set {
+				Package.CheckIsReadOnly ();
+				modified = value;
+			}
+		}
+		public override string Revision {
+			get {
+				return revision;
+			}
+			set {
+				Package.CheckIsReadOnly ();
+				revision = value;
+			}
+		}
+		public override string Subject {
+			get {
+				return subject;
+			}
+			set {
+				Package.CheckIsReadOnly ();
+				subject = value;
+			}
+		}
+		public override string Title {
+			get {
+				return title;
+			}
+			set {
+				Package.CheckIsReadOnly ();
+				title = value;
+			}
+		}
+		public override string Version {
+			get {
+				return version;
+			}
+			set {
+				Package.CheckIsReadOnly ();
+				version = value;
+			}
+		}
+		
+		internal override void LoadFrom (Stream stream)
+		{
+			if (stream.Length == 0)
+				return;
+			
+			XmlDocument doc = new XmlDocument ();
+			doc.Load (stream);
+			
+			XmlNamespaceManager manager = new XmlNamespaceManager (doc.NameTable);
+			manager.AddNamespace ("prop", NSPackageProperties);
+			manager.AddNamespace ("dc", NSDc);
+			manager.AddNamespace ("dcterms", NSDcTerms);
+			manager.AddNamespace ("xsi", NSXsi);
+
+			XmlNode node;
+			if ((node = doc.SelectSingleNode ("prop:coreProperties/prop:category", manager)) != null)
+				category = node.InnerXml;
+            if ((node = doc.SelectSingleNode ("prop:coreProperties/prop:contentStatus", manager)) != null)
+				contentStatus = node.InnerXml;
+            if ((node = doc.SelectSingleNode ("prop:coreProperties/prop:contentType", manager)) != null)
+				contentType = node.InnerXml;
+			if ((node = doc.SelectSingleNode ("prop:coreProperties/dcterms:created", manager)) != null)
+				created = DateTime.Parse (node.InnerXml);
+            if ((node = doc.SelectSingleNode ("prop:coreProperties/dc:creator", manager)) != null)
+				creator = node.InnerXml;
+            if ((node = doc.SelectSingleNode ("prop:coreProperties/dc:description", manager)) != null)
+				description = node.InnerXml;
+			if ((node = doc.SelectSingleNode ("prop:coreProperties/dc:identifier", manager)) != null)
+				identifier = node.InnerXml;
+            if ((node = doc.SelectSingleNode ("prop:coreProperties/prop:keywords", manager)) != null)
+				keywords = node.InnerXml;
+            if ((node = doc.SelectSingleNode ("prop:coreProperties/dc:language", manager)) != null)
+				language = node.InnerXml;
+            if ((node = doc.SelectSingleNode ("prop:coreProperties/prop:lastModifiedBy", manager)) != null)
+				lastModifiedBy = node.InnerXml;
+            if ((node = doc.SelectSingleNode ("prop:coreProperties/prop:lastPrinted", manager)) != null)
+				lastPrinted = DateTime.Parse (node.InnerXml);
+            if ((node = doc.SelectSingleNode ("prop:coreProperties/dcterms:modified", manager)) != null)
+				modified = DateTime.Parse (node.InnerXml);
+            if ((node = doc.SelectSingleNode ("prop:coreProperties/prop:revision", manager)) != null)
+				revision = node.InnerXml;
+            if ((node = doc.SelectSingleNode ("prop:coreProperties/dc:subject", manager)) != null)
+				subject = node.InnerXml;
+            if ((node = doc.SelectSingleNode ("prop:coreProperties/dc:title", manager)) != null)
+				title = node.InnerXml;
+            if ((node = doc.SelectSingleNode ("prop:coreProperties/prop:version", manager)) != null)
+				version = node.InnerXml;
+		}
+
+		internal override void WriteTo(XmlTextWriter writer)
+		{
+			XmlDocument doc = new XmlDocument ();
+			XmlNamespaceManager manager = new XmlNamespaceManager (doc.NameTable);
+			manager.AddNamespace ("prop", NSPackageProperties);
+			manager.AddNamespace ("dc", NSDc);
+			manager.AddNamespace ("dcterms", NSDcTerms);
+			manager.AddNamespace ("xsi", NSXsi);
+			
+			// Create XML declaration
+			doc.AppendChild (doc.CreateXmlDeclaration ("1.0", "UTF-8", null));
+
+			// Create root node with required namespace declarations
+			XmlNode coreProperties = doc.AppendChild (doc.CreateNode (XmlNodeType.Element, "coreProperties", NSPackageProperties));
+			coreProperties.Attributes.Append (doc.CreateAttribute ("xmlns:dc")).Value = NSDc;
+			coreProperties.Attributes.Append (doc.CreateAttribute ("xmlns:dcterms")).Value = NSDcTerms;
+			coreProperties.Attributes.Append (doc.CreateAttribute ("xmlns:xsi")).Value = NSXsi;
+
+			// Create the children
+			if (Category != null)
+				coreProperties.AppendChild (doc.CreateNode (XmlNodeType.Element, "category", NSPackageProperties)).InnerXml = Category;
+			if (ContentStatus != null)
+				coreProperties.AppendChild (doc.CreateNode (XmlNodeType.Element, "contentStatus", NSPackageProperties)).InnerXml = ContentStatus;
+			if (ContentType != null)
+			coreProperties.AppendChild (doc.CreateNode (XmlNodeType.Element, "contentType", NSPackageProperties)).InnerXml = ContentType;
+			if (Created.HasValue)
+				coreProperties.AppendChild (doc.CreateNode (XmlNodeType.Element, "dcterms", "created", NSDcTerms)).InnerXml = Created.Value.ToString ();
+			if (Creator != null)
+				coreProperties.AppendChild (doc.CreateNode (XmlNodeType.Element, "dc", "creator", NSDc)).InnerXml = Creator;
+			if (Description != null)
+				coreProperties.AppendChild (doc.CreateNode (XmlNodeType.Element, "dc", "description", NSDc)).InnerXml = Description;
+			if (Identifier != null)
+				coreProperties.AppendChild (doc.CreateNode (XmlNodeType.Element, "dc", "identifier", NSDc)).InnerXml = Identifier;
+			if (Keywords != null)
+				coreProperties.AppendChild (doc.CreateNode (XmlNodeType.Element, "keywords", NSPackageProperties)).InnerXml = Keywords;
+			if (Language != null)
+				coreProperties.AppendChild (doc.CreateNode (XmlNodeType.Element, "dc", "language", NSDc)).InnerXml = Language;
+			if (LastModifiedBy != null)
+				coreProperties.AppendChild (doc.CreateNode (XmlNodeType.Element, "lastModifiedBy", NSPackageProperties)).InnerXml = LastModifiedBy;
+			if (LastPrinted.HasValue)
+				coreProperties.AppendChild (doc.CreateNode (XmlNodeType.Element, "lastPrinted", NSPackageProperties)).InnerXml = LastPrinted.Value.ToString ();
+			if (Revision != null)
+				coreProperties.AppendChild (doc.CreateNode (XmlNodeType.Element, "revision", NSPackageProperties)).InnerXml = Revision;
+			if (Subject != null)
+				coreProperties.AppendChild (doc.CreateNode (XmlNodeType.Element, "dc", "subject", NSDc)).InnerXml = Subject;
+			if (Title != null)
+				coreProperties.AppendChild (doc.CreateNode (XmlNodeType.Element, "dc", "title", NSDc)).InnerXml = Title;
+			if (Version != null)
+				coreProperties.AppendChild (doc.CreateNode (XmlNodeType.Element, "version", NSPackageProperties)).InnerXml = Version;
+
+			if (Modified.HasValue)
+			{
+				XmlAttribute att = doc.CreateAttribute("xsi", "type", NSXsi);
+				att.Value = "dcterms:W3CDTF";
+				
+				XmlNode modified = coreProperties.AppendChild (doc.CreateNode (XmlNodeType.Element, "dcterms", "modified", NSDcTerms));
+				modified.Attributes.Append (att);
+				modified.InnerXml = Modified.Value.ToString ();
+			}
+			
+			doc.WriteContentTo (writer);
+		}
+	}
+}

+ 68 - 0
mcs/class/WindowsBase/System.IO.Packaging/PackageRelationship.cs

@@ -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 ([email protected])
+//
+
+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;
+		}
+	}
+}

+ 52 - 0
mcs/class/WindowsBase/System.IO.Packaging/PackageRelationshipCollection.cs

@@ -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 ([email protected])
+// Alan McGovern ([email protected])
+//
+
+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();
+		}
+	}
+}

+ 55 - 0
mcs/class/WindowsBase/System.IO.Packaging/PackageRelationshipSelector.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+
+}
+

+ 33 - 0
mcs/class/WindowsBase/System.IO.Packaging/PackageRelationshipSelectorType.cs

@@ -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 ([email protected])
+//
+
+namespace System.IO.Packaging {
+
+	public enum PackageRelationshipSelectorType {
+		Id,
+		Type
+	}
+
+}

+ 74 - 0
mcs/class/WindowsBase/System.IO.Packaging/RightsManagementInformation.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+
+}

+ 45 - 0
mcs/class/WindowsBase/System.IO.Packaging/SignatureVerificationEventArgs.cs

@@ -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 ([email protected])
+//
+
+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 (); }
+		}
+	}
+
+}

+ 98 - 0
mcs/class/WindowsBase/System.IO.Packaging/StorageInfo.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+
+	}
+
+}

+ 65 - 0
mcs/class/WindowsBase/System.IO.Packaging/StreamInfo.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+
+}

+ 33 - 0
mcs/class/WindowsBase/System.IO.Packaging/TargetMode.cs

@@ -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 ([email protected])
+//
+
+namespace System.IO.Packaging {
+
+	public enum TargetMode {
+		Internal,
+		External
+	}
+
+}

+ 38 - 0
mcs/class/WindowsBase/System.IO.Packaging/VerifyResult.cs

@@ -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 ([email protected])
+//
+
+namespace System.IO.Packaging {
+
+	public enum VerifyResult {
+		Success,
+
+		InvalidSignature,
+		CertificateRequired,
+		InvalidCertificate,
+		ReferenceNotFound,
+		NotSigned
+	}
+
+}

+ 223 - 0
mcs/class/WindowsBase/System.IO.Packaging/ZipPackage.cs

@@ -0,0 +1,223 @@
+// 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 ([email protected])
+//
+
+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, Stream stream)
+			: base (access)
+		{
+			PackageStream = stream;
+		}
+
+		internal ZipPackage (FileAccess access, Stream stream, bool streaming)
+			: base (access, streaming)
+		{
+			PackageStream = stream;
+		}
+		
+		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), part.CompressionOption)) {
+						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, CompressionOption.Maximum))
+					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);
+
+					XmlNamespaceManager manager = new XmlNamespaceManager (doc.NameTable);
+					manager.AddNamespace ("content", ContentNamespace);
+
+					// The file names in the zip archive are not prepended with '/'
+					foreach (string file in archive.GetFiles ()) {
+						XmlNode node;
+						CompressionOption compression = archive.GetCompressionLevel (file);
+
+						if (file == RelationshipUri.ToString ().Substring (1))
+						{
+							CreatePartCore (RelationshipUri, RelationshipContentType, compression);
+							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)
+							CreatePartCore (new Uri ("/" + file, UriKind.Relative), node.Attributes["ContentType"].Value, compression);
+					}
+				}
+			} 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 ();
+				
+
+				node.Attributes.Append (contentType);
+				node.Attributes.Append (name);
+
+				root.AppendChild (node);				
+			}
+
+			using (XmlTextWriter writer = new XmlTextWriter (s, System.Text.Encoding.UTF8))
+				doc.WriteTo (writer);
+		}
+	}
+}

+ 98 - 0
mcs/class/WindowsBase/System.IO.Packaging/ZipPackagePart.cs

@@ -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 ([email protected])
+//
+
+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)) {
+				zps = new ZipPartStream (Package, stream, access);
+				if (mode == FileMode.Create)
+					stream.SetLength (0);
+				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);
+			if (mode == FileMode.Create)
+				stream.SetLength (0);
+			return new ZipPartStream (Package, stream, access);
+		}
+	}
+
+}

+ 117 - 0
mcs/class/WindowsBase/System.IO.Packaging/ZipPartStream.cs

@@ -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;
+		}
+	}
+}

+ 95 - 0
mcs/class/WindowsBase/System.IO/FileFormatException.cs

@@ -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 ([email protected])
+//	Miguel de Icaza ([email protected])
+//
+
+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);
+		}
+	}
+}
+

+ 111 - 0
mcs/class/WindowsBase/System.Security.Permissions/MediaPermission.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+
+}

+ 61 - 0
mcs/class/WindowsBase/System.Security.Permissions/MediaPermissionAttribute.cs

@@ -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 ([email protected])
+//
+
+using System;
+using System.Security;
+
+namespace System.Security.Permissions {
+
+	[AttributeUsage (AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Struct | AttributeTargets.Class | AttributeTargets.Assembly)]
+	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 ();
+		}
+	}
+
+}

+ 36 - 0
mcs/class/WindowsBase/System.Security.Permissions/MediaPermissionAudio.cs

@@ -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 ([email protected])
+//
+
+namespace System.Security.Permissions {
+
+	public enum MediaPermissionAudio {
+		NoAudio,
+		SiteOfOriginAudio,
+		SafeAudio,
+		AllAudio
+	}
+
+}
+

+ 36 - 0
mcs/class/WindowsBase/System.Security.Permissions/MediaPermissionImage.cs

@@ -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 ([email protected])
+//
+
+namespace System.Security.Permissions {
+
+	public enum MediaPermissionImage {
+		NoImage,
+		SiteOfOriginImage,
+		SafeImage,
+		AllImage
+	}
+
+}
+

+ 36 - 0
mcs/class/WindowsBase/System.Security.Permissions/MediaPermissionVideo.cs

@@ -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 ([email protected])
+//
+
+namespace System.Security.Permissions {
+
+	public enum MediaPermissionVideo {
+		NoVideo,
+		SiteOfOriginVideo,
+		SafeVideo,
+		AllVideo
+	}
+
+}
+

+ 90 - 0
mcs/class/WindowsBase/System.Security.Permissions/WebBrowserPermission.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+
+	}
+
+}

+ 51 - 0
mcs/class/WindowsBase/System.Security.Permissions/WebBrowserPermissionAttribute.cs

@@ -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 ([email protected])
+//
+
+using System;
+using System.Security;
+
+namespace System.Security.Permissions {
+
+	[AttributeUsage (AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Struct | AttributeTargets.Class | AttributeTargets.Assembly)]
+	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 ();
+		}
+	}
+
+}

+ 34 - 0
mcs/class/WindowsBase/System.Security.Permissions/WebBrowserPermissionLevel.cs

@@ -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 ([email protected])
+//
+
+namespace System.Security.Permissions {
+
+	public enum WebBrowserPermissionLevel {
+		None,
+		Safe,
+		Unrestricted
+	}
+
+}

+ 35 - 0
mcs/class/WindowsBase/System.Security.RightsManagement/AuthenticationType.cs

@@ -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 ([email protected])
+//
+
+namespace System.Security.RightsManagement {
+
+	public enum AuthenticationType {
+		Windows,
+		Passport,
+		WindowsPassport,
+		Internal
+	}
+
+}

+ 61 - 0
mcs/class/WindowsBase/System.Security.RightsManagement/ContentGrant.cs

@@ -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 ([email protected])
+//
+
+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 (); }
+		}
+	}
+}
+

+ 44 - 0
mcs/class/WindowsBase/System.Security.RightsManagement/ContentRight.cs

@@ -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 ([email protected])
+//
+
+namespace System.Security.RightsManagement {
+
+	public enum ContentRight {
+		View,
+		Edit,
+		Print,
+		Extract,
+		ObjectModel,
+		Owner,
+		ViewRightsData,
+		Forward,
+		Reply,
+		ReplyAll,
+		Sign,
+		DocumentEdit,
+		Export
+	}
+
+}

+ 71 - 0
mcs/class/WindowsBase/System.Security.RightsManagement/ContentUser.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+
+}

+ 84 - 0
mcs/class/WindowsBase/System.Security.RightsManagement/CryptoProvider.cs

@@ -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 ([email protected])
+//
+
+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 ();			
+		}
+	}
+
+}

+ 57 - 0
mcs/class/WindowsBase/System.Security.RightsManagement/LocalizedNameDescriptionPair.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+}

+ 77 - 0
mcs/class/WindowsBase/System.Security.RightsManagement/PublishLicense.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+
+}

+ 86 - 0
mcs/class/WindowsBase/System.Security.RightsManagement/RightsManagementException.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+
+}

+ 139 - 0
mcs/class/WindowsBase/System.Security.RightsManagement/RightsManagementFailureCode.cs

@@ -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 ([email protected])
+//
+
+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
+	}
+
+}

+ 84 - 0
mcs/class/WindowsBase/System.Security.RightsManagement/SecureEnvironment.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+
+}

+ 84 - 0
mcs/class/WindowsBase/System.Security.RightsManagement/UnsignedPublishLicense.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+
+}

+ 72 - 0
mcs/class/WindowsBase/System.Security.RightsManagement/UseLicense.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+}

+ 33 - 0
mcs/class/WindowsBase/System.Security.RightsManagement/UserActivationMode.cs

@@ -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 ([email protected])
+//
+
+namespace System.Security.RightsManagement {
+
+	public enum UserActivationMode {
+		Permanent,
+		Temporary
+	}
+
+}

+ 55 - 0
mcs/class/WindowsBase/System.Windows.Converters/Int32RectValueSerializer.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+
+}
+

+ 55 - 0
mcs/class/WindowsBase/System.Windows.Converters/PointValueSerializer.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+
+}
+

+ 55 - 0
mcs/class/WindowsBase/System.Windows.Converters/RectValueSerializer.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+
+}
+

+ 55 - 0
mcs/class/WindowsBase/System.Windows.Converters/SizeValueSerializer.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+
+}
+

+ 55 - 0
mcs/class/WindowsBase/System.Windows.Converters/VectorValueSerializer.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+
+}
+

+ 126 - 0
mcs/class/WindowsBase/System.Windows.Data/DataSourceProvider.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+}
+

+ 41 - 0
mcs/class/WindowsBase/System.Windows.Input/FocusNavigationDirection.cs

@@ -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 ([email protected])
+//
+
+using System;
+
+namespace System.Windows.Input {
+
+	public enum FocusNavigationDirection
+	{
+		Next,
+		Previous,
+		First,
+		Last,
+		Left,
+		Right,
+		Up,
+		Down
+	}
+}

+ 238 - 0
mcs/class/WindowsBase/System.Windows.Input/Key.cs

@@ -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 ([email protected])
+//
+
+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
+	}
+}

+ 56 - 0
mcs/class/WindowsBase/System.Windows.Input/KeyConverter.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+
+}
+

+ 43 - 0
mcs/class/WindowsBase/System.Windows.Input/KeyInterop.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+
+}

+ 55 - 0
mcs/class/WindowsBase/System.Windows.Input/KeyValueSerializer.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+
+}
+

+ 43 - 0
mcs/class/WindowsBase/System.Windows.Input/ModifierKeys.cs

@@ -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 ([email protected])
+//
+
+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
+	}
+}
+

+ 61 - 0
mcs/class/WindowsBase/System.Windows.Input/ModifierKeysConverter.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+
+}
+

+ 55 - 0
mcs/class/WindowsBase/System.Windows.Input/ModifierKeysValueSerializer.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+
+}
+

+ 49 - 0
mcs/class/WindowsBase/System.Windows.Input/TraversalRequest.cs

@@ -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 ([email protected])
+//
+
+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; }
+		}
+	}
+}

+ 73 - 0
mcs/class/WindowsBase/System.Windows.Interop/ComponentDispatcher.cs

@@ -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 ([email protected])
+//
+
+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 ();
+		}
+	}
+}

+ 55 - 0
mcs/class/WindowsBase/System.Windows.Interop/IKeyboardInputSink.cs

@@ -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 ([email protected])
+//
+
+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);
+	}
+}

+ 42 - 0
mcs/class/WindowsBase/System.Windows.Interop/IKeyboardInputSite.cs

@@ -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 ([email protected])
+//
+
+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 ();
+	}
+
+}

+ 84 - 0
mcs/class/WindowsBase/System.Windows.Interop/MSG.cs

@@ -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 ([email protected])
+//
+
+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 (); }
+		}
+	}
+}
+

+ 32 - 0
mcs/class/WindowsBase/System.Windows.Interop/ThreadMessageEventHandler.cs

@@ -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 ([email protected])
+//
+
+using System;
+
+namespace System.Windows.Interop {
+
+	public delegate void ThreadMessageEventHandler (ref MSG msg, ref bool handled);
+
+}

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff