Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2017-06-06 14:05:26 +0300
committerMarek Safar <marek.safar@gmail.com>2017-06-06 14:05:26 +0300
commit684f306d0d2bfabac80d7aae99cfdfe6a300ca5f (patch)
tree81b2f5cca7fe0b4caa3d90d1fe945b4f496490e4
parente49886bd091487abfbf5de934a451c5a8fe7f4c5 (diff)
parent0e2b8241482c472b1ff456f57bc032716d62c260 (diff)
Merge remote-tracking branch 'upstream/master'
-rw-r--r--BuildToolsVersion.txt2
-rw-r--r--Documentation/building/unix-instructions.md2
-rw-r--r--Documentation/project-docs/developer-guide.md127
-rw-r--r--Documentation/project-docs/issue-guide.md17
-rw-r--r--Documentation/project-docs/porting.md2
-rw-r--r--buildpipeline/DotNet-CoreFx-Trusted-Linux-Crossbuild.json2
-rw-r--r--buildpipeline/DotNet-CoreFx-Trusted-Windows-NoTest.json2
-rw-r--r--buildpipeline/DotNet-CoreFx-Trusted-Windows.json2
-rw-r--r--buildpipeline/DotNet-Trusted-Publish.json54
-rw-r--r--buildpipeline/pipeline.json538
-rw-r--r--buildpipeline/pipelinejobs.groovy12
-rw-r--r--buildpipeline/portable-linux.groovy8
-rw-r--r--buildpipeline/portable-windows.groovy14
-rw-r--r--config.json4
-rw-r--r--dependencies.props28
-rw-r--r--dir.props2
-rw-r--r--external/test-runtime/XUnit.Runtime.depproj5
-rw-r--r--external/test-runtime/optional.json6
-rwxr-xr-xinit-tools.sh6
-rw-r--r--netci.groovy4
-rw-r--r--pkg/Microsoft.Private.CoreFx.NETCoreApp/netcoreapp.rids.props89
-rw-r--r--pkg/Microsoft.Private.PackageBaseline/packageIndex.json9
-rw-r--r--pkg/descriptions.json26
-rw-r--r--src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Keychain.cs8
-rw-r--r--src/Common/src/System/Drawing/ColorConverterCommon.cs150
-rw-r--r--src/Common/src/System/Drawing/ColorTable.cs4
-rw-r--r--src/Common/src/System/NotImplemented.cs21
-rw-r--r--src/Common/tests/Data/TinyAssembly.dllbin1536 -> 1536 bytes
-rw-r--r--src/Common/tests/Data/TinyAssembly.il5
-rw-r--r--src/Common/tests/System/Diagnostics/RemoteExecutorTestBase.cs67
-rw-r--r--src/Common/tests/System/PlatformDetection.cs57
-rw-r--r--src/Common/tests/System/Reflection/MockParameterInfo.cs33
-rw-r--r--src/Native/Unix/System.Native/pal_io.cpp2
-rw-r--r--src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain.cpp9
-rw-r--r--src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain.h7
-rw-r--r--src/System.Buffers/tests/ArrayPool/UnitTests.cs5
-rw-r--r--src/System.Collections.Concurrent/tests/ProducerConsumerCollectionTests.cs1
-rw-r--r--src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedSet_1.Builder.DebuggerProxy.cs14
-rw-r--r--src/System.Collections.Immutable/tests/ImmutableSortedSetBuilderDebuggerProxyTest.cs25
-rw-r--r--src/System.Collections.Immutable/tests/Resources/System.Collections.Immutable.Tests.rd.xml7
-rw-r--r--src/System.Collections.Immutable/tests/System.Collections.Immutable.Tests.csproj6
-rw-r--r--src/System.Collections.Specialized/src/System/Collections/Specialized/ListDictionary.cs84
-rw-r--r--src/System.Collections.Specialized/src/System/Collections/Specialized/StringCollection.cs32
-rw-r--r--src/System.Collections/src/System/Collections/Generic/SortedList.cs170
-rw-r--r--src/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs1
-rw-r--r--src/System.ComponentModel.TypeConverter/src/System.ComponentModel.TypeConverter.csproj17
-rw-r--r--src/System.ComponentModel.TypeConverter/src/System/ComponentModel/BindingList.cs78
-rw-r--r--src/System.ComponentModel.TypeConverter/src/System/ComponentModel/InterlockedBitVector32.cs2
-rw-r--r--src/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseManager.cs224
-rw-r--r--src/System.ComponentModel.TypeConverter/src/System/Drawing/ColorConverter.cs95
-rw-r--r--src/System.ComponentModel.TypeConverter/src/System/misc.cs16
-rw-r--r--src/System.Composition/tests/ContractTests.cs2
-rw-r--r--src/System.Composition/tests/DiscoveryTests.cs3
-rw-r--r--src/System.Composition/tests/ErrorMessageQualityTests.cs2
-rw-r--r--src/System.Composition/tests/ExportFactoryTests.cs1
-rw-r--r--src/System.Composition/tests/MetadataViewGenerationTests.cs2
-rw-r--r--src/System.Composition/tests/OpenGenericsTests.cs2
-rw-r--r--src/System.Composition/tests/SharingTests.cs3
-rw-r--r--src/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigPaths.cs10
-rw-r--r--src/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigurationHost.cs2
-rw-r--r--src/System.Data.Common/src/System/Data/SQLTypes/SQLBoolean.cs48
-rw-r--r--src/System.Data.Common/src/System/Data/SQLTypes/SQLByte.cs60
-rw-r--r--src/System.Data.Common/src/System/Data/SQLTypes/SQLDateTime.cs57
-rw-r--r--src/System.Data.Common/src/System/Data/SQLTypes/SQLDouble.cs57
-rw-r--r--src/System.Data.Common/src/System/Data/SQLTypes/SQLInt16.cs72
-rw-r--r--src/System.Data.Common/src/System/Data/SQLTypes/SQLInt32.cs73
-rw-r--r--src/System.Data.Common/src/System/Data/SQLTypes/SQLInt64.cs78
-rw-r--r--src/System.Data.Common/src/System/Data/SQLTypes/SQLString.cs144
-rw-r--r--src/System.Data.Common/tests/System/Data/DataCommonEventSourceTest.cs1
-rw-r--r--src/System.Data.SqlClient/tests/FunctionalTests/SqlConnectionTest.cs1
-rw-r--r--src/System.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/CheckConstraints.cs2
-rw-r--r--src/System.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/CopyVariants.cs4
-rw-r--r--src/System.Data.SqlClient/tests/ManualTests/SQL/SqlSchemaInfoTest/SqlSchemaInfoTest.cs50
-rw-r--r--src/System.Data.SqlClient/tests/ManualTests/System.Data.SqlClient.ManualTesting.Tests.csproj1
-rw-r--r--src/System.Diagnostics.Contracts/tests/System.Diagnostics.Contracts.Tests.csproj5
-rw-r--r--src/System.Diagnostics.Contracts/tests/Utilities.cs5
-rw-r--r--src/System.Diagnostics.DiagnosticSource/src/ActivityUserGuide.md4
-rw-r--r--src/System.Diagnostics.DiagnosticSource/src/System.Diagnostics.DiagnosticSource.csproj1
-rw-r--r--src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.Current.net45.cs6
-rw-r--r--src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs15
-rw-r--r--src/System.Diagnostics.DiagnosticSource/tests/ActivityTests.cs43
-rw-r--r--src/System.Diagnostics.DiagnosticSource/tests/DiagnosticSourceEventSourceBridgeTests.cs9
-rw-r--r--src/System.Diagnostics.Process/tests/ProcessCollectionTests.cs1
-rw-r--r--src/System.Diagnostics.Process/tests/ProcessStandardConsoleTests.cs1
-rw-r--r--src/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs23
-rw-r--r--src/System.Diagnostics.Process/tests/ProcessStreamReadTests.cs1
-rw-r--r--src/System.Diagnostics.Process/tests/ProcessTests.cs51
-rw-r--r--src/System.Diagnostics.Process/tests/ProcessThreadTests.cs4
-rw-r--r--src/System.Diagnostics.Process/tests/ProcessWaitingTests.cs9
-rw-r--r--src/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestUtilities.cs4
-rw-r--r--src/System.DirectoryServices.AccountManagement/dir.props6
-rw-r--r--src/System.DirectoryServices.AccountManagement/pkg/System.DirectoryServices.AccountManagement.pkgproj14
-rw-r--r--src/System.DirectoryServices.AccountManagement/src/Configurations.props1
-rw-r--r--src/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj5
-rw-r--r--src/System.DirectoryServices.Protocols/dir.props6
-rw-r--r--src/System.DirectoryServices.Protocols/pkg/System.DirectoryServices.Protocols.pkgproj15
-rw-r--r--src/System.DirectoryServices.Protocols/src/Configurations.props1
-rw-r--r--src/System.DirectoryServices.Protocols/src/FxCopBaseline.AnyOS.cs1
-rw-r--r--src/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj8
-rw-r--r--src/System.DirectoryServices/dir.props6
-rw-r--r--src/System.DirectoryServices/pkg/System.DirectoryServices.pkgproj15
-rw-r--r--src/System.DirectoryServices/src/Configurations.props1
-rw-r--r--src/System.DirectoryServices/src/FxCopBaseline.AnyOS.cs1
-rw-r--r--src/System.DirectoryServices/src/System.DirectoryServices.csproj8
-rw-r--r--src/System.Drawing.Common/System.Drawing.Common.sln45
-rw-r--r--src/System.Drawing.Common/dir.props (renamed from src/System.DirectoryServices/pkg/Configurations.props)7
-rw-r--r--src/System.Drawing.Common/ref/Configurations.props (renamed from src/System.DirectoryServices.Protocols/pkg/Configurations.props)7
-rw-r--r--src/System.Drawing.Common/ref/System.Drawing.Common.cs3186
-rw-r--r--src/System.Drawing.Common/ref/System.Drawing.Common.csproj20
-rw-r--r--src/System.Drawing.Common/src/AssemblyRef.cs13
-rw-r--r--src/System.Drawing.Common/src/Configurations.props (renamed from src/System.DirectoryServices.AccountManagement/pkg/Configurations.props)5
-rw-r--r--src/System.Drawing.Common/src/Resources/Strings.resx334
-rw-r--r--src/System.Drawing.Common/src/Resources/System/Drawing/DefaultComponent.bmpbin0 -> 824 bytes
-rw-r--r--src/System.Drawing.Common/src/Resources/System/Drawing/Printing/PrintDocument.bmpbin0 -> 824 bytes
-rw-r--r--src/System.Drawing.Common/src/Resources/System/Drawing/ShieldIcon.icobin0 -> 25214 bytes
-rw-r--r--src/System.Drawing.Common/src/SRDescriptionAttribute.cs31
-rw-r--r--src/System.Drawing.Common/src/System.Drawing.Common.csproj248
-rw-r--r--src/System.Drawing.Common/src/System/ComponentModel/InvalidEnumArgumentException.cs63
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/AdjustableArrowCap.cs171
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/BitmapData.cs120
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/Blend.cs79
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/BrushType.cs18
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/ColorAdjustType.cs66
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/ColorBlend.cs73
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/ColorChannelFlags.cs45
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/ColorMap.cs52
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/ColorMapType.cs27
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/ColorMatrix.cs481
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/ColorMatrixFlags.cs36
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/ColorMode.cs34
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/ColorPalette.cs108
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/ColorTranslator.cs393
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/CombineMode.cs57
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/CompositingMode.cs36
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/CompositingQuality.cs45
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/CoordinateSpace.cs45
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/CustomLineCap.cs320
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/CustomLineCapType.cs15
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/DashStyle.cs58
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/EmfPlusFlags.cs15
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/EmfPlusRecordType.cs1311
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/EmfType.cs43
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/Encoder.cs88
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/EncoderParameter.cs546
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/EncoderParameterValueType.cs75
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/EncoderParameters.cs139
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/EncoderValue.cs139
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/FillMode.cs43
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/FlushIntention.cs39
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/Font.cs1041
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/FontCollection.cs98
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/FontFamily.cs520
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/FontStyle.cs50
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/FrameDimension.cs103
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/GPPOINT.cs36
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/GPPOINTF.cs36
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/GPRECT.cs38
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/GPRECTF.cs46
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/GPStream.cs277
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/Gdiplus.cs4736
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/GenericFontFamilies.cs32
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/GraphicsContainer.cs30
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/GraphicsPath.cs1887
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/GraphicsPathIterator.cs356
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/GraphicsState.cs21
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/HatchBrush.cs141
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/HatchStyle.cs358
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/HotkeyPrefix.cs38
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/ISystemEventTracker.cs13
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/ImageAttributes.cs754
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/ImageCodecFlags.cs64
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/ImageCodecInfo.cs307
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/ImageCodecInfoPrivate.cs36
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/ImageFlags.cs102
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/ImageFormat.cs208
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/ImageLockMode.cs46
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/InstalledFontCollection.cs31
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/InterpolationMode.cs67
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/LineCap.cs81
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/LineJoin.cs42
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/LinearGradientBrush.cs934
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/LinearGradientMode.cs44
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/METAHEADER.cs96
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/Matrix.cs706
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/MatrixOrder.cs33
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/Metafile.cs920
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/MetafileFrameUnit.cs61
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/MetafileHeader.cs321
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/MetafileHeaderEmf.cs31
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/MetafileHeaderWmf.cs56
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/MetafileType.cs50
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/PaletteFlags.cs33
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/PathData.cs64
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/PathGradientBrush.cs899
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/PathPointType.cs65
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/PenAlignment.cs58
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/PenType.cs45
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/PixelFormat.cs214
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/PixelOffsetMode.cs48
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/PlayRecordCallback.cs16
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/PrivateFontCollection.cs104
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/PropertyItem.cs62
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/QualityMode.cs39
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/RectangleFEx.cs14
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/RegionData.cs40
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/SafeCustomLineCapHandle.cs69
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/SmoothingMode.cs55
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/StringAlignment.cs45
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/StringDigitSubstitute.cs39
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/StringFormat.cs575
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/StringFormatFlags.cs102
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/StringTrimming.cs56
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/StringUnit.cs69
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/SystemColorTracker.cs164
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/TextRenderingHint.cs46
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/TextureBrush.cs565
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/Unit.cs56
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/WarpMode.cs27
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/WmfPlaceableFileHeader.cs131
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Advanced/WrapMode.cs49
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Bitmap.cs724
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/BitmapSelector.cs251
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/BitmapSuffixInSameAssemblyAttribute.cs15
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/BitmapSuffixInSatelliteAssemblyAttribute.cs15
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Brush.cs133
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Brushes.cs2698
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/BufferedGraphics.cs174
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/BufferedGraphicsContext.cs719
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/BufferedGraphicsManager.cs58
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/ColorConverter.cs423
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/ColorConverterCommon.cs14
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Configuration/SystemDrawingSection.cs40
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/ContentAlignment.cs86
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/CopyPixelOperation.cs161
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/DashCap.cs33
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Design/CategoryNameCollection.cs83
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Design/IPropertyValueUIService.cs68
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Design/IToolboxItemProvider.cs21
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Design/IToolboxService.cs212
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Design/IToolboxUser.cs38
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Design/PaintValueEventArgs.cs101
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Design/PropertyValueUIHandler.cs24
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Design/PropertyValueUIItem.cs103
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Design/PropertyValueUIItemInvokeHandler.cs26
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Design/ToolboxComponentsCreatedEventArgs.cs44
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Design/ToolboxComponentsCreatedEventHandler.cs16
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Design/ToolboxComponentsCreatingEventArgs.cs45
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Design/ToolboxComponentsCreatingEventHandler.cs16
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Design/ToolboxItem.cs1035
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Design/ToolboxItemCollection.cs78
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Design/ToolboxItemCreatorCallback.cs17
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Design/UITypeEditor.cs152
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Design/UITypeEditorEditStyle.cs42
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Graphics.cs4915
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/GraphicsContext.cs187
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/IDeviceContext.cs29
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Icon.cs1117
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Image.cs1500
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/ImageAnimator.cs440
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/ImageInfo.cs203
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/KnownColorTable.cs495
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/LocalAppContextSwitches.cs32
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/NativeMethods.cs418
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Pen.cs1158
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Pens.cs2697
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/PointConverter.cs204
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/DefaultPrintController.cs166
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/Duplex.cs48
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/InvalidPrinterException.cs74
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/Margins.cs338
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/ModeField.cs24
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/PageSettings.cs605
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/PaperKinds.cs999
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/PaperSize.cs167
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/PaperSource.cs98
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/PaperSourceKind.cs132
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/PreviewPageInfo.cs53
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/PreviewPrintController.cs205
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/PrintAction.cs37
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/PrintController.cs326
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/PrintDocument.cs322
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/PrintEvent.cs54
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/PrintEventHandler.cs16
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/PrintPageEvent.cs134
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/PrintPageEventHandler.cs14
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/PrintPreviewGraphics.cs61
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/PrintRange.cs58
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/PrinterResolution.cs123
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/PrinterResolutionKind.cs55
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/PrinterSettings.cs2040
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/PrinterUnit.cs47
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/PrinterUnitConvert.cs136
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/PrintingPermission.cs220
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/PrintingPermissionAttribute.cs51
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/PrintingPermissionLevel.cs58
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/QueryPageSettingsEventArgs.cs61
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/QueryPageSettingsEventHandler.cs14
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Printing/TriState.cs91
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/PropertyItemInternal.cs121
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/RectangleConverter.cs209
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/Region.cs1079
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/RotateFlipType.cs99
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/SizeConverter.cs201
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/SolidBrush.cs173
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/SystemBrushes.cs455
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/SystemColors.cs425
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/SystemFonts.cs538
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/SystemIcons.cs216
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/SystemPens.cs457
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/ToolboxBitmapAttribute.cs516
-rw-r--r--src/System.Drawing.Common/src/System/Drawing/UnsafeNativeMethods.cs361
-rw-r--r--src/System.Drawing.Common/src/misc/ClientUtils.cs530
-rw-r--r--src/System.Drawing.Common/src/misc/CompModSwitches.cs41
-rw-r--r--src/System.Drawing.Common/src/misc/CoreSwitches.cs26
-rw-r--r--src/System.Drawing.Common/src/misc/DbgUtil.cs368
-rw-r--r--src/System.Drawing.Common/src/misc/DebugHandleTracker.cs538
-rw-r--r--src/System.Drawing.Common/src/misc/DpiHelper.cs242
-rw-r--r--src/System.Drawing.Common/src/misc/ExternDll.cs51
-rw-r--r--src/System.Drawing.Common/src/misc/GDI/ApplyGraphicsProperties.cs23
-rw-r--r--src/System.Drawing.Common/src/misc/GDI/DeviceContext.cs601
-rw-r--r--src/System.Drawing.Common/src/misc/GDI/DeviceContextGraphicsMode.cs48
-rw-r--r--src/System.Drawing.Common/src/misc/GDI/DeviceContextType.cs34
-rw-r--r--src/System.Drawing.Common/src/misc/GDI/DeviceContexts.cs56
-rw-r--r--src/System.Drawing.Common/src/misc/GDI/GdiObjectType.cs39
-rw-r--r--src/System.Drawing.Common/src/misc/GDI/NativeMethods.cs371
-rw-r--r--src/System.Drawing.Common/src/misc/GDI/SafeNativeMethods.cs89
-rw-r--r--src/System.Drawing.Common/src/misc/GDI/UnsafeNativeMethods.cs631
-rw-r--r--src/System.Drawing.Common/src/misc/GDI/WindowsGraphics.cs260
-rw-r--r--src/System.Drawing.Common/src/misc/GDI/WindowsRegion.cs195
-rw-r--r--src/System.Drawing.Common/src/misc/GDI/WindowsRegionCombineMode.cs19
-rw-r--r--src/System.Drawing.Common/src/misc/HandleCollector.cs297
-rw-r--r--src/System.Drawing.Common/src/misc/InvariantComparer.cs32
-rw-r--r--src/System.Drawing.Primitives/ref/System.Drawing.Primitives.cs181
-rw-r--r--src/System.Drawing.Primitives/src/System/Drawing/Color.cs8
-rw-r--r--src/System.Drawing.Primitives/src/System/Drawing/KnownColor.cs709
-rw-r--r--src/System.Drawing.Primitives/src/System/Drawing/Point.cs26
-rw-r--r--src/System.Drawing.Primitives/src/System/Drawing/PointF.cs20
-rw-r--r--src/System.Drawing.Primitives/src/System/Drawing/Rectangle.cs42
-rw-r--r--src/System.Drawing.Primitives/src/System/Drawing/RectangleF.cs40
-rw-r--r--src/System.Drawing.Primitives/src/System/Drawing/Size.cs24
-rw-r--r--src/System.Drawing.Primitives/src/System/Drawing/SizeF.cs28
-rw-r--r--src/System.Globalization/tests/CultureInfo/CultureInfoAll.cs1
-rw-r--r--src/System.Globalization/tests/CultureInfo/CultureInfoAsync.cs2
-rw-r--r--src/System.Globalization/tests/CultureInfo/CultureInfoCurrentCulture.cs2
-rw-r--r--src/System.Globalization/tests/System.Globalization.Tests.csproj7
-rw-r--r--src/System.IO.FileSystem/src/System/IO/File.cs2
-rw-r--r--src/System.IO.FileSystem/tests/Directory/CreateDirectory.cs22
-rw-r--r--src/System.IO.FileSystem/tests/Directory/GetDirectories.cs44
-rw-r--r--src/System.IO.FileSystem/tests/Directory/GetFiles.cs33
-rw-r--r--src/System.IO.FileSystem/tests/File/ReadWriteAllTextAsync.cs6
-rw-r--r--src/System.IO.FileSystem/tests/FileSystemTest.cs18
-rw-r--r--src/System.IO.FileSystem/tests/PortedCommon/ReparsePointUtilities.cs1
-rw-r--r--src/System.IO.FileSystem/tests/PortedCommon/TemporaryDirectory.cs30
-rw-r--r--src/System.IO.FileSystem/tests/PortedCommon/TemporaryFile.cs20
-rw-r--r--src/System.IO.FileSystem/tests/PortedCommon/TemporaryFileSystemItem.cs82
-rw-r--r--src/System.IO.FileSystem/tests/Resources/System.IO.FileSystem.Tests.rd.xml6
-rw-r--r--src/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj8
-rw-r--r--src/System.IO.Ports/src/System/IO/Ports/SerialStream.cs50
-rw-r--r--src/System.IO.Ports/tests/SerialPort/GetPortNames.cs1
-rw-r--r--src/System.IO.Ports/tests/Support/PortHelper.cs2
-rw-r--r--src/System.IO.UnmanagedMemoryStream/tests/Uma.ReadWriteStructArray.cs1
-rw-r--r--src/System.Linq.Expressions/tests/SequenceTests/SequenceTests.cs1
-rw-r--r--src/System.Linq/tests/Resources/System.Linq.Tests.rd.xml2
-rw-r--r--src/System.Memory/ref/System.Memory.cs2
-rw-r--r--src/System.Memory/src/System/SpanExtensions.cs18
-rw-r--r--src/System.Memory/tests/ReadOnlySpan/AsReadOnlySpan.cs83
-rw-r--r--src/System.Memory/tests/System.Memory.Tests.csproj3
-rw-r--r--src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpResponseStream.cs5
-rw-r--r--src/System.Net.Http/src/System/Net/Http/Unix/CurlHandler.EasyRequest.cs15
-rw-r--r--src/System.Net.Http/tests/FunctionalTests/PostScenarioTest.cs8
-rw-r--r--src/System.Net.Http/tests/FunctionalTests/ResponseStreamTest.cs12
-rw-r--r--src/System.Net.HttpListener/src/System/Net/HttpListenerRequestUriBuilder.cs4
-rw-r--r--src/System.Net.HttpListener/src/System/Net/Managed/HttpRequestStream.Managed.cs28
-rw-r--r--src/System.Net.HttpListener/tests/AuthenticationTests.cs86
-rw-r--r--src/System.Net.HttpListener/tests/GetContextHelper.cs20
-rw-r--r--src/System.Net.HttpListener/tests/HttpListenerContextTests.cs51
-rw-r--r--src/System.Net.HttpListener/tests/HttpListenerFactory.cs76
-rw-r--r--src/System.Net.HttpListener/tests/HttpListenerPrefixCollectionTests.cs19
-rw-r--r--src/System.Net.HttpListener/tests/HttpListenerRequestTests.cs403
-rw-r--r--src/System.Net.HttpListener/tests/HttpListenerResponseTests.Cookies.cs33
-rw-r--r--src/System.Net.HttpListener/tests/HttpListenerResponseTests.Headers.cs141
-rw-r--r--src/System.Net.HttpListener/tests/HttpListenerResponseTests.cs49
-rw-r--r--src/System.Net.HttpListener/tests/HttpListenerTests.cs39
-rw-r--r--src/System.Net.HttpListener/tests/HttpListenerTimeoutManagerTests.cs81
-rw-r--r--src/System.Net.HttpListener/tests/HttpListenerWebSocketTests.cs46
-rw-r--r--src/System.Net.HttpListener/tests/HttpRequestStreamTests.cs48
-rw-r--r--src/System.Net.HttpListener/tests/HttpResponseStreamTests.cs50
-rw-r--r--src/System.Net.HttpListener/tests/InvalidClientRequestTests.cs3
-rw-r--r--src/System.Net.HttpListener/tests/SimpleHttpTests.cs30
-rw-r--r--src/System.Net.HttpListener/tests/WebSocketTests.cs3
-rw-r--r--src/System.Net.Mail/tests/Functional/LoggingTest.cs1
-rw-r--r--src/System.Net.Mail/tests/Functional/SmtpExceptionTest.cs1
-rw-r--r--src/System.Net.NetworkInformation/tests/UnitTests/NetworkInterfaceTest.cs4
-rw-r--r--src/System.Net.Ping/tests/FunctionalTests/PingTest.cs15
-rw-r--r--src/System.Net.Primitives/src/System/Net/Cookie.cs254
-rw-r--r--src/System.Net.Primitives/src/System/Net/CookieCollection.cs52
-rw-r--r--src/System.Net.Primitives/src/System/Net/CookieContainer.cs118
-rw-r--r--src/System.Net.Primitives/tests/FunctionalTests/CookieContainerTest.cs1
-rw-r--r--src/System.Net.Security/tests/UnitTests/System.Net.Security.Unit.Tests.csproj3
-rw-r--r--src/System.Net.Security/tests/UnitTests/System/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicyTest.cs6
-rw-r--r--src/System.Net.WebClient/tests/WebClientTest.cs16
-rw-r--r--src/System.Net.WebHeaderCollection/tests/LoggingTest.cs1
-rw-r--r--src/System.Net.WebHeaderCollection/tests/WebHeaderCollectionTest.cs7
-rw-r--r--src/System.Net.WebProxy/tests/WebProxyTest.cs1
-rw-r--r--src/System.Net.WebSockets.Client/src/System/Net/WebSockets/ClientWebSocketOptions.cs2
-rw-r--r--src/System.Net.WebSockets.Client/tests/CancelTest.cs5
-rw-r--r--src/System.Net.WebSockets.Client/tests/ClientWebSocketOptionsTests.cs2
-rw-r--r--src/System.Net.WebSockets.Client/tests/ClientWebSocketUnitTest.cs6
-rw-r--r--src/System.Net.WebSockets.Client/tests/CloseTest.cs3
-rw-r--r--src/System.Net.WebSockets.Client/tests/ConnectTest.cs4
-rw-r--r--src/System.Net.WebSockets.Client/tests/LoggingTest.cs1
-rw-r--r--src/System.Numerics.Vectors/tests/Vector2Tests.cs1
-rw-r--r--src/System.ObjectModel/src/System/Collections/ObjectModel/KeyedCollection.cs72
-rw-r--r--src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs51
-rw-r--r--src/System.ObjectModel/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs40
-rw-r--r--src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/ClassDataContract.cs3
-rw-r--r--src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Globals.cs11
-rw-r--r--src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonWriterDelegator.cs2
-rw-r--r--src/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs58
-rw-r--r--src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestCaseBase.cs9
-rw-r--r--src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestFile.cs6
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/Internal/Utilities/BlobUtilities.cs2
-rw-r--r--src/System.Reflection.TypeExtensions/tests/CoreCLR/ModuleTests.CoreCLR.cs1
-rw-r--r--src/System.Reflection.TypeExtensions/tests/CoreCLR/Resources/System.Reflection.TypeExtensions.CoreCLR.Tests.rd.xml7
-rw-r--r--src/System.Reflection.TypeExtensions/tests/CoreCLR/System.Reflection.TypeExtensions.CoreCLR.Tests.csproj3
-rw-r--r--src/System.Runtime.Extensions/System.Runtime.Extensions.sln15
-rw-r--r--src/System.Runtime.Extensions/src/System.Runtime.Extensions.csproj2
-rw-r--r--src/System.Runtime.Extensions/src/System/Environment.Win32.cs370
-rw-r--r--src/System.Runtime.Extensions/src/System/Environment.Windows.cs337
-rw-r--r--src/System.Runtime.Extensions/src/System/Environment.cs15
-rw-r--r--src/System.Runtime.Extensions/tests/AssemblyResolveTests/AssemblyResolveTests.csproj2
-rw-r--r--src/System.Runtime.Extensions/tests/System.Runtime.Extensions.Tests.csproj6
-rw-r--r--src/System.Runtime.Extensions/tests/System/Environment.Exit.cs2
-rw-r--r--src/System.Runtime.Extensions/tests/System/Environment.GetCommandLineArgs.cs1
-rw-r--r--src/System.Runtime.Extensions/tests/System/Environment.SetEnvironmentVariable.cs4
-rw-r--r--src/System.Runtime.Extensions/tests/System/Environment.StackTrace.cs2
-rw-r--r--src/System.Runtime.Extensions/tests/System/Environment.UserDomainName.cs22
-rw-r--r--src/System.Runtime.Extensions/tests/System/Environment.UserName.cs22
-rw-r--r--src/System.Runtime.Extensions/tests/System/Math.cs487
-rw-r--r--src/System.Runtime.Extensions/tests/System/Reflection/AssemblyNameProxyTests.cs1
-rw-r--r--src/System.Runtime.InteropServices/src/System.Runtime.InteropServices.csproj6
-rw-r--r--src/System.Runtime.InteropServices/src/System/Runtime/InteropServices/RuntimeEnvironment.cs7
-rw-r--r--src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/HandleCollectorTests.cs1
-rw-r--r--src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/MarshalTests.cs8
-rw-r--r--src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/RuntimeEnvironmentTest.cs8
-rw-r--r--src/System.Runtime.Loader/tests/AssemblyLoadContextTest.cs1
-rw-r--r--src/System.Runtime.Loader/tests/DefaultContext/DefaultLoadContextTest.cs1
-rw-r--r--src/System.Runtime.Loader/tests/RefEmitLoadContext/RefEmitLoadContextTest.cs1
-rw-r--r--src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/Formatters/Binary/BinaryObjectReader.cs73
-rw-r--r--src/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTestData.cs390
-rw-r--r--src/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.cs443
-rw-r--r--src/System.Runtime.Serialization.Formatters/tests/EqualityExtensions.cs124
-rw-r--r--src/System.Runtime.Serialization.Formatters/tests/SerializationTypes.cs140
-rw-r--r--src/System.Runtime.Serialization.Formatters/tests/System.Runtime.Serialization.Formatters.Tests.csproj2
-rw-r--r--src/System.Runtime.Serialization.Json/tests/DataContractJsonSerializer.cs45
-rw-r--r--src/System.Runtime.Serialization.Json/tests/System.Runtime.Serialization.Json.Tests.settings.targets33
-rw-r--r--src/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs39
-rw-r--r--src/System.Runtime.Serialization.Xml/tests/ReflectionOnly/System.Runtime.Serialization.Xml.ReflectionOnly.Tests.csproj1
-rw-r--r--src/System.Runtime.Serialization.Xml/tests/SerializationTypes.cs89
-rw-r--r--src/System.Runtime.Serialization.Xml/tests/System.Runtime.Serialization.Xml.Tests.csproj1
-rw-r--r--src/System.Runtime.Serialization.Xml/tests/System.Runtime.Serialization.Xml.Tests.settings.targets34
-rw-r--r--src/System.Runtime.WindowsRuntime/src/System/Resources/WindowsRuntimeResourceManager.cs7
-rw-r--r--src/System.Runtime/tests/System.Runtime.Tests.csproj5
-rw-r--r--src/System.Runtime/tests/System/ArrayTests.netcoreapp.cs1
-rw-r--r--src/System.Runtime/tests/System/LazyTests.cs2
-rw-r--r--src/System.Runtime/tests/System/Reflection/ParameterInfoTests.cs60
-rw-r--r--src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RijndaelImplementation.cs2
-rw-r--r--src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RijndaelManaged.cs2
-rw-r--r--src/System.Security.Cryptography.X509Certificates/tests/CertificateCreation/EccTestData.cs4
-rw-r--r--src/System.Security.Cryptography.X509Certificates/tests/ChainTests.cs3
-rw-r--r--src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.Tests/ServiceControllerTests.cs5
-rw-r--r--src/System.Text.Encoding/tests/Encoding/Encoding.cs3
-rw-r--r--src/System.Text.Encoding/tests/UTF32Encoding/UTF32EncodingTests.cs1
-rw-r--r--src/System.Text.Encoding/tests/UTF8Encoding/UTF8EncodingDecode.cs1
-rw-r--r--src/System.Text.Encoding/tests/UnicodeEncoding/UnicodeEncodingDecode.cs1
-rw-r--r--src/System.Text.Encoding/tests/UnicodeEncoding/UnicodeEncodingTests.cs1
-rw-r--r--src/System.Threading.Thread/src/System.Threading.Thread.csproj1
-rw-r--r--src/System.Threading.Thread/src/System/Threading/ThreadAbortException.cs19
-rw-r--r--src/System.Threading.Thread/tests/ThreadTests.cs7
-rw-r--r--src/System.Threading/tests/EtwTests.cs1
480 files changed, 70308 insertions, 3643 deletions
diff --git a/BuildToolsVersion.txt b/BuildToolsVersion.txt
index 2c7cc55eb0..a72a2229ed 100644
--- a/BuildToolsVersion.txt
+++ b/BuildToolsVersion.txt
@@ -1 +1 @@
-2.0.0-prerelease-01624-02
+2.0.0-prerelease-01702-02
diff --git a/Documentation/building/unix-instructions.md b/Documentation/building/unix-instructions.md
index 9f9624f4d5..74c4eeaedc 100644
--- a/Documentation/building/unix-instructions.md
+++ b/Documentation/building/unix-instructions.md
@@ -57,6 +57,8 @@ most systems when you install the development packages).
### macOS
+macOS 10.12 or higher is needed to build corefx 2.x.
+
On macOS a few components are needed which are not provided by a default developer setup:
* CMake
* pkgconfig
diff --git a/Documentation/project-docs/developer-guide.md b/Documentation/project-docs/developer-guide.md
index 7abd762953..97e94be287 100644
--- a/Documentation/project-docs/developer-guide.md
+++ b/Documentation/project-docs/developer-guide.md
@@ -226,7 +226,11 @@ msbuild System.Runtime.Tests.csproj /p:TargetGroup=netfx
The tests can also be filtered based on xunit trait attributes defined in [`xunit.netcore.extensions`](https://github.com/dotnet/buildtools/tree/master/src/xunit.netcore.extensions). These attributes are specified above the test method's definition. The available attributes are:
-_**`OuterLoop`:**_
+#### OuterloopAttribute
+
+```cs
+[OuterLoop()]
+```
Tests marked as `Outerloop` are for scenarios that don't need to run every build. They may take longer than normal tests, cover seldom hit code paths, or require special setup or resources to execute. These tests are excluded by default when testing through msbuild but can be enabled manually by adding the `Outerloop` property e.g.
```cmd
@@ -238,25 +242,136 @@ To run <b>only</b> the Outerloop tests, use the following command:
msbuild <csproj_file> /t:BuildAndTest /p:WithCategories=OuterLoop
```
-_**`PlatformSpecific(TestPlatforms platforms)`:**_
+#### PlatformSpecificAttribute
+
+```cs
+[PlatformSpecific(TestPlatforms platforms)]
+```
Use this attribute on test methods to specify that this test may only be run on the specified platforms. This attribute returns the following categories based on platform
- `nonwindowstests` for tests that don't run on Windows
- `nonlinuxtests` for tests that don't run on Linux
- `nonosxtests` for tests that don't run on OS X
+**[Available Test Platforms](https://github.com/dotnet/buildtools/blob/master/src/xunit.netcore.extensions/TestPlatforms.cs#L10)**
+
When running tests by building a test project, tests that don't apply to the `OSGroup` are not run. For example, to run Linux-specific tests on a Linux box, use the following command line:
```sh
<repo-root>/Tools/msbuild.sh <csproj_file> /t:BuildAndTest /p:OSGroup=Linux
```
-
-_**`ActiveIssue(int issue, TestPlatforms platforms)`:**_
-Use this attribute over test methods to skip failing tests only on the specific platforms; if no platforms are specified, then the test is skipped on all platforms. This attribute returns the 'failing' category, which is disabled by default.
-
To run all Linux-compatible tests that are failing:
```sh
<repo-root>/Tools/msbuild.sh <csproj_file> /t:BuildAndTest /p:OSGroup=Linux /p:WithCategories=failing
```
+#### ActiveIssueAttribute
+This attribute is intended to be used when there is an active issue tracking the test failure and it is needed to be fixed. This is a temporary attribute to skip the test while the issue is fixed. It is important that you limit the scope of the attribute to just the platforms and target monikers where the issue applies.
+
+This attribute can be applied either to a test class (will disable all the tests in that class) or to a test method. It allows multiple usages on the same member.
+
+This attribute returns the 'failing' category, which is disabled by default.
+
+**Disable for all platforms and all target frameworks:**
+```cs
+[ActiveIssue(int issue)]
+[ActiveIssue(string issue)]
+```
+**Disable for specific platform:**
+```cs
+[ActiveIssue(int issue, TestPlatforms platforms)]
+[ActiveIssue(string issue, TestPlatforms platforms)]
+```
+**Disable for specific target frameworks:**
+```cs
+[ActiveIssue(int issue, TargetFrameworkMonikers frameworks)]
+[ActiveIssue(string issue, TargetFrameworkMonikers frameworks)]
+```
+**Disable for specific test platforms and target frameworks:**
+```cs
+[ActiveIssue(int issue, TestPlatforms platforms, TargetFrameworkMonikers frameworks)]
+[ActiveIssue(string issue, TestPlatforms platforms, TargetFrameworkMonikers frameworks)]
+```
+Use this attribute over test methods to skip failing tests only on the specific platforms and the specific target frameworks.
+
+#### SkipOnTargetFrameworkAttribute
+This attribute is intended to disable a test permanently on a framework where an API is not available or there is an intentional difference in behavior in between the tested framework and the skipped framework.
+
+This attribute can be applied either to a test class (will disable all the tests in that class) or to a test method. It allows multiple usages on the same member.
+
+```cs
+[SkipOnTargetFramework(TargetFrameworkMonikers frameworks, string reason)]
+```
+Use this attribute over test methods to skip tests only on the specific target frameworks. The reason parameter doesn't affect the traits but we rather always use it so that when we see this attribute we know why it is being skipped on that framework.
+
+If it needs to be skipped in multiple frameworks and the reasons are different please use two attributes on the same test so that you can specify different reasons for each framework.
+
+**Currently this are the [Framework Monikers](https://github.com/dotnet/buildtools/blob/master/src/xunit.netcore.extensions/TargetFrameworkMonikers.cs#L23-L26) that we support through our test execution infrastructure**
+
+#### ConditionalFactAttribute
+Use this attribute to run the test only when a condition is `true`. This attribute is used when `ActiveIssueAttribute` or `SkipOnTargetFrameworkAttribute` are not flexible enough due to needing to run a custom logic at test time. This test behaves as a `[Fact]` test that has no test data passed in as a parameter.
+
+```cs
+[ConditionalFact(params string[] conditionMemberNames)]
+```
+
+The conditional method needs to be a static method or property on this or any ancestor type, of any visibility, accepting zero arguments, and having a return type of Boolean.
+
+**Example:**
+```cs
+public class TestClass
+{
+ public static bool ConditionProperty => true;
+
+ [ConditionalFact(nameof(ConditionProperty))]
+ public static void TestMethod()
+ {
+ Assert.True(true);
+ }
+}
+```
+
+#### ConditionalTheoryAttribute
+Use this attribute to run the test only when a condition is `true`. This attribute is used when `ActiveIssueAttribute` or `SkipOnTargetFrameworkAttribute` are not flexible enough due to needing to run a custom logic at test time. This test behaves as a `[Theory]` test that has no test data passed in as a parameter.
+
+```cs
+[ConditionalTheory(params string[] conditionMemberNames)]
+```
+
+This attribute must have `[MemberData(string member)]` or a `[ClassData(Type class)]` attribute, which represents an `IEnumerable<object>` containing the data that will be passed as a parameter to the test. Another option is to add multiple or one `[InlineData(object params[] parameters)]` attribute.
+
+The conditional method needs to be a static method or property on this or any ancestor type, of any visibility, accepting zero arguments, and having a return type of Boolean.
+
+**Example:**
+```cs
+public class TestClass
+{
+ public static bool ConditionProperty => true;
+
+ public static IEnumerable<object[]> Subtract_TestData()
+ {
+ yield return new object[] { new IntPtr(42), 6, (long)36 };
+ yield return new object[] { new IntPtr(40), 0, (long)40 };
+ yield return new object[] { new IntPtr(38), -2, (long)40 };
+ }
+
+ [ConditionalTheory(nameof(ConditionProperty))]
+ [MemberData(nameof(Equals_TestData))]
+ public static void Subtract(IntPtr ptr, int offset, long expected)
+ {
+ IntPtr p1 = IntPtr.Subtract(ptr, offset);
+ VerifyPointer(p1, expected);
+
+ IntPtr p2 = ptr - offset;
+ VerifyPointer(p2, expected);
+
+ IntPtr p3 = ptr;
+ p3 -= offset;
+ VerifyPointer(p3, expected);
+ }
+}
+```
+
+**Note that all of the attributes above must include an issue number/link and/or have a comment next to them briefly justifying the reason. ActiveIssueAttribute and SkipOnTargetFrameworkAttribute should use their constructor parameters to do this**
+
_**A few common examples with the above attributes:**_
- Run all tests acceptable on Windows that are not failing:
diff --git a/Documentation/project-docs/issue-guide.md b/Documentation/project-docs/issue-guide.md
index cae602ead1..f22bcd47e8 100644
--- a/Documentation/project-docs/issue-guide.md
+++ b/Documentation/project-docs/issue-guide.md
@@ -113,7 +113,7 @@ Feel free to use other labels if it helps your triage efforts (e.g. **needs more
#### Motivation for triage rules
-1. Each issue has exactly one **area-&#42;** label
+1. Each issue has exactly one **area-\*** label
* Motivation: Issues with multiple areas have loose responbility (everyone blames the other side) and issues are double counted in reports.
1. Issue has no **Assignee**, unless someone is working on the issue at the moment
* Motivation: Observation is that contributors are less likely to grab assigned issues, no matter what the repo rules say.
@@ -125,3 +125,18 @@ Feel free to use other labels if it helps your triage efforts (e.g. **needs more
* Don't be afraid to be wrong when deciding 'bug' vs. 'test bug' (flip a coin if you must). The most useful values for tracking are 'api-&#42;' vs. 'enhancement', 'question', and 'documentation'.
1. Don't be afraid to say no, or close issues - just explain why and be polite
1. Don't be afraid to be wrong - just be flexible when new information appears
+
+#### PR rules
+
+1. Each PR has exactly one **area-\*** label
+ * Movitation: Area owners will get email notification about new issue in their area.
+1. PR has **Assignee** set to author of the PR, if it is non-CoreFX engineer, then area owners are co-assignees
+ * Motivation: Area owners are responsible to do code reviews for PRs from external contributors. CoreFX engineers know how to get code reviews from others.
+1. Set milestone according to the branch (master = 2.1, release/2.0.0 = 2.0, release/1.0.0 = 1.0.x, release/1.1.0 = 1.1.x)
+ * Motivation: Easier to track where which fix ended and if it needs to be ported into another branch
+1. Any other labels on PRs are superfluous and not needed (exceptions: **blocked**, **NO MERGE**)
+ * Motivation: All the important info (*issue type* label, api approval label, OS label, etc.) is already captured on the associated issue.
+1. Push PRs forward, don't let them go stale (response every 5+ days, ideally no PRs older than 2 weeks)
+1. Stuck or long-term blocked PRs (e.g. due to missing API approval, etc.) should be closed and reopened once they are unstuck
+ * Motivation: Keep only active PRs. WIP (work-in-progress) PRs should be rare and should not become stale (2+ weeks old). If a PR is stale and there is not immediate path forward, consider closing the PR until it is unblocked/unstuck.
+1. PR should be linked to related issue, use [auto-closing](https://help.github.com/articles/closing-issues-via-commit-messages/) (add "Fixes #12345" into your PR description)
diff --git a/Documentation/project-docs/porting.md b/Documentation/project-docs/porting.md
index e928126314..830cd79543 100644
--- a/Documentation/project-docs/porting.md
+++ b/Documentation/project-docs/porting.md
@@ -87,7 +87,7 @@ Security Transparency | [Details](#security-transparency)
**Justification**. AppDomains require runtime support and are generally quite expensive. They are not implemented in .NET Core or .NET Native. We do not plan on adding this capability in future.
-**Replacement**. AppDomains were used for different features; for isolation we recommend processes and/or containers. For dynamic loading, we provide `AssemblyLoadContext`. Information (such as the name and base directory) is provided by APIs on other types, for instance `AppContext.BaseDirectory `. Some scenarios, such as getting the list of loaded are unsupported as they are inherently fragile.
+**Replacement**. AppDomains were used for different features; for isolation we recommend processes and/or containers. For dynamic loading, we provide `AssemblyLoadContext`. Information (such as the name and base directory) is provided by APIs on other types, for instance `AppContext.BaseDirectory`. Some scenarios, such as getting the list of loaded assemblies are unsupported as they are inherently fragile.
To make code migration from .NET Framework easier, we have exposed some of the `AppDomain` API surface in .NET Core and .NET Native. Some of the APIs work fine (e.g. `UnhandledException`), some of them do nothing (e.g. `SetCachePath`) and some of them throw `PlatformNotSupportedException` (e.g. `CreateDomain`). See more details about particular API differences in [TODO](https://github.com/dotnet/corefx/issues/18405).
diff --git a/buildpipeline/DotNet-CoreFx-Trusted-Linux-Crossbuild.json b/buildpipeline/DotNet-CoreFx-Trusted-Linux-Crossbuild.json
index 652388d631..d5568222d5 100644
--- a/buildpipeline/DotNet-CoreFx-Trusted-Linux-Crossbuild.json
+++ b/buildpipeline/DotNet-CoreFx-Trusted-Linux-Crossbuild.json
@@ -191,7 +191,7 @@
},
"inputs": {
"filename": "docker",
- "arguments": "exec -e ROOTFS_DIR $(PB_DockerContainerName) $(PB_GitDirectory)/build.sh -OfficialBuildId=$(OfficialBuildId) -buildArch=$(PB_Architecture) -$(PB_ConfigurationGroup) $(PB_BuildArguments)",
+ "arguments": "exec -e ROOTFS_DIR $(PB_DockerContainerName) $(PB_GitDirectory)/build.sh -OfficialBuildId=$(OfficialBuildId) $(PB_BuildArguments)",
"workingFolder": "",
"failOnStandardError": "false"
}
diff --git a/buildpipeline/DotNet-CoreFx-Trusted-Windows-NoTest.json b/buildpipeline/DotNet-CoreFx-Trusted-Windows-NoTest.json
index 17f690f614..6f51006a96 100644
--- a/buildpipeline/DotNet-CoreFx-Trusted-Windows-NoTest.json
+++ b/buildpipeline/DotNet-CoreFx-Trusted-Windows-NoTest.json
@@ -15,7 +15,7 @@
"scriptType": "inlineScript",
"scriptName": "",
"arguments": "-path $(build.SourcesDirectory)\\corefx",
- "inlineScript": "param($path)\n\nif (Test-Path $path){\n # this will print out an error each time a file can't be deleted.\n Remove-Item -Recurse -Force $path\n }\n\nif (Test-Path $path){\n # in case corefx is still alive\n .\\diag_tools\\handle.exe -accepteula $path\n }",
+ "inlineScript": "param($path)\n\nif (Test-Path $path){\n Stop-Process -processname msbuild -ErrorAction Ignore -Verbose\n Stop-Process -processname dotnet -ErrorAction Ignore -Verbose\n Stop-Process -processname vbcscompiler -ErrorAction Ignore -Verbose\n # this will print out an error each time a file can't be deleted.\n Remove-Item -Recurse -Force $path\n }\n",
"workingFolder": "",
"failOnStandardError": "true"
}
diff --git a/buildpipeline/DotNet-CoreFx-Trusted-Windows.json b/buildpipeline/DotNet-CoreFx-Trusted-Windows.json
index ea684a3a05..2ccfd8640d 100644
--- a/buildpipeline/DotNet-CoreFx-Trusted-Windows.json
+++ b/buildpipeline/DotNet-CoreFx-Trusted-Windows.json
@@ -15,7 +15,7 @@
"scriptType": "inlineScript",
"scriptName": "",
"arguments": "-path $(build.SourcesDirectory)\\corefx",
- "inlineScript": "param($path)\n\nif (Test-Path $path){\n # this will print out an error each time a file can't be deleted.\n Remove-Item -Recurse -Force $path\n }\n\nif (Test-Path $path){\n # in case corefx is still alive\n .\\diag_tools\\handle.exe -accepteula $path\n }",
+ "inlineScript": "param($path)\n\nif (Test-Path $path){\n Stop-Process -processname msbuild -ErrorAction Ignore -Verbose\n Stop-Process -processname dotnet -ErrorAction Ignore -Verbose\n Stop-Process -processname vbcscompiler -ErrorAction Ignore -Verbose\n # this will print out an error each time a file can't be deleted.\n Remove-Item -Recurse -Force $path\n }\n",
"workingFolder": "",
"failOnStandardError": "true"
}
diff --git a/buildpipeline/DotNet-Trusted-Publish.json b/buildpipeline/DotNet-Trusted-Publish.json
index 280fdd7358..6e1bf95693 100644
--- a/buildpipeline/DotNet-Trusted-Publish.json
+++ b/buildpipeline/DotNet-Trusted-Publish.json
@@ -4,6 +4,25 @@
"enabled": true,
"continueOnError": false,
"alwaysRun": false,
+ "displayName": "Install Signing Plugin",
+ "timeoutInMinutes": 0,
+ "condition": "succeeded()",
+ "task": {
+ "id": "30666190-6959-11e5-9f96-f56098202fef",
+ "versionSpec": "1.*",
+ "definitionType": "task"
+ },
+ "inputs": {
+ "signType": "real",
+ "zipSources": "true",
+ "version": "",
+ "feedSource": "https://devdiv.pkgs.visualstudio.com/DefaultCollection/_packaging/MicroBuildToolset/nuget/v3/index.json"
+ }
+ },
+ {
+ "enabled": true,
+ "continueOnError": false,
+ "alwaysRun": false,
"displayName": "Run script $(VS140COMNTOOLS)\\VsDevCmd.bat",
"timeoutInMinutes": 0,
"task": {
@@ -83,6 +102,27 @@
"enabled": true,
"continueOnError": false,
"alwaysRun": false,
+ "displayName": "Inject signed symbol catalogs",
+ "timeoutInMinutes": 0,
+ "condition": "succeeded()",
+ "task": {
+ "id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1",
+ "versionSpec": "1.*",
+ "definitionType": "task"
+ },
+ "inputs": {
+ "scriptType": "inlineScript",
+ "scriptName": "",
+ "arguments": "-ConfigGroup $(PB_ConfigurationGroup) -SymPkgGlob $(PB_AzureContainerSymbolPackageGlob) -PipelineSrcDir $(Pipeline.SourcesDirectory)",
+ "workingFolder": "$(Pipeline.SourcesDirectory)",
+ "inlineScript": "param($ConfigGroup, $SymPkgGlob, $PipelineSrcDir)\n\n.\\build-managed.cmd -- /t:InjectSignedSymbolCatalogIntoSymbolPackages `\n/p:SymbolPackagesToPublishGlob=$PipelineSrcDir\\packages\\AzureTransfer\\$ConfigGroup\\$SymPkgGlob `\n/p:SymbolCatalogCertificateId=400",
+ "failOnStandardError": "true"
+ }
+ },
+ {
+ "enabled": true,
+ "continueOnError": false,
+ "alwaysRun": false,
"displayName": "Index symbol packages",
"timeoutInMinutes": 0,
"task": {
@@ -221,6 +261,20 @@
"retentionDays": "",
"dropMetadataContainerName": "DropMetadata"
}
+ },
+ {
+ "enabled": true,
+ "continueOnError": false,
+ "alwaysRun": false,
+ "displayName": "Send Telemetry",
+ "timeoutInMinutes": 0,
+ "condition": "always()",
+ "task": {
+ "id": "521a94ea-9e68-468a-8167-6dcf361ea776",
+ "versionSpec": "1.*",
+ "definitionType": "task"
+ },
+ "inputs": {}
}
],
"options": [
diff --git a/buildpipeline/pipeline.json b/buildpipeline/pipeline.json
index 0d729573bf..50dd214c7d 100644
--- a/buildpipeline/pipeline.json
+++ b/buildpipeline/pipeline.json
@@ -5,168 +5,45 @@
"Type": "VSTS",
"BaseUrl": "https://devdiv.visualstudio.com/DefaultCollection"
},
- "Pipelines": [{
+ "Pipelines": [
+ {
"Name": "Trusted-All-Release-Linux",
"Parameters": {
"TreatWarningsAsErrors": "false"
},
"BuildParameters": {
- "PB_ConfigurationGroup": "Release",
- "PB_BuildArguments": "-buildArch=x64 -Release -stripSymbols",
- "PB_BuildTestsArguments": "-buildArch=x64 -Release -SkipTests -Outerloop -- /p:ArchiveTests=true /p:EnableDumpling=true",
- "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:ConfigurationGroup=Release /p:\"EnableCloudTest=false\" /p:\"TestProduct=corefx /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Linux\"",
- "PB_SyncArguments": "-p -- /p:ArchGroup=x64"
+ "PB_ConfigurationGroup": "Release"
},
"Definitions": [{
"Name": "DotNet-CoreFx-Trusted-Linux",
"Parameters": {
- "PB_DockerTag": "debian82_prereqs_2",
- "PB_TargetQueue": "Debian.82.Amd64"
- },
- "ReportingParameters": {
- "OperatingSystem": "Debian 8.2",
- "Type": "build/product/",
- "ConfigurationGroup": "Release"
- }
- },
- {
- "Name": "DotNet-CoreFx-Trusted-Linux",
- "Parameters": {
- "PB_DockerTag": "fedora24_prereqs_v4",
- "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:ConfigurationGroup=Release /p:\"EnableCloudTest=false\" /p:\"TestProduct=corefx /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Linux\""
- },
- "ReportingParameters": {
- "OperatingSystem": "Fedora 24",
- "Type": "build/product/",
- "ConfigurationGroup": "Release"
- }
- },
- {
- "Name": "DotNet-CoreFx-Trusted-Linux",
- "Parameters": {
- "PB_DockerTag": "opensuse421_prereqs_v3",
- "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:ConfigurationGroup=Release /p:\"EnableCloudTest=false\" /p:\"TestProduct=corefx /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Linux\""
- },
- "ReportingParameters": {
- "OperatingSystem": "openSUSE 42.1",
- "Type": "build/product/",
- "ConfigurationGroup": "Release"
- }
- },
- {
- "Name": "DotNet-CoreFx-Trusted-Linux",
- "Parameters": {
"PB_DockerTag": "rhel7_prereqs_2",
- "PB_TargetQueue": "Redhat.72.Amd64"
- },
- "ReportingParameters": {
- "OperatingSystem": "RedHat 7",
- "Type": "build/product/",
- "ConfigurationGroup": "Release"
- }
- },
- {
- "Name": "DotNet-CoreFx-Trusted-Linux",
- "Parameters": {
- "PB_DockerTag": "rhel7_prereqs_2",
- "PB_BuildArguments": "-buildArch=x64 -Release -portable",
- "PB_SyncArguments": "-p -portable -- /p:ArchGroup=x64",
+ "PB_BuildArguments": "-buildArch=x64 -Release -stripSymbols",
+ "PB_BuildTestsArguments": "-buildArch=x64 -Release -SkipTests -Outerloop -- /p:ArchiveTests=true /p:EnableDumpling=true",
+ "PB_SyncArguments": "-p -- /p:ArchGroup=x64",
"PB_TargetQueue": "Centos.73.Amd64+RedHat.72.Amd64+RedHat.73.Amd64+Debian.87.Amd64+Debian.90.Amd64+Ubuntu.1404.Amd64+Ubuntu.1604.Amd64+Ubuntu.1610.Amd64+Ubuntu.1704.Amd64+suse.422.amd64+fedora.25.amd64",
- "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:ConfigurationGroup=Release /p:\"TestProduct=corefx /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Linux\" "
- },
- "ReportingParameters": {
- "OperatingSystem": "RedHat 7",
- "Type": "build/product/",
- "ConfigurationGroup": "Release",
- "SubType": "PortableBuild"
- }
- },
- {
- "Name": "DotNet-CoreFx-Trusted-Linux",
- "Parameters": {
- "PB_DockerTag": "ubuntu1404_prereqs_v3",
- "PB_TargetQueue": "Ubuntu.1404.Amd64"
+ "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:ConfigurationGroup=Release /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Linux"
},
"ReportingParameters": {
- "OperatingSystem": "Ubuntu 14.04",
- "Type": "build/product/",
- "ConfigurationGroup": "Release"
- }
- },
- {
- "Name": "DotNet-CoreFx-Trusted-Linux",
- "Parameters": {
- "PB_DockerTag": "ubuntu1604_prereqs",
- "PB_TargetQueue": "Ubuntu.1604.Amd64"
- },
- "ReportingParameters": {
- "OperatingSystem": "Ubuntu 16.04",
- "Type": "build/product/",
- "ConfigurationGroup": "Release"
- }
- },
- {
- "Name": "DotNet-CoreFx-Trusted-Linux",
- "Parameters": {
- "PB_DockerTag": "ubuntu1610_prereqs_v2",
- "PB_TargetQueue": "Ubuntu.1610.Amd64"
- },
- "ReportingParameters": {
- "OperatingSystem": "Ubuntu 16.10",
+ "OperatingSystem": "Linux",
+ "Platform": "x64",
"Type": "build/product/",
"ConfigurationGroup": "Release"
}
- }
- ]
- },
- {
- "Name": "Trusted-All-Release-Linux-Crossbuild",
- "Parameters": {
- "TreatWarningsAsErrors": "false"
- },
- "BuildParameters": {
- "PB_ConfigurationGroup": "Release",
- "PB_BuildArguments": "-stripSymbols"
- },
- "Definitions": [{
- "Name": "DotNet-CoreFx-Trusted-Linux-Crossbuild",
- "Parameters": {
- "PB_DockerTag": "ubuntu-14.04-cross-0cd4667-20172211042239",
- "PB_Architecture": "arm"
- },
- "ReportingParameters": {
- "OperatingSystem": "Ubuntu 14.04",
- "Type": "build/product/",
- "ConfigurationGroup": "Release",
- "SubType": "Crossbuild"
- }
},
{
"Name": "DotNet-CoreFx-Trusted-Linux-Crossbuild",
"Parameters": {
"PB_DockerTag": "ubuntu-14.04-cross-0cd4667-20172211042239",
"PB_Architecture": "arm",
- "PB_BuildArguments": "-portable",
- "PB_SyncArguments": "-p -portable -- /p:ArchGroup=arm"
- },
- "ReportingParameters": {
- "OperatingSystem": "Ubuntu 14.04",
- "Type": "build/product/",
- "ConfigurationGroup": "Release",
- "SubType": "PortableBuild"
- }
- },
- {
- "Name": "DotNet-CoreFx-Trusted-Linux-Crossbuild",
- "Parameters": {
- "PB_DockerTag": "ubuntu-16.04-cross-ef0ac75-20175511035548",
- "PB_Architecture": "arm"
+ "PB_BuildArguments": "-buildArch=arm -Release -stripSymbols",
+ "PB_SyncArguments": "-p -- /p:ArchGroup=arm"
},
"ReportingParameters": {
- "OperatingSystem": "Ubuntu 16.04",
+ "OperatingSystem": "Linux",
+ "Platform": "arm",
"Type": "build/product/",
- "ConfigurationGroup": "Release",
- "SubType": "Crossbuild"
+ "ConfigurationGroup": "Release"
}
}
]
@@ -185,27 +62,16 @@
"Definitions": [{
"Name": "DotNet-CoreFx-Trusted-OSX",
"Parameters": {
- "PB_TargetQueue": "OSX.1012.Amd64"
- },
- "ReportingParameters": {
- "OperatingSystem": "OSX",
- "Type": "build/product/",
- "ConfigurationGroup": "Release"
- }
- },
- {
- "Name": "DotNet-CoreFx-Trusted-OSX",
- "Parameters": {
- "PB_BuildArguments": "-buildArch=x64 -Release -portable",
- "PB_SyncArguments": "-p -portable -- /p:ArchGroup=x64",
+ "PB_BuildArguments": "-buildArch=x64 -Release",
+ "PB_SyncArguments": "-p -- /p:ArchGroup=x64",
"PB_TargetQueue": "OSX.1012.Amd64",
- "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:ConfigurationGroup=Release /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=OSX "
+ "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:ConfigurationGroup=Release /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=OSX"
},
"ReportingParameters": {
"OperatingSystem": "OSX",
+ "Platform": "x64",
"Type": "build/product/",
- "ConfigurationGroup": "Release",
- "SubType": "PortableBuild"
+ "ConfigurationGroup": "Release"
}
}
]
@@ -219,20 +85,22 @@
"PB_ConfigurationGroup": "Release",
"PB_PipelineBuildMSBuildArguments": "/p:EnableProfileGuidedOptimization=true"
},
- "Definitions": [{
+ "Definitions": [
+ {
"Name": "DotNet-CoreFx-Trusted-Windows",
"Parameters": {
"PB_Platform": "arm",
"PB_BuildArguments": "-buildArch=arm -Release -- /p:SignType=real /p:RuntimeOS=win10",
"PB_BuildTestsArguments": "-buildArch=arm -Release -SkipTests -Outerloop -- /p:RuntimeOS=win10 /p:ArchiveTests=true",
"PB_SyncArguments": "-p -- /p:ArchGroup=arm /p:RuntimeOS=win10",
- "PB_CreateHelixArguments": "/p:ArchGroup=arm /p:ConfigurationGroup=Release /p:\"EnableCloudTest=false\" /p:\"TestProduct=corefx\" /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Windows_NT\""
+ "PB_CreateHelixArguments": "/p:ArchGroup=arm /p:ConfigurationGroup=Release /p:EnableCloudTest=false /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT"
},
"ReportingParameters": {
"OperatingSystem": "Windows",
"Type": "build/product/",
"Platform": "arm",
- "ConfigurationGroup": "Release"
+ "ConfigurationGroup": "Release",
+ "SubType": "netcoreapp"
}
},
{
@@ -242,13 +110,14 @@
"PB_BuildArguments": "-buildArch=arm64 -Release -- /p:SignType=real /p:RuntimeOS=win10",
"PB_BuildTestsArguments": "-buildArch=arm64 -Release -SkipTests -Outerloop -- /p:RuntimeOS=win10 /p:ArchiveTests=true",
"PB_SyncArguments": "-p -- /p:ArchGroup=arm64 /p:RuntimeOS=win10",
- "PB_CreateHelixArguments": "/p:ArchGroup=arm64 /p:ConfigurationGroup=Release /p:\"EnableCloudTest=false\" /p:\"TestProduct=corefx\" /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Windows_NT\""
+ "PB_CreateHelixArguments": "/p:ArchGroup=arm64 /p:ConfigurationGroup=Release /p:EnableCloudTest=false /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT"
},
"ReportingParameters": {
"OperatingSystem": "Windows",
"Type": "build/product/",
"Platform": "arm64",
- "ConfigurationGroup": "Release"
+ "ConfigurationGroup": "Release",
+ "SubType": "netcoreapp"
}
},
{
@@ -258,13 +127,14 @@
"PB_BuildArguments": "-buildArch=x64 -Release -- /p:SignType=real /p:RuntimeOS=win10",
"PB_BuildTestsArguments": "-buildArch=x64 -Release -SkipTests -Outerloop -- /p:RuntimeOS=win10 /p:ArchiveTests=true",
"PB_SyncArguments": "-p -- /p:ArchGroup=x64 /p:RuntimeOS=win10",
- "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:ConfigurationGroup=Release /p:\"EnableCloudTest=false\" /p:\"TestProduct=corefx\" /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Windows_NT\""
+ "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:ConfigurationGroup=Release /p:\"TargetQueues=Windows.10.Amd64,Windows.10.Nano.Amd64,Windows.7.Amd64,Windows.81.Amd64\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT"
},
"ReportingParameters": {
"OperatingSystem": "Windows",
"Type": "build/product/",
"Platform": "x64",
- "ConfigurationGroup": "Release"
+ "ConfigurationGroup": "Release",
+ "SubType": "netcoreapp"
}
},
{
@@ -275,82 +145,14 @@
"PB_BuildArguments": "-buildArch=x86 -Release -- /p:SignType=real /p:RuntimeOS=win10",
"PB_BuildTestsArguments": "-buildArch=x86 -Release -SkipTests -Outerloop -- /p:RuntimeOS=win10 /p:ArchiveTests=true",
"PB_SyncArguments": "-p -- /p:ArchGroup=x86 /p:RuntimeOS=win10",
- "PB_CreateHelixArguments": "/p:ArchGroup=x86 /p:ConfigurationGroup=Release /p:\"EnableCloudTest=false\" /p:\"TestProduct=corefx\" /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Windows_NT\""
- },
- "ReportingParameters": {
- "OperatingSystem": "Windows",
- "Type": "build/product/",
- "Platform": "x86",
- "ConfigurationGroup": "Release"
- }
- },
- {
- "Name": "DotNet-CoreFx-Trusted-Windows",
- "Parameters": {
- "PB_Platform": "arm",
- "PB_BuildArguments": "-buildArch=arm -Release -portable -- /p:SignType=real /p:RuntimeOS=win10",
- "PB_BuildTestsArguments": "-buildArch=arm -Release -SkipTests -Outerloop -portable -- /p:RuntimeOS=win10 /p:ArchiveTests=true",
- "PB_SyncArguments": "-p -portable -- /p:ArchGroup=arm /p:RuntimeOS=win10",
- "PB_CreateHelixArguments": "/p:ArchGroup=arm /p:ConfigurationGroup=Release /p:\"EnableCloudTest=false\" /p:\"TestProduct=corefx\" /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Windows_NT\""
- },
- "ReportingParameters": {
- "OperatingSystem": "Windows",
- "Type": "build/product/",
- "Platform": "arm",
- "ConfigurationGroup": "Release",
- "SubType": "PortableBuild"
- }
- },
- {
- "Name": "DotNet-CoreFx-Trusted-Windows",
- "Parameters": {
- "PB_Platform": "arm64",
- "PB_BuildArguments": "-buildArch=arm64 -Release -portable -- /p:SignType=real /p:RuntimeOS=win10",
- "PB_BuildTestsArguments": "-buildArch=arm64 -Release -SkipTests -Outerloop -portable -- /p:RuntimeOS=win10 /p:ArchiveTests=true",
- "PB_SyncArguments": "-p -portable -- /p:ArchGroup=arm64 /p:RuntimeOS=win10",
- "PB_CreateHelixArguments": "/p:ArchGroup=arm64 /p:ConfigurationGroup=Release /p:\"EnableCloudTest=false\" /p:\"TestProduct=corefx\" /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Windows_NT\""
- },
- "ReportingParameters": {
- "OperatingSystem": "Windows",
- "Type": "build/product/",
- "Platform": "arm64",
- "ConfigurationGroup": "Release",
- "SubType": "PortableBuild"
- }
- },
- {
- "Name": "DotNet-CoreFx-Trusted-Windows",
- "Parameters": {
- "PB_Platform": "x64",
- "PB_BuildArguments": "-buildArch=x64 -Release -portable -- /p:SignType=real /p:RuntimeOS=win10",
- "PB_BuildTestsArguments": "-buildArch=x64 -Release -SkipTests -Outerloop -portable -- /p:RuntimeOS=win10 /p:ArchiveTests=true",
- "PB_SyncArguments": "-p -portable -- /p:ArchGroup=x64 /p:RuntimeOS=win10",
- "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:ConfigurationGroup=Release /p:\"TargetQueues=Windows.10.Amd64,Windows.10.Nano.Amd64,Windows.7.Amd64,Windows.81.Amd64\" /p:\"TestProduct=corefx\" /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Windows_NT\" "
- },
- "ReportingParameters": {
- "OperatingSystem": "Windows",
- "Type": "build/product/",
- "Platform": "x64",
- "ConfigurationGroup": "Release",
- "SubType": "PortableBuild"
- }
- },
- {
- "Name": "DotNet-CoreFx-Trusted-Windows",
- "Parameters": {
- "PB_Platform": "x86",
- "PB_TargetQueue": "Windows.10.Amd64",
- "PB_BuildArguments": "-buildArch=x86 -Release -portable -- /p:SignType=real /p:RuntimeOS=win10",
- "PB_BuildTestsArguments": "-buildArch=x86 -Release -SkipTests -Outerloop -portable -- /p:RuntimeOS=win10 /p:ArchiveTests=true",
- "PB_SyncArguments": "-p -portable -- /p:ArchGroup=x86 /p:RuntimeOS=win10",
- "PB_CreateHelixArguments": "/p:ArchGroup=x86 /p:ConfigurationGroup=Release /p:\"TargetQueues=Windows.10.Amd64,Windows.7.Amd64,Windows.81.Amd64\" /p:\"TestProduct=corefx\" /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Windows_NT\" "
+ "PB_CreateHelixArguments": "/p:ArchGroup=x86 /p:ConfigurationGroup=Release /p:\"TargetQueues=Windows.10.Amd64,Windows.7.Amd64,Windows.81.Amd64\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT"
},
"ReportingParameters": {
"OperatingSystem": "Windows",
"Type": "build/product/",
"Platform": "x86",
"ConfigurationGroup": "Release",
- "SubType": "PortableBuild"
+ "SubType": "netcoreapp"
}
},
{
@@ -365,7 +167,7 @@
"Type": "build/product/",
"Platform": "arm",
"ConfigurationGroup": "Release",
- "SubType": "Uap"
+ "SubType": "uap"
}
},
{
@@ -375,14 +177,14 @@
"PB_BuildArguments": "-framework=uap -buildArch=x64 -Release -- /p:SignType=real /p:RuntimeOS=win10",
"PB_BuildTestsArguments": "-framework=uap -buildArch=x64 -Release -SkipTests -- /p:RuntimeOS=win10 /p:ArchiveTests=true",
"PB_SyncArguments": "-p -- /p:ArchGroup=x64 /p:RuntimeOS=win10 /p:TargetGroup=uap",
- "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:TargetGroup=uap /p:ConfigurationGroup=Release /p:\"TargetQueues=Windows.10.Amd64\" /p:\"TestProduct=corefx\" /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Windows_NT\" /p:\"HelixJobType=test/functional/uwp/\""
+ "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:TargetGroup=uap /p:ConfigurationGroup=Release /p:\"TargetQueues=Windows.10.Amd64\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/uwp/\""
},
"ReportingParameters": {
"OperatingSystem": "Windows",
"Type": "build/product/",
"Platform": "x64",
"ConfigurationGroup": "Release",
- "SubType": "Uap"
+ "SubType": "uap"
}
},
{
@@ -398,22 +200,24 @@
"Type": "build/product/",
"Platform": "x86",
"ConfigurationGroup": "Release",
- "SubType": "Uap"
+ "SubType": "uap"
}
},
{
- "Name": "DotNet-CoreFx-Trusted-Windows-NoTest",
+ "Name": "DotNet-CoreFx-Trusted-Windows",
"Parameters": {
"PB_Platform": "arm",
"PB_BuildArguments": "-framework=uapaot -buildArch=arm -Release -- /p:SignType=real /p:RuntimeOS=win10",
- "PB_SyncArguments": "-p -- /p:ArchGroup=arm /p:RuntimeOS=win10"
+ "PB_BuildTestsArguments": "-framework=uapaot -buildArch=arm -Release -SkipTests -- /p:RuntimeOS=win10 /p:ArchiveTests=true",
+ "PB_SyncArguments": "-p -- /p:ArchGroup=arm /p:RuntimeOS=win10 /p:TargetGroup=uapaot",
+ "PB_CreateHelixArguments": "/p:ArchGroup=arm /p:TargetGroup=uapaot /p:ConfigurationGroup=Release /p:TargetQueues=Windows.10.Amd64 /p:SecondaryQueue=Windows.10.Arm64 /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/ilc/\""
},
"ReportingParameters": {
"OperatingSystem": "Windows",
"Type": "build/product/",
"Platform": "arm",
"ConfigurationGroup": "Release",
- "SubType": "Uapaot"
+ "SubType": "uapaot"
}
},
{
@@ -423,14 +227,14 @@
"PB_BuildArguments": "-framework=uapaot -buildArch=x64 -Release -- /p:SignType=real /p:RuntimeOS=win10",
"PB_BuildTestsArguments": "-framework=uapaot -buildArch=x64 -Release -SkipTests -- /p:RuntimeOS=win10 /p:ArchiveTests=true",
"PB_SyncArguments": "-p -- /p:ArchGroup=x64 /p:RuntimeOS=win10 /p:TargetGroup=uapaot",
- "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:TargetGroup=uapaot /p:ConfigurationGroup=Release /p:\"TargetQueues=Windows.10.Amd64\" /p:\"TestProduct=corefx\" /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Windows_NT\" /p:\"HelixJobType=test/functional/ilc/\""
+ "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:TargetGroup=uapaot /p:ConfigurationGroup=Release /p:\"TargetQueues=Windows.10.Amd64\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/ilc/\""
},
"ReportingParameters": {
"OperatingSystem": "Windows",
"Type": "build/product/",
"Platform": "x64",
"ConfigurationGroup": "Release",
- "SubType": "Uapaot"
+ "SubType": "uapaot"
}
},
{
@@ -440,14 +244,14 @@
"PB_BuildArguments": "-framework=uapaot -buildArch=x86 -Release -- /p:SignType=real /p:RuntimeOS=win10",
"PB_BuildTestsArguments": "-framework=uapaot -buildArch=x86 -Release -SkipTests -- /p:RuntimeOS=win10 /p:ArchiveTests=true",
"PB_SyncArguments": "-p -- /p:ArchGroup=x86 /p:RuntimeOS=win10",
- "PB_CreateHelixArguments": "/p:ArchGroup=x86 /p:TargetGroup=uapaot /p:ConfigurationGroup=Release /p:\"TargetQueues=Windows.10.Amd64\" /p:\"TestProduct=corefx\" /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Windows_NT\" /p:\"HelixJobType=test/functional/ilc/\""
+ "PB_CreateHelixArguments": "/p:ArchGroup=x86 /p:TargetGroup=uapaot /p:ConfigurationGroup=Release /p:\"TargetQueues=Windows.10.Amd64\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/ilc/\""
},
"ReportingParameters": {
"OperatingSystem": "Windows",
"Type": "build/product/",
"Platform": "x86",
"ConfigurationGroup": "Release",
- "SubType": "Uapaot"
+ "SubType": "uapaot"
}
},
{
@@ -472,14 +276,14 @@
"PB_BuildArguments": "-framework=netfx -buildArch=x64 -Release -- /p:SignType=real /p:RuntimeOS=win10",
"PB_BuildTestsArguments": "-framework=netfx -buildArch=x64 -Release -SkipTests -- /p:RuntimeOS=win10 /p:ArchiveTests=true",
"PB_SyncArguments": "-p -- /p:ArchGroup=x64 /p:RuntimeOS=win10 /p:TargetGroup=netfx",
- "PB_CreateHelixArguments": "/p:EnableCloudTest=false /p:ArchGroup=x64 /p:TargetGroup=netfx /p:ConfigurationGroup=Release /p:\"TargetQueues=Windows.10.Amd64\" /p:\"TestProduct=corefx\" /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Windows_NT\" /p:\"HelixJobType=test/functional/desktop/cli/\""
+ "PB_CreateHelixArguments": "/p:EnableCloudTest=false /p:ArchGroup=x64 /p:TargetGroup=netfx /p:ConfigurationGroup=Release /p:\"TargetQueues=Windows.10.Amd64\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/desktop/cli/\""
},
"ReportingParameters": {
"OperatingSystem": "Windows",
"Type": "build/product/",
"Platform": "x64",
"ConfigurationGroup": "Release",
- "SubType": "Netfx"
+ "SubType": "netfx"
}
},
{
@@ -489,14 +293,14 @@
"PB_BuildArguments": "-framework=netfx -buildArch=x86 -Release -- /p:SignType=real /p:RuntimeOS=win10",
"PB_BuildTestsArguments": "-framework=netfx -buildArch=x86 -Release -SkipTests -- /p:RuntimeOS=win10 /p:ArchiveTests=true",
"PB_SyncArguments": "-p -- /p:ArchGroup=x86 /p:RuntimeOS=win10 /p:TargetGroup=netfx",
- "PB_CreateHelixArguments": "/p:EnableCloudTest=false /p:ArchGroup=x86 /p:TargetGroup=netfx /p:ConfigurationGroup=Release /p:\"TargetQueues=Windows.10.Amd64\" /p:\"TestProduct=corefx\" /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Windows_NT\" /p:\"HelixJobType=test/functional/desktop/cli/\""
+ "PB_CreateHelixArguments": "/p:EnableCloudTest=false /p:ArchGroup=x86 /p:TargetGroup=netfx /p:ConfigurationGroup=Release /p:\"TargetQueues=Windows.10.Amd64\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/desktop/cli/\""
},
"ReportingParameters": {
"OperatingSystem": "Windows",
"Type": "build/product/",
"Platform": "x86",
"ConfigurationGroup": "Release",
- "SubType": "Netfx"
+ "SubType": "netfx"
}
}
]
@@ -507,146 +311,38 @@
"TreatWarningsAsErrors": "false"
},
"BuildParameters": {
- "PB_ConfigurationGroup": "Debug",
- "PB_BuildArguments": "-buildArch=x64 -Debug",
- "PB_BuildTestsArguments": "-buildArch=x64 -Debug -SkipTests -Outerloop -- /p:ArchiveTests=true /p:EnableDumpling=true",
- "PB_CreateHelixArguments": "/p:EnableCloudTest=false /p:ArchGroup=x64 /p:ConfigurationGroup=Debug /p:\"TestProduct=corefx /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Linux\"",
- "PB_SyncArguments": "-p -- /p:ArchGroup=x64"
+ "PB_ConfigurationGroup": "Debug"
},
"Definitions": [{
"Name": "DotNet-CoreFx-Trusted-Linux",
"Parameters": {
- "PB_DockerTag": "debian82_prereqs_2",
- "PB_TargetQueue": "Debian.82.Amd64"
- },
- "ReportingParameters": {
- "OperatingSystem": "Debian 8.2",
- "Type": "build/product/",
- "ConfigurationGroup": "Debug"
- }
- },
- {
- "Name": "DotNet-CoreFx-Trusted-Linux",
- "Parameters": {
- "PB_DockerTag": "fedora24_prereqs_v4",
- "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:ConfigurationGroup=Debug /p:\"EnableCloudTest=false\" /p:\"TestProduct=corefx /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Linux\""
- },
- "ReportingParameters": {
- "OperatingSystem": "Fedora 24",
- "Type": "build/product/",
- "ConfigurationGroup": "Debug"
- }
- },
- {
- "Name": "DotNet-CoreFx-Trusted-Linux",
- "Parameters": {
- "PB_DockerTag": "opensuse421_prereqs_v3",
- "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:ConfigurationGroup=Debug /p:\"EnableCloudTest=false\" /p:\"TestProduct=corefx /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Linux\""
- },
- "ReportingParameters": {
- "OperatingSystem": "openSUSE 42.1",
- "Type": "build/product/",
- "ConfigurationGroup": "Debug"
- }
- },
- {
- "Name": "DotNet-CoreFx-Trusted-Linux",
- "Parameters": {
- "PB_DockerTag": "rhel7_prereqs_2",
- "PB_TargetQueue": "Redhat.72.Amd64"
- },
- "ReportingParameters": {
- "OperatingSystem": "RedHat 7",
- "Type": "build/product/",
- "ConfigurationGroup": "Debug"
- }
- },
- {
- "Name": "DotNet-CoreFx-Trusted-Linux",
- "Parameters": {
"PB_DockerTag": "rhel7_prereqs_2",
- "PB_BuildArguments": "-buildArch=x64 -Debug -portable",
- "PB_SyncArguments": "-p -portable -- /p:ArchGroup=x64",
+ "PB_BuildArguments": "-buildArch=x64 -Debug",
+ "PB_BuildTestsArguments": "-buildArch=x64 -Debug -SkipTests -Outerloop -- /p:ArchiveTests=true /p:EnableDumpling=true",
+ "PB_SyncArguments": "-p -- /p:ArchGroup=x64",
"PB_TargetQueue": "Centos.73.Amd64+RedHat.72.Amd64+RedHat.73.Amd64+Debian.87.Amd64+Debian.90.Amd64+Ubuntu.1404.Amd64+Ubuntu.1604.Amd64+Ubuntu.1610.Amd64+Ubuntu.1704.Amd64+suse.422.amd64+fedora.25.amd64",
- "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:ConfigurationGroup=Debug /p:\"TestProduct=corefx /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Linux\" "
+ "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:ConfigurationGroup=Debug /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Linux"
},
"ReportingParameters": {
- "OperatingSystem": "RedHat 7",
- "Type": "build/product/",
- "ConfigurationGroup": "Debug",
- "SubType": "PortableBuild"
- }
- },
- {
- "Name": "DotNet-CoreFx-Trusted-Linux",
- "Parameters": {
- "PB_DockerTag": "ubuntu1404_prereqs_v3",
- "PB_TargetQueue": "Ubuntu.1404.Amd64"
- },
- "ReportingParameters": {
- "OperatingSystem": "Ubuntu 14.04",
- "Type": "build/product/",
- "ConfigurationGroup": "Debug"
- }
- },
- {
- "Name": "DotNet-CoreFx-Trusted-Linux",
- "Parameters": {
- "PB_DockerTag": "ubuntu1604_prereqs",
- "PB_TargetQueue": "Ubuntu.1604.Amd64"
- },
- "ReportingParameters": {
- "OperatingSystem": "Ubuntu 16.04",
+ "OperatingSystem": "Linux",
+ "Platform": "x64",
"Type": "build/product/",
"ConfigurationGroup": "Debug"
}
},
{
- "Name": "DotNet-CoreFx-Trusted-Linux",
- "Parameters": {
- "PB_DockerTag": "ubuntu1610_prereqs_v2",
- "PB_TargetQueue": "Ubuntu.1610.Amd64"
- },
- "ReportingParameters": {
- "OperatingSystem": "Ubuntu 16.10",
- "Type": "build/product/",
- "ConfigurationGroup": "Debug"
- }
- }
- ]
- },
- {
- "Name": "Trusted-All-Debug-Linux-Crossbuild",
- "Parameters": {
- "TreatWarningsAsErrors": "false"
- },
- "BuildParameters": {
- "PB_ConfigurationGroup": "Debug"
- },
- "Definitions": [{
"Name": "DotNet-CoreFx-Trusted-Linux-Crossbuild",
"Parameters": {
"PB_DockerTag": "ubuntu-14.04-cross-0cd4667-20172211042239",
- "PB_Architecture": "arm"
- },
- "ReportingParameters": {
- "OperatingSystem": "Ubuntu 14.04",
- "Type": "build/product/",
- "ConfigurationGroup": "Debug",
- "SubType": "Crossbuild"
- }
- },
- {
- "Name": "DotNet-CoreFx-Trusted-Linux-Crossbuild",
- "Parameters": {
- "PB_DockerTag": "ubuntu-16.04-cross-ef0ac75-20175511035548",
- "PB_Architecture": "arm"
+ "PB_Architecture": "arm",
+ "PB_BuildArguments": "-buildArch=arm -Debug",
+ "PB_SyncArguments": "-p -- /p:ArchGroup=arm"
},
"ReportingParameters": {
- "OperatingSystem": "Ubuntu 16.04",
+ "OperatingSystem": "Linux",
+ "Platform": "arm",
"Type": "build/product/",
- "ConfigurationGroup": "Debug",
- "SubType": "Crossbuild"
+ "ConfigurationGroup": "Debug"
}
}
]
@@ -660,7 +356,7 @@
"PB_BuildArguments": "-buildArch=x64 -Debug",
"PB_BuildTestsArguments": "-buildArch=x64 -Debug -SkipTests -Outerloop -- /p:ArchiveTests=true",
"PB_SyncArguments": "-p -- /p:ArchGroup=x64",
- "PB_CreateHelixArguments": "/p:EnableCloudTest=false /p:ArchGroup=x64 /p:ConfigurationGroup=Debug /p:\"TestProduct=corefx /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=OSX\""
+ "PB_CreateHelixArguments": "/p:EnableCloudTest=false /p:ArchGroup=x64 /p:ConfigurationGroup=Debug /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:\"TargetOS=OSX\""
},
"Definitions": [{
"Name": "DotNet-CoreFx-Trusted-OSX",
@@ -669,6 +365,7 @@
},
"ReportingParameters": {
"OperatingSystem": "OSX",
+ "Platform": "x64",
"Type": "build/product/",
"ConfigurationGroup": "Debug"
}
@@ -682,84 +379,22 @@
"BuildParameters": {
"PB_ConfigurationGroup": "Debug"
},
- "Definitions": [{
- "Name": "DotNet-CoreFx-Trusted-Windows",
- "Parameters": {
- "PB_Platform": "arm",
- "PB_BuildArguments": "-buildArch=arm -Debug -- /p:SignType=real /p:RuntimeOS=win10",
- "PB_BuildTestsArguments": "-buildArch=arm -Debug -SkipTests -Outerloop -- /p:RuntimeOS=win10 /p:ArchiveTests=true",
- "PB_SyncArguments": "-p -- /p:ArchGroup=arm /p:RuntimeOS=win10",
- "PB_CreateHelixArguments": "/p:ArchGroup=arm /p:ConfigurationGroup=Debug /p:\"EnableCloudTest=false\" /p:\"TestProduct=corefx\" /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Windows_NT\""
- },
- "ReportingParameters": {
- "OperatingSystem": "Windows",
- "Type": "build/product/",
- "Platform": "arm",
- "ConfigurationGroup": "Debug"
- }
- },
+ "Definitions": [
{
"Name": "DotNet-CoreFx-Trusted-Windows",
"Parameters": {
- "PB_Platform": "arm64",
- "PB_BuildArguments": "-buildArch=arm64 -Debug -- /p:SignType=real /p:RuntimeOS=win10",
- "PB_BuildTestsArguments": "-buildArch=arm64 -Debug -SkipTests -Outerloop -- /p:RuntimeOS=win10 /p:ArchiveTests=true",
- "PB_SyncArguments": "-p -- /p:ArchGroup=arm64 /p:RuntimeOS=win10",
- "PB_CreateHelixArguments": "/p:ArchGroup=arm64 /p:ConfigurationGroup=Debug /p:\"EnableCloudTest=false\" /p:\"TestProduct=corefx\" /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Windows_NT\""
- },
- "ReportingParameters": {
- "OperatingSystem": "Windows",
- "Type": "build/product/",
- "Platform": "arm64",
- "ConfigurationGroup": "Debug"
- }
- },
- {
- "Name": "DotNet-CoreFx-Trusted-Windows",
- "Parameters": {
- "PB_Platform": "x64",
- "PB_BuildArguments": "-buildArch=x64 -Debug -- /p:SignType=real /p:RuntimeOS=win10",
- "PB_BuildTestsArguments": "-buildArch=x64 -Debug -SkipTests -Outerloop -- /p:RuntimeOS=win10 /p:ArchiveTests=true",
- "PB_SyncArguments": "-p -- /p:ArchGroup=x64 /p:RuntimeOS=win10",
- "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:ConfigurationGroup=Debug /p:\"EnableCloudTest=false\" /p:\"TestProduct=corefx\" /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Windows_NT\""
- },
- "ReportingParameters": {
- "OperatingSystem": "Windows",
- "Type": "build/product/",
- "Platform": "x64",
- "ConfigurationGroup": "Debug"
- }
- },
- {
- "Name": "DotNet-CoreFx-Trusted-Windows",
- "Parameters": {
- "PB_Platform": "x86",
- "PB_TargetQueue": "Windows.10.Amd64",
- "PB_BuildArguments": "-buildArch=x86 -Debug -- /p:SignType=real /p:RuntimeOS=win10",
- "PB_BuildTestsArguments": "-buildArch=x86 -Debug -SkipTests -Outerloop -- /p:RuntimeOS=win10 /p:ArchiveTests=true",
- "PB_SyncArguments": "-p -- /p:ArchGroup=x86 /p:RuntimeOS=win10",
- "PB_CreateHelixArguments": "/p:ArchGroup=x86 /p:ConfigurationGroup=Debug /p:\"EnableCloudTest=false\" /p:\"TestProduct=corefx\" /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Windows_NT\""
- },
- "ReportingParameters": {
- "OperatingSystem": "Windows",
- "Type": "build/product/",
- "Platform": "x86",
- "ConfigurationGroup": "Debug"
- }
- },
- {
- "Name": "DotNet-CoreFx-Trusted-Windows-NoTest",
- "Parameters": {
"PB_Platform": "arm",
- "PB_BuildArguments": "-framework:uap -buildArch=arm -Debug -- /p:SignType=real /p:RuntimeOS=win10",
- "PB_SyncArguments": "-p -- /p:ArchGroup=arm /p:RuntimeOS=win10"
+ "PB_BuildArguments": "-framework=uap -buildArch=arm -Debug -- /p:SignType=real /p:RuntimeOS=win10",
+ "PB_BuildTestsArguments": "-framework=uap -buildArch=arm -Debug -SkipTests -- /p:RuntimeOS=win10 /p:ArchiveTests=true",
+ "PB_SyncArguments": "-p -- /p:ArchGroup=arm /p:RuntimeOS=win10 /p:TargetGroup=uap",
+ "PB_CreateHelixArguments": "/p:ArchGroup=arm /p:TargetGroup=uap /p:ConfigurationGroup=Debug /p:TargetQueues=Windows.10.Amd64 /p:SecondaryQueue=Windows.10.Arm64 /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/uwp/\""
},
"ReportingParameters": {
"OperatingSystem": "Windows",
"Type": "build/product/",
"Platform": "arm",
"ConfigurationGroup": "Debug",
- "SubType": "Uap"
+ "SubType": "uap"
}
},
{
@@ -769,14 +404,14 @@
"PB_BuildArguments": "-framework=uap -buildArch=x64 -Debug -- /p:SignType=real /p:RuntimeOS=win10",
"PB_BuildTestsArguments": "-framework=uap -buildArch=x64 -Debug -SkipTests -- /p:RuntimeOS=win10 /p:ArchiveTests=true",
"PB_SyncArguments": "-p -- /p:ArchGroup=x64 /p:RuntimeOS=win10 /p:TargetGroup=uap",
- "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:TargetGroup=uap /p:ConfigurationGroup=Debug /p:\"TargetQueues=Windows.10.Amd64\" /p:\"TestProduct=corefx\" /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Windows_NT\" /p:\"HelixJobType=test/functional/uwp/\""
+ "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:TargetGroup=uap /p:ConfigurationGroup=Debug /p:\"TargetQueues=Windows.10.Amd64\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/uwp/\""
},
"ReportingParameters": {
"OperatingSystem": "Windows",
"Type": "build/product/",
"Platform": "x64",
"ConfigurationGroup": "Debug",
- "SubType": "Uap"
+ "SubType": "uap"
}
},
{
@@ -792,7 +427,7 @@
"Type": "build/product/",
"Platform": "x86",
"ConfigurationGroup": "Debug",
- "SubType": "Uap"
+ "SubType": "uap"
}
},
{
@@ -807,7 +442,7 @@
"Type": "build/product/",
"Platform": "arm",
"ConfigurationGroup": "Debug",
- "SubType": "Uapaot"
+ "SubType": "uapaot"
}
},
{
@@ -817,14 +452,14 @@
"PB_BuildArguments": "-framework:uapaot -buildArch=x64 -Debug -- /p:SignType=real /p:RuntimeOS=win10",
"PB_BuildTestsArguments": "-framework=uapaot -buildArch=x64 -Debug -SkipTests -- /p:RuntimeOS=win10 /p:ArchiveTests=true",
"PB_SyncArguments": "-p -- /p:ArchGroup=x64 /p:RuntimeOS=win10 /p:TargetGroup=uapaot",
- "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:TargetGroup=uapaot /p:ConfigurationGroup=Debug /p:\"TargetQueues=Windows.10.Amd64\" /p:\"TestProduct=corefx\" /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Windows_NT\" /p:\"HelixJobType=test/functional/ilc/\""
+ "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:TargetGroup=uapaot /p:ConfigurationGroup=Debug /p:\"TargetQueues=Windows.10.Amd64\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/ilc/\""
},
"ReportingParameters": {
"OperatingSystem": "Windows",
"Type": "build/product/",
"Platform": "x64",
"ConfigurationGroup": "Debug",
- "SubType": "Uapaot"
+ "SubType": "uapaot"
}
},
{
@@ -835,14 +470,14 @@
"PB_BuildArguments": "-framework:uapaot -buildArch=x86 -Debug -- /p:SignType=real /p:RuntimeOS=win10",
"PB_BuildTestsArguments": "-framework=uapaot -buildArch=x86 -Debug -SkipTests -- /p:RuntimeOS=win10 /p:ArchiveTests=true",
"PB_SyncArguments": "-p -- /p:ArchGroup=x86 /p:RuntimeOS=win10",
- "PB_CreateHelixArguments": "/p:ArchGroup=x86 /p:TargetGroup=uapaot /p:ConfigurationGroup=Debug /p:\"TargetQueues=Windows.10.Amd64\" /p:\"TestProduct=corefx\" /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Windows_NT\" /p:\"HelixJobType=test/functional/ilc/\""
+ "PB_CreateHelixArguments": "/p:ArchGroup=x86 /p:TargetGroup=uapaot /p:ConfigurationGroup=Debug /p:\"TargetQueues=Windows.10.Amd64\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/ilc/\""
},
"ReportingParameters": {
"OperatingSystem": "Windows",
"Type": "build/product/",
"Platform": "x86",
"ConfigurationGroup": "Debug",
- "SubType": "Uapaot"
+ "SubType": "uapaot"
}
},
{
@@ -867,14 +502,14 @@
"PB_BuildArguments": "-framework=netfx -buildArch=x64 -Debug -- /p:SignType=real /p:RuntimeOS=win10",
"PB_BuildTestsArguments": "-framework=netfx -buildArch=x64 -Debug -SkipTests -- /p:RuntimeOS=win10 /p:ArchiveTests=true",
"PB_SyncArguments": "-p -- /p:ArchGroup=x64 /p:RuntimeOS=win10 /p:TargetGroup=netfx",
- "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:TargetGroup=netfx /p:ConfigurationGroup=Debug /p:\"TargetQueues=Windows.10.Amd64\" /p:\"TestProduct=corefx\" /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Windows_NT\" /p:\"HelixJobType=test/functional/desktop/cli/\""
+ "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:TargetGroup=netfx /p:ConfigurationGroup=Debug /p:\"TargetQueues=Windows.10.Amd64\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/desktop/cli/\""
},
"ReportingParameters": {
"OperatingSystem": "Windows",
"Type": "build/product/",
"Platform": "x64",
"ConfigurationGroup": "Debug",
- "SubType": "Netfx"
+ "SubType": "netfx"
}
},
{
@@ -884,14 +519,14 @@
"PB_BuildArguments": "-framework=netfx -buildArch=x86 -Debug -- /p:SignType=real /p:RuntimeOS=win10",
"PB_BuildTestsArguments": "-framework=netfx -buildArch=x86 -Debug -SkipTests -- /p:RuntimeOS=win10 /p:ArchiveTests=true",
"PB_SyncArguments": "-p -- /p:ArchGroup=x86 /p:RuntimeOS=win10 /p:TargetGroup=netfx",
- "PB_CreateHelixArguments": "/p:ArchGroup=x86 /p:TargetGroup=netfx /p:ConfigurationGroup=Debug /p:\"TargetQueues=Windows.10.Amd64\" /p:\"TestProduct=corefx\" /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Windows_NT\" /p:\"HelixJobType=test/functional/desktop/cli/\""
+ "PB_CreateHelixArguments": "/p:ArchGroup=x86 /p:TargetGroup=netfx /p:ConfigurationGroup=Debug /p:\"TargetQueues=Windows.10.Amd64\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/desktop/cli/\""
},
"ReportingParameters": {
"OperatingSystem": "Windows",
"Type": "build/product/",
"Platform": "x86",
"ConfigurationGroup": "Debug",
- "SubType": "Netfx"
+ "SubType": "netfx"
}
}
]
@@ -919,8 +554,7 @@
"DependsOn": [
"Trusted-All-Release-Windows",
"Trusted-All-Release-OSX",
- "Trusted-All-Release-Linux",
- "Trusted-All-Release-Linux-Crossbuild"
+ "Trusted-All-Release-Linux"
]
},
{
@@ -946,8 +580,7 @@
"DependsOn": [
"Trusted-All-Debug-Windows",
"Trusted-All-Debug-OSX",
- "Trusted-All-Debug-Linux",
- "Trusted-All-Debug-Linux-Crossbuild"
+ "Trusted-All-Debug-Linux"
]
},
{
@@ -972,8 +605,7 @@
"DependsOn": [
"Trusted-All-Release-Windows",
"Trusted-All-Release-OSX",
- "Trusted-All-Release-Linux",
- "Trusted-All-Release-Linux-Crossbuild"
+ "Trusted-All-Release-Linux"
]
}
]
diff --git a/buildpipeline/pipelinejobs.groovy b/buildpipeline/pipelinejobs.groovy
index bbe401f4ee..3bd0a3a47d 100644
--- a/buildpipeline/pipelinejobs.groovy
+++ b/buildpipeline/pipelinejobs.groovy
@@ -22,11 +22,9 @@ def linuxPipeline = Pipeline.createPipelineForGithub(this, project, branch, 'bui
// CentOS 7.3, RedHat 7.3, Debian 8.7, Ubuntu 14.04, Ubuntu 16.04, Ubuntu 16.10, openSuSE 42.2 and Fedora 25
// One for just innerloop.
- linuxPipeline.triggerPipelineOnEveryGithubPR("Portable ${osName} ${configurationGroup} Build", "(?i).*test\\W+portable\\W+linux\\W+${configurationGroup}\\W+pipeline.*",
- ['Config':configurationGroup, 'OuterLoop':false])
+ linuxPipeline.triggerPipelineOnEveryGithubPR("Portable ${osName} ${configurationGroup} Build", ['Config':configurationGroup, 'OuterLoop':false])
// Add one for outerloop
- linuxPipeline.triggerPipelineOnGithubPRComment("Portable Outerloop ${osName} ${configurationGroup} Build", "(?i).*test\\W+outerloop\\W+portable\\W+linux\\W+${configurationGroup}\\W+pipeline.*",
- ['Config':configurationGroup, 'OuterLoop':true])
+ linuxPipeline.triggerPipelineOnGithubPRComment("Portable Outerloop ${osName} ${configurationGroup} Build", ['Config':configurationGroup, 'OuterLoop':true])
}
}
}
@@ -40,11 +38,9 @@ def windowsPipeline = Pipeline.createPipelineForGithub(this, project, branch, 'b
// Windows 10, Windows 7, Windows 8.1 and Windows Nano
// One for just innerloop
- windowsPipeline.triggerPipelineOnEveryGithubPR("Portable ${osName} ${configurationGroup} Build", "(?i).*test\\W+portable\\W+windows\\W+${configurationGroup}\\W+pipeline.*",
- ['Config':configurationGroup, 'OuterLoop':false])
+ windowsPipeline.triggerPipelineOnEveryGithubPR("Portable ${osName} ${configurationGroup} Build", ['Config':configurationGroup, 'OuterLoop':false])
// Add one for outerloop
- windowsPipeline.triggerPipelineOnGithubPRComment("Portable Outerloop ${osName} ${configurationGroup} Build", "(?i).*test\\W+outerloop\\W+portable\\W+windows\\W+${configurationGroup}\\W+pipeline.*",
- ['Config':configurationGroup, 'OuterLoop':true])
+ windowsPipeline.triggerPipelineOnGithubPRComment("Portable Outerloop ${osName} ${configurationGroup} Build", ['Config':configurationGroup, 'OuterLoop':true])
}
}
}
diff --git a/buildpipeline/portable-linux.groovy b/buildpipeline/portable-linux.groovy
index 57274c1a31..a1b7ce3f99 100644
--- a/buildpipeline/portable-linux.groovy
+++ b/buildpipeline/portable-linux.groovy
@@ -32,10 +32,10 @@ simpleDockerNode('microsoft/dotnet-buildtools-prereqs:rhel7_prereqs_2') {
sh "./build-managed.sh -- /t:GenerateVersionSourceFile /p:GenerateVersionSourceFile=true"
}
stage ('Sync') {
- sh "./sync.sh -p -portable -- /p:ArchGroup=x64"
+ sh "./sync.sh -p -- /p:ArchGroup=x64"
}
stage ('Build Product') {
- sh "./build.sh -buildArch=x64 -${params.Config} -portable"
+ sh "./build.sh -buildArch=x64 -${params.Config}"
}
stage ('Build Tests') {
def additionalArgs = ''
@@ -64,9 +64,9 @@ simpleDockerNode('microsoft/dotnet-buildtools-prereqs:rhel7_prereqs_2') {
// 'Ubuntu.1704.Amd64.Open',
'suse.422.amd64.Open',
'fedora.25.amd64.Open']
-
- sh "./Tools/msbuild.sh src/upload-tests.proj /p:ArchGroup=x64 /p:ConfigurationGroup=${params.Config} /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Linux /p:HelixJobType=test/functional/portable/cli/ /p:HelixSource=${helixSource} /p:BuildMoniker=${helixBuild} /p:HelixCreator=${helixCreator} /p:CloudDropAccountName=dotnetbuilddrops /p:CloudResultsAccountName=dotnetjobresults /p:CloudDropAccessToken=\$CloudDropAccessToken /p:CloudResultsAccessToken=\$OutputCloudResultsAccessToken /p:HelixApiEndpoint=https://helix.dot.net/api/2017-04-14/jobs /p:TargetQueues=${targetHelixQueues.join('+')} /p:HelixLogFolder=${WORKSPACE}/${logFolder}/ /p:HelixCorrelationInfoFileName=SubmittedHelixRuns.txt"
+
+ sh "./Tools/msbuild.sh src/upload-tests.proj /p:ArchGroup=x64 /p:ConfigurationGroup=${params.Config} /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Linux /p:HelixJobType=test/functional/cli/ /p:HelixSource=${helixSource} /p:BuildMoniker=${helixBuild} /p:HelixCreator=${helixCreator} /p:CloudDropAccountName=dotnetbuilddrops /p:CloudResultsAccountName=dotnetjobresults /p:CloudDropAccessToken=\$CloudDropAccessToken /p:CloudResultsAccessToken=\$OutputCloudResultsAccessToken /p:HelixApiEndpoint=https://helix.dot.net/api/2017-04-14/jobs /p:TargetQueues=${targetHelixQueues.join('+')} /p:HelixLogFolder=${WORKSPACE}/${logFolder}/ /p:HelixCorrelationInfoFileName=SubmittedHelixRuns.txt"
submittedHelixJson = readJSON file: "${logFolder}/SubmittedHelixRuns.txt"
}
diff --git a/buildpipeline/portable-windows.groovy b/buildpipeline/portable-windows.groovy
index 0651df8a86..e5f222c0f6 100644
--- a/buildpipeline/portable-windows.groovy
+++ b/buildpipeline/portable-windows.groovy
@@ -9,7 +9,9 @@ def submittedHelixJson = null
simpleNode('Windows_NT','latest') {
stage ('Checkout source') {
- checkout scm
+ retry (10) {
+ checkout scm
+ }
}
def logFolder = getLogFolder()
@@ -18,20 +20,20 @@ simpleNode('Windows_NT','latest') {
bat '.\\clean.cmd -all'
}
stage ('Sync') {
- bat '.\\sync.cmd -p -portable -- /p:ArchGroup=x64 /p:RuntimeOS=win10'
+ bat '.\\sync.cmd -p -- /p:ArchGroup=x64 /p:RuntimeOS=win10'
}
stage ('Generate Version Assets') {
bat '.\\build-managed.cmd -GenerateVersion'
}
stage ('Build Product') {
- bat ".\\build.cmd -buildArch=x64 -${params.Config} -portable -- /p:SignType=real /p:RuntimeOS=win10"
+ bat ".\\build.cmd -buildArch=x64 -${params.Config} -- /p:SignType=real /p:RuntimeOS=win10"
}
stage ('Build Tests') {
def additionalArgs = ''
if (params.OuterLoop) {
additionalArgs = '-Outerloop'
}
- bat ".\\build-tests.cmd -buildArch=x64 -${params.Config} -SkipTests -portable ${additionalArgs} -- /p:RuntimeOS=win10 /p:ArchiveTests=true"
+ bat ".\\build-tests.cmd -buildArch=x64 -${params.Config} -SkipTests ${additionalArgs} -- /p:RuntimeOS=win10 /p:ArchiveTests=true"
}
stage ('Submit To Helix For Testing') {
// Bind the credentials
@@ -43,14 +45,14 @@ simpleNode('Windows_NT','latest') {
def helixBuild = getCommit()
// Get the user that should be associated with the submission
def helixCreator = getUser()
-
+
// Target queues
def targetHelixQueues = ['Windows.10.Amd64.Open',
'Windows.10.Nano.Amd64.Open',
'Windows.7.Amd64.Open',
'Windows.81.Amd64.Open']
- bat "\"%VS140COMNTOOLS%\\VsDevCmd.bat\" && msbuild src\\upload-tests.proj /p:ArchGroup=x64 /p:ConfigurationGroup=${params.Config} /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:HelixJobType=test/functional/portable/cli/ /p:HelixSource=${helixSource} /p:BuildMoniker=${helixBuild} /p:HelixCreator=${helixCreator} /p:CloudDropAccountName=dotnetbuilddrops /p:CloudResultsAccountName=dotnetjobresults /p:CloudDropAccessToken=%CloudDropAccessToken% /p:CloudResultsAccessToken=%OutputCloudResultsAccessToken% /p:HelixApiEndpoint=https://helix.dot.net/api/2017-04-14/jobs /p:TargetQueues=\"${targetHelixQueues.join(',')}\" /p:HelixLogFolder= /p:HelixLogFolder=${WORKSPACE}\\${logFolder}\\ /p:HelixCorrelationInfoFileName=SubmittedHelixRuns.txt"
+ bat "\"%VS140COMNTOOLS%\\VsDevCmd.bat\" && msbuild src\\upload-tests.proj /p:ArchGroup=x64 /p:ConfigurationGroup=${params.Config} /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:HelixJobType=test/functional/cli/ /p:HelixSource=${helixSource} /p:BuildMoniker=${helixBuild} /p:HelixCreator=${helixCreator} /p:CloudDropAccountName=dotnetbuilddrops /p:CloudResultsAccountName=dotnetjobresults /p:CloudDropAccessToken=%CloudDropAccessToken% /p:CloudResultsAccessToken=%OutputCloudResultsAccessToken% /p:HelixApiEndpoint=https://helix.dot.net/api/2017-04-14/jobs /p:TargetQueues=\"${targetHelixQueues.join(',')}\" /p:HelixLogFolder= /p:HelixLogFolder=${WORKSPACE}\\${logFolder}\\ /p:HelixCorrelationInfoFileName=SubmittedHelixRuns.txt"
submittedHelixJson = readJSON file: "${logFolder}\\SubmittedHelixRuns.txt"
}
diff --git a/config.json b/config.json
index 57f63aa43e..d30f859467 100644
--- a/config.json
+++ b/config.json
@@ -40,7 +40,7 @@
"description": "Indicates if this is a portable build.",
"valueType": "property",
"values": [ "True", "False"],
- "defaultValue": "false"
+ "defaultValue": "true"
},
"SkipTests": {
"description": "Enables/Disables running tests.",
@@ -411,7 +411,7 @@
"CmakeBuildType": "default",
"HostOs": "default",
"ProcessorCount": "default",
- "AdditionalArgs": "default",
+ "AdditionalArgs": "-portable",
"ToolSetDir": "default"
}
}
diff --git a/dependencies.props b/dependencies.props
index c59f34728a..4018dd1ee3 100644
--- a/dependencies.props
+++ b/dependencies.props
@@ -9,28 +9,28 @@
These ref versions are pulled from https://github.com/dotnet/versions.
-->
<PropertyGroup>
- <CoreFxCurrentRef>6fa6ed1a40843f4ec7c0779aed68ec01b888ba1a</CoreFxCurrentRef>
- <CoreClrCurrentRef>a3cc536986258354aea31547ac3ddf3dad3cfd9d</CoreClrCurrentRef>
- <CoreSetupCurrentRef>a3cc536986258354aea31547ac3ddf3dad3cfd9d</CoreSetupCurrentRef>
+ <CoreFxCurrentRef>82fc1fc68bfa1d55e43913b188868879f31de8e7</CoreFxCurrentRef>
+ <CoreClrCurrentRef>82fc1fc68bfa1d55e43913b188868879f31de8e7</CoreClrCurrentRef>
+ <CoreSetupCurrentRef>82fc1fc68bfa1d55e43913b188868879f31de8e7</CoreSetupCurrentRef>
<ExternalCurrentRef>5a0606fccb09fce4b47545ae9896139acca547f5</ExternalCurrentRef>
- <ProjectNTfsCurrentRef>a3cc536986258354aea31547ac3ddf3dad3cfd9d</ProjectNTfsCurrentRef>
- <ProjectNTfsTestILCCurrentRef>a3cc536986258354aea31547ac3ddf3dad3cfd9d</ProjectNTfsTestILCCurrentRef>
+ <ProjectNTfsCurrentRef>4c65044ada00a01da3f9f5e544f70949d5a3cce5</ProjectNTfsCurrentRef>
+ <ProjectNTfsTestILCCurrentRef>4c65044ada00a01da3f9f5e544f70949d5a3cce5</ProjectNTfsTestILCCurrentRef>
<SniCurrentRef>97059fa979a3c8fb8b9fba127c526f15e48c9dde</SniCurrentRef>
- <StandardCurrentRef>a3cc536986258354aea31547ac3ddf3dad3cfd9d</StandardCurrentRef>
+ <StandardCurrentRef>4081b2616c091ea60c2cf069421b9438493a4a08</StandardCurrentRef>
</PropertyGroup>
<!-- Auto-upgraded properties for each build info dependency. -->
<PropertyGroup>
<PlatformPackageVersion>2.1.0-preview1-25324-02</PlatformPackageVersion>
- <CoreFxExpectedPrerelease>preview1-25324-02</CoreFxExpectedPrerelease>
- <CoreClrPackageVersion>2.1.0-preview1-25330-01</CoreClrPackageVersion>
+ <CoreFxExpectedPrerelease>preview1-25406-01</CoreFxExpectedPrerelease>
+ <CoreClrPackageVersion>2.1.0-preview1-25405-02</CoreClrPackageVersion>
<ExternalExpectedPrerelease>beta-25322-00</ExternalExpectedPrerelease>
- <ProjectNTfsExpectedPrerelease>beta-25330-00</ProjectNTfsExpectedPrerelease>
- <ProjectNTfsTestILCExpectedPrerelease>beta-25330-00</ProjectNTfsTestILCExpectedPrerelease>
- <ProjectNTfsTestILCPackageVersion>1.0.0-beta-25330-00</ProjectNTfsTestILCPackageVersion>
- <NETStandardPackageVersion>2.1.0-preview1-25329-01</NETStandardPackageVersion>
+ <ProjectNTfsExpectedPrerelease>beta-25405-00</ProjectNTfsExpectedPrerelease>
+ <ProjectNTfsTestILCExpectedPrerelease>beta-25405-00</ProjectNTfsTestILCExpectedPrerelease>
+ <ProjectNTfsTestILCPackageVersion>1.0.0-beta-25405-00</ProjectNTfsTestILCPackageVersion>
+ <NETStandardPackageVersion>2.1.0-preview1-25405-01</NETStandardPackageVersion>
<NETStandardPackageId>NETStandard.Library</NETStandardPackageId>
- <MicrosoftNETCoreAppPackageVersion>2.1.0-preview1-25329-02</MicrosoftNETCoreAppPackageVersion>
+ <MicrosoftNETCoreAppPackageVersion>2.1.0-preview1-25405-02</MicrosoftNETCoreAppPackageVersion>
<!-- Use the SNI runtime package -->
<SniPackageVersion>4.4.0-preview2-25312-01</SniPackageVersion>
</PropertyGroup>
@@ -40,7 +40,7 @@
<AppXRunnerVersion>1.0.3-prerelease-00921-01</AppXRunnerVersion>
<XunitPerfAnalysisPackageVersion>1.0.0-beta-build0006</XunitPerfAnalysisPackageVersion>
<TraceEventPackageVersion>1.0.3-alpha-experimental</TraceEventPackageVersion>
- <XunitNetcoreExtensionsVersion>1.0.1-prerelease-01625-01</XunitNetcoreExtensionsVersion>
+ <XunitNetcoreExtensionsVersion>1.0.1-prerelease-01630-02</XunitNetcoreExtensionsVersion>
</PropertyGroup>
<!-- Package dependency verification/auto-upgrade configuration. -->
diff --git a/dir.props b/dir.props
index 0904404a18..ba2b70257b 100644
--- a/dir.props
+++ b/dir.props
@@ -75,6 +75,8 @@
<!-- Default any assembly not specifying a key to use the Open Key -->
<AssemblyKey>Open</AssemblyKey>
<RunApiCompat>true</RunApiCompat>
+ <!-- Build as portable by default -->
+ <PortableBuild Condition="'$(PortableBuild)' == ''">true</PortableBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(BuildingInsideVisualStudio)' == 'true' and '$(Configuration)' != ''">
diff --git a/external/test-runtime/XUnit.Runtime.depproj b/external/test-runtime/XUnit.Runtime.depproj
index fcf98080a8..949ed87122 100644
--- a/external/test-runtime/XUnit.Runtime.depproj
+++ b/external/test-runtime/XUnit.Runtime.depproj
@@ -3,9 +3,8 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<!-- Given that xunit packages bring with them part of the framework, we need to specify a runtime in order to get the assets
- This RID value doesn't really matter, since the assets we are copying are not RID specific, so defaulting to Windows here
- -->
- <NugetRuntimeIdentifier>win7-x64</NugetRuntimeIdentifier>
+ The only asset that we copy which is RID-specific is sni.dll which is only used in windows, which is why we default to Windows as the RID -->
+ <NugetRuntimeIdentifier>win10-$(ArchGroup)</NugetRuntimeIdentifier>
<RidSpecificAssets>true</RidSpecificAssets>
<OutputPath>$(RuntimePath)</OutputPath>
<XUnitRunnerPackageId Condition="'$(TargetGroup)' != 'netfx'">xunit.console.netcore</XUnitRunnerPackageId>
diff --git a/external/test-runtime/optional.json b/external/test-runtime/optional.json
index 72b84403ac..ea491ea1da 100644
--- a/external/test-runtime/optional.json
+++ b/external/test-runtime/optional.json
@@ -4,9 +4,9 @@
"dependencies": {
"Microsoft.DotNet.IBCMerge": "4.6.0-alpha-00001",
"Microsoft.DotNet.UAP.TestTools": "1.0.2",
- "TestILC.amd64ret": "1.0.0-beta-25330-00",
- "TestILC.armret": "1.0.0-beta-25330-00",
- "TestILC.x86ret": "1.0.0-beta-25330-00"
+ "TestILC.amd64ret": "1.0.0-beta-25405-00",
+ "TestILC.armret": "1.0.0-beta-25405-00",
+ "TestILC.x86ret": "1.0.0-beta-25405-00"
}
}
}
diff --git a/init-tools.sh b/init-tools.sh
index c6c6df7d01..3b8527822a 100755
--- a/init-tools.sh
+++ b/init-tools.sh
@@ -25,6 +25,12 @@ OSName=$(uname -s)
OS=OSX
__DOTNET_PKG=dotnet-dev-osx-x64
ulimit -n 2048
+ # Format x.y.z as single integer with three digits for each part
+ VERSION=`sw_vers -productVersion| sed -e 's/\./ /g' | xargs printf "%03d%03d%03d"`
+ if [ "$VERSION" -lt 010012000 ]; then
+ echo error: macOS version `sw_vers -productVersion` is too old. 10.12 is needed as minimum.
+ exit 1
+ fi
;;
Linux)
diff --git a/netci.groovy b/netci.groovy
index e8b1282ef6..e6ec812250 100644
--- a/netci.groovy
+++ b/netci.groovy
@@ -341,8 +341,8 @@ def targetGroupOsMapInnerloop = ['netcoreapp': ['Windows_NT', 'Ubuntu14.04', 'Ub
// Set up triggers
if (isPR) {
targetGroupString = targetGroupString.replaceAll('_', ' ');
- // Set PR trigger only run netfx jobs automatically on every PR, the other legs are covered by the new portable pipeline legs
- if (targetGroup == 'netfx') {
+ // Set PR trigger only run netfx jobs automatically on every PR, the other legs except OSX10.12 are covered by the new portable pipeline legs
+ if (targetGroup == 'netfx' || osName == 'OSX10.12') {
Utilities.addGithubPRTriggerForBranch(newJob, branch, "Innerloop ${targetGroupString}${osName} ${configurationGroup} ${archGroup} Build and Test")
}
else {
diff --git a/pkg/Microsoft.Private.CoreFx.NETCoreApp/netcoreapp.rids.props b/pkg/Microsoft.Private.CoreFx.NETCoreApp/netcoreapp.rids.props
index b01cd5aeb6..6269203455 100644
--- a/pkg/Microsoft.Private.CoreFx.NETCoreApp/netcoreapp.rids.props
+++ b/pkg/Microsoft.Private.CoreFx.NETCoreApp/netcoreapp.rids.props
@@ -1,85 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Choose>
- <When Condition="'$(PackageRID)' != ''" />
- <When Condition="'$(_runtimeOSFamily)' == 'win'">
- <PropertyGroup>
- <PackageRID Condition="'$(ArchGroup)' == 'x86' OR '$(ArchGroup)' == 'x64'">win7-$(ArchGroup)</PackageRID>
- <PackageRID Condition="'$(ArchGroup)' == 'arm'">win8-$(ArchGroup)</PackageRID>
- <PackageRID Condition="'$(ArchGroup)' == 'arm64'">win10-$(ArchGroup)</PackageRID>
- <PackageRID Condition="'$(PortableBuild)' == 'true'">win-$(ArchGroup)</PackageRID>
- </PropertyGroup>
- </When>
- <When Condition="'$(_runtimeOSFamily)' == 'osx'">
- <PropertyGroup>
- <PackageRID>osx.10.12-$(ArchGroup)</PackageRID>
- <PackageRID Condition="'$(PortableBuild)' == 'true'">osx-$(ArchGroup)</PackageRID>
- </PropertyGroup>
- </When>
- <When Condition="'$(_runtimeOSFamily)' == 'rhel'">
- <PropertyGroup>
- <PackageRID>rhel.7-$(ArchGroup)</PackageRID>
- <PackageRID Condition="'$(PortableBuild)' == 'true'">linux-$(ArchGroup)</PackageRID>
- </PropertyGroup>
- </When>
- <Otherwise>
- <PropertyGroup>
- <PackageRID>$(RuntimeOS)-$(ArchGroup)</PackageRID>
- <PackageRID Condition="'$(PortableBuild)' == 'true'">linux-$(ArchGroup)</PackageRID>
- </PropertyGroup>
- </Otherwise>
- </Choose>
+ <PropertyGroup Condition="'$(PortableBuild)' == 'true'">
+ <PackageRID>linux-$(ArchGroup)</PackageRID>
+ <PackageRID Condition="'$(_runtimeOSFamily)' == 'osx'">osx-$(ArchGroup)</PackageRID>
+ <PackageRID Condition="'$(_runtimeOSFamily)' == 'win'">win-$(ArchGroup)</PackageRID>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(PortableBuild)' != 'true'">
+ <PackageRID>$(RuntimeOS)-$(ArchGroup)</PackageRID>
+ </PropertyGroup>
<ItemGroup>
- <OfficialBuildRID Include="alpine.3.4.3-x64" />
- <OfficialBuildRID Include="debian.8-armel">
- <Platform>armel</Platform>
- </OfficialBuildRID>
- <OfficialBuildRID Include="debian.8-x64" />
- <OfficialBuildRID Include="fedora.24-x64" />
- <OfficialBuildRID Include="linux-x64" />
- <OfficialBuildRID Include="opensuse.13.2-x64" />
- <OfficialBuildRID Include="opensuse.42.1-x64" />
- <OfficialBuildRID Include="osx.10.12-x64" />
- <OfficialBuildRID Include="osx-x64" />
- <OfficialBuildRID Include="rhel.7-x64" />
- <OfficialBuildRID Include="tizen.4.0.0-armel">
- <Platform>armel</Platform>
- </OfficialBuildRID>
<OfficialBuildRID Include="linux-arm">
<Platform>arm</Platform>
</OfficialBuildRID>
- <OfficialBuildRID Include="ubuntu.14.04-arm">
- <Platform>arm</Platform>
- </OfficialBuildRID>
- <OfficialBuildRID Include="ubuntu.14.04-x64" />
- <OfficialBuildRID Include="ubuntu.16.04-arm">
+ <OfficialBuildRID Include="linux-x64" />
+ <OfficialBuildRID Include="osx-x64" />
+ <OfficialBuildRID Include="win-arm">
<Platform>arm</Platform>
</OfficialBuildRID>
- <OfficialBuildRID Include="ubuntu.16.04-x64" />
- <OfficialBuildRID Include="ubuntu.16.10-arm">
- <Platform>arm</Platform>
+ <OfficialBuildRID Include="win-arm64">
+ <Platform>arm64</Platform>
</OfficialBuildRID>
- <OfficialBuildRID Include="ubuntu.16.10-x64" />
+ <OfficialBuildRID Include="win-x64" />
<OfficialBuildRID Include="win-x86">
<Platform>x86</Platform>
</OfficialBuildRID>
- <OfficialBuildRID Include="win7-x86">
- <Platform>x86</Platform>
- </OfficialBuildRID>
- <OfficialBuildRID Include="win-x64" />
- <OfficialBuildRID Include="win7-x64" />
- <OfficialBuildRID Include="win8-arm">
- <Platform>arm</Platform>
- </OfficialBuildRID>
- <OfficialBuildRID Include="win10-arm64">
- <Platform>arm64</Platform>
- </OfficialBuildRID>
- <OfficialBuildRID Include="win-arm">
- <Platform>arm</Platform>
- </OfficialBuildRID>
- <OfficialBuildRID Include="win-arm64">
- <Platform>arm64</Platform>
+
+ <!-- The following RIDs are not officically supported and are not
+ built during official builds, however we wish to include them
+ in our runtime.json to enable others to provide them. -->
+ <OfficialBuildRID Include="tizen.4.0.0-armel">
+ <Platform>armel</Platform>
</OfficialBuildRID>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/pkg/Microsoft.Private.PackageBaseline/packageIndex.json b/pkg/Microsoft.Private.PackageBaseline/packageIndex.json
index 06a7406abe..6723f07496 100644
--- a/pkg/Microsoft.Private.PackageBaseline/packageIndex.json
+++ b/pkg/Microsoft.Private.PackageBaseline/packageIndex.json
@@ -1486,16 +1486,25 @@
"System.DirectoryServices": {
"InboxOn": {
"net45": "4.0.0.0"
+ },
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.5.0"
}
},
"System.DirectoryServices.AccountManagement": {
"InboxOn": {
"net45": "4.0.0.0"
+ },
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.5.0"
}
},
"System.DirectoryServices.Protocols": {
"InboxOn": {
"net45": "4.0.0.0"
+ },
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.5.0"
}
},
"System.Drawing": {
diff --git a/pkg/descriptions.json b/pkg/descriptions.json
index 421744fca9..f8fec250f2 100644
--- a/pkg/descriptions.json
+++ b/pkg/descriptions.json
@@ -569,6 +569,32 @@
]
},
{
+ "Name": "System.DirectoryServices",
+ "Description": "Provides easy access to Active Directory Domain Services.",
+ "CommonTypes": [
+ "System.DirectoryServices.DirectoryEntry",
+ "System.DirectoryServices.DirectorySearcher",
+ "System.DirectoryServices.ActiveDirectory.ActiveDirectorySite",
+ "System.DirectoryServices.ActiveDirectory.ApplicationPartition",
+ "System.DirectoryServices.ActiveDirectory.DirectoryContext",
+ "System.DirectoryServices.ActiveDirectory.DirectoryServer",
+ "System.DirectoryServices.ActiveDirectory.Domain",
+ "System.DirectoryServices.ActiveDirectory.DomainController"
+ ]
+ },
+ {
+ "Name": "System.DirectoryServices.AccountManagement",
+ "Description": "Provides uniform access and manipulation of user, computer, and group security principals across the multiple principal stores: Active Directory Domain Services (AD DS), Active Directory Lightweight Directory Services (AD LDS), and Machine SAM (MSAM).",
+ "CommonTypes": [
+ ]
+ },
+ {
+ "Name": "System.DirectoryServices.Protocols",
+ "Description": "Provides the methods defined in the Lightweight Directory Access Protocol (LDAP) version 3 (V3) and Directory Services Markup Language (DSML) version 2.0 (V2) standards.",
+ "CommonTypes": [
+ ]
+ },
+ {
"Name": "System.Drawing.Primitives",
"Description": "Provides basic drawing primitive structures, that exposes the corresponding System.Drawing.dll types in .NET Core.",
"CommonTypes": [
diff --git a/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Keychain.cs b/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Keychain.cs
index f090360582..70817b86e4 100644
--- a/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Keychain.cs
+++ b/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Keychain.cs
@@ -40,6 +40,9 @@ internal static partial class Interop
out SafeKeychainHandle keychain);
[DllImport(Libraries.AppleCryptoNative)]
+ private static extern int AppleCryptoNative_SetKeychainNeverLock(SafeKeychainHandle keychain);
+
+ [DllImport(Libraries.AppleCryptoNative)]
private static extern int AppleCryptoNative_SecKeychainEnumerateCerts(
SafeKeychainHandle keychain,
out SafeCFArrayHandle matches,
@@ -179,6 +182,11 @@ internal static partial class Interop
SafeTemporaryKeychainHandle.TrackKeychain(keychain);
+ if (osStatus == 0)
+ {
+ osStatus = AppleCryptoNative_SetKeychainNeverLock(keychain);
+ }
+
if (osStatus != 0)
{
keychain.Dispose();
diff --git a/src/Common/src/System/Drawing/ColorConverterCommon.cs b/src/Common/src/System/Drawing/ColorConverterCommon.cs
new file mode 100644
index 0000000000..6e3e901450
--- /dev/null
+++ b/src/Common/src/System/Drawing/ColorConverterCommon.cs
@@ -0,0 +1,150 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Globalization;
+using System.Reflection;
+
+namespace System.Drawing
+{
+ // Minimal color conversion functionality, without a dependency on TypeConverter itself.
+ internal static class ColorConverterCommon
+ {
+ public static Color ConvertFromString(string strValue, CultureInfo culture)
+ {
+ string text = strValue.Trim();
+
+ if (text.Length == 0)
+ {
+ return Color.Empty;
+ }
+
+ {
+ Color c;
+ // First, check to see if this is a standard name.
+ //
+ if (ColorTable.TryGetNamedColor(text, out c))
+ {
+ return c;
+ }
+ }
+
+ if (culture == null)
+ {
+ culture = CultureInfo.CurrentCulture;
+ }
+
+ char sep = culture.TextInfo.ListSeparator[0];
+
+ // If the value is a 6 digit hex number only, then
+ // we want to treat the Alpha as 255, not 0
+ //
+ if (text.IndexOf(sep) == -1)
+ {
+ // text can be '' (empty quoted string)
+ if (text.Length >= 2 && (text[0] == '\'' || text[0] == '"') && text[0] == text[text.Length - 1])
+ {
+ // In quotes means a named value
+ string colorName = text.Substring(1, text.Length - 2);
+ return Color.FromName(colorName);
+ }
+ else if ((text.Length == 7 && text[0] == '#') ||
+ (text.Length == 8 && (text.StartsWith("0x") || text.StartsWith("0X"))) ||
+ (text.Length == 8 && (text.StartsWith("&h") || text.StartsWith("&H"))))
+ {
+ // Note: int.Parse will raise exception if value cannot be converted.
+ return PossibleKnownColor(Color.FromArgb(unchecked((int)(0xFF000000 | (uint)IntFromString(text, culture)))));
+ }
+ }
+
+ // Nope. Parse the RGBA from the text.
+ //
+ string[] tokens = text.Split(sep);
+ int[] values = new int[tokens.Length];
+ for (int i = 0; i < values.Length; i++)
+ {
+ values[i] = unchecked(IntFromString(tokens[i], culture));
+ }
+
+ // We should now have a number of parsed integer values.
+ // We support 1, 3, or 4 arguments:
+ //
+ // 1 -- full ARGB encoded
+ // 3 -- RGB
+ // 4 -- ARGB
+ //
+ switch (values.Length)
+ {
+ case 1:
+ return PossibleKnownColor(Color.FromArgb(values[0]));
+
+ case 3:
+ return PossibleKnownColor(Color.FromArgb(values[0], values[1], values[2]));
+
+ case 4:
+ return PossibleKnownColor(Color.FromArgb(values[0], values[1], values[2], values[3]));
+ }
+
+ throw new ArgumentException(SR.Format(SR.InvalidColor, text));
+ }
+
+ private static Color PossibleKnownColor(Color color)
+ {
+ // Now check to see if this color matches one of our known colors.
+ // If it does, then substitute it. We can only do this for "Colors"
+ // because system colors morph with user settings.
+ //
+ int targetARGB = color.ToArgb();
+
+ foreach (Color c in ColorTable.Colors.Values)
+ {
+ if (c.ToArgb() == targetARGB)
+ {
+ return c;
+ }
+ }
+ return color;
+ }
+
+ private static int IntFromString(string text, CultureInfo culture)
+ {
+ text = text.Trim();
+
+ try
+ {
+ if (text[0] == '#')
+ {
+ return IntFromString(text.Substring(1), 16);
+ }
+ else if (text.StartsWith("0x", StringComparison.OrdinalIgnoreCase)
+ || text.StartsWith("&h", StringComparison.OrdinalIgnoreCase))
+ {
+ return IntFromString(text.Substring(2), 16);
+ }
+ else
+ {
+ if (culture == null)
+ {
+ culture = CultureInfo.CurrentCulture;
+ }
+ NumberFormatInfo formatInfo = (NumberFormatInfo)culture.GetFormat(typeof(NumberFormatInfo));
+ return IntFromString(text, formatInfo);
+ }
+ }
+ catch (Exception e)
+ {
+ throw new Exception(SR.Format(SR.ConvertInvalidPrimitive, text, typeof(int).Name), e);
+ }
+ }
+
+ private static int IntFromString(string value, int radix)
+ {
+ return Convert.ToInt32(value, radix);
+ }
+
+ private static int IntFromString(string value, NumberFormatInfo formatInfo)
+ {
+ return Int32.Parse(value, NumberStyles.Integer, formatInfo);
+ }
+ }
+} \ No newline at end of file
diff --git a/src/Common/src/System/Drawing/ColorTable.cs b/src/Common/src/System/Drawing/ColorTable.cs
index 10a7a53217..04e69025fd 100644
--- a/src/Common/src/System/Drawing/ColorTable.cs
+++ b/src/Common/src/System/Drawing/ColorTable.cs
@@ -43,8 +43,8 @@ namespace System.Drawing
internal static bool IsKnownNamedColor(string name)
{
- Color result;
- return Colors.TryGetValue(name, out result);
+ Color result;
+ return Colors.TryGetValue(name, out result);
}
}
} \ No newline at end of file
diff --git a/src/Common/src/System/NotImplemented.cs b/src/Common/src/System/NotImplemented.cs
index 5895577569..ffbec64447 100644
--- a/src/Common/src/System/NotImplemented.cs
+++ b/src/Common/src/System/NotImplemented.cs
@@ -5,22 +5,27 @@
namespace System
{
//
- // This class enables one to throw a NotImplementedException using the following idiom:
- //
- // throw NotImplemented.ByDesign;
- //
- // Used by methods whose intended implementation is to throw a NotImplementedException (typically
- // virtual methods in public abstract classes that intended to be subclassed by third parties.)
- //
- // This makes it distinguishable both from human eyes and CCI from NYI's that truly represent undone work.
+ // Support for tooling-friendly NotImplementedExceptions.
//
internal static class NotImplemented
{
+ /// <summary>
+ /// Permanent NotImplementedException with no message shown to user.
+ /// </summary>
internal static Exception ByDesign => new NotImplementedException();
+ /// <summary>
+ /// Permanent NotImplementedException with localized message shown to user.
+ /// </summary>
internal static Exception ByDesignWithMessage(string message)
{
return new NotImplementedException(message);
}
+
+ /// <summary>
+ /// Temporary NotImplementedException with no message shown to user.
+ /// Example: Exception.ActiveIssue("https://github.com/dotnet/corefx/issues/xxxx") or Exception.ActiveIssue("TFS xxxxxx").
+ /// </summary>
+ internal static Exception ActiveIssue(string issue) => new NotImplementedException();
}
}
diff --git a/src/Common/tests/Data/TinyAssembly.dll b/src/Common/tests/Data/TinyAssembly.dll
index 73620119e5..07c90e02cc 100644
--- a/src/Common/tests/Data/TinyAssembly.dll
+++ b/src/Common/tests/Data/TinyAssembly.dll
Binary files differ
diff --git a/src/Common/tests/Data/TinyAssembly.il b/src/Common/tests/Data/TinyAssembly.il
index 797a0631c3..ba9456a4a0 100644
--- a/src/Common/tests/Data/TinyAssembly.il
+++ b/src/Common/tests/Data/TinyAssembly.il
@@ -1,2 +1,7 @@
.assembly TinyAssembly {}
.module TinyModule.dll
+
+.class interface public abstract auto ansi TinyAssembly.TinyInterface
+{
+} // end of class TinyAssembly.TinyInterface
+
diff --git a/src/Common/tests/System/Diagnostics/RemoteExecutorTestBase.cs b/src/Common/tests/System/Diagnostics/RemoteExecutorTestBase.cs
index 1903de1343..17e7e52b05 100644
--- a/src/Common/tests/System/Diagnostics/RemoteExecutorTestBase.cs
+++ b/src/Common/tests/System/Diagnostics/RemoteExecutorTestBase.cs
@@ -8,6 +8,12 @@ using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Xunit;
+#if uap
+using Windows.ApplicationModel;
+using Windows.ApplicationModel.AppService;
+using Windows.Foundation.Collections;
+#endif // uap
+
namespace System.Diagnostics
{
/// <summary>Base class used for all tests that need to spawn a remote process.</summary>
@@ -16,7 +22,7 @@ namespace System.Diagnostics
/// <summary>The name of the test console app.</summary>
protected static readonly string TestConsoleApp = "RemoteExecutorConsoleApp.exe";
/// <summary>The name, without an extension, of the host used to host the test console app.</summary>
- private static readonly string HostRunnerExecutableName = IsFullFramework ? "xunit.console" : "dotnet";
+ private static readonly string HostRunnerExecutableName = IsFullFramework ? "xunit.console" : IsNetNative ? "xunit.console.netcore" : "dotnet";
/// <summary>The name, with an extension, of the host host used to host the test console app.</summary>
protected static readonly string HostRunnerName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? HostRunnerExecutableName + ".exe" : HostRunnerExecutableName;
/// <summary>The absolute path to the host runner executable.</summary>
@@ -132,6 +138,64 @@ namespace System.Diagnostics
return RemoteInvoke(method.GetMethodInfo(), new[] { unparsedArg }, options);
}
+#if uap
+ /// <summary>Invokes the method from this assembly in another process using the specified arguments.</summary>
+ /// <param name="method">The method to invoke.</param>
+ /// <param name="args">The arguments to pass to the method.</param>
+ /// <param name="start">true if this function should Start the Process; false if that responsibility is left up to the caller.</param>
+ /// <param name="psi">The ProcessStartInfo to use, or null for a default.</param>
+ private static RemoteInvokeHandle RemoteInvoke(MethodInfo method, string[] args, RemoteInvokeOptions options)
+ {
+ options = options ?? new RemoteInvokeOptions();
+
+ // Verify the specified method is and that it returns an int (the exit code),
+ // and that if it accepts any arguments, they're all strings.
+ Assert.True(method.ReturnType == typeof(int) || method.ReturnType == typeof(Task<int>));
+ Assert.All(method.GetParameters(), pi => Assert.Equal(typeof(string), pi.ParameterType));
+
+ // And make sure it's in this assembly. This isn't critical, but it helps with deployment to know
+ // that the method to invoke is available because we're already running in this assembly.
+ Type t = method.DeclaringType;
+ Assembly a = t.GetTypeInfo().Assembly;
+ Assert.Equal(typeof(RemoteExecutorTestBase).GetTypeInfo().Assembly, a);
+
+ using (AppServiceConnection remoteExecutionService = new AppServiceConnection())
+ {
+ // Here, we use the app service name defined in the app service provider's Package.appxmanifest file in the <Extension> section.
+ remoteExecutionService.AppServiceName = "com.microsoft.corefxuaptests";
+ remoteExecutionService.PackageFamilyName = Package.Current.Id.FamilyName;
+
+ AppServiceConnectionStatus status = remoteExecutionService.OpenAsync().GetAwaiter().GetResult();
+ if (status != AppServiceConnectionStatus.Success)
+ {
+ throw new IOException($"RemoteInvoke cannot open the remote service. Open Service Status: {status}");
+ }
+
+ ValueSet message = new ValueSet();
+
+ message.Add("AssemblyName", a.FullName);
+ message.Add("TypeName", t.FullName);
+ message.Add("MethodName", method.Name);
+
+ int i = 0;
+ foreach (string arg in args)
+ {
+ message.Add("Arg" + i, arg);
+ i++;
+ }
+
+ AppServiceResponse response = remoteExecutionService.SendMessageAsync(message).GetAwaiter().GetResult();
+
+ Assert.True(response.Status == AppServiceResponseStatus.Success, $"response.Status = {response.Status}");
+ int res = (int) response.Message["Results"];
+ Assert.True(res == SuccessExitCode, (string) response.Message["Log"] + Environment.NewLine + $"Returned Error code: {res}");
+ }
+
+ // RemoteInvokeHandle is not really needed in the UAP scenario but we use it just to have consistent interface as non UAP
+ return new RemoteInvokeHandle(null, options);
+ }
+#else
+
/// <summary>Invokes the method from this assembly in another process using the specified arguments.</summary>
/// <param name="method">The method to invoke.</param>
/// <param name="args">The arguments to pass to the method.</param>
@@ -190,6 +254,7 @@ namespace System.Diagnostics
Process.Start(psi) :
new Process() { StartInfo = psi }, options);
}
+#endif
/// <summary>A cleanup handle to the Process created for the remote invocation.</summary>
internal sealed class RemoteInvokeHandle : IDisposable
diff --git a/src/Common/tests/System/PlatformDetection.cs b/src/Common/tests/System/PlatformDetection.cs
index c60124bf4a..09c3082f57 100644
--- a/src/Common/tests/System/PlatformDetection.cs
+++ b/src/Common/tests/System/PlatformDetection.cs
@@ -66,25 +66,34 @@ namespace System
return runningVersion != null && runningVersion >= net470;
}
+ public static bool IsNetfxBelow471()
+ {
+ if (!IsFullFramework)
+ {
+ return false;
+ }
+
+ Version net471 = new Version(4, 7, 1);
+ Version runningVersion = GetFrameworkVersion();
+ return runningVersion != null && runningVersion < net471;
+ }
+
public static Version GetFrameworkVersion()
{
string[] descriptionArray = RuntimeInformation.FrameworkDescription.Split(' ');
if (descriptionArray.Length < 3)
- {
return null;
- }
-
- string runningVersion = descriptionArray[2];
- // we could get a version with build number > 1 e.g 4.6.1375 but we only want to have 4.6.1
- // so that we get the actual Framework Version
- if (runningVersion.Length > 5)
+ if (!Version.TryParse(descriptionArray[2], out Version actualVersion))
+ return null;
+
+ foreach (Range currentRange in FrameworkRanges)
{
- runningVersion = runningVersion.Substring(0, 5);
+ if (currentRange.IsInRange(actualVersion))
+ return currentRange.FrameworkVersion;
}
- Version result;
- return Version.TryParse(runningVersion, out result) ? result : null;
+ return null;
}
private static int s_isWinRT = -1;
@@ -396,5 +405,33 @@ namespace System
// System.Security.Cryptography.Xml.XmlDsigXsltTransform.GetOutput() relies on XslCompiledTransform which relies
// heavily on Reflection.Emit
public static bool IsXmlDsigXsltTransformSupported => PlatformDetection.IsReflectionEmitSupported;
+
+ public static Range[] FrameworkRanges => new Range[]{
+ new Range(new Version(4, 7, 2500, 0), null, new Version(4, 7, 1)),
+ new Range(new Version(4, 6, 2000, 0), new Version(4, 7, 2090, 0), new Version(4, 7, 0)),
+ new Range(new Version(4, 6, 1500, 0), new Version(4, 6, 1999, 0), new Version(4, 6, 2)),
+ new Range(new Version(4, 6, 1000, 0), new Version(4, 6, 1499, 0), new Version(4, 6, 1)),
+ new Range(new Version(4, 6, 55, 0), new Version(4, 6, 999, 0), new Version(4, 6, 0)),
+ new Range(new Version(4, 0, 30319, 0), new Version(4, 0, 52313, 36313), new Version(4, 5, 2))
+ };
+
+ public class Range
+ {
+ public Version Start { get; private set; }
+ public Version Finish { get; private set; }
+ public Version FrameworkVersion { get; private set; }
+
+ public Range(Version start, Version finish, Version frameworkVersion)
+ {
+ Start = start;
+ Finish = finish;
+ FrameworkVersion = frameworkVersion;
+ }
+
+ public bool IsInRange(Version version)
+ {
+ return version >= Start && (Finish == null || version <= Finish);
+ }
+ }
}
}
diff --git a/src/Common/tests/System/Reflection/MockParameterInfo.cs b/src/Common/tests/System/Reflection/MockParameterInfo.cs
new file mode 100644
index 0000000000..3eadad2213
--- /dev/null
+++ b/src/Common/tests/System/Reflection/MockParameterInfo.cs
@@ -0,0 +1,33 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Collections.Generic;
+
+namespace System.Reflection
+{
+ internal abstract class MockParameterInfo : ParameterInfo
+ {
+ public override ParameterAttributes Attributes => throw Unexpected;
+ public override IEnumerable<CustomAttributeData> CustomAttributes => throw Unexpected;
+ public override object DefaultValue => throw Unexpected;
+ public override bool Equals(object obj) => throw Unexpected;
+ public override object[] GetCustomAttributes(bool inherit) => throw Unexpected;
+ public override object[] GetCustomAttributes(Type attributeType, bool inherit) => throw Unexpected;
+ public override IList<CustomAttributeData> GetCustomAttributesData() => throw Unexpected;
+ public override int GetHashCode() => throw Unexpected;
+ public override Type[] GetOptionalCustomModifiers() => throw Unexpected;
+ public override Type[] GetRequiredCustomModifiers() => throw Unexpected;
+ public override bool HasDefaultValue => throw Unexpected;
+ public override bool IsDefined(Type attributeType, bool inherit) => throw Unexpected;
+ public override MemberInfo Member => throw Unexpected;
+ public override int MetadataToken => throw Unexpected;
+ public override string Name => throw Unexpected;
+ public override Type ParameterType => throw Unexpected;
+ public override int Position => throw Unexpected;
+ public override object RawDefaultValue => throw Unexpected;
+ public override string ToString() => throw Unexpected;
+
+ protected virtual Exception Unexpected => new Exception("Did not expect to be called.");
+ }
+}
diff --git a/src/Native/Unix/System.Native/pal_io.cpp b/src/Native/Unix/System.Native/pal_io.cpp
index b05d44ae9f..5072446b58 100644
--- a/src/Native/Unix/System.Native/pal_io.cpp
+++ b/src/Native/Unix/System.Native/pal_io.cpp
@@ -264,7 +264,7 @@ extern "C" int32_t SystemNative_Close(intptr_t fd)
extern "C" intptr_t SystemNative_Dup(intptr_t oldfd)
{
int result;
- while (CheckInterrupted(result = dup(ToFileDescriptor(oldfd))));
+ while (CheckInterrupted(result = fcntl(ToFileDescriptor(oldfd), F_DUPFD_CLOEXEC, 0)));
return result;
}
diff --git a/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain.cpp b/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain.cpp
index 4c7fd927ca..0a2d18832a 100644
--- a/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain.cpp
+++ b/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain.cpp
@@ -67,6 +67,15 @@ extern "C" int32_t AppleCryptoNative_SecKeychainOpen(const char* pszKeychainPath
return SecKeychainOpen(pszKeychainPath, pKeychainOut);
}
+extern "C" int32_t AppleCryptoNative_SetKeychainNeverLock(SecKeychainRef keychain)
+{
+ SecKeychainSettings settings = {
+ .version = SEC_KEYCHAIN_SETTINGS_VERS1, .useLockInterval = 0, .lockOnSleep = 0, .lockInterval = INT_MAX,
+ };
+
+ return SecKeychainSetSettings(keychain, &settings);
+}
+
static int32_t
EnumerateKeychain(SecKeychainRef keychain, CFStringRef matchType, CFArrayRef* pCertsOut, int32_t* pOSStatus)
{
diff --git a/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain.h b/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain.h
index ef3fe27e50..6a00dd6e66 100644
--- a/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain.h
+++ b/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain.h
@@ -61,6 +61,13 @@ pKeychainOut: Receives the SecKeychainRef for the named keychain.
extern "C" int32_t AppleCryptoNative_SecKeychainOpen(const char* pszKeychainPath, SecKeychainRef* pKeychainOut);
/*
+Set a keychain to never (automatically) lock.
+
+Returns the result of SecKeychainSetSettings to a never-auto-lock policy.
+*/
+extern "C" int32_t AppleCryptoNative_SetKeychainNeverLock(SecKeychainRef keychain);
+
+/*
Enumerate the certificate objects within the given keychain.
Returns 1 on success (including "no certs found"), 0 on failure, any other value for invalid state.
diff --git a/src/System.Buffers/tests/ArrayPool/UnitTests.cs b/src/System.Buffers/tests/ArrayPool/UnitTests.cs
index 72a9e9f203..2f3644fa4c 100644
--- a/src/System.Buffers/tests/ArrayPool/UnitTests.cs
+++ b/src/System.Buffers/tests/ArrayPool/UnitTests.cs
@@ -414,6 +414,7 @@ namespace System.Buffers.ArrayPool.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20511", TargetFrameworkMonikers.UapAot)]
public static void RentBufferFiresRentedDiagnosticEvent()
{
ArrayPool<byte> pool = ArrayPool<byte>.Create(maxArrayLength: 16, maxArraysPerBucket: 1);
@@ -431,6 +432,7 @@ namespace System.Buffers.ArrayPool.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20511", TargetFrameworkMonikers.UapAot)]
public static void ReturnBufferFiresDiagnosticEvent()
{
ArrayPool<byte> pool = ArrayPool<byte>.Create(maxArrayLength: 16, maxArraysPerBucket: 1);
@@ -445,6 +447,7 @@ namespace System.Buffers.ArrayPool.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20511", TargetFrameworkMonikers.UapAot)]
public static void RentingNonExistentBufferFiresAllocatedDiagnosticEvent()
{
ArrayPool<byte> pool = ArrayPool<byte>.Create(maxArrayLength: 16, maxArraysPerBucket: 1);
@@ -452,6 +455,7 @@ namespace System.Buffers.ArrayPool.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20511", TargetFrameworkMonikers.UapAot)]
public static void RentingBufferOverConfiguredMaximumSizeFiresDiagnosticEvent()
{
ArrayPool<byte> pool = ArrayPool<byte>.Create(maxArrayLength: 16, maxArraysPerBucket: 1);
@@ -459,6 +463,7 @@ namespace System.Buffers.ArrayPool.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20511", TargetFrameworkMonikers.UapAot)]
public static void RentingManyBuffersFiresExpectedDiagnosticEvents()
{
ArrayPool<byte> pool = ArrayPool<byte>.Create(maxArrayLength: 16, maxArraysPerBucket: 10);
diff --git a/src/System.Collections.Concurrent/tests/ProducerConsumerCollectionTests.cs b/src/System.Collections.Concurrent/tests/ProducerConsumerCollectionTests.cs
index 9e95c4d499..8448cbc71d 100644
--- a/src/System.Collections.Concurrent/tests/ProducerConsumerCollectionTests.cs
+++ b/src/System.Collections.Concurrent/tests/ProducerConsumerCollectionTests.cs
@@ -879,6 +879,7 @@ namespace System.Collections.Concurrent.Tests
[Theory]
[InlineData(ConcurrencyTestSeconds)]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20474", TargetFrameworkMonikers.UapAot)]
public void ManyConcurrentAddsTakes_ForceContentionWithToArray(double seconds)
{
IProducerConsumerCollection<int> c = CreateProducerConsumerCollection();
diff --git a/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedSet_1.Builder.DebuggerProxy.cs b/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedSet_1.Builder.DebuggerProxy.cs
index 2955c7c70b..f27de5d4fe 100644
--- a/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedSet_1.Builder.DebuggerProxy.cs
+++ b/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedSet_1.Builder.DebuggerProxy.cs
@@ -15,12 +15,7 @@ namespace System.Collections.Immutable
/// The collection to be enumerated.
/// </summary>
private readonly ImmutableSortedSet<T>.Builder _set;
-
- /// <summary>
- /// The simple view of the collection.
- /// </summary>
- private T[] _contents;
-
+
/// <summary>
/// Initializes a new instance of the <see cref="ImmutableSortedSetBuilderDebuggerProxy{T}"/> class.
/// </summary>
@@ -39,12 +34,7 @@ namespace System.Collections.Immutable
{
get
{
- if (_contents == null)
- {
- _contents = _set.ToArray(_set.Count);
- }
-
- return _contents;
+ return _set.ToArray(_set.Count); ;
}
}
}
diff --git a/src/System.Collections.Immutable/tests/ImmutableSortedSetBuilderDebuggerProxyTest.cs b/src/System.Collections.Immutable/tests/ImmutableSortedSetBuilderDebuggerProxyTest.cs
new file mode 100644
index 0000000000..3e7bae0e51
--- /dev/null
+++ b/src/System.Collections.Immutable/tests/ImmutableSortedSetBuilderDebuggerProxyTest.cs
@@ -0,0 +1,25 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using Xunit;
+
+namespace System.Collections.Immutable.Tests
+{
+ public class ImmutableSortedSetBuilderDebuggerProxyTest : ImmutablesTestBase
+ {
+ [Fact]
+ public void DoesNotCacheContents()
+ {
+ var set = ImmutableSortedSet<int>.Empty.Add(1);
+ var builder = set.ToBuilder();
+ var debuggerProxy = new ImmutableSortedSetBuilderDebuggerProxy<int>(builder);
+ var contents = debuggerProxy.Contents; // view the contents to trigger caching
+ builder.Add(2);
+ Assert.Equal(builder.ToArray(), debuggerProxy.Contents);
+ }
+ }
+}
diff --git a/src/System.Collections.Immutable/tests/Resources/System.Collections.Immutable.Tests.rd.xml b/src/System.Collections.Immutable/tests/Resources/System.Collections.Immutable.Tests.rd.xml
new file mode 100644
index 0000000000..dc9d30240b
--- /dev/null
+++ b/src/System.Collections.Immutable/tests/Resources/System.Collections.Immutable.Tests.rd.xml
@@ -0,0 +1,7 @@
+<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
+ <Library>
+ <!-- Needed because of objects in [Theory] data which causes xunit to reflect on its ToString() -->
+ <Type Name="System.Collections.Generic.ComparisonComparer&lt;T&gt;" Dynamic="Required Public" />
+ </Library>
+</Directives>
+
diff --git a/src/System.Collections.Immutable/tests/System.Collections.Immutable.Tests.csproj b/src/System.Collections.Immutable/tests/System.Collections.Immutable.Tests.csproj
index bfdf5be989..e2d0f2e511 100644
--- a/src/System.Collections.Immutable/tests/System.Collections.Immutable.Tests.csproj
+++ b/src/System.Collections.Immutable/tests/System.Collections.Immutable.Tests.csproj
@@ -39,6 +39,7 @@
<Compile Include="ImmutableSetTest.cs" />
<Compile Include="ImmutableSortedDictionaryBuilderTest.cs" />
<Compile Include="ImmutableSortedDictionaryTest.cs" />
+ <Compile Include="ImmutableSortedSetBuilderDebuggerProxyTest.cs" />
<Compile Include="ImmutableSortedSetBuilderTest.cs" />
<Compile Include="ImmutableSortedSetTest.cs" />
<Compile Include="ImmutableStackTest.cs" />
@@ -121,5 +122,8 @@
<TargetingPackExclusions Include="System.Collections.Immutable" />
<ReferenceFromRuntime Include="System.Collections.Immutable" />
</ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Resources\$(AssemblyName).rd.xml" />
+ </ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
+</Project> \ No newline at end of file
diff --git a/src/System.Collections.Specialized/src/System/Collections/Specialized/ListDictionary.cs b/src/System.Collections.Specialized/src/System/Collections/Specialized/ListDictionary.cs
index f7770e6eff..1f8e53e831 100644
--- a/src/System.Collections.Specialized/src/System/Collections/Specialized/ListDictionary.cs
+++ b/src/System.Collections.Specialized/src/System/Collections/Specialized/ListDictionary.cs
@@ -14,10 +14,10 @@ namespace System.Collections.Specialized
[Serializable]
public class ListDictionary : IDictionary
{
- private DictionaryNode _head;
- private int _version;
- private int _count;
- private readonly IComparer _comparer;
+ private DictionaryNode head; // Do not rename (binary serialization)
+ private int version; // Do not rename (binary serialization)
+ private int count; // Do not rename (binary serialization)
+ private readonly IComparer comparer; // Do not rename (binary serialization)
[NonSerialized]
private Object _syncRoot;
@@ -27,7 +27,7 @@ namespace System.Collections.Specialized
public ListDictionary(IComparer comparer)
{
- _comparer = comparer;
+ this.comparer = comparer;
}
public object this[object key]
@@ -38,8 +38,8 @@ namespace System.Collections.Specialized
{
throw new ArgumentNullException(nameof(key));
}
- DictionaryNode node = _head;
- if (_comparer == null)
+ DictionaryNode node = head;
+ if (comparer == null)
{
while (node != null)
{
@@ -56,7 +56,7 @@ namespace System.Collections.Specialized
while (node != null)
{
object oldKey = node.key;
- if (_comparer.Compare(oldKey, key) == 0)
+ if (comparer.Compare(oldKey, key) == 0)
{
return node.value;
}
@@ -71,13 +71,13 @@ namespace System.Collections.Specialized
{
throw new ArgumentNullException(nameof(key));
}
- _version++;
+ version++;
DictionaryNode last = null;
DictionaryNode node;
- for (node = _head; node != null; node = node.next)
+ for (node = head; node != null; node = node.next)
{
object oldKey = node.key;
- if ((_comparer == null) ? oldKey.Equals(key) : _comparer.Compare(oldKey, key) == 0)
+ if ((comparer == null) ? oldKey.Equals(key) : comparer.Compare(oldKey, key) == 0)
{
break;
}
@@ -99,9 +99,9 @@ namespace System.Collections.Specialized
}
else
{
- _head = newNode;
+ head = newNode;
}
- _count++;
+ count++;
}
}
@@ -109,7 +109,7 @@ namespace System.Collections.Specialized
{
get
{
- return _count;
+ return count;
}
}
@@ -171,13 +171,13 @@ namespace System.Collections.Specialized
{
throw new ArgumentNullException(nameof(key));
}
- _version++;
+ version++;
DictionaryNode last = null;
DictionaryNode node;
- for (node = _head; node != null; node = node.next)
+ for (node = head; node != null; node = node.next)
{
object oldKey = node.key;
- if ((_comparer == null) ? oldKey.Equals(key) : _comparer.Compare(oldKey, key) == 0)
+ if ((comparer == null) ? oldKey.Equals(key) : comparer.Compare(oldKey, key) == 0)
{
throw new ArgumentException(SR.Format(SR.Argument_AddingDuplicate, key));
}
@@ -193,16 +193,16 @@ namespace System.Collections.Specialized
}
else
{
- _head = newNode;
+ head = newNode;
}
- _count++;
+ count++;
}
public void Clear()
{
- _count = 0;
- _head = null;
- _version++;
+ count = 0;
+ head = null;
+ version++;
}
public bool Contains(object key)
@@ -211,10 +211,10 @@ namespace System.Collections.Specialized
{
throw new ArgumentNullException(nameof(key));
}
- for (DictionaryNode node = _head; node != null; node = node.next)
+ for (DictionaryNode node = head; node != null; node = node.next)
{
object oldKey = node.key;
- if ((_comparer == null) ? oldKey.Equals(key) : _comparer.Compare(oldKey, key) == 0)
+ if ((comparer == null) ? oldKey.Equals(key) : comparer.Compare(oldKey, key) == 0)
{
return true;
}
@@ -229,10 +229,10 @@ namespace System.Collections.Specialized
if (index < 0)
throw new ArgumentOutOfRangeException(nameof(index), index, SR.ArgumentOutOfRange_NeedNonNegNum);
- if (array.Length - index < _count)
+ if (array.Length - index < count)
throw new ArgumentException(SR.Arg_InsufficientSpace);
- for (DictionaryNode node = _head; node != null; node = node.next)
+ for (DictionaryNode node = head; node != null; node = node.next)
{
array.SetValue(new DictionaryEntry(node.key, node.value), index);
index++;
@@ -255,13 +255,13 @@ namespace System.Collections.Specialized
{
throw new ArgumentNullException(nameof(key));
}
- _version++;
+ version++;
DictionaryNode last = null;
DictionaryNode node;
- for (node = _head; node != null; node = node.next)
+ for (node = head; node != null; node = node.next)
{
object oldKey = node.key;
- if ((_comparer == null) ? oldKey.Equals(key) : _comparer.Compare(oldKey, key) == 0)
+ if ((comparer == null) ? oldKey.Equals(key) : comparer.Compare(oldKey, key) == 0)
{
break;
}
@@ -271,15 +271,15 @@ namespace System.Collections.Specialized
{
return;
}
- if (node == _head)
+ if (node == head)
{
- _head = node.next;
+ head = node.next;
}
else
{
last.next = node.next;
}
- _count--;
+ count--;
}
private class NodeEnumerator : IDictionaryEnumerator
@@ -293,7 +293,7 @@ namespace System.Collections.Specialized
public NodeEnumerator(ListDictionary list)
{
_list = list;
- _version = list._version;
+ _version = list.version;
_start = true;
_current = null;
}
@@ -344,13 +344,13 @@ namespace System.Collections.Specialized
public bool MoveNext()
{
- if (_version != _list._version)
+ if (_version != _list.version)
{
throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion);
}
if (_start)
{
- _current = _list._head;
+ _current = _list.head;
_start = false;
}
else if (_current != null)
@@ -362,7 +362,7 @@ namespace System.Collections.Specialized
public void Reset()
{
- if (_version != _list._version)
+ if (_version != _list.version)
{
throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion);
}
@@ -390,7 +390,7 @@ namespace System.Collections.Specialized
if (index < 0)
throw new ArgumentOutOfRangeException(nameof(index), index, SR.ArgumentOutOfRange_NeedNonNegNum);
- for (DictionaryNode node = _list._head; node != null; node = node.next)
+ for (DictionaryNode node = _list.head; node != null; node = node.next)
{
array.SetValue(_isKeys ? node.key : node.value, index);
index++;
@@ -402,7 +402,7 @@ namespace System.Collections.Specialized
get
{
int count = 0;
- for (DictionaryNode node = _list._head; node != null; node = node.next)
+ for (DictionaryNode node = _list.head; node != null; node = node.next)
{
count++;
}
@@ -444,7 +444,7 @@ namespace System.Collections.Specialized
{
_list = list;
_isKeys = isKeys;
- _version = list._version;
+ _version = list.version;
_start = true;
_current = null;
}
@@ -463,13 +463,13 @@ namespace System.Collections.Specialized
public bool MoveNext()
{
- if (_version != _list._version)
+ if (_version != _list.version)
{
throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion);
}
if (_start)
{
- _current = _list._head;
+ _current = _list.head;
_start = false;
}
else if (_current != null)
@@ -481,7 +481,7 @@ namespace System.Collections.Specialized
public void Reset()
{
- if (_version != _list._version)
+ if (_version != _list.version)
{
throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion);
}
diff --git a/src/System.Collections.Specialized/src/System/Collections/Specialized/StringCollection.cs b/src/System.Collections.Specialized/src/System/Collections/Specialized/StringCollection.cs
index 92e4f5f271..d918e66fcb 100644
--- a/src/System.Collections.Specialized/src/System/Collections/Specialized/StringCollection.cs
+++ b/src/System.Collections.Specialized/src/System/Collections/Specialized/StringCollection.cs
@@ -11,7 +11,7 @@ namespace System.Collections.Specialized
[Serializable]
public class StringCollection : IList
{
- private readonly ArrayList _data = new ArrayList();
+ private readonly ArrayList data = new ArrayList(); // Do not rename (binary serialization)
/// <devdoc>
/// <para>Represents the entry at the specified index of the <see cref='System.Collections.Specialized.StringCollection'/>.</para>
@@ -20,11 +20,11 @@ namespace System.Collections.Specialized
{
get
{
- return ((string)_data[index]);
+ return ((string)data[index]);
}
set
{
- _data[index] = value;
+ data[index] = value;
}
}
@@ -36,7 +36,7 @@ namespace System.Collections.Specialized
{
get
{
- return _data.Count;
+ return data.Count;
}
}
@@ -63,7 +63,7 @@ namespace System.Collections.Specialized
/// </devdoc>
public int Add(string value)
{
- return _data.Add(value);
+ return data.Add(value);
}
/// <devdoc>
@@ -75,7 +75,7 @@ namespace System.Collections.Specialized
{
throw new ArgumentNullException(nameof(value));
}
- _data.AddRange(value);
+ data.AddRange(value);
}
/// <devdoc>
@@ -84,7 +84,7 @@ namespace System.Collections.Specialized
/// </devdoc>
public void Clear()
{
- _data.Clear();
+ data.Clear();
}
/// <devdoc>
@@ -94,7 +94,7 @@ namespace System.Collections.Specialized
/// </devdoc>
public bool Contains(string value)
{
- return _data.Contains(value);
+ return data.Contains(value);
}
/// <devdoc>
@@ -103,7 +103,7 @@ namespace System.Collections.Specialized
/// </devdoc>
public void CopyTo(string[] array, int index)
{
- _data.CopyTo(array, index);
+ data.CopyTo(array, index);
}
/// <devdoc>
@@ -121,7 +121,7 @@ namespace System.Collections.Specialized
/// </devdoc>
public int IndexOf(string value)
{
- return _data.IndexOf(value);
+ return data.IndexOf(value);
}
/// <devdoc>
@@ -130,7 +130,7 @@ namespace System.Collections.Specialized
/// </devdoc>
public void Insert(int index, string value)
{
- _data.Insert(index, value);
+ data.Insert(index, value);
}
/// <devdoc>
@@ -163,7 +163,7 @@ namespace System.Collections.Specialized
/// </devdoc>
public void Remove(string value)
{
- _data.Remove(value);
+ data.Remove(value);
}
/// <devdoc>
@@ -171,7 +171,7 @@ namespace System.Collections.Specialized
/// </devdoc>
public void RemoveAt(int index)
{
- _data.RemoveAt(index);
+ data.RemoveAt(index);
}
/// <devdoc>
@@ -181,7 +181,7 @@ namespace System.Collections.Specialized
{
get
{
- return _data.SyncRoot;
+ return data.SyncRoot;
}
}
@@ -225,12 +225,12 @@ namespace System.Collections.Specialized
void ICollection.CopyTo(Array array, int index)
{
- _data.CopyTo(array, index);
+ data.CopyTo(array, index);
}
IEnumerator IEnumerable.GetEnumerator()
{
- return _data.GetEnumerator();
+ return data.GetEnumerator();
}
}
diff --git a/src/System.Collections/src/System/Collections/Generic/SortedList.cs b/src/System.Collections/src/System/Collections/Generic/SortedList.cs
index e59f792612..817a9c871e 100644
--- a/src/System.Collections/src/System/Collections/Generic/SortedList.cs
+++ b/src/System.Collections/src/System/Collections/Generic/SortedList.cs
@@ -53,13 +53,13 @@ namespace System.Collections.Generic
public class SortedList<TKey, TValue> :
IDictionary<TKey, TValue>, IDictionary, IReadOnlyDictionary<TKey, TValue>
{
- private TKey[] _keys;
- private TValue[] _values;
- private int _size;
- private int _version;
- private IComparer<TKey> _comparer;
- private KeyList _keyList;
- private ValueList _valueList;
+ private TKey[] keys; // Do not rename (binary serialization)
+ private TValue[] values; // Do not rename (binary serialization)
+ private int _size; // Do not rename (binary serialization)
+ private int version; // Do not rename (binary serialization)
+ private IComparer<TKey> comparer; // Do not rename (binary serialization)
+ private KeyList keyList; // Do not rename (binary serialization)
+ private ValueList valueList; // Do not rename (binary serialization)
[NonSerialized]
private object _syncRoot;
@@ -73,10 +73,10 @@ namespace System.Collections.Generic
// all entries added to the sorted list.
public SortedList()
{
- _keys = Array.Empty<TKey>();
- _values = Array.Empty<TValue>();
+ keys = Array.Empty<TKey>();
+ values = Array.Empty<TValue>();
_size = 0;
- _comparer = Comparer<TKey>.Default;
+ comparer = Comparer<TKey>.Default;
}
// Constructs a new sorted list. The sorted list is initially empty and has
@@ -90,9 +90,9 @@ namespace System.Collections.Generic
{
if (capacity < 0)
throw new ArgumentOutOfRangeException(nameof(capacity), capacity, SR.ArgumentOutOfRange_NeedNonNegNum);
- _keys = new TKey[capacity];
- _values = new TValue[capacity];
- _comparer = Comparer<TKey>.Default;
+ keys = new TKey[capacity];
+ values = new TValue[capacity];
+ comparer = Comparer<TKey>.Default;
}
// Constructs a new sorted list with a given IComparer
@@ -110,7 +110,7 @@ namespace System.Collections.Generic
{
if (comparer != null)
{
- _comparer = comparer;
+ this.comparer = comparer;
}
}
@@ -157,14 +157,14 @@ namespace System.Collections.Generic
int count = dictionary.Count;
if (count != 0)
{
- TKey[] keys = _keys;
+ TKey[] keys = this.keys;
dictionary.Keys.CopyTo(keys, 0);
- dictionary.Values.CopyTo(_values, 0);
- Debug.Assert(count == _keys.Length);
+ dictionary.Values.CopyTo(values, 0);
+ Debug.Assert(count == this.keys.Length);
if (count > 1)
{
comparer = Comparer; // obtain default if this is null.
- Array.Sort<TKey, TValue>(keys, _values, comparer);
+ Array.Sort<TKey, TValue>(keys, values, comparer);
for (int i = 1; i != keys.Length; ++i)
{
if (comparer.Compare(keys[i - 1], keys[i]) == 0)
@@ -184,7 +184,7 @@ namespace System.Collections.Generic
public void Add(TKey key, TValue value)
{
if (key == null) throw new ArgumentNullException(nameof(key));
- int i = Array.BinarySearch<TKey>(_keys, 0, _size, key, _comparer);
+ int i = Array.BinarySearch<TKey>(keys, 0, _size, key, comparer);
if (i >= 0)
throw new ArgumentException(SR.Format(SR.Argument_AddingDuplicate, key), nameof(key));
Insert(~i, key, value);
@@ -198,7 +198,7 @@ namespace System.Collections.Generic
bool ICollection<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKey, TValue> keyValuePair)
{
int index = IndexOfKey(keyValuePair.Key);
- if (index >= 0 && EqualityComparer<TValue>.Default.Equals(_values[index], keyValuePair.Value))
+ if (index >= 0 && EqualityComparer<TValue>.Default.Equals(values[index], keyValuePair.Value))
{
return true;
}
@@ -208,7 +208,7 @@ namespace System.Collections.Generic
bool ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue> keyValuePair)
{
int index = IndexOfKey(keyValuePair.Key);
- if (index >= 0 && EqualityComparer<TValue>.Default.Equals(_values[index], keyValuePair.Value))
+ if (index >= 0 && EqualityComparer<TValue>.Default.Equals(values[index], keyValuePair.Value))
{
RemoveAt(index);
return true;
@@ -226,11 +226,11 @@ namespace System.Collections.Generic
{
get
{
- return _keys.Length;
+ return keys.Length;
}
set
{
- if (value != _keys.Length)
+ if (value != keys.Length)
{
if (value < _size)
{
@@ -243,16 +243,16 @@ namespace System.Collections.Generic
TValue[] newValues = new TValue[value];
if (_size > 0)
{
- Array.Copy(_keys, 0, newKeys, 0, _size);
- Array.Copy(_values, 0, newValues, 0, _size);
+ Array.Copy(keys, 0, newKeys, 0, _size);
+ Array.Copy(values, 0, newValues, 0, _size);
}
- _keys = newKeys;
- _values = newValues;
+ keys = newKeys;
+ values = newValues;
}
else
{
- _keys = Array.Empty<TKey>();
- _values = Array.Empty<TValue>();
+ keys = Array.Empty<TKey>();
+ values = Array.Empty<TValue>();
}
}
}
@@ -262,7 +262,7 @@ namespace System.Collections.Generic
{
get
{
- return _comparer;
+ return comparer;
}
}
@@ -365,16 +365,16 @@ namespace System.Collections.Generic
private KeyList GetKeyListHelper()
{
- if (_keyList == null)
- _keyList = new KeyList(this);
- return _keyList;
+ if (keyList == null)
+ keyList = new KeyList(this);
+ return keyList;
}
private ValueList GetValueListHelper()
{
- if (_valueList == null)
- _valueList = new ValueList(this);
- return _valueList;
+ if (valueList == null)
+ valueList = new ValueList(this);
+ return valueList;
}
bool ICollection<KeyValuePair<TKey, TValue>>.IsReadOnly
@@ -414,15 +414,15 @@ namespace System.Collections.Generic
public void Clear()
{
// clear does not change the capacity
- _version++;
+ version++;
// Don't need to doc this but we clear the elements so that the gc can reclaim the references.
if (RuntimeHelpers.IsReferenceOrContainsReferences<TKey>())
{
- Array.Clear(_keys, 0, _size);
+ Array.Clear(keys, 0, _size);
}
if (RuntimeHelpers.IsReferenceOrContainsReferences<TValue>())
{
- Array.Clear(_values, 0, _size);
+ Array.Clear(values, 0, _size);
}
_size = 0;
}
@@ -472,7 +472,7 @@ namespace System.Collections.Generic
for (int i = 0; i < Count; i++)
{
- KeyValuePair<TKey, TValue> entry = new KeyValuePair<TKey, TValue>(_keys[i], _values[i]);
+ KeyValuePair<TKey, TValue> entry = new KeyValuePair<TKey, TValue>(keys[i], values[i]);
array[arrayIndex + i] = entry;
}
}
@@ -509,7 +509,7 @@ namespace System.Collections.Generic
{
for (int i = 0; i < Count; i++)
{
- keyValuePairArray[i + index] = new KeyValuePair<TKey, TValue>(_keys[i], _values[i]);
+ keyValuePairArray[i + index] = new KeyValuePair<TKey, TValue>(keys[i], values[i]);
}
}
else
@@ -524,7 +524,7 @@ namespace System.Collections.Generic
{
for (int i = 0; i < Count; i++)
{
- objects[i + index] = new KeyValuePair<TKey, TValue>(_keys[i], _values[i]);
+ objects[i + index] = new KeyValuePair<TKey, TValue>(keys[i], values[i]);
}
}
catch (ArrayTypeMismatchException)
@@ -542,7 +542,7 @@ namespace System.Collections.Generic
// to min, whichever is larger.
private void EnsureCapacity(int min)
{
- int newCapacity = _keys.Length == 0 ? DefaultCapacity : _keys.Length * 2;
+ int newCapacity = keys.Length == 0 ? DefaultCapacity : keys.Length * 2;
// Allow the list to grow to maximum possible capacity (~2G elements) before encountering overflow.
// Note that this check works even when _items.Length overflowed thanks to the (uint) cast
if ((uint)newCapacity > MaxArrayLength) newCapacity = MaxArrayLength;
@@ -555,7 +555,7 @@ namespace System.Collections.Generic
{
if (index < 0 || index >= _size)
throw new ArgumentOutOfRangeException(nameof(index), index, SR.ArgumentOutOfRange_Index);
- return _values[index];
+ return values[index];
}
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
@@ -583,7 +583,7 @@ namespace System.Collections.Generic
{
if (index < 0 || index >= _size)
throw new ArgumentOutOfRangeException(nameof(index), index, SR.ArgumentOutOfRange_Index);
- return _keys[index];
+ return keys[index];
}
// Returns the value associated with the given key. If an entry with the
@@ -594,18 +594,18 @@ namespace System.Collections.Generic
{
int i = IndexOfKey(key);
if (i >= 0)
- return _values[i];
+ return values[i];
throw new KeyNotFoundException();
}
set
{
if (((object)key) == null) throw new ArgumentNullException(nameof(key));
- int i = Array.BinarySearch<TKey>(_keys, 0, _size, key, _comparer);
+ int i = Array.BinarySearch<TKey>(keys, 0, _size, key, comparer);
if (i >= 0)
{
- _values[i] = value;
- _version++;
+ values[i] = value;
+ version++;
return;
}
Insert(~i, key, value);
@@ -621,7 +621,7 @@ namespace System.Collections.Generic
int i = IndexOfKey((TKey)key);
if (i >= 0)
{
- return _values[i];
+ return values[i];
}
}
@@ -659,7 +659,7 @@ namespace System.Collections.Generic
{
if (key == null)
throw new ArgumentNullException(nameof(key));
- int ret = Array.BinarySearch<TKey>(_keys, 0, _size, key, _comparer);
+ int ret = Array.BinarySearch<TKey>(keys, 0, _size, key, comparer);
return ret >= 0 ? ret : -1;
}
@@ -670,22 +670,22 @@ namespace System.Collections.Generic
// given value using the Object.Equals method.
public int IndexOfValue(TValue value)
{
- return Array.IndexOf(_values, value, 0, _size);
+ return Array.IndexOf(values, value, 0, _size);
}
// Inserts an entry with a given key and value at a given index.
private void Insert(int index, TKey key, TValue value)
{
- if (_size == _keys.Length) EnsureCapacity(_size + 1);
+ if (_size == keys.Length) EnsureCapacity(_size + 1);
if (index < _size)
{
- Array.Copy(_keys, index, _keys, index + 1, _size - index);
- Array.Copy(_values, index, _values, index + 1, _size - index);
+ Array.Copy(keys, index, keys, index + 1, _size - index);
+ Array.Copy(values, index, values, index + 1, _size - index);
}
- _keys[index] = key;
- _values[index] = value;
+ keys[index] = key;
+ values[index] = value;
_size++;
- _version++;
+ version++;
}
public bool TryGetValue(TKey key, out TValue value)
@@ -693,7 +693,7 @@ namespace System.Collections.Generic
int i = IndexOfKey(key);
if (i >= 0)
{
- value = _values[i];
+ value = values[i];
return true;
}
@@ -710,18 +710,18 @@ namespace System.Collections.Generic
_size--;
if (index < _size)
{
- Array.Copy(_keys, index + 1, _keys, index, _size - index);
- Array.Copy(_values, index + 1, _values, index, _size - index);
+ Array.Copy(keys, index + 1, keys, index, _size - index);
+ Array.Copy(values, index + 1, values, index, _size - index);
}
if (RuntimeHelpers.IsReferenceOrContainsReferences<TKey>())
{
- _keys[_size] = default(TKey);
+ keys[_size] = default(TKey);
}
if (RuntimeHelpers.IsReferenceOrContainsReferences<TValue>())
{
- _values[_size] = default(TValue);
+ values[_size] = default(TValue);
}
- _version++;
+ version++;
}
// Removes an entry from this sorted list. If an entry with the specified
@@ -753,7 +753,7 @@ namespace System.Collections.Generic
// SortedList.TrimExcess();
public void TrimExcess()
{
- int threshold = (int)(((double)_keys.Length) * 0.9);
+ int threshold = (int)(((double)keys.Length) * 0.9);
if (_size < threshold)
{
Capacity = _size;
@@ -787,7 +787,7 @@ namespace System.Collections.Generic
{
_sortedList = sortedList;
_index = 0;
- _version = _sortedList._version;
+ _version = _sortedList.version;
_getEnumeratorRetType = getEnumeratorRetType;
_key = default(TKey);
_value = default(TValue);
@@ -815,12 +815,12 @@ namespace System.Collections.Generic
public bool MoveNext()
{
- if (_version != _sortedList._version) throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion);
+ if (_version != _sortedList.version) throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion);
if ((uint)_index < (uint)_sortedList.Count)
{
- _key = _sortedList._keys[_index];
- _value = _sortedList._values[_index];
+ _key = _sortedList.keys[_index];
+ _value = _sortedList.values[_index];
_index++;
return true;
}
@@ -887,7 +887,7 @@ namespace System.Collections.Generic
void IEnumerator.Reset()
{
- if (_version != _sortedList._version)
+ if (_version != _sortedList.version)
{
throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion);
}
@@ -909,7 +909,7 @@ namespace System.Collections.Generic
internal SortedListKeyEnumerator(SortedList<TKey, TValue> sortedList)
{
_sortedList = sortedList;
- _version = sortedList._version;
+ _version = sortedList.version;
}
public void Dispose()
@@ -920,14 +920,14 @@ namespace System.Collections.Generic
public bool MoveNext()
{
- if (_version != _sortedList._version)
+ if (_version != _sortedList.version)
{
throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion);
}
if ((uint)_index < (uint)_sortedList.Count)
{
- _currentKey = _sortedList._keys[_index];
+ _currentKey = _sortedList.keys[_index];
_index++;
return true;
}
@@ -960,7 +960,7 @@ namespace System.Collections.Generic
void IEnumerator.Reset()
{
- if (_version != _sortedList._version)
+ if (_version != _sortedList.version)
{
throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion);
}
@@ -980,7 +980,7 @@ namespace System.Collections.Generic
internal SortedListValueEnumerator(SortedList<TKey, TValue> sortedList)
{
_sortedList = sortedList;
- _version = sortedList._version;
+ _version = sortedList.version;
}
public void Dispose()
@@ -991,14 +991,14 @@ namespace System.Collections.Generic
public bool MoveNext()
{
- if (_version != _sortedList._version)
+ if (_version != _sortedList.version)
{
throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion);
}
if ((uint)_index < (uint)_sortedList.Count)
{
- _currentValue = _sortedList._values[_index];
+ _currentValue = _sortedList.values[_index];
_index++;
return true;
}
@@ -1031,7 +1031,7 @@ namespace System.Collections.Generic
void IEnumerator.Reset()
{
- if (_version != _sortedList._version)
+ if (_version != _sortedList.version)
{
throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion);
}
@@ -1090,7 +1090,7 @@ namespace System.Collections.Generic
public void CopyTo(TKey[] array, int arrayIndex)
{
// defer error checking to Array.Copy
- Array.Copy(_dict._keys, 0, array, arrayIndex, _dict.Count);
+ Array.Copy(_dict.keys, 0, array, arrayIndex, _dict.Count);
}
void ICollection.CopyTo(Array array, int arrayIndex)
@@ -1101,7 +1101,7 @@ namespace System.Collections.Generic
try
{
// defer error checking to Array.Copy
- Array.Copy(_dict._keys, 0, array, arrayIndex, _dict.Count);
+ Array.Copy(_dict.keys, 0, array, arrayIndex, _dict.Count);
}
catch (ArrayTypeMismatchException)
{
@@ -1141,8 +1141,8 @@ namespace System.Collections.Generic
if (((object)key) == null)
throw new ArgumentNullException(nameof(key));
- int i = Array.BinarySearch<TKey>(_dict._keys, 0,
- _dict.Count, key, _dict._comparer);
+ int i = Array.BinarySearch<TKey>(_dict.keys, 0,
+ _dict.Count, key, _dict.comparer);
if (i >= 0) return i;
return -1;
}
@@ -1209,7 +1209,7 @@ namespace System.Collections.Generic
public void CopyTo(TValue[] array, int arrayIndex)
{
// defer error checking to Array.Copy
- Array.Copy(_dict._values, 0, array, arrayIndex, _dict.Count);
+ Array.Copy(_dict.values, 0, array, arrayIndex, _dict.Count);
}
void ICollection.CopyTo(Array array, int index)
@@ -1220,7 +1220,7 @@ namespace System.Collections.Generic
try
{
// defer error checking to Array.Copy
- Array.Copy(_dict._values, 0, array, index, _dict.Count);
+ Array.Copy(_dict.values, 0, array, index, _dict.Count);
}
catch (ArrayTypeMismatchException)
{
@@ -1257,7 +1257,7 @@ namespace System.Collections.Generic
public int IndexOf(TValue value)
{
- return Array.IndexOf(_dict._values, value, 0, _dict.Count);
+ return Array.IndexOf(_dict.values, value, 0, _dict.Count);
}
public bool Remove(TValue value)
diff --git a/src/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs b/src/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs
index 457d8ba8ee..aafa55cfcf 100644
--- a/src/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs
+++ b/src/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs
@@ -783,6 +783,7 @@ namespace System.Drawing
public override bool GetPropertiesSupported(System.ComponentModel.ITypeDescriptorContext context) { throw null; }
}
}
+
namespace System.Security.Authentication.ExtendedProtection
{
public partial class ExtendedProtectionPolicyTypeConverter : System.ComponentModel.TypeConverter
diff --git a/src/System.ComponentModel.TypeConverter/src/System.ComponentModel.TypeConverter.csproj b/src/System.ComponentModel.TypeConverter/src/System.ComponentModel.TypeConverter.csproj
index afcdd237df..ce823889ef 100644
--- a/src/System.ComponentModel.TypeConverter/src/System.ComponentModel.TypeConverter.csproj
+++ b/src/System.ComponentModel.TypeConverter/src/System.ComponentModel.TypeConverter.csproj
@@ -5,7 +5,10 @@
<ProjectGuid>{AF3EBF3B-526A-4B51-9F3D-62B0113CD01F}</ProjectGuid>
<RootNamespace>System.ComponentModel.TypeConverter</RootNamespace>
<AssemblyName>System.ComponentModel.TypeConverter</AssemblyName>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
+ <!-- TODO: RE-ENABLE THIS -->
+ <EnablePInvokeAnalyzer>false</EnablePInvokeAnalyzer>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
@@ -45,7 +48,9 @@
<Compile Include="System\ComponentModel\UriTypeConverter.cs" />
<Compile Include="System\Timers\ElapsedEventArgs.cs" />
<Compile Include="System\Timers\ElapsedEventHandler.cs" />
- <Compile Include="System\Timers\Timer.cs" />
+ <Compile Include="System\Timers\Timer.cs">
+ <SubType>Component</SubType>
+ </Compile>
<Compile Include="System\Timers\TimersDescriptionAttribute.cs" />
<Compile Include="System\ComponentModel\AttributeCollection.cs" />
<Compile Include="System\ComponentModel\AttributeProviderAttribute.cs" />
@@ -86,6 +91,9 @@
<Compile Include="System\ComponentModel\Design\IDictionaryService.cs" />
<Compile Include="System\ComponentModel\Design\IExtenderListService.cs" />
<Compile Include="System\ComponentModel\Design\ITypeDescriptorFilterService.cs" />
+ <Compile Include="$(CommonPath)/System/Drawing/ColorConverterCommon.cs">
+ <Link>System\Drawing\ColorConverterCommon.cs</Link>
+ </Compile>
<Compile Include="$(CommonPath)/System/Drawing/ColorTable.cs">
<Link>System\Drawing\ColorTable.cs</Link>
</Compile>
@@ -161,7 +169,9 @@
<Compile Include="System\ComponentModel\Design\ITypeResolutionService.cs" />
<Compile Include="System\ComponentModel\ListBindableAttribute.cs" />
<Compile Include="System\ComponentModel\LookupBindingPropertiesAttribute.cs" />
- <Compile Include="System\ComponentModel\MarshalByValueComponent.cs" />
+ <Compile Include="System\ComponentModel\MarshalByValueComponent.cs">
+ <SubType>Component</SubType>
+ </Compile>
<Compile Include="System\ComponentModel\MaskedTextProvider.cs" />
<Compile Include="System\ComponentModel\MaskedTextResultHint.cs" />
<Compile Include="System\ComponentModel\NestedContainer.cs" />
@@ -269,7 +279,8 @@
<Reference Include="System.Runtime.Serialization.Formatters" />
<Reference Include="System.Text.RegularExpressions" />
<Reference Include="System.Threading" />
+ <Reference Include="System.Threading.Thread" />
<Reference Include="System.Threading.Timer" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
+</Project> \ No newline at end of file
diff --git a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/BindingList.cs b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/BindingList.cs
index 3b2b4737a0..16b545659b 100644
--- a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/BindingList.cs
+++ b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/BindingList.cs
@@ -19,9 +19,9 @@ namespace System.ComponentModel
[Serializable]
public class BindingList<T> : Collection<T>, IBindingList, ICancelAddNew, IRaiseItemChangedEvents
{
- private int _addNewPos = -1;
- private bool _raiseListChangedEvents = true;
- private bool _raiseItemChangedEvents;
+ private int addNewPos = -1; // Do not rename (binary serialization)
+ private bool raiseListChangedEvents = true; // Do not rename (binary serialization)
+ private bool raiseItemChangedEvents; // Do not rename (binary serialization)
[NonSerialized]
private PropertyDescriptorCollection _itemTypeProperties;
@@ -38,10 +38,10 @@ namespace System.ComponentModel
[NonSerialized]
private int _lastChangeIndex = -1;
- private bool _allowNew = true;
- private bool _allowEdit = true;
- private bool _allowRemove = true;
- private bool _userSetAllowNew;
+ private bool allowNew = true; // Do not rename (binary serialization)
+ private bool allowEdit = true; // Do not rename (binary serialization)
+ private bool allowRemove = true; // Do not rename (binary serialization)
+ private bool userSetAllowNew; // Do not rename (binary serialization)
#region Constructors
@@ -64,13 +64,13 @@ namespace System.ComponentModel
private void Initialize()
{
// Set the default value of AllowNew based on whether type T has a default constructor
- _allowNew = ItemTypeHasDefaultConstructor;
+ allowNew = ItemTypeHasDefaultConstructor;
// Check for INotifyPropertyChanged
if (typeof(INotifyPropertyChanged).IsAssignableFrom(typeof(T)))
{
// Supports INotifyPropertyChanged
- _raiseItemChangedEvents = true;
+ raiseItemChangedEvents = true;
// Loop thru the items already in the collection and hook their change notification.
foreach (T item in Items)
@@ -177,14 +177,14 @@ namespace System.ComponentModel
{
get
{
- return _raiseListChangedEvents;
+ return raiseListChangedEvents;
}
set
{
- if (_raiseListChangedEvents != value)
+ if (raiseListChangedEvents != value)
{
- _raiseListChangedEvents = value;
+ raiseListChangedEvents = value;
}
}
}
@@ -206,7 +206,7 @@ namespace System.ComponentModel
// Private helper method
private void FireListChanged(ListChangedType type, int index)
{
- if (_raiseListChangedEvents)
+ if (raiseListChangedEvents)
{
OnListChanged(new ListChangedEventArgs(type, index));
}
@@ -221,9 +221,9 @@ namespace System.ComponentModel
protected override void ClearItems()
{
- EndNew(_addNewPos);
+ EndNew(addNewPos);
- if (_raiseItemChangedEvents)
+ if (raiseItemChangedEvents)
{
foreach (T item in Items)
{
@@ -237,10 +237,10 @@ namespace System.ComponentModel
protected override void InsertItem(int index, T item)
{
- EndNew(_addNewPos);
+ EndNew(addNewPos);
base.InsertItem(index, item);
- if (_raiseItemChangedEvents)
+ if (raiseItemChangedEvents)
{
HookPropertyChanged(item);
}
@@ -251,14 +251,14 @@ namespace System.ComponentModel
protected override void RemoveItem(int index)
{
// Need to all RemoveItem if this on the AddNew item
- if (!_allowRemove && !(_addNewPos >= 0 && _addNewPos == index))
+ if (!allowRemove && !(addNewPos >= 0 && addNewPos == index))
{
throw new NotSupportedException();
}
- EndNew(_addNewPos);
+ EndNew(addNewPos);
- if (_raiseItemChangedEvents)
+ if (raiseItemChangedEvents)
{
UnhookPropertyChanged(this[index]);
}
@@ -269,14 +269,14 @@ namespace System.ComponentModel
protected override void SetItem(int index, T item)
{
- if (_raiseItemChangedEvents)
+ if (raiseItemChangedEvents)
{
UnhookPropertyChanged(this[index]);
}
base.SetItem(index, item);
- if (_raiseItemChangedEvents)
+ if (raiseItemChangedEvents)
{
HookPropertyChanged(item);
}
@@ -293,10 +293,10 @@ namespace System.ComponentModel
/// </summary>
public virtual void CancelNew(int itemIndex)
{
- if (_addNewPos >= 0 && _addNewPos == itemIndex)
+ if (addNewPos >= 0 && addNewPos == itemIndex)
{
- RemoveItem(_addNewPos);
- _addNewPos = -1;
+ RemoveItem(addNewPos);
+ addNewPos = -1;
}
}
@@ -305,9 +305,9 @@ namespace System.ComponentModel
/// </summary>
public virtual void EndNew(int itemIndex)
{
- if (_addNewPos >= 0 && _addNewPos == itemIndex)
+ if (addNewPos >= 0 && addNewPos == itemIndex)
{
- _addNewPos = -1;
+ addNewPos = -1;
}
}
@@ -335,7 +335,7 @@ namespace System.ComponentModel
object newItem = AddNewCore();
// Record position of new item (to support cancellation later on)
- _addNewPos = (newItem != null) ? IndexOf((T)newItem) : -1;
+ addNewPos = (newItem != null) ? IndexOf((T)newItem) : -1;
// Return new item to caller
return newItem;
@@ -379,9 +379,9 @@ namespace System.ComponentModel
{
//If the user set AllowNew, return what they set. If we have a default constructor, allowNew will be
//true and we should just return true.
- if (_userSetAllowNew || _allowNew)
+ if (userSetAllowNew || allowNew)
{
- return _allowNew;
+ return allowNew;
}
//Even if the item doesn't have a default constructor, the user can hook AddingNew to provide an item.
//If there's a handler for this, we should allow new.
@@ -390,10 +390,10 @@ namespace System.ComponentModel
set
{
bool oldAllowNewValue = AllowNew;
- _userSetAllowNew = true;
+ userSetAllowNew = true;
//Note that we don't want to set allowNew only if AllowNew didn't match value,
//since AllowNew can depend on onAddingNew handler
- _allowNew = value;
+ allowNew = value;
if (oldAllowNewValue != value)
{
FireListChanged(ListChangedType.Reset, -1);
@@ -410,13 +410,13 @@ namespace System.ComponentModel
{
get
{
- return _allowEdit;
+ return allowEdit;
}
set
{
- if (_allowEdit != value)
+ if (allowEdit != value)
{
- _allowEdit = value;
+ allowEdit = value;
FireListChanged(ListChangedType.Reset, -1);
}
}
@@ -431,13 +431,13 @@ namespace System.ComponentModel
{
get
{
- return _allowRemove;
+ return allowRemove;
}
set
{
- if (_allowRemove != value)
+ if (allowRemove != value)
{
- _allowRemove = value;
+ allowRemove = value;
FireListChanged(ListChangedType.Reset, -1);
}
}
@@ -615,7 +615,7 @@ namespace System.ComponentModel
/// of type ItemChanged as a result of property changes on individual list items
/// unless those items support INotifyPropertyChanged
/// </summary>
- bool IRaiseItemChangedEvents.RaisesItemChangedEvents => _raiseItemChangedEvents;
+ bool IRaiseItemChangedEvents.RaisesItemChangedEvents => raiseItemChangedEvents;
#endregion
}
diff --git a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/InterlockedBitVector32.cs b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/InterlockedBitVector32.cs
index 299bd6896c..8a881f1b21 100644
--- a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/InterlockedBitVector32.cs
+++ b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/InterlockedBitVector32.cs
@@ -42,8 +42,6 @@ namespace System.ComponentModel
_data = value ? _data | bit : _data & ~bit;
}
- public int Data => _data;
-
public static int CreateMask() => CreateMask(0);
public static int CreateMask(int previous)
diff --git a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseManager.cs b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseManager.cs
index 2a1ab92ed1..c48730f1ab 100644
--- a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseManager.cs
+++ b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseManager.cs
@@ -389,229 +389,5 @@ namespace System.ComponentModel
return lic;
}
-
- // FxCop complaint about uninstantiated internal classes
- // Re-activate if this class proves to be useful.
-
- // This is a helper class that supports the CLR's IClassFactory2 marshaling
- // support.
- //
- // When a managed object is exposed to COM, the CLR invokes
- // AllocateAndValidateLicense() to set up the appropriate
- // license context and instantiate the object.
- //
- // When the CLR consumes an unmanaged COM object, the CLR invokes
- // GetCurrentContextInfo() to figure out the licensing context
- // and decide whether to call ICF::CreateInstance() (designtime) or
- // ICF::CreateInstanceLic() (runtime). In the former case, it also
- // requests the class factory for a runtime license key and invokes
- // SaveKeyInCurrentContext() to stash a copy in the current licensing
- // context
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
- private class LicenseInteropHelper
- {
- // Define some common HRESULTs.
- private const int S_OK = 0;
- private const int E_NOTIMPL = unchecked((int)0x80004001);
- private const int CLASS_E_NOTLICENSED = unchecked((int)0x80040112);
- private const int E_FAIL = unchecked((int)0x80000008);
-
- private DesigntimeLicenseContext _helperContext;
- private LicenseContext _savedLicenseContext;
- private Type _savedType;
-
- // The CLR invokes this whenever a COM client invokes
- // IClassFactory::CreateInstance() or IClassFactory2::CreateInstanceLic()
- // on a managed managed that has a LicenseProvider custom attribute.
- //
- // If we are being entered because of a call to ICF::CreateInstance(),
- // fDesignTime will be "true".
- //
- // If we are being entered because of a call to ICF::CreateInstanceLic(),
- // fDesignTime will be "false" and bstrKey will point a non-null
- // license key.
- private static object AllocateAndValidateLicense(RuntimeTypeHandle rth, IntPtr bstrKey, int fDesignTime)
- {
- Type type = Type.GetTypeFromHandle(rth);
- CLRLicenseContext licensecontext = new CLRLicenseContext(fDesignTime != 0 ? LicenseUsageMode.Designtime : LicenseUsageMode.Runtime, type);
- if (fDesignTime == 0 && bstrKey != (IntPtr)0)
- {
- licensecontext.SetSavedLicenseKey(type, Marshal.PtrToStringBSTR(bstrKey));
- }
-
-
- try
- {
- return LicenseManager.CreateWithContext(type, licensecontext);
- }
- catch (LicenseException lexp)
- {
- throw new COMException(lexp.Message, CLASS_E_NOTLICENSED);
- }
- }
-
- // The CLR invokes this whenever a COM client invokes
- // IClassFactory2::RequestLicKey on a managed class.
- //
- // This method should return the appropriate HRESULT and set pbstrKey
- // to the licensing key.
- private static int RequestLicKey(RuntimeTypeHandle rth, ref IntPtr pbstrKey)
- {
- Type type = Type.GetTypeFromHandle(rth);
- License license;
- string licenseKey;
-
- // license will be null, since we passed no instance,
- // however we can still retrieve the "first" license
- // key from the file. This really will only
- // work for simple COM-compatible license providers
- // like LicFileLicenseProvider that don't require the
- // instance to grant a key.
- //
- if (!LicenseManager.ValidateInternalRecursive(LicenseManager.CurrentContext,
- type,
- null,
- false,
- out license,
- out licenseKey))
- {
- return E_FAIL;
- }
-
- if (licenseKey == null)
- {
- return E_FAIL;
- }
-
- pbstrKey = Marshal.StringToBSTR(licenseKey);
-
- if (license != null)
- {
- license.Dispose();
- license = null;
- }
-
- return S_OK;
- }
-
-
- // The CLR invokes this whenever a COM client invokes
- // IClassFactory2::GetLicInfo on a managed class.
- //
- // COM normally doesn't expect this function to fail so this method
- // should only throw in the case of a catastrophic error (stack, memory, etc.)
- private void GetLicInfo(RuntimeTypeHandle rth, ref int pRuntimeKeyAvail, ref int pLicVerified)
- {
- pRuntimeKeyAvail = 0;
- pLicVerified = 0;
-
- Type type = Type.GetTypeFromHandle(rth);
- License license;
- string licenseKey;
-
- if (_helperContext == null)
- {
- _helperContext = new DesigntimeLicenseContext();
- }
- else
- {
- _helperContext.savedLicenseKeys.Clear();
- }
-
- if (LicenseManager.ValidateInternalRecursive(_helperContext, type, null, false, out license, out licenseKey))
- {
- if (_helperContext.savedLicenseKeys.Contains(type.AssemblyQualifiedName))
- {
- pRuntimeKeyAvail = 1;
- }
-
- if (license != null)
- {
- license.Dispose();
- license = null;
-
- pLicVerified = 1;
- }
- }
- }
-
- // The CLR invokes this when instantiating an unmanaged COM
- // object. The purpose is to decide which classfactory method to
- // use.
- //
- // If the current context is design time, the CLR will
- // use ICF::CreateInstance().
- //
- // If the current context is runtime and the current context
- // exposes a non-null license key and the COM object supports
- // IClassFactory2, the CLR will use ICF2::CreateInstanceLic().
- // Otherwise, the CLR will use ICF::CreateInstance.
- //
- // Arguments:
- // ref int fDesignTime: on exit, this will be set to indicate
- // the nature of the current license context.
- // ref int bstrKey: on exit, this will point to the
- // licensekey saved inside the license context.
- // (only if the license context is runtime)
- // RuntimeTypeHandle rth: the managed type of the wrapper
- private void GetCurrentContextInfo(ref int fDesignTime, ref IntPtr bstrKey, RuntimeTypeHandle rth)
- {
- _savedLicenseContext = LicenseManager.CurrentContext;
- _savedType = Type.GetTypeFromHandle(rth);
- if (_savedLicenseContext.UsageMode == LicenseUsageMode.Designtime)
- {
- fDesignTime = 1;
- bstrKey = (IntPtr)0;
- }
- else
- {
- fDesignTime = 0;
- String key = _savedLicenseContext.GetSavedLicenseKey(_savedType, null);
- bstrKey = Marshal.StringToBSTR(key);
- }
- }
-
- // The CLR invokes this when instantiating a licensed COM
- // object inside a designtime license context.
- // It's purpose is to save away the license key that the CLR
- // retrieved using RequestLicKey(). This license key can be NULL.
- private void SaveKeyInCurrentContext(IntPtr bstrKey)
- {
- if (bstrKey != (IntPtr)0)
- {
- _savedLicenseContext.SetSavedLicenseKey(_savedType, Marshal.PtrToStringBSTR(bstrKey));
- }
- }
-
- // A private implementation of a LicenseContext used for instantiating
- // managed objects exposed to COM. It has memory for the license key
- // of a single Type.
- internal class CLRLicenseContext : LicenseContext
- {
- private Type _type;
- private string _key;
-
- public CLRLicenseContext(LicenseUsageMode usageMode, Type type)
- {
- UsageMode = usageMode;
- _type = type;
- }
-
- public override LicenseUsageMode UsageMode { get; }
-
-
- public override string GetSavedLicenseKey(Type type, Assembly resourceAssembly)
- {
- return type == _type ? _key : null;
- }
- public override void SetSavedLicenseKey(Type type, string key)
- {
- if (type == _type)
- {
- _key = key;
- }
- }
- }
- }
}
}
diff --git a/src/System.ComponentModel.TypeConverter/src/System/Drawing/ColorConverter.cs b/src/System.ComponentModel.TypeConverter/src/System/Drawing/ColorConverter.cs
index 26266840df..b9ca22d4d7 100644
--- a/src/System.ComponentModel.TypeConverter/src/System/Drawing/ColorConverter.cs
+++ b/src/System.ComponentModel.TypeConverter/src/System/Drawing/ColorConverter.cs
@@ -53,104 +53,11 @@ namespace System.Drawing
string strValue = value as string;
if (strValue != null)
{
- string text = strValue.Trim();
-
- if (text.Length == 0)
- {
- return Color.Empty;
- }
-
- {
- Color c;
- // First, check to see if this is a standard name.
- //
- if (ColorTable.TryGetNamedColor(text, out c))
- {
- return c;
- }
- }
-
- if (culture == null)
- {
- culture = CultureInfo.CurrentCulture;
- }
-
- char sep = culture.TextInfo.ListSeparator[0];
-
- TypeConverter intConverter = TypeDescriptor.GetConverter(typeof(int));
-
- // If the value is a 6 digit hex number only, then
- // we want to treat the Alpha as 255, not 0
- //
- if (text.IndexOf(sep) == -1)
- {
- // text can be '' (empty quoted string)
- if (text.Length >= 2 && (text[0] == '\'' || text[0] == '"') && text[0] == text[text.Length - 1])
- {
- // In quotes means a named value
- string colorName = text.Substring(1, text.Length - 2);
- return Color.FromName(colorName);
- }
- else if ((text.Length == 7 && text[0] == '#') ||
- (text.Length == 8 && (text.StartsWith("0x") || text.StartsWith("0X"))) ||
- (text.Length == 8 && (text.StartsWith("&h") || text.StartsWith("&H"))))
- {
- // Note: ConvertFromString will raise exception if value cannot be converted.
- return PossibleKnownColor(Color.FromArgb(unchecked((int)(0xFF000000 | (uint)(int)intConverter.ConvertFromString(context, culture, text)))));
- }
- }
-
- // Nope. Parse the RGBA from the text.
- //
- string[] tokens = text.Split(sep);
- int[] values = new int[tokens.Length];
- for (int i = 0; i < values.Length; i++)
- {
- values[i] = unchecked((int)intConverter.ConvertFromString(context, culture, tokens[i]));
- }
-
- // We should now have a number of parsed integer values.
- // We support 1, 3, or 4 arguments:
- //
- // 1 -- full ARGB encoded
- // 3 -- RGB
- // 4 -- ARGB
- //
- switch (values.Length)
- {
- case 1:
- return PossibleKnownColor(Color.FromArgb(values[0]));
-
- case 3:
- return PossibleKnownColor(Color.FromArgb(values[0], values[1], values[2]));
-
- case 4:
- return PossibleKnownColor(Color.FromArgb(values[0], values[1], values[2], values[3]));
- }
-
- throw new ArgumentException(SR.Format(SR.InvalidColor, text));
+ return ColorConverterCommon.ConvertFromString(strValue, culture);
}
return base.ConvertFrom(context, culture, value);
}
- private Color PossibleKnownColor(Color color)
- {
- // Now check to see if this color matches one of our known colors.
- // If it does, then substitute it. We can only do this for "Colors"
- // because system colors morph with user settings.
- //
- int targetARGB = color.ToArgb();
-
- foreach (Color c in ColorTable.Colors.Values)
- {
- if (c.ToArgb() == targetARGB)
- {
- return c;
- }
- }
- return color;
- }
-
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if (destinationType == null)
diff --git a/src/System.ComponentModel.TypeConverter/src/System/misc.cs b/src/System.ComponentModel.TypeConverter/src/System/misc.cs
index 598723f1ee..260f8deb09 100644
--- a/src/System.ComponentModel.TypeConverter/src/System/misc.cs
+++ b/src/System.ComponentModel.TypeConverter/src/System/misc.cs
@@ -55,7 +55,6 @@ namespace System.ComponentModel
internal static class CompModSwitches
{
private static volatile BooleanSwitch commonDesignerServices;
- private static volatile TraceSwitch eventLog;
public static BooleanSwitch CommonDesignerServices
{
@@ -67,19 +66,6 @@ namespace System.ComponentModel
}
return commonDesignerServices;
}
- }
-
- public static TraceSwitch EventLog
- {
- get
- {
- if (eventLog == null)
- {
- eventLog = new TraceSwitch("EventLog", "Enable tracing for the EventLog component.");
- }
- return eventLog;
- }
- }
-
+ }
}
}
diff --git a/src/System.Composition/tests/ContractTests.cs b/src/System.Composition/tests/ContractTests.cs
index d6d1465da3..f9e0867c04 100644
--- a/src/System.Composition/tests/ContractTests.cs
+++ b/src/System.Composition/tests/ContractTests.cs
@@ -68,6 +68,7 @@ namespace System.Composition.UnitTests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20656", TargetFrameworkMonikers.UapAot)]
public void FormattingTheContractPrintsConstraintKeysAndValues()
{
var mcd = new CompositionContract(typeof(AType), null, new Dictionary<string, object> { { "A", 1 }, { "B", "C" } });
@@ -76,6 +77,7 @@ namespace System.Composition.UnitTests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20656", TargetFrameworkMonikers.UapAot)]
public void FormattingTheContractPrintsNameAndDiscriminator()
{
var mcd = new CompositionContract(typeof(AType), "inner", new Dictionary<string, object> { { "A", 1 } });
diff --git a/src/System.Composition/tests/DiscoveryTests.cs b/src/System.Composition/tests/DiscoveryTests.cs
index a4c043ad8f..9aec3aff43 100644
--- a/src/System.Composition/tests/DiscoveryTests.cs
+++ b/src/System.Composition/tests/DiscoveryTests.cs
@@ -57,6 +57,7 @@ namespace System.Composition.UnitTests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20656", TargetFrameworkMonikers.UapAot)]
public void InstanceExportsOfIncompatibleContractsAreDetected()
{
var x = Assert.Throws<CompositionFailedException>(() => CreateContainer(typeof(IncompatibleRule)));
@@ -64,6 +65,7 @@ namespace System.Composition.UnitTests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20656", TargetFrameworkMonikers.UapAot)]
public void PropertyExportsOfIncompatibleContractsAreDetected()
{
var x = Assert.Throws<CompositionFailedException>(() => CreateContainer(typeof(IncompatibleRuleProperty)));
@@ -123,6 +125,7 @@ namespace System.Composition.UnitTests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20656", TargetFrameworkMonikers.UapAot)]
public void MultipleImportAttributesAreDetected()
{
var c = new ContainerConfiguration()
diff --git a/src/System.Composition/tests/ErrorMessageQualityTests.cs b/src/System.Composition/tests/ErrorMessageQualityTests.cs
index 4e9d756557..68c53fe33e 100644
--- a/src/System.Composition/tests/ErrorMessageQualityTests.cs
+++ b/src/System.Composition/tests/ErrorMessageQualityTests.cs
@@ -64,6 +64,7 @@ namespace System.Composition.UnitTests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20656", TargetFrameworkMonikers.UapAot)]
public void MissingTopLevelExportMessageIsInformative()
{
var cc = CreateContainer();
@@ -72,6 +73,7 @@ namespace System.Composition.UnitTests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20656", TargetFrameworkMonikers.UapAot)]
public void MissingTopLevelNamedExportMessageIsInformative()
{
var cc = CreateContainer();
diff --git a/src/System.Composition/tests/ExportFactoryTests.cs b/src/System.Composition/tests/ExportFactoryTests.cs
index ed47a009ad..2f73f6e5ce 100644
--- a/src/System.Composition/tests/ExportFactoryTests.cs
+++ b/src/System.Composition/tests/ExportFactoryTests.cs
@@ -116,6 +116,7 @@ namespace System.Composition.UnitTests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20656", TargetFrameworkMonikers.UapAot)]
public void TheSameSharedInstanceIsReusedWithinItsSharingBoundary()
{
var cc = CreateContainer(typeof(SharedBoundedByDC), typeof(SharedPartConsumer), typeof(DataConsistencyBoundaryProvider));
diff --git a/src/System.Composition/tests/MetadataViewGenerationTests.cs b/src/System.Composition/tests/MetadataViewGenerationTests.cs
index 6e5e406e68..2eb06d056b 100644
--- a/src/System.Composition/tests/MetadataViewGenerationTests.cs
+++ b/src/System.Composition/tests/MetadataViewGenerationTests.cs
@@ -78,6 +78,7 @@ namespace System.Composition.Lightweight.UnitTests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20656", TargetFrameworkMonikers.UapAot)]
public void AConcreteTypeWithUnsupportedConstructorsCannotBeUsedAsAMetadataView()
{
var cc = new ContainerConfiguration()
@@ -102,6 +103,7 @@ namespace System.Composition.Lightweight.UnitTests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20656", TargetFrameworkMonikers.UapAot)]
public void UnsupportedMetadataViewMessageIsInformative()
{
var cc = new ContainerConfiguration().WithParts(typeof(ImportsWithMetadataInterface), typeof(ExportsWithMetadata)).CreateContainer();
diff --git a/src/System.Composition/tests/OpenGenericsTests.cs b/src/System.Composition/tests/OpenGenericsTests.cs
index f0da7808ed..c676c67d5b 100644
--- a/src/System.Composition/tests/OpenGenericsTests.cs
+++ b/src/System.Composition/tests/OpenGenericsTests.cs
@@ -124,6 +124,7 @@ namespace System.Composition.UnitTests
// In future, the set of allowable generic type mappings will be expanded (see
// ignored tests above).
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20656", TargetFrameworkMonikers.UapAot)]
public void TypesWithMismatchedGenericParameterListsAreDetectedDuringDiscovery()
{
var x = Assert.Throws<CompositionFailedException>(() => CreateContainer(typeof(RepositoryWithKey<,>)));
@@ -131,6 +132,7 @@ namespace System.Composition.UnitTests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20656", TargetFrameworkMonikers.UapAot)]
public void TypesWithNonGenericExportsAreDetectedDuringDiscovery()
{
var x = Assert.Throws<CompositionFailedException>(() => CreateContainer(typeof(RepositoryWithNonGenericExport<>)));
diff --git a/src/System.Composition/tests/SharingTests.cs b/src/System.Composition/tests/SharingTests.cs
index 4090c01bc5..65cfbc9d32 100644
--- a/src/System.Composition/tests/SharingTests.cs
+++ b/src/System.Composition/tests/SharingTests.cs
@@ -338,6 +338,7 @@ namespace System.Composition.UnitTests
/// Needs to be fixed so that specifying boundary would automatically create the shared
/// </summary>
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20656", TargetFrameworkMonikers.UapAot)]
public void BoundarySharingTest()
{
var cc = CreateContainer(typeof(A), typeof(B), typeof(C), typeof(D));
@@ -359,6 +360,7 @@ namespace System.Composition.UnitTests
/// CirA root of the composition has to be shared explicitly.
/// </summary>
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20656", TargetFrameworkMonikers.UapAot)]
public void CircularBoundarySharingTest()
{
var cc = CreateContainer(typeof(CirA), typeof(CirB), typeof(CirC));
@@ -375,6 +377,7 @@ namespace System.Composition.UnitTests
/// Something is badly busted here.. I am getting a null ref exception
/// </summary>
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20656", TargetFrameworkMonikers.UapAot)]
public void MultipleBoundarySpecified()
{
var cc = CreateContainer(typeof(ProjA), typeof(ProjB), typeof(SolA), typeof(DocA), typeof(DocB), typeof(ColA), typeof(ColB));
diff --git a/src/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigPaths.cs b/src/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigPaths.cs
index 467a70b6e5..b62f885187 100644
--- a/src/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigPaths.cs
+++ b/src/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigPaths.cs
@@ -60,7 +60,9 @@ namespace System.Configuration
// used for local paths and "file://" for UNCs. Simply removing the prefix will make
// local paths relative on Unix (e.g. "file:///home" will become "home" instead of
// "/home").
- Uri uri = new Uri(exeAssembly.CodeBase);
+ string configBasePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, exeAssembly.ManifestModule.Name);
+ Uri uri = new Uri(configBasePath);
+
if (uri.IsFile)
{
ApplicationUri = uri.LocalPath;
@@ -68,7 +70,7 @@ namespace System.Configuration
}
else
{
- ApplicationUri = exeAssembly.EscapedCodeBase;
+ ApplicationUri = Uri.EscapeDataString(configBasePath);
}
}
@@ -201,7 +203,7 @@ namespace System.Configuration
if (assembly != null)
{
AssemblyName assemblyName = assembly.GetName();
- Uri codeBase = new Uri(assembly.CodeBase);
+ Uri codeBase = new Uri(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, assembly.ManifestModule.Name));
hash = IdentityHelper.GetNormalizedStrongNameHash(assemblyName);
if (hash != null)
@@ -329,4 +331,4 @@ namespace System.Configuration
return validated;
}
}
-} \ No newline at end of file
+}
diff --git a/src/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigurationHost.cs b/src/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigurationHost.cs
index 5c7c5e56ce..d5b7e0435b 100644
--- a/src/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigurationHost.cs
+++ b/src/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigurationHost.cs
@@ -46,7 +46,7 @@ namespace System.Configuration
{
if (s_machineConfigFilePath == null)
{
- string directory = RuntimeEnvironment.GetRuntimeDirectory();
+ string directory = AppDomain.CurrentDomain.BaseDirectory;
s_machineConfigFilePath = Path.Combine(Path.Combine(directory, MachineConfigSubdirectory),
MachineConfigFilename);
}
diff --git a/src/System.Data.Common/src/System/Data/SQLTypes/SQLBoolean.cs b/src/System.Data.Common/src/System/Data/SQLTypes/SQLBoolean.cs
index 15d0b531c2..0eb96cbc09 100644
--- a/src/System.Data.Common/src/System/Data/SQLTypes/SQLBoolean.cs
+++ b/src/System.Data.Common/src/System/Data/SQLTypes/SQLBoolean.cs
@@ -20,7 +20,7 @@ namespace System.Data.SqlTypes
public struct SqlBoolean : INullable, IComparable, IXmlSerializable
{
// m_value: 2 (true), 1 (false), 0 (unknown/Null)
- private byte _value;
+ private byte m_value; // Do not rename (binary serialization)
private const byte x_Null = 0;
private const byte x_False = 1;
@@ -33,7 +33,7 @@ namespace System.Data.SqlTypes
/// </summary>
public SqlBoolean(bool value)
{
- _value = value ? x_True : x_False;
+ m_value = value ? x_True : x_False;
}
public SqlBoolean(int value) : this(value, false)
@@ -43,9 +43,9 @@ namespace System.Data.SqlTypes
private SqlBoolean(int value, bool fNull)
{
if (fNull)
- _value = x_Null;
+ m_value = x_Null;
else
- _value = (value != 0) ? x_True : x_False;
+ m_value = (value != 0) ? x_True : x_False;
}
@@ -55,7 +55,7 @@ namespace System.Data.SqlTypes
/// </summary>
public bool IsNull
{
- get { return _value == x_Null; }
+ get { return m_value == x_Null; }
}
// property: Value
@@ -66,7 +66,7 @@ namespace System.Data.SqlTypes
{
get
{
- switch (_value)
+ switch (m_value)
{
case x_True:
return true;
@@ -85,7 +85,7 @@ namespace System.Data.SqlTypes
/// </summary>
public bool IsTrue
{
- get { return _value == x_True; }
+ get { return m_value == x_True; }
}
/// <summary>
@@ -93,7 +93,7 @@ namespace System.Data.SqlTypes
/// </summary>
public bool IsFalse
{
- get { return _value == x_False; }
+ get { return m_value == x_False; }
}
@@ -123,7 +123,7 @@ namespace System.Data.SqlTypes
/// </summary>
public static SqlBoolean operator !(SqlBoolean x)
{
- switch (x._value)
+ switch (x.m_value)
{
case x_True:
return SqlBoolean.False;
@@ -132,7 +132,7 @@ namespace System.Data.SqlTypes
return SqlBoolean.True;
default:
- Debug.Assert(x._value == x_Null);
+ Debug.Assert(x.m_value == x_Null);
return SqlBoolean.Null;
}
}
@@ -154,9 +154,9 @@ namespace System.Data.SqlTypes
/// </summary>
public static SqlBoolean operator &(SqlBoolean x, SqlBoolean y)
{
- if (x._value == x_False || y._value == x_False)
+ if (x.m_value == x_False || y.m_value == x_False)
return SqlBoolean.False;
- else if (x._value == x_True && y._value == x_True)
+ else if (x.m_value == x_True && y.m_value == x_True)
return SqlBoolean.True;
else
return SqlBoolean.Null;
@@ -167,9 +167,9 @@ namespace System.Data.SqlTypes
/// </summary>
public static SqlBoolean operator |(SqlBoolean x, SqlBoolean y)
{
- if (x._value == x_True || y._value == x_True)
+ if (x.m_value == x_True || y.m_value == x_True)
return SqlBoolean.True;
- else if (x._value == x_False && y._value == x_False)
+ else if (x.m_value == x_False && y.m_value == x_False)
return SqlBoolean.False;
else
return SqlBoolean.Null;
@@ -183,7 +183,7 @@ namespace System.Data.SqlTypes
get
{
if (!IsNull)
- return (_value == x_True) ? (byte)1 : (byte)0;
+ return (m_value == x_True) ? (byte)1 : (byte)0;
else
throw new SqlNullValueException();
}
@@ -226,7 +226,7 @@ namespace System.Data.SqlTypes
public static SqlBoolean operator ^(SqlBoolean x, SqlBoolean y)
{
- return (x.IsNull || y.IsNull) ? Null : new SqlBoolean(x._value != y._value);
+ return (x.IsNull || y.IsNull) ? Null : new SqlBoolean(x.m_value != y.m_value);
}
@@ -295,7 +295,7 @@ namespace System.Data.SqlTypes
// Overloading comparison operators
public static SqlBoolean operator ==(SqlBoolean x, SqlBoolean y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value == y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value == y.m_value);
}
public static SqlBoolean operator !=(SqlBoolean x, SqlBoolean y)
@@ -305,22 +305,22 @@ namespace System.Data.SqlTypes
public static SqlBoolean operator <(SqlBoolean x, SqlBoolean y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value < y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value < y.m_value);
}
public static SqlBoolean operator >(SqlBoolean x, SqlBoolean y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value > y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value > y.m_value);
}
public static SqlBoolean operator <=(SqlBoolean x, SqlBoolean y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value <= y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value <= y.m_value);
}
public static SqlBoolean operator >=(SqlBoolean x, SqlBoolean y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value >= y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value >= y.m_value);
}
//--------------------------------------------------
@@ -499,11 +499,11 @@ namespace System.Data.SqlTypes
{
// Read the next value.
reader.ReadElementString();
- _value = x_Null;
+ m_value = x_Null;
}
else
{
- _value = XmlConvert.ToBoolean(reader.ReadElementString()) ? x_True : x_False;
+ m_value = XmlConvert.ToBoolean(reader.ReadElementString()) ? x_True : x_False;
}
}
@@ -515,7 +515,7 @@ namespace System.Data.SqlTypes
}
else
{
- writer.WriteString(_value == x_True ? "true" : "false");
+ writer.WriteString(m_value == x_True ? "true" : "false");
}
}
diff --git a/src/System.Data.Common/src/System/Data/SQLTypes/SQLByte.cs b/src/System.Data.Common/src/System/Data/SQLTypes/SQLByte.cs
index b136462755..c09b6e3037 100644
--- a/src/System.Data.Common/src/System/Data/SQLTypes/SQLByte.cs
+++ b/src/System.Data.Common/src/System/Data/SQLTypes/SQLByte.cs
@@ -19,8 +19,8 @@ namespace System.Data.SqlTypes
[XmlSchemaProvider("GetXsdType")]
public struct SqlByte : INullable, IComparable, IXmlSerializable
{
- private bool _fNotNull; // false if null
- private byte _value;
+ private bool m_fNotNull; // false if null. Do not rename (binary serialization)
+ private byte m_value; // Do not rename (binary serialization)
private static readonly int s_iBitNotByteMax = ~0xff;
@@ -28,20 +28,20 @@ namespace System.Data.SqlTypes
// construct a Null
private SqlByte(bool fNull)
{
- _fNotNull = false;
- _value = 0;
+ m_fNotNull = false;
+ m_value = 0;
}
public SqlByte(byte value)
{
- _value = value;
- _fNotNull = true;
+ m_value = value;
+ m_fNotNull = true;
}
// INullable
public bool IsNull
{
- get { return !_fNotNull; }
+ get { return !m_fNotNull; }
}
// property: Value
@@ -49,8 +49,8 @@ namespace System.Data.SqlTypes
{
get
{
- if (_fNotNull)
- return _value;
+ if (m_fNotNull)
+ return m_value;
else
throw new SqlNullValueException();
}
@@ -70,7 +70,7 @@ namespace System.Data.SqlTypes
public override string ToString()
{
- return IsNull ? SQLResource.NullString : _value.ToString((IFormatProvider)null);
+ return IsNull ? SQLResource.NullString : m_value.ToString((IFormatProvider)null);
}
public static SqlByte Parse(string s)
@@ -84,7 +84,7 @@ namespace System.Data.SqlTypes
// Unary operators
public static SqlByte operator ~(SqlByte x)
{
- return x.IsNull ? Null : new SqlByte(unchecked((byte)~x._value));
+ return x.IsNull ? Null : new SqlByte(unchecked((byte)~x.m_value));
}
@@ -96,7 +96,7 @@ namespace System.Data.SqlTypes
if (x.IsNull || y.IsNull)
return Null;
- int iResult = x._value + y._value;
+ int iResult = x.m_value + y.m_value;
if ((iResult & s_iBitNotByteMax) != 0)
throw new OverflowException(SQLResource.ArithOverflowMessage);
else
@@ -108,7 +108,7 @@ namespace System.Data.SqlTypes
if (x.IsNull || y.IsNull)
return Null;
- int iResult = x._value - y._value;
+ int iResult = x.m_value - y.m_value;
if ((iResult & s_iBitNotByteMax) != 0)
throw new OverflowException(SQLResource.ArithOverflowMessage);
else
@@ -120,7 +120,7 @@ namespace System.Data.SqlTypes
if (x.IsNull || y.IsNull)
return Null;
- int iResult = x._value * y._value;
+ int iResult = x.m_value * y.m_value;
if ((iResult & s_iBitNotByteMax) != 0)
throw new OverflowException(SQLResource.ArithOverflowMessage);
else
@@ -132,9 +132,9 @@ namespace System.Data.SqlTypes
if (x.IsNull || y.IsNull)
return Null;
- if (y._value != 0)
+ if (y.m_value != 0)
{
- return new SqlByte((byte)(x._value / y._value));
+ return new SqlByte((byte)(x.m_value / y.m_value));
}
else
throw new DivideByZeroException(SQLResource.DivideByZeroMessage);
@@ -145,9 +145,9 @@ namespace System.Data.SqlTypes
if (x.IsNull || y.IsNull)
return Null;
- if (y._value != 0)
+ if (y.m_value != 0)
{
- return new SqlByte((byte)(x._value % y._value));
+ return new SqlByte((byte)(x.m_value % y.m_value));
}
else
throw new DivideByZeroException(SQLResource.DivideByZeroMessage);
@@ -156,17 +156,17 @@ namespace System.Data.SqlTypes
// Bitwise operators
public static SqlByte operator &(SqlByte x, SqlByte y)
{
- return (x.IsNull || y.IsNull) ? Null : new SqlByte((byte)(x._value & y._value));
+ return (x.IsNull || y.IsNull) ? Null : new SqlByte((byte)(x.m_value & y.m_value));
}
public static SqlByte operator |(SqlByte x, SqlByte y)
{
- return (x.IsNull || y.IsNull) ? Null : new SqlByte((byte)(x._value | y._value));
+ return (x.IsNull || y.IsNull) ? Null : new SqlByte((byte)(x.m_value | y.m_value));
}
public static SqlByte operator ^(SqlByte x, SqlByte y)
{
- return (x.IsNull || y.IsNull) ? Null : new SqlByte((byte)(x._value ^ y._value));
+ return (x.IsNull || y.IsNull) ? Null : new SqlByte((byte)(x.m_value ^ y.m_value));
}
@@ -264,7 +264,7 @@ namespace System.Data.SqlTypes
// Overloading comparison operators
public static SqlBoolean operator ==(SqlByte x, SqlByte y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value == y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value == y.m_value);
}
public static SqlBoolean operator !=(SqlByte x, SqlByte y)
@@ -274,22 +274,22 @@ namespace System.Data.SqlTypes
public static SqlBoolean operator <(SqlByte x, SqlByte y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value < y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value < y.m_value);
}
public static SqlBoolean operator >(SqlByte x, SqlByte y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value > y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value > y.m_value);
}
public static SqlBoolean operator <=(SqlByte x, SqlByte y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value <= y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value <= y.m_value);
}
public static SqlBoolean operator >=(SqlByte x, SqlByte y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value >= y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value >= y.m_value);
}
//--------------------------------------------------
@@ -503,12 +503,12 @@ namespace System.Data.SqlTypes
{
// Read the next value.
reader.ReadElementString();
- _fNotNull = false;
+ m_fNotNull = false;
}
else
{
- _value = XmlConvert.ToByte(reader.ReadElementString());
- _fNotNull = true;
+ m_value = XmlConvert.ToByte(reader.ReadElementString());
+ m_fNotNull = true;
}
}
@@ -520,7 +520,7 @@ namespace System.Data.SqlTypes
}
else
{
- writer.WriteString(XmlConvert.ToString(_value));
+ writer.WriteString(XmlConvert.ToString(m_value));
}
}
diff --git a/src/System.Data.Common/src/System/Data/SQLTypes/SQLDateTime.cs b/src/System.Data.Common/src/System/Data/SQLTypes/SQLDateTime.cs
index 95757d677e..d4a2335ca4 100644
--- a/src/System.Data.Common/src/System/Data/SQLTypes/SQLDateTime.cs
+++ b/src/System.Data.Common/src/System/Data/SQLTypes/SQLDateTime.cs
@@ -22,9 +22,9 @@ namespace System.Data.SqlTypes
[XmlSchemaProvider("GetXsdType")]
public struct SqlDateTime : INullable, IComparable, IXmlSerializable
{
- private bool _fNotNull; // false if null
- private int _day; // Day from 1900/1/1, could be negative. Range: Jan 1 1753 - Dec 31 9999.
- private int _time; // Time in the day in term of ticks
+ private bool m_fNotNull; // false if null. Do not rename (binary serialization)
+ private int m_day; // Day from 1900/1/1, could be negative. Range: Jan 1 1753 - Dec 31 9999. Do not rename (binary serialization)
+ private int m_time; // Time in the day in term of ticks. Do not rename (binary serialization)
// Constants
@@ -80,9 +80,9 @@ namespace System.Data.SqlTypes
// construct a Null
private SqlDateTime(bool fNull)
{
- _fNotNull = false;
- _day = 0;
- _time = 0;
+ m_fNotNull = false;
+ m_day = 0;
+ m_time = 0;
}
public SqlDateTime(DateTime value)
@@ -147,18 +147,17 @@ namespace System.Data.SqlTypes
{
}
-
public SqlDateTime(int dayTicks, int timeTicks)
{
if (dayTicks < s_minDay || dayTicks > s_maxDay || timeTicks < s_minTime || timeTicks > s_maxTime)
{
- _fNotNull = false;
+ m_fNotNull = false;
throw new OverflowException(SQLResource.DateTimeOverflowMessage);
}
- _day = dayTicks;
- _time = timeTicks;
- _fNotNull = true;
+ m_day = dayTicks;
+ m_time = timeTicks;
+ m_fNotNull = true;
}
internal SqlDateTime(double dblVal)
@@ -192,18 +191,16 @@ namespace System.Data.SqlTypes
this = new SqlDateTime(day, time);
}
-
// INullable
public bool IsNull
{
- get { return !_fNotNull; }
+ get { return !m_fNotNull; }
}
-
private static TimeSpan ToTimeSpan(SqlDateTime value)
{
- long millisecond = (long)(value._time / s_SQLTicksPerMillisecond + 0.5);
- return new TimeSpan(value._day * TimeSpan.TicksPerDay +
+ long millisecond = (long)(value.m_time / s_SQLTicksPerMillisecond + 0.5);
+ return new TimeSpan(value.m_day * TimeSpan.TicksPerDay +
millisecond * TimeSpan.TicksPerMillisecond);
}
@@ -293,7 +290,7 @@ namespace System.Data.SqlTypes
{
get
{
- if (_fNotNull)
+ if (m_fNotNull)
return ToDateTime(this);
else
throw new SqlNullValueException();
@@ -305,8 +302,8 @@ namespace System.Data.SqlTypes
{
get
{
- if (_fNotNull)
- return _day;
+ if (m_fNotNull)
+ return m_day;
else
throw new SqlNullValueException();
}
@@ -317,8 +314,8 @@ namespace System.Data.SqlTypes
{
get
{
- if (_fNotNull)
- return _time;
+ if (m_fNotNull)
+ return m_time;
else
throw new SqlNullValueException();
}
@@ -511,7 +508,7 @@ namespace System.Data.SqlTypes
// Overloading comparison operators
public static SqlBoolean operator ==(SqlDateTime x, SqlDateTime y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._day == y._day && x._time == y._time);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_day == y.m_day && x.m_time == y.m_time);
}
public static SqlBoolean operator !=(SqlDateTime x, SqlDateTime y)
@@ -522,25 +519,25 @@ namespace System.Data.SqlTypes
public static SqlBoolean operator <(SqlDateTime x, SqlDateTime y)
{
return (x.IsNull || y.IsNull) ? SqlBoolean.Null :
- new SqlBoolean(x._day < y._day || (x._day == y._day && x._time < y._time));
+ new SqlBoolean(x.m_day < y.m_day || (x.m_day == y.m_day && x.m_time < y.m_time));
}
public static SqlBoolean operator >(SqlDateTime x, SqlDateTime y)
{
return (x.IsNull || y.IsNull) ? SqlBoolean.Null :
- new SqlBoolean(x._day > y._day || (x._day == y._day && x._time > y._time));
+ new SqlBoolean(x.m_day > y.m_day || (x.m_day == y.m_day && x.m_time > y.m_time));
}
public static SqlBoolean operator <=(SqlDateTime x, SqlDateTime y)
{
return (x.IsNull || y.IsNull) ? SqlBoolean.Null :
- new SqlBoolean(x._day < y._day || (x._day == y._day && x._time <= y._time));
+ new SqlBoolean(x.m_day < y.m_day || (x.m_day == y.m_day && x.m_time <= y.m_time));
}
public static SqlBoolean operator >=(SqlDateTime x, SqlDateTime y)
{
return (x.IsNull || y.IsNull) ? SqlBoolean.Null :
- new SqlBoolean(x._day > y._day || (x._day == y._day && x._time >= y._time));
+ new SqlBoolean(x.m_day > y.m_day || (x.m_day == y.m_day && x.m_time >= y.m_time));
}
//--------------------------------------------------
@@ -653,7 +650,7 @@ namespace System.Data.SqlTypes
{
// Read the next value.
reader.ReadElementString();
- _fNotNull = false;
+ m_fNotNull = false;
}
else
{
@@ -668,9 +665,9 @@ namespace System.Data.SqlTypes
}
SqlDateTime st = FromDateTime(dt);
- _day = st.DayTicks;
- _time = st.TimeTicks;
- _fNotNull = true;
+ m_day = st.DayTicks;
+ m_time = st.TimeTicks;
+ m_fNotNull = true;
}
}
diff --git a/src/System.Data.Common/src/System/Data/SQLTypes/SQLDouble.cs b/src/System.Data.Common/src/System/Data/SQLTypes/SQLDouble.cs
index d46963eafa..986d878748 100644
--- a/src/System.Data.Common/src/System/Data/SQLTypes/SQLDouble.cs
+++ b/src/System.Data.Common/src/System/Data/SQLTypes/SQLDouble.cs
@@ -20,15 +20,15 @@ namespace System.Data.SqlTypes
[XmlSchemaProvider("GetXsdType")]
public struct SqlDouble : INullable, IComparable, IXmlSerializable
{
- private bool _fNotNull; // false if null
- private double _value;
+ private bool m_fNotNull; // false if null. Do not rename (binary serialization)
+ private double m_value; // Do not rename (binary serialization)
// constructor
// construct a Null
private SqlDouble(bool fNull)
{
- _fNotNull = false;
- _value = 0.0;
+ m_fNotNull = false;
+ m_value = 0.0;
}
public SqlDouble(double value)
@@ -37,15 +37,15 @@ namespace System.Data.SqlTypes
throw new OverflowException(SQLResource.ArithOverflowMessage);
else
{
- _value = value;
- _fNotNull = true;
+ m_value = value;
+ m_fNotNull = true;
}
}
// INullable
public bool IsNull
{
- get { return !_fNotNull; }
+ get { return !m_fNotNull; }
}
// property: Value
@@ -53,8 +53,8 @@ namespace System.Data.SqlTypes
{
get
{
- if (_fNotNull)
- return _value;
+ if (m_fNotNull)
+ return m_value;
else
throw new SqlNullValueException();
}
@@ -74,7 +74,7 @@ namespace System.Data.SqlTypes
public override string ToString()
{
- return IsNull ? SQLResource.NullString : _value.ToString((IFormatProvider)null);
+ return IsNull ? SQLResource.NullString : m_value.ToString((IFormatProvider)null);
}
public static SqlDouble Parse(string s)
@@ -89,7 +89,7 @@ namespace System.Data.SqlTypes
// Unary operators
public static SqlDouble operator -(SqlDouble x)
{
- return x.IsNull ? Null : new SqlDouble(-x._value);
+ return x.IsNull ? Null : new SqlDouble(-x.m_value);
}
@@ -101,7 +101,7 @@ namespace System.Data.SqlTypes
if (x.IsNull || y.IsNull)
return Null;
- double value = x._value + y._value;
+ double value = x.m_value + y.m_value;
if (double.IsInfinity(value))
throw new OverflowException(SQLResource.ArithOverflowMessage);
@@ -114,7 +114,7 @@ namespace System.Data.SqlTypes
if (x.IsNull || y.IsNull)
return Null;
- double value = x._value - y._value;
+ double value = x.m_value - y.m_value;
if (double.IsInfinity(value))
throw new OverflowException(SQLResource.ArithOverflowMessage);
@@ -127,7 +127,7 @@ namespace System.Data.SqlTypes
if (x.IsNull || y.IsNull)
return Null;
- double value = x._value * y._value;
+ double value = x.m_value * y.m_value;
if (double.IsInfinity(value))
throw new OverflowException(SQLResource.ArithOverflowMessage);
@@ -140,10 +140,10 @@ namespace System.Data.SqlTypes
if (x.IsNull || y.IsNull)
return Null;
- if (y._value == 0.0)
+ if (y.m_value == 0.0)
throw new DivideByZeroException(SQLResource.DivideByZeroMessage);
- double value = x._value / y._value;
+ double value = x.m_value / y.m_value;
if (double.IsInfinity(value))
throw new OverflowException(SQLResource.ArithOverflowMessage);
@@ -151,8 +151,6 @@ namespace System.Data.SqlTypes
return new SqlDouble(value);
}
-
-
// Implicit conversions
// Implicit conversion from SqlBoolean to SqlDouble
@@ -203,11 +201,8 @@ namespace System.Data.SqlTypes
return x.IsNull ? Null : new SqlDouble(x.ToDouble());
}
-
// Explicit conversions
-
-
// Explicit conversion from SqlString to SqlDouble
// Throws FormatException or OverflowException if necessary.
public static explicit operator SqlDouble(SqlString x)
@@ -221,7 +216,7 @@ namespace System.Data.SqlTypes
// Overloading comparison operators
public static SqlBoolean operator ==(SqlDouble x, SqlDouble y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value == y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value == y.m_value);
}
public static SqlBoolean operator !=(SqlDouble x, SqlDouble y)
@@ -231,22 +226,22 @@ namespace System.Data.SqlTypes
public static SqlBoolean operator <(SqlDouble x, SqlDouble y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value < y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value < y.m_value);
}
public static SqlBoolean operator >(SqlDouble x, SqlDouble y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value > y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value > y.m_value);
}
public static SqlBoolean operator <=(SqlDouble x, SqlDouble y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value <= y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value <= y.m_value);
}
public static SqlBoolean operator >=(SqlDouble x, SqlDouble y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value >= y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value >= y.m_value);
}
//--------------------------------------------------
@@ -359,8 +354,6 @@ namespace System.Data.SqlTypes
return (SqlString)this;
}
-
-
// IComparable
// Compares this object to another object, returning an integer that
// indicates the relationship.
@@ -424,12 +417,12 @@ namespace System.Data.SqlTypes
{
// Read the next value.
reader.ReadElementString();
- _fNotNull = false;
+ m_fNotNull = false;
}
else
{
- _value = XmlConvert.ToDouble(reader.ReadElementString());
- _fNotNull = true;
+ m_value = XmlConvert.ToDouble(reader.ReadElementString());
+ m_fNotNull = true;
}
}
@@ -441,7 +434,7 @@ namespace System.Data.SqlTypes
}
else
{
- writer.WriteString(XmlConvert.ToString(_value));
+ writer.WriteString(XmlConvert.ToString(m_value));
}
}
diff --git a/src/System.Data.Common/src/System/Data/SQLTypes/SQLInt16.cs b/src/System.Data.Common/src/System/Data/SQLTypes/SQLInt16.cs
index 237a2126a2..bd893c800f 100644
--- a/src/System.Data.Common/src/System/Data/SQLTypes/SQLInt16.cs
+++ b/src/System.Data.Common/src/System/Data/SQLTypes/SQLInt16.cs
@@ -18,8 +18,8 @@ namespace System.Data.SqlTypes
[XmlSchemaProvider("GetXsdType")]
public struct SqlInt16 : INullable, IComparable, IXmlSerializable
{
- private bool _fNotNull; // false if null
- private short _value;
+ private bool m_fNotNull; // false if null. Do not rename (binary serialization)
+ private short m_value; // Do not rename (binary serialization)
private static readonly int s_MASKI2 = ~0x00007fff;
@@ -27,20 +27,20 @@ namespace System.Data.SqlTypes
// construct a Null
private SqlInt16(bool fNull)
{
- _fNotNull = false;
- _value = 0;
+ m_fNotNull = false;
+ m_value = 0;
}
public SqlInt16(short value)
{
- _value = value;
- _fNotNull = true;
+ m_value = value;
+ m_fNotNull = true;
}
// INullable
public bool IsNull
{
- get { return !_fNotNull; }
+ get { return !m_fNotNull; }
}
// property: Value
@@ -48,8 +48,8 @@ namespace System.Data.SqlTypes
{
get
{
- if (_fNotNull)
- return _value;
+ if (m_fNotNull)
+ return m_value;
else
throw new SqlNullValueException();
}
@@ -69,7 +69,7 @@ namespace System.Data.SqlTypes
public override string ToString()
{
- return IsNull ? SQLResource.NullString : _value.ToString((IFormatProvider)null);
+ return IsNull ? SQLResource.NullString : m_value.ToString((IFormatProvider)null);
}
public static SqlInt16 Parse(string s)
@@ -80,19 +80,17 @@ namespace System.Data.SqlTypes
return new SqlInt16(short.Parse(s, null));
}
-
// Unary operators
public static SqlInt16 operator -(SqlInt16 x)
{
- return x.IsNull ? Null : new SqlInt16((short)-x._value);
+ return x.IsNull ? Null : new SqlInt16((short)-x.m_value);
}
public static SqlInt16 operator ~(SqlInt16 x)
{
- return x.IsNull ? Null : new SqlInt16((short)~x._value);
+ return x.IsNull ? Null : new SqlInt16((short)~x.m_value);
}
-
// Binary operators
// Arithmetic operators
@@ -101,7 +99,7 @@ namespace System.Data.SqlTypes
if (x.IsNull || y.IsNull)
return Null;
- int iResult = x._value + y._value;
+ int iResult = x.m_value + y.m_value;
if ((((iResult >> 15) ^ (iResult >> 16)) & 1) != 0) // Bit 15 != bit 16
throw new OverflowException(SQLResource.ArithOverflowMessage);
else
@@ -113,7 +111,7 @@ namespace System.Data.SqlTypes
if (x.IsNull || y.IsNull)
return Null;
- int iResult = x._value - y._value;
+ int iResult = x.m_value - y.m_value;
if ((((iResult >> 15) ^ (iResult >> 16)) & 1) != 0) // Bit 15 != bit 16
throw new OverflowException(SQLResource.ArithOverflowMessage);
else
@@ -125,7 +123,7 @@ namespace System.Data.SqlTypes
if (x.IsNull || y.IsNull)
return Null;
- int iResult = x._value * y._value;
+ int iResult = x.m_value * y.m_value;
int iTemp = iResult & s_MASKI2;
if (iTemp != 0 && iTemp != s_MASKI2)
throw new OverflowException(SQLResource.ArithOverflowMessage);
@@ -138,12 +136,12 @@ namespace System.Data.SqlTypes
if (x.IsNull || y.IsNull)
return Null;
- if (y._value != 0)
+ if (y.m_value != 0)
{
- if ((x._value == short.MinValue) && (y._value == -1))
+ if ((x.m_value == short.MinValue) && (y.m_value == -1))
throw new OverflowException(SQLResource.ArithOverflowMessage);
- return new SqlInt16((short)(x._value / y._value));
+ return new SqlInt16((short)(x.m_value / y.m_value));
}
else
throw new DivideByZeroException(SQLResource.DivideByZeroMessage);
@@ -154,12 +152,12 @@ namespace System.Data.SqlTypes
if (x.IsNull || y.IsNull)
return Null;
- if (y._value != 0)
+ if (y.m_value != 0)
{
- if ((x._value == short.MinValue) && (y._value == -1))
+ if ((x.m_value == short.MinValue) && (y.m_value == -1))
throw new OverflowException(SQLResource.ArithOverflowMessage);
- return new SqlInt16((short)(x._value % y._value));
+ return new SqlInt16((short)(x.m_value % y.m_value));
}
else
throw new DivideByZeroException(SQLResource.DivideByZeroMessage);
@@ -168,21 +166,19 @@ namespace System.Data.SqlTypes
// Bitwise operators
public static SqlInt16 operator &(SqlInt16 x, SqlInt16 y)
{
- return (x.IsNull || y.IsNull) ? Null : new SqlInt16((short)(x._value & y._value));
+ return (x.IsNull || y.IsNull) ? Null : new SqlInt16((short)(x.m_value & y.m_value));
}
public static SqlInt16 operator |(SqlInt16 x, SqlInt16 y)
{
- return (x.IsNull || y.IsNull) ? Null : new SqlInt16(unchecked((short)((ushort)x._value | (ushort)y._value)));
+ return (x.IsNull || y.IsNull) ? Null : new SqlInt16(unchecked((short)((ushort)x.m_value | (ushort)y.m_value)));
}
public static SqlInt16 operator ^(SqlInt16 x, SqlInt16 y)
{
- return (x.IsNull || y.IsNull) ? Null : new SqlInt16((short)(x._value ^ y._value));
+ return (x.IsNull || y.IsNull) ? Null : new SqlInt16((short)(x.m_value ^ y.m_value));
}
-
-
// Implicit conversions
// Implicit conversion from SqlBoolean to SqlInt16
@@ -272,7 +268,7 @@ namespace System.Data.SqlTypes
// Overloading comparison operators
public static SqlBoolean operator ==(SqlInt16 x, SqlInt16 y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value == y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value == y.m_value);
}
public static SqlBoolean operator !=(SqlInt16 x, SqlInt16 y)
@@ -282,22 +278,22 @@ namespace System.Data.SqlTypes
public static SqlBoolean operator <(SqlInt16 x, SqlInt16 y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value < y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value < y.m_value);
}
public static SqlBoolean operator >(SqlInt16 x, SqlInt16 y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value > y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value > y.m_value);
}
public static SqlBoolean operator <=(SqlInt16 x, SqlInt16 y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value <= y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value <= y.m_value);
}
public static SqlBoolean operator >=(SqlInt16 x, SqlInt16 y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value >= y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value >= y.m_value);
}
//--------------------------------------------------
@@ -445,8 +441,6 @@ namespace System.Data.SqlTypes
return (SqlString)this;
}
-
-
// IComparable
// Compares this object to another object, returning an integer that
// indicates the relationship.
@@ -510,12 +504,12 @@ namespace System.Data.SqlTypes
{
// Read the next value.
reader.ReadElementString();
- _fNotNull = false;
+ m_fNotNull = false;
}
else
{
- _value = XmlConvert.ToInt16(reader.ReadElementString());
- _fNotNull = true;
+ m_value = XmlConvert.ToInt16(reader.ReadElementString());
+ m_fNotNull = true;
}
}
@@ -527,7 +521,7 @@ namespace System.Data.SqlTypes
}
else
{
- writer.WriteString(XmlConvert.ToString(_value));
+ writer.WriteString(XmlConvert.ToString(m_value));
}
}
diff --git a/src/System.Data.Common/src/System/Data/SQLTypes/SQLInt32.cs b/src/System.Data.Common/src/System/Data/SQLTypes/SQLInt32.cs
index be703a852f..d2796f7abb 100644
--- a/src/System.Data.Common/src/System/Data/SQLTypes/SQLInt32.cs
+++ b/src/System.Data.Common/src/System/Data/SQLTypes/SQLInt32.cs
@@ -18,8 +18,8 @@ namespace System.Data.SqlTypes
[XmlSchemaProvider("GetXsdType")]
public struct SqlInt32 : INullable, IComparable, IXmlSerializable
{
- private bool _fNotNull; // false if null, the default ctor (plain 0) will make it Null
- private int _value;
+ private bool m_fNotNull; // false if null, the default ctor (plain 0) will make it Null. Do not rename (binary serialization)
+ private int m_value; // Do not rename (binary serialization)
private static readonly long s_iIntMin = int.MinValue; // minimum (signed) int value
private static readonly long s_lBitNotIntMax = ~int.MaxValue;
@@ -28,21 +28,20 @@ namespace System.Data.SqlTypes
// construct a Null
private SqlInt32(bool fNull)
{
- _fNotNull = false;
- _value = 0;
+ m_fNotNull = false;
+ m_value = 0;
}
public SqlInt32(int value)
{
- _value = value;
- _fNotNull = true;
+ m_value = value;
+ m_fNotNull = true;
}
-
// INullable
public bool IsNull
{
- get { return !_fNotNull; }
+ get { return !m_fNotNull; }
}
// property: Value
@@ -53,7 +52,7 @@ namespace System.Data.SqlTypes
if (IsNull)
throw new SqlNullValueException();
else
- return _value;
+ return m_value;
}
}
@@ -71,7 +70,7 @@ namespace System.Data.SqlTypes
public override string ToString()
{
- return IsNull ? SQLResource.NullString : _value.ToString((IFormatProvider)null);
+ return IsNull ? SQLResource.NullString : m_value.ToString((IFormatProvider)null);
}
public static SqlInt32 Parse(string s)
@@ -86,15 +85,14 @@ namespace System.Data.SqlTypes
// Unary operators
public static SqlInt32 operator -(SqlInt32 x)
{
- return x.IsNull ? Null : new SqlInt32(-x._value);
+ return x.IsNull ? Null : new SqlInt32(-x.m_value);
}
public static SqlInt32 operator ~(SqlInt32 x)
{
- return x.IsNull ? Null : new SqlInt32(~x._value);
+ return x.IsNull ? Null : new SqlInt32(~x.m_value);
}
-
// Binary operators
// Arithmetic operators
@@ -103,8 +101,8 @@ namespace System.Data.SqlTypes
if (x.IsNull || y.IsNull)
return Null;
- int iResult = x._value + y._value;
- if (SameSignInt(x._value, y._value) && !SameSignInt(x._value, iResult))
+ int iResult = x.m_value + y.m_value;
+ if (SameSignInt(x.m_value, y.m_value) && !SameSignInt(x.m_value, iResult))
throw new OverflowException(SQLResource.ArithOverflowMessage);
else
return new SqlInt32(iResult);
@@ -115,8 +113,8 @@ namespace System.Data.SqlTypes
if (x.IsNull || y.IsNull)
return Null;
- int iResult = x._value - y._value;
- if (!SameSignInt(x._value, y._value) && SameSignInt(y._value, iResult))
+ int iResult = x.m_value - y.m_value;
+ if (!SameSignInt(x.m_value, y.m_value) && SameSignInt(y.m_value, iResult))
throw new OverflowException(SQLResource.ArithOverflowMessage);
else
return new SqlInt32(iResult);
@@ -127,7 +125,7 @@ namespace System.Data.SqlTypes
if (x.IsNull || y.IsNull)
return Null;
- long lResult = x._value * (long)y._value;
+ long lResult = x.m_value * (long)y.m_value;
long lTemp = lResult & s_lBitNotIntMax;
if (lTemp != 0 && lTemp != s_lBitNotIntMax)
throw new OverflowException(SQLResource.ArithOverflowMessage);
@@ -140,12 +138,12 @@ namespace System.Data.SqlTypes
if (x.IsNull || y.IsNull)
return Null;
- if (y._value != 0)
+ if (y.m_value != 0)
{
- if ((x._value == s_iIntMin) && (y._value == -1))
+ if ((x.m_value == s_iIntMin) && (y.m_value == -1))
throw new OverflowException(SQLResource.ArithOverflowMessage);
- return new SqlInt32(x._value / y._value);
+ return new SqlInt32(x.m_value / y.m_value);
}
else
throw new DivideByZeroException(SQLResource.DivideByZeroMessage);
@@ -156,12 +154,12 @@ namespace System.Data.SqlTypes
if (x.IsNull || y.IsNull)
return Null;
- if (y._value != 0)
+ if (y.m_value != 0)
{
- if ((x._value == s_iIntMin) && (y._value == -1))
+ if ((x.m_value == s_iIntMin) && (y.m_value == -1))
throw new OverflowException(SQLResource.ArithOverflowMessage);
- return new SqlInt32(x._value % y._value);
+ return new SqlInt32(x.m_value % y.m_value);
}
else
throw new DivideByZeroException(SQLResource.DivideByZeroMessage);
@@ -170,17 +168,17 @@ namespace System.Data.SqlTypes
// Bitwise operators
public static SqlInt32 operator &(SqlInt32 x, SqlInt32 y)
{
- return (x.IsNull || y.IsNull) ? Null : new SqlInt32(x._value & y._value);
+ return (x.IsNull || y.IsNull) ? Null : new SqlInt32(x.m_value & y.m_value);
}
public static SqlInt32 operator |(SqlInt32 x, SqlInt32 y)
{
- return (x.IsNull || y.IsNull) ? Null : new SqlInt32(x._value | y._value);
+ return (x.IsNull || y.IsNull) ? Null : new SqlInt32(x.m_value | y.m_value);
}
public static SqlInt32 operator ^(SqlInt32 x, SqlInt32 y)
{
- return (x.IsNull || y.IsNull) ? Null : new SqlInt32(x._value ^ y._value);
+ return (x.IsNull || y.IsNull) ? Null : new SqlInt32(x.m_value ^ y.m_value);
}
@@ -204,7 +202,6 @@ namespace System.Data.SqlTypes
return x.IsNull ? Null : new SqlInt32(x.Value);
}
-
// Explicit conversions
// Explicit conversion from SqlInt64 to SqlInt32
@@ -286,7 +283,7 @@ namespace System.Data.SqlTypes
// Overloading comparison operators
public static SqlBoolean operator ==(SqlInt32 x, SqlInt32 y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value == y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value == y.m_value);
}
public static SqlBoolean operator !=(SqlInt32 x, SqlInt32 y)
@@ -296,22 +293,22 @@ namespace System.Data.SqlTypes
public static SqlBoolean operator <(SqlInt32 x, SqlInt32 y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value < y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value < y.m_value);
}
public static SqlBoolean operator >(SqlInt32 x, SqlInt32 y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value > y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value > y.m_value);
}
public static SqlBoolean operator <=(SqlInt32 x, SqlInt32 y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value <= y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value <= y.m_value);
}
public static SqlBoolean operator >=(SqlInt32 x, SqlInt32 y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value >= y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value >= y.m_value);
}
//--------------------------------------------------
@@ -459,8 +456,6 @@ namespace System.Data.SqlTypes
return (SqlString)this;
}
-
-
// IComparable
// Compares this object to another object, returning an integer that
// indicates the relationship.
@@ -524,12 +519,12 @@ namespace System.Data.SqlTypes
{
// Read the next value.
reader.ReadElementString();
- _fNotNull = false;
+ m_fNotNull = false;
}
else
{
- _value = XmlConvert.ToInt32(reader.ReadElementString());
- _fNotNull = true;
+ m_value = XmlConvert.ToInt32(reader.ReadElementString());
+ m_fNotNull = true;
}
}
@@ -541,7 +536,7 @@ namespace System.Data.SqlTypes
}
else
{
- writer.WriteString(XmlConvert.ToString(_value));
+ writer.WriteString(XmlConvert.ToString(m_value));
}
}
diff --git a/src/System.Data.Common/src/System/Data/SQLTypes/SQLInt64.cs b/src/System.Data.Common/src/System/Data/SQLTypes/SQLInt64.cs
index c662a44370..929764c525 100644
--- a/src/System.Data.Common/src/System/Data/SQLTypes/SQLInt64.cs
+++ b/src/System.Data.Common/src/System/Data/SQLTypes/SQLInt64.cs
@@ -19,31 +19,30 @@ namespace System.Data.SqlTypes
[XmlSchemaProvider("GetXsdType")]
public struct SqlInt64 : INullable, IComparable, IXmlSerializable
{
- private bool _fNotNull; // false if null
- private long _value;
+ private bool m_fNotNull; // false if null. Do not rename (binary serialization)
+ private long m_value; // Do not rename (binary serialization)
private static readonly long s_lLowIntMask = 0xffffffff;
private static readonly long s_lHighIntMask = unchecked((long)0xffffffff00000000);
-
// constructor
// construct a Null
private SqlInt64(bool fNull)
{
- _fNotNull = false;
- _value = 0;
+ m_fNotNull = false;
+ m_value = 0;
}
public SqlInt64(long value)
{
- _value = value;
- _fNotNull = true;
+ m_value = value;
+ m_fNotNull = true;
}
// INullable
public bool IsNull
{
- get { return !_fNotNull; }
+ get { return !m_fNotNull; }
}
// property: Value
@@ -51,8 +50,8 @@ namespace System.Data.SqlTypes
{
get
{
- if (_fNotNull)
- return _value;
+ if (m_fNotNull)
+ return m_value;
else
throw new SqlNullValueException();
}
@@ -72,7 +71,7 @@ namespace System.Data.SqlTypes
public override string ToString()
{
- return IsNull ? SQLResource.NullString : _value.ToString((IFormatProvider)null);
+ return IsNull ? SQLResource.NullString : m_value.ToString((IFormatProvider)null);
}
public static SqlInt64 Parse(string s)
@@ -83,19 +82,17 @@ namespace System.Data.SqlTypes
return new SqlInt64(long.Parse(s, null));
}
-
// Unary operators
public static SqlInt64 operator -(SqlInt64 x)
{
- return x.IsNull ? Null : new SqlInt64(-x._value);
+ return x.IsNull ? Null : new SqlInt64(-x.m_value);
}
public static SqlInt64 operator ~(SqlInt64 x)
{
- return x.IsNull ? Null : new SqlInt64(~x._value);
+ return x.IsNull ? Null : new SqlInt64(~x.m_value);
}
-
// Binary operators
// Arithmetic operators
@@ -104,8 +101,8 @@ namespace System.Data.SqlTypes
if (x.IsNull || y.IsNull)
return Null;
- long lResult = x._value + y._value;
- if (SameSignLong(x._value, y._value) && !SameSignLong(x._value, lResult))
+ long lResult = x.m_value + y.m_value;
+ if (SameSignLong(x.m_value, y.m_value) && !SameSignLong(x.m_value, lResult))
throw new OverflowException(SQLResource.ArithOverflowMessage);
else
return new SqlInt64(lResult);
@@ -116,8 +113,8 @@ namespace System.Data.SqlTypes
if (x.IsNull || y.IsNull)
return Null;
- long lResult = x._value - y._value;
- if (!SameSignLong(x._value, y._value) && SameSignLong(y._value, lResult))
+ long lResult = x.m_value - y.m_value;
+ if (!SameSignLong(x.m_value, y.m_value) && SameSignLong(y.m_value, lResult))
throw new OverflowException(SQLResource.ArithOverflowMessage);
else
return new SqlInt64(lResult);
@@ -130,8 +127,8 @@ namespace System.Data.SqlTypes
bool fNeg = false;
- long lOp1 = x._value;
- long lOp2 = y._value;
+ long lOp1 = x.m_value;
+ long lOp2 = y.m_value;
long lResult;
long lPartialResult = 0;
@@ -191,12 +188,12 @@ namespace System.Data.SqlTypes
if (x.IsNull || y.IsNull)
return Null;
- if (y._value != 0)
+ if (y.m_value != 0)
{
- if ((x._value == long.MinValue) && (y._value == -1))
+ if ((x.m_value == long.MinValue) && (y.m_value == -1))
throw new OverflowException(SQLResource.ArithOverflowMessage);
- return new SqlInt64(x._value / y._value);
+ return new SqlInt64(x.m_value / y.m_value);
}
else
throw new DivideByZeroException(SQLResource.DivideByZeroMessage);
@@ -207,12 +204,12 @@ namespace System.Data.SqlTypes
if (x.IsNull || y.IsNull)
return Null;
- if (y._value != 0)
+ if (y.m_value != 0)
{
- if ((x._value == long.MinValue) && (y._value == -1))
+ if ((x.m_value == long.MinValue) && (y.m_value == -1))
throw new OverflowException(SQLResource.ArithOverflowMessage);
- return new SqlInt64(x._value % y._value);
+ return new SqlInt64(x.m_value % y.m_value);
}
else
throw new DivideByZeroException(SQLResource.DivideByZeroMessage);
@@ -221,20 +218,19 @@ namespace System.Data.SqlTypes
// Bitwise operators
public static SqlInt64 operator &(SqlInt64 x, SqlInt64 y)
{
- return (x.IsNull || y.IsNull) ? Null : new SqlInt64(x._value & y._value);
+ return (x.IsNull || y.IsNull) ? Null : new SqlInt64(x.m_value & y.m_value);
}
public static SqlInt64 operator |(SqlInt64 x, SqlInt64 y)
{
- return (x.IsNull || y.IsNull) ? Null : new SqlInt64(x._value | y._value);
+ return (x.IsNull || y.IsNull) ? Null : new SqlInt64(x.m_value | y.m_value);
}
public static SqlInt64 operator ^(SqlInt64 x, SqlInt64 y)
{
- return (x.IsNull || y.IsNull) ? Null : new SqlInt64(x._value ^ y._value);
+ return (x.IsNull || y.IsNull) ? Null : new SqlInt64(x.m_value ^ y.m_value);
}
-
// Implicit conversions
// Implicit conversion from SqlBoolean to SqlInt64
@@ -261,7 +257,6 @@ namespace System.Data.SqlTypes
return x.IsNull ? Null : new SqlInt64(x.Value);
}
-
// Explicit conversions
// Explicit conversion from SqlSingle to SqlInt64
@@ -347,7 +342,7 @@ namespace System.Data.SqlTypes
// Overloading comparison operators
public static SqlBoolean operator ==(SqlInt64 x, SqlInt64 y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value == y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value == y.m_value);
}
public static SqlBoolean operator !=(SqlInt64 x, SqlInt64 y)
@@ -357,22 +352,22 @@ namespace System.Data.SqlTypes
public static SqlBoolean operator <(SqlInt64 x, SqlInt64 y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value < y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value < y.m_value);
}
public static SqlBoolean operator >(SqlInt64 x, SqlInt64 y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value > y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value > y.m_value);
}
public static SqlBoolean operator <=(SqlInt64 x, SqlInt64 y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value <= y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value <= y.m_value);
}
public static SqlBoolean operator >=(SqlInt64 x, SqlInt64 y)
{
- return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x._value >= y._value);
+ return (x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value >= y.m_value);
}
//--------------------------------------------------
@@ -520,7 +515,6 @@ namespace System.Data.SqlTypes
return (SqlString)this;
}
-
// IComparable
// Compares this object to another object, returning an integer that
// indicates the relationship.
@@ -584,12 +578,12 @@ namespace System.Data.SqlTypes
{
// Read the next value.
reader.ReadElementString();
- _fNotNull = false;
+ m_fNotNull = false;
}
else
{
- _value = XmlConvert.ToInt64(reader.ReadElementString());
- _fNotNull = true;
+ m_value = XmlConvert.ToInt64(reader.ReadElementString());
+ m_fNotNull = true;
}
}
@@ -601,7 +595,7 @@ namespace System.Data.SqlTypes
}
else
{
- writer.WriteString(XmlConvert.ToString(_value));
+ writer.WriteString(XmlConvert.ToString(m_value));
}
}
diff --git a/src/System.Data.Common/src/System/Data/SQLTypes/SQLString.cs b/src/System.Data.Common/src/System/Data/SQLTypes/SQLString.cs
index 58be676b30..a94ed9d94f 100644
--- a/src/System.Data.Common/src/System/Data/SQLTypes/SQLString.cs
+++ b/src/System.Data.Common/src/System/Data/SQLTypes/SQLString.cs
@@ -34,11 +34,11 @@ namespace System.Data.SqlTypes
[XmlSchemaProvider("GetXsdType")]
public struct SqlString : INullable, IComparable, IXmlSerializable
{
- private string _value;
- private CompareInfo _cmpInfo;
- private int _lcid; // Locale Id
- private SqlCompareOptions _flag; // Compare flags
- private bool _fNotNull; // false if null
+ private string m_value; // Do not rename (binary serialization)
+ private CompareInfo m_cmpInfo; // Do not rename (binary serialization)
+ private int m_lcid; // Locale Id. Do not rename (binary serialization)
+ private SqlCompareOptions m_flag; // Compare flags. Do not rename (binary serialization)
+ private bool m_fNotNull; // false if null. Do not rename (binary serialization)
/// <summary>
/// Represents a null value that can be assigned to the <see cref='System.Data.SqlTypes.SqlString.Value'/> property of an instance of
@@ -87,11 +87,11 @@ namespace System.Data.SqlTypes
// construct a Null
private SqlString(bool fNull)
{
- _value = null;
- _cmpInfo = null;
- _lcid = 0;
- _flag = SqlCompareOptions.None;
- _fNotNull = false;
+ m_value = null;
+ m_cmpInfo = null;
+ m_lcid = 0;
+ m_flag = SqlCompareOptions.None;
+ m_fNotNull = false;
}
// Constructor: Construct from both Unicode and NonUnicode data, according to fUnicode
@@ -100,32 +100,32 @@ namespace System.Data.SqlTypes
/// </summary>
public SqlString(int lcid, SqlCompareOptions compareOptions, byte[] data, int index, int count, bool fUnicode)
{
- _lcid = lcid;
+ m_lcid = lcid;
ValidateSqlCompareOptions(compareOptions);
- _flag = compareOptions;
+ m_flag = compareOptions;
if (data == null)
{
- _fNotNull = false;
- _value = null;
- _cmpInfo = null;
+ m_fNotNull = false;
+ m_value = null;
+ m_cmpInfo = null;
}
else
{
- _fNotNull = true;
+ m_fNotNull = true;
// m_cmpInfo is set lazily, so that we don't need to pay the cost
// unless the string is used in comparison.
- _cmpInfo = null;
+ m_cmpInfo = null;
if (fUnicode)
{
- _value = s_unicodeEncoding.GetString(data, index, count);
+ m_value = s_unicodeEncoding.GetString(data, index, count);
}
else
{
- CultureInfo culInfo = new CultureInfo(_lcid);
+ CultureInfo culInfo = new CultureInfo(m_lcid);
Encoding cpe = System.Text.Encoding.GetEncoding(culInfo.TextInfo.ANSICodePage);
- _value = cpe.GetString(data, index, count);
+ m_value = cpe.GetString(data, index, count);
}
}
}
@@ -160,19 +160,19 @@ namespace System.Data.SqlTypes
/// </summary>
public SqlString(string data, int lcid, SqlCompareOptions compareOptions)
{
- _lcid = lcid;
+ m_lcid = lcid;
ValidateSqlCompareOptions(compareOptions);
- _flag = compareOptions;
- _cmpInfo = null;
+ m_flag = compareOptions;
+ m_cmpInfo = null;
if (data == null)
{
- _fNotNull = false;
- _value = null;
+ m_fNotNull = false;
+ m_value = null;
}
else
{
- _fNotNull = true;
- _value = data; // PERF: do not String.Copy
+ m_fNotNull = true;
+ m_value = data; // PERF: do not String.Copy
}
}
@@ -192,20 +192,20 @@ namespace System.Data.SqlTypes
private SqlString(int lcid, SqlCompareOptions compareOptions, string data, CompareInfo cmpInfo)
{
- _lcid = lcid;
+ m_lcid = lcid;
ValidateSqlCompareOptions(compareOptions);
- _flag = compareOptions;
+ m_flag = compareOptions;
if (data == null)
{
- _fNotNull = false;
- _value = null;
- _cmpInfo = null;
+ m_fNotNull = false;
+ m_value = null;
+ m_cmpInfo = null;
}
else
{
- _value = data;
- _cmpInfo = cmpInfo;
- _fNotNull = true;
+ m_value = data;
+ m_cmpInfo = cmpInfo;
+ m_fNotNull = true;
}
}
@@ -216,7 +216,7 @@ namespace System.Data.SqlTypes
/// </summary>
public bool IsNull
{
- get { return !_fNotNull; }
+ get { return !m_fNotNull; }
}
// property: Value
@@ -228,7 +228,7 @@ namespace System.Data.SqlTypes
get
{
if (!IsNull)
- return _value;
+ return m_value;
else
throw new SqlNullValueException();
}
@@ -239,7 +239,7 @@ namespace System.Data.SqlTypes
get
{
if (!IsNull)
- return _lcid;
+ return m_lcid;
else
throw new SqlNullValueException();
}
@@ -250,7 +250,7 @@ namespace System.Data.SqlTypes
get
{
if (!IsNull)
- return CultureInfo.GetCultureInfo(_lcid);
+ return CultureInfo.GetCultureInfo(m_lcid);
else
throw new SqlNullValueException();
}
@@ -259,8 +259,8 @@ namespace System.Data.SqlTypes
private void SetCompareInfo()
{
Debug.Assert(!IsNull);
- if (_cmpInfo == null)
- _cmpInfo = (CultureInfo.GetCultureInfo(_lcid)).CompareInfo;
+ if (m_cmpInfo == null)
+ m_cmpInfo = (CultureInfo.GetCultureInfo(m_lcid)).CompareInfo;
}
public CompareInfo CompareInfo
@@ -270,7 +270,7 @@ namespace System.Data.SqlTypes
if (!IsNull)
{
SetCompareInfo();
- return _cmpInfo;
+ return m_cmpInfo;
}
else
throw new SqlNullValueException();
@@ -282,7 +282,7 @@ namespace System.Data.SqlTypes
get
{
if (!IsNull)
- return _flag;
+ return m_flag;
else
throw new SqlNullValueException();
}
@@ -305,7 +305,7 @@ namespace System.Data.SqlTypes
/// </summary>
public override string ToString()
{
- return IsNull ? SQLResource.NullString : _value;
+ return IsNull ? SQLResource.NullString : m_value;
}
public byte[] GetUnicodeBytes()
@@ -313,7 +313,7 @@ namespace System.Data.SqlTypes
if (IsNull)
return null;
- return s_unicodeEncoding.GetBytes(_value);
+ return s_unicodeEncoding.GetBytes(m_value);
}
public byte[] GetNonUnicodeBytes()
@@ -322,10 +322,10 @@ namespace System.Data.SqlTypes
return null;
// Get the CultureInfo
- CultureInfo culInfo = new CultureInfo(_lcid);
+ CultureInfo culInfo = new CultureInfo(m_lcid);
Encoding cpe = System.Text.Encoding.GetEncoding(culInfo.TextInfo.ANSICodePage);
- return cpe.GetBytes(_value);
+ return cpe.GetBytes(m_value);
}
/*
@@ -345,11 +345,11 @@ namespace System.Data.SqlTypes
if (x.IsNull || y.IsNull)
return SqlString.Null;
- if (x._lcid != y._lcid || x._flag != y._flag)
+ if (x.m_lcid != y.m_lcid || x.m_flag != y.m_flag)
throw new SqlTypeException(SQLResource.ConcatDiffCollationMessage);
- return new SqlString(x._lcid, x._flag, x._value + y._value,
- (x._cmpInfo == null) ? y._cmpInfo : x._cmpInfo);
+ return new SqlString(x.m_lcid, x.m_flag, x.m_value + y.m_value,
+ (x.m_cmpInfo == null) ? y.m_cmpInfo : x.m_cmpInfo);
}
// StringCompare: Common compare function which is used by Compare and CompareTo
@@ -361,19 +361,19 @@ namespace System.Data.SqlTypes
Debug.Assert(!x.IsNull && !y.IsNull,
"!x.IsNull && !y.IsNull", "Null condition should be handled by the caller of StringCompare method");
- if (x._lcid != y._lcid || x._flag != y._flag)
+ if (x.m_lcid != y.m_lcid || x.m_flag != y.m_flag)
throw new SqlTypeException(SQLResource.CompareDiffCollationMessage);
x.SetCompareInfo();
y.SetCompareInfo();
- Debug.Assert(x.FBinarySort() || (x._cmpInfo != null && y._cmpInfo != null),
+ Debug.Assert(x.FBinarySort() || (x.m_cmpInfo != null && y.m_cmpInfo != null),
"x.FBinarySort() || (x.m_cmpInfo != null && y.m_cmpInfo != null)", "");
int iCmpResult;
- if ((x._flag & SqlCompareOptions.BinarySort) != 0)
+ if ((x.m_flag & SqlCompareOptions.BinarySort) != 0)
iCmpResult = CompareBinary(x, y);
- else if ((x._flag & SqlCompareOptions.BinarySort2) != 0)
+ else if ((x.m_flag & SqlCompareOptions.BinarySort2) != 0)
iCmpResult = CompareBinary2(x, y);
else
{
@@ -381,8 +381,8 @@ namespace System.Data.SqlTypes
// Trim the trailing space for comparison
// Avoid using String.TrimEnd function to avoid extra string allocations
- string rgchX = x._value;
- string rgchY = y._value;
+ string rgchX = x.m_value;
+ string rgchY = y.m_value;
int cwchX = rgchX.Length;
int cwchY = rgchY.Length;
@@ -391,9 +391,9 @@ namespace System.Data.SqlTypes
while (cwchY > 0 && rgchY[cwchY - 1] == ' ')
cwchY--;
- CompareOptions options = CompareOptionsFromSqlCompareOptions(x._flag);
+ CompareOptions options = CompareOptionsFromSqlCompareOptions(x.m_flag);
- iCmpResult = x._cmpInfo.Compare(x._value, 0, cwchX, y._value, 0, cwchY, options);
+ iCmpResult = x.m_cmpInfo.Compare(x.m_value, 0, cwchX, y.m_value, 0, cwchY, options);
}
return iCmpResult;
@@ -519,7 +519,7 @@ namespace System.Data.SqlTypes
return new SqlString(true);
else
{
- SqlString ret = new SqlString(_value, _lcid, _flag);
+ SqlString ret = new SqlString(m_value, m_lcid, m_flag);
return ret;
}
}
@@ -699,7 +699,7 @@ namespace System.Data.SqlTypes
private bool FBinarySort()
{
- return (!IsNull && (_flag & (SqlCompareOptions.BinarySort | SqlCompareOptions.BinarySort2)) != 0);
+ return (!IsNull && (m_flag & (SqlCompareOptions.BinarySort | SqlCompareOptions.BinarySort2)) != 0);
}
// Wide-character string comparison for Binary Unicode Collation
@@ -711,8 +711,8 @@ namespace System.Data.SqlTypes
// Does a memory comparison.
private static int CompareBinary(SqlString x, SqlString y)
{
- byte[] rgDataX = s_unicodeEncoding.GetBytes(x._value);
- byte[] rgDataY = s_unicodeEncoding.GetBytes(y._value);
+ byte[] rgDataX = s_unicodeEncoding.GetBytes(x.m_value);
+ byte[] rgDataY = s_unicodeEncoding.GetBytes(y.m_value);
int cbX = rgDataX.Length;
int cbY = rgDataY.Length;
int cbMin = cbX < cbY ? cbX : cbY;
@@ -767,8 +767,8 @@ namespace System.Data.SqlTypes
{
Debug.Assert(!x.IsNull && !y.IsNull);
- string rgDataX = x._value;
- string rgDataY = y._value;
+ string rgDataX = x.m_value;
+ string rgDataY = y.m_value;
int cwchX = rgDataX.Length;
int cwchY = rgDataY.Length;
int cwchMin = cwchX < cwchY ? cwchX : cwchY;
@@ -892,7 +892,7 @@ namespace System.Data.SqlTypes
byte[] rgbSortKey;
if (FBinarySort())
- rgbSortKey = s_unicodeEncoding.GetBytes(_value.TrimEnd());
+ rgbSortKey = s_unicodeEncoding.GetBytes(m_value.TrimEnd());
else
{
// GetHashCode should not throw just because this instance has an invalid LCID or compare options.
@@ -901,8 +901,8 @@ namespace System.Data.SqlTypes
try
{
SetCompareInfo();
- cmpInfo = _cmpInfo;
- options = CompareOptionsFromSqlCompareOptions(_flag);
+ cmpInfo = m_cmpInfo;
+ options = CompareOptionsFromSqlCompareOptions(m_flag);
}
catch (ArgumentException)
{
@@ -911,7 +911,7 @@ namespace System.Data.SqlTypes
cmpInfo = CultureInfo.InvariantCulture.CompareInfo;
options = CompareOptions.None;
}
- rgbSortKey = cmpInfo.GetSortKey(_value.TrimEnd(), options).KeyData;
+ rgbSortKey = cmpInfo.GetSortKey(m_value.TrimEnd(), options).KeyData;
}
return SqlBinary.HashByteArray(rgbSortKey, rgbSortKey.Length);
@@ -926,12 +926,12 @@ namespace System.Data.SqlTypes
{
// Read the next value.
reader.ReadElementString();
- _fNotNull = false;
+ m_fNotNull = false;
}
else
{
- _value = reader.ReadElementString();
- _fNotNull = true;
+ m_value = reader.ReadElementString();
+ m_fNotNull = true;
}
}
@@ -943,7 +943,7 @@ namespace System.Data.SqlTypes
}
else
{
- writer.WriteString(_value);
+ writer.WriteString(m_value);
}
}
diff --git a/src/System.Data.Common/tests/System/Data/DataCommonEventSourceTest.cs b/src/System.Data.Common/tests/System/Data/DataCommonEventSourceTest.cs
index 9020b8d53f..ae63577d48 100644
--- a/src/System.Data.Common/tests/System/Data/DataCommonEventSourceTest.cs
+++ b/src/System.Data.Common/tests/System/Data/DataCommonEventSourceTest.cs
@@ -12,6 +12,7 @@ namespace System.Data.Tests
{
[Fact]
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20589", TargetFrameworkMonikers.UapAot)]
public void InvokeCodeThatShouldFirEvents_EnsureEventsFired()
{
using (var listener = new TestEventListener("System.Data.DataCommonEventSource", EventLevel.Verbose))
diff --git a/src/System.Data.SqlClient/tests/FunctionalTests/SqlConnectionTest.cs b/src/System.Data.SqlClient/tests/FunctionalTests/SqlConnectionTest.cs
index e032208f25..7cf0e3d1c7 100644
--- a/src/System.Data.SqlClient/tests/FunctionalTests/SqlConnectionTest.cs
+++ b/src/System.Data.SqlClient/tests/FunctionalTests/SqlConnectionTest.cs
@@ -27,6 +27,7 @@ namespace System.Data.SqlClient.Tests
[PlatformSpecific(TestPlatforms.Windows)] // Integ auth on Test server is supported on Windows right now
[ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] // https://github.com/dotnet/corefx/issues/19218
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20718", TargetFrameworkMonikers.UapAot)]
public void IntegratedAuthConnectionTest()
{
using (TestTdsServer server = TestTdsServer.StartTestServer())
diff --git a/src/System.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/CheckConstraints.cs b/src/System.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/CheckConstraints.cs
index c4e3206675..ff9d279278 100644
--- a/src/System.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/CheckConstraints.cs
+++ b/src/System.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/CheckConstraints.cs
@@ -22,7 +22,7 @@ namespace System.Data.SqlClient.ManualTesting.Tests
Helpers.Execute(dstCmd, "create table " + srctable + " (col1 int , col2 int, col3 text)");
Helpers.Execute(dstCmd, "insert into " + srctable + " values (33, 498, 'Michael')");
Helpers.Execute(dstCmd, "insert into " + srctable + " values (34, 499, 'Astrid')");
- Helpers.Execute(dstCmd, "insert into " + srctable + " values (65, 500, 'alles Käse')");
+ Helpers.Execute(dstCmd, "insert into " + srctable + " values (65, 500, 'alles Käse')");
Helpers.Execute(dstCmd, "create table " + dstTable + " (col1 int primary key, col2 int CONSTRAINT CK_" + dstTable + " CHECK (col2 < 500), col3 text)");
diff --git a/src/System.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/CopyVariants.cs b/src/System.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/CopyVariants.cs
index 054564a6a8..6dcaee2fea 100644
--- a/src/System.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/CopyVariants.cs
+++ b/src/System.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/CopyVariants.cs
@@ -29,7 +29,7 @@ namespace System.Data.SqlClient.ManualTesting.Tests
"insert into " + dstTable + "_src values (10, convert(uniqueidentifier, '00000000-0000-0000-0000-000000000009') )",
"insert into " + dstTable + "_src values (11, convert(varbinary(756), 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0A) )",
"insert into " + dstTable + "_src values (12, convert(varchar(756), '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101') )",
- "insert into " + dstTable + "_src values (13, convert(nvarchar(756), N'???a???????????????????????????????üböuaäZßABCÄboÜOUÖvrhÃã??z?????????????????z?????????A?????a???????????????????????????????üböuaäZßABCÄboÜOUÖvrhÃã??z?????????????????z?????????A?????a???????????????????????????????üböuaäZßABCÄboÜOUÖvrhÃã??z?????????????????z?????????A?????a???????????????????????????????üböuaäZßABCÄboÜOUÖvrhÃã??z?????????????????z?????????A?????a?????') )",
+ "insert into " + dstTable + "_src values (13, convert(nvarchar(756), N'???a???????????????????????????????üböuaäZßABCÄboÜOUÖvrhÃã??z?????????????????z?????????A?????a???????????????????????????????üböuaäZßABCÄboÜOUÖvrhÃã??z?????????????????z?????????A?????a???????????????????????????????üböuaäZßABCÄboÜOUÖvrhÃã??z?????????????????z?????????A?????a???????????????????????????????üböuaäZßABCÄboÜOUÖvrhÃã??z?????????????????z?????????A?????a?????') )",
"insert into " + dstTable + "_src values (14, convert(datetime, {ts '2003-01-11 12:54:01.133'}) )",
"insert into " + dstTable + "_src values (15, convert(bigint, 444444444444404) )",
"insert into " + dstTable + "_src values (16, convert(int, -555505) )",
@@ -76,4 +76,4 @@ namespace System.Data.SqlClient.ManualTesting.Tests
}
}
}
-} \ No newline at end of file
+}
diff --git a/src/System.Data.SqlClient/tests/ManualTests/SQL/SqlSchemaInfoTest/SqlSchemaInfoTest.cs b/src/System.Data.SqlClient/tests/ManualTests/SQL/SqlSchemaInfoTest/SqlSchemaInfoTest.cs
new file mode 100644
index 0000000000..53e76afabc
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/ManualTests/SQL/SqlSchemaInfoTest/SqlSchemaInfoTest.cs
@@ -0,0 +1,50 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Data.Common;
+using Xunit;
+
+namespace System.Data.SqlClient.ManualTesting.Tests
+{
+ public static class SqlSchemaInfoTest
+ {
+ [CheckConnStrSetupFact]
+ public static void TestGetSchema()
+ {
+ SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(DataTestUtility.TcpConnStr);
+ using (SqlConnection connection = new SqlConnection(builder.ConnectionString))
+ {
+ connection.Open();
+
+ DataTable dataTable = connection.GetSchema("DATABASES");
+
+ if (dataTable.Rows.Count > 0)
+ {
+ DataTable metaDataCollections = connection.GetSchema(DbMetaDataCollectionNames.MetaDataCollections);
+ Assert.True(metaDataCollections != null && metaDataCollections.Rows.Count > 0);
+
+ DataTable metaDataSourceInfo = connection.GetSchema(DbMetaDataCollectionNames.DataSourceInformation);
+ Assert.True(metaDataSourceInfo != null && metaDataSourceInfo.Rows.Count > 0);
+
+ DataTable metaDataTypes = connection.GetSchema(DbMetaDataCollectionNames.DataTypes);
+ Assert.True(metaDataTypes != null && metaDataTypes.Rows.Count > 0);
+ }
+
+ connection.Close();
+ }
+ }
+
+ [CheckConnStrSetupFact]
+ public static void TestCommandBuilder()
+ {
+ // CommandBuilder is not supported yet in .NET Core.
+ }
+
+ [CheckConnStrSetupFact]
+ public static void TestInitialCatalogStandardValues()
+ {
+ // PropertyDescriptor is not supported yet in .NET Core.
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/ManualTests/System.Data.SqlClient.ManualTesting.Tests.csproj b/src/System.Data.SqlClient/tests/ManualTests/System.Data.SqlClient.ManualTesting.Tests.csproj
index f3daace172..afa45def3d 100644
--- a/src/System.Data.SqlClient/tests/ManualTests/System.Data.SqlClient.ManualTesting.Tests.csproj
+++ b/src/System.Data.SqlClient/tests/ManualTests/System.Data.SqlClient.ManualTesting.Tests.csproj
@@ -57,6 +57,7 @@
<Compile Include="SQL\MARSSessionPoolingTest\MARSSessionPoolingTest.cs" />
<Compile Include="SQL\MARSTest\MARSTest.cs" />
<Compile Include="SQL\ParallelTransactionsTest\ParallelTransactionsTest.cs" />
+ <Compile Include="SQL\SqlSchemaInfoTest\SqlSchemaInfoTest.cs" />
<Compile Include="SQL\SqlBulkCopyTest\ErrorOnRowsMarkedAsDeleted.cs" />
<Compile Include="SQL\SqlBulkCopyTest\Bug84548.cs" />
<Compile Include="SQL\SqlBulkCopyTest\Bug85007.cs" />
diff --git a/src/System.Diagnostics.Contracts/tests/System.Diagnostics.Contracts.Tests.csproj b/src/System.Diagnostics.Contracts/tests/System.Diagnostics.Contracts.Tests.csproj
index 4475f1e1e4..e456d1d099 100644
--- a/src/System.Diagnostics.Contracts/tests/System.Diagnostics.Contracts.Tests.csproj
+++ b/src/System.Diagnostics.Contracts/tests/System.Diagnostics.Contracts.Tests.csproj
@@ -14,9 +14,12 @@
<Compile Include="ForAllTests.cs" />
<Compile Include="Utilities.cs" />
<Compile Include="ValueTests.cs" />
+ <Compile Include="$(CommonTestPath)\System\PlatformDetection.cs">
+ <Link>Common\System\PlatformDetection.cs</Link>
+ </Compile>
<Compile Include="$(CommonTestPath)\System\ShouldNotBeInvokedException.cs">
<Link>Common\System\ShouldNotBeInvokedException.cs</Link>
</Compile>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project> \ No newline at end of file
+</Project>
diff --git a/src/System.Diagnostics.Contracts/tests/Utilities.cs b/src/System.Diagnostics.Contracts/tests/Utilities.cs
index ef97c9208a..3f13aa9d52 100644
--- a/src/System.Diagnostics.Contracts/tests/Utilities.cs
+++ b/src/System.Diagnostics.Contracts/tests/Utilities.cs
@@ -14,7 +14,10 @@ namespace System.Diagnostics.Contracts.Tests
internal static void AssertThrowsContractException(Action action)
{
Exception exc = Assert.ThrowsAny<Exception>(action);
- Assert.Equal("ContractException", exc.GetType().Name);
+ if (!PlatformDetection.IsNetNative) // Cannot do internal framework Reflection on .Net Native
+ {
+ Assert.Equal("ContractException", exc.GetType().Name);
+ }
}
internal static IDisposable WithContractFailed(EventHandler<ContractFailedEventArgs> handler)
diff --git a/src/System.Diagnostics.DiagnosticSource/src/ActivityUserGuide.md b/src/System.Diagnostics.DiagnosticSource/src/ActivityUserGuide.md
index 80e5a9ade9..a66cb52d53 100644
--- a/src/System.Diagnostics.DiagnosticSource/src/ActivityUserGuide.md
+++ b/src/System.Diagnostics.DiagnosticSource/src/ActivityUserGuide.md
@@ -202,7 +202,7 @@ Activity.Id serves as hierarchical Request-Id in terms of [HTTP standard proposa
e.g.
-`|a000b421-5d183ab6-Server1.1.8e2d4c28_1.`
+`|a000b421-5d183ab6.1.8e2d4c28_1.`
It starts with '|' followed by [root-id](#root-id) followed by '.' and small identifiers of local Activities, separated by '.' or '_'.
@@ -217,7 +217,7 @@ Where base64 and '-' are used in nodes and other characters delimit nodes. Id al
### Root Id
When you start the first Activity for the operation, you may optionaly provide root-id through `Activity.SetParentId(string)` API.
-If you don't provide it, Activity will generate root-id: e.g. `a000b421-5d183ab6-Server1`
+If you don't provide it, Activity will generate root-id: e.g. `a000b421-5d183ab6`
If don't have ParentId from external process and want to generate one, keep in mind that Root-Id
* MUST be sufficiently large to identify single operation in entire system: use 64(or 128) bit random number or Guid
diff --git a/src/System.Diagnostics.DiagnosticSource/src/System.Diagnostics.DiagnosticSource.csproj b/src/System.Diagnostics.DiagnosticSource/src/System.Diagnostics.DiagnosticSource.csproj
index 9a49c6cadf..713e80bd4b 100644
--- a/src/System.Diagnostics.DiagnosticSource/src/System.Diagnostics.DiagnosticSource.csproj
+++ b/src/System.Diagnostics.DiagnosticSource/src/System.Diagnostics.DiagnosticSource.csproj
@@ -10,6 +10,7 @@
to work with older NuGet clients -->
<PackageTargetFramework Condition="'$(TargetGroup)' == 'netstandard1.1'">netstandard1.1;portable-net45+win8+wpa81</PackageTargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <BlockReflectionAttribute>false</BlockReflectionAttribute>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetGroup)' == 'netstandard1.1' OR '$(TargetGroup)' == 'net45'">
<DefineConstants>$(DefineConstants);NO_EVENTSOURCE_COMPLEX_TYPE_SUPPORT</DefineConstants>
diff --git a/src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.Current.net45.cs b/src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.Current.net45.cs
index b8b2bd24d8..d736712512 100644
--- a/src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.Current.net45.cs
+++ b/src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.Current.net45.cs
@@ -7,7 +7,8 @@ using System.Security;
namespace System.Diagnostics
{
- [Serializable]
+ // this code is specific to .NET 4.5 and uses CallContext to store Activity.Current which requires Activity to be Serializable.
+ [Serializable] // DO NOT remove
public partial class Activity
{
/// <summary>
@@ -34,8 +35,7 @@ namespace System.Diagnostics
}
#region private
-
- [Serializable]
+ [Serializable] // DO NOT remove
private partial class KeyValueListNode
{
}
diff --git a/src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs b/src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs
index 20ce673aa0..05c1afa314 100644
--- a/src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs
+++ b/src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs
@@ -45,11 +45,11 @@ namespace System.Diagnostics
/// See <see href="https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/ActivityUserGuide.md#id-format"/> for more details
/// </summary>
/// <example>
- /// Id looks like '|a000b421-5d183ab6-Server1.1.8e2d4c28_1.':<para />
- /// - '|a000b421-5d183ab6-Server1.' - Id of the first, top-most, Activity created<para />
- /// - '|a000b421-5d183ab6-Server1.1.' - Id of a child activity. It was started in the same process as the first activity and ends with '.'<para />
- /// - '|a000b421-5d183ab6-Server1.1.8e2d4c28_' - Id of the grand child activity. It was started in another process and ends with '_'<para />
- /// 'a000b421-5d183ab6-Server1' is a <see cref="RootId"/> for the first Activity and all its children
+ /// Id looks like '|a000b421-5d183ab6.1.8e2d4c28_1.':<para />
+ /// - '|a000b421-5d183ab6.' - Id of the first, top-most, Activity created<para />
+ /// - '|a000b421-5d183ab6.1.' - Id of a child activity. It was started in the same process as the first activity and ends with '.'<para />
+ /// - '|a000b421-5d183ab6.1.8e2d4c28_' - Id of the grand child activity. It was started in another process and ends with '_'<para />
+ /// 'a000b421-5d183ab6' is a <see cref="RootId"/> for the first Activity and all its children
/// </example>
public string Id { get; private set; }
@@ -421,7 +421,7 @@ namespace System.Diagnostics
}
//ParentId is not valid Request-Id, let's generate proper one.
- if (trimPosition == 0)
+ if (trimPosition == 1)
return GenerateRootId();
//generate overflow suffix
@@ -433,8 +433,7 @@ namespace System.Diagnostics
{
// It is important that the part that changes frequently be first, because
// many hash functions don't 'randomize' the tail of a string. This makes
- // sampling based on the hash produce poor samples. Thus the 'machine part'
- // of the ID is last.
+ // sampling based on the hash produce poor samples.
return '|' + Interlocked.Increment(ref s_currentRootId).ToString("x") + s_uniqSuffix;
}
#if ALLOW_PARTIALLY_TRUSTED_CALLERS
diff --git a/src/System.Diagnostics.DiagnosticSource/tests/ActivityTests.cs b/src/System.Diagnostics.DiagnosticSource/tests/ActivityTests.cs
index 1346801356..c99f28b473 100644
--- a/src/System.Diagnostics.DiagnosticSource/tests/ActivityTests.cs
+++ b/src/System.Diagnostics.DiagnosticSource/tests/ActivityTests.cs
@@ -127,6 +127,33 @@ namespace System.Diagnostics.Tests
}
/// <summary>
+ /// Tests overflow in Id generation when parentId has a single (root) node
+ /// </summary>
+ [Fact]
+ public void ActivityIdNonHierarchicalOverflow()
+ {
+ // find out Activity Id length on this platform in this AppDomain
+ Activity testActivity = new Activity("activity")
+ .Start();
+ var expectedIdLength = testActivity.Id.Length;
+ testActivity.Stop();
+
+ // check that if parentId '|aaa...a' 1024 bytes long is set with single node (no dots or underscores in the Id)
+ // it causes overflow during Id generation, and new root Id is generated for the new Activity
+ var parentId = '|' + new string('a', 1022) + '.';
+
+ var activity = new Activity("activity")
+ .SetParentId(parentId)
+ .Start();
+
+ Assert.Equal(parentId, activity.ParentId);
+
+ // With probability 1/MaxLong, Activity.Id length may be expectedIdLength + 1
+ Assert.InRange(activity.Id.Length, expectedIdLength, expectedIdLength + 1);
+ Assert.False(activity.Id.Contains('#'));
+ }
+
+ /// <summary>
/// Tests activity start and stop
/// Checks Activity.Current correctness, Id generation
/// </summary>
@@ -214,8 +241,8 @@ namespace System.Diagnostics.Tests
child1.SetParentId("123");
child1.Start();
Assert.Equal("123", child1.RootId);
- Assert.True(child1.Id[0] == '|');
- Assert.True(child1.Id[child1.Id.Length - 1] == '_');
+ Assert.Equal('|', child1.Id[0]);
+ Assert.Equal('_', child1.Id[child1.Id.Length - 1]);
child1.Stop();
var child2 = new Activity("child2");
@@ -296,7 +323,7 @@ namespace System.Diagnostics.Tests
// Let's check that duration is 1sec - maximum DateTime.UtcNow error or bigger.
// There is another test (ActivityDateTimeTests.StartStopReturnsPreciseDuration)
// that checks duration precision on netfx.
- Assert.True(activity.Duration.TotalMilliseconds >= 1000 - MaxClockErrorMSec);
+ Assert.InRange(activity.Duration.TotalMilliseconds, 1000 - MaxClockErrorMSec, double.MaxValue);
}
/// <summary>
@@ -423,10 +450,10 @@ namespace System.Diagnostics.Tests
// We 'fix' DateTime on netfx to be precise;
// comparing Activity StartTime to potentially imprecise DateTime.UtcNow is not correct
// this test does not intend fo check StartTime/Duration precision, so we allow anything within 20ms.
- Assert.True(startTime.AddMilliseconds(-1 * MaxClockErrorMSec) <= observer.Activity.StartTimeUtc);
- Assert.True(observer.Activity.StartTimeUtc < DateTime.UtcNow.AddMilliseconds(MaxClockErrorMSec));
+ Assert.InRange(observer.Activity.StartTimeUtc, startTime.AddMilliseconds(-1 * MaxClockErrorMSec), DateTime.MaxValue);
+ Assert.InRange(observer.Activity.StartTimeUtc, DateTime.MinValue, DateTime.UtcNow.AddMilliseconds(MaxClockErrorMSec).AddTicks(-1));
- Assert.True(observer.Activity.Duration == TimeSpan.Zero);
+ Assert.Equal(TimeSpan.Zero, observer.Activity.Duration);
observer.Reset();
@@ -439,10 +466,10 @@ namespace System.Diagnostics.Tests
// Confirm that duration is set.
Assert.NotNull(observer.Activity);
- Assert.True(TimeSpan.Zero < observer.Activity.Duration);
+ Assert.InRange(observer.Activity.Duration, TimeSpan.FromTicks(1), TimeSpan.MaxValue);
// let's only check that Duration is set in StopActivity, we do not intend to check precision here
- Assert.True(observer.Activity.StartTimeUtc + observer.Activity.Duration <= DateTime.UtcNow.AddMilliseconds(2 * MaxClockErrorMSec));
+ Assert.InRange(observer.Activity.StartTimeUtc + observer.Activity.Duration, DateTime.MinValue, DateTime.UtcNow.AddMilliseconds(2 * MaxClockErrorMSec));
}
}
}
diff --git a/src/System.Diagnostics.DiagnosticSource/tests/DiagnosticSourceEventSourceBridgeTests.cs b/src/System.Diagnostics.DiagnosticSource/tests/DiagnosticSourceEventSourceBridgeTests.cs
index 482c857715..2c48d49e03 100644
--- a/src/System.Diagnostics.DiagnosticSource/tests/DiagnosticSourceEventSourceBridgeTests.cs
+++ b/src/System.Diagnostics.DiagnosticSource/tests/DiagnosticSourceEventSourceBridgeTests.cs
@@ -22,6 +22,7 @@ namespace System.Diagnostics.Tests
/// the events you want.
/// </summary>
[Fact]
+ [ActiveIssue(20579,TargetFrameworkMonikers.UapAot)]
public void TestSpecificEvents()
{
using (var eventSourceListener = new TestDiagnosticSourceEventListener())
@@ -103,6 +104,7 @@ namespace System.Diagnostics.Tests
/// Test that things work properly for Linux newline conventions.
/// </summary>
[Fact]
+ [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot,"This is linux specific test")]
public void LinuxNewLineConventions()
{
using (var eventSourceListener = new TestDiagnosticSourceEventListener())
@@ -159,6 +161,7 @@ namespace System.Diagnostics.Tests
/// Tests what happens when you wildcard the source name (empty string)
/// </summary>
[Fact]
+ [ActiveIssue(20579, TargetFrameworkMonikers.UapAot)]
public void TestWildCardSourceName()
{
using (var eventSourceListener = new TestDiagnosticSourceEventListener())
@@ -220,6 +223,7 @@ namespace System.Diagnostics.Tests
/// Tests what happens when you wildcard event name (but not the source name)
/// </summary>
[Fact]
+ [ActiveIssue(20579, TargetFrameworkMonikers.UapAot)]
public void TestWildCardEventName()
{
using (var eventSourceListener = new TestDiagnosticSourceEventListener())
@@ -276,6 +280,7 @@ namespace System.Diagnostics.Tests
/// ignored.
/// </summary>
[Fact]
+ [ActiveIssue(20579, TargetFrameworkMonikers.UapAot)]
public void TestNulls()
{
using (var eventSourceListener = new TestDiagnosticSourceEventListener())
@@ -354,6 +359,7 @@ namespace System.Diagnostics.Tests
/// of the payload object.
/// </summary>
[Fact]
+ [ActiveIssue(20579, TargetFrameworkMonikers.UapAot)]
public void TestNoImplicitTransforms()
{
using (var eventSourceListener = new TestDiagnosticSourceEventListener())
@@ -384,6 +390,7 @@ namespace System.Diagnostics.Tests
/// Tests what happens when wacky characters are used in property specs.
/// </summary>
[Fact]
+ [ActiveIssue(20579, TargetFrameworkMonikers.UapAot)]
public void TestBadProperties()
{
using (var eventSourceListener = new TestDiagnosticSourceEventListener())
@@ -443,6 +450,7 @@ namespace System.Diagnostics.Tests
/// Tests the feature to send the messages as EventSource Activities.
/// </summary>
[Fact]
+ [ActiveIssue(20579, TargetFrameworkMonikers.UapAot)]
public void TestActivities()
{
using (var eventSourceListener = new TestDiagnosticSourceEventListener())
@@ -513,6 +521,7 @@ namespace System.Diagnostics.Tests
/// Tests that keywords that define shortcuts work.
/// </summary>
[Fact]
+ [ActiveIssue(20579, TargetFrameworkMonikers.UapAot)]
public void TestShortcutKeywords()
{
using (var eventSourceListener = new TestDiagnosticSourceEventListener())
diff --git a/src/System.Diagnostics.Process/tests/ProcessCollectionTests.cs b/src/System.Diagnostics.Process/tests/ProcessCollectionTests.cs
index 3a4e3976b7..9f8dd3818e 100644
--- a/src/System.Diagnostics.Process/tests/ProcessCollectionTests.cs
+++ b/src/System.Diagnostics.Process/tests/ProcessCollectionTests.cs
@@ -59,6 +59,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestThreadCollectionBehavior()
{
CreateDefaultProcess();
diff --git a/src/System.Diagnostics.Process/tests/ProcessStandardConsoleTests.cs b/src/System.Diagnostics.Process/tests/ProcessStandardConsoleTests.cs
index 95e46e1f88..0a158a0ed6 100644
--- a/src/System.Diagnostics.Process/tests/ProcessStandardConsoleTests.cs
+++ b/src/System.Diagnostics.Process/tests/ProcessStandardConsoleTests.cs
@@ -14,6 +14,7 @@ namespace System.Diagnostics.Tests
private const int s_ConsoleEncoding = 437;
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestChangesInConsoleEncoding()
{
Action<int> run = expectedCodePage =>
diff --git a/src/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs b/src/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs
index e107579223..dab8e3ee28 100644
--- a/src/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs
+++ b/src/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs
@@ -196,6 +196,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestEnvironmentOfChildProcess()
{
const string ItemSeparator = "CAFF9451396B4EEF8A5155A15BDC2080"; // random string that shouldn't be in any env vars; used instead of newline to separate env var strings
@@ -322,6 +323,7 @@ namespace System.Diagnostics.Tests
}
[Theory, InlineData(true), InlineData(false)]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestCreateNoWindowProperty(bool value)
{
Process testProcess = CreateProcessLong();
@@ -342,6 +344,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestWorkingDirectoryProperty()
{
CreateDefaultProcess();
@@ -506,6 +509,13 @@ namespace System.Diagnostics.Tests
{
var psi = new ProcessStartInfo { FileName = $"{Process.GetCurrentProcess().ProcessName}.exe" };
+ if (PlatformDetection.IsNetNative)
+ {
+ // UapAot doesn't have RegistryKey apis available so ProcessStartInfo.Verbs returns Array<string>.Empty().
+ Assert.Equal(0, psi.Verbs.Length);
+ return;
+ }
+
Assert.Contains("open", psi.Verbs, StringComparer.OrdinalIgnoreCase);
if (PlatformDetection.IsNotWindowsNanoServer)
{
@@ -944,7 +954,7 @@ namespace System.Diagnostics.Tests
FileName = @"http://www.microsoft.com"
};
- Process.Start(info);
+ Process.Start(info); // Returns null after navigating browser
}
[ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] // No Notepad on Nano
@@ -967,6 +977,8 @@ namespace System.Diagnostics.Tests
using (var process = Process.Start(info))
{
+ Assert.True(process != null, $"Could not start {info.FileName} {info.Arguments} UseShellExecute={info.UseShellExecute}");
+
try
{
process.WaitForInputIdle(); // Give the file a chance to load
@@ -977,7 +989,8 @@ namespace System.Diagnostics.Tests
}
finally
{
- process.Kill();
+ if (process != null && !process.HasExited)
+ process.Kill();
}
}
}
@@ -986,6 +999,7 @@ namespace System.Diagnostics.Tests
[OuterLoop("Launches notepad")]
[PlatformSpecific(TestPlatforms.Windows)]
[SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "https://github.com/dotnet/corefx/issues/20204")]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20388")]
public void StartInfo_TextFile_ShellExecute()
{
string tempFile = GetTestFilePath() + ".txt";
@@ -1000,6 +1014,8 @@ namespace System.Diagnostics.Tests
using (var process = Process.Start(info))
{
+ Assert.True(process != null, $"Could not start {info.FileName} UseShellExecute={info.UseShellExecute}");
+
try
{
process.WaitForInputIdle(); // Give the file a chance to load
@@ -1010,7 +1026,8 @@ namespace System.Diagnostics.Tests
}
finally
{
- process.Kill();
+ if (process != null && !process.HasExited)
+ process.Kill();
}
}
}
diff --git a/src/System.Diagnostics.Process/tests/ProcessStreamReadTests.cs b/src/System.Diagnostics.Process/tests/ProcessStreamReadTests.cs
index f08acfa95f..45903ef802 100644
--- a/src/System.Diagnostics.Process/tests/ProcessStreamReadTests.cs
+++ b/src/System.Diagnostics.Process/tests/ProcessStreamReadTests.cs
@@ -10,6 +10,7 @@ using Xunit;
namespace System.Diagnostics.Tests
{
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public class ProcessStreamReadTests : ProcessTestBase
{
[Fact]
diff --git a/src/System.Diagnostics.Process/tests/ProcessTests.cs b/src/System.Diagnostics.Process/tests/ProcessTests.cs
index d48f2dd67a..476fb69523 100644
--- a/src/System.Diagnostics.Process/tests/ProcessTests.cs
+++ b/src/System.Diagnostics.Process/tests/ProcessTests.cs
@@ -60,6 +60,7 @@ namespace System.Diagnostics.Tests
[ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))]
[PlatformSpecific(TestPlatforms.Windows)] // Expected behavior varies on Windows and Unix
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestBasePriorityOnWindows()
{
CreateDefaultProcess();
@@ -89,6 +90,7 @@ namespace System.Diagnostics.Tests
[InlineData(true)]
[InlineData(false)]
[InlineData(null)]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestEnableRaiseEvents(bool? enable)
{
bool exitedInvoked = false;
@@ -118,6 +120,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestExitCode()
{
{
@@ -135,6 +138,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestExitTime()
{
// ExitTime resolution on some platforms is less accurate than our DateTime.UtcNow resolution, so
@@ -162,6 +166,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestId()
{
CreateDefaultProcess();
@@ -178,6 +183,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestHasExited()
{
{
@@ -219,6 +225,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestMachineName()
{
CreateDefaultProcess();
@@ -245,6 +252,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestMaxWorkingSet()
{
CreateDefaultProcess();
@@ -299,6 +307,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestMinWorkingSet()
{
CreateDefaultProcess();
@@ -370,6 +379,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestNonpagedSystemMemorySize64()
{
CreateDefaultProcess();
@@ -385,6 +395,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestPagedMemorySize64()
{
CreateDefaultProcess();
@@ -400,6 +411,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestPagedSystemMemorySize64()
{
CreateDefaultProcess();
@@ -415,6 +427,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestPeakPagedMemorySize64()
{
CreateDefaultProcess();
@@ -430,6 +443,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestPeakVirtualMemorySize64()
{
CreateDefaultProcess();
@@ -445,6 +459,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestPeakWorkingSet64()
{
CreateDefaultProcess();
@@ -460,6 +475,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestPrivateMemorySize64()
{
CreateDefaultProcess();
@@ -475,6 +491,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestVirtualMemorySize64()
{
CreateDefaultProcess();
@@ -490,6 +507,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestWorkingSet64()
{
CreateDefaultProcess();
@@ -512,6 +530,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestProcessorTime()
{
CreateDefaultProcess();
@@ -555,6 +574,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestProcessStartTime()
{
TimeSpan allowedWindow = TimeSpan.FromSeconds(3);
@@ -579,6 +599,7 @@ namespace System.Diagnostics.Tests
[Fact]
[PlatformSpecific(~TestPlatforms.OSX)] // getting/setting affinity not supported on OSX
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestProcessorAffinity()
{
CreateDefaultProcess();
@@ -597,6 +618,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestPriorityBoostEnabled()
{
CreateDefaultProcess();
@@ -626,6 +648,7 @@ namespace System.Diagnostics.Tests
}
[Fact, PlatformSpecific(TestPlatforms.Windows)] // Expected behavior varies on Windows and Unix
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestPriorityClassWindows()
{
CreateDefaultProcess();
@@ -662,12 +685,13 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestProcessName()
{
CreateDefaultProcess();
// Processes are not hosted by dotnet in the full .NET Framework.
- string expected = PlatformDetection.IsFullFramework ? TestConsoleApp : HostRunner;
+ string expected = PlatformDetection.IsFullFramework || PlatformDetection.IsNetNative ? TestConsoleApp : HostRunner;
Assert.Equal(Path.GetFileNameWithoutExtension(_process.ProcessName), Path.GetFileNameWithoutExtension(expected), StringComparer.OrdinalIgnoreCase);
}
@@ -679,6 +703,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestSafeHandle()
{
CreateDefaultProcess();
@@ -694,6 +719,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestSessionId()
{
CreateDefaultProcess();
@@ -732,6 +758,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestGetProcessById()
{
CreateDefaultProcess();
@@ -773,6 +800,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void GetProcessesByName_ProcessName_ReturnsExpected()
{
// Get the current process using its name
@@ -874,13 +902,14 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void StartInfo_GetFileName_ReturnsExpected()
{
Process process = CreateProcessLong();
process.Start();
// Processes are not hosted by dotnet in the full .NET Framework.
- string expectedFileName = PlatformDetection.IsFullFramework ? TestConsoleApp : HostRunner;
+ string expectedFileName = PlatformDetection.IsFullFramework || PlatformDetection.IsNetNative ? TestConsoleApp : HostRunner;
Assert.Equal(expectedFileName, process.StartInfo.FileName);
process.Kill();
@@ -888,6 +917,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void StartInfo_SetOnRunningProcess_ThrowsInvalidOperationException()
{
Process process = CreateProcessLong();
@@ -922,7 +952,7 @@ namespace System.Diagnostics.Tests
public void StartInfo_SetNull_ThrowsArgumentNullException()
{
var process = new Process();
- Assert.Throws<ArgumentNullException>("value", () => process.StartInfo = null);
+ Assert.Throws<ArgumentNullException>(() => process.StartInfo = null);
}
[Fact]
@@ -954,6 +984,7 @@ namespace System.Diagnostics.Tests
[InlineData(@"a""b c""d e""f g""h i""j k""l", @"ab cd,ef gh,ij kl")]
[InlineData(@"a b c""def", @"a,b,cdef")]
[InlineData(@"""\a\"" \\""\\\ b c", @"\a"" \\\\,b,c")]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)] // Process.Start returns null in UapAot due to this issue, so it throws NRE.
public void TestArgumentParsing(string inputArguments, string expectedArgv)
{
using (var handle = RemoteInvokeRaw((Func<string, string, string, int>)ConcatThreeArguments,
@@ -1126,6 +1157,7 @@ namespace System.Diagnostics.Tests
[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // MainWindowHandle is not supported on Unix.
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void MainWindowHandle_NoWindow_ReturnsEmptyHandle()
{
CreateDefaultProcess();
@@ -1142,6 +1174,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void MainWindowTitle_NoWindow_ReturnsEmpty()
{
CreateDefaultProcess();
@@ -1159,6 +1192,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void CloseMainWindow_NoWindow_ReturnsFalse()
{
CreateDefaultProcess();
@@ -1193,6 +1227,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestNonpagedSystemMemorySize()
{
CreateDefaultProcess();
@@ -1212,6 +1247,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestPagedMemorySize()
{
CreateDefaultProcess();
@@ -1231,6 +1267,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestPagedSystemMemorySize()
{
CreateDefaultProcess();
@@ -1250,6 +1287,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestPeakPagedMemorySize()
{
CreateDefaultProcess();
@@ -1269,6 +1307,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestPeakVirtualMemorySize()
{
CreateDefaultProcess();
@@ -1288,6 +1327,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestPeakWorkingSet()
{
CreateDefaultProcess();
@@ -1307,6 +1347,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestPrivateMemorySize()
{
CreateDefaultProcess();
@@ -1326,6 +1367,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestVirtualMemorySize()
{
CreateDefaultProcess();
@@ -1345,6 +1387,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestWorkingSet()
{
CreateDefaultProcess();
@@ -1392,6 +1435,7 @@ namespace System.Diagnostics.Tests
[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // Starting process with authentication not supported on Unix
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void Process_StartTest()
{
string currentProcessName = GetCurrentProcessName();
@@ -1412,6 +1456,7 @@ namespace System.Diagnostics.Tests
[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // Starting process with authentication not supported on Unix
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void Process_StartWithArgumentsTest()
{
string currentProcessName = GetCurrentProcessName();
diff --git a/src/System.Diagnostics.Process/tests/ProcessThreadTests.cs b/src/System.Diagnostics.Process/tests/ProcessThreadTests.cs
index b2c5945536..38a291054f 100644
--- a/src/System.Diagnostics.Process/tests/ProcessThreadTests.cs
+++ b/src/System.Diagnostics.Process/tests/ProcessThreadTests.cs
@@ -14,6 +14,7 @@ namespace System.Diagnostics.Tests
public class ProcessThreadTests : ProcessTestBase
{
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestCommonPriorityAndTimeProperties()
{
CreateDefaultProcess();
@@ -153,6 +154,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestPriorityLevelProperty()
{
CreateDefaultProcess();
@@ -186,6 +188,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void TestThreadStateProperty()
{
CreateDefaultProcess();
@@ -198,6 +201,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void Threads_GetMultipleTimes_ReturnsSameInstance()
{
CreateDefaultProcess();
diff --git a/src/System.Diagnostics.Process/tests/ProcessWaitingTests.cs b/src/System.Diagnostics.Process/tests/ProcessWaitingTests.cs
index e0d20fc299..6a4809dc9c 100644
--- a/src/System.Diagnostics.Process/tests/ProcessWaitingTests.cs
+++ b/src/System.Diagnostics.Process/tests/ProcessWaitingTests.cs
@@ -11,6 +11,7 @@ namespace System.Diagnostics.Tests
public class ProcessWaitingTests : ProcessTestBase
{
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void MultipleProcesses_StartAllKillAllWaitAll()
{
const int Iters = 10;
@@ -22,6 +23,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void MultipleProcesses_SerialStartKillWait()
{
const int Iters = 10;
@@ -35,6 +37,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void MultipleProcesses_ParallelStartKillWait()
{
const int Tasks = 4, ItersPerTask = 10;
@@ -60,6 +63,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void SingleProcess_TryWaitMultipleTimesBeforeCompleting()
{
Process p = CreateProcessLong();
@@ -82,6 +86,7 @@ namespace System.Diagnostics.Tests
[Theory]
[InlineData(false)]
[InlineData(true)]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public async Task SingleProcess_WaitAfterExited(bool addHandlerBeforeStart)
{
Process p = CreateProcessLong();
@@ -123,6 +128,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void SingleProcess_CopiesShareExitInformation()
{
Process p = CreateProcessLong();
@@ -141,6 +147,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void WaitForPeerProcess()
{
Process child1 = CreateProcessLong();
@@ -168,6 +175,7 @@ namespace System.Diagnostics.Tests
[Fact]
[ActiveIssue(15844, TestPlatforms.AnyUnix)]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void WaitChain()
{
Process root = CreateProcess(() =>
@@ -195,6 +203,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909", TargetFrameworkMonikers.UapAot)]
public void WaitForSelfTerminatingChild()
{
Process child = CreateProcess(() =>
diff --git a/src/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestUtilities.cs b/src/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestUtilities.cs
index 2f910ef4d6..0af8d460bb 100644
--- a/src/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestUtilities.cs
+++ b/src/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestUtilities.cs
@@ -26,7 +26,9 @@ namespace BasicEventSourceTests
if (eventSource.Name != "System.Threading.Tasks.TplEventSource" &&
eventSource.Name != "System.Diagnostics.Eventing.FrameworkEventSource" &&
eventSource.Name != "System.Buffers.ArrayPoolEventSource" &&
- eventSource.Name != "System.Threading.SynchronizationEventSource")
+ eventSource.Name != "System.Threading.SynchronizationEventSource" &&
+ eventSource.Name != "System.Runtime.InteropServices.InteropEventProvider"
+ )
{
eventSourceNames += eventSource.Name + " ";
}
diff --git a/src/System.DirectoryServices.AccountManagement/dir.props b/src/System.DirectoryServices.AccountManagement/dir.props
index da96bce0a4..6f104b7b76 100644
--- a/src/System.DirectoryServices.AccountManagement/dir.props
+++ b/src/System.DirectoryServices.AccountManagement/dir.props
@@ -2,7 +2,9 @@
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
- <AssemblyKey>Open</AssemblyKey>
+ <AssemblyVersion>4.0.0.0</AssemblyVersion>
+ <AssemblyKey>MSFT</AssemblyKey>
+ <!-- disable package until https://github.com/dotnet/corefx/issues/18090 is addressed -->
+ <ShouldCreatePackage>false</ShouldCreatePackage>
</PropertyGroup>
</Project> \ No newline at end of file
diff --git a/src/System.DirectoryServices.AccountManagement/pkg/System.DirectoryServices.AccountManagement.pkgproj b/src/System.DirectoryServices.AccountManagement/pkg/System.DirectoryServices.AccountManagement.pkgproj
index 1158843eac..4850709dd0 100644
--- a/src/System.DirectoryServices.AccountManagement/pkg/System.DirectoryServices.AccountManagement.pkgproj
+++ b/src/System.DirectoryServices.AccountManagement/pkg/System.DirectoryServices.AccountManagement.pkgproj
@@ -3,15 +3,15 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.DirectoryServices.AccountManagement.csproj">
- <SupportedFramework>netcoreapp2.0;$(AllXamarinFrameworks)</SupportedFramework>
+ <SupportedFramework>netcoreapp2.0;net45;$(AllXamarinFrameworks)</SupportedFramework>
</ProjectReference>
<ProjectReference Include="..\src\System.DirectoryServices.AccountManagement.csproj" />
- <InboxOnTargetFramework Include="MonoAndroid10" />
- <InboxOnTargetFramework Include="MonoTouch10" />
- <InboxOnTargetFramework Include="xamarinios10" />
- <InboxOnTargetFramework Include="xamarinmac20" />
- <InboxOnTargetFramework Include="xamarintvos10" />
- <InboxOnTargetFramework Include="xamarinwatchos10" />
+ <InboxOnTargetFramework Include="net45">
+ <AsFrameworkReference>true</AsFrameworkReference>
+ </InboxOnTargetFramework>
+ <File Include="$(PlaceHolderFile)">
+ <TargetPath>runtimes/win/lib/net45</TargetPath>
+ </File>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project> \ No newline at end of file
diff --git a/src/System.DirectoryServices.AccountManagement/src/Configurations.props b/src/System.DirectoryServices.AccountManagement/src/Configurations.props
index bddb58f02a..64d654a29f 100644
--- a/src/System.DirectoryServices.AccountManagement/src/Configurations.props
+++ b/src/System.DirectoryServices.AccountManagement/src/Configurations.props
@@ -3,6 +3,7 @@
<PropertyGroup>
<BuildConfigurations>
netstandard-Windows_NT;
+ netstandard;
</BuildConfigurations>
</PropertyGroup>
</Project>
diff --git a/src/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj b/src/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj
index 286ec44d06..de3dfa5061 100644
--- a/src/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj
+++ b/src/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj
@@ -10,10 +10,13 @@
<!-- Although we have a netstandard configuration, we know we are not currently UAP compatible-->
<UWPCompatible>false</UWPCompatible>
<IncludeDllSafeSearchPathAttribute>true</IncludeDllSafeSearchPathAttribute>
+ <GeneratePlatformNotSupportedAssembly Condition="'$(TargetsWindows)' != 'true'">true</GeneratePlatformNotSupportedAssembly>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Windows_NT-Release|AnyCPU'" />
- <ItemGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
+ <ItemGroup Condition="'$(TargetsWindows)' == 'true'">
<Compile Include="System\DirectoryServices\AccountManagement\externdll.cs" />
<Compile Include="System\DirectoryServices\AccountManagement\interopt.cs" />
<Compile Include="System\DirectoryServices\AccountManagement\PrincipalSearcher.cs" />
diff --git a/src/System.DirectoryServices.Protocols/dir.props b/src/System.DirectoryServices.Protocols/dir.props
index da96bce0a4..6f104b7b76 100644
--- a/src/System.DirectoryServices.Protocols/dir.props
+++ b/src/System.DirectoryServices.Protocols/dir.props
@@ -2,7 +2,9 @@
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
- <AssemblyKey>Open</AssemblyKey>
+ <AssemblyVersion>4.0.0.0</AssemblyVersion>
+ <AssemblyKey>MSFT</AssemblyKey>
+ <!-- disable package until https://github.com/dotnet/corefx/issues/18090 is addressed -->
+ <ShouldCreatePackage>false</ShouldCreatePackage>
</PropertyGroup>
</Project> \ No newline at end of file
diff --git a/src/System.DirectoryServices.Protocols/pkg/System.DirectoryServices.Protocols.pkgproj b/src/System.DirectoryServices.Protocols/pkg/System.DirectoryServices.Protocols.pkgproj
index 3f3cf98a19..7f056cb3a0 100644
--- a/src/System.DirectoryServices.Protocols/pkg/System.DirectoryServices.Protocols.pkgproj
+++ b/src/System.DirectoryServices.Protocols/pkg/System.DirectoryServices.Protocols.pkgproj
@@ -3,15 +3,16 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.DirectoryServices.Protocols.csproj">
- <SupportedFramework>netcoreapp2.0;$(AllXamarinFrameworks)</SupportedFramework>
+ <SupportedFramework>netcoreapp2.0;net45;$(AllXamarinFrameworks)</SupportedFramework>
</ProjectReference>
<ProjectReference Include="..\src\System.DirectoryServices.Protocols.csproj" />
- <InboxOnTargetFramework Include="MonoAndroid10" />
- <InboxOnTargetFramework Include="MonoTouch10" />
- <InboxOnTargetFramework Include="xamarinios10" />
- <InboxOnTargetFramework Include="xamarinmac20" />
- <InboxOnTargetFramework Include="xamarintvos10" />
- <InboxOnTargetFramework Include="xamarinwatchos10" />
+
+ <InboxOnTargetFramework Include="net45">
+ <AsFrameworkReference>true</AsFrameworkReference>
+ </InboxOnTargetFramework>
+ <File Include="$(PlaceHolderFile)">
+ <TargetPath>runtimes/win/lib/net45</TargetPath>
+ </File>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project> \ No newline at end of file
diff --git a/src/System.DirectoryServices.Protocols/src/Configurations.props b/src/System.DirectoryServices.Protocols/src/Configurations.props
index 5b22dd27d3..ae7f026927 100644
--- a/src/System.DirectoryServices.Protocols/src/Configurations.props
+++ b/src/System.DirectoryServices.Protocols/src/Configurations.props
@@ -3,6 +3,7 @@
<PropertyGroup>
<BuildConfigurations>
netstandard-Windows_NT;
+ netstandard;
</BuildConfigurations>
</PropertyGroup>
</Project>
diff --git a/src/System.DirectoryServices.Protocols/src/FxCopBaseline.AnyOS.cs b/src/System.DirectoryServices.Protocols/src/FxCopBaseline.AnyOS.cs
new file mode 100644
index 0000000000..8f8b8d9856
--- /dev/null
+++ b/src/System.DirectoryServices.Protocols/src/FxCopBaseline.AnyOS.cs
@@ -0,0 +1 @@
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA1821", Justification = "Finalizer has implementation in Windows version.")] \ No newline at end of file
diff --git a/src/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj b/src/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj
index 0d9e335bb3..5022bf78e2 100644
--- a/src/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj
+++ b/src/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj
@@ -9,10 +9,16 @@
<!-- Although we have a netstandard configuration, we know we are not currently UAP compatible-->
<UWPCompatible>false</UWPCompatible>
<IncludeDllSafeSearchPathAttribute>true</IncludeDllSafeSearchPathAttribute>
+ <GeneratePlatformNotSupportedAssembly Condition="'$(TargetsWindows)' != 'true'">true</GeneratePlatformNotSupportedAssembly>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Windows_NT-Release|AnyCPU'" />
- <ItemGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
+ <ItemGroup Condition="'$(TargetsWindows)' != 'true'">
+ <Compile Include="FxCopBaseline.AnyOS.cs" />
+ </ItemGroup>
+ <ItemGroup Condition="'$(TargetsWindows)' == 'true'">
<Compile Include="System\DirectoryServices\Protocols\externdll.cs" />
<Compile Include="System\DirectoryServices\Protocols\common\AuthTypes.cs" />
<Compile Include="System\DirectoryServices\Protocols\common\BerConverter.cs" />
diff --git a/src/System.DirectoryServices/dir.props b/src/System.DirectoryServices/dir.props
index da96bce0a4..6f104b7b76 100644
--- a/src/System.DirectoryServices/dir.props
+++ b/src/System.DirectoryServices/dir.props
@@ -2,7 +2,9 @@
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
- <AssemblyKey>Open</AssemblyKey>
+ <AssemblyVersion>4.0.0.0</AssemblyVersion>
+ <AssemblyKey>MSFT</AssemblyKey>
+ <!-- disable package until https://github.com/dotnet/corefx/issues/18090 is addressed -->
+ <ShouldCreatePackage>false</ShouldCreatePackage>
</PropertyGroup>
</Project> \ No newline at end of file
diff --git a/src/System.DirectoryServices/pkg/System.DirectoryServices.pkgproj b/src/System.DirectoryServices/pkg/System.DirectoryServices.pkgproj
index 11e3eb5b54..c750a9d9c5 100644
--- a/src/System.DirectoryServices/pkg/System.DirectoryServices.pkgproj
+++ b/src/System.DirectoryServices/pkg/System.DirectoryServices.pkgproj
@@ -3,15 +3,16 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.DirectoryServices.csproj">
- <SupportedFramework>netcoreapp2.0;$(AllXamarinFrameworks)</SupportedFramework>
+ <SupportedFramework>netcoreapp2.0;net45;$(AllXamarinFrameworks)</SupportedFramework>
</ProjectReference>
<ProjectReference Include="..\src\System.DirectoryServices.csproj" />
- <InboxOnTargetFramework Include="MonoAndroid10" />
- <InboxOnTargetFramework Include="MonoTouch10" />
- <InboxOnTargetFramework Include="xamarinios10" />
- <InboxOnTargetFramework Include="xamarinmac20" />
- <InboxOnTargetFramework Include="xamarintvos10" />
- <InboxOnTargetFramework Include="xamarinwatchos10" />
+
+ <InboxOnTargetFramework Include="net45">
+ <AsFrameworkReference>true</AsFrameworkReference>
+ </InboxOnTargetFramework>
+ <File Include="$(PlaceHolderFile)">
+ <TargetPath>runtimes/win/lib/net45</TargetPath>
+ </File>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project> \ No newline at end of file
diff --git a/src/System.DirectoryServices/src/Configurations.props b/src/System.DirectoryServices/src/Configurations.props
index bddb58f02a..64d654a29f 100644
--- a/src/System.DirectoryServices/src/Configurations.props
+++ b/src/System.DirectoryServices/src/Configurations.props
@@ -3,6 +3,7 @@
<PropertyGroup>
<BuildConfigurations>
netstandard-Windows_NT;
+ netstandard;
</BuildConfigurations>
</PropertyGroup>
</Project>
diff --git a/src/System.DirectoryServices/src/FxCopBaseline.AnyOS.cs b/src/System.DirectoryServices/src/FxCopBaseline.AnyOS.cs
new file mode 100644
index 0000000000..8f8b8d9856
--- /dev/null
+++ b/src/System.DirectoryServices/src/FxCopBaseline.AnyOS.cs
@@ -0,0 +1 @@
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA1821", Justification = "Finalizer has implementation in Windows version.")] \ No newline at end of file
diff --git a/src/System.DirectoryServices/src/System.DirectoryServices.csproj b/src/System.DirectoryServices/src/System.DirectoryServices.csproj
index 6714394362..bb6f01fa4f 100644
--- a/src/System.DirectoryServices/src/System.DirectoryServices.csproj
+++ b/src/System.DirectoryServices/src/System.DirectoryServices.csproj
@@ -8,10 +8,16 @@
<NoWarn>$(NoWarn);0649</NoWarn>
<!-- Although we have a netstandard configuration, we know we are not currently UAP compatible-->
<UWPCompatible>false</UWPCompatible>
+ <GeneratePlatformNotSupportedAssembly Condition="'$(TargetsWindows)' != 'true'">true</GeneratePlatformNotSupportedAssembly>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Windows_NT-Release|AnyCPU'" />
- <ItemGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
+ <ItemGroup Condition="'$(TargetsWindows)' != 'true'">
+ <Compile Include="FxCopBaseline.AnyOS.cs" />
+ </ItemGroup>
+ <ItemGroup Condition="'$(TargetsWindows)' == 'true'">
<Compile Include="System\DirectoryServices\externdll.cs" />
<Compile Include="System\DirectoryServices\PrivilegedConfigurationManager.cs" />
<Compile Include="System\DirectoryServices\ActiveDirectorySecurity.cs" />
diff --git a/src/System.Drawing.Common/System.Drawing.Common.sln b/src/System.Drawing.Common/System.Drawing.Common.sln
new file mode 100644
index 0000000000..935e8397f2
--- /dev/null
+++ b/src/System.Drawing.Common/System.Drawing.Common.sln
@@ -0,0 +1,45 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.26228.10
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Drawing.Common", "src\System.Drawing.Common.csproj", "{191B3618-FECD-4ABD-9D6B-5AC90DC33621}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E107E9C1-E893-4E87-987E-04EF0DCEAEFD}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{A6F820B0-2679-4543-AE8B-CB9BB71FF175}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Drawing.Common.Tests", "tests\System.Drawing.Common.Tests.csproj", "{4B93E684-0630-45F4-8F63-6C7788C9892F}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ netcoreapp-Windows_NT-Debug|Any CPU = netcoreapp-Windows_NT-Debug|Any CPU
+ netcoreapp-Windows_NT-Release|Any CPU = netcoreapp-Windows_NT-Release|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {191B3618-FECD-4ABD-9D6B-5AC90DC33621}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
+ {191B3618-FECD-4ABD-9D6B-5AC90DC33621}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
+ {191B3618-FECD-4ABD-9D6B-5AC90DC33621}.netcoreapp-Windows_NT-Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
+ {191B3618-FECD-4ABD-9D6B-5AC90DC33621}.netcoreapp-Windows_NT-Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
+ {191B3618-FECD-4ABD-9D6B-5AC90DC33621}.netcoreapp-Windows_NT-Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
+ {191B3618-FECD-4ABD-9D6B-5AC90DC33621}.netcoreapp-Windows_NT-Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
+ {191B3618-FECD-4ABD-9D6B-5AC90DC33621}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
+ {191B3618-FECD-4ABD-9D6B-5AC90DC33621}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
+ {4B93E684-0630-45F4-8F63-6C7788C9892F}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
+ {4B93E684-0630-45F4-8F63-6C7788C9892F}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
+ {4B93E684-0630-45F4-8F63-6C7788C9892F}.netcoreapp-Windows_NT-Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
+ {4B93E684-0630-45F4-8F63-6C7788C9892F}.netcoreapp-Windows_NT-Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
+ {4B93E684-0630-45F4-8F63-6C7788C9892F}.netcoreapp-Windows_NT-Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
+ {4B93E684-0630-45F4-8F63-6C7788C9892F}.netcoreapp-Windows_NT-Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
+ {4B93E684-0630-45F4-8F63-6C7788C9892F}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
+ {4B93E684-0630-45F4-8F63-6C7788C9892F}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {191B3618-FECD-4ABD-9D6B-5AC90DC33621} = {E107E9C1-E893-4E87-987E-04EF0DCEAEFD}
+ {4B93E684-0630-45F4-8F63-6C7788C9892F} = {A6F820B0-2679-4543-AE8B-CB9BB71FF175}
+ EndGlobalSection
+EndGlobal
diff --git a/src/System.DirectoryServices/pkg/Configurations.props b/src/System.Drawing.Common/dir.props
index b746c4279b..cd605ceb6b 100644
--- a/src/System.DirectoryServices/pkg/Configurations.props
+++ b/src/System.Drawing.Common/dir.props
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
<PropertyGroup>
- <BuildConfigurations>
- <!-- Empty build configurations as this project is not currently building for any vertical -->
- ;
- </BuildConfigurations>
+ <AssemblyVersion>4.1.0.0</AssemblyVersion>
+ <AssemblyKey>MSFT</AssemblyKey>
</PropertyGroup>
</Project>
diff --git a/src/System.DirectoryServices.Protocols/pkg/Configurations.props b/src/System.Drawing.Common/ref/Configurations.props
index b746c4279b..2845c11c54 100644
--- a/src/System.DirectoryServices.Protocols/pkg/Configurations.props
+++ b/src/System.Drawing.Common/ref/Configurations.props
@@ -1,9 +1,8 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
- <!-- Empty build configurations as this project is not currently building for any vertical -->
- ;
+ netcoreapp;
</BuildConfigurations>
</PropertyGroup>
-</Project>
+</Project> \ No newline at end of file
diff --git a/src/System.Drawing.Common/ref/System.Drawing.Common.cs b/src/System.Drawing.Common/ref/System.Drawing.Common.cs
new file mode 100644
index 0000000000..27fed869a7
--- /dev/null
+++ b/src/System.Drawing.Common/ref/System.Drawing.Common.cs
@@ -0,0 +1,3186 @@
+namespace System.Drawing
+{
+ [System.Runtime.InteropServices.ComVisibleAttribute(true)]
+ public sealed partial class Bitmap : System.Drawing.Image
+ {
+ public Bitmap(System.Drawing.Image original) { }
+ public Bitmap(System.Drawing.Image original, System.Drawing.Size newSize) { }
+ public Bitmap(System.Drawing.Image original, int width, int height) { }
+ public Bitmap(int width, int height) { }
+ public Bitmap(int width, int height, System.Drawing.Graphics g) { }
+ public Bitmap(int width, int height, System.Drawing.Imaging.PixelFormat format) { }
+ public Bitmap(int width, int height, int stride, System.Drawing.Imaging.PixelFormat format, System.IntPtr scan0) { }
+ public Bitmap(System.IO.Stream stream) { }
+ public Bitmap(System.IO.Stream stream, bool useIcm) { }
+ public Bitmap(string filename) { }
+ public Bitmap(string filename, bool useIcm) { }
+ public Bitmap(System.Type type, string resource) { }
+ public System.Drawing.Bitmap Clone(System.Drawing.Rectangle rect, System.Drawing.Imaging.PixelFormat format) { throw null; }
+ public System.Drawing.Bitmap Clone(System.Drawing.RectangleF rect, System.Drawing.Imaging.PixelFormat format) { throw null; }
+ public static System.Drawing.Bitmap FromHicon(System.IntPtr hicon) { throw null; }
+ public static System.Drawing.Bitmap FromResource(System.IntPtr hinstance, string bitmapName) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))]
+ [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2))]
+ public System.IntPtr GetHbitmap() { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))]
+ [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2))]
+ public System.IntPtr GetHbitmap(System.Drawing.Color background) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))]
+ [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2))]
+ public System.IntPtr GetHicon() { throw null; }
+ public System.Drawing.Color GetPixel(int x, int y) { throw null; }
+ [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2))]
+ public System.Drawing.Imaging.BitmapData LockBits(System.Drawing.Rectangle rect, System.Drawing.Imaging.ImageLockMode flags, System.Drawing.Imaging.PixelFormat format) { throw null; }
+ [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2))]
+ public System.Drawing.Imaging.BitmapData LockBits(System.Drawing.Rectangle rect, System.Drawing.Imaging.ImageLockMode flags, System.Drawing.Imaging.PixelFormat format, System.Drawing.Imaging.BitmapData bitmapData) { throw null; }
+ public void MakeTransparent() { }
+ public void MakeTransparent(System.Drawing.Color transparentColor) { }
+ public void SetPixel(int x, int y, System.Drawing.Color color) { }
+ public void SetResolution(float xDpi, float yDpi) { }
+ [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2))]
+ public void UnlockBits(System.Drawing.Imaging.BitmapData bitmapdata) { }
+ }
+ [System.AttributeUsageAttribute((System.AttributeTargets)(1))]
+ public partial class BitmapSuffixInSameAssemblyAttribute : System.Attribute
+ {
+ public BitmapSuffixInSameAssemblyAttribute() { }
+ }
+ [System.AttributeUsageAttribute((System.AttributeTargets)(1))]
+ public partial class BitmapSuffixInSatelliteAssemblyAttribute : System.Attribute
+ {
+ public BitmapSuffixInSatelliteAssemblyAttribute() { }
+ }
+ public abstract partial class Brush : System.MarshalByRefObject, System.ICloneable, System.IDisposable
+ {
+ protected Brush() { }
+ public abstract object Clone();
+ public void Dispose() { }
+ protected virtual void Dispose(bool disposing) { }
+ ~Brush() { }
+ protected internal void SetNativeBrush(System.IntPtr brush) { }
+ }
+ public sealed partial class Brushes
+ {
+ internal Brushes() { }
+ public static System.Drawing.Brush AliceBlue { get { throw null; } }
+ public static System.Drawing.Brush AntiqueWhite { get { throw null; } }
+ public static System.Drawing.Brush Aqua { get { throw null; } }
+ public static System.Drawing.Brush Aquamarine { get { throw null; } }
+ public static System.Drawing.Brush Azure { get { throw null; } }
+ public static System.Drawing.Brush Beige { get { throw null; } }
+ public static System.Drawing.Brush Bisque { get { throw null; } }
+ public static System.Drawing.Brush Black { get { throw null; } }
+ public static System.Drawing.Brush BlanchedAlmond { get { throw null; } }
+ public static System.Drawing.Brush Blue { get { throw null; } }
+ public static System.Drawing.Brush BlueViolet { get { throw null; } }
+ public static System.Drawing.Brush Brown { get { throw null; } }
+ public static System.Drawing.Brush BurlyWood { get { throw null; } }
+ public static System.Drawing.Brush CadetBlue { get { throw null; } }
+ public static System.Drawing.Brush Chartreuse { get { throw null; } }
+ public static System.Drawing.Brush Chocolate { get { throw null; } }
+ public static System.Drawing.Brush Coral { get { throw null; } }
+ public static System.Drawing.Brush CornflowerBlue { get { throw null; } }
+ public static System.Drawing.Brush Cornsilk { get { throw null; } }
+ public static System.Drawing.Brush Crimson { get { throw null; } }
+ public static System.Drawing.Brush Cyan { get { throw null; } }
+ public static System.Drawing.Brush DarkBlue { get { throw null; } }
+ public static System.Drawing.Brush DarkCyan { get { throw null; } }
+ public static System.Drawing.Brush DarkGoldenrod { get { throw null; } }
+ public static System.Drawing.Brush DarkGray { get { throw null; } }
+ public static System.Drawing.Brush DarkGreen { get { throw null; } }
+ public static System.Drawing.Brush DarkKhaki { get { throw null; } }
+ public static System.Drawing.Brush DarkMagenta { get { throw null; } }
+ public static System.Drawing.Brush DarkOliveGreen { get { throw null; } }
+ public static System.Drawing.Brush DarkOrange { get { throw null; } }
+ public static System.Drawing.Brush DarkOrchid { get { throw null; } }
+ public static System.Drawing.Brush DarkRed { get { throw null; } }
+ public static System.Drawing.Brush DarkSalmon { get { throw null; } }
+ public static System.Drawing.Brush DarkSeaGreen { get { throw null; } }
+ public static System.Drawing.Brush DarkSlateBlue { get { throw null; } }
+ public static System.Drawing.Brush DarkSlateGray { get { throw null; } }
+ public static System.Drawing.Brush DarkTurquoise { get { throw null; } }
+ public static System.Drawing.Brush DarkViolet { get { throw null; } }
+ public static System.Drawing.Brush DeepPink { get { throw null; } }
+ public static System.Drawing.Brush DeepSkyBlue { get { throw null; } }
+ public static System.Drawing.Brush DimGray { get { throw null; } }
+ public static System.Drawing.Brush DodgerBlue { get { throw null; } }
+ public static System.Drawing.Brush Firebrick { get { throw null; } }
+ public static System.Drawing.Brush FloralWhite { get { throw null; } }
+ public static System.Drawing.Brush ForestGreen { get { throw null; } }
+ public static System.Drawing.Brush Fuchsia { get { throw null; } }
+ public static System.Drawing.Brush Gainsboro { get { throw null; } }
+ public static System.Drawing.Brush GhostWhite { get { throw null; } }
+ public static System.Drawing.Brush Gold { get { throw null; } }
+ public static System.Drawing.Brush Goldenrod { get { throw null; } }
+ public static System.Drawing.Brush Gray { get { throw null; } }
+ public static System.Drawing.Brush Green { get { throw null; } }
+ public static System.Drawing.Brush GreenYellow { get { throw null; } }
+ public static System.Drawing.Brush Honeydew { get { throw null; } }
+ public static System.Drawing.Brush HotPink { get { throw null; } }
+ public static System.Drawing.Brush IndianRed { get { throw null; } }
+ public static System.Drawing.Brush Indigo { get { throw null; } }
+ public static System.Drawing.Brush Ivory { get { throw null; } }
+ public static System.Drawing.Brush Khaki { get { throw null; } }
+ public static System.Drawing.Brush Lavender { get { throw null; } }
+ public static System.Drawing.Brush LavenderBlush { get { throw null; } }
+ public static System.Drawing.Brush LawnGreen { get { throw null; } }
+ public static System.Drawing.Brush LemonChiffon { get { throw null; } }
+ public static System.Drawing.Brush LightBlue { get { throw null; } }
+ public static System.Drawing.Brush LightCoral { get { throw null; } }
+ public static System.Drawing.Brush LightCyan { get { throw null; } }
+ public static System.Drawing.Brush LightGoldenrodYellow { get { throw null; } }
+ public static System.Drawing.Brush LightGray { get { throw null; } }
+ public static System.Drawing.Brush LightGreen { get { throw null; } }
+ public static System.Drawing.Brush LightPink { get { throw null; } }
+ public static System.Drawing.Brush LightSalmon { get { throw null; } }
+ public static System.Drawing.Brush LightSeaGreen { get { throw null; } }
+ public static System.Drawing.Brush LightSkyBlue { get { throw null; } }
+ public static System.Drawing.Brush LightSlateGray { get { throw null; } }
+ public static System.Drawing.Brush LightSteelBlue { get { throw null; } }
+ public static System.Drawing.Brush LightYellow { get { throw null; } }
+ public static System.Drawing.Brush Lime { get { throw null; } }
+ public static System.Drawing.Brush LimeGreen { get { throw null; } }
+ public static System.Drawing.Brush Linen { get { throw null; } }
+ public static System.Drawing.Brush Magenta { get { throw null; } }
+ public static System.Drawing.Brush Maroon { get { throw null; } }
+ public static System.Drawing.Brush MediumAquamarine { get { throw null; } }
+ public static System.Drawing.Brush MediumBlue { get { throw null; } }
+ public static System.Drawing.Brush MediumOrchid { get { throw null; } }
+ public static System.Drawing.Brush MediumPurple { get { throw null; } }
+ public static System.Drawing.Brush MediumSeaGreen { get { throw null; } }
+ public static System.Drawing.Brush MediumSlateBlue { get { throw null; } }
+ public static System.Drawing.Brush MediumSpringGreen { get { throw null; } }
+ public static System.Drawing.Brush MediumTurquoise { get { throw null; } }
+ public static System.Drawing.Brush MediumVioletRed { get { throw null; } }
+ public static System.Drawing.Brush MidnightBlue { get { throw null; } }
+ public static System.Drawing.Brush MintCream { get { throw null; } }
+ public static System.Drawing.Brush MistyRose { get { throw null; } }
+ public static System.Drawing.Brush Moccasin { get { throw null; } }
+ public static System.Drawing.Brush NavajoWhite { get { throw null; } }
+ public static System.Drawing.Brush Navy { get { throw null; } }
+ public static System.Drawing.Brush OldLace { get { throw null; } }
+ public static System.Drawing.Brush Olive { get { throw null; } }
+ public static System.Drawing.Brush OliveDrab { get { throw null; } }
+ public static System.Drawing.Brush Orange { get { throw null; } }
+ public static System.Drawing.Brush OrangeRed { get { throw null; } }
+ public static System.Drawing.Brush Orchid { get { throw null; } }
+ public static System.Drawing.Brush PaleGoldenrod { get { throw null; } }
+ public static System.Drawing.Brush PaleGreen { get { throw null; } }
+ public static System.Drawing.Brush PaleTurquoise { get { throw null; } }
+ public static System.Drawing.Brush PaleVioletRed { get { throw null; } }
+ public static System.Drawing.Brush PapayaWhip { get { throw null; } }
+ public static System.Drawing.Brush PeachPuff { get { throw null; } }
+ public static System.Drawing.Brush Peru { get { throw null; } }
+ public static System.Drawing.Brush Pink { get { throw null; } }
+ public static System.Drawing.Brush Plum { get { throw null; } }
+ public static System.Drawing.Brush PowderBlue { get { throw null; } }
+ public static System.Drawing.Brush Purple { get { throw null; } }
+ public static System.Drawing.Brush Red { get { throw null; } }
+ public static System.Drawing.Brush RosyBrown { get { throw null; } }
+ public static System.Drawing.Brush RoyalBlue { get { throw null; } }
+ public static System.Drawing.Brush SaddleBrown { get { throw null; } }
+ public static System.Drawing.Brush Salmon { get { throw null; } }
+ public static System.Drawing.Brush SandyBrown { get { throw null; } }
+ public static System.Drawing.Brush SeaGreen { get { throw null; } }
+ public static System.Drawing.Brush SeaShell { get { throw null; } }
+ public static System.Drawing.Brush Sienna { get { throw null; } }
+ public static System.Drawing.Brush Silver { get { throw null; } }
+ public static System.Drawing.Brush SkyBlue { get { throw null; } }
+ public static System.Drawing.Brush SlateBlue { get { throw null; } }
+ public static System.Drawing.Brush SlateGray { get { throw null; } }
+ public static System.Drawing.Brush Snow { get { throw null; } }
+ public static System.Drawing.Brush SpringGreen { get { throw null; } }
+ public static System.Drawing.Brush SteelBlue { get { throw null; } }
+ public static System.Drawing.Brush Tan { get { throw null; } }
+ public static System.Drawing.Brush Teal { get { throw null; } }
+ public static System.Drawing.Brush Thistle { get { throw null; } }
+ public static System.Drawing.Brush Tomato { get { throw null; } }
+ public static System.Drawing.Brush Transparent { get { throw null; } }
+ public static System.Drawing.Brush Turquoise { get { throw null; } }
+ public static System.Drawing.Brush Violet { get { throw null; } }
+ public static System.Drawing.Brush Wheat { get { throw null; } }
+ public static System.Drawing.Brush White { get { throw null; } }
+ public static System.Drawing.Brush WhiteSmoke { get { throw null; } }
+ public static System.Drawing.Brush Yellow { get { throw null; } }
+ public static System.Drawing.Brush YellowGreen { get { throw null; } }
+ }
+ public sealed partial class BufferedGraphics : System.IDisposable
+ {
+ internal BufferedGraphics() { }
+ public System.Drawing.Graphics Graphics { get { throw null; } }
+ public void Dispose() { }
+ ~BufferedGraphics() { }
+ public void Render() { }
+ public void Render(System.Drawing.Graphics target) { }
+ public void Render(System.IntPtr targetDC) { }
+ }
+ public sealed partial class BufferedGraphicsContext : System.IDisposable
+ {
+ public BufferedGraphicsContext() { }
+ public System.Drawing.Size MaximumBuffer { get { throw null; } set { } }
+ public System.Drawing.BufferedGraphics Allocate(System.Drawing.Graphics targetGraphics, System.Drawing.Rectangle targetRectangle) { throw null; }
+ [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2))]
+ public System.Drawing.BufferedGraphics Allocate(System.IntPtr targetDC, System.Drawing.Rectangle targetRectangle) { throw null; }
+ public void Dispose() { }
+ ~BufferedGraphicsContext() { }
+ public void Invalidate() { }
+ }
+ public sealed partial class BufferedGraphicsManager
+ {
+ internal BufferedGraphicsManager() { }
+ public static System.Drawing.BufferedGraphicsContext Current { get { throw null; } }
+ }
+ [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
+ public partial struct CharacterRange
+ {
+ public CharacterRange(int First, int Length) { throw null;}
+ public int First { get { throw null; } set { } }
+ public int Length { get { throw null; } set { } }
+ public override bool Equals(object obj) { throw null; }
+ public override int GetHashCode() { throw null; }
+ public static bool operator ==(System.Drawing.CharacterRange cr1, System.Drawing.CharacterRange cr2) { throw null; }
+ public static bool operator !=(System.Drawing.CharacterRange cr1, System.Drawing.CharacterRange cr2) { throw null; }
+ }
+ public sealed partial class ColorTranslator
+ {
+ internal ColorTranslator() { }
+ public static System.Drawing.Color FromHtml(string htmlColor) { throw null; }
+ public static System.Drawing.Color FromOle(int oleColor) { throw null; }
+ public static System.Drawing.Color FromWin32(int win32Color) { throw null; }
+ public static string ToHtml(System.Drawing.Color c) { throw null; }
+ public static int ToOle(System.Drawing.Color c) { throw null; }
+ public static int ToWin32(System.Drawing.Color c) { throw null; }
+ }
+ public enum ContentAlignment
+ {
+ BottomCenter = 512,
+ BottomLeft = 256,
+ BottomRight = 1024,
+ MiddleCenter = 32,
+ MiddleLeft = 16,
+ MiddleRight = 64,
+ TopCenter = 2,
+ TopLeft = 1,
+ TopRight = 4,
+ }
+ [System.Runtime.InteropServices.ComVisibleAttribute(true)]
+ public enum CopyPixelOperation
+ {
+ Blackness = 66,
+ CaptureBlt = 1073741824,
+ DestinationInvert = 5570569,
+ MergeCopy = 12583114,
+ MergePaint = 12255782,
+ NoMirrorBitmap = -2147483648,
+ NotSourceCopy = 3342344,
+ NotSourceErase = 1114278,
+ PatCopy = 15728673,
+ PatInvert = 5898313,
+ PatPaint = 16452105,
+ SourceAnd = 8913094,
+ SourceCopy = 13369376,
+ SourceErase = 4457256,
+ SourceInvert = 6684742,
+ SourcePaint = 15597702,
+ Whiteness = 16711778,
+ }
+ [System.Runtime.InteropServices.ComVisibleAttribute(true)]
+ public sealed partial class Font : System.MarshalByRefObject, System.ICloneable, System.IDisposable, System.Runtime.Serialization.ISerializable
+ {
+ public Font(System.Drawing.Font prototype, System.Drawing.FontStyle newStyle) { }
+ public Font(System.Drawing.FontFamily family, float emSize) { }
+ public Font(System.Drawing.FontFamily family, float emSize, System.Drawing.FontStyle style) { }
+ public Font(System.Drawing.FontFamily family, float emSize, System.Drawing.FontStyle style, System.Drawing.GraphicsUnit unit) { }
+ public Font(System.Drawing.FontFamily family, float emSize, System.Drawing.FontStyle style, System.Drawing.GraphicsUnit unit, byte gdiCharSet) { }
+ public Font(System.Drawing.FontFamily family, float emSize, System.Drawing.FontStyle style, System.Drawing.GraphicsUnit unit, byte gdiCharSet, bool gdiVerticalFont) { }
+ public Font(System.Drawing.FontFamily family, float emSize, System.Drawing.GraphicsUnit unit) { }
+ public Font(string familyName, float emSize) { }
+ public Font(string familyName, float emSize, System.Drawing.FontStyle style) { }
+ public Font(string familyName, float emSize, System.Drawing.FontStyle style, System.Drawing.GraphicsUnit unit) { }
+ public Font(string familyName, float emSize, System.Drawing.FontStyle style, System.Drawing.GraphicsUnit unit, byte gdiCharSet) { }
+ public Font(string familyName, float emSize, System.Drawing.FontStyle style, System.Drawing.GraphicsUnit unit, byte gdiCharSet, bool gdiVerticalFont) { }
+ public Font(string familyName, float emSize, System.Drawing.GraphicsUnit unit) { }
+ [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))]
+ public bool Bold { get { throw null; } }
+ [System.ComponentModel.BrowsableAttribute(false)]
+ public System.Drawing.FontFamily FontFamily { get { throw null; } }
+ [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))]
+ public byte GdiCharSet { get { throw null; } }
+ [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))]
+ public bool GdiVerticalFont { get { throw null; } }
+ [System.ComponentModel.BrowsableAttribute(false)]
+ public int Height { get { throw null; } }
+ [System.ComponentModel.BrowsableAttribute(false)]
+ public bool IsSystemFont { get { throw null; } }
+ [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))]
+ public bool Italic { get { throw null; } }
+ [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))]
+ public string Name { get { throw null; } }
+ [System.ComponentModel.BrowsableAttribute(false)]
+ public string OriginalFontName { get { throw null; } }
+ public float Size { get { throw null; } }
+ [System.ComponentModel.BrowsableAttribute(false)]
+ public float SizeInPoints { get { throw null; } }
+ [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))]
+ public bool Strikeout { get { throw null; } }
+ [System.ComponentModel.BrowsableAttribute(false)]
+ public System.Drawing.FontStyle Style { get { throw null; } }
+ [System.ComponentModel.BrowsableAttribute(false)]
+ public string SystemFontName { get { throw null; } }
+ [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))]
+ public bool Underline { get { throw null; } }
+ public System.Drawing.GraphicsUnit Unit { get { throw null; } }
+ public object Clone() { throw null; }
+ public void Dispose() { }
+ public override bool Equals(object obj) { throw null; }
+ ~Font() { }
+ public static System.Drawing.Font FromHdc(System.IntPtr hdc) { throw null; }
+ public static System.Drawing.Font FromHfont(System.IntPtr hfont) { throw null; }
+ public static System.Drawing.Font FromLogFont(object lf) { throw null; }
+ public static System.Drawing.Font FromLogFont(object lf, System.IntPtr hdc) { throw null; }
+ public override int GetHashCode() { throw null; }
+ public float GetHeight() { throw null; }
+ public float GetHeight(System.Drawing.Graphics graphics) { throw null; }
+ public float GetHeight(float dpi) { throw null; }
+ [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128))]
+ void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo si, System.Runtime.Serialization.StreamingContext context) { }
+ public System.IntPtr ToHfont() { throw null; }
+ public void ToLogFont(object logFont) { }
+ public void ToLogFont(object logFont, System.Drawing.Graphics graphics) { }
+ public override string ToString() { throw null; }
+ }
+ public sealed partial class FontFamily : System.MarshalByRefObject, System.IDisposable
+ {
+ public FontFamily(System.Drawing.Text.GenericFontFamilies genericFamily) { }
+ public FontFamily(string name) { }
+ public FontFamily(string name, System.Drawing.Text.FontCollection fontCollection) { }
+ public static System.Drawing.FontFamily[] Families { get { throw null; } }
+ public static System.Drawing.FontFamily GenericMonospace { get { throw null; } }
+ public static System.Drawing.FontFamily GenericSansSerif { get { throw null; } }
+ public static System.Drawing.FontFamily GenericSerif { get { throw null; } }
+ public string Name { get { throw null; } }
+ public void Dispose() { }
+ public override bool Equals(object obj) { throw null; }
+ ~FontFamily() { }
+ public int GetCellAscent(System.Drawing.FontStyle style) { throw null; }
+ public int GetCellDescent(System.Drawing.FontStyle style) { throw null; }
+ public int GetEmHeight(System.Drawing.FontStyle style) { throw null; }
+ [System.ObsoleteAttribute("Do not use method GetFamilies, use property Families instead")]
+ public static System.Drawing.FontFamily[] GetFamilies(System.Drawing.Graphics graphics) { throw null; }
+ public override int GetHashCode() { throw null; }
+ public int GetLineSpacing(System.Drawing.FontStyle style) { throw null; }
+ public string GetName(int language) { throw null; }
+ public bool IsStyleAvailable(System.Drawing.FontStyle style) { throw null; }
+ public override string ToString() { throw null; }
+ }
+ [System.FlagsAttribute]
+ public enum FontStyle
+ {
+ Bold = 1,
+ Italic = 2,
+ Regular = 0,
+ Strikeout = 8,
+ Underline = 4,
+ }
+ public sealed partial class Graphics : System.MarshalByRefObject, System.Drawing.IDeviceContext, System.IDisposable
+ {
+ internal Graphics() { }
+ public System.Drawing.Region Clip { get { throw null; } set { } }
+ public System.Drawing.RectangleF ClipBounds { get { throw null; } }
+ public System.Drawing.Drawing2D.CompositingMode CompositingMode { get { throw null; } set { } }
+ public System.Drawing.Drawing2D.CompositingQuality CompositingQuality { get { throw null; } set { } }
+ public float DpiX { get { throw null; } }
+ public float DpiY { get { throw null; } }
+ public System.Drawing.Drawing2D.InterpolationMode InterpolationMode { get { throw null; } set { } }
+ public bool IsClipEmpty { get { throw null; } }
+ public bool IsVisibleClipEmpty { get { throw null; } }
+ public float PageScale { get { throw null; } set { } }
+ public System.Drawing.GraphicsUnit PageUnit { get { throw null; } set { } }
+ public System.Drawing.Drawing2D.PixelOffsetMode PixelOffsetMode { get { throw null; } set { } }
+ public System.Drawing.Point RenderingOrigin { get { throw null; } set { } }
+ public System.Drawing.Drawing2D.SmoothingMode SmoothingMode { get { throw null; } set { } }
+ public int TextContrast { get { throw null; } set { } }
+ public System.Drawing.Text.TextRenderingHint TextRenderingHint { get { throw null; } set { } }
+ public System.Drawing.Drawing2D.Matrix Transform { get { throw null; } set { } }
+ public System.Drawing.RectangleF VisibleClipBounds { get { throw null; } }
+ public void AddMetafileComment(byte[] data) { }
+ public System.Drawing.Drawing2D.GraphicsContainer BeginContainer() { throw null; }
+ public System.Drawing.Drawing2D.GraphicsContainer BeginContainer(System.Drawing.Rectangle dstrect, System.Drawing.Rectangle srcrect, System.Drawing.GraphicsUnit unit) { throw null; }
+ public System.Drawing.Drawing2D.GraphicsContainer BeginContainer(System.Drawing.RectangleF dstrect, System.Drawing.RectangleF srcrect, System.Drawing.GraphicsUnit unit) { throw null; }
+ public void Clear(System.Drawing.Color color) { }
+ public void CopyFromScreen(System.Drawing.Point upperLeftSource, System.Drawing.Point upperLeftDestination, System.Drawing.Size blockRegionSize) { }
+ public void CopyFromScreen(System.Drawing.Point upperLeftSource, System.Drawing.Point upperLeftDestination, System.Drawing.Size blockRegionSize, System.Drawing.CopyPixelOperation copyPixelOperation) { }
+ public void CopyFromScreen(int sourceX, int sourceY, int destinationX, int destinationY, System.Drawing.Size blockRegionSize) { }
+ public void CopyFromScreen(int sourceX, int sourceY, int destinationX, int destinationY, System.Drawing.Size blockRegionSize, System.Drawing.CopyPixelOperation copyPixelOperation) { }
+ public void Dispose() { }
+ public void DrawArc(System.Drawing.Pen pen, System.Drawing.Rectangle rect, float startAngle, float sweepAngle) { }
+ public void DrawArc(System.Drawing.Pen pen, System.Drawing.RectangleF rect, float startAngle, float sweepAngle) { }
+ public void DrawArc(System.Drawing.Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle) { }
+ public void DrawArc(System.Drawing.Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle) { }
+ public void DrawBezier(System.Drawing.Pen pen, System.Drawing.Point pt1, System.Drawing.Point pt2, System.Drawing.Point pt3, System.Drawing.Point pt4) { }
+ public void DrawBezier(System.Drawing.Pen pen, System.Drawing.PointF pt1, System.Drawing.PointF pt2, System.Drawing.PointF pt3, System.Drawing.PointF pt4) { }
+ public void DrawBezier(System.Drawing.Pen pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) { }
+ public void DrawBeziers(System.Drawing.Pen pen, System.Drawing.PointF[] points) { }
+ public void DrawBeziers(System.Drawing.Pen pen, System.Drawing.Point[] points) { }
+ public void DrawClosedCurve(System.Drawing.Pen pen, System.Drawing.PointF[] points) { }
+ public void DrawClosedCurve(System.Drawing.Pen pen, System.Drawing.PointF[] points, float tension, System.Drawing.Drawing2D.FillMode fillmode) { }
+ public void DrawClosedCurve(System.Drawing.Pen pen, System.Drawing.Point[] points) { }
+ public void DrawClosedCurve(System.Drawing.Pen pen, System.Drawing.Point[] points, float tension, System.Drawing.Drawing2D.FillMode fillmode) { }
+ public void DrawCurve(System.Drawing.Pen pen, System.Drawing.PointF[] points) { }
+ public void DrawCurve(System.Drawing.Pen pen, System.Drawing.PointF[] points, int offset, int numberOfSegments) { }
+ public void DrawCurve(System.Drawing.Pen pen, System.Drawing.PointF[] points, int offset, int numberOfSegments, float tension) { }
+ public void DrawCurve(System.Drawing.Pen pen, System.Drawing.PointF[] points, float tension) { }
+ public void DrawCurve(System.Drawing.Pen pen, System.Drawing.Point[] points) { }
+ public void DrawCurve(System.Drawing.Pen pen, System.Drawing.Point[] points, int offset, int numberOfSegments, float tension) { }
+ public void DrawCurve(System.Drawing.Pen pen, System.Drawing.Point[] points, float tension) { }
+ public void DrawEllipse(System.Drawing.Pen pen, System.Drawing.Rectangle rect) { }
+ public void DrawEllipse(System.Drawing.Pen pen, System.Drawing.RectangleF rect) { }
+ public void DrawEllipse(System.Drawing.Pen pen, int x, int y, int width, int height) { }
+ public void DrawEllipse(System.Drawing.Pen pen, float x, float y, float width, float height) { }
+ public void DrawIcon(System.Drawing.Icon icon, System.Drawing.Rectangle targetRect) { }
+ public void DrawIcon(System.Drawing.Icon icon, int x, int y) { }
+ public void DrawIconUnstretched(System.Drawing.Icon icon, System.Drawing.Rectangle targetRect) { }
+ public void DrawImage(System.Drawing.Image image, System.Drawing.Point point) { }
+ public void DrawImage(System.Drawing.Image image, System.Drawing.PointF point) { }
+ public void DrawImage(System.Drawing.Image image, System.Drawing.PointF[] destPoints) { }
+ public void DrawImage(System.Drawing.Image image, System.Drawing.PointF[] destPoints, System.Drawing.RectangleF srcRect, System.Drawing.GraphicsUnit srcUnit) { }
+ public void DrawImage(System.Drawing.Image image, System.Drawing.PointF[] destPoints, System.Drawing.RectangleF srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttr) { }
+ public void DrawImage(System.Drawing.Image image, System.Drawing.PointF[] destPoints, System.Drawing.RectangleF srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttr, System.Drawing.Graphics.DrawImageAbort callback) { }
+ public void DrawImage(System.Drawing.Image image, System.Drawing.PointF[] destPoints, System.Drawing.RectangleF srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttr, System.Drawing.Graphics.DrawImageAbort callback, int callbackData) { }
+ public void DrawImage(System.Drawing.Image image, System.Drawing.Point[] destPoints) { }
+ public void DrawImage(System.Drawing.Image image, System.Drawing.Point[] destPoints, System.Drawing.Rectangle srcRect, System.Drawing.GraphicsUnit srcUnit) { }
+ public void DrawImage(System.Drawing.Image image, System.Drawing.Point[] destPoints, System.Drawing.Rectangle srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttr) { }
+ public void DrawImage(System.Drawing.Image image, System.Drawing.Point[] destPoints, System.Drawing.Rectangle srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttr, System.Drawing.Graphics.DrawImageAbort callback) { }
+ public void DrawImage(System.Drawing.Image image, System.Drawing.Point[] destPoints, System.Drawing.Rectangle srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttr, System.Drawing.Graphics.DrawImageAbort callback, int callbackData) { }
+ public void DrawImage(System.Drawing.Image image, System.Drawing.Rectangle rect) { }
+ public void DrawImage(System.Drawing.Image image, System.Drawing.Rectangle destRect, System.Drawing.Rectangle srcRect, System.Drawing.GraphicsUnit srcUnit) { }
+ public void DrawImage(System.Drawing.Image image, System.Drawing.Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, System.Drawing.GraphicsUnit srcUnit) { }
+ public void DrawImage(System.Drawing.Image image, System.Drawing.Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttr) { }
+ public void DrawImage(System.Drawing.Image image, System.Drawing.Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttr, System.Drawing.Graphics.DrawImageAbort callback) { }
+ public void DrawImage(System.Drawing.Image image, System.Drawing.Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttrs, System.Drawing.Graphics.DrawImageAbort callback, System.IntPtr callbackData) { }
+ public void DrawImage(System.Drawing.Image image, System.Drawing.Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, System.Drawing.GraphicsUnit srcUnit) { }
+ public void DrawImage(System.Drawing.Image image, System.Drawing.Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttrs) { }
+ public void DrawImage(System.Drawing.Image image, System.Drawing.Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttrs, System.Drawing.Graphics.DrawImageAbort callback) { }
+ public void DrawImage(System.Drawing.Image image, System.Drawing.Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttrs, System.Drawing.Graphics.DrawImageAbort callback, System.IntPtr callbackData) { }
+ public void DrawImage(System.Drawing.Image image, System.Drawing.RectangleF rect) { }
+ public void DrawImage(System.Drawing.Image image, System.Drawing.RectangleF destRect, System.Drawing.RectangleF srcRect, System.Drawing.GraphicsUnit srcUnit) { }
+ public void DrawImage(System.Drawing.Image image, int x, int y) { }
+ public void DrawImage(System.Drawing.Image image, int x, int y, System.Drawing.Rectangle srcRect, System.Drawing.GraphicsUnit srcUnit) { }
+ public void DrawImage(System.Drawing.Image image, int x, int y, int width, int height) { }
+ public void DrawImage(System.Drawing.Image image, float x, float y) { }
+ public void DrawImage(System.Drawing.Image image, float x, float y, System.Drawing.RectangleF srcRect, System.Drawing.GraphicsUnit srcUnit) { }
+ public void DrawImage(System.Drawing.Image image, float x, float y, float width, float height) { }
+ public void DrawImageUnscaled(System.Drawing.Image image, System.Drawing.Point point) { }
+ public void DrawImageUnscaled(System.Drawing.Image image, System.Drawing.Rectangle rect) { }
+ public void DrawImageUnscaled(System.Drawing.Image image, int x, int y) { }
+ public void DrawImageUnscaled(System.Drawing.Image image, int x, int y, int width, int height) { }
+ public void DrawImageUnscaledAndClipped(System.Drawing.Image image, System.Drawing.Rectangle rect) { }
+ public void DrawLine(System.Drawing.Pen pen, System.Drawing.Point pt1, System.Drawing.Point pt2) { }
+ public void DrawLine(System.Drawing.Pen pen, System.Drawing.PointF pt1, System.Drawing.PointF pt2) { }
+ public void DrawLine(System.Drawing.Pen pen, int x1, int y1, int x2, int y2) { }
+ public void DrawLine(System.Drawing.Pen pen, float x1, float y1, float x2, float y2) { }
+ public void DrawLines(System.Drawing.Pen pen, System.Drawing.PointF[] points) { }
+ public void DrawLines(System.Drawing.Pen pen, System.Drawing.Point[] points) { }
+ public void DrawPath(System.Drawing.Pen pen, System.Drawing.Drawing2D.GraphicsPath path) { }
+ public void DrawPie(System.Drawing.Pen pen, System.Drawing.Rectangle rect, float startAngle, float sweepAngle) { }
+ public void DrawPie(System.Drawing.Pen pen, System.Drawing.RectangleF rect, float startAngle, float sweepAngle) { }
+ public void DrawPie(System.Drawing.Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle) { }
+ public void DrawPie(System.Drawing.Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle) { }
+ public void DrawPolygon(System.Drawing.Pen pen, System.Drawing.PointF[] points) { }
+ public void DrawPolygon(System.Drawing.Pen pen, System.Drawing.Point[] points) { }
+ public void DrawRectangle(System.Drawing.Pen pen, System.Drawing.Rectangle rect) { }
+ public void DrawRectangle(System.Drawing.Pen pen, int x, int y, int width, int height) { }
+ public void DrawRectangle(System.Drawing.Pen pen, float x, float y, float width, float height) { }
+ public void DrawRectangles(System.Drawing.Pen pen, System.Drawing.RectangleF[] rects) { }
+ public void DrawRectangles(System.Drawing.Pen pen, System.Drawing.Rectangle[] rects) { }
+ public void DrawString(string s, System.Drawing.Font font, System.Drawing.Brush brush, System.Drawing.PointF point) { }
+ public void DrawString(string s, System.Drawing.Font font, System.Drawing.Brush brush, System.Drawing.PointF point, System.Drawing.StringFormat format) { }
+ public void DrawString(string s, System.Drawing.Font font, System.Drawing.Brush brush, System.Drawing.RectangleF layoutRectangle) { }
+ public void DrawString(string s, System.Drawing.Font font, System.Drawing.Brush brush, System.Drawing.RectangleF layoutRectangle, System.Drawing.StringFormat format) { }
+ public void DrawString(string s, System.Drawing.Font font, System.Drawing.Brush brush, float x, float y) { }
+ public void DrawString(string s, System.Drawing.Font font, System.Drawing.Brush brush, float x, float y, System.Drawing.StringFormat format) { }
+ public void EndContainer(System.Drawing.Drawing2D.GraphicsContainer container) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.Point destPoint, System.Drawing.Graphics.EnumerateMetafileProc callback) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.Point destPoint, System.Drawing.Graphics.EnumerateMetafileProc callback, System.IntPtr callbackData) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.Point destPoint, System.Drawing.Graphics.EnumerateMetafileProc callback, System.IntPtr callbackData, System.Drawing.Imaging.ImageAttributes imageAttr) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.Point destPoint, System.Drawing.Rectangle srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.Point destPoint, System.Drawing.Rectangle srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback, System.IntPtr callbackData) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.Point destPoint, System.Drawing.Rectangle srcRect, System.Drawing.GraphicsUnit unit, System.Drawing.Graphics.EnumerateMetafileProc callback, System.IntPtr callbackData, System.Drawing.Imaging.ImageAttributes imageAttr) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.PointF destPoint, System.Drawing.Graphics.EnumerateMetafileProc callback) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.PointF destPoint, System.Drawing.Graphics.EnumerateMetafileProc callback, System.IntPtr callbackData) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.PointF destPoint, System.Drawing.Graphics.EnumerateMetafileProc callback, System.IntPtr callbackData, System.Drawing.Imaging.ImageAttributes imageAttr) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.PointF destPoint, System.Drawing.RectangleF srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.PointF destPoint, System.Drawing.RectangleF srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback, System.IntPtr callbackData) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.PointF destPoint, System.Drawing.RectangleF srcRect, System.Drawing.GraphicsUnit unit, System.Drawing.Graphics.EnumerateMetafileProc callback, System.IntPtr callbackData, System.Drawing.Imaging.ImageAttributes imageAttr) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.PointF[] destPoints, System.Drawing.Graphics.EnumerateMetafileProc callback) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.PointF[] destPoints, System.Drawing.Graphics.EnumerateMetafileProc callback, System.IntPtr callbackData) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.PointF[] destPoints, System.Drawing.Graphics.EnumerateMetafileProc callback, System.IntPtr callbackData, System.Drawing.Imaging.ImageAttributes imageAttr) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.PointF[] destPoints, System.Drawing.RectangleF srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.PointF[] destPoints, System.Drawing.RectangleF srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback, System.IntPtr callbackData) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.PointF[] destPoints, System.Drawing.RectangleF srcRect, System.Drawing.GraphicsUnit unit, System.Drawing.Graphics.EnumerateMetafileProc callback, System.IntPtr callbackData, System.Drawing.Imaging.ImageAttributes imageAttr) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.Point[] destPoints, System.Drawing.Graphics.EnumerateMetafileProc callback) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.Point[] destPoints, System.Drawing.Graphics.EnumerateMetafileProc callback, System.IntPtr callbackData) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.Point[] destPoints, System.Drawing.Graphics.EnumerateMetafileProc callback, System.IntPtr callbackData, System.Drawing.Imaging.ImageAttributes imageAttr) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.Point[] destPoints, System.Drawing.Rectangle srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.Point[] destPoints, System.Drawing.Rectangle srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback, System.IntPtr callbackData) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.Point[] destPoints, System.Drawing.Rectangle srcRect, System.Drawing.GraphicsUnit unit, System.Drawing.Graphics.EnumerateMetafileProc callback, System.IntPtr callbackData, System.Drawing.Imaging.ImageAttributes imageAttr) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.Rectangle destRect, System.Drawing.Graphics.EnumerateMetafileProc callback) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.Rectangle destRect, System.Drawing.Graphics.EnumerateMetafileProc callback, System.IntPtr callbackData) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.Rectangle destRect, System.Drawing.Graphics.EnumerateMetafileProc callback, System.IntPtr callbackData, System.Drawing.Imaging.ImageAttributes imageAttr) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.Rectangle destRect, System.Drawing.Rectangle srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.Rectangle destRect, System.Drawing.Rectangle srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback, System.IntPtr callbackData) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.Rectangle destRect, System.Drawing.Rectangle srcRect, System.Drawing.GraphicsUnit unit, System.Drawing.Graphics.EnumerateMetafileProc callback, System.IntPtr callbackData, System.Drawing.Imaging.ImageAttributes imageAttr) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.RectangleF destRect, System.Drawing.Graphics.EnumerateMetafileProc callback) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.RectangleF destRect, System.Drawing.Graphics.EnumerateMetafileProc callback, System.IntPtr callbackData) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.RectangleF destRect, System.Drawing.Graphics.EnumerateMetafileProc callback, System.IntPtr callbackData, System.Drawing.Imaging.ImageAttributes imageAttr) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.RectangleF destRect, System.Drawing.RectangleF srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.RectangleF destRect, System.Drawing.RectangleF srcRect, System.Drawing.GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback, System.IntPtr callbackData) { }
+ public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, System.Drawing.RectangleF destRect, System.Drawing.RectangleF srcRect, System.Drawing.GraphicsUnit unit, System.Drawing.Graphics.EnumerateMetafileProc callback, System.IntPtr callbackData, System.Drawing.Imaging.ImageAttributes imageAttr) { }
+ public void ExcludeClip(System.Drawing.Rectangle rect) { }
+ public void ExcludeClip(System.Drawing.Region region) { }
+ public void FillClosedCurve(System.Drawing.Brush brush, System.Drawing.PointF[] points) { }
+ public void FillClosedCurve(System.Drawing.Brush brush, System.Drawing.PointF[] points, System.Drawing.Drawing2D.FillMode fillmode) { }
+ public void FillClosedCurve(System.Drawing.Brush brush, System.Drawing.PointF[] points, System.Drawing.Drawing2D.FillMode fillmode, float tension) { }
+ public void FillClosedCurve(System.Drawing.Brush brush, System.Drawing.Point[] points) { }
+ public void FillClosedCurve(System.Drawing.Brush brush, System.Drawing.Point[] points, System.Drawing.Drawing2D.FillMode fillmode) { }
+ public void FillClosedCurve(System.Drawing.Brush brush, System.Drawing.Point[] points, System.Drawing.Drawing2D.FillMode fillmode, float tension) { }
+ public void FillEllipse(System.Drawing.Brush brush, System.Drawing.Rectangle rect) { }
+ public void FillEllipse(System.Drawing.Brush brush, System.Drawing.RectangleF rect) { }
+ public void FillEllipse(System.Drawing.Brush brush, int x, int y, int width, int height) { }
+ public void FillEllipse(System.Drawing.Brush brush, float x, float y, float width, float height) { }
+ public void FillPath(System.Drawing.Brush brush, System.Drawing.Drawing2D.GraphicsPath path) { }
+ public void FillPie(System.Drawing.Brush brush, System.Drawing.Rectangle rect, float startAngle, float sweepAngle) { }
+ public void FillPie(System.Drawing.Brush brush, int x, int y, int width, int height, int startAngle, int sweepAngle) { }
+ public void FillPie(System.Drawing.Brush brush, float x, float y, float width, float height, float startAngle, float sweepAngle) { }
+ public void FillPolygon(System.Drawing.Brush brush, System.Drawing.PointF[] points) { }
+ public void FillPolygon(System.Drawing.Brush brush, System.Drawing.PointF[] points, System.Drawing.Drawing2D.FillMode fillMode) { }
+ public void FillPolygon(System.Drawing.Brush brush, System.Drawing.Point[] points) { }
+ public void FillPolygon(System.Drawing.Brush brush, System.Drawing.Point[] points, System.Drawing.Drawing2D.FillMode fillMode) { }
+ public void FillRectangle(System.Drawing.Brush brush, System.Drawing.Rectangle rect) { }
+ public void FillRectangle(System.Drawing.Brush brush, System.Drawing.RectangleF rect) { }
+ public void FillRectangle(System.Drawing.Brush brush, int x, int y, int width, int height) { }
+ public void FillRectangle(System.Drawing.Brush brush, float x, float y, float width, float height) { }
+ public void FillRectangles(System.Drawing.Brush brush, System.Drawing.RectangleF[] rects) { }
+ public void FillRectangles(System.Drawing.Brush brush, System.Drawing.Rectangle[] rects) { }
+ public void FillRegion(System.Drawing.Brush brush, System.Drawing.Region region) { }
+ ~Graphics() { }
+ public void Flush() { }
+ public void Flush(System.Drawing.Drawing2D.FlushIntention intention) { }
+ [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))]
+ public static System.Drawing.Graphics FromHdc(System.IntPtr hdc) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))]
+ public static System.Drawing.Graphics FromHdc(System.IntPtr hdc, System.IntPtr hdevice) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))]
+ [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2))]
+ public static System.Drawing.Graphics FromHdcInternal(System.IntPtr hdc) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))]
+ public static System.Drawing.Graphics FromHwnd(System.IntPtr hwnd) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))]
+ [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2))]
+ public static System.Drawing.Graphics FromHwndInternal(System.IntPtr hwnd) { throw null; }
+ public static System.Drawing.Graphics FromImage(System.Drawing.Image image) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))]
+ public object GetContextInfo() { throw null; }
+ public static System.IntPtr GetHalftonePalette() { throw null; }
+ [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2))]
+ public System.IntPtr GetHdc() { throw null; }
+ public System.Drawing.Color GetNearestColor(System.Drawing.Color color) { throw null; }
+ public void IntersectClip(System.Drawing.Rectangle rect) { }
+ public void IntersectClip(System.Drawing.RectangleF rect) { }
+ public void IntersectClip(System.Drawing.Region region) { }
+ public bool IsVisible(System.Drawing.Point point) { throw null; }
+ public bool IsVisible(System.Drawing.PointF point) { throw null; }
+ public bool IsVisible(System.Drawing.Rectangle rect) { throw null; }
+ public bool IsVisible(System.Drawing.RectangleF rect) { throw null; }
+ public bool IsVisible(int x, int y) { throw null; }
+ public bool IsVisible(int x, int y, int width, int height) { throw null; }
+ public bool IsVisible(float x, float y) { throw null; }
+ public bool IsVisible(float x, float y, float width, float height) { throw null; }
+ public System.Drawing.Region[] MeasureCharacterRanges(string text, System.Drawing.Font font, System.Drawing.RectangleF layoutRect, System.Drawing.StringFormat stringFormat) { throw null; }
+ public System.Drawing.SizeF MeasureString(string text, System.Drawing.Font font) { throw null; }
+ public System.Drawing.SizeF MeasureString(string text, System.Drawing.Font font, System.Drawing.PointF origin, System.Drawing.StringFormat stringFormat) { throw null; }
+ public System.Drawing.SizeF MeasureString(string text, System.Drawing.Font font, System.Drawing.SizeF layoutArea) { throw null; }
+ public System.Drawing.SizeF MeasureString(string text, System.Drawing.Font font, System.Drawing.SizeF layoutArea, System.Drawing.StringFormat stringFormat) { throw null; }
+ public System.Drawing.SizeF MeasureString(string text, System.Drawing.Font font, System.Drawing.SizeF layoutArea, System.Drawing.StringFormat stringFormat, out int charactersFitted, out int linesFilled) { charactersFitted = default(int); linesFilled = default(int); throw null; }
+ public System.Drawing.SizeF MeasureString(string text, System.Drawing.Font font, int width) { throw null; }
+ public System.Drawing.SizeF MeasureString(string text, System.Drawing.Font font, int width, System.Drawing.StringFormat format) { throw null; }
+ public void MultiplyTransform(System.Drawing.Drawing2D.Matrix matrix) { }
+ public void MultiplyTransform(System.Drawing.Drawing2D.Matrix matrix, System.Drawing.Drawing2D.MatrixOrder order) { }
+ [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2))]
+ public void ReleaseHdc() { }
+ [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))]
+ public void ReleaseHdc(System.IntPtr hdc) { }
+ [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))]
+ [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2))]
+ public void ReleaseHdcInternal(System.IntPtr hdc) { }
+ public void ResetClip() { }
+ public void ResetTransform() { }
+ public void Restore(System.Drawing.Drawing2D.GraphicsState gstate) { }
+ public void RotateTransform(float angle) { }
+ public void RotateTransform(float angle, System.Drawing.Drawing2D.MatrixOrder order) { }
+ public System.Drawing.Drawing2D.GraphicsState Save() { throw null; }
+ public void ScaleTransform(float sx, float sy) { }
+ public void ScaleTransform(float sx, float sy, System.Drawing.Drawing2D.MatrixOrder order) { }
+ public void SetClip(System.Drawing.Drawing2D.GraphicsPath path) { }
+ public void SetClip(System.Drawing.Drawing2D.GraphicsPath path, System.Drawing.Drawing2D.CombineMode combineMode) { }
+ public void SetClip(System.Drawing.Graphics g) { }
+ public void SetClip(System.Drawing.Graphics g, System.Drawing.Drawing2D.CombineMode combineMode) { }
+ public void SetClip(System.Drawing.Rectangle rect) { }
+ public void SetClip(System.Drawing.Rectangle rect, System.Drawing.Drawing2D.CombineMode combineMode) { }
+ public void SetClip(System.Drawing.RectangleF rect) { }
+ public void SetClip(System.Drawing.RectangleF rect, System.Drawing.Drawing2D.CombineMode combineMode) { }
+ public void SetClip(System.Drawing.Region region, System.Drawing.Drawing2D.CombineMode combineMode) { }
+ public void TransformPoints(System.Drawing.Drawing2D.CoordinateSpace destSpace, System.Drawing.Drawing2D.CoordinateSpace srcSpace, System.Drawing.PointF[] pts) { }
+ public void TransformPoints(System.Drawing.Drawing2D.CoordinateSpace destSpace, System.Drawing.Drawing2D.CoordinateSpace srcSpace, System.Drawing.Point[] pts) { }
+ public void TranslateClip(int dx, int dy) { }
+ public void TranslateClip(float dx, float dy) { }
+ public void TranslateTransform(float dx, float dy) { }
+ public void TranslateTransform(float dx, float dy, System.Drawing.Drawing2D.MatrixOrder order) { }
+ public delegate bool DrawImageAbort(System.IntPtr callbackdata);
+ public delegate bool EnumerateMetafileProc(System.Drawing.Imaging.EmfPlusRecordType recordType, int flags, int dataSize, System.IntPtr data, System.Drawing.Imaging.PlayRecordCallback callbackData);
+ }
+ public enum GraphicsUnit
+ {
+ Display = 1,
+ Document = 5,
+ Inch = 4,
+ Millimeter = 6,
+ Pixel = 2,
+ Point = 3,
+ World = 0,
+ }
+ public sealed partial class Icon : System.MarshalByRefObject, System.ICloneable, System.IDisposable, System.Runtime.Serialization.ISerializable
+ {
+ public Icon(System.Drawing.Icon original, System.Drawing.Size size) { }
+ public Icon(System.Drawing.Icon original, int width, int height) { }
+ public Icon(System.IO.Stream stream) { }
+ public Icon(System.IO.Stream stream, System.Drawing.Size size) { }
+ public Icon(System.IO.Stream stream, int width, int height) { }
+ public Icon(string fileName) { }
+ public Icon(string fileName, System.Drawing.Size size) { }
+ public Icon(string fileName, int width, int height) { }
+ public Icon(System.Type type, string resource) { }
+ [System.ComponentModel.BrowsableAttribute(false)]
+ public System.IntPtr Handle { get { throw null; } }
+ [System.ComponentModel.BrowsableAttribute(false)]
+ public int Height { get { throw null; } }
+ public System.Drawing.Size Size { get { throw null; } }
+ [System.ComponentModel.BrowsableAttribute(false)]
+ public int Width { get { throw null; } }
+ public object Clone() { throw null; }
+ public void Dispose() { }
+ public static System.Drawing.Icon ExtractAssociatedIcon(string filePath) { throw null; }
+ ~Icon() { }
+ public static System.Drawing.Icon FromHandle(System.IntPtr handle) { throw null; }
+ public void Save(System.IO.Stream outputStream) { }
+ [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128))]
+ void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo si, System.Runtime.Serialization.StreamingContext context) { }
+ public System.Drawing.Bitmap ToBitmap() { throw null; }
+ public override string ToString() { throw null; }
+ }
+ public partial interface IDeviceContext : System.IDisposable
+ {
+ [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2))]
+ [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2))]
+ System.IntPtr GetHdc();
+ [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2))]
+ [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2))]
+ void ReleaseHdc();
+ }
+ [System.ComponentModel.ImmutableObjectAttribute(true)]
+ [System.Runtime.InteropServices.ComVisibleAttribute(true)]
+ public abstract partial class Image : System.MarshalByRefObject, System.ICloneable, System.IDisposable, System.Runtime.Serialization.ISerializable
+ {
+ internal Image() { }
+ [System.ComponentModel.BrowsableAttribute(false)]
+ public int Flags { get { throw null; } }
+ [System.ComponentModel.BrowsableAttribute(false)]
+ public System.Guid[] FrameDimensionsList { get { throw null; } }
+ [System.ComponentModel.BrowsableAttribute(false)]
+ [System.ComponentModel.DefaultValueAttribute(false)]
+ [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))]
+ public int Height { get { throw null; } }
+ public float HorizontalResolution { get { throw null; } }
+ [System.ComponentModel.BrowsableAttribute(false)]
+ public System.Drawing.Imaging.ColorPalette Palette { get { throw null; } set { } }
+ public System.Drawing.SizeF PhysicalDimension { get { throw null; } }
+ public System.Drawing.Imaging.PixelFormat PixelFormat { get { throw null; } }
+ [System.ComponentModel.BrowsableAttribute(false)]
+ public int[] PropertyIdList { get { throw null; } }
+ [System.ComponentModel.BrowsableAttribute(false)]
+ public System.Drawing.Imaging.PropertyItem[] PropertyItems { get { throw null; } }
+ public System.Drawing.Imaging.ImageFormat RawFormat { get { throw null; } }
+ public System.Drawing.Size Size { get { throw null; } }
+ [System.ComponentModel.DefaultValueAttribute(null)]
+ [System.ComponentModel.LocalizableAttribute(false)]
+ public object Tag { get { throw null; } set { } }
+ public float VerticalResolution { get { throw null; } }
+ [System.ComponentModel.BrowsableAttribute(false)]
+ [System.ComponentModel.DefaultValueAttribute(false)]
+ [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))]
+ public int Width { get { throw null; } }
+ public object Clone() { throw null; }
+ public void Dispose() { }
+ protected virtual void Dispose(bool disposing) { }
+ ~Image() { }
+ public static System.Drawing.Image FromFile(string filename) { throw null; }
+ public static System.Drawing.Image FromFile(string filename, bool useEmbeddedColorManagement) { throw null; }
+ public static System.Drawing.Bitmap FromHbitmap(System.IntPtr hbitmap) { throw null; }
+ public static System.Drawing.Bitmap FromHbitmap(System.IntPtr hbitmap, System.IntPtr hpalette) { throw null; }
+ public static System.Drawing.Image FromStream(System.IO.Stream stream) { throw null; }
+ public static System.Drawing.Image FromStream(System.IO.Stream stream, bool useEmbeddedColorManagement) { throw null; }
+ public static System.Drawing.Image FromStream(System.IO.Stream stream, bool useEmbeddedColorManagement, bool validateImageData) { throw null; }
+ public System.Drawing.RectangleF GetBounds(ref System.Drawing.GraphicsUnit pageUnit) { throw null; }
+ public System.Drawing.Imaging.EncoderParameters GetEncoderParameterList(System.Guid encoder) { throw null; }
+ public int GetFrameCount(System.Drawing.Imaging.FrameDimension dimension) { throw null; }
+ public static int GetPixelFormatSize(System.Drawing.Imaging.PixelFormat pixfmt) { throw null; }
+ public System.Drawing.Imaging.PropertyItem GetPropertyItem(int propid) { throw null; }
+ public System.Drawing.Image GetThumbnailImage(int thumbWidth, int thumbHeight, System.Drawing.Image.GetThumbnailImageAbort callback, System.IntPtr callbackData) { throw null; }
+ public static bool IsAlphaPixelFormat(System.Drawing.Imaging.PixelFormat pixfmt) { throw null; }
+ public static bool IsCanonicalPixelFormat(System.Drawing.Imaging.PixelFormat pixfmt) { throw null; }
+ public static bool IsExtendedPixelFormat(System.Drawing.Imaging.PixelFormat pixfmt) { throw null; }
+ public void RemovePropertyItem(int propid) { }
+ public void RotateFlip(System.Drawing.RotateFlipType rotateFlipType) { }
+ public void Save(System.IO.Stream stream, System.Drawing.Imaging.ImageCodecInfo encoder, System.Drawing.Imaging.EncoderParameters encoderParams) { }
+ public void Save(System.IO.Stream stream, System.Drawing.Imaging.ImageFormat format) { }
+ public void Save(string filename) { }
+ public void Save(string filename, System.Drawing.Imaging.ImageCodecInfo encoder, System.Drawing.Imaging.EncoderParameters encoderParams) { }
+ public void Save(string filename, System.Drawing.Imaging.ImageFormat format) { }
+ public void SaveAdd(System.Drawing.Image image, System.Drawing.Imaging.EncoderParameters encoderParams) { }
+ public void SaveAdd(System.Drawing.Imaging.EncoderParameters encoderParams) { }
+ public int SelectActiveFrame(System.Drawing.Imaging.FrameDimension dimension, int frameIndex) { throw null; }
+ public void SetPropertyItem(System.Drawing.Imaging.PropertyItem propitem) { }
+ [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128))]
+ void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo si, System.Runtime.Serialization.StreamingContext context) { }
+ public delegate bool GetThumbnailImageAbort();
+ }
+ public sealed partial class ImageAnimator
+ {
+ internal ImageAnimator() { }
+ public static void Animate(System.Drawing.Image image, System.EventHandler onFrameChangedHandler) { }
+ public static bool CanAnimate(System.Drawing.Image image) { throw null; }
+ public static void StopAnimate(System.Drawing.Image image, System.EventHandler onFrameChangedHandler) { }
+ public static void UpdateFrames() { }
+ public static void UpdateFrames(System.Drawing.Image image) { }
+ }
+ public sealed partial class Pen : System.MarshalByRefObject, System.ICloneable, System.IDisposable
+ {
+ public Pen(System.Drawing.Brush brush) { }
+ public Pen(System.Drawing.Brush brush, float width) { }
+ public Pen(System.Drawing.Color color) { }
+ public Pen(System.Drawing.Color color, float width) { }
+ public System.Drawing.Drawing2D.PenAlignment Alignment { get { throw null; } set { } }
+ public System.Drawing.Brush Brush { get { throw null; } set { } }
+ public System.Drawing.Color Color { get { throw null; } set { } }
+ public float[] CompoundArray { get { throw null; } set { } }
+ public System.Drawing.Drawing2D.CustomLineCap CustomEndCap { get { throw null; } set { } }
+ public System.Drawing.Drawing2D.CustomLineCap CustomStartCap { get { throw null; } set { } }
+ public System.Drawing.Drawing2D.DashCap DashCap { get { throw null; } set { } }
+ public float DashOffset { get { throw null; } set { } }
+ public float[] DashPattern { get { throw null; } set { } }
+ public System.Drawing.Drawing2D.DashStyle DashStyle { get { throw null; } set { } }
+ public System.Drawing.Drawing2D.LineCap EndCap { get { throw null; } set { } }
+ public System.Drawing.Drawing2D.LineJoin LineJoin { get { throw null; } set { } }
+ public float MiterLimit { get { throw null; } set { } }
+ public System.Drawing.Drawing2D.PenType PenType { get { throw null; } }
+ public System.Drawing.Drawing2D.LineCap StartCap { get { throw null; } set { } }
+ public System.Drawing.Drawing2D.Matrix Transform { get { throw null; } set { } }
+ public float Width { get { throw null; } set { } }
+ public object Clone() { throw null; }
+ public void Dispose() { }
+ ~Pen() { }
+ public void MultiplyTransform(System.Drawing.Drawing2D.Matrix matrix) { }
+ public void MultiplyTransform(System.Drawing.Drawing2D.Matrix matrix, System.Drawing.Drawing2D.MatrixOrder order) { }
+ public void ResetTransform() { }
+ public void RotateTransform(float angle) { }
+ public void RotateTransform(float angle, System.Drawing.Drawing2D.MatrixOrder order) { }
+ public void ScaleTransform(float sx, float sy) { }
+ public void ScaleTransform(float sx, float sy, System.Drawing.Drawing2D.MatrixOrder order) { }
+ public void SetLineCap(System.Drawing.Drawing2D.LineCap startCap, System.Drawing.Drawing2D.LineCap endCap, System.Drawing.Drawing2D.DashCap dashCap) { }
+ public void TranslateTransform(float dx, float dy) { }
+ public void TranslateTransform(float dx, float dy, System.Drawing.Drawing2D.MatrixOrder order) { }
+ }
+ public sealed partial class Pens
+ {
+ internal Pens() { }
+ public static System.Drawing.Pen AliceBlue { get { throw null; } }
+ public static System.Drawing.Pen AntiqueWhite { get { throw null; } }
+ public static System.Drawing.Pen Aqua { get { throw null; } }
+ public static System.Drawing.Pen Aquamarine { get { throw null; } }
+ public static System.Drawing.Pen Azure { get { throw null; } }
+ public static System.Drawing.Pen Beige { get { throw null; } }
+ public static System.Drawing.Pen Bisque { get { throw null; } }
+ public static System.Drawing.Pen Black { get { throw null; } }
+ public static System.Drawing.Pen BlanchedAlmond { get { throw null; } }
+ public static System.Drawing.Pen Blue { get { throw null; } }
+ public static System.Drawing.Pen BlueViolet { get { throw null; } }
+ public static System.Drawing.Pen Brown { get { throw null; } }
+ public static System.Drawing.Pen BurlyWood { get { throw null; } }
+ public static System.Drawing.Pen CadetBlue { get { throw null; } }
+ public static System.Drawing.Pen Chartreuse { get { throw null; } }
+ public static System.Drawing.Pen Chocolate { get { throw null; } }
+ public static System.Drawing.Pen Coral { get { throw null; } }
+ public static System.Drawing.Pen CornflowerBlue { get { throw null; } }
+ public static System.Drawing.Pen Cornsilk { get { throw null; } }
+ public static System.Drawing.Pen Crimson { get { throw null; } }
+ public static System.Drawing.Pen Cyan { get { throw null; } }
+ public static System.Drawing.Pen DarkBlue { get { throw null; } }
+ public static System.Drawing.Pen DarkCyan { get { throw null; } }
+ public static System.Drawing.Pen DarkGoldenrod { get { throw null; } }
+ public static System.Drawing.Pen DarkGray { get { throw null; } }
+ public static System.Drawing.Pen DarkGreen { get { throw null; } }
+ public static System.Drawing.Pen DarkKhaki { get { throw null; } }
+ public static System.Drawing.Pen DarkMagenta { get { throw null; } }
+ public static System.Drawing.Pen DarkOliveGreen { get { throw null; } }
+ public static System.Drawing.Pen DarkOrange { get { throw null; } }
+ public static System.Drawing.Pen DarkOrchid { get { throw null; } }
+ public static System.Drawing.Pen DarkRed { get { throw null; } }
+ public static System.Drawing.Pen DarkSalmon { get { throw null; } }
+ public static System.Drawing.Pen DarkSeaGreen { get { throw null; } }
+ public static System.Drawing.Pen DarkSlateBlue { get { throw null; } }
+ public static System.Drawing.Pen DarkSlateGray { get { throw null; } }
+ public static System.Drawing.Pen DarkTurquoise { get { throw null; } }
+ public static System.Drawing.Pen DarkViolet { get { throw null; } }
+ public static System.Drawing.Pen DeepPink { get { throw null; } }
+ public static System.Drawing.Pen DeepSkyBlue { get { throw null; } }
+ public static System.Drawing.Pen DimGray { get { throw null; } }
+ public static System.Drawing.Pen DodgerBlue { get { throw null; } }
+ public static System.Drawing.Pen Firebrick { get { throw null; } }
+ public static System.Drawing.Pen FloralWhite { get { throw null; } }
+ public static System.Drawing.Pen ForestGreen { get { throw null; } }
+ public static System.Drawing.Pen Fuchsia { get { throw null; } }
+ public static System.Drawing.Pen Gainsboro { get { throw null; } }
+ public static System.Drawing.Pen GhostWhite { get { throw null; } }
+ public static System.Drawing.Pen Gold { get { throw null; } }
+ public static System.Drawing.Pen Goldenrod { get { throw null; } }
+ public static System.Drawing.Pen Gray { get { throw null; } }
+ public static System.Drawing.Pen Green { get { throw null; } }
+ public static System.Drawing.Pen GreenYellow { get { throw null; } }
+ public static System.Drawing.Pen Honeydew { get { throw null; } }
+ public static System.Drawing.Pen HotPink { get { throw null; } }
+ public static System.Drawing.Pen IndianRed { get { throw null; } }
+ public static System.Drawing.Pen Indigo { get { throw null; } }
+ public static System.Drawing.Pen Ivory { get { throw null; } }
+ public static System.Drawing.Pen Khaki { get { throw null; } }
+ public static System.Drawing.Pen Lavender { get { throw null; } }
+ public static System.Drawing.Pen LavenderBlush { get { throw null; } }
+ public static System.Drawing.Pen LawnGreen { get { throw null; } }
+ public static System.Drawing.Pen LemonChiffon { get { throw null; } }
+ public static System.Drawing.Pen LightBlue { get { throw null; } }
+ public static System.Drawing.Pen LightCoral { get { throw null; } }
+ public static System.Drawing.Pen LightCyan { get { throw null; } }
+ public static System.Drawing.Pen LightGoldenrodYellow { get { throw null; } }
+ public static System.Drawing.Pen LightGray { get { throw null; } }
+ public static System.Drawing.Pen LightGreen { get { throw null; } }
+ public static System.Drawing.Pen LightPink { get { throw null; } }
+ public static System.Drawing.Pen LightSalmon { get { throw null; } }
+ public static System.Drawing.Pen LightSeaGreen { get { throw null; } }
+ public static System.Drawing.Pen LightSkyBlue { get { throw null; } }
+ public static System.Drawing.Pen LightSlateGray { get { throw null; } }
+ public static System.Drawing.Pen LightSteelBlue { get { throw null; } }
+ public static System.Drawing.Pen LightYellow { get { throw null; } }
+ public static System.Drawing.Pen Lime { get { throw null; } }
+ public static System.Drawing.Pen LimeGreen { get { throw null; } }
+ public static System.Drawing.Pen Linen { get { throw null; } }
+ public static System.Drawing.Pen Magenta { get { throw null; } }
+ public static System.Drawing.Pen Maroon { get { throw null; } }
+ public static System.Drawing.Pen MediumAquamarine { get { throw null; } }
+ public static System.Drawing.Pen MediumBlue { get { throw null; } }
+ public static System.Drawing.Pen MediumOrchid { get { throw null; } }
+ public static System.Drawing.Pen MediumPurple { get { throw null; } }
+ public static System.Drawing.Pen MediumSeaGreen { get { throw null; } }
+ public static System.Drawing.Pen MediumSlateBlue { get { throw null; } }
+ public static System.Drawing.Pen MediumSpringGreen { get { throw null; } }
+ public static System.Drawing.Pen MediumTurquoise { get { throw null; } }
+ public static System.Drawing.Pen MediumVioletRed { get { throw null; } }
+ public static System.Drawing.Pen MidnightBlue { get { throw null; } }
+ public static System.Drawing.Pen MintCream { get { throw null; } }
+ public static System.Drawing.Pen MistyRose { get { throw null; } }
+ public static System.Drawing.Pen Moccasin { get { throw null; } }
+ public static System.Drawing.Pen NavajoWhite { get { throw null; } }
+ public static System.Drawing.Pen Navy { get { throw null; } }
+ public static System.Drawing.Pen OldLace { get { throw null; } }
+ public static System.Drawing.Pen Olive { get { throw null; } }
+ public static System.Drawing.Pen OliveDrab { get { throw null; } }
+ public static System.Drawing.Pen Orange { get { throw null; } }
+ public static System.Drawing.Pen OrangeRed { get { throw null; } }
+ public static System.Drawing.Pen Orchid { get { throw null; } }
+ public static System.Drawing.Pen PaleGoldenrod { get { throw null; } }
+ public static System.Drawing.Pen PaleGreen { get { throw null; } }
+ public static System.Drawing.Pen PaleTurquoise { get { throw null; } }
+ public static System.Drawing.Pen PaleVioletRed { get { throw null; } }
+ public static System.Drawing.Pen PapayaWhip { get { throw null; } }
+ public static System.Drawing.Pen PeachPuff { get { throw null; } }
+ public static System.Drawing.Pen Peru { get { throw null; } }
+ public static System.Drawing.Pen Pink { get { throw null; } }
+ public static System.Drawing.Pen Plum { get { throw null; } }
+ public static System.Drawing.Pen PowderBlue { get { throw null; } }
+ public static System.Drawing.Pen Purple { get { throw null; } }
+ public static System.Drawing.Pen Red { get { throw null; } }
+ public static System.Drawing.Pen RosyBrown { get { throw null; } }
+ public static System.Drawing.Pen RoyalBlue { get { throw null; } }
+ public static System.Drawing.Pen SaddleBrown { get { throw null; } }
+ public static System.Drawing.Pen Salmon { get { throw null; } }
+ public static System.Drawing.Pen SandyBrown { get { throw null; } }
+ public static System.Drawing.Pen SeaGreen { get { throw null; } }
+ public static System.Drawing.Pen SeaShell { get { throw null; } }
+ public static System.Drawing.Pen Sienna { get { throw null; } }
+ public static System.Drawing.Pen Silver { get { throw null; } }
+ public static System.Drawing.Pen SkyBlue { get { throw null; } }
+ public static System.Drawing.Pen SlateBlue { get { throw null; } }
+ public static System.Drawing.Pen SlateGray { get { throw null; } }
+ public static System.Drawing.Pen Snow { get { throw null; } }
+ public static System.Drawing.Pen SpringGreen { get { throw null; } }
+ public static System.Drawing.Pen SteelBlue { get { throw null; } }
+ public static System.Drawing.Pen Tan { get { throw null; } }
+ public static System.Drawing.Pen Teal { get { throw null; } }
+ public static System.Drawing.Pen Thistle { get { throw null; } }
+ public static System.Drawing.Pen Tomato { get { throw null; } }
+ public static System.Drawing.Pen Transparent { get { throw null; } }
+ public static System.Drawing.Pen Turquoise { get { throw null; } }
+ public static System.Drawing.Pen Violet { get { throw null; } }
+ public static System.Drawing.Pen Wheat { get { throw null; } }
+ public static System.Drawing.Pen White { get { throw null; } }
+ public static System.Drawing.Pen WhiteSmoke { get { throw null; } }
+ public static System.Drawing.Pen Yellow { get { throw null; } }
+ public static System.Drawing.Pen YellowGreen { get { throw null; } }
+ }
+ public sealed partial class Region : System.MarshalByRefObject, System.IDisposable
+ {
+ public Region() { }
+ public Region(System.Drawing.Drawing2D.GraphicsPath path) { }
+ public Region(System.Drawing.Drawing2D.RegionData rgnData) { }
+ public Region(System.Drawing.Rectangle rect) { }
+ public Region(System.Drawing.RectangleF rect) { }
+ public System.Drawing.Region Clone() { throw null; }
+ public void Complement(System.Drawing.Drawing2D.GraphicsPath path) { }
+ public void Complement(System.Drawing.Rectangle rect) { }
+ public void Complement(System.Drawing.RectangleF rect) { }
+ public void Complement(System.Drawing.Region region) { }
+ public void Dispose() { }
+ public bool Equals(System.Drawing.Region region, System.Drawing.Graphics g) { throw null; }
+ public void Exclude(System.Drawing.Drawing2D.GraphicsPath path) { }
+ public void Exclude(System.Drawing.Rectangle rect) { }
+ public void Exclude(System.Drawing.RectangleF rect) { }
+ public void Exclude(System.Drawing.Region region) { }
+ ~Region() { }
+ public static System.Drawing.Region FromHrgn(System.IntPtr hrgn) { throw null; }
+ public System.Drawing.RectangleF GetBounds(System.Drawing.Graphics g) { throw null; }
+ public System.IntPtr GetHrgn(System.Drawing.Graphics g) { throw null; }
+ public System.Drawing.Drawing2D.RegionData GetRegionData() { throw null; }
+ public System.Drawing.RectangleF[] GetRegionScans(System.Drawing.Drawing2D.Matrix matrix) { throw null; }
+ public void Intersect(System.Drawing.Drawing2D.GraphicsPath path) { }
+ public void Intersect(System.Drawing.Rectangle rect) { }
+ public void Intersect(System.Drawing.RectangleF rect) { }
+ public void Intersect(System.Drawing.Region region) { }
+ public bool IsEmpty(System.Drawing.Graphics g) { throw null; }
+ public bool IsInfinite(System.Drawing.Graphics g) { throw null; }
+ public bool IsVisible(System.Drawing.Point point) { throw null; }
+ public bool IsVisible(System.Drawing.Point point, System.Drawing.Graphics g) { throw null; }
+ public bool IsVisible(System.Drawing.PointF point) { throw null; }
+ public bool IsVisible(System.Drawing.PointF point, System.Drawing.Graphics g) { throw null; }
+ public bool IsVisible(System.Drawing.Rectangle rect) { throw null; }
+ public bool IsVisible(System.Drawing.Rectangle rect, System.Drawing.Graphics g) { throw null; }
+ public bool IsVisible(System.Drawing.RectangleF rect) { throw null; }
+ public bool IsVisible(System.Drawing.RectangleF rect, System.Drawing.Graphics g) { throw null; }
+ public bool IsVisible(int x, int y, System.Drawing.Graphics g) { throw null; }
+ public bool IsVisible(int x, int y, int width, int height) { throw null; }
+ public bool IsVisible(int x, int y, int width, int height, System.Drawing.Graphics g) { throw null; }
+ public bool IsVisible(float x, float y) { throw null; }
+ public bool IsVisible(float x, float y, System.Drawing.Graphics g) { throw null; }
+ public bool IsVisible(float x, float y, float width, float height) { throw null; }
+ public bool IsVisible(float x, float y, float width, float height, System.Drawing.Graphics g) { throw null; }
+ public void MakeEmpty() { }
+ public void MakeInfinite() { }
+ public void ReleaseHrgn(System.IntPtr regionHandle) { }
+ public void Transform(System.Drawing.Drawing2D.Matrix matrix) { }
+ public void Translate(int dx, int dy) { }
+ public void Translate(float dx, float dy) { }
+ public void Union(System.Drawing.Drawing2D.GraphicsPath path) { }
+ public void Union(System.Drawing.Rectangle rect) { }
+ public void Union(System.Drawing.RectangleF rect) { }
+ public void Union(System.Drawing.Region region) { }
+ public void Xor(System.Drawing.Drawing2D.GraphicsPath path) { }
+ public void Xor(System.Drawing.Rectangle rect) { }
+ public void Xor(System.Drawing.RectangleF rect) { }
+ public void Xor(System.Drawing.Region region) { }
+ }
+ public enum RotateFlipType
+ {
+ Rotate180FlipNone = 2,
+ Rotate180FlipX = 6,
+ Rotate180FlipXY = 0,
+ Rotate180FlipY = 4,
+ Rotate270FlipNone = 3,
+ Rotate270FlipX = 7,
+ Rotate270FlipXY = 1,
+ Rotate270FlipY = 5,
+ Rotate90FlipNone = 1,
+ Rotate90FlipX = 5,
+ Rotate90FlipXY = 3,
+ Rotate90FlipY = 7,
+ RotateNoneFlipNone = 0,
+ RotateNoneFlipX = 4,
+ RotateNoneFlipXY = 2,
+ RotateNoneFlipY = 6,
+ }
+ public sealed partial class SolidBrush : System.Drawing.Brush
+ {
+ public SolidBrush(System.Drawing.Color color) { }
+ public System.Drawing.Color Color { get { throw null; } set { } }
+ public override object Clone() { throw null; }
+ protected override void Dispose(bool disposing) { }
+ }
+ public enum StringAlignment
+ {
+ Center = 1,
+ Far = 2,
+ Near = 0,
+ }
+ public enum StringDigitSubstitute
+ {
+ National = 2,
+ None = 1,
+ Traditional = 3,
+ User = 0,
+ }
+ public sealed partial class StringFormat : System.MarshalByRefObject, System.ICloneable, System.IDisposable
+ {
+ public StringFormat() { }
+ public StringFormat(System.Drawing.StringFormat format) { }
+ public StringFormat(System.Drawing.StringFormatFlags options) { }
+ public StringFormat(System.Drawing.StringFormatFlags options, int language) { }
+ public System.Drawing.StringAlignment Alignment { get { throw null; } set { } }
+ public int DigitSubstitutionLanguage { get { throw null; } }
+ public System.Drawing.StringDigitSubstitute DigitSubstitutionMethod { get { throw null; } }
+ public System.Drawing.StringFormatFlags FormatFlags { get { throw null; } set { } }
+ public static System.Drawing.StringFormat GenericDefault { get { throw null; } }
+ public static System.Drawing.StringFormat GenericTypographic { get { throw null; } }
+ public System.Drawing.Text.HotkeyPrefix HotkeyPrefix { get { throw null; } set { } }
+ public System.Drawing.StringAlignment LineAlignment { get { throw null; } set { } }
+ public System.Drawing.StringTrimming Trimming { get { throw null; } set { } }
+ public object Clone() { throw null; }
+ public void Dispose() { }
+ ~StringFormat() { }
+ public float[] GetTabStops(out float firstTabOffset) { firstTabOffset = default(float); throw null; }
+ public void SetDigitSubstitution(int language, System.Drawing.StringDigitSubstitute substitute) { }
+ public void SetMeasurableCharacterRanges(System.Drawing.CharacterRange[] ranges) { }
+ public void SetTabStops(float firstTabOffset, float[] tabStops) { }
+ public override string ToString() { throw null; }
+ }
+ [System.FlagsAttribute]
+ public enum StringFormatFlags
+ {
+ DirectionRightToLeft = 1,
+ DirectionVertical = 2,
+ DisplayFormatControl = 32,
+ FitBlackBox = 4,
+ LineLimit = 8192,
+ MeasureTrailingSpaces = 2048,
+ NoClip = 16384,
+ NoFontFallback = 1024,
+ NoWrap = 4096,
+ }
+ public enum StringTrimming
+ {
+ Character = 1,
+ EllipsisCharacter = 3,
+ EllipsisPath = 5,
+ EllipsisWord = 4,
+ None = 0,
+ Word = 2,
+ }
+ public enum StringUnit
+ {
+ Display = 1,
+ Document = 5,
+ Em = 32,
+ Inch = 4,
+ Millimeter = 6,
+ Pixel = 2,
+ Point = 3,
+ World = 0,
+ }
+ public sealed partial class SystemBrushes
+ {
+ internal SystemBrushes() { }
+ public static System.Drawing.Brush ActiveBorder { get { throw null; } }
+ public static System.Drawing.Brush ActiveCaption { get { throw null; } }
+ public static System.Drawing.Brush ActiveCaptionText { get { throw null; } }
+ public static System.Drawing.Brush AppWorkspace { get { throw null; } }
+ public static System.Drawing.Brush ButtonFace { get { throw null; } }
+ public static System.Drawing.Brush ButtonHighlight { get { throw null; } }
+ public static System.Drawing.Brush ButtonShadow { get { throw null; } }
+ public static System.Drawing.Brush Control { get { throw null; } }
+ public static System.Drawing.Brush ControlDark { get { throw null; } }
+ public static System.Drawing.Brush ControlDarkDark { get { throw null; } }
+ public static System.Drawing.Brush ControlLight { get { throw null; } }
+ public static System.Drawing.Brush ControlLightLight { get { throw null; } }
+ public static System.Drawing.Brush ControlText { get { throw null; } }
+ public static System.Drawing.Brush Desktop { get { throw null; } }
+ public static System.Drawing.Brush GradientActiveCaption { get { throw null; } }
+ public static System.Drawing.Brush GradientInactiveCaption { get { throw null; } }
+ public static System.Drawing.Brush GrayText { get { throw null; } }
+ public static System.Drawing.Brush Highlight { get { throw null; } }
+ public static System.Drawing.Brush HighlightText { get { throw null; } }
+ public static System.Drawing.Brush HotTrack { get { throw null; } }
+ public static System.Drawing.Brush InactiveBorder { get { throw null; } }
+ public static System.Drawing.Brush InactiveCaption { get { throw null; } }
+ public static System.Drawing.Brush InactiveCaptionText { get { throw null; } }
+ public static System.Drawing.Brush Info { get { throw null; } }
+ public static System.Drawing.Brush InfoText { get { throw null; } }
+ public static System.Drawing.Brush Menu { get { throw null; } }
+ public static System.Drawing.Brush MenuBar { get { throw null; } }
+ public static System.Drawing.Brush MenuHighlight { get { throw null; } }
+ public static System.Drawing.Brush MenuText { get { throw null; } }
+ public static System.Drawing.Brush ScrollBar { get { throw null; } }
+ public static System.Drawing.Brush Window { get { throw null; } }
+ public static System.Drawing.Brush WindowFrame { get { throw null; } }
+ public static System.Drawing.Brush WindowText { get { throw null; } }
+ public static System.Drawing.Brush FromSystemColor(System.Drawing.Color c) { throw null; }
+ }
+ public sealed partial class SystemColors
+ {
+ internal SystemColors() { }
+ public static System.Drawing.Color ActiveBorder { get { throw null; } }
+ public static System.Drawing.Color ActiveCaption { get { throw null; } }
+ public static System.Drawing.Color ActiveCaptionText { get { throw null; } }
+ public static System.Drawing.Color AppWorkspace { get { throw null; } }
+ public static System.Drawing.Color ButtonFace { get { throw null; } }
+ public static System.Drawing.Color ButtonHighlight { get { throw null; } }
+ public static System.Drawing.Color ButtonShadow { get { throw null; } }
+ public static System.Drawing.Color Control { get { throw null; } }
+ public static System.Drawing.Color ControlDark { get { throw null; } }
+ public static System.Drawing.Color ControlDarkDark { get { throw null; } }
+ public static System.Drawing.Color ControlLight { get { throw null; } }
+ public static System.Drawing.Color ControlLightLight { get { throw null; } }
+ public static System.Drawing.Color ControlText { get { throw null; } }
+ public static System.Drawing.Color Desktop { get { throw null; } }
+ public static System.Drawing.Color GradientActiveCaption { get { throw null; } }
+ public static System.Drawing.Color GradientInactiveCaption { get { throw null; } }
+ public static System.Drawing.Color GrayText { get { throw null; } }
+ public static System.Drawing.Color Highlight { get { throw null; } }
+ public static System.Drawing.Color HighlightText { get { throw null; } }
+ public static System.Drawing.Color HotTrack { get { throw null; } }
+ public static System.Drawing.Color InactiveBorder { get { throw null; } }
+ public static System.Drawing.Color InactiveCaption { get { throw null; } }
+ public static System.Drawing.Color InactiveCaptionText { get { throw null; } }
+ public static System.Drawing.Color Info { get { throw null; } }
+ public static System.Drawing.Color InfoText { get { throw null; } }
+ public static System.Drawing.Color Menu { get { throw null; } }
+ public static System.Drawing.Color MenuBar { get { throw null; } }
+ public static System.Drawing.Color MenuHighlight { get { throw null; } }
+ public static System.Drawing.Color MenuText { get { throw null; } }
+ public static System.Drawing.Color ScrollBar { get { throw null; } }
+ public static System.Drawing.Color Window { get { throw null; } }
+ public static System.Drawing.Color WindowFrame { get { throw null; } }
+ public static System.Drawing.Color WindowText { get { throw null; } }
+ }
+ public sealed partial class SystemFonts
+ {
+ internal SystemFonts() { }
+ public static System.Drawing.Font CaptionFont { get { throw null; } }
+ public static System.Drawing.Font DefaultFont { get { throw null; } }
+ public static System.Drawing.Font DialogFont { get { throw null; } }
+ public static System.Drawing.Font IconTitleFont { get { throw null; } }
+ public static System.Drawing.Font MenuFont { get { throw null; } }
+ public static System.Drawing.Font MessageBoxFont { get { throw null; } }
+ public static System.Drawing.Font SmallCaptionFont { get { throw null; } }
+ public static System.Drawing.Font StatusFont { get { throw null; } }
+ public static System.Drawing.Font GetFontByName(string systemFontName) { throw null; }
+ }
+ public sealed partial class SystemIcons
+ {
+ internal SystemIcons() { }
+ public static System.Drawing.Icon Application { get { throw null; } }
+ public static System.Drawing.Icon Asterisk { get { throw null; } }
+ public static System.Drawing.Icon Error { get { throw null; } }
+ public static System.Drawing.Icon Exclamation { get { throw null; } }
+ public static System.Drawing.Icon Hand { get { throw null; } }
+ public static System.Drawing.Icon Information { get { throw null; } }
+ public static System.Drawing.Icon Question { get { throw null; } }
+ public static System.Drawing.Icon Shield { get { throw null; } }
+ public static System.Drawing.Icon Warning { get { throw null; } }
+ public static System.Drawing.Icon WinLogo { get { throw null; } }
+ }
+ public sealed partial class SystemPens
+ {
+ internal SystemPens() { }
+ public static System.Drawing.Pen ActiveBorder { get { throw null; } }
+ public static System.Drawing.Pen ActiveCaption { get { throw null; } }
+ public static System.Drawing.Pen ActiveCaptionText { get { throw null; } }
+ public static System.Drawing.Pen AppWorkspace { get { throw null; } }
+ public static System.Drawing.Pen ButtonFace { get { throw null; } }
+ public static System.Drawing.Pen ButtonHighlight { get { throw null; } }
+ public static System.Drawing.Pen ButtonShadow { get { throw null; } }
+ public static System.Drawing.Pen Control { get { throw null; } }
+ public static System.Drawing.Pen ControlDark { get { throw null; } }
+ public static System.Drawing.Pen ControlDarkDark { get { throw null; } }
+ public static System.Drawing.Pen ControlLight { get { throw null; } }
+ public static System.Drawing.Pen ControlLightLight { get { throw null; } }
+ public static System.Drawing.Pen ControlText { get { throw null; } }
+ public static System.Drawing.Pen Desktop { get { throw null; } }
+ public static System.Drawing.Pen GradientActiveCaption { get { throw null; } }
+ public static System.Drawing.Pen GradientInactiveCaption { get { throw null; } }
+ public static System.Drawing.Pen GrayText { get { throw null; } }
+ public static System.Drawing.Pen Highlight { get { throw null; } }
+ public static System.Drawing.Pen HighlightText { get { throw null; } }
+ public static System.Drawing.Pen HotTrack { get { throw null; } }
+ public static System.Drawing.Pen InactiveBorder { get { throw null; } }
+ public static System.Drawing.Pen InactiveCaption { get { throw null; } }
+ public static System.Drawing.Pen InactiveCaptionText { get { throw null; } }
+ public static System.Drawing.Pen Info { get { throw null; } }
+ public static System.Drawing.Pen InfoText { get { throw null; } }
+ public static System.Drawing.Pen Menu { get { throw null; } }
+ public static System.Drawing.Pen MenuBar { get { throw null; } }
+ public static System.Drawing.Pen MenuHighlight { get { throw null; } }
+ public static System.Drawing.Pen MenuText { get { throw null; } }
+ public static System.Drawing.Pen ScrollBar { get { throw null; } }
+ public static System.Drawing.Pen Window { get { throw null; } }
+ public static System.Drawing.Pen WindowFrame { get { throw null; } }
+ public static System.Drawing.Pen WindowText { get { throw null; } }
+ public static System.Drawing.Pen FromSystemColor(System.Drawing.Color c) { throw null; }
+ }
+ public sealed partial class TextureBrush : System.Drawing.Brush
+ {
+ public TextureBrush(System.Drawing.Image bitmap) { }
+ public TextureBrush(System.Drawing.Image image, System.Drawing.Drawing2D.WrapMode wrapMode) { }
+ public TextureBrush(System.Drawing.Image image, System.Drawing.Drawing2D.WrapMode wrapMode, System.Drawing.Rectangle dstRect) { }
+ public TextureBrush(System.Drawing.Image image, System.Drawing.Drawing2D.WrapMode wrapMode, System.Drawing.RectangleF dstRect) { }
+ public TextureBrush(System.Drawing.Image image, System.Drawing.Rectangle dstRect) { }
+ public TextureBrush(System.Drawing.Image image, System.Drawing.Rectangle dstRect, System.Drawing.Imaging.ImageAttributes imageAttr) { }
+ public TextureBrush(System.Drawing.Image image, System.Drawing.RectangleF dstRect) { }
+ public TextureBrush(System.Drawing.Image image, System.Drawing.RectangleF dstRect, System.Drawing.Imaging.ImageAttributes imageAttr) { }
+ public System.Drawing.Image Image { get { throw null; } }
+ public System.Drawing.Drawing2D.Matrix Transform { get { throw null; } set { } }
+ public System.Drawing.Drawing2D.WrapMode WrapMode { get { throw null; } set { } }
+ public override object Clone() { throw null; }
+ public void MultiplyTransform(System.Drawing.Drawing2D.Matrix matrix) { }
+ public void MultiplyTransform(System.Drawing.Drawing2D.Matrix matrix, System.Drawing.Drawing2D.MatrixOrder order) { }
+ public void ResetTransform() { }
+ public void RotateTransform(float angle) { }
+ public void RotateTransform(float angle, System.Drawing.Drawing2D.MatrixOrder order) { }
+ public void ScaleTransform(float sx, float sy) { }
+ public void ScaleTransform(float sx, float sy, System.Drawing.Drawing2D.MatrixOrder order) { }
+ public void TranslateTransform(float dx, float dy) { }
+ public void TranslateTransform(float dx, float dy, System.Drawing.Drawing2D.MatrixOrder order) { }
+ }
+ [System.AttributeUsageAttribute((System.AttributeTargets)(4))]
+ public partial class ToolboxBitmapAttribute : System.Attribute
+ {
+ public static readonly System.Drawing.ToolboxBitmapAttribute Default;
+ public ToolboxBitmapAttribute(string imageFile) { }
+ public ToolboxBitmapAttribute(System.Type t) { }
+ public ToolboxBitmapAttribute(System.Type t, string name) { }
+ public override bool Equals(object value) { throw null; }
+ public override int GetHashCode() { throw null; }
+ public System.Drawing.Image GetImage(object component) { throw null; }
+ public System.Drawing.Image GetImage(object component, bool large) { throw null; }
+ public System.Drawing.Image GetImage(System.Type type) { throw null; }
+ public System.Drawing.Image GetImage(System.Type type, bool large) { throw null; }
+ public System.Drawing.Image GetImage(System.Type type, string imgName, bool large) { throw null; }
+ public static System.Drawing.Image GetImageFromResource(System.Type t, string imageName, bool large) { throw null; }
+ }
+}
+namespace System.Drawing.Design
+{
+ public sealed partial class CategoryNameCollection : System.Collections.ReadOnlyCollectionBase
+ {
+ public CategoryNameCollection(System.Drawing.Design.CategoryNameCollection value) { }
+ public CategoryNameCollection(string[] value) { }
+ public string this[int index] { get { throw null; } }
+ public bool Contains(string value) { throw null; }
+ public void CopyTo(string[] array, int index) { }
+ public int IndexOf(string value) { throw null; }
+ }
+}
+namespace System.Drawing.Drawing2D
+{
+ public sealed partial class AdjustableArrowCap : System.Drawing.Drawing2D.CustomLineCap
+ {
+ public AdjustableArrowCap(float width, float height) : base (default(System.Drawing.Drawing2D.GraphicsPath), default(System.Drawing.Drawing2D.GraphicsPath)) { }
+ public AdjustableArrowCap(float width, float height, bool isFilled) : base (default(System.Drawing.Drawing2D.GraphicsPath), default(System.Drawing.Drawing2D.GraphicsPath)) { }
+ public bool Filled { get { throw null; } set { } }
+ public float Height { get { throw null; } set { } }
+ public float MiddleInset { get { throw null; } set { } }
+ public float Width { get { throw null; } set { } }
+ }
+ public sealed partial class Blend
+ {
+ public Blend() { }
+ public Blend(int count) { }
+ public float[] Factors { get { throw null; } set { } }
+ public float[] Positions { get { throw null; } set { } }
+ }
+ public sealed partial class ColorBlend
+ {
+ public ColorBlend() { }
+ public ColorBlend(int count) { }
+ public System.Drawing.Color[] Colors { get { throw null; } set { } }
+ public float[] Positions { get { throw null; } set { } }
+ }
+ public enum CombineMode
+ {
+ Complement = 5,
+ Exclude = 4,
+ Intersect = 1,
+ Replace = 0,
+ Union = 2,
+ Xor = 3,
+ }
+ public enum CompositingMode
+ {
+ SourceCopy = 1,
+ SourceOver = 0,
+ }
+ public enum CompositingQuality
+ {
+ AssumeLinear = 4,
+ Default = 0,
+ GammaCorrected = 3,
+ HighQuality = 2,
+ HighSpeed = 1,
+ Invalid = -1,
+ }
+ public enum CoordinateSpace
+ {
+ Device = 2,
+ Page = 1,
+ World = 0,
+ }
+ public partial class CustomLineCap : System.MarshalByRefObject, System.ICloneable, System.IDisposable
+ {
+ public CustomLineCap(System.Drawing.Drawing2D.GraphicsPath fillPath, System.Drawing.Drawing2D.GraphicsPath strokePath) { }
+ public CustomLineCap(System.Drawing.Drawing2D.GraphicsPath fillPath, System.Drawing.Drawing2D.GraphicsPath strokePath, System.Drawing.Drawing2D.LineCap baseCap) { }
+ public CustomLineCap(System.Drawing.Drawing2D.GraphicsPath fillPath, System.Drawing.Drawing2D.GraphicsPath strokePath, System.Drawing.Drawing2D.LineCap baseCap, float baseInset) { }
+ public System.Drawing.Drawing2D.LineCap BaseCap { get { throw null; } set { } }
+ public float BaseInset { get { throw null; } set { } }
+ public System.Drawing.Drawing2D.LineJoin StrokeJoin { get { throw null; } set { } }
+ public float WidthScale { get { throw null; } set { } }
+ public object Clone() { throw null; }
+ public void Dispose() { }
+ protected virtual void Dispose(bool disposing) { }
+ ~CustomLineCap() { }
+ public void GetStrokeCaps(out System.Drawing.Drawing2D.LineCap startCap, out System.Drawing.Drawing2D.LineCap endCap) { startCap = default(System.Drawing.Drawing2D.LineCap); endCap = default(System.Drawing.Drawing2D.LineCap); }
+ public void SetStrokeCaps(System.Drawing.Drawing2D.LineCap startCap, System.Drawing.Drawing2D.LineCap endCap) { }
+ }
+ public enum DashCap
+ {
+ Flat = 0,
+ Round = 2,
+ Triangle = 3,
+ }
+ public enum DashStyle
+ {
+ Custom = 5,
+ Dash = 1,
+ DashDot = 3,
+ DashDotDot = 4,
+ Dot = 2,
+ Solid = 0,
+ }
+ public enum FillMode
+ {
+ Alternate = 0,
+ Winding = 1,
+ }
+ public enum FlushIntention
+ {
+ Flush = 0,
+ Sync = 1,
+ }
+ public sealed partial class GraphicsContainer : System.MarshalByRefObject
+ {
+ internal GraphicsContainer() { }
+ }
+ public sealed partial class GraphicsPath : System.MarshalByRefObject, System.ICloneable, System.IDisposable
+ {
+ public GraphicsPath() { }
+ public GraphicsPath(System.Drawing.Drawing2D.FillMode fillMode) { }
+ public GraphicsPath(System.Drawing.PointF[] pts, byte[] types) { }
+ public GraphicsPath(System.Drawing.PointF[] pts, byte[] types, System.Drawing.Drawing2D.FillMode fillMode) { }
+ public GraphicsPath(System.Drawing.Point[] pts, byte[] types) { }
+ public GraphicsPath(System.Drawing.Point[] pts, byte[] types, System.Drawing.Drawing2D.FillMode fillMode) { }
+ public System.Drawing.Drawing2D.FillMode FillMode { get { throw null; } set { } }
+ public System.Drawing.Drawing2D.PathData PathData { get { throw null; } }
+ public System.Drawing.PointF[] PathPoints { get { throw null; } }
+ public byte[] PathTypes { get { throw null; } }
+ public int PointCount { get { throw null; } }
+ public void AddArc(System.Drawing.Rectangle rect, float startAngle, float sweepAngle) { }
+ public void AddArc(System.Drawing.RectangleF rect, float startAngle, float sweepAngle) { }
+ public void AddArc(int x, int y, int width, int height, float startAngle, float sweepAngle) { }
+ public void AddArc(float x, float y, float width, float height, float startAngle, float sweepAngle) { }
+ public void AddBezier(System.Drawing.Point pt1, System.Drawing.Point pt2, System.Drawing.Point pt3, System.Drawing.Point pt4) { }
+ public void AddBezier(System.Drawing.PointF pt1, System.Drawing.PointF pt2, System.Drawing.PointF pt3, System.Drawing.PointF pt4) { }
+ public void AddBezier(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) { }
+ public void AddBezier(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) { }
+ public void AddBeziers(System.Drawing.PointF[] points) { }
+ public void AddBeziers(params System.Drawing.Point[] points) { }
+ public void AddClosedCurve(System.Drawing.PointF[] points) { }
+ public void AddClosedCurve(System.Drawing.PointF[] points, float tension) { }
+ public void AddClosedCurve(System.Drawing.Point[] points) { }
+ public void AddClosedCurve(System.Drawing.Point[] points, float tension) { }
+ public void AddCurve(System.Drawing.PointF[] points) { }
+ public void AddCurve(System.Drawing.PointF[] points, int offset, int numberOfSegments, float tension) { }
+ public void AddCurve(System.Drawing.PointF[] points, float tension) { }
+ public void AddCurve(System.Drawing.Point[] points) { }
+ public void AddCurve(System.Drawing.Point[] points, int offset, int numberOfSegments, float tension) { }
+ public void AddCurve(System.Drawing.Point[] points, float tension) { }
+ public void AddEllipse(System.Drawing.Rectangle rect) { }
+ public void AddEllipse(System.Drawing.RectangleF rect) { }
+ public void AddEllipse(int x, int y, int width, int height) { }
+ public void AddEllipse(float x, float y, float width, float height) { }
+ public void AddLine(System.Drawing.Point pt1, System.Drawing.Point pt2) { }
+ public void AddLine(System.Drawing.PointF pt1, System.Drawing.PointF pt2) { }
+ public void AddLine(int x1, int y1, int x2, int y2) { }
+ public void AddLine(float x1, float y1, float x2, float y2) { }
+ public void AddLines(System.Drawing.PointF[] points) { }
+ public void AddLines(System.Drawing.Point[] points) { }
+ public void AddPath(System.Drawing.Drawing2D.GraphicsPath addingPath, bool connect) { }
+ public void AddPie(System.Drawing.Rectangle rect, float startAngle, float sweepAngle) { }
+ public void AddPie(int x, int y, int width, int height, float startAngle, float sweepAngle) { }
+ public void AddPie(float x, float y, float width, float height, float startAngle, float sweepAngle) { }
+ public void AddPolygon(System.Drawing.PointF[] points) { }
+ public void AddPolygon(System.Drawing.Point[] points) { }
+ public void AddRectangle(System.Drawing.Rectangle rect) { }
+ public void AddRectangle(System.Drawing.RectangleF rect) { }
+ public void AddRectangles(System.Drawing.RectangleF[] rects) { }
+ public void AddRectangles(System.Drawing.Rectangle[] rects) { }
+ public void AddString(string s, System.Drawing.FontFamily family, int style, float emSize, System.Drawing.Point origin, System.Drawing.StringFormat format) { }
+ public void AddString(string s, System.Drawing.FontFamily family, int style, float emSize, System.Drawing.PointF origin, System.Drawing.StringFormat format) { }
+ public void AddString(string s, System.Drawing.FontFamily family, int style, float emSize, System.Drawing.Rectangle layoutRect, System.Drawing.StringFormat format) { }
+ public void AddString(string s, System.Drawing.FontFamily family, int style, float emSize, System.Drawing.RectangleF layoutRect, System.Drawing.StringFormat format) { }
+ public void ClearMarkers() { }
+ public object Clone() { throw null; }
+ public void CloseAllFigures() { }
+ public void CloseFigure() { }
+ public void Dispose() { }
+ ~GraphicsPath() { }
+ public void Flatten() { }
+ public void Flatten(System.Drawing.Drawing2D.Matrix matrix) { }
+ public void Flatten(System.Drawing.Drawing2D.Matrix matrix, float flatness) { }
+ public System.Drawing.RectangleF GetBounds() { throw null; }
+ public System.Drawing.RectangleF GetBounds(System.Drawing.Drawing2D.Matrix matrix) { throw null; }
+ public System.Drawing.RectangleF GetBounds(System.Drawing.Drawing2D.Matrix matrix, System.Drawing.Pen pen) { throw null; }
+ public System.Drawing.PointF GetLastPoint() { throw null; }
+ public bool IsOutlineVisible(System.Drawing.Point point, System.Drawing.Pen pen) { throw null; }
+ public bool IsOutlineVisible(System.Drawing.Point pt, System.Drawing.Pen pen, System.Drawing.Graphics graphics) { throw null; }
+ public bool IsOutlineVisible(System.Drawing.PointF point, System.Drawing.Pen pen) { throw null; }
+ public bool IsOutlineVisible(System.Drawing.PointF pt, System.Drawing.Pen pen, System.Drawing.Graphics graphics) { throw null; }
+ public bool IsOutlineVisible(int x, int y, System.Drawing.Pen pen) { throw null; }
+ public bool IsOutlineVisible(int x, int y, System.Drawing.Pen pen, System.Drawing.Graphics graphics) { throw null; }
+ public bool IsOutlineVisible(float x, float y, System.Drawing.Pen pen) { throw null; }
+ public bool IsOutlineVisible(float x, float y, System.Drawing.Pen pen, System.Drawing.Graphics graphics) { throw null; }
+ public bool IsVisible(System.Drawing.Point point) { throw null; }
+ public bool IsVisible(System.Drawing.Point pt, System.Drawing.Graphics graphics) { throw null; }
+ public bool IsVisible(System.Drawing.PointF point) { throw null; }
+ public bool IsVisible(System.Drawing.PointF pt, System.Drawing.Graphics graphics) { throw null; }
+ public bool IsVisible(int x, int y) { throw null; }
+ public bool IsVisible(int x, int y, System.Drawing.Graphics graphics) { throw null; }
+ public bool IsVisible(float x, float y) { throw null; }
+ public bool IsVisible(float x, float y, System.Drawing.Graphics graphics) { throw null; }
+ public void Reset() { }
+ public void Reverse() { }
+ public void SetMarkers() { }
+ public void StartFigure() { }
+ public void Transform(System.Drawing.Drawing2D.Matrix matrix) { }
+ public void Warp(System.Drawing.PointF[] destPoints, System.Drawing.RectangleF srcRect) { }
+ public void Warp(System.Drawing.PointF[] destPoints, System.Drawing.RectangleF srcRect, System.Drawing.Drawing2D.Matrix matrix) { }
+ public void Warp(System.Drawing.PointF[] destPoints, System.Drawing.RectangleF srcRect, System.Drawing.Drawing2D.Matrix matrix, System.Drawing.Drawing2D.WarpMode warpMode) { }
+ public void Warp(System.Drawing.PointF[] destPoints, System.Drawing.RectangleF srcRect, System.Drawing.Drawing2D.Matrix matrix, System.Drawing.Drawing2D.WarpMode warpMode, float flatness) { }
+ public void Widen(System.Drawing.Pen pen) { }
+ public void Widen(System.Drawing.Pen pen, System.Drawing.Drawing2D.Matrix matrix) { }
+ public void Widen(System.Drawing.Pen pen, System.Drawing.Drawing2D.Matrix matrix, float flatness) { }
+ }
+ public sealed partial class GraphicsPathIterator : System.MarshalByRefObject, System.IDisposable
+ {
+ public GraphicsPathIterator(System.Drawing.Drawing2D.GraphicsPath path) { }
+ public int Count { get { throw null; } }
+ public int SubpathCount { get { throw null; } }
+ public int CopyData(ref System.Drawing.PointF[] points, ref byte[] types, int startIndex, int endIndex) { throw null; }
+ public void Dispose() { }
+ public int Enumerate(ref System.Drawing.PointF[] points, ref byte[] types) { throw null; }
+ ~GraphicsPathIterator() { }
+ public bool HasCurve() { throw null; }
+ public int NextMarker(System.Drawing.Drawing2D.GraphicsPath path) { throw null; }
+ public int NextMarker(out int startIndex, out int endIndex) { startIndex = default(int); endIndex = default(int); throw null; }
+ public int NextPathType(out byte pathType, out int startIndex, out int endIndex) { pathType = default(byte); startIndex = default(int); endIndex = default(int); throw null; }
+ public int NextSubpath(System.Drawing.Drawing2D.GraphicsPath path, out bool isClosed) { isClosed = default(bool); throw null; }
+ public int NextSubpath(out int startIndex, out int endIndex, out bool isClosed) { startIndex = default(int); endIndex = default(int); isClosed = default(bool); throw null; }
+ public void Rewind() { }
+ }
+ public sealed partial class GraphicsState : System.MarshalByRefObject
+ {
+ internal GraphicsState() { }
+ }
+ public sealed partial class HatchBrush : System.Drawing.Brush
+ {
+ public HatchBrush(System.Drawing.Drawing2D.HatchStyle hatchstyle, System.Drawing.Color foreColor) { }
+ public HatchBrush(System.Drawing.Drawing2D.HatchStyle hatchstyle, System.Drawing.Color foreColor, System.Drawing.Color backColor) { }
+ public System.Drawing.Color BackgroundColor { get { throw null; } }
+ public System.Drawing.Color ForegroundColor { get { throw null; } }
+ public System.Drawing.Drawing2D.HatchStyle HatchStyle { get { throw null; } }
+ public override object Clone() { throw null; }
+ }
+ public enum HatchStyle
+ {
+ BackwardDiagonal = 3,
+ Cross = 4,
+ DarkDownwardDiagonal = 20,
+ DarkHorizontal = 29,
+ DarkUpwardDiagonal = 21,
+ DarkVertical = 28,
+ DashedDownwardDiagonal = 30,
+ DashedHorizontal = 32,
+ DashedUpwardDiagonal = 31,
+ DashedVertical = 33,
+ DiagonalBrick = 38,
+ DiagonalCross = 5,
+ Divot = 42,
+ DottedDiamond = 44,
+ DottedGrid = 43,
+ ForwardDiagonal = 2,
+ Horizontal = 0,
+ HorizontalBrick = 39,
+ LargeCheckerBoard = 50,
+ LargeConfetti = 35,
+ LargeGrid = 4,
+ LightDownwardDiagonal = 18,
+ LightHorizontal = 25,
+ LightUpwardDiagonal = 19,
+ LightVertical = 24,
+ Max = 4,
+ Min = 0,
+ NarrowHorizontal = 27,
+ NarrowVertical = 26,
+ OutlinedDiamond = 51,
+ Percent05 = 6,
+ Percent10 = 7,
+ Percent20 = 8,
+ Percent25 = 9,
+ Percent30 = 10,
+ Percent40 = 11,
+ Percent50 = 12,
+ Percent60 = 13,
+ Percent70 = 14,
+ Percent75 = 15,
+ Percent80 = 16,
+ Percent90 = 17,
+ Plaid = 41,
+ Shingle = 45,
+ SmallCheckerBoard = 49,
+ SmallConfetti = 34,
+ SmallGrid = 48,
+ SolidDiamond = 52,
+ Sphere = 47,
+ Trellis = 46,
+ Vertical = 1,
+ Wave = 37,
+ Weave = 40,
+ WideDownwardDiagonal = 22,
+ WideUpwardDiagonal = 23,
+ ZigZag = 36,
+ }
+ public enum InterpolationMode
+ {
+ Bicubic = 4,
+ Bilinear = 3,
+ Default = 0,
+ High = 2,
+ HighQualityBicubic = 7,
+ HighQualityBilinear = 6,
+ Invalid = -1,
+ Low = 1,
+ NearestNeighbor = 5,
+ }
+ public sealed partial class LinearGradientBrush : System.Drawing.Brush
+ {
+ public LinearGradientBrush(System.Drawing.Point point1, System.Drawing.Point point2, System.Drawing.Color color1, System.Drawing.Color color2) { }
+ public LinearGradientBrush(System.Drawing.PointF point1, System.Drawing.PointF point2, System.Drawing.Color color1, System.Drawing.Color color2) { }
+ public LinearGradientBrush(System.Drawing.Rectangle rect, System.Drawing.Color color1, System.Drawing.Color color2, System.Drawing.Drawing2D.LinearGradientMode linearGradientMode) { }
+ public LinearGradientBrush(System.Drawing.Rectangle rect, System.Drawing.Color color1, System.Drawing.Color color2, float angle) { }
+ public LinearGradientBrush(System.Drawing.Rectangle rect, System.Drawing.Color color1, System.Drawing.Color color2, float angle, bool isAngleScaleable) { }
+ public LinearGradientBrush(System.Drawing.RectangleF rect, System.Drawing.Color color1, System.Drawing.Color color2, System.Drawing.Drawing2D.LinearGradientMode linearGradientMode) { }
+ public LinearGradientBrush(System.Drawing.RectangleF rect, System.Drawing.Color color1, System.Drawing.Color color2, float angle) { }
+ public LinearGradientBrush(System.Drawing.RectangleF rect, System.Drawing.Color color1, System.Drawing.Color color2, float angle, bool isAngleScaleable) { }
+ public System.Drawing.Drawing2D.Blend Blend { get { throw null; } set { } }
+ public bool GammaCorrection { get { throw null; } set { } }
+ public System.Drawing.Drawing2D.ColorBlend InterpolationColors { get { throw null; } set { } }
+ public System.Drawing.Color[] LinearColors { get { throw null; } set { } }
+ public System.Drawing.RectangleF Rectangle { get { throw null; } }
+ public System.Drawing.Drawing2D.Matrix Transform { get { throw null; } set { } }
+ public System.Drawing.Drawing2D.WrapMode WrapMode { get { throw null; } set { } }
+ public override object Clone() { throw null; }
+ public void MultiplyTransform(System.Drawing.Drawing2D.Matrix matrix) { }
+ public void MultiplyTransform(System.Drawing.Drawing2D.Matrix matrix, System.Drawing.Drawing2D.MatrixOrder order) { }
+ public void ResetTransform() { }
+ public void RotateTransform(float angle) { }
+ public void RotateTransform(float angle, System.Drawing.Drawing2D.MatrixOrder order) { }
+ public void ScaleTransform(float sx, float sy) { }
+ public void ScaleTransform(float sx, float sy, System.Drawing.Drawing2D.MatrixOrder order) { }
+ public void SetBlendTriangularShape(float focus) { }
+ public void SetBlendTriangularShape(float focus, float scale) { }
+ public void SetSigmaBellShape(float focus) { }
+ public void SetSigmaBellShape(float focus, float scale) { }
+ public void TranslateTransform(float dx, float dy) { }
+ public void TranslateTransform(float dx, float dy, System.Drawing.Drawing2D.MatrixOrder order) { }
+ }
+ public enum LinearGradientMode
+ {
+ BackwardDiagonal = 3,
+ ForwardDiagonal = 2,
+ Horizontal = 0,
+ Vertical = 1,
+ }
+ public enum LineCap
+ {
+ AnchorMask = 240,
+ ArrowAnchor = 20,
+ Custom = 255,
+ DiamondAnchor = 19,
+ Flat = 0,
+ NoAnchor = 16,
+ Round = 2,
+ RoundAnchor = 18,
+ Square = 1,
+ SquareAnchor = 17,
+ Triangle = 3,
+ }
+ public enum LineJoin
+ {
+ Bevel = 1,
+ Miter = 0,
+ MiterClipped = 3,
+ Round = 2,
+ }
+ public sealed partial class Matrix : System.MarshalByRefObject, System.IDisposable
+ {
+ public Matrix() { }
+ public Matrix(System.Drawing.Rectangle rect, System.Drawing.Point[] plgpts) { }
+ public Matrix(System.Drawing.RectangleF rect, System.Drawing.PointF[] plgpts) { }
+ public Matrix(float m11, float m12, float m21, float m22, float dx, float dy) { }
+ public float[] Elements { get { throw null; } }
+ public bool IsIdentity { get { throw null; } }
+ public bool IsInvertible { get { throw null; } }
+ public float OffsetX { get { throw null; } }
+ public float OffsetY { get { throw null; } }
+ public System.Drawing.Drawing2D.Matrix Clone() { throw null; }
+ public void Dispose() { }
+ public override bool Equals(object obj) { throw null; }
+ ~Matrix() { }
+ public override int GetHashCode() { throw null; }
+ public void Invert() { }
+ public void Multiply(System.Drawing.Drawing2D.Matrix matrix) { }
+ public void Multiply(System.Drawing.Drawing2D.Matrix matrix, System.Drawing.Drawing2D.MatrixOrder order) { }
+ public void Reset() { }
+ public void Rotate(float angle) { }
+ public void Rotate(float angle, System.Drawing.Drawing2D.MatrixOrder order) { }
+ public void RotateAt(float angle, System.Drawing.PointF point) { }
+ public void RotateAt(float angle, System.Drawing.PointF point, System.Drawing.Drawing2D.MatrixOrder order) { }
+ public void Scale(float scaleX, float scaleY) { }
+ public void Scale(float scaleX, float scaleY, System.Drawing.Drawing2D.MatrixOrder order) { }
+ public void Shear(float shearX, float shearY) { }
+ public void Shear(float shearX, float shearY, System.Drawing.Drawing2D.MatrixOrder order) { }
+ public void TransformPoints(System.Drawing.PointF[] pts) { }
+ public void TransformPoints(System.Drawing.Point[] pts) { }
+ public void TransformVectors(System.Drawing.PointF[] pts) { }
+ public void TransformVectors(System.Drawing.Point[] pts) { }
+ public void Translate(float offsetX, float offsetY) { }
+ public void Translate(float offsetX, float offsetY, System.Drawing.Drawing2D.MatrixOrder order) { }
+ public void VectorTransformPoints(System.Drawing.Point[] pts) { }
+ }
+ public enum MatrixOrder
+ {
+ Append = 1,
+ Prepend = 0,
+ }
+ public sealed partial class PathData
+ {
+ public PathData() { }
+ public System.Drawing.PointF[] Points { get { throw null; } set { } }
+ public byte[] Types { get { throw null; } set { } }
+ }
+ public sealed partial class PathGradientBrush : System.Drawing.Brush
+ {
+ public PathGradientBrush(System.Drawing.Drawing2D.GraphicsPath path) { }
+ public PathGradientBrush(System.Drawing.PointF[] points) { }
+ public PathGradientBrush(System.Drawing.PointF[] points, System.Drawing.Drawing2D.WrapMode wrapMode) { }
+ public PathGradientBrush(System.Drawing.Point[] points) { }
+ public PathGradientBrush(System.Drawing.Point[] points, System.Drawing.Drawing2D.WrapMode wrapMode) { }
+ public System.Drawing.Drawing2D.Blend Blend { get { throw null; } set { } }
+ public System.Drawing.Color CenterColor { get { throw null; } set { } }
+ public System.Drawing.PointF CenterPoint { get { throw null; } set { } }
+ public System.Drawing.PointF FocusScales { get { throw null; } set { } }
+ public System.Drawing.Drawing2D.ColorBlend InterpolationColors { get { throw null; } set { } }
+ public System.Drawing.RectangleF Rectangle { get { throw null; } }
+ public System.Drawing.Color[] SurroundColors { get { throw null; } set { } }
+ public System.Drawing.Drawing2D.Matrix Transform { get { throw null; } set { } }
+ public System.Drawing.Drawing2D.WrapMode WrapMode { get { throw null; } set { } }
+ public override object Clone() { throw null; }
+ public void MultiplyTransform(System.Drawing.Drawing2D.Matrix matrix) { }
+ public void MultiplyTransform(System.Drawing.Drawing2D.Matrix matrix, System.Drawing.Drawing2D.MatrixOrder order) { }
+ public void ResetTransform() { }
+ public void RotateTransform(float angle) { }
+ public void RotateTransform(float angle, System.Drawing.Drawing2D.MatrixOrder order) { }
+ public void ScaleTransform(float sx, float sy) { }
+ public void ScaleTransform(float sx, float sy, System.Drawing.Drawing2D.MatrixOrder order) { }
+ public void SetBlendTriangularShape(float focus) { }
+ public void SetBlendTriangularShape(float focus, float scale) { }
+ public void SetSigmaBellShape(float focus) { }
+ public void SetSigmaBellShape(float focus, float scale) { }
+ public void TranslateTransform(float dx, float dy) { }
+ public void TranslateTransform(float dx, float dy, System.Drawing.Drawing2D.MatrixOrder order) { }
+ }
+ public enum PathPointType
+ {
+ Bezier = 3,
+ Bezier3 = 3,
+ CloseSubpath = 128,
+ DashMode = 16,
+ Line = 1,
+ PathMarker = 32,
+ PathTypeMask = 7,
+ Start = 0,
+ }
+ public enum PenAlignment
+ {
+ Center = 0,
+ Inset = 1,
+ Left = 3,
+ Outset = 2,
+ Right = 4,
+ }
+ public enum PenType
+ {
+ HatchFill = 1,
+ LinearGradient = 4,
+ PathGradient = 3,
+ SolidColor = 0,
+ TextureFill = 2,
+ }
+ public enum PixelOffsetMode
+ {
+ Default = 0,
+ Half = 4,
+ HighQuality = 2,
+ HighSpeed = 1,
+ Invalid = -1,
+ None = 3,
+ }
+ public enum QualityMode
+ {
+ Default = 0,
+ High = 2,
+ Invalid = -1,
+ Low = 1,
+ }
+ public sealed partial class RegionData
+ {
+ internal RegionData() { }
+ public byte[] Data { get { throw null; } set { } }
+ }
+ public enum SmoothingMode
+ {
+ AntiAlias = 4,
+ Default = 0,
+ HighQuality = 2,
+ HighSpeed = 1,
+ Invalid = -1,
+ None = 3,
+ }
+ public enum WarpMode
+ {
+ Bilinear = 1,
+ Perspective = 0,
+ }
+ public enum WrapMode
+ {
+ Clamp = 4,
+ Tile = 0,
+ TileFlipX = 1,
+ TileFlipXY = 3,
+ TileFlipY = 2,
+ }
+}
+namespace System.Drawing.Imaging
+{
+ public sealed partial class BitmapData
+ {
+ public BitmapData() { }
+ public int Height { get { throw null; } set { } }
+ public System.Drawing.Imaging.PixelFormat PixelFormat { get { throw null; } set { } }
+ public int Reserved { get { throw null; } set { } }
+ public System.IntPtr Scan0 { get { throw null; } set { } }
+ public int Stride { get { throw null; } set { } }
+ public int Width { get { throw null; } set { } }
+ }
+ public enum ColorAdjustType
+ {
+ Any = 6,
+ Bitmap = 1,
+ Brush = 2,
+ Count = 5,
+ Default = 0,
+ Pen = 3,
+ Text = 4,
+ }
+ public enum ColorChannelFlag
+ {
+ ColorChannelC = 0,
+ ColorChannelK = 3,
+ ColorChannelLast = 4,
+ ColorChannelM = 1,
+ ColorChannelY = 2,
+ }
+ public sealed partial class ColorMap
+ {
+ public ColorMap() { }
+ public System.Drawing.Color NewColor { get { throw null; } set { } }
+ public System.Drawing.Color OldColor { get { throw null; } set { } }
+ }
+ public enum ColorMapType
+ {
+ Brush = 1,
+ Default = 0,
+ }
+ public sealed partial class ColorMatrix
+ {
+ public ColorMatrix() { }
+ [System.CLSCompliantAttribute(false)]
+ public ColorMatrix(float[][] newColorMatrix) { }
+ public float this[int row, int column] { get { throw null; } set { } }
+ public float Matrix00 { get { throw null; } set { } }
+ public float Matrix01 { get { throw null; } set { } }
+ public float Matrix02 { get { throw null; } set { } }
+ public float Matrix03 { get { throw null; } set { } }
+ public float Matrix04 { get { throw null; } set { } }
+ public float Matrix10 { get { throw null; } set { } }
+ public float Matrix11 { get { throw null; } set { } }
+ public float Matrix12 { get { throw null; } set { } }
+ public float Matrix13 { get { throw null; } set { } }
+ public float Matrix14 { get { throw null; } set { } }
+ public float Matrix20 { get { throw null; } set { } }
+ public float Matrix21 { get { throw null; } set { } }
+ public float Matrix22 { get { throw null; } set { } }
+ public float Matrix23 { get { throw null; } set { } }
+ public float Matrix24 { get { throw null; } set { } }
+ public float Matrix30 { get { throw null; } set { } }
+ public float Matrix31 { get { throw null; } set { } }
+ public float Matrix32 { get { throw null; } set { } }
+ public float Matrix33 { get { throw null; } set { } }
+ public float Matrix34 { get { throw null; } set { } }
+ public float Matrix40 { get { throw null; } set { } }
+ public float Matrix41 { get { throw null; } set { } }
+ public float Matrix42 { get { throw null; } set { } }
+ public float Matrix43 { get { throw null; } set { } }
+ public float Matrix44 { get { throw null; } set { } }
+ }
+ public enum ColorMatrixFlag
+ {
+ AltGrays = 2,
+ Default = 0,
+ SkipGrays = 1,
+ }
+ public enum ColorMode
+ {
+ Argb32Mode = 0,
+ Argb64Mode = 1,
+ }
+ public sealed partial class ColorPalette
+ {
+ internal ColorPalette() { }
+ public System.Drawing.Color[] Entries { get { throw null; } }
+ public int Flags { get { throw null; } }
+ }
+ public enum EmfPlusRecordType
+ {
+ BeginContainer = 16423,
+ BeginContainerNoParams = 16424,
+ Clear = 16393,
+ Comment = 16387,
+ DrawArc = 16402,
+ DrawBeziers = 16409,
+ DrawClosedCurve = 16407,
+ DrawCurve = 16408,
+ DrawDriverString = 16438,
+ DrawEllipse = 16399,
+ DrawImage = 16410,
+ DrawImagePoints = 16411,
+ DrawLines = 16397,
+ DrawPath = 16405,
+ DrawPie = 16401,
+ DrawRects = 16395,
+ DrawString = 16412,
+ EmfAbortPath = 68,
+ EmfAlphaBlend = 114,
+ EmfAngleArc = 41,
+ EmfArcTo = 55,
+ EmfBeginPath = 59,
+ EmfBitBlt = 76,
+ EmfChord = 46,
+ EmfCloseFigure = 61,
+ EmfColorCorrectPalette = 111,
+ EmfColorMatchToTargetW = 121,
+ EmfCreateBrushIndirect = 39,
+ EmfCreateColorSpace = 99,
+ EmfCreateColorSpaceW = 122,
+ EmfCreateDibPatternBrushPt = 94,
+ EmfCreateMonoBrush = 93,
+ EmfCreatePalette = 49,
+ EmfCreatePen = 38,
+ EmfDeleteColorSpace = 101,
+ EmfDeleteObject = 40,
+ EmfDrawEscape = 105,
+ EmfEllipse = 42,
+ EmfEndPath = 60,
+ EmfEof = 14,
+ EmfExcludeClipRect = 29,
+ EmfExtCreateFontIndirect = 82,
+ EmfExtCreatePen = 95,
+ EmfExtEscape = 106,
+ EmfExtFloodFill = 53,
+ EmfExtSelectClipRgn = 75,
+ EmfExtTextOutA = 83,
+ EmfExtTextOutW = 84,
+ EmfFillPath = 62,
+ EmfFillRgn = 71,
+ EmfFlattenPath = 65,
+ EmfForceUfiMapping = 109,
+ EmfFrameRgn = 72,
+ EmfGdiComment = 70,
+ EmfGlsBoundedRecord = 103,
+ EmfGlsRecord = 102,
+ EmfGradientFill = 118,
+ EmfHeader = 1,
+ EmfIntersectClipRect = 30,
+ EmfInvertRgn = 73,
+ EmfLineTo = 54,
+ EmfMaskBlt = 78,
+ EmfMax = 122,
+ EmfMin = 1,
+ EmfModifyWorldTransform = 36,
+ EmfMoveToEx = 27,
+ EmfNamedEscpae = 110,
+ EmfOffsetClipRgn = 26,
+ EmfPaintRgn = 74,
+ EmfPie = 47,
+ EmfPixelFormat = 104,
+ EmfPlgBlt = 79,
+ EmfPlusRecordBase = 16384,
+ EmfPolyBezier = 2,
+ EmfPolyBezier16 = 85,
+ EmfPolyBezierTo = 5,
+ EmfPolyBezierTo16 = 88,
+ EmfPolyDraw = 56,
+ EmfPolyDraw16 = 92,
+ EmfPolygon = 3,
+ EmfPolygon16 = 86,
+ EmfPolyline = 4,
+ EmfPolyline16 = 87,
+ EmfPolyLineTo = 6,
+ EmfPolylineTo16 = 89,
+ EmfPolyPolygon = 8,
+ EmfPolyPolygon16 = 91,
+ EmfPolyPolyline = 7,
+ EmfPolyPolyline16 = 90,
+ EmfPolyTextOutA = 96,
+ EmfPolyTextOutW = 97,
+ EmfRealizePalette = 52,
+ EmfRectangle = 43,
+ EmfReserved069 = 69,
+ EmfReserved117 = 117,
+ EmfResizePalette = 51,
+ EmfRestoreDC = 34,
+ EmfRoundArc = 45,
+ EmfRoundRect = 44,
+ EmfSaveDC = 33,
+ EmfScaleViewportExtEx = 31,
+ EmfScaleWindowExtEx = 32,
+ EmfSelectClipPath = 67,
+ EmfSelectObject = 37,
+ EmfSelectPalette = 48,
+ EmfSetArcDirection = 57,
+ EmfSetBkColor = 25,
+ EmfSetBkMode = 18,
+ EmfSetBrushOrgEx = 13,
+ EmfSetColorAdjustment = 23,
+ EmfSetColorSpace = 100,
+ EmfSetDIBitsToDevice = 80,
+ EmfSetIcmMode = 98,
+ EmfSetIcmProfileA = 112,
+ EmfSetIcmProfileW = 113,
+ EmfSetLayout = 115,
+ EmfSetLinkedUfis = 119,
+ EmfSetMapMode = 17,
+ EmfSetMapperFlags = 16,
+ EmfSetMetaRgn = 28,
+ EmfSetMiterLimit = 58,
+ EmfSetPaletteEntries = 50,
+ EmfSetPixelV = 15,
+ EmfSetPolyFillMode = 19,
+ EmfSetROP2 = 20,
+ EmfSetStretchBltMode = 21,
+ EmfSetTextAlign = 22,
+ EmfSetTextColor = 24,
+ EmfSetTextJustification = 120,
+ EmfSetViewportExtEx = 11,
+ EmfSetViewportOrgEx = 12,
+ EmfSetWindowExtEx = 9,
+ EmfSetWindowOrgEx = 10,
+ EmfSetWorldTransform = 35,
+ EmfSmallTextOut = 108,
+ EmfStartDoc = 107,
+ EmfStretchBlt = 77,
+ EmfStretchDIBits = 81,
+ EmfStrokeAndFillPath = 63,
+ EmfStrokePath = 64,
+ EmfTransparentBlt = 116,
+ EmfWidenPath = 66,
+ EndContainer = 16425,
+ EndOfFile = 16386,
+ FillClosedCurve = 16406,
+ FillEllipse = 16398,
+ FillPath = 16404,
+ FillPie = 16400,
+ FillPolygon = 16396,
+ FillRects = 16394,
+ FillRegion = 16403,
+ GetDC = 16388,
+ Header = 16385,
+ Invalid = 16384,
+ Max = 16438,
+ Min = 16385,
+ MultiFormatEnd = 16391,
+ MultiFormatSection = 16390,
+ MultiFormatStart = 16389,
+ MultiplyWorldTransform = 16428,
+ Object = 16392,
+ OffsetClip = 16437,
+ ResetClip = 16433,
+ ResetWorldTransform = 16427,
+ Restore = 16422,
+ RotateWorldTransform = 16431,
+ Save = 16421,
+ ScaleWorldTransform = 16430,
+ SetAntiAliasMode = 16414,
+ SetClipPath = 16435,
+ SetClipRect = 16434,
+ SetClipRegion = 16436,
+ SetCompositingMode = 16419,
+ SetCompositingQuality = 16420,
+ SetInterpolationMode = 16417,
+ SetPageTransform = 16432,
+ SetPixelOffsetMode = 16418,
+ SetRenderingOrigin = 16413,
+ SetTextContrast = 16416,
+ SetTextRenderingHint = 16415,
+ SetWorldTransform = 16426,
+ Total = 16439,
+ TranslateWorldTransform = 16429,
+ WmfAnimatePalette = 66614,
+ WmfArc = 67607,
+ WmfBitBlt = 67874,
+ WmfChord = 67632,
+ WmfCreateBrushIndirect = 66300,
+ WmfCreateFontIndirect = 66299,
+ WmfCreatePalette = 65783,
+ WmfCreatePatternBrush = 66041,
+ WmfCreatePenIndirect = 66298,
+ WmfCreateRegion = 67327,
+ WmfDeleteObject = 66032,
+ WmfDibBitBlt = 67904,
+ WmfDibCreatePatternBrush = 65858,
+ WmfDibStretchBlt = 68417,
+ WmfEllipse = 66584,
+ WmfEscape = 67110,
+ WmfExcludeClipRect = 66581,
+ WmfExtFloodFill = 66888,
+ WmfExtTextOut = 68146,
+ WmfFillRegion = 66088,
+ WmfFloodFill = 66585,
+ WmfFrameRegion = 66601,
+ WmfIntersectClipRect = 66582,
+ WmfInvertRegion = 65834,
+ WmfLineTo = 66067,
+ WmfMoveTo = 66068,
+ WmfOffsetCilpRgn = 66080,
+ WmfOffsetViewportOrg = 66065,
+ WmfOffsetWindowOrg = 66063,
+ WmfPaintRegion = 65835,
+ WmfPatBlt = 67101,
+ WmfPie = 67610,
+ WmfPolygon = 66340,
+ WmfPolyline = 66341,
+ WmfPolyPolygon = 66872,
+ WmfRealizePalette = 65589,
+ WmfRecordBase = 65536,
+ WmfRectangle = 66587,
+ WmfResizePalette = 65849,
+ WmfRestoreDC = 65831,
+ WmfRoundRect = 67100,
+ WmfSaveDC = 65566,
+ WmfScaleViewportExt = 66578,
+ WmfScaleWindowExt = 66576,
+ WmfSelectClipRegion = 65836,
+ WmfSelectObject = 65837,
+ WmfSelectPalette = 66100,
+ WmfSetBkColor = 66049,
+ WmfSetBkMode = 65794,
+ WmfSetDibToDev = 68915,
+ WmfSetLayout = 65865,
+ WmfSetMapMode = 65795,
+ WmfSetMapperFlags = 66097,
+ WmfSetPalEntries = 65591,
+ WmfSetPixel = 66591,
+ WmfSetPolyFillMode = 65798,
+ WmfSetRelAbs = 65797,
+ WmfSetROP2 = 65796,
+ WmfSetStretchBltMode = 65799,
+ WmfSetTextAlign = 65838,
+ WmfSetTextCharExtra = 65800,
+ WmfSetTextColor = 66057,
+ WmfSetTextJustification = 66058,
+ WmfSetViewportExt = 66062,
+ WmfSetViewportOrg = 66061,
+ WmfSetWindowExt = 66060,
+ WmfSetWindowOrg = 66059,
+ WmfStretchBlt = 68387,
+ WmfStretchDib = 69443,
+ WmfTextOut = 66849,
+ }
+ public enum EmfType
+ {
+ EmfOnly = 3,
+ EmfPlusDual = 5,
+ EmfPlusOnly = 4,
+ }
+ public sealed partial class Encoder
+ {
+ public static readonly System.Drawing.Imaging.Encoder ChrominanceTable;
+ public static readonly System.Drawing.Imaging.Encoder ColorDepth;
+ public static readonly System.Drawing.Imaging.Encoder Compression;
+ public static readonly System.Drawing.Imaging.Encoder LuminanceTable;
+ public static readonly System.Drawing.Imaging.Encoder Quality;
+ public static readonly System.Drawing.Imaging.Encoder RenderMethod;
+ public static readonly System.Drawing.Imaging.Encoder SaveFlag;
+ public static readonly System.Drawing.Imaging.Encoder ScanMethod;
+ public static readonly System.Drawing.Imaging.Encoder Transformation;
+ public static readonly System.Drawing.Imaging.Encoder Version;
+ public Encoder(System.Guid guid) { }
+ public System.Guid Guid { get { throw null; } }
+ }
+ public sealed partial class EncoderParameter : System.IDisposable
+ {
+ public EncoderParameter(System.Drawing.Imaging.Encoder encoder, byte value) { }
+ public EncoderParameter(System.Drawing.Imaging.Encoder encoder, byte value, bool undefined) { }
+ public EncoderParameter(System.Drawing.Imaging.Encoder encoder, byte[] value) { }
+ public EncoderParameter(System.Drawing.Imaging.Encoder encoder, byte[] value, bool undefined) { }
+ public EncoderParameter(System.Drawing.Imaging.Encoder encoder, short value) { }
+ public EncoderParameter(System.Drawing.Imaging.Encoder encoder, short[] value) { }
+ public EncoderParameter(System.Drawing.Imaging.Encoder encoder, int numberValues, System.Drawing.Imaging.EncoderParameterValueType type, System.IntPtr value) { }
+ public EncoderParameter(System.Drawing.Imaging.Encoder encoder, int numerator, int denominator) { }
+ [System.ObsoleteAttribute("This constructor has been deprecated. Use EncoderParameter(Encoder encoder, int numberValues, EncoderParameterValueType type, IntPtr value) instead. http://go.microsoft.com/fwlink/?linkid=14202")]
+ public EncoderParameter(System.Drawing.Imaging.Encoder encoder, int NumberOfValues, int Type, int Value) { }
+ public EncoderParameter(System.Drawing.Imaging.Encoder encoder, int numerator1, int demoninator1, int numerator2, int demoninator2) { }
+ public EncoderParameter(System.Drawing.Imaging.Encoder encoder, int[] numerator, int[] denominator) { }
+ public EncoderParameter(System.Drawing.Imaging.Encoder encoder, int[] numerator1, int[] denominator1, int[] numerator2, int[] denominator2) { }
+ public EncoderParameter(System.Drawing.Imaging.Encoder encoder, long value) { }
+ public EncoderParameter(System.Drawing.Imaging.Encoder encoder, long rangebegin, long rangeend) { }
+ public EncoderParameter(System.Drawing.Imaging.Encoder encoder, long[] value) { }
+ public EncoderParameter(System.Drawing.Imaging.Encoder encoder, long[] rangebegin, long[] rangeend) { }
+ public EncoderParameter(System.Drawing.Imaging.Encoder encoder, string value) { }
+ public System.Drawing.Imaging.Encoder Encoder { get { throw null; } set { } }
+ public int NumberOfValues { get { throw null; } }
+ public System.Drawing.Imaging.EncoderParameterValueType Type { get { throw null; } }
+ public System.Drawing.Imaging.EncoderParameterValueType ValueType { get { throw null; } }
+ public void Dispose() { }
+ ~EncoderParameter() { }
+ }
+ public sealed partial class EncoderParameters : System.IDisposable
+ {
+ public EncoderParameters() { }
+ public EncoderParameters(int count) { }
+ public System.Drawing.Imaging.EncoderParameter[] Param { get { throw null; } set { } }
+ public void Dispose() { }
+ }
+ public enum EncoderParameterValueType
+ {
+ ValueTypeAscii = 2,
+ ValueTypeByte = 1,
+ ValueTypeLong = 4,
+ ValueTypeLongRange = 6,
+ ValueTypeRational = 5,
+ ValueTypeRationalRange = 8,
+ ValueTypeShort = 3,
+ ValueTypeUndefined = 7,
+ }
+ public enum EncoderValue
+ {
+ ColorTypeCMYK = 0,
+ ColorTypeYCCK = 1,
+ CompressionCCITT3 = 3,
+ CompressionCCITT4 = 4,
+ CompressionLZW = 2,
+ CompressionNone = 6,
+ CompressionRle = 5,
+ Flush = 20,
+ FrameDimensionPage = 23,
+ FrameDimensionResolution = 22,
+ FrameDimensionTime = 21,
+ LastFrame = 19,
+ MultiFrame = 18,
+ RenderNonProgressive = 12,
+ RenderProgressive = 11,
+ ScanMethodInterlaced = 7,
+ ScanMethodNonInterlaced = 8,
+ TransformFlipHorizontal = 16,
+ TransformFlipVertical = 17,
+ TransformRotate180 = 14,
+ TransformRotate270 = 15,
+ TransformRotate90 = 13,
+ VersionGif87 = 9,
+ VersionGif89 = 10,
+ }
+ public sealed partial class FrameDimension
+ {
+ public FrameDimension(System.Guid guid) { }
+ public System.Guid Guid { get { throw null; } }
+ public static System.Drawing.Imaging.FrameDimension Page { get { throw null; } }
+ public static System.Drawing.Imaging.FrameDimension Resolution { get { throw null; } }
+ public static System.Drawing.Imaging.FrameDimension Time { get { throw null; } }
+ public override bool Equals(object o) { throw null; }
+ public override int GetHashCode() { throw null; }
+ public override string ToString() { throw null; }
+ }
+ public sealed partial class ImageAttributes : System.ICloneable, System.IDisposable
+ {
+ public ImageAttributes() { }
+ public void ClearBrushRemapTable() { }
+ public void ClearColorKey() { }
+ public void ClearColorKey(System.Drawing.Imaging.ColorAdjustType type) { }
+ public void ClearColorMatrix() { }
+ public void ClearColorMatrix(System.Drawing.Imaging.ColorAdjustType type) { }
+ public void ClearGamma() { }
+ public void ClearGamma(System.Drawing.Imaging.ColorAdjustType type) { }
+ public void ClearNoOp() { }
+ public void ClearNoOp(System.Drawing.Imaging.ColorAdjustType type) { }
+ public void ClearOutputChannel() { }
+ public void ClearOutputChannel(System.Drawing.Imaging.ColorAdjustType type) { }
+ public void ClearOutputChannelColorProfile() { }
+ public void ClearOutputChannelColorProfile(System.Drawing.Imaging.ColorAdjustType type) { }
+ public void ClearRemapTable() { }
+ public void ClearRemapTable(System.Drawing.Imaging.ColorAdjustType type) { }
+ public void ClearThreshold() { }
+ public void ClearThreshold(System.Drawing.Imaging.ColorAdjustType type) { }
+ public object Clone() { throw null; }
+ public void Dispose() { }
+ ~ImageAttributes() { }
+ public void GetAdjustedPalette(System.Drawing.Imaging.ColorPalette palette, System.Drawing.Imaging.ColorAdjustType type) { }
+ public void SetBrushRemapTable(System.Drawing.Imaging.ColorMap[] map) { }
+ public void SetColorKey(System.Drawing.Color colorLow, System.Drawing.Color colorHigh) { }
+ public void SetColorKey(System.Drawing.Color colorLow, System.Drawing.Color colorHigh, System.Drawing.Imaging.ColorAdjustType type) { }
+ public void SetColorMatrices(System.Drawing.Imaging.ColorMatrix newColorMatrix, System.Drawing.Imaging.ColorMatrix grayMatrix) { }
+ public void SetColorMatrices(System.Drawing.Imaging.ColorMatrix newColorMatrix, System.Drawing.Imaging.ColorMatrix grayMatrix, System.Drawing.Imaging.ColorMatrixFlag flags) { }
+ public void SetColorMatrices(System.Drawing.Imaging.ColorMatrix newColorMatrix, System.Drawing.Imaging.ColorMatrix grayMatrix, System.Drawing.Imaging.ColorMatrixFlag mode, System.Drawing.Imaging.ColorAdjustType type) { }
+ public void SetColorMatrix(System.Drawing.Imaging.ColorMatrix newColorMatrix) { }
+ public void SetColorMatrix(System.Drawing.Imaging.ColorMatrix newColorMatrix, System.Drawing.Imaging.ColorMatrixFlag flags) { }
+ public void SetColorMatrix(System.Drawing.Imaging.ColorMatrix newColorMatrix, System.Drawing.Imaging.ColorMatrixFlag mode, System.Drawing.Imaging.ColorAdjustType type) { }
+ public void SetGamma(float gamma) { }
+ public void SetGamma(float gamma, System.Drawing.Imaging.ColorAdjustType type) { }
+ public void SetNoOp() { }
+ public void SetNoOp(System.Drawing.Imaging.ColorAdjustType type) { }
+ public void SetOutputChannel(System.Drawing.Imaging.ColorChannelFlag flags) { }
+ public void SetOutputChannel(System.Drawing.Imaging.ColorChannelFlag flags, System.Drawing.Imaging.ColorAdjustType type) { }
+ public void SetOutputChannelColorProfile(string colorProfileFilename) { }
+ public void SetOutputChannelColorProfile(string colorProfileFilename, System.Drawing.Imaging.ColorAdjustType type) { }
+ public void SetRemapTable(System.Drawing.Imaging.ColorMap[] map) { }
+ public void SetRemapTable(System.Drawing.Imaging.ColorMap[] map, System.Drawing.Imaging.ColorAdjustType type) { }
+ public void SetThreshold(float threshold) { }
+ public void SetThreshold(float threshold, System.Drawing.Imaging.ColorAdjustType type) { }
+ public void SetWrapMode(System.Drawing.Drawing2D.WrapMode mode) { }
+ public void SetWrapMode(System.Drawing.Drawing2D.WrapMode mode, System.Drawing.Color color) { }
+ public void SetWrapMode(System.Drawing.Drawing2D.WrapMode mode, System.Drawing.Color color, bool clamp) { }
+ }
+ [System.FlagsAttribute]
+ public enum ImageCodecFlags
+ {
+ BlockingDecode = 32,
+ Builtin = 65536,
+ Decoder = 2,
+ Encoder = 1,
+ SeekableEncode = 16,
+ SupportBitmap = 4,
+ SupportVector = 8,
+ System = 131072,
+ User = 262144,
+ }
+ public sealed partial class ImageCodecInfo
+ {
+ internal ImageCodecInfo() { }
+ public System.Guid Clsid { get { throw null; } set { } }
+ public string CodecName { get { throw null; } set { } }
+ public string DllName { get { throw null; } set { } }
+ public string FilenameExtension { get { throw null; } set { } }
+ public System.Drawing.Imaging.ImageCodecFlags Flags { get { throw null; } set { } }
+ public string FormatDescription { get { throw null; } set { } }
+ public System.Guid FormatID { get { throw null; } set { } }
+ public string MimeType { get { throw null; } set { } }
+ [System.CLSCompliantAttribute(false)]
+ public byte[][] SignatureMasks { get { throw null; } set { } }
+ [System.CLSCompliantAttribute(false)]
+ public byte[][] SignaturePatterns { get { throw null; } set { } }
+ public int Version { get { throw null; } set { } }
+ public static System.Drawing.Imaging.ImageCodecInfo[] GetImageDecoders() { throw null; }
+ public static System.Drawing.Imaging.ImageCodecInfo[] GetImageEncoders() { throw null; }
+ }
+ [System.FlagsAttribute]
+ public enum ImageFlags
+ {
+ Caching = 131072,
+ ColorSpaceCmyk = 32,
+ ColorSpaceGray = 64,
+ ColorSpaceRgb = 16,
+ ColorSpaceYcbcr = 128,
+ ColorSpaceYcck = 256,
+ HasAlpha = 2,
+ HasRealDpi = 4096,
+ HasRealPixelSize = 8192,
+ HasTranslucent = 4,
+ None = 0,
+ PartiallyScalable = 8,
+ ReadOnly = 65536,
+ Scalable = 1,
+ }
+ public sealed partial class ImageFormat
+ {
+ public ImageFormat(System.Guid guid) { }
+ public static System.Drawing.Imaging.ImageFormat Bmp { get { throw null; } }
+ public static System.Drawing.Imaging.ImageFormat Emf { get { throw null; } }
+ public static System.Drawing.Imaging.ImageFormat Exif { get { throw null; } }
+ public static System.Drawing.Imaging.ImageFormat Gif { get { throw null; } }
+ public System.Guid Guid { get { throw null; } }
+ public static System.Drawing.Imaging.ImageFormat Icon { get { throw null; } }
+ public static System.Drawing.Imaging.ImageFormat Jpeg { get { throw null; } }
+ public static System.Drawing.Imaging.ImageFormat MemoryBmp { get { throw null; } }
+ public static System.Drawing.Imaging.ImageFormat Png { get { throw null; } }
+ public static System.Drawing.Imaging.ImageFormat Tiff { get { throw null; } }
+ public static System.Drawing.Imaging.ImageFormat Wmf { get { throw null; } }
+ public override bool Equals(object o) { throw null; }
+ public override int GetHashCode() { throw null; }
+ public override string ToString() { throw null; }
+ }
+ public enum ImageLockMode
+ {
+ ReadOnly = 1,
+ ReadWrite = 3,
+ UserInputBuffer = 4,
+ WriteOnly = 2,
+ }
+ public sealed partial class Metafile : System.Drawing.Image
+ {
+ public Metafile(System.IntPtr henhmetafile, bool deleteEmf) { }
+ public Metafile(System.IntPtr referenceHdc, System.Drawing.Imaging.EmfType emfType) { }
+ public Metafile(System.IntPtr referenceHdc, System.Drawing.Imaging.EmfType emfType, string description) { }
+ public Metafile(System.IntPtr hmetafile, System.Drawing.Imaging.WmfPlaceableFileHeader wmfHeader) { }
+ public Metafile(System.IntPtr hmetafile, System.Drawing.Imaging.WmfPlaceableFileHeader wmfHeader, bool deleteWmf) { }
+ public Metafile(System.IntPtr referenceHdc, System.Drawing.Rectangle frameRect) { }
+ public Metafile(System.IntPtr referenceHdc, System.Drawing.Rectangle frameRect, System.Drawing.Imaging.MetafileFrameUnit frameUnit) { }
+ public Metafile(System.IntPtr referenceHdc, System.Drawing.Rectangle frameRect, System.Drawing.Imaging.MetafileFrameUnit frameUnit, System.Drawing.Imaging.EmfType type) { }
+ public Metafile(System.IntPtr referenceHdc, System.Drawing.Rectangle frameRect, System.Drawing.Imaging.MetafileFrameUnit frameUnit, System.Drawing.Imaging.EmfType type, string desc) { }
+ public Metafile(System.IntPtr referenceHdc, System.Drawing.RectangleF frameRect) { }
+ public Metafile(System.IntPtr referenceHdc, System.Drawing.RectangleF frameRect, System.Drawing.Imaging.MetafileFrameUnit frameUnit) { }
+ public Metafile(System.IntPtr referenceHdc, System.Drawing.RectangleF frameRect, System.Drawing.Imaging.MetafileFrameUnit frameUnit, System.Drawing.Imaging.EmfType type) { }
+ public Metafile(System.IntPtr referenceHdc, System.Drawing.RectangleF frameRect, System.Drawing.Imaging.MetafileFrameUnit frameUnit, System.Drawing.Imaging.EmfType type, string description) { }
+ public Metafile(System.IO.Stream stream) { }
+ public Metafile(System.IO.Stream stream, System.IntPtr referenceHdc) { }
+ public Metafile(System.IO.Stream stream, System.IntPtr referenceHdc, System.Drawing.Imaging.EmfType type) { }
+ public Metafile(System.IO.Stream stream, System.IntPtr referenceHdc, System.Drawing.Imaging.EmfType type, string description) { }
+ public Metafile(System.IO.Stream stream, System.IntPtr referenceHdc, System.Drawing.Rectangle frameRect) { }
+ public Metafile(System.IO.Stream stream, System.IntPtr referenceHdc, System.Drawing.Rectangle frameRect, System.Drawing.Imaging.MetafileFrameUnit frameUnit) { }
+ public Metafile(System.IO.Stream stream, System.IntPtr referenceHdc, System.Drawing.Rectangle frameRect, System.Drawing.Imaging.MetafileFrameUnit frameUnit, System.Drawing.Imaging.EmfType type) { }
+ public Metafile(System.IO.Stream stream, System.IntPtr referenceHdc, System.Drawing.Rectangle frameRect, System.Drawing.Imaging.MetafileFrameUnit frameUnit, System.Drawing.Imaging.EmfType type, string description) { }
+ public Metafile(System.IO.Stream stream, System.IntPtr referenceHdc, System.Drawing.RectangleF frameRect) { }
+ public Metafile(System.IO.Stream stream, System.IntPtr referenceHdc, System.Drawing.RectangleF frameRect, System.Drawing.Imaging.MetafileFrameUnit frameUnit) { }
+ public Metafile(System.IO.Stream stream, System.IntPtr referenceHdc, System.Drawing.RectangleF frameRect, System.Drawing.Imaging.MetafileFrameUnit frameUnit, System.Drawing.Imaging.EmfType type) { }
+ public Metafile(System.IO.Stream stream, System.IntPtr referenceHdc, System.Drawing.RectangleF frameRect, System.Drawing.Imaging.MetafileFrameUnit frameUnit, System.Drawing.Imaging.EmfType type, string description) { }
+ public Metafile(string filename) { }
+ public Metafile(string fileName, System.IntPtr referenceHdc) { }
+ public Metafile(string fileName, System.IntPtr referenceHdc, System.Drawing.Imaging.EmfType type) { }
+ public Metafile(string fileName, System.IntPtr referenceHdc, System.Drawing.Imaging.EmfType type, string description) { }
+ public Metafile(string fileName, System.IntPtr referenceHdc, System.Drawing.Rectangle frameRect) { }
+ public Metafile(string fileName, System.IntPtr referenceHdc, System.Drawing.Rectangle frameRect, System.Drawing.Imaging.MetafileFrameUnit frameUnit) { }
+ public Metafile(string fileName, System.IntPtr referenceHdc, System.Drawing.Rectangle frameRect, System.Drawing.Imaging.MetafileFrameUnit frameUnit, System.Drawing.Imaging.EmfType type) { }
+ public Metafile(string fileName, System.IntPtr referenceHdc, System.Drawing.Rectangle frameRect, System.Drawing.Imaging.MetafileFrameUnit frameUnit, System.Drawing.Imaging.EmfType type, string description) { }
+ public Metafile(string fileName, System.IntPtr referenceHdc, System.Drawing.Rectangle frameRect, System.Drawing.Imaging.MetafileFrameUnit frameUnit, string description) { }
+ public Metafile(string fileName, System.IntPtr referenceHdc, System.Drawing.RectangleF frameRect) { }
+ public Metafile(string fileName, System.IntPtr referenceHdc, System.Drawing.RectangleF frameRect, System.Drawing.Imaging.MetafileFrameUnit frameUnit) { }
+ public Metafile(string fileName, System.IntPtr referenceHdc, System.Drawing.RectangleF frameRect, System.Drawing.Imaging.MetafileFrameUnit frameUnit, System.Drawing.Imaging.EmfType type) { }
+ public Metafile(string fileName, System.IntPtr referenceHdc, System.Drawing.RectangleF frameRect, System.Drawing.Imaging.MetafileFrameUnit frameUnit, System.Drawing.Imaging.EmfType type, string description) { }
+ public Metafile(string fileName, System.IntPtr referenceHdc, System.Drawing.RectangleF frameRect, System.Drawing.Imaging.MetafileFrameUnit frameUnit, string desc) { }
+ public System.IntPtr GetHenhmetafile() { throw null; }
+ public System.Drawing.Imaging.MetafileHeader GetMetafileHeader() { throw null; }
+ public static System.Drawing.Imaging.MetafileHeader GetMetafileHeader(System.IntPtr henhmetafile) { throw null; }
+ public static System.Drawing.Imaging.MetafileHeader GetMetafileHeader(System.IntPtr hmetafile, System.Drawing.Imaging.WmfPlaceableFileHeader wmfHeader) { throw null; }
+ public static System.Drawing.Imaging.MetafileHeader GetMetafileHeader(System.IO.Stream stream) { throw null; }
+ public static System.Drawing.Imaging.MetafileHeader GetMetafileHeader(string fileName) { throw null; }
+ public void PlayRecord(System.Drawing.Imaging.EmfPlusRecordType recordType, int flags, int dataSize, byte[] data) { }
+ }
+ public enum MetafileFrameUnit
+ {
+ Document = 5,
+ GdiCompatible = 7,
+ Inch = 4,
+ Millimeter = 6,
+ Pixel = 2,
+ Point = 3,
+ }
+ public sealed partial class MetafileHeader
+ {
+ internal MetafileHeader() { }
+ public System.Drawing.Rectangle Bounds { get { throw null; } }
+ public float DpiX { get { throw null; } }
+ public float DpiY { get { throw null; } }
+ public int EmfPlusHeaderSize { get { throw null; } }
+ public int LogicalDpiX { get { throw null; } }
+ public int LogicalDpiY { get { throw null; } }
+ public int MetafileSize { get { throw null; } }
+ public System.Drawing.Imaging.MetafileType Type { get { throw null; } }
+ public int Version { get { throw null; } }
+ public System.Drawing.Imaging.MetaHeader WmfHeader { get { throw null; } }
+ public bool IsDisplay() { throw null; }
+ public bool IsEmf() { throw null; }
+ public bool IsEmfOrEmfPlus() { throw null; }
+ public bool IsEmfPlus() { throw null; }
+ public bool IsEmfPlusDual() { throw null; }
+ public bool IsEmfPlusOnly() { throw null; }
+ public bool IsWmf() { throw null; }
+ public bool IsWmfPlaceable() { throw null; }
+ }
+ public enum MetafileType
+ {
+ Emf = 3,
+ EmfPlusDual = 5,
+ EmfPlusOnly = 4,
+ Invalid = 0,
+ Wmf = 1,
+ WmfPlaceable = 2,
+ }
+ public sealed partial class MetaHeader
+ {
+ public MetaHeader() { }
+ public short HeaderSize { get { throw null; } set { } }
+ public int MaxRecord { get { throw null; } set { } }
+ public short NoObjects { get { throw null; } set { } }
+ public short NoParameters { get { throw null; } set { } }
+ public int Size { get { throw null; } set { } }
+ public short Type { get { throw null; } set { } }
+ public short Version { get { throw null; } set { } }
+ }
+ [System.FlagsAttribute]
+ public enum PaletteFlags
+ {
+ GrayScale = 2,
+ Halftone = 4,
+ HasAlpha = 1,
+ }
+ public enum PixelFormat
+ {
+ Alpha = 262144,
+ Canonical = 2097152,
+ DontCare = 0,
+ Extended = 1048576,
+ Format16bppArgb1555 = 397319,
+ Format16bppGrayScale = 1052676,
+ Format16bppRgb555 = 135173,
+ Format16bppRgb565 = 135174,
+ Format1bppIndexed = 196865,
+ Format24bppRgb = 137224,
+ Format32bppArgb = 2498570,
+ Format32bppPArgb = 925707,
+ Format32bppRgb = 139273,
+ Format48bppRgb = 1060876,
+ Format4bppIndexed = 197634,
+ Format64bppArgb = 3424269,
+ Format64bppPArgb = 1851406,
+ Format8bppIndexed = 198659,
+ Gdi = 131072,
+ Indexed = 65536,
+ Max = 15,
+ PAlpha = 524288,
+ Undefined = 0,
+ }
+ public delegate void PlayRecordCallback(System.Drawing.Imaging.EmfPlusRecordType recordType, int flags, int dataSize, System.IntPtr recordData);
+ public sealed partial class PropertyItem
+ {
+ internal PropertyItem() { }
+ public int Id { get { throw null; } set { } }
+ public int Len { get { throw null; } set { } }
+ public short Type { get { throw null; } set { } }
+ public byte[] Value { get { throw null; } set { } }
+ }
+ public sealed partial class WmfPlaceableFileHeader
+ {
+ public WmfPlaceableFileHeader() { }
+ public short BboxBottom { get { throw null; } set { } }
+ public short BboxLeft { get { throw null; } set { } }
+ public short BboxRight { get { throw null; } set { } }
+ public short BboxTop { get { throw null; } set { } }
+ public short Checksum { get { throw null; } set { } }
+ public short Hmf { get { throw null; } set { } }
+ public short Inch { get { throw null; } set { } }
+ public int Key { get { throw null; } set { } }
+ public int Reserved { get { throw null; } set { } }
+ }
+}
+namespace System.Drawing.Printing
+{
+ public enum Duplex
+ {
+ Default = -1,
+ Horizontal = 3,
+ Simplex = 1,
+ Vertical = 2,
+ }
+ public partial class InvalidPrinterException : System.SystemException
+ {
+ public InvalidPrinterException(System.Drawing.Printing.PrinterSettings settings) { }
+ protected InvalidPrinterException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
+ [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter=true)]
+ public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
+ }
+ public partial class Margins : System.ICloneable
+ {
+ public Margins() { }
+ public Margins(int left, int right, int top, int bottom) { }
+ public int Bottom { get { throw null; } set { } }
+ public int Left { get { throw null; } set { } }
+ public int Right { get { throw null; } set { } }
+ public int Top { get { throw null; } set { } }
+ public object Clone() { throw null; }
+ public override bool Equals(object obj) { throw null; }
+ public override int GetHashCode() { throw null; }
+ public static bool operator ==(System.Drawing.Printing.Margins m1, System.Drawing.Printing.Margins m2) { throw null; }
+ public static bool operator !=(System.Drawing.Printing.Margins m1, System.Drawing.Printing.Margins m2) { throw null; }
+ public override string ToString() { throw null; }
+ }
+ public partial class PageSettings : System.ICloneable
+ {
+ public PageSettings() { }
+ public PageSettings(System.Drawing.Printing.PrinterSettings printerSettings) { }
+ public System.Drawing.Rectangle Bounds { get { throw null; } }
+ public bool Color { get { throw null; } set { } }
+ public float HardMarginX { get { throw null; } }
+ public float HardMarginY { get { throw null; } }
+ public bool Landscape { get { throw null; } set { } }
+ public System.Drawing.Printing.Margins Margins { get { throw null; } set { } }
+ public System.Drawing.Printing.PaperSize PaperSize { get { throw null; } set { } }
+ public System.Drawing.Printing.PaperSource PaperSource { get { throw null; } set { } }
+ public System.Drawing.RectangleF PrintableArea { get { throw null; } }
+ public System.Drawing.Printing.PrinterResolution PrinterResolution { get { throw null; } set { } }
+ public System.Drawing.Printing.PrinterSettings PrinterSettings { get { throw null; } set { } }
+ public object Clone() { throw null; }
+ public void CopyToHdevmode(System.IntPtr hdevmode) { }
+ public void SetHdevmode(System.IntPtr hdevmode) { }
+ public override string ToString() { throw null; }
+ }
+ public enum PaperKind
+ {
+ A2 = 66,
+ A3 = 8,
+ A3Extra = 63,
+ A3ExtraTransverse = 68,
+ A3Rotated = 76,
+ A3Transverse = 67,
+ A4 = 9,
+ A4Extra = 53,
+ A4Plus = 60,
+ A4Rotated = 77,
+ A4Small = 10,
+ A4Transverse = 55,
+ A5 = 11,
+ A5Extra = 64,
+ A5Rotated = 78,
+ A5Transverse = 61,
+ A6 = 70,
+ A6Rotated = 83,
+ APlus = 57,
+ B4 = 12,
+ B4Envelope = 33,
+ B4JisRotated = 79,
+ B5 = 13,
+ B5Envelope = 34,
+ B5Extra = 65,
+ B5JisRotated = 80,
+ B5Transverse = 62,
+ B6Envelope = 35,
+ B6Jis = 88,
+ B6JisRotated = 89,
+ BPlus = 58,
+ C3Envelope = 29,
+ C4Envelope = 30,
+ C5Envelope = 28,
+ C65Envelope = 32,
+ C6Envelope = 31,
+ CSheet = 24,
+ Custom = 0,
+ DLEnvelope = 27,
+ DSheet = 25,
+ ESheet = 26,
+ Executive = 7,
+ Folio = 14,
+ GermanLegalFanfold = 41,
+ GermanStandardFanfold = 40,
+ InviteEnvelope = 47,
+ IsoB4 = 42,
+ ItalyEnvelope = 36,
+ JapaneseDoublePostcard = 69,
+ JapaneseDoublePostcardRotated = 82,
+ JapaneseEnvelopeChouNumber3 = 73,
+ JapaneseEnvelopeChouNumber3Rotated = 86,
+ JapaneseEnvelopeChouNumber4 = 74,
+ JapaneseEnvelopeChouNumber4Rotated = 87,
+ JapaneseEnvelopeKakuNumber2 = 71,
+ JapaneseEnvelopeKakuNumber2Rotated = 84,
+ JapaneseEnvelopeKakuNumber3 = 72,
+ JapaneseEnvelopeKakuNumber3Rotated = 85,
+ JapaneseEnvelopeYouNumber4 = 91,
+ JapaneseEnvelopeYouNumber4Rotated = 92,
+ JapanesePostcard = 43,
+ JapanesePostcardRotated = 81,
+ Ledger = 4,
+ Legal = 5,
+ LegalExtra = 51,
+ Letter = 1,
+ LetterExtra = 50,
+ LetterExtraTransverse = 56,
+ LetterPlus = 59,
+ LetterRotated = 75,
+ LetterSmall = 2,
+ LetterTransverse = 54,
+ MonarchEnvelope = 37,
+ Note = 18,
+ Number10Envelope = 20,
+ Number11Envelope = 21,
+ Number12Envelope = 22,
+ Number14Envelope = 23,
+ Number9Envelope = 19,
+ PersonalEnvelope = 38,
+ Prc16K = 93,
+ Prc16KRotated = 106,
+ Prc32K = 94,
+ Prc32KBig = 95,
+ Prc32KBigRotated = 108,
+ Prc32KRotated = 107,
+ PrcEnvelopeNumber1 = 96,
+ PrcEnvelopeNumber10 = 105,
+ PrcEnvelopeNumber10Rotated = 118,
+ PrcEnvelopeNumber1Rotated = 109,
+ PrcEnvelopeNumber2 = 97,
+ PrcEnvelopeNumber2Rotated = 110,
+ PrcEnvelopeNumber3 = 98,
+ PrcEnvelopeNumber3Rotated = 111,
+ PrcEnvelopeNumber4 = 99,
+ PrcEnvelopeNumber4Rotated = 112,
+ PrcEnvelopeNumber5 = 100,
+ PrcEnvelopeNumber5Rotated = 113,
+ PrcEnvelopeNumber6 = 101,
+ PrcEnvelopeNumber6Rotated = 114,
+ PrcEnvelopeNumber7 = 102,
+ PrcEnvelopeNumber7Rotated = 115,
+ PrcEnvelopeNumber8 = 103,
+ PrcEnvelopeNumber8Rotated = 116,
+ PrcEnvelopeNumber9 = 104,
+ PrcEnvelopeNumber9Rotated = 117,
+ Quarto = 15,
+ Standard10x11 = 45,
+ Standard10x14 = 16,
+ Standard11x17 = 17,
+ Standard12x11 = 90,
+ Standard15x11 = 46,
+ Standard9x11 = 44,
+ Statement = 6,
+ Tabloid = 3,
+ TabloidExtra = 52,
+ USStandardFanfold = 39,
+ }
+ public partial class PaperSize
+ {
+ public PaperSize() { }
+ public PaperSize(string name, int width, int height) { }
+ public int Height { get { throw null; } set { } }
+ public System.Drawing.Printing.PaperKind Kind { get { throw null; } }
+ public string PaperName { get { throw null; } set { } }
+ public int RawKind { get { throw null; } set { } }
+ public int Width { get { throw null; } set { } }
+ public override string ToString() { throw null; }
+ }
+ public partial class PaperSource
+ {
+ public PaperSource() { }
+ public System.Drawing.Printing.PaperSourceKind Kind { get { throw null; } }
+ public int RawKind { get { throw null; } set { } }
+ public string SourceName { get { throw null; } set { } }
+ public override string ToString() { throw null; }
+ }
+ public enum PaperSourceKind
+ {
+ AutomaticFeed = 7,
+ Cassette = 14,
+ Custom = 257,
+ Envelope = 5,
+ FormSource = 15,
+ LargeCapacity = 11,
+ LargeFormat = 10,
+ Lower = 2,
+ Manual = 4,
+ ManualFeed = 6,
+ Middle = 3,
+ SmallFormat = 9,
+ TractorFeed = 8,
+ Upper = 1,
+ }
+ public sealed partial class PreviewPageInfo
+ {
+ public PreviewPageInfo(System.Drawing.Image image, System.Drawing.Size physicalSize) { }
+ public System.Drawing.Image Image { get { throw null; } }
+ public System.Drawing.Size PhysicalSize { get { throw null; } }
+ }
+ public partial class PreviewPrintController : System.Drawing.Printing.PrintController
+ {
+ public PreviewPrintController() { }
+ public override bool IsPreview { get { throw null; } }
+ public virtual bool UseAntiAlias { get { throw null; } set { } }
+ public System.Drawing.Printing.PreviewPageInfo[] GetPreviewPageInfo() { throw null; }
+ public override void OnEndPage(System.Drawing.Printing.PrintDocument document, System.Drawing.Printing.PrintPageEventArgs e) { }
+ public override void OnEndPrint(System.Drawing.Printing.PrintDocument document, System.Drawing.Printing.PrintEventArgs e) { }
+ public override System.Drawing.Graphics OnStartPage(System.Drawing.Printing.PrintDocument document, System.Drawing.Printing.PrintPageEventArgs e) { throw null; }
+ public override void OnStartPrint(System.Drawing.Printing.PrintDocument document, System.Drawing.Printing.PrintEventArgs e) { }
+ }
+ public enum PrintAction
+ {
+ PrintToFile = 0,
+ PrintToPreview = 1,
+ PrintToPrinter = 2,
+ }
+ public abstract partial class PrintController
+ {
+ protected PrintController() { }
+ public virtual bool IsPreview { get { throw null; } }
+ public virtual void OnEndPage(System.Drawing.Printing.PrintDocument document, System.Drawing.Printing.PrintPageEventArgs e) { }
+ public virtual void OnEndPrint(System.Drawing.Printing.PrintDocument document, System.Drawing.Printing.PrintEventArgs e) { }
+ public virtual System.Drawing.Graphics OnStartPage(System.Drawing.Printing.PrintDocument document, System.Drawing.Printing.PrintPageEventArgs e) { throw null; }
+ public virtual void OnStartPrint(System.Drawing.Printing.PrintDocument document, System.Drawing.Printing.PrintEventArgs e) { }
+ }
+ public partial class PrintDocument : System.ComponentModel.Component
+ {
+ public PrintDocument() { }
+ [System.ComponentModel.BrowsableAttribute(false)]
+ [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))]
+ public System.Drawing.Printing.PageSettings DefaultPageSettings { get { throw null; } set { } }
+ [System.ComponentModel.DefaultValueAttribute("document")]
+ public string DocumentName { get { throw null; } set { } }
+ [System.ComponentModel.DefaultValueAttribute(false)]
+ public bool OriginAtMargins { get { throw null; } set { } }
+ [System.ComponentModel.BrowsableAttribute(false)]
+ [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))]
+ public System.Drawing.Printing.PrintController PrintController { get { throw null; } set { } }
+ [System.ComponentModel.BrowsableAttribute(false)]
+ [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))]
+ public System.Drawing.Printing.PrinterSettings PrinterSettings { get { throw null; } set { } }
+ public event System.Drawing.Printing.PrintEventHandler BeginPrint { add { } remove { } }
+ public event System.Drawing.Printing.PrintEventHandler EndPrint { add { } remove { } }
+ public event System.Drawing.Printing.PrintPageEventHandler PrintPage { add { } remove { } }
+ public event System.Drawing.Printing.QueryPageSettingsEventHandler QueryPageSettings { add { } remove { } }
+ protected virtual void OnBeginPrint(System.Drawing.Printing.PrintEventArgs e) { }
+ protected virtual void OnEndPrint(System.Drawing.Printing.PrintEventArgs e) { }
+ protected virtual void OnPrintPage(System.Drawing.Printing.PrintPageEventArgs e) { }
+ protected virtual void OnQueryPageSettings(System.Drawing.Printing.QueryPageSettingsEventArgs e) { }
+ public void Print() { }
+ public override string ToString() { throw null; }
+ }
+ public partial class PrinterResolution
+ {
+ public PrinterResolution() { }
+ public System.Drawing.Printing.PrinterResolutionKind Kind { get { throw null; } set { } }
+ public int X { get { throw null; } set { } }
+ public int Y { get { throw null; } set { } }
+ public override string ToString() { throw null; }
+ }
+ public enum PrinterResolutionKind
+ {
+ Custom = 0,
+ Draft = -1,
+ High = -4,
+ Low = -2,
+ Medium = -3,
+ }
+ public partial class PrinterSettings : System.ICloneable
+ {
+ public PrinterSettings() { }
+ public bool CanDuplex { get { throw null; } }
+ public bool Collate { get { throw null; } set { } }
+ public short Copies { get { throw null; } set { } }
+ public System.Drawing.Printing.PageSettings DefaultPageSettings { get { throw null; } }
+ public System.Drawing.Printing.Duplex Duplex { get { throw null; } set { } }
+ public int FromPage { get { throw null; } set { } }
+ public static System.Drawing.Printing.PrinterSettings.StringCollection InstalledPrinters { get { throw null; } }
+ public bool IsDefaultPrinter { get { throw null; } }
+ public bool IsPlotter { get { throw null; } }
+ public bool IsValid { get { throw null; } }
+ public int LandscapeAngle { get { throw null; } }
+ public int MaximumCopies { get { throw null; } }
+ public int MaximumPage { get { throw null; } set { } }
+ public int MinimumPage { get { throw null; } set { } }
+ public System.Drawing.Printing.PrinterSettings.PaperSizeCollection PaperSizes { get { throw null; } }
+ public System.Drawing.Printing.PrinterSettings.PaperSourceCollection PaperSources { get { throw null; } }
+ public string PrinterName { get { throw null; } set { } }
+ public System.Drawing.Printing.PrinterSettings.PrinterResolutionCollection PrinterResolutions { get { throw null; } }
+ public string PrintFileName { get { throw null; } set { } }
+ public System.Drawing.Printing.PrintRange PrintRange { get { throw null; } set { } }
+ public bool PrintToFile { get { throw null; } set { } }
+ public bool SupportsColor { get { throw null; } }
+ public int ToPage { get { throw null; } set { } }
+ public object Clone() { throw null; }
+ public System.Drawing.Graphics CreateMeasurementGraphics() { throw null; }
+ public System.Drawing.Graphics CreateMeasurementGraphics(bool honorOriginAtMargins) { throw null; }
+ public System.Drawing.Graphics CreateMeasurementGraphics(System.Drawing.Printing.PageSettings pageSettings) { throw null; }
+ public System.Drawing.Graphics CreateMeasurementGraphics(System.Drawing.Printing.PageSettings pageSettings, bool honorOriginAtMargins) { throw null; }
+ public System.IntPtr GetHdevmode() { throw null; }
+ public System.IntPtr GetHdevmode(System.Drawing.Printing.PageSettings pageSettings) { throw null; }
+ public System.IntPtr GetHdevnames() { throw null; }
+ public bool IsDirectPrintingSupported(System.Drawing.Image image) { throw null; }
+ public bool IsDirectPrintingSupported(System.Drawing.Imaging.ImageFormat imageFormat) { throw null; }
+ public void SetHdevmode(System.IntPtr hdevmode) { }
+ public void SetHdevnames(System.IntPtr hdevnames) { }
+ public override string ToString() { throw null; }
+ public partial class PaperSizeCollection : System.Collections.ICollection, System.Collections.IEnumerable
+ {
+ public PaperSizeCollection(System.Drawing.Printing.PaperSize[] array) { }
+ public int Count { get { throw null; } }
+ public virtual System.Drawing.Printing.PaperSize this[int index] { get { throw null; } }
+ int System.Collections.ICollection.Count { get { throw null; } }
+ bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
+ object System.Collections.ICollection.SyncRoot { get { throw null; } }
+ [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))]
+ public int Add(System.Drawing.Printing.PaperSize paperSize) { throw null; }
+ public void CopyTo(System.Drawing.Printing.PaperSize[] paperSizes, int index) { }
+ public System.Collections.IEnumerator GetEnumerator() { throw null; }
+ void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
+ }
+ public partial class PaperSourceCollection : System.Collections.ICollection, System.Collections.IEnumerable
+ {
+ public PaperSourceCollection(System.Drawing.Printing.PaperSource[] array) { }
+ public int Count { get { throw null; } }
+ public virtual System.Drawing.Printing.PaperSource this[int index] { get { throw null; } }
+ int System.Collections.ICollection.Count { get { throw null; } }
+ bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
+ object System.Collections.ICollection.SyncRoot { get { throw null; } }
+ [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))]
+ public int Add(System.Drawing.Printing.PaperSource paperSource) { throw null; }
+ public void CopyTo(System.Drawing.Printing.PaperSource[] paperSources, int index) { }
+ public System.Collections.IEnumerator GetEnumerator() { throw null; }
+ void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
+ }
+ public partial class PrinterResolutionCollection : System.Collections.ICollection, System.Collections.IEnumerable
+ {
+ public PrinterResolutionCollection(System.Drawing.Printing.PrinterResolution[] array) { }
+ public int Count { get { throw null; } }
+ public virtual System.Drawing.Printing.PrinterResolution this[int index] { get { throw null; } }
+ int System.Collections.ICollection.Count { get { throw null; } }
+ bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
+ object System.Collections.ICollection.SyncRoot { get { throw null; } }
+ [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))]
+ public int Add(System.Drawing.Printing.PrinterResolution printerResolution) { throw null; }
+ public void CopyTo(System.Drawing.Printing.PrinterResolution[] printerResolutions, int index) { }
+ public System.Collections.IEnumerator GetEnumerator() { throw null; }
+ void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
+ }
+ public partial class StringCollection : System.Collections.ICollection, System.Collections.IEnumerable
+ {
+ public StringCollection(string[] array) { }
+ public int Count { get { throw null; } }
+ public virtual string this[int index] { get { throw null; } }
+ int System.Collections.ICollection.Count { get { throw null; } }
+ bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
+ object System.Collections.ICollection.SyncRoot { get { throw null; } }
+ [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))]
+ public int Add(string value) { throw null; }
+ public void CopyTo(string[] strings, int index) { }
+ public System.Collections.IEnumerator GetEnumerator() { throw null; }
+ void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
+ }
+ }
+ public enum PrinterUnit
+ {
+ Display = 0,
+ HundredthsOfAMillimeter = 2,
+ TenthsOfAMillimeter = 3,
+ ThousandthsOfAnInch = 1,
+ }
+ public sealed partial class PrinterUnitConvert
+ {
+ internal PrinterUnitConvert() { }
+ public static double Convert(double value, System.Drawing.Printing.PrinterUnit fromUnit, System.Drawing.Printing.PrinterUnit toUnit) { throw null; }
+ public static System.Drawing.Point Convert(System.Drawing.Point value, System.Drawing.Printing.PrinterUnit fromUnit, System.Drawing.Printing.PrinterUnit toUnit) { throw null; }
+ public static System.Drawing.Printing.Margins Convert(System.Drawing.Printing.Margins value, System.Drawing.Printing.PrinterUnit fromUnit, System.Drawing.Printing.PrinterUnit toUnit) { throw null; }
+ public static System.Drawing.Rectangle Convert(System.Drawing.Rectangle value, System.Drawing.Printing.PrinterUnit fromUnit, System.Drawing.Printing.PrinterUnit toUnit) { throw null; }
+ public static System.Drawing.Size Convert(System.Drawing.Size value, System.Drawing.Printing.PrinterUnit fromUnit, System.Drawing.Printing.PrinterUnit toUnit) { throw null; }
+ public static int Convert(int value, System.Drawing.Printing.PrinterUnit fromUnit, System.Drawing.Printing.PrinterUnit toUnit) { throw null; }
+ }
+ public partial class PrintEventArgs : System.ComponentModel.CancelEventArgs
+ {
+ public PrintEventArgs() { }
+ public System.Drawing.Printing.PrintAction PrintAction { get { throw null; } }
+ }
+ public delegate void PrintEventHandler(object sender, System.Drawing.Printing.PrintEventArgs e);
+ public partial class PrintPageEventArgs : System.EventArgs
+ {
+ public PrintPageEventArgs(System.Drawing.Graphics graphics, System.Drawing.Rectangle marginBounds, System.Drawing.Rectangle pageBounds, System.Drawing.Printing.PageSettings pageSettings) { }
+ public bool Cancel { get { throw null; } set { } }
+ public System.Drawing.Graphics Graphics { get { throw null; } }
+ public bool HasMorePages { get { throw null; } set { } }
+ public System.Drawing.Rectangle MarginBounds { get { throw null; } }
+ public System.Drawing.Rectangle PageBounds { get { throw null; } }
+ public System.Drawing.Printing.PageSettings PageSettings { get { throw null; } }
+ }
+ public delegate void PrintPageEventHandler(object sender, System.Drawing.Printing.PrintPageEventArgs e);
+ public enum PrintRange
+ {
+ AllPages = 0,
+ CurrentPage = 4194304,
+ Selection = 1,
+ SomePages = 2,
+ }
+ public partial class QueryPageSettingsEventArgs : System.Drawing.Printing.PrintEventArgs
+ {
+ public QueryPageSettingsEventArgs(System.Drawing.Printing.PageSettings pageSettings) { }
+ public System.Drawing.Printing.PageSettings PageSettings { get { throw null; } set { } }
+ }
+ public delegate void QueryPageSettingsEventHandler(object sender, System.Drawing.Printing.QueryPageSettingsEventArgs e);
+ public partial class StandardPrintController : System.Drawing.Printing.PrintController
+ {
+ public StandardPrintController() { }
+ public override void OnEndPage(System.Drawing.Printing.PrintDocument document, System.Drawing.Printing.PrintPageEventArgs e) { }
+ public override void OnEndPrint(System.Drawing.Printing.PrintDocument document, System.Drawing.Printing.PrintEventArgs e) { }
+ public override System.Drawing.Graphics OnStartPage(System.Drawing.Printing.PrintDocument document, System.Drawing.Printing.PrintPageEventArgs e) { throw null; }
+ public override void OnStartPrint(System.Drawing.Printing.PrintDocument document, System.Drawing.Printing.PrintEventArgs e) { }
+ }
+}
+namespace System.Drawing.Text
+{
+ public abstract partial class FontCollection : System.IDisposable
+ {
+ internal FontCollection() { }
+ public System.Drawing.FontFamily[] Families { get { throw null; } }
+ public void Dispose() { }
+ protected virtual void Dispose(bool disposing) { }
+ ~FontCollection() { }
+ }
+ public enum GenericFontFamilies
+ {
+ Monospace = 2,
+ SansSerif = 1,
+ Serif = 0,
+ }
+ public enum HotkeyPrefix
+ {
+ Hide = 2,
+ None = 0,
+ Show = 1,
+ }
+ public sealed partial class InstalledFontCollection : System.Drawing.Text.FontCollection
+ {
+ public InstalledFontCollection() { }
+ }
+ public sealed partial class PrivateFontCollection : System.Drawing.Text.FontCollection
+ {
+ public PrivateFontCollection() { }
+ public void AddFontFile(string filename) { }
+ public void AddMemoryFont(System.IntPtr memory, int length) { }
+ protected override void Dispose(bool disposing) { }
+ }
+ public enum TextRenderingHint
+ {
+ AntiAlias = 4,
+ AntiAliasGridFit = 3,
+ ClearTypeGridFit = 5,
+ SingleBitPerPixel = 2,
+ SingleBitPerPixelGridFit = 1,
+ SystemDefault = 0,
+ }
+}
+
+// Removed stuff:
+/*
+namespace System.Drawing.Design
+{
+ public delegate System.Drawing.Design.ToolboxItem ToolboxItemCreatorCallback(object serializedObject, string format);
+ public partial class PropertyValueUIItem
+ {
+ public PropertyValueUIItem(System.Drawing.Image uiItemImage, System.Drawing.Design.PropertyValueUIItemInvokeHandler handler, string tooltip) { }
+ public virtual System.Drawing.Image Image { get { throw null; } }
+ public virtual System.Drawing.Design.PropertyValueUIItemInvokeHandler InvokeHandler { get { throw null; } }
+ public virtual string ToolTip { get { throw null; } }
+ public virtual void Reset() { }
+ }
+ public partial interface IPropertyValueUIService
+ {
+ event System.EventHandler PropertyUIValueItemsChanged;
+ void AddPropertyValueUIHandler(System.Drawing.Design.PropertyValueUIHandler newHandler);
+ System.Drawing.Design.PropertyValueUIItem[] GetPropertyUIValueItems(System.ComponentModel.ITypeDescriptorContext context, System.ComponentModel.PropertyDescriptor propDesc);
+ void NotifyPropertyValueUIItemsChanged();
+ void RemovePropertyValueUIHandler(System.Drawing.Design.PropertyValueUIHandler newHandler);
+ }
+ public partial class PaintValueEventArgs : System.EventArgs
+ {
+ public PaintValueEventArgs(System.ComponentModel.ITypeDescriptorContext context, object value, System.Drawing.Graphics graphics, System.Drawing.Rectangle bounds) { }
+ public System.Drawing.Rectangle Bounds { get { throw null; } }
+ public System.ComponentModel.ITypeDescriptorContext Context { get { throw null; } }
+ public System.Drawing.Graphics Graphics { get { throw null; } }
+ public object Value { get { throw null; } }
+ }
+ public delegate void PropertyValueUIHandler(System.ComponentModel.ITypeDescriptorContext context, System.ComponentModel.PropertyDescriptor propDesc, System.Collections.ArrayList valueUIItemList);
+ public delegate void PropertyValueUIItemInvokeHandler(System.ComponentModel.ITypeDescriptorContext context, System.ComponentModel.PropertyDescriptor descriptor, System.Drawing.Design.PropertyValueUIItem invokedItem);
+ public partial class UITypeEditor
+ {
+ public UITypeEditor() { }
+ public virtual bool IsDropDownResizable { get { throw null; } }
+ public virtual object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value) { throw null; }
+ public object EditValue(System.IServiceProvider provider, object value) { throw null; }
+ public System.Drawing.Design.UITypeEditorEditStyle GetEditStyle() { throw null; }
+ public virtual System.Drawing.Design.UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context) { throw null; }
+ public bool GetPaintValueSupported() { throw null; }
+ public virtual bool GetPaintValueSupported(System.ComponentModel.ITypeDescriptorContext context) { throw null; }
+ public virtual void PaintValue(System.Drawing.Design.PaintValueEventArgs e) { }
+ public void PaintValue(object value, System.Drawing.Graphics canvas, System.Drawing.Rectangle rectangle) { }
+ }
+ public enum UITypeEditorEditStyle
+ {
+ DropDown = 3,
+ Modal = 2,
+ None = 1,
+ }
+ [System.Runtime.InteropServices.GuidAttribute("4BACD258-DE64-4048-BC4E-FEDBEF9ACB76")]
+ [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))]
+ public partial interface IToolboxService
+ {
+ System.Drawing.Design.CategoryNameCollection CategoryNames { get; }
+ string SelectedCategory { get; set; }
+ void AddCreator(System.Drawing.Design.ToolboxItemCreatorCallback creator, string format);
+ void AddCreator(System.Drawing.Design.ToolboxItemCreatorCallback creator, string format, System.ComponentModel.Design.IDesignerHost host);
+ void AddLinkedToolboxItem(System.Drawing.Design.ToolboxItem toolboxItem, System.ComponentModel.Design.IDesignerHost host);
+ void AddLinkedToolboxItem(System.Drawing.Design.ToolboxItem toolboxItem, string category, System.ComponentModel.Design.IDesignerHost host);
+ void AddToolboxItem(System.Drawing.Design.ToolboxItem toolboxItem);
+ void AddToolboxItem(System.Drawing.Design.ToolboxItem toolboxItem, string category);
+ System.Drawing.Design.ToolboxItem DeserializeToolboxItem(object serializedObject);
+ System.Drawing.Design.ToolboxItem DeserializeToolboxItem(object serializedObject, System.ComponentModel.Design.IDesignerHost host);
+ System.Drawing.Design.ToolboxItem GetSelectedToolboxItem();
+ System.Drawing.Design.ToolboxItem GetSelectedToolboxItem(System.ComponentModel.Design.IDesignerHost host);
+ System.Drawing.Design.ToolboxItemCollection GetToolboxItems();
+ System.Drawing.Design.ToolboxItemCollection GetToolboxItems(System.ComponentModel.Design.IDesignerHost host);
+ System.Drawing.Design.ToolboxItemCollection GetToolboxItems(string category);
+ System.Drawing.Design.ToolboxItemCollection GetToolboxItems(string category, System.ComponentModel.Design.IDesignerHost host);
+ bool IsSupported(object serializedObject, System.Collections.ICollection filterAttributes);
+ bool IsSupported(object serializedObject, System.ComponentModel.Design.IDesignerHost host);
+ bool IsToolboxItem(object serializedObject);
+ bool IsToolboxItem(object serializedObject, System.ComponentModel.Design.IDesignerHost host);
+ void Refresh();
+ void RemoveCreator(string format);
+ void RemoveCreator(string format, System.ComponentModel.Design.IDesignerHost host);
+ void RemoveToolboxItem(System.Drawing.Design.ToolboxItem toolboxItem);
+ void RemoveToolboxItem(System.Drawing.Design.ToolboxItem toolboxItem, string category);
+ void SelectedToolboxItemUsed();
+ object SerializeToolboxItem(System.Drawing.Design.ToolboxItem toolboxItem);
+ bool SetCursor();
+ void SetSelectedToolboxItem(System.Drawing.Design.ToolboxItem toolboxItem);
+ }
+ public partial class ToolboxItem : System.Runtime.Serialization.ISerializable
+ {
+ public ToolboxItem() { }
+ public ToolboxItem(System.Type toolType) { }
+ public System.Reflection.AssemblyName AssemblyName { get { throw null; } set { } }
+ public System.Drawing.Bitmap Bitmap { get { throw null; } set { } }
+ public string Company { get { throw null; } set { } }
+ public virtual string ComponentType { get { throw null; } }
+ public System.Reflection.AssemblyName[] DependentAssemblies { get { throw null; } set { } }
+ public string Description { get { throw null; } set { } }
+ public string DisplayName { get { throw null; } set { } }
+ public System.Collections.ICollection Filter { get { throw null; } set { } }
+ public bool IsTransient { get { throw null; } set { } }
+ public virtual bool Locked { get { throw null; } }
+ public System.Drawing.Bitmap OriginalBitmap { get { throw null; } set { } }
+ public System.Collections.IDictionary Properties { get { throw null; } }
+ public string TypeName { get { throw null; } set { } }
+ public virtual string Version { get { throw null; } }
+ public event System.Drawing.Design.ToolboxComponentsCreatedEventHandler ComponentsCreated { add { } remove { } }
+ public event System.Drawing.Design.ToolboxComponentsCreatingEventHandler ComponentsCreating { add { } remove { } }
+ protected void CheckUnlocked() { }
+ public System.ComponentModel.IComponent[] CreateComponents() { throw null; }
+ public System.ComponentModel.IComponent[] CreateComponents(System.ComponentModel.Design.IDesignerHost host) { throw null; }
+ public System.ComponentModel.IComponent[] CreateComponents(System.ComponentModel.Design.IDesignerHost host, System.Collections.IDictionary defaultValues) { throw null; }
+ protected virtual System.ComponentModel.IComponent[] CreateComponentsCore(System.ComponentModel.Design.IDesignerHost host) { throw null; }
+ protected virtual System.ComponentModel.IComponent[] CreateComponentsCore(System.ComponentModel.Design.IDesignerHost host, System.Collections.IDictionary defaultValues) { throw null; }
+ protected virtual void Deserialize(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
+ public override bool Equals(object obj) { throw null; }
+ protected virtual object FilterPropertyValue(string propertyName, object value) { throw null; }
+ public override int GetHashCode() { throw null; }
+ public System.Type GetType(System.ComponentModel.Design.IDesignerHost host) { throw null; }
+ protected virtual System.Type GetType(System.ComponentModel.Design.IDesignerHost host, System.Reflection.AssemblyName assemblyName, string typeName, bool reference) { throw null; }
+ public virtual void Initialize(System.Type type) { }
+ public virtual void Lock() { }
+ protected virtual void OnComponentsCreated(System.Drawing.Design.ToolboxComponentsCreatedEventArgs args) { }
+ protected virtual void OnComponentsCreating(System.Drawing.Design.ToolboxComponentsCreatingEventArgs args) { }
+ protected virtual void Serialize(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
+ void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
+ public override string ToString() { throw null; }
+ protected void ValidatePropertyType(string propertyName, object value, System.Type expectedType, bool allowNull) { }
+ protected virtual object ValidatePropertyValue(string propertyName, object value) { throw null; }
+ }
+ public partial interface IToolboxItemProvider
+ {
+ System.Drawing.Design.ToolboxItemCollection Items { get; }
+ }
+ public partial interface IToolboxUser
+ {
+ bool GetToolSupported(System.Drawing.Design.ToolboxItem tool);
+ void ToolPicked(System.Drawing.Design.ToolboxItem tool);
+ }
+ public sealed partial class ToolboxItemCollection : System.Collections.ReadOnlyCollectionBase
+ {
+ public ToolboxItemCollection(System.Drawing.Design.ToolboxItemCollection value) { }
+ public ToolboxItemCollection(System.Drawing.Design.ToolboxItem[] value) { }
+ public System.Drawing.Design.ToolboxItem this[int index] { get { throw null; } }
+ public bool Contains(System.Drawing.Design.ToolboxItem value) { throw null; }
+ public void CopyTo(System.Drawing.Design.ToolboxItem[] array, int index) { }
+ public int IndexOf(System.Drawing.Design.ToolboxItem value) { throw null; }
+ }
+ public partial class ToolboxComponentsCreatedEventArgs : System.EventArgs
+ {
+ public ToolboxComponentsCreatedEventArgs(System.ComponentModel.IComponent[] components) { }
+ public System.ComponentModel.IComponent[] Components { get { throw null; } }
+ }
+ public delegate void ToolboxComponentsCreatedEventHandler(object sender, System.Drawing.Design.ToolboxComponentsCreatedEventArgs e);
+ public partial class ToolboxComponentsCreatingEventArgs : System.EventArgs
+ {
+ public ToolboxComponentsCreatingEventArgs(System.ComponentModel.Design.IDesignerHost host) { }
+ public System.ComponentModel.Design.IDesignerHost DesignerHost { get { throw null; } }
+ }
+ public delegate void ToolboxComponentsCreatingEventHandler(object sender, System.Drawing.Design.ToolboxComponentsCreatingEventArgs e);
+
+}
+namespace System.Drawing.Configuration
+{
+ public sealed partial class SystemDrawingSection : System.Configuration.ConfigurationSection
+ {
+ public SystemDrawingSection() { }
+ [System.Configuration.ConfigurationPropertyAttribute("bitmapSuffix")]
+ public string BitmapSuffix { get { throw null; } set { } }
+ protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } }
+ }
+}
+
+*/ \ No newline at end of file
diff --git a/src/System.Drawing.Common/ref/System.Drawing.Common.csproj b/src/System.Drawing.Common/ref/System.Drawing.Common.csproj
new file mode 100644
index 0000000000..52b77920a3
--- /dev/null
+++ b/src/System.Drawing.Common/ref/System.Drawing.Common.csproj
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
+ <ItemGroup>
+ <Compile Include="System.Drawing.Common.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
+ <ProjectReference Include="..\..\System.Runtime.Extensions\ref\System.Runtime.Extensions.csproj" />
+ <ProjectReference Include="..\..\System.Runtime.InteropServices\ref\System.Runtime.InteropServices.csproj" />
+ <ProjectReference Include="..\..\System.Collections.NonGeneric\ref\System.Collections.NonGeneric.csproj" />
+ <ProjectReference Include="..\..\System.ComponentModel\ref\System.ComponentModel.csproj" />
+ <ProjectReference Include="..\..\System.ComponentModel.Primitives\ref\System.ComponentModel.Primitives.csproj" />
+ <ProjectReference Include="..\..\System.Diagnostics.Debug\ref\System.Diagnostics.Debug.csproj" />
+ <ProjectReference Include="..\..\System.Drawing.Primitives\ref\System.Drawing.Primitives.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project> \ No newline at end of file
diff --git a/src/System.Drawing.Common/src/AssemblyRef.cs b/src/System.Drawing.Common/src/AssemblyRef.cs
new file mode 100644
index 0000000000..61b2bbb861
--- /dev/null
+++ b/src/System.Drawing.Common/src/AssemblyRef.cs
@@ -0,0 +1,13 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ internal static class AssemblyRef
+ {
+ public const string SystemDrawingDesign = "System.Drawing.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
+ public const string SystemDesign = "System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
+ public const string SystemWindowsForms = "System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
+ }
+}
diff --git a/src/System.DirectoryServices.AccountManagement/pkg/Configurations.props b/src/System.Drawing.Common/src/Configurations.props
index b746c4279b..de40e021ab 100644
--- a/src/System.DirectoryServices.AccountManagement/pkg/Configurations.props
+++ b/src/System.Drawing.Common/src/Configurations.props
@@ -1,9 +1,8 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
- <!-- Empty build configurations as this project is not currently building for any vertical -->
- ;
+ netcoreapp-Windows_NT;
</BuildConfigurations>
</PropertyGroup>
</Project>
diff --git a/src/System.Drawing.Common/src/Resources/Strings.resx b/src/System.Drawing.Common/src/Resources/Strings.resx
new file mode 100644
index 0000000000..b6f979a828
--- /dev/null
+++ b/src/System.Drawing.Common/src/Resources/Strings.resx
@@ -0,0 +1,334 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="CantTellPrinterName" xml:space="preserve">
+ <value>(printer name protected due to security restrictions)</value>
+ </data>
+ <data name="CantChangeImmutableObjects" xml:space="preserve">
+ <value>Changes cannot be made to {0} because permissions are not valid.</value>
+ </data>
+ <data name="CantMakeIconTransparent" xml:space="preserve">
+ <value>Bitmaps that are icons cannot be made transparent. Icons natively support transparency. Use the Icon constructor to create an icon.</value>
+ </data>
+ <data name="ColorNotSystemColor" xml:space="preserve">
+ <value>The color {0} is not a system color.</value>
+ </data>
+ <data name="DotNET_ComponentType" xml:space="preserve">
+ <value>.NET Component</value>
+ </data>
+ <data name="GdiplusAborted" xml:space="preserve">
+ <value>Function was ended.</value>
+ </data>
+ <data name="GdiplusAccessDenied" xml:space="preserve">
+ <value>File access is denied.</value>
+ </data>
+ <data name="GdiplusCannotCreateGraphicsFromIndexedPixelFormat" xml:space="preserve">
+ <value>A Graphics object cannot be created from an image that has an indexed pixel format.</value>
+ </data>
+ <data name="GdiplusCannotSetPixelFromIndexedPixelFormat" xml:space="preserve">
+ <value>SetPixel is not supported for images with indexed pixel formats.</value>
+ </data>
+ <data name="GdiplusDestPointsInvalidParallelogram" xml:space="preserve">
+ <value>Destination points define a parallelogram which must have a length of 3. These points will represent the upper-left, upper-right, and lower-left coordinates (defined in that order).</value>
+ </data>
+ <data name="GdiplusDestPointsInvalidLength" xml:space="preserve">
+ <value>Destination points must be an array with a length of 3 or 4. A length of 3 defines a parallelogram with the upper-left, upper-right, and lower-left corners. A length of 4 defines a quadrilateral with the fourth element of the array specifying the lower-right coordinate.</value>
+ </data>
+ <data name="GdiplusFileNotFound" xml:space="preserve">
+ <value>File not found.</value>
+ </data>
+ <data name="GdiplusFontFamilyNotFound" xml:space="preserve">
+ <value>Font '{0}' cannot be found.</value>
+ </data>
+ <data name="GdiplusFontStyleNotFound" xml:space="preserve">
+ <value>Font '{0}' does not support style '{1}'.</value>
+ </data>
+ <data name="GdiplusGenericError" xml:space="preserve">
+ <value>A generic error occurred in GDI+.</value>
+ </data>
+ <data name="GdiplusInsufficientBuffer" xml:space="preserve">
+ <value>Buffer is too small (internal GDI+ error).</value>
+ </data>
+ <data name="GdiplusInvalidParameter" xml:space="preserve">
+ <value>Parameter is not valid.</value>
+ </data>
+ <data name="GdiplusInvalidRectangle" xml:space="preserve">
+ <value>Rectangle '{0}' cannot have a width or height equal to 0.</value>
+ </data>
+ <data name="GdiplusInvalidSize" xml:space="preserve">
+ <value>Operation requires a transformation of the image from GDI+ to GDI. GDI does not support images with a width or height greater than 32767.</value>
+ </data>
+ <data name="GdiplusOutOfMemory" xml:space="preserve">
+ <value>Out of memory.</value>
+ </data>
+ <data name="GdiplusNotImplemented" xml:space="preserve">
+ <value>Not implemented.</value>
+ </data>
+ <data name="GdiplusNotInitialized" xml:space="preserve">
+ <value>GDI+ is not properly initialized (internal GDI+ error).</value>
+ </data>
+ <data name="GdiplusNotTrueTypeFont" xml:space="preserve">
+ <value>Only TrueType fonts are supported. '{0}' is not a TrueType font.</value>
+ </data>
+ <data name="GdiplusNotTrueTypeFont_NoName" xml:space="preserve">
+ <value>Only TrueType fonts are supported. This is not a TrueType font.</value>
+ </data>
+ <data name="GdiplusObjectBusy" xml:space="preserve">
+ <value>Object is currently in use elsewhere.</value>
+ </data>
+ <data name="GdiplusOverflow" xml:space="preserve">
+ <value>Overflow error.</value>
+ </data>
+ <data name="GdiplusPropertyNotFoundError" xml:space="preserve">
+ <value>Property cannot be found.</value>
+ </data>
+ <data name="GdiplusPropertyNotSupportedError" xml:space="preserve">
+ <value>Property is not supported.</value>
+ </data>
+ <data name="GdiplusUnknown" xml:space="preserve">
+ <value>Unknown GDI+ error occurred.</value>
+ </data>
+ <data name="GdiplusUnknownImageFormat" xml:space="preserve">
+ <value>Image format is unknown.</value>
+ </data>
+ <data name="GdiplusUnsupportedGdiplusVersion" xml:space="preserve">
+ <value>Current version of GDI+ does not support this feature.</value>
+ </data>
+ <data name="GdiplusWrongState" xml:space="preserve">
+ <value>Bitmap region is already locked.</value>
+ </data>
+ <data name="GlobalAssemblyCache" xml:space="preserve">
+ <value> (Global Assembly Cache)</value>
+ </data>
+ <data name="GraphicsBufferCurrentlyBusy" xml:space="preserve">
+ <value>BufferedGraphicsContext cannot be disposed of because a buffer operation is currently in progress.</value>
+ </data>
+ <data name="GraphicsBufferQueryFail" xml:space="preserve">
+ <value>Screen-compatible bitmap cannot be created. The screen bitmap format cannot be determined.</value>
+ </data>
+ <data name="ToolboxItemLocked" xml:space="preserve">
+ <value>Toolbox item cannot be modified.</value>
+ </data>
+ <data name="ToolboxItemInvalidPropertyType" xml:space="preserve">
+ <value>Property {0} requires an argument of type {1}.</value>
+ </data>
+ <data name="ToolboxItemValueNotSerializable" xml:space="preserve">
+ <value>Data type {0} is not serializable. Items added to a property dictionary must be serializable.</value>
+ </data>
+ <data name="ToolboxItemInvalidKey" xml:space="preserve">
+ <value>Argument should be a non-empty string.</value>
+ </data>
+ <data name="IllegalState" xml:space="preserve">
+ <value>Internal state of the {1} class is invalid.</value>
+ </data>
+ <data name="InterpolationColorsColorBlendNotSet" xml:space="preserve">
+ <value>Property must be set to a valid ColorBlend object to use interpolation colors.</value>
+ </data>
+ <data name="InterpolationColorsCommon" xml:space="preserve">
+ <value>{0}{1} ColorBlend objects must be constructed with the same number of positions and color values. Positions must be between 0.0 and 1.0, 1.0 indicating the last element in the array.</value>
+ </data>
+ <data name="InterpolationColorsInvalidColorBlendObject" xml:space="preserve">
+ <value>ColorBlend object that was set is not valid.</value>
+ </data>
+ <data name="InterpolationColorsInvalidStartPosition" xml:space="preserve">
+ <value>Position's first element must be equal to 0.</value>
+ </data>
+ <data name="InterpolationColorsInvalidEndPosition" xml:space="preserve">
+ <value>Position's last element must be equal to 1.0.</value>
+ </data>
+ <data name="InterpolationColorsLength" xml:space="preserve">
+ <value>Array of colors and positions must contain at least two elements.</value>
+ </data>
+ <data name="InterpolationColorsLengthsDiffer" xml:space="preserve">
+ <value>Colors and positions do not have the same number of elements.</value>
+ </data>
+ <data name="InvalidArgument" xml:space="preserve">
+ <value>Value of '{1}' is not valid for '{0}'.</value>
+ </data>
+ <data name="InvalidBoundArgument" xml:space="preserve">
+ <value>Value of '{1}' is not valid for '{0}'. '{0}' should be greater than {2} and less than or equal to {3}.</value>
+ </data>
+ <data name="InvalidClassName" xml:space="preserve">
+ <value>Class name is not valid.</value>
+ </data>
+ <data name="InvalidColor" xml:space="preserve">
+ <value>Color '{0}' is not valid.</value>
+ </data>
+ <data name="InvalidDashPattern" xml:space="preserve">
+ <value>DashPattern value is not valid.</value>
+ </data>
+ <data name="InvalidEx2BoundArgument" xml:space="preserve">
+ <value>Value of '{1}' is not valid for '{0}'. '{0}' should be greater than or equal to {2} and less than or equal to {3}.</value>
+ </data>
+ <data name="InvalidFrame" xml:space="preserve">
+ <value>Frame is not valid. Frame must be between 0 and FrameCount.</value>
+ </data>
+ <data name="InvalidGDIHandle" xml:space="preserve">
+ <value>Win32 handle that was passed to {0} is not valid or is the wrong type.</value>
+ </data>
+ <data name="InvalidImage" xml:space="preserve">
+ <value>Image type is unknown.</value>
+ </data>
+ <data name="InvalidLowBoundArgumentEx" xml:space="preserve">
+ <value>Value of '{1}' is not valid for '{0}'. '{0}' must be greater than or equal to {2}.</value>
+ </data>
+ <data name="InvalidPermissionLevel" xml:space="preserve">
+ <value>Permission level is not valid.</value>
+ </data>
+ <data name="InvalidPermissionState" xml:space="preserve">
+ <value>Permission state is not valid.</value>
+ </data>
+ <data name="InvalidPictureType" xml:space="preserve">
+ <value>Argument '{0}' must be a picture that can be used as a {1}.</value>
+ </data>
+ <data name="InvalidPrinterException_InvalidPrinter" xml:space="preserve">
+ <value>Settings to access printer '{0}' are not valid.</value>
+ </data>
+ <data name="InvalidPrinterException_NoDefaultPrinter" xml:space="preserve">
+ <value>No printers are installed.</value>
+ </data>
+ <data name="InvalidPrinterHandle" xml:space="preserve">
+ <value>Handle {0} is not valid.</value>
+ </data>
+ <data name="ValidRangeX" xml:space="preserve">
+ <value>Parameter must be positive and &lt; Width.</value>
+ </data>
+ <data name="ValidRangeY" xml:space="preserve">
+ <value>Parameter must be positive and &lt; Height.</value>
+ </data>
+ <data name="NativeHandle0" xml:space="preserve">
+ <value>Native handle is 0.</value>
+ </data>
+ <data name="NoDefaultPrinter" xml:space="preserve">
+ <value>Default printer is not set.</value>
+ </data>
+ <data name="NotImplemented" xml:space="preserve">
+ <value>Not implemented.</value>
+ </data>
+ <data name="PDOCbeginPrintDescr" xml:space="preserve">
+ <value>Occurs when the document is about to be printed.</value>
+ </data>
+ <data name="PDOCdocumentNameDescr" xml:space="preserve">
+ <value>The name of the document shown to the user.</value>
+ </data>
+ <data name="PDOCdocumentPageSettingsDescr" xml:space="preserve">
+ <value>The page settings of the page currently being printed.</value>
+ </data>
+ <data name="PDOCendPrintDescr" xml:space="preserve">
+ <value>Occurs after the document has been printed.</value>
+ </data>
+ <data name="PDOCoriginAtMarginsDescr" xml:space="preserve">
+ <value>Indicates that the graphics origin is located at the user-specified page margins.</value>
+ </data>
+ <data name="PDOCprintControllerDescr" xml:space="preserve">
+ <value>Retrieves the print controller for this document.</value>
+ </data>
+ <data name="PDOCprintPageDescr" xml:space="preserve">
+ <value>Occurs once for each page to be printed.</value>
+ </data>
+ <data name="PDOCprinterSettingsDescr" xml:space="preserve">
+ <value>Retrieves the settings for the printer the document is currently being printed to.</value>
+ </data>
+ <data name="PDOCqueryPageSettingsDescr" xml:space="preserve">
+ <value>Occurs before each page is printed. Useful for changing PageSettings for a particular page.</value>
+ </data>
+ <data name="PrintDocumentDesc" xml:space="preserve">
+ <value>Defines an object that sends output to a printer.</value>
+ </data>
+ <data name="PrintingPermissionBadXml" xml:space="preserve">
+ <value>XML is not valid.</value>
+ </data>
+ <data name="PrintingPermissionAttributeInvalidPermissionLevel" xml:space="preserve">
+ <value>Permission level must be between PrintingPermissionLevel.NoPrinting and PrintingPermissionLevel.AllPrinting.</value>
+ </data>
+ <data name="PropertyValueInvalidEntry" xml:space="preserve">
+ <value>IDictionary parameter contains at least one entry that is not valid. Ensure all values are consistent with the object's properties.</value>
+ </data>
+ <data name="PSizeNotCustom" xml:space="preserve">
+ <value>PaperSize cannot be changed unless the Kind property is set to Custom.</value>
+ </data>
+ <data name="ResourceNotFound" xml:space="preserve">
+ <value>Resource '{1}' cannot be found in class '{0}'.</value>
+ </data>
+ <data name="TargetNotPrintingPermission" xml:space="preserve">
+ <value>Target does not have permission to print.</value>
+ </data>
+ <data name="TextParseFailedFormat" xml:space="preserve">
+ <value>Text "{0}" cannot be parsed. The expected text format is "{1}".</value>
+ </data>
+ <data name="TriStateCompareError" xml:space="preserve">
+ <value>TriState.Default cannot be converted into a Boolean.</value>
+ </data>
+ <data name="toStringIcon" xml:space="preserve">
+ <value>(Icon)</value>
+ </data>
+ <data name="toStringNone" xml:space="preserve">
+ <value>(none)</value>
+ </data>
+ <data name="DCTypeInvalid" xml:space="preserve">
+ <value>GetObjectType on this dc returned an invalid value.</value>
+ </data>
+ <data name="InvalidEnumArgument" xml:space="preserve">
+ <value>The value of argument '{0}' ({1}) is invalid for Enum type '{2}'.</value>
+ </data>
+ <data name="ConvertInvalidPrimitive" xml:space="preserve">
+ <value>{0} is not a valid value for {1}.</value>
+ </data>
+</root> \ No newline at end of file
diff --git a/src/System.Drawing.Common/src/Resources/System/Drawing/DefaultComponent.bmp b/src/System.Drawing.Common/src/Resources/System/Drawing/DefaultComponent.bmp
new file mode 100644
index 0000000000..e7a9eb9331
--- /dev/null
+++ b/src/System.Drawing.Common/src/Resources/System/Drawing/DefaultComponent.bmp
Binary files differ
diff --git a/src/System.Drawing.Common/src/Resources/System/Drawing/Printing/PrintDocument.bmp b/src/System.Drawing.Common/src/Resources/System/Drawing/Printing/PrintDocument.bmp
new file mode 100644
index 0000000000..9473fc5a52
--- /dev/null
+++ b/src/System.Drawing.Common/src/Resources/System/Drawing/Printing/PrintDocument.bmp
Binary files differ
diff --git a/src/System.Drawing.Common/src/Resources/System/Drawing/ShieldIcon.ico b/src/System.Drawing.Common/src/Resources/System/Drawing/ShieldIcon.ico
new file mode 100644
index 0000000000..0bc48439a1
--- /dev/null
+++ b/src/System.Drawing.Common/src/Resources/System/Drawing/ShieldIcon.ico
Binary files differ
diff --git a/src/System.Drawing.Common/src/SRDescriptionAttribute.cs b/src/System.Drawing.Common/src/SRDescriptionAttribute.cs
new file mode 100644
index 0000000000..193d10f85d
--- /dev/null
+++ b/src/System.Drawing.Common/src/SRDescriptionAttribute.cs
@@ -0,0 +1,31 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.ComponentModel;
+
+namespace System.Drawing
+{
+ [AttributeUsage(AttributeTargets.All)]
+ internal sealed class SRDescriptionAttribute : DescriptionAttribute
+ {
+ private bool _replaced;
+
+ public override string Description
+ {
+ get
+ {
+ if (!_replaced)
+ {
+ _replaced = true;
+ DescriptionValue = SR.Format(base.Description);
+ }
+ return base.Description;
+ }
+ }
+
+ public SRDescriptionAttribute(string description) : base(description)
+ {
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System.Drawing.Common.csproj b/src/System.Drawing.Common/src/System.Drawing.Common.csproj
new file mode 100644
index 0000000000..7716dffe5d
--- /dev/null
+++ b/src/System.Drawing.Common/src/System.Drawing.Common.csproj
@@ -0,0 +1,248 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <OutputType>Library</OutputType>
+ <RootNamespace>System.Drawing</RootNamespace>
+ <ProjectGuid>{191B3618-FECD-4ABD-9D6B-5AC90DC33621}</ProjectGuid>
+ <DefineConstants>$(DefineConstants);DRAWING_NAMESPACE</DefineConstants>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <!-- TODO: RE-ENABLE THIS -->
+ <EnablePInvokeAnalyzer>false</EnablePInvokeAnalyzer>
+ <WarningsNotAsErrors>CS0618</WarningsNotAsErrors>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Windows_NT-Debug|AnyCPU'" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Windows_NT-Release|AnyCPU'" />
+ <ItemGroup>
+ <Reference Include="Microsoft.Win32.Primitives" />
+ <Reference Include="System.Collections" />
+ <Reference Include="System.Collections.NonGeneric" />
+ <Reference Include="System.Collections.Specialized" />
+ <Reference Include="System.Configuration.ConfigurationManager" />
+ <Reference Include="System.Diagnostics.Contracts" />
+ <Reference Include="System.Diagnostics.Debug" />
+ <Reference Include="System.Diagnostics.StackTrace" />
+ <Reference Include="System.Diagnostics.Tools" />
+ <Reference Include="System.Diagnostics.TraceSource" />
+ <Reference Include="System.Drawing.Primitives" />
+ <Reference Include="System.IO.FileSystem" />
+ <Reference Include="System.Resources.ResourceManager" />
+ <Reference Include="System.Runtime" />
+ <Reference Include="System.Runtime.Extensions" />
+ <Reference Include="System.Runtime.InteropServices" />
+ <Reference Include="System.ComponentModel" />
+ <Reference Include="System.ComponentModel.Primitives" />
+ <Reference Include="System.Security.Permissions" />
+ <Reference Include="System.Threading" />
+ <Reference Include="System.Threading.Thread" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AssemblyRef.cs" />
+ <Compile Include="SRDescriptionAttribute.cs" />
+ <Compile Include="System\ComponentModel\InvalidEnumArgumentException.cs" />
+ <Compile Include="System\Drawing\Advanced\AdjustableArrowCap.cs" />
+ <Compile Include="System\Drawing\Advanced\BitmapData.cs" />
+ <Compile Include="System\Drawing\Advanced\Blend.cs" />
+ <Compile Include="System\Drawing\Advanced\BrushType.cs" />
+ <Compile Include="System\Drawing\Advanced\ColorAdjustType.cs" />
+ <Compile Include="System\Drawing\Advanced\ColorBlend.cs" />
+ <Compile Include="System\Drawing\Advanced\ColorChannelFlags.cs" />
+ <Compile Include="System\Drawing\Advanced\ColorMap.cs" />
+ <Compile Include="System\Drawing\Advanced\ColorMapType.cs" />
+ <Compile Include="System\Drawing\Advanced\ColorMatrix.cs" />
+ <Compile Include="System\Drawing\Advanced\ColorMatrixFlags.cs" />
+ <Compile Include="System\Drawing\Advanced\ColorMode.cs" />
+ <Compile Include="System\Drawing\Advanced\ColorPalette.cs" />
+ <Compile Include="System\Drawing\Advanced\ColorTranslator.cs" />
+ <Compile Include="System\Drawing\Advanced\CombineMode.cs" />
+ <Compile Include="System\Drawing\Advanced\CompositingMode.cs" />
+ <Compile Include="System\Drawing\Advanced\CompositingQuality.cs" />
+ <Compile Include="System\Drawing\Advanced\CoordinateSpace.cs" />
+ <Compile Include="System\Drawing\Advanced\CustomLineCap.cs" />
+ <Compile Include="System\Drawing\Advanced\CustomLineCapType.cs" />
+ <Compile Include="System\Drawing\Advanced\DashStyle.cs" />
+ <Compile Include="System\Drawing\Advanced\EmfPlusFlags.cs" />
+ <Compile Include="System\Drawing\Advanced\EmfPlusRecordType.cs" />
+ <Compile Include="System\Drawing\Advanced\EmfType.cs" />
+ <Compile Include="System\Drawing\Advanced\Encoder.cs" />
+ <Compile Include="System\Drawing\Advanced\EncoderParameter.cs" />
+ <Compile Include="System\Drawing\Advanced\EncoderParameters.cs" />
+ <Compile Include="System\Drawing\Advanced\EncoderParameterValueType.cs" />
+ <Compile Include="System\Drawing\Advanced\EncoderValue.cs" />
+ <Compile Include="System\Drawing\Advanced\FillMode.cs" />
+ <Compile Include="System\Drawing\Advanced\FlushIntention.cs" />
+ <Compile Include="System\Drawing\Advanced\Font.cs" />
+ <Compile Include="System\Drawing\Advanced\FontCollection.cs" />
+ <Compile Include="System\Drawing\Advanced\FontFamily.cs" />
+ <Compile Include="System\Drawing\Advanced\FontStyle.cs" />
+ <Compile Include="System\Drawing\Advanced\FrameDimension.cs" />
+ <Compile Include="System\Drawing\Advanced\Gdiplus.cs" />
+ <Compile Include="System\Drawing\Advanced\GenericFontFamilies.cs" />
+ <Compile Include="System\Drawing\Advanced\GPPOINT.cs" />
+ <Compile Include="System\Drawing\Advanced\GPPOINTF.cs" />
+ <Compile Include="System\Drawing\Advanced\GPRECT.cs" />
+ <Compile Include="System\Drawing\Advanced\GPRECTF.cs" />
+ <Compile Include="System\Drawing\Advanced\GPStream.cs" />
+ <Compile Include="System\Drawing\Advanced\GraphicsContainer.cs" />
+ <Compile Include="System\Drawing\Advanced\GraphicsPath.cs" />
+ <Compile Include="System\Drawing\Advanced\GraphicsPathIterator.cs" />
+ <Compile Include="System\Drawing\Advanced\GraphicsState.cs" />
+ <Compile Include="System\Drawing\Advanced\HatchBrush.cs" />
+ <Compile Include="System\Drawing\Advanced\HatchStyle.cs" />
+ <Compile Include="System\Drawing\Advanced\HotkeyPrefix.cs" />
+ <Compile Include="System\Drawing\Advanced\ImageAttributes.cs" />
+ <Compile Include="System\Drawing\Advanced\ImageCodecFlags.cs" />
+ <Compile Include="System\Drawing\Advanced\ImageCodecInfo.cs" />
+ <Compile Include="System\Drawing\Advanced\ImageCodecInfoPrivate.cs" />
+ <Compile Include="System\Drawing\Advanced\ImageFlags.cs" />
+ <Compile Include="System\Drawing\Advanced\ImageFormat.cs" />
+ <Compile Include="System\Drawing\Advanced\ImageLockMode.cs" />
+ <Compile Include="System\Drawing\Advanced\InstalledFontCollection.cs" />
+ <Compile Include="System\Drawing\Advanced\InterpolationMode.cs" />
+ <Compile Include="System\Drawing\Advanced\ISystemEventTracker.cs" />
+ <Compile Include="System\Drawing\Advanced\LinearGradientBrush.cs" />
+ <Compile Include="System\Drawing\Advanced\LinearGradientMode.cs" />
+ <Compile Include="System\Drawing\Advanced\LineCap.cs" />
+ <Compile Include="System\Drawing\Advanced\LineJoin.cs" />
+ <Compile Include="System\Drawing\Advanced\Matrix.cs" />
+ <Compile Include="System\Drawing\Advanced\MatrixOrder.cs" />
+ <Compile Include="System\Drawing\Advanced\Metafile.cs" />
+ <Compile Include="System\Drawing\Advanced\MetafileFrameUnit.cs" />
+ <Compile Include="System\Drawing\Advanced\MetafileHeader.cs" />
+ <Compile Include="System\Drawing\Advanced\MetafileHeaderEmf.cs" />
+ <Compile Include="System\Drawing\Advanced\MetafileHeaderWmf.cs" />
+ <Compile Include="System\Drawing\Advanced\MetafileType.cs" />
+ <Compile Include="System\Drawing\Advanced\METAHEADER.cs" />
+ <Compile Include="System\Drawing\Advanced\PaletteFlags.cs" />
+ <Compile Include="System\Drawing\Advanced\PathData.cs" />
+ <Compile Include="System\Drawing\Advanced\PathGradientBrush.cs" />
+ <Compile Include="System\Drawing\Advanced\PathPointType.cs" />
+ <Compile Include="System\Drawing\Advanced\PenAlignment.cs" />
+ <Compile Include="System\Drawing\Advanced\PenType.cs" />
+ <Compile Include="System\Drawing\Advanced\PixelFormat.cs" />
+ <Compile Include="System\Drawing\Advanced\PixelOffsetMode.cs" />
+ <Compile Include="System\Drawing\Advanced\PlayRecordCallback.cs" />
+ <Compile Include="System\Drawing\Advanced\PrivateFontCollection.cs" />
+ <Compile Include="System\Drawing\Advanced\PropertyItem.cs" />
+ <Compile Include="System\Drawing\Advanced\QualityMode.cs" />
+ <Compile Include="System\Drawing\Advanced\RectangleFEx.cs" />
+ <Compile Include="System\Drawing\Advanced\RegionData.cs" />
+ <Compile Include="System\Drawing\Advanced\SafeCustomLineCapHandle.cs" />
+ <Compile Include="System\Drawing\Advanced\SmoothingMode.cs" />
+ <Compile Include="System\Drawing\Advanced\StringAlignment.cs" />
+ <Compile Include="System\Drawing\Advanced\StringDigitSubstitute.cs" />
+ <Compile Include="System\Drawing\Advanced\StringFormat.cs" />
+ <Compile Include="System\Drawing\Advanced\StringFormatFlags.cs" />
+ <Compile Include="System\Drawing\Advanced\StringTrimming.cs" />
+ <Compile Include="System\Drawing\Advanced\StringUnit.cs" />
+ <Compile Include="System\Drawing\Advanced\SystemColorTracker.cs" />
+ <Compile Include="System\Drawing\Advanced\TextRenderingHint.cs" />
+ <Compile Include="System\Drawing\Advanced\TextureBrush.cs" />
+ <Compile Include="System\Drawing\Advanced\Unit.cs" />
+ <Compile Include="System\Drawing\Advanced\WarpMode.cs" />
+ <Compile Include="System\Drawing\Advanced\WmfPlaceableFileHeader.cs" />
+ <Compile Include="System\Drawing\Advanced\WrapMode.cs" />
+ <Compile Include="System\Drawing\Bitmap.cs" />
+ <Compile Include="System\Drawing\BitmapSelector.cs" />
+ <Compile Include="System\Drawing\BitmapSuffixInSameAssemblyAttribute.cs" />
+ <Compile Include="System\Drawing\BitmapSuffixInSatelliteAssemblyAttribute.cs" />
+ <Compile Include="System\Drawing\Brush.cs" />
+ <Compile Include="System\Drawing\Brushes.cs" />
+ <Compile Include="System\Drawing\BufferedGraphics.cs" />
+ <Compile Include="System\Drawing\BufferedGraphicsContext.cs" />
+ <Compile Include="System\Drawing\BufferedGraphicsManager.cs" />
+ <Compile Include="System\Drawing\Configuration\SystemDrawingSection.cs" />
+ <Compile Include="System\Drawing\ContentAlignment.cs" />
+ <Compile Include="System\Drawing\CopyPixelOperation.cs" />
+ <Compile Include="System\Drawing\DashCap.cs" />
+ <Compile Include="System\Drawing\Design\CategoryNameCollection.cs" />
+ <Compile Include="System\Drawing\Graphics.cs" />
+ <Compile Include="System\Drawing\GraphicsContext.cs" />
+ <Compile Include="System\Drawing\Icon.cs" />
+ <Compile Include="System\Drawing\IDeviceContext.cs" />
+ <Compile Include="System\Drawing\Image.cs" />
+ <Compile Include="System\Drawing\ImageAnimator.cs" />
+ <Compile Include="System\Drawing\ImageInfo.cs" />
+ <Compile Include="System\Drawing\KnownColorTable.cs" />
+ <Compile Include="System\Drawing\LocalAppContextSwitches.cs" />
+ <Compile Include="System\Drawing\NativeMethods.cs" />
+ <Compile Include="System\Drawing\Pen.cs" />
+ <Compile Include="System\Drawing\Pens.cs" />
+ <Compile Include="System\Drawing\Printing\DefaultPrintController.cs" />
+ <Compile Include="System\Drawing\Printing\Duplex.cs" />
+ <Compile Include="System\Drawing\Printing\InvalidPrinterException.cs" />
+ <Compile Include="System\Drawing\Printing\Margins.cs" />
+ <Compile Include="System\Drawing\Printing\ModeField.cs" />
+ <Compile Include="System\Drawing\Printing\PageSettings.cs" />
+ <Compile Include="System\Drawing\Printing\PaperKinds.cs" />
+ <Compile Include="System\Drawing\Printing\PaperSize.cs" />
+ <Compile Include="System\Drawing\Printing\PaperSource.cs" />
+ <Compile Include="System\Drawing\Printing\PaperSourceKind.cs" />
+ <Compile Include="System\Drawing\Printing\PreviewPageInfo.cs" />
+ <Compile Include="System\Drawing\Printing\PreviewPrintController.cs" />
+ <Compile Include="System\Drawing\Printing\PrintAction.cs" />
+ <Compile Include="System\Drawing\Printing\PrintController.cs" />
+ <Compile Include="System\Drawing\Printing\PrintDocument.cs">
+ <SubType>Component</SubType>
+ </Compile>
+ <Compile Include="System\Drawing\Printing\PrinterResolution.cs" />
+ <Compile Include="System\Drawing\Printing\PrinterResolutionKind.cs" />
+ <Compile Include="System\Drawing\Printing\PrinterSettings.cs" />
+ <Compile Include="System\Drawing\Printing\PrinterUnit.cs" />
+ <Compile Include="System\Drawing\Printing\PrinterUnitConvert.cs" />
+ <Compile Include="System\Drawing\Printing\PrintEvent.cs" />
+ <Compile Include="System\Drawing\Printing\PrintEventHandler.cs" />
+ <Compile Include="System\Drawing\Printing\PrintPageEvent.cs" />
+ <Compile Include="System\Drawing\Printing\PrintPageEventHandler.cs" />
+ <Compile Include="System\Drawing\Printing\PrintPreviewGraphics.cs" />
+ <Compile Include="System\Drawing\Printing\PrintRange.cs" />
+ <Compile Include="System\Drawing\Printing\QueryPageSettingsEventArgs.cs" />
+ <Compile Include="System\Drawing\Printing\QueryPageSettingsEventHandler.cs" />
+ <Compile Include="System\Drawing\Printing\TriState.cs" />
+ <Compile Include="System\Drawing\PropertyItemInternal.cs" />
+ <Compile Include="System\Drawing\Region.cs" />
+ <Compile Include="System\Drawing\RotateFlipType.cs" />
+ <Compile Include="System\Drawing\SolidBrush.cs" />
+ <Compile Include="System\Drawing\SystemBrushes.cs" />
+ <Compile Include="System\Drawing\SystemColors.cs" />
+ <Compile Include="System\Drawing\SystemFonts.cs" />
+ <Compile Include="System\Drawing\SystemIcons.cs" />
+ <Compile Include="System\Drawing\SystemPens.cs" />
+ <Compile Include="System\Drawing\ToolboxBitmapAttribute.cs" />
+ <Compile Include="System\Drawing\UnsafeNativeMethods.cs" />
+ <Compile Include="misc\ClientUtils.cs" />
+ <Compile Include="misc\CompModSwitches.cs" />
+ <Compile Include="misc\CoreSwitches.cs" />
+ <Compile Include="misc\DbgUtil.cs" />
+ <Compile Include="misc\DebugHandleTracker.cs" />
+ <Compile Include="misc\DpiHelper.cs" />
+ <Compile Include="misc\ExternDll.cs" />
+ <Compile Include="misc\GDI\ApplyGraphicsProperties.cs" />
+ <Compile Include="misc\GDI\DeviceContext.cs" />
+ <Compile Include="misc\GDI\DeviceContextGraphicsMode.cs" />
+ <Compile Include="misc\GDI\DeviceContexts.cs" />
+ <Compile Include="misc\GDI\DeviceContextType.cs" />
+ <Compile Include="misc\GDI\GdiObjectType.cs" />
+ <Compile Include="misc\GDI\NativeMethods.cs" />
+ <Compile Include="misc\GDI\SafeNativeMethods.cs" />
+ <Compile Include="misc\GDI\UnsafeNativeMethods.cs" />
+ <Compile Include="misc\GDI\WindowsGraphics.cs" />
+ <Compile Include="misc\GDI\WindowsRegion.cs" />
+ <Compile Include="misc\GDI\WindowsRegionCombineMode.cs" />
+ <Compile Include="misc\HandleCollector.cs" />
+ <Compile Include="misc\InvariantComparer.cs" />
+ <Compile Include="$(CommonPath)\System\LocalAppContext.cs" />
+ <Compile Include="$(CommonPath)/System/Drawing/ColorConverterCommon.cs">
+ <Link>System\Drawing\ColorConverterCommon.cs</Link>
+ </Compile>
+ <Compile Include="$(CommonPath)/System/Drawing/ColorTable.cs">
+ <Link>System\Drawing\ColorTable.cs</Link>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Resources\System\Drawing\DefaultComponent.bmp" />
+ <EmbeddedResource Include="Resources\System\Drawing\Printing\PrintDocument.bmp" />
+ <EmbeddedResource Include="Resources\System\Drawing\ShieldIcon.ico" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project> \ No newline at end of file
diff --git a/src/System.Drawing.Common/src/System/ComponentModel/InvalidEnumArgumentException.cs b/src/System.Drawing.Common/src/System/ComponentModel/InvalidEnumArgumentException.cs
new file mode 100644
index 0000000000..0e2fc28594
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/ComponentModel/InvalidEnumArgumentException.cs
@@ -0,0 +1,63 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.ComponentModel
+{
+ /// <summary>
+ /// <para>The exception that is thrown when using invalid arguments that are enumerators.</para>
+ /// </summary>
+ [Serializable]
+ internal class InvalidEnumArgumentException : ArgumentException
+ {
+ /// <summary>
+ /// <para>Initializes a new instance of the <see cref='System.ComponentModel.InvalidEnumArgumentException'/> class without a message.</para>
+ /// </summary>
+ public InvalidEnumArgumentException() : this(null)
+ {
+ }
+
+ /// <summary>
+ /// <para>Initializes a new instance of the <see cref='System.ComponentModel.InvalidEnumArgumentException'/> class with
+ /// the specified message.</para>
+ /// </summary>
+ public InvalidEnumArgumentException(string message)
+ : base(message)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the Exception class with a specified error message and a
+ /// reference to the inner exception that is the cause of this exception.
+ /// FxCop CA1032: Multiple constructors are required to correctly implement a custom exception.
+ /// </summary>
+ public InvalidEnumArgumentException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ /// <summary>
+ /// <para>Initializes a new instance of the <see cref='System.ComponentModel.InvalidEnumArgumentException'/> class with a
+ /// message generated from the argument, invalid value, and enumeration
+ /// class.</para>
+ /// </summary>
+ public InvalidEnumArgumentException(string argumentName, int invalidValue, Type enumClass)
+ : base(SR.Format(SR.InvalidEnumArgument,
+ argumentName,
+ invalidValue.ToString(CultureInfo.CurrentCulture),
+ enumClass.Name), argumentName)
+ {
+ }
+
+ /// <summary>
+ /// Need this constructor since Exception implements ISerializable. We don't have any fields,
+ /// so just forward this to base.
+ /// </summary>
+ protected InvalidEnumArgumentException(SerializationInfo info, StreamingContext context) : base(info, context)
+ {
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/AdjustableArrowCap.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/AdjustableArrowCap.cs
new file mode 100644
index 0000000000..d964096160
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/AdjustableArrowCap.cs
@@ -0,0 +1,171 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ using System.Runtime.InteropServices;
+
+ /// <include file='doc\AdjustableArrowCap.uex' path='docs/doc[@for="AdjustableArrowCap"]/*' />
+ /// <devdoc>
+ /// Represents an adjustable arrow-shaped line
+ /// cap.
+ /// </devdoc>
+ public sealed class AdjustableArrowCap : CustomLineCap
+ {
+ internal AdjustableArrowCap(IntPtr nativeCap) :
+ base(nativeCap)
+ { }
+
+ /// <include file='doc\AdjustableArrowCap.uex' path='docs/doc[@for="AdjustableArrowCap.AdjustableArrowCap"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.AdjustableArrowCap'/> class with the specified width and
+ /// height.
+ /// </devdoc>
+ public AdjustableArrowCap(float width,
+ float height) :
+ this(width, height, true)
+ { }
+
+ /// <include file='doc\AdjustableArrowCap.uex' path='docs/doc[@for="AdjustableArrowCap.AdjustableArrowCap1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.AdjustableArrowCap'/> class with the specified width,
+ /// height, and fill property.
+ /// </para>
+ /// </devdoc>
+ public AdjustableArrowCap(float width,
+ float height,
+ bool isFilled)
+ {
+ IntPtr nativeCap = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateAdjustableArrowCap(
+ height, width, isFilled, out nativeCap);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeLineCap(nativeCap);
+ }
+
+ private void _SetHeight(float height)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetAdjustableArrowCapHeight(new HandleRef(this, nativeCap), height);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ private float _GetHeight()
+ {
+ float height;
+ int status = SafeNativeMethods.Gdip.GdipGetAdjustableArrowCapHeight(new HandleRef(this, nativeCap), out height);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return height;
+ }
+
+ /// <include file='doc\AdjustableArrowCap.uex' path='docs/doc[@for="AdjustableArrowCap.Height"]/*' />
+ /// <devdoc>
+ /// Gets or sets the height of the arrow cap.
+ /// </devdoc>
+ public float Height
+ {
+ get { return _GetHeight(); }
+ set { _SetHeight(value); }
+ }
+
+ private void _SetWidth(float width)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetAdjustableArrowCapWidth(new HandleRef(this, nativeCap), width);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ private float _GetWidth()
+ {
+ float width;
+ int status = SafeNativeMethods.Gdip.GdipGetAdjustableArrowCapWidth(new HandleRef(this, nativeCap), out width);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return width;
+ }
+
+ /// <include file='doc\AdjustableArrowCap.uex' path='docs/doc[@for="AdjustableArrowCap.Width"]/*' />
+ /// <devdoc>
+ /// Gets or sets the width of the arrow cap.
+ /// </devdoc>
+ public float Width
+ {
+ get { return _GetWidth(); }
+ set { _SetWidth(value); }
+ }
+
+ private void _SetMiddleInset(float middleInset)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetAdjustableArrowCapMiddleInset(new HandleRef(this, nativeCap), middleInset);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ private float _GetMiddleInset()
+ {
+ float middleInset;
+ int status = SafeNativeMethods.Gdip.GdipGetAdjustableArrowCapMiddleInset(new HandleRef(this, nativeCap), out middleInset);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return middleInset;
+ }
+
+ /// <include file='doc\AdjustableArrowCap.uex' path='docs/doc[@for="AdjustableArrowCap.MiddleInset"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or set the number of pixels between the outline of the arrow cap and the fill.
+ /// </para>
+ /// </devdoc>
+ public float MiddleInset
+ {
+ get { return _GetMiddleInset(); }
+ set { _SetMiddleInset(value); }
+ }
+
+ private void _SetFillState(bool isFilled)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetAdjustableArrowCapFillState(new HandleRef(this, nativeCap), isFilled);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ private bool _IsFilled()
+ {
+ bool isFilled = false;
+ int status = SafeNativeMethods.Gdip.GdipGetAdjustableArrowCapFillState(new HandleRef(this, nativeCap), out isFilled);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return isFilled;
+ }
+
+ /// <include file='doc\AdjustableArrowCap.uex' path='docs/doc[@for="AdjustableArrowCap.Filled"]/*' />
+ /// <devdoc>
+ /// Gets or sets a value indicating whether the
+ /// arrow cap is filled.
+ /// </devdoc>
+ public bool Filled
+ {
+ get { return _IsFilled(); }
+ set { _SetFillState(value); }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/BitmapData.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/BitmapData.cs
new file mode 100644
index 0000000000..850f21a36a
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/BitmapData.cs
@@ -0,0 +1,120 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ using System.Runtime.InteropServices;
+
+ /// <include file='doc\BitmapData.uex' path='docs/doc[@for="BitmapData"]/*' />
+ /// <devdoc>
+ /// Specifies the attributes of a bitmap image.
+ /// </devdoc>
+ [StructLayout(LayoutKind.Sequential)]
+ public sealed class BitmapData
+ {
+ private int _width;
+ private int _height;
+ private int _stride;
+ private int _pixelFormat;
+ private IntPtr _scan0;
+ private int _reserved;
+
+ /// <include file='doc\BitmapData.uex' path='docs/doc[@for="BitmapData.Width"]/*' />
+ /// <devdoc>
+ /// Specifies the pixel width of the <see cref='System.Drawing.Bitmap'/>.
+ /// </devdoc>
+ public int Width
+ {
+ get { return _width; }
+ set { _width = value; }
+ }
+
+ /// <include file='doc\BitmapData.uex' path='docs/doc[@for="BitmapData.Height"]/*' />
+ /// <devdoc>
+ /// Specifies the pixel height of the <see cref='System.Drawing.Bitmap'/>.
+ /// </devdoc>
+ public int Height
+ {
+ get { return _height; }
+ set { _height = value; }
+ }
+
+ /// <include file='doc\BitmapData.uex' path='docs/doc[@for="BitmapData.Stride"]/*' />
+ /// <devdoc>
+ /// Specifies the stride width of the <see cref='System.Drawing.Bitmap'/>.
+ /// </devdoc>
+ public int Stride
+ {
+ get { return _stride; }
+ set { _stride = value; }
+ }
+
+ /// <include file='doc\BitmapData.uex' path='docs/doc[@for="BitmapData.PixelFormat"]/*' />
+ /// <devdoc>
+ /// Specifies the format of the pixel
+ /// information in this <see cref='System.Drawing.Bitmap'/>.
+ /// </devdoc>
+ public PixelFormat PixelFormat
+ {
+ get { return (PixelFormat)_pixelFormat; }
+ set
+ {
+ switch (value)
+ {
+ case PixelFormat.DontCare:
+ // case PixelFormat.Undefined: same as DontCare
+ case PixelFormat.Max:
+ case PixelFormat.Indexed:
+ case PixelFormat.Gdi:
+ case PixelFormat.Format16bppRgb555:
+ case PixelFormat.Format16bppRgb565:
+ case PixelFormat.Format24bppRgb:
+ case PixelFormat.Format32bppRgb:
+ case PixelFormat.Format1bppIndexed:
+ case PixelFormat.Format4bppIndexed:
+ case PixelFormat.Format8bppIndexed:
+ case PixelFormat.Alpha:
+ case PixelFormat.Format16bppArgb1555:
+ case PixelFormat.PAlpha:
+ case PixelFormat.Format32bppPArgb:
+ case PixelFormat.Extended:
+ case PixelFormat.Format16bppGrayScale:
+ case PixelFormat.Format48bppRgb:
+ case PixelFormat.Format64bppPArgb:
+ case PixelFormat.Canonical:
+ case PixelFormat.Format32bppArgb:
+ case PixelFormat.Format64bppArgb:
+ break;
+ default:
+ throw new System.ComponentModel.InvalidEnumArgumentException("value", unchecked((int)value), typeof(PixelFormat));
+ }
+
+
+ _pixelFormat = (int)value;
+ }
+ }
+
+ /// <include file='doc\BitmapData.uex' path='docs/doc[@for="BitmapData.Scan0"]/*' />
+ /// <devdoc>
+ /// Specifies the address of the pixel data.
+ /// </devdoc>
+ public IntPtr Scan0
+ {
+ get { return _scan0; }
+ set { _scan0 = value; }
+ }
+
+ /// <include file='doc\BitmapData.uex' path='docs/doc[@for="BitmapData.Reserved"]/*' />
+ /// <devdoc>
+ /// Reserved. Do not use.
+ /// </devdoc>
+ public int Reserved
+ {
+ // why make public??
+ //
+ get { return _reserved; }
+ set { _reserved = value; }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/Blend.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/Blend.cs
new file mode 100644
index 0000000000..f5a74f880d
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/Blend.cs
@@ -0,0 +1,79 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /// <include file='doc\Blend.uex' path='docs/doc[@for="Blend"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Defines a blend pattern for a <see cref='System.Drawing.Drawing2D.LinearGradientBrush'/>
+ /// .
+ /// </para>
+ /// </devdoc>
+ public sealed class Blend
+ {
+ private float[] _factors;
+ private float[] _positions;
+
+ /// <include file='doc\Blend.uex' path='docs/doc[@for="Blend.Blend"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.Blend'/>
+ /// class.
+ /// </para>
+ /// </devdoc>
+ public Blend()
+ {
+ _factors = new float[1];
+ _positions = new float[1];
+ }
+
+ /// <include file='doc\Blend.uex' path='docs/doc[@for="Blend.Blend1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.Blend'/>
+ /// class with the specified number of factors and positions.
+ /// </para>
+ /// </devdoc>
+ public Blend(int count)
+ {
+ _factors = new float[count];
+ _positions = new float[count];
+ }
+ /// <include file='doc\Blend.uex' path='docs/doc[@for="Blend.Factors"]/*' />
+ /// <devdoc>
+ /// Specifies an array of blend factors for the
+ /// gradient.
+ /// </devdoc>
+ public float[] Factors
+ {
+ get
+ {
+ return _factors;
+ }
+ set
+ {
+ _factors = value;
+ }
+ }
+
+ /// <include file='doc\Blend.uex' path='docs/doc[@for="Blend.Positions"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies an array of blend positions for the gradient.
+ /// </para>
+ /// </devdoc>
+ public float[] Positions
+ {
+ get
+ {
+ return _positions;
+ }
+ set
+ {
+ _positions = value;
+ }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/BrushType.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/BrushType.cs
new file mode 100644
index 0000000000..560c1ddeb6
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/BrushType.cs
@@ -0,0 +1,18 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /**
+ * BrushType Type
+ */
+ internal enum BrushType
+ {
+ SolidColor = 0,
+ HatchFill = 1,
+ TextureFill = 2,
+ PathGradient = 3,
+ LinearGradient = 4
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorAdjustType.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorAdjustType.cs
new file mode 100644
index 0000000000..0dda3f3b09
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorAdjustType.cs
@@ -0,0 +1,66 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ /**
+ * Color adjust type constants
+ */
+ /// <include file='doc\ColorAdjustType.uex' path='docs/doc[@for="ColorAdjustType"]/*' />
+ /// <devdoc>
+ /// Specifies which GDI+ objects use color
+ /// adjustment information.
+ /// </devdoc>
+ public enum ColorAdjustType
+ {
+ /// <include file='doc\ColorAdjustType.uex' path='docs/doc[@for="ColorAdjustType.Default"]/*' />
+ /// <devdoc>
+ /// Defines color adjustment information that is
+ /// used by all GDI+ objects that do not have their own color adjustment
+ /// information.
+ /// </devdoc>
+ Default = 0,
+ /// <include file='doc\ColorAdjustType.uex' path='docs/doc[@for="ColorAdjustType.Bitmap"]/*' />
+ /// <devdoc>
+ /// Defines color adjustment information for
+ /// <see cref='System.Drawing.Bitmap'/>
+ /// objects.
+ /// </devdoc>
+ Bitmap,
+ /// <include file='doc\ColorAdjustType.uex' path='docs/doc[@for="ColorAdjustType.Brush"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Defines color adjustment information for <see cref='System.Drawing.Brush'/> objects.
+ /// </para>
+ /// </devdoc>
+ Brush,
+ /// <include file='doc\ColorAdjustType.uex' path='docs/doc[@for="ColorAdjustType.Pen"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Defines color adjustment information for <see cref='System.Drawing.Pen'/> objects.
+ /// </para>
+ /// </devdoc>
+ Pen,
+ /// <include file='doc\ColorAdjustType.uex' path='docs/doc[@for="ColorAdjustType.Text"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Defines color adjustment information for text.
+ /// </para>
+ /// </devdoc>
+ Text,
+ /// <include file='doc\ColorAdjustType.uex' path='docs/doc[@for="ColorAdjustType.Count"]/*' />
+ /// <devdoc>
+ /// Specifies the number of types specified.
+ /// </devdoc>
+ Count,
+ /// <include file='doc\ColorAdjustType.uex' path='docs/doc[@for="ColorAdjustType.Any"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the number of types specified.
+ /// </para>
+ /// </devdoc>
+ Any
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorBlend.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorBlend.cs
new file mode 100644
index 0000000000..63986970d3
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorBlend.cs
@@ -0,0 +1,73 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /// <include file='doc\ColorBlend.uex' path='docs/doc[@for="ColorBlend"]/*' />
+ /// <devdoc>
+ /// Defines arrays of colors and positions used
+ /// for interpolating color blending in a gradient.
+ /// </devdoc>
+ public sealed class ColorBlend
+ {
+ private Color[] _colors;
+ private float[] _positions;
+
+ /// <include file='doc\ColorBlend.uex' path='docs/doc[@for="ColorBlend.ColorBlend"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.ColorBlend'/> class.
+ /// </devdoc>
+ public ColorBlend()
+ {
+ _colors = new Color[1];
+ _positions = new float[1];
+ }
+
+ /// <include file='doc\ColorBlend.uex' path='docs/doc[@for="ColorBlend.ColorBlend1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.ColorBlend'/> class with the specified number of
+ /// colors and positions.
+ /// </para>
+ /// </devdoc>
+ public ColorBlend(int count)
+ {
+ _colors = new Color[count];
+ _positions = new float[count];
+ }
+
+ /// <include file='doc\ColorBlend.uex' path='docs/doc[@for="ColorBlend.Colors"]/*' />
+ /// <devdoc>
+ /// Represents an array of colors.
+ /// </devdoc>
+ public Color[] Colors
+ {
+ get
+ {
+ return _colors;
+ }
+ set
+ {
+ _colors = value;
+ }
+ }
+
+ /// <include file='doc\ColorBlend.uex' path='docs/doc[@for="ColorBlend.Positions"]/*' />
+ /// <devdoc>
+ /// Represents the positions along a gradient
+ /// line.
+ /// </devdoc>
+ public float[] Positions
+ {
+ get
+ {
+ return _positions;
+ }
+ set
+ {
+ _positions = value;
+ }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorChannelFlags.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorChannelFlags.cs
new file mode 100644
index 0000000000..a1c0295c12
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorChannelFlags.cs
@@ -0,0 +1,45 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ /**
+ * Color channel flag constants
+ */
+ /// <include file='doc\ColorChannelFlags.uex' path='docs/doc[@for="ColorChannelFlag"]/*' />
+ /// <devdoc>
+ /// Specifies a range of CMYK channels.
+ /// </devdoc>
+ public enum ColorChannelFlag
+ {
+ /// <include file='doc\ColorChannelFlags.uex' path='docs/doc[@for="ColorChannelFlag.ColorChannelC"]/*' />
+ /// <devdoc>
+ /// Specifies the Cyan color channel.
+ /// </devdoc>
+ ColorChannelC = 0,
+ /// <include file='doc\ColorChannelFlags.uex' path='docs/doc[@for="ColorChannelFlag.ColorChannelM"]/*' />
+ /// <devdoc>
+ /// Specifies the Magenta color channel.
+ /// </devdoc>
+ ColorChannelM,
+ /// <include file='doc\ColorChannelFlags.uex' path='docs/doc[@for="ColorChannelFlag.ColorChannelY"]/*' />
+ /// <devdoc>
+ /// Specifies the Yellow color channel.
+ /// </devdoc>
+ ColorChannelY,
+ /// <include file='doc\ColorChannelFlags.uex' path='docs/doc[@for="ColorChannelFlag.ColorChannelK"]/*' />
+ /// <devdoc>
+ /// Specifies the Black color channel.
+ /// </devdoc>
+ ColorChannelK,
+ /// <include file='doc\ColorChannelFlags.uex' path='docs/doc[@for="ColorChannelFlag.ColorChannelLast"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// This element specifies to leave the color
+ /// channel unchanged from the last selected channel.
+ /// </para>
+ /// </devdoc>
+ ColorChannelLast
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorMap.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorMap.cs
new file mode 100644
index 0000000000..7fda5bd0c1
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorMap.cs
@@ -0,0 +1,52 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ /// <include file='doc\ColorMap.uex' path='docs/doc[@for="ColorMap"]/*' />
+ /// <devdoc>
+ /// Defines a map for converting colors.
+ /// </devdoc>
+ public sealed class ColorMap
+ {
+ private Color _oldColor;
+ private Color _newColor;
+
+ /// <include file='doc\ColorMap.uex' path='docs/doc[@for="ColorMap.ColorMap"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.ColorMap'/> class.
+ /// </para>
+ /// </devdoc>
+ public ColorMap()
+ {
+ _oldColor = new Color();
+ _newColor = new Color();
+ }
+
+ /// <include file='doc\ColorMap.uex' path='docs/doc[@for="ColorMap.OldColor"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the existing <see cref='System.Drawing.Color'/> to be
+ /// converted.
+ /// </para>
+ /// </devdoc>
+ public Color OldColor
+ {
+ get { return _oldColor; }
+ set { _oldColor = value; }
+ }
+ /// <include file='doc\ColorMap.uex' path='docs/doc[@for="ColorMap.NewColor"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifes the new <see cref='System.Drawing.Color'/> to which to convert.
+ /// </para>
+ /// </devdoc>
+ public Color NewColor
+ {
+ get { return _newColor; }
+ set { _newColor = value; }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorMapType.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorMapType.cs
new file mode 100644
index 0000000000..c523120266
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorMapType.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ /**
+ * Color Map type constants
+ */
+ /// <include file='doc\ColorMapType.uex' path='docs/doc[@for="ColorMapType"]/*' />
+ /// <devdoc>
+ /// Specifies the types of color maps.
+ /// </devdoc>
+ public enum ColorMapType
+ {
+ /// <include file='doc\ColorMapType.uex' path='docs/doc[@for="ColorMapType.Default"]/*' />
+ /// <devdoc>
+ /// A default color map.
+ /// </devdoc>
+ Default = 0,
+ /// <include file='doc\ColorMapType.uex' path='docs/doc[@for="ColorMapType.Brush"]/*' />
+ /// <devdoc>
+ /// Specifies a color map for a <see cref='System.Drawing.Brush'/>.
+ /// </devdoc>
+ Brush
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorMatrix.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorMatrix.cs
new file mode 100644
index 0000000000..aed76b0487
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorMatrix.cs
@@ -0,0 +1,481 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ using System.Runtime.InteropServices;
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix"]/*' />
+ /// <devdoc>
+ /// Defines a 5 x 5 matrix that that
+ /// contains the homogenous coordinates for the RGBA space.
+ /// </devdoc>
+ [StructLayout(LayoutKind.Sequential)]
+ public sealed class ColorMatrix
+ {
+ private float _matrix00;
+ private float _matrix01;
+ private float _matrix02;
+ private float _matrix03;
+ private float _matrix04;
+ private float _matrix10;
+ private float _matrix11;
+ private float _matrix12;
+ private float _matrix13;
+ private float _matrix14;
+ private float _matrix20;
+ private float _matrix21;
+ private float _matrix22;
+ private float _matrix23;
+ private float _matrix24;
+ private float _matrix30;
+ private float _matrix31;
+ private float _matrix32;
+ private float _matrix33;
+ private float _matrix34;
+ private float _matrix40;
+ private float _matrix41;
+ private float _matrix42;
+ private float _matrix43;
+ private float _matrix44;
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.ColorMatrix"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.ColorMatrix'/> class.
+ /// </para>
+ /// </devdoc>
+ public ColorMatrix()
+ {
+ /*
+ * Setup identity matrix by default
+ */
+
+ _matrix00 = 1.0f;
+ //matrix01 = 0.0f;
+ //matrix02 = 0.0f;
+ //matrix03 = 0.0f;
+ //matrix04 = 0.0f;
+ //matrix10 = 0.0f;
+ _matrix11 = 1.0f;
+ //matrix12 = 0.0f;
+ //matrix13 = 0.0f;
+ //matrix14 = 0.0f;
+ //matrix20 = 0.0f;
+ //matrix21 = 0.0f;
+ _matrix22 = 1.0f;
+ // matrix23 = 0.0f;
+ // matrix24 = 0.0f;
+ // matrix30 = 0.0f;
+ //matrix31 = 0.0f;
+ // matrix32 = 0.0f;
+ _matrix33 = 1.0f;
+ // matrix34 = 0.0f;
+ // matrix40 = 0.0f;
+ // matrix41 = 0.0f;
+ // matrix42 = 0.0f;
+ // matrix43 = 0.0f;
+ _matrix44 = 1.0f;
+ }
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.Matrix00"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Represents the element at the
+ /// 0th row and 0th column of this <see cref='System.Drawing.Imaging.ColorMatrix'/>.
+ /// </para>
+ /// </devdoc>
+ public float Matrix00
+ {
+ get { return _matrix00; }
+ set { _matrix00 = value; }
+ }
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.Matrix01"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Represents the element at the 0th row and 1st column of this <see cref='System.Drawing.Imaging.ColorMatrix'/>.
+ /// </para>
+ /// </devdoc>
+ public float Matrix01
+ {
+ get { return _matrix01; }
+ set { _matrix01 = value; }
+ }
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.Matrix02"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Represents the element at the 0th row and 2nd column of this <see cref='System.Drawing.Imaging.ColorMatrix'/>.
+ /// </para>
+ /// </devdoc>
+ public float Matrix02
+ {
+ get { return _matrix02; }
+ set { _matrix02 = value; }
+ }
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.Matrix03"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Represents the element at the 0th row and 3rd column of this <see cref='System.Drawing.Imaging.ColorMatrix'/>.
+ /// </para>
+ /// </devdoc>
+ public float Matrix03
+ {
+ get { return _matrix03; }
+ set { _matrix03 = value; }
+ }
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.Matrix04"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Represents the element at the 0th row and 4th column of this <see cref='System.Drawing.Imaging.ColorMatrix'/>.
+ /// </para>
+ /// </devdoc>
+ public float Matrix04
+ {
+ get { return _matrix04; }
+ set { _matrix04 = value; }
+ }
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.Matrix10"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Represents the element at the 1st row and 0th column of this <see cref='System.Drawing.Imaging.ColorMatrix'/>.
+ /// </para>
+ /// </devdoc>
+ public float Matrix10
+ {
+ get { return _matrix10; }
+ set { _matrix10 = value; }
+ }
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.Matrix11"]/*' />
+ /// <devdoc>
+ /// Represents the element at the 1st row and
+ /// 1st column of this <see cref='System.Drawing.Imaging.ColorMatrix'/>.
+ /// </devdoc>
+ public float Matrix11
+ {
+ get { return _matrix11; }
+ set { _matrix11 = value; }
+ }
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.Matrix12"]/*' />
+ /// <devdoc>
+ /// Represents the element at the 1st row
+ /// and 2nd column of this <see cref='System.Drawing.Imaging.ColorMatrix'/>.
+ /// </devdoc>
+ public float Matrix12
+ {
+ get { return _matrix12; }
+ set { _matrix12 = value; }
+ }
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.Matrix13"]/*' />
+ /// <devdoc>
+ /// Represents the element at the 1st row
+ /// and 3rd column of this <see cref='System.Drawing.Imaging.ColorMatrix'/>.
+ /// </devdoc>
+ public float Matrix13
+ {
+ get { return _matrix13; }
+ set { _matrix13 = value; }
+ }
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.Matrix14"]/*' />
+ /// <devdoc>
+ /// Represents the element at the 1st row
+ /// and 4th column of this <see cref='System.Drawing.Imaging.ColorMatrix'/>.
+ /// </devdoc>
+ public float Matrix14
+ {
+ get { return _matrix14; }
+ set { _matrix14 = value; }
+ }
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.Matrix20"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Represents the element at the 2nd row and
+ /// 0th column of this <see cref='System.Drawing.Imaging.ColorMatrix'/>.
+ /// </para>
+ /// </devdoc>
+ public float Matrix20
+ {
+ get { return _matrix20; }
+ set { _matrix20 = value; }
+ }
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.Matrix21"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Represents the element at the 2nd row and 1st column of this <see cref='System.Drawing.Imaging.ColorMatrix'/>.
+ /// </para>
+ /// </devdoc>
+ public float Matrix21
+ {
+ get { return _matrix21; }
+ set { _matrix21 = value; }
+ }
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.Matrix22"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Represents the element at the 2nd row and 2nd column of this <see cref='System.Drawing.Imaging.ColorMatrix'/>.
+ /// </para>
+ /// </devdoc>
+ public float Matrix22
+ {
+ get { return _matrix22; }
+ set { _matrix22 = value; }
+ }
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.Matrix23"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Represents the element at the 2nd row and 3rd column of this <see cref='System.Drawing.Imaging.ColorMatrix'/>.
+ /// </para>
+ /// </devdoc>
+ public float Matrix23
+ {
+ get { return _matrix23; }
+ set { _matrix23 = value; }
+ }
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.Matrix24"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Represents the element at the 2nd row and 4th column of this <see cref='System.Drawing.Imaging.ColorMatrix'/>.
+ /// </para>
+ /// </devdoc>
+ public float Matrix24
+ {
+ get { return _matrix24; }
+ set { _matrix24 = value; }
+ }
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.Matrix30"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Represents the element at the 3rd row and 0th column of this <see cref='System.Drawing.Imaging.ColorMatrix'/>.
+ /// </para>
+ /// </devdoc>
+ public float Matrix30
+ {
+ get { return _matrix30; }
+ set { _matrix30 = value; }
+ }
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.Matrix31"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Represents the element at the 3rd row and 1st column of this <see cref='System.Drawing.Imaging.ColorMatrix'/>.
+ /// </para>
+ /// </devdoc>
+ public float Matrix31
+ {
+ get { return _matrix31; }
+ set { _matrix31 = value; }
+ }
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.Matrix32"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Represents the element at the 3rd row and 2nd column of this <see cref='System.Drawing.Imaging.ColorMatrix'/>.
+ /// </para>
+ /// </devdoc>
+ public float Matrix32
+ {
+ get { return _matrix32; }
+ set { _matrix32 = value; }
+ }
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.Matrix33"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Represents the element at the 3rd row and 3rd column of this <see cref='System.Drawing.Imaging.ColorMatrix'/>.
+ /// </para>
+ /// </devdoc>
+ public float Matrix33
+ {
+ get { return _matrix33; }
+ set { _matrix33 = value; }
+ }
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.Matrix34"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Represents the element at the 3rd row and 4th column of this <see cref='System.Drawing.Imaging.ColorMatrix'/>.
+ /// </para>
+ /// </devdoc>
+ public float Matrix34
+ {
+ get { return _matrix34; }
+ set { _matrix34 = value; }
+ }
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.Matrix40"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Represents the element at the 4th row and 0th column of this <see cref='System.Drawing.Imaging.ColorMatrix'/>.
+ /// </para>
+ /// </devdoc>
+ public float Matrix40
+ {
+ get { return _matrix40; }
+ set { _matrix40 = value; }
+ }
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.Matrix41"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Represents the element at the 4th row and 1st column of this <see cref='System.Drawing.Imaging.ColorMatrix'/>.
+ /// </para>
+ /// </devdoc>
+ public float Matrix41
+ {
+ get { return _matrix41; }
+ set { _matrix41 = value; }
+ }
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.Matrix42"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Represents the element at the 4th row and 2nd column of this <see cref='System.Drawing.Imaging.ColorMatrix'/>.
+ /// </para>
+ /// </devdoc>
+ public float Matrix42
+ {
+ get { return _matrix42; }
+ set { _matrix42 = value; }
+ }
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.Matrix43"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Represents the element at the 4th row and 3rd column of this <see cref='System.Drawing.Imaging.ColorMatrix'/>.
+ /// </para>
+ /// </devdoc>
+ public float Matrix43
+ {
+ get { return _matrix43; }
+ set { _matrix43 = value; }
+ }
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.Matrix44"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Represents the element at the 4th row and 4th column of this <see cref='System.Drawing.Imaging.ColorMatrix'/>.
+ /// </para>
+ /// </devdoc>
+ public float Matrix44
+ {
+ get { return _matrix44; }
+ set { _matrix44 = value; }
+ }
+
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.ColorMatrix1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.ColorMatrix'/> class with the
+ /// elements in the specified matrix.
+ /// </para>
+ /// </devdoc>
+ [CLSCompliant(false)]
+ public ColorMatrix(float[][] newColorMatrix)
+ {
+ SetMatrix(newColorMatrix);
+ }
+
+ internal void SetMatrix(float[][] newColorMatrix)
+ {
+ _matrix00 = newColorMatrix[0][0];
+ _matrix01 = newColorMatrix[0][1];
+ _matrix02 = newColorMatrix[0][2];
+ _matrix03 = newColorMatrix[0][3];
+ _matrix04 = newColorMatrix[0][4];
+ _matrix10 = newColorMatrix[1][0];
+ _matrix11 = newColorMatrix[1][1];
+ _matrix12 = newColorMatrix[1][2];
+ _matrix13 = newColorMatrix[1][3];
+ _matrix14 = newColorMatrix[1][4];
+ _matrix20 = newColorMatrix[2][0];
+ _matrix21 = newColorMatrix[2][1];
+ _matrix22 = newColorMatrix[2][2];
+ _matrix23 = newColorMatrix[2][3];
+ _matrix24 = newColorMatrix[2][4];
+ _matrix30 = newColorMatrix[3][0];
+ _matrix31 = newColorMatrix[3][1];
+ _matrix32 = newColorMatrix[3][2];
+ _matrix33 = newColorMatrix[3][3];
+ _matrix34 = newColorMatrix[3][4];
+ _matrix40 = newColorMatrix[4][0];
+ _matrix41 = newColorMatrix[4][1];
+ _matrix42 = newColorMatrix[4][2];
+ _matrix43 = newColorMatrix[4][3];
+ _matrix44 = newColorMatrix[4][4];
+ }
+
+ internal float[][] GetMatrix()
+ {
+ float[][] returnMatrix = new float[5][];
+
+ for (int i = 0; i < 5; i++)
+ returnMatrix[i] = new float[5];
+
+ returnMatrix[0][0] = _matrix00;
+ returnMatrix[0][1] = _matrix01;
+ returnMatrix[0][2] = _matrix02;
+ returnMatrix[0][3] = _matrix03;
+ returnMatrix[0][4] = _matrix04;
+ returnMatrix[1][0] = _matrix10;
+ returnMatrix[1][1] = _matrix11;
+ returnMatrix[1][2] = _matrix12;
+ returnMatrix[1][3] = _matrix13;
+ returnMatrix[1][4] = _matrix14;
+ returnMatrix[2][0] = _matrix20;
+ returnMatrix[2][1] = _matrix21;
+ returnMatrix[2][2] = _matrix22;
+ returnMatrix[2][3] = _matrix23;
+ returnMatrix[2][4] = _matrix24;
+ returnMatrix[3][0] = _matrix30;
+ returnMatrix[3][1] = _matrix31;
+ returnMatrix[3][2] = _matrix32;
+ returnMatrix[3][3] = _matrix33;
+ returnMatrix[3][4] = _matrix34;
+ returnMatrix[4][0] = _matrix40;
+ returnMatrix[4][1] = _matrix41;
+ returnMatrix[4][2] = _matrix42;
+ returnMatrix[4][3] = _matrix43;
+ returnMatrix[4][4] = _matrix44;
+
+ return returnMatrix;
+ }
+
+ /// <include file='doc\ColorMatrix.uex' path='docs/doc[@for="ColorMatrix.this"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets the value of the specified element of this <see cref='System.Drawing.Imaging.ColorMatrix'/>.
+ /// </para>
+ /// </devdoc>
+ public float this[int row, int column]
+ {
+ get
+ {
+ return GetMatrix()[row][column];
+ }
+
+ set
+ {
+ float[][] tempMatrix = GetMatrix();
+
+ tempMatrix[row][column] = value;
+
+ SetMatrix(tempMatrix);
+ }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorMatrixFlags.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorMatrixFlags.cs
new file mode 100644
index 0000000000..1f3e732bf6
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorMatrixFlags.cs
@@ -0,0 +1,36 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ /**
+ * Color matrix flag constants
+ */
+ /// <include file='doc\ColorMatrixFlags.uex' path='docs/doc[@for="ColorMatrixFlag"]/*' />
+ /// <devdoc>
+ /// Specifies available options for
+ /// color-adjusting. GDI+ can adjust color data only, grayscale data only,
+ /// or both.
+ /// </devdoc>
+ public enum ColorMatrixFlag
+ {
+ /// <include file='doc\ColorMatrixFlags.uex' path='docs/doc[@for="ColorMatrixFlag.Default"]/*' />
+ /// <devdoc>
+ /// Both colors and grayscale are
+ /// color-adjusted.
+ /// </devdoc>
+ Default = 0,
+ /// <include file='doc\ColorMatrixFlags.uex' path='docs/doc[@for="ColorMatrixFlag.SkipGrays"]/*' />
+ /// <devdoc>
+ /// Grascale values are not color-adjusted.
+ /// </devdoc>
+ SkipGrays = 1,
+ /// <include file='doc\ColorMatrixFlags.uex' path='docs/doc[@for="ColorMatrixFlag.AltGrays"]/*' />
+ /// <devdoc>
+ /// Only grascale values are color-adjusted.
+ /// </devdoc>
+ AltGrays = 2
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorMode.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorMode.cs
new file mode 100644
index 0000000000..63df6b7125
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorMode.cs
@@ -0,0 +1,34 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ /**
+ * Color mode constants
+ */
+ /// <include file='doc\ColorMode.uex' path='docs/doc[@for="ColorMode"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies two modes for color component
+ /// values.
+ /// </para>
+ /// </devdoc>
+ public enum ColorMode
+ {
+ /// <include file='doc\ColorMode.uex' path='docs/doc[@for="ColorMode.Argb32Mode"]/*' />
+ /// <devdoc>
+ /// Specifies that integer values supplied are
+ /// 32-bit values.
+ /// </devdoc>
+ Argb32Mode = 0,
+ /// <include file='doc\ColorMode.uex' path='docs/doc[@for="ColorMode.Argb64Mode"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies that integer values supplied are
+ /// 64-bit values.
+ /// </para>
+ /// </devdoc>
+ Argb64Mode = 1
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorPalette.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorPalette.cs
new file mode 100644
index 0000000000..eac8755460
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorPalette.cs
@@ -0,0 +1,108 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ using System.Runtime.InteropServices;
+
+ /// <include file='doc\ColorPalette.uex' path='docs/doc[@for="ColorPalette"]/*' />
+ /// <devdoc>
+ /// Defines an array of colors that make up a
+ /// color palette.
+ /// </devdoc>
+ public sealed class ColorPalette
+ {
+ /// Note (From VSWhidbey#444618): We don't provide a public constructor for ColorPalette because if we allow
+ /// arbitrary creation of color palettes you could in theroy not only change the color entries, but the size
+ /// of the palette and that is not valid for an image (meaning you cannot change the palette size for an image).
+ /// ColorPalettes are only valid for "indexed" images like GIFs.
+
+ private int _flags;
+ private Color[] _entries;
+
+ /// <include file='doc\ColorPalette.uex' path='docs/doc[@for="ColorPalette.Flags"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies how to interpret the color
+ /// information in the array of colors.
+ /// </para>
+ /// </devdoc>
+ public int Flags
+ {
+ get
+ {
+ return _flags;
+ }
+ }
+
+ /// <include file='doc\ColorPalette.uex' path='docs/doc[@for="ColorPalette.Entries"]/*' />
+ /// <devdoc>
+ /// Specifies an array of <see cref='System.Drawing.Color'/> objects.
+ /// </devdoc>
+ public Color[] Entries
+ {
+ get
+ {
+ return _entries;
+ }
+ }
+
+ internal ColorPalette(int count)
+ {
+ _entries = new Color[count];
+ }
+
+ internal ColorPalette()
+ {
+ _entries = new Color[1];
+ }
+
+ internal void ConvertFromMemory(IntPtr memory)
+ {
+ // Memory layout is:
+ // UINT Flags
+ // UINT Count
+ // ARGB Entries[size]
+
+ _flags = Marshal.ReadInt32(memory);
+
+ int size;
+
+ size = Marshal.ReadInt32((IntPtr)((long)memory + 4)); // Marshal.SizeOf(size.GetType())
+
+ _entries = new Color[size];
+
+ for (int i = 0; i < size; i++)
+ {
+ // use Marshal.SizeOf()
+ int argb = Marshal.ReadInt32((IntPtr)((long)memory + 8 + i * 4));
+ _entries[i] = Color.FromArgb(argb);
+ }
+ }
+
+ internal IntPtr ConvertToMemory()
+ {
+ // Memory layout is:
+ // UINT Flags
+ // UINT Count
+ // ARGB Entries[size]
+
+ // use Marshal.SizeOf()
+ int length = _entries.Length;
+ IntPtr memory = Marshal.AllocHGlobal(checked(4 * (2 + length)));
+
+ Marshal.WriteInt32(memory, 0, _flags);
+ // use Marshal.SizeOf()
+ Marshal.WriteInt32((IntPtr)checked((long)memory + 4), 0, length);
+
+ for (int i = 0; i < length; i++)
+ {
+ // use Marshal.SizeOf()
+ Marshal.WriteInt32((IntPtr)((long)memory + 4 * (i + 2)), 0, _entries[i].ToArgb());
+ }
+
+ return memory;
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorTranslator.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorTranslator.cs
new file mode 100644
index 0000000000..43ca9e400f
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/ColorTranslator.cs
@@ -0,0 +1,393 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.Collections;
+ using System.Globalization;
+
+ /// <include file='doc\ColorTranslator.uex' path='docs/doc[@for="ColorTranslator"]/*' />
+ /// <devdoc>
+ /// Translates colors to and from GDI+ <see cref='System.Drawing.Color'/> objects.
+ /// </devdoc>
+ public sealed class ColorTranslator
+ {
+ private const int Win32RedShift = 0;
+ private const int Win32GreenShift = 8;
+ private const int Win32BlueShift = 16;
+
+ private static Hashtable s_htmlSysColorTable;
+
+ // not creatable...
+ //
+ private ColorTranslator()
+ {
+ }
+
+ /// <include file='doc\ColorTranslator.uex' path='docs/doc[@for="ColorTranslator.ToWin32"]/*' />
+ /// <devdoc>
+ /// Translates the specified <see cref='System.Drawing.Color'/> to a
+ /// Win32 color.
+ /// </devdoc>
+ public static int ToWin32(Color c)
+ {
+ return c.R << Win32RedShift | c.G << Win32GreenShift | c.B << Win32BlueShift;
+ }
+
+ /// <include file='doc\ColorTranslator.uex' path='docs/doc[@for="ColorTranslator.ToOle"]/*' />
+ /// <devdoc>
+ /// Translates the specified <see cref='System.Drawing.Color'/> to
+ /// an Ole color.
+ /// </devdoc>
+ public static int ToOle(Color c)
+ {
+ // WARNING!!! WARNING!!! WARNING!!! WARNING!!!
+ // WARNING!!! WARNING!!! WARNING!!! WARNING!!!
+ // We must never have another method called ToOle() with a different signature.
+ // This is so that we can push into the runtime a custom marshaller for OLE_COLOR to Color.
+
+ if (c.IsKnownColor)
+ {
+ switch (c.ToKnownColor())
+ {
+ case KnownColor.ActiveBorder:
+ return unchecked((int)0x8000000A);
+ case KnownColor.ActiveCaption:
+ return unchecked((int)0x80000002);
+ case KnownColor.ActiveCaptionText:
+ return unchecked((int)0x80000009);
+ case KnownColor.AppWorkspace:
+ return unchecked((int)0x8000000C);
+ case KnownColor.ButtonFace:
+ return unchecked((int)0x8000000F);
+ case KnownColor.ButtonHighlight:
+ return unchecked((int)0x80000014);
+ case KnownColor.ButtonShadow:
+ return unchecked((int)0x80000010);
+ case KnownColor.Control:
+ return unchecked((int)0x8000000F);
+ case KnownColor.ControlDark:
+ return unchecked((int)0x80000010);
+ case KnownColor.ControlDarkDark:
+ return unchecked((int)0x80000015);
+ case KnownColor.ControlLight:
+ return unchecked((int)0x80000016);
+ case KnownColor.ControlLightLight:
+ return unchecked((int)0x80000014);
+ case KnownColor.ControlText:
+ return unchecked((int)0x80000012);
+ case KnownColor.Desktop:
+ return unchecked((int)0x80000001);
+ case KnownColor.GradientActiveCaption:
+ return unchecked((int)0x8000001B);
+ case KnownColor.GradientInactiveCaption:
+ return unchecked((int)0x8000001C);
+ case KnownColor.GrayText:
+ return unchecked((int)0x80000011);
+ case KnownColor.Highlight:
+ return unchecked((int)0x8000000D);
+ case KnownColor.HighlightText:
+ return unchecked((int)0x8000000E);
+ case KnownColor.HotTrack:
+ return unchecked((int)0x8000001A);
+ case KnownColor.InactiveBorder:
+ return unchecked((int)0x8000000B);
+ case KnownColor.InactiveCaption:
+ return unchecked((int)0x80000003);
+ case KnownColor.InactiveCaptionText:
+ return unchecked((int)0x80000013);
+ case KnownColor.Info:
+ return unchecked((int)0x80000018);
+ case KnownColor.InfoText:
+ return unchecked((int)0x80000017);
+ case KnownColor.Menu:
+ return unchecked((int)0x80000004);
+ case KnownColor.MenuBar:
+ return unchecked((int)0x8000001E);
+ case KnownColor.MenuHighlight:
+ return unchecked((int)0x8000001D);
+ case KnownColor.MenuText:
+ return unchecked((int)0x80000007);
+ case KnownColor.ScrollBar:
+ return unchecked((int)0x80000000);
+ case KnownColor.Window:
+ return unchecked((int)0x80000005);
+ case KnownColor.WindowFrame:
+ return unchecked((int)0x80000006);
+ case KnownColor.WindowText:
+ return unchecked((int)0x80000008);
+ }
+ }
+
+ return ToWin32(c);
+ }
+ /// <include file='doc\ColorTranslator.uex' path='docs/doc[@for="ColorTranslator.FromOle"]/*' />
+ /// <devdoc>
+ /// Translates an Ole color value to a GDI+
+ /// <see cref='System.Drawing.Color'/>.
+ /// </devdoc>
+ public static Color FromOle(int oleColor)
+ {
+ // WARNING!!! WARNING!!! WARNING!!! WARNING!!!
+ // WARNING!!! WARNING!!! WARNING!!! WARNING!!!
+ // We must never have another method called ToOle() with a different signature.
+ // This is so that we can push into the runtime a custom marshaller for OLE_COLOR to Color.
+
+ // if system color
+ // (the if < 0x18 check test whether it's a well-formed system color)
+ if (unchecked((int)(oleColor & 0xFF000000)) == unchecked((int)0x80000000)
+ && (oleColor & 0xFFFFFF) <= 0x1E)
+ {
+ switch (oleColor)
+ {
+ case unchecked((int)0x8000000A):
+ return Color.FromKnownColor(KnownColor.ActiveBorder);
+ case unchecked((int)0x80000002):
+ return Color.FromKnownColor(KnownColor.ActiveCaption);
+ case unchecked((int)0x80000009):
+ return Color.FromKnownColor(KnownColor.ActiveCaptionText);
+ case unchecked((int)0x8000000C):
+ return Color.FromKnownColor(KnownColor.AppWorkspace);
+ case unchecked((int)0x8000000F):
+ return Color.FromKnownColor(KnownColor.Control);
+ case unchecked((int)0x80000010):
+ return Color.FromKnownColor(KnownColor.ControlDark);
+ case unchecked((int)0x80000015):
+ return Color.FromKnownColor(KnownColor.ControlDarkDark);
+ case unchecked((int)0x80000016):
+ return Color.FromKnownColor(KnownColor.ControlLight);
+ case unchecked((int)0x80000014):
+ return Color.FromKnownColor(KnownColor.ControlLightLight);
+ case unchecked((int)0x80000012):
+ return Color.FromKnownColor(KnownColor.ControlText);
+ case unchecked((int)0x80000001):
+ return Color.FromKnownColor(KnownColor.Desktop);
+ case unchecked((int)0x8000001B):
+ return Color.FromKnownColor(KnownColor.GradientActiveCaption);
+ case unchecked((int)0x8000001C):
+ return Color.FromKnownColor(KnownColor.GradientInactiveCaption);
+ case unchecked((int)0x80000011):
+ return Color.FromKnownColor(KnownColor.GrayText);
+ case unchecked((int)0x8000000D):
+ return Color.FromKnownColor(KnownColor.Highlight);
+ case unchecked((int)0x8000000E):
+ return Color.FromKnownColor(KnownColor.HighlightText);
+ case unchecked((int)0x8000001A):
+ return Color.FromKnownColor(KnownColor.HotTrack);
+ case unchecked((int)0x8000000B):
+ return Color.FromKnownColor(KnownColor.InactiveBorder);
+ case unchecked((int)0x80000003):
+ return Color.FromKnownColor(KnownColor.InactiveCaption);
+ case unchecked((int)0x80000013):
+ return Color.FromKnownColor(KnownColor.InactiveCaptionText);
+ case unchecked((int)0x80000018):
+ return Color.FromKnownColor(KnownColor.Info);
+ case unchecked((int)0x80000017):
+ return Color.FromKnownColor(KnownColor.InfoText);
+ case unchecked((int)0x80000004):
+ return Color.FromKnownColor(KnownColor.Menu);
+ case unchecked((int)0x8000001E):
+ return Color.FromKnownColor(KnownColor.MenuBar);
+ case unchecked((int)0x8000001D):
+ return Color.FromKnownColor(KnownColor.MenuHighlight);
+ case unchecked((int)0x80000007):
+ return Color.FromKnownColor(KnownColor.MenuText);
+ case unchecked((int)0x80000000):
+ return Color.FromKnownColor(KnownColor.ScrollBar);
+ case unchecked((int)0x80000005):
+ return Color.FromKnownColor(KnownColor.Window);
+ case unchecked((int)0x80000006):
+ return Color.FromKnownColor(KnownColor.WindowFrame);
+ case unchecked((int)0x80000008):
+ return Color.FromKnownColor(KnownColor.WindowText);
+ }
+ }
+
+ Color color = Color.FromArgb((byte)((oleColor >> Win32RedShift) & 0xFF),
+ (byte)((oleColor >> Win32GreenShift) & 0xFF),
+ (byte)((oleColor >> Win32BlueShift) & 0xFF));
+
+ return KnownColorTable.ArgbToKnownColor(color.ToArgb());
+ }
+
+ /// <include file='doc\ColorTranslator.uex' path='docs/doc[@for="ColorTranslator.FromWin32"]/*' />
+ /// <devdoc>
+ /// Translates an Win32 color value to a
+ /// GDI+ <see cref='System.Drawing.Color'/>.
+ /// </devdoc>
+ public static Color FromWin32(int win32Color)
+ {
+ return FromOle(win32Color);
+ }
+
+ /// <include file='doc\ColorTranslator.uex' path='docs/doc[@for="ColorTranslator.FromHtml"]/*' />
+ /// <devdoc>
+ /// Translates an Html color representation to
+ /// a GDI+ <see cref='System.Drawing.Color'/>.
+ /// </devdoc>
+ public static Color FromHtml(string htmlColor)
+ {
+ Color c = Color.Empty;
+
+ // empty color
+ if ((htmlColor == null) || (htmlColor.Length == 0))
+ return c;
+
+ // #RRGGBB or #RGB
+ if ((htmlColor[0] == '#') &&
+ ((htmlColor.Length == 7) || (htmlColor.Length == 4)))
+ {
+ if (htmlColor.Length == 7)
+ {
+ c = Color.FromArgb(Convert.ToInt32(htmlColor.Substring(1, 2), 16),
+ Convert.ToInt32(htmlColor.Substring(3, 2), 16),
+ Convert.ToInt32(htmlColor.Substring(5, 2), 16));
+ }
+ else
+ {
+ string r = Char.ToString(htmlColor[1]);
+ string g = Char.ToString(htmlColor[2]);
+ string b = Char.ToString(htmlColor[3]);
+
+ c = Color.FromArgb(Convert.ToInt32(r + r, 16),
+ Convert.ToInt32(g + g, 16),
+ Convert.ToInt32(b + b, 16));
+ }
+ }
+
+ // special case. Html requires LightGrey, but .NET uses LightGray
+ if (c.IsEmpty && String.Equals(htmlColor, "LightGrey", StringComparison.OrdinalIgnoreCase))
+ {
+ c = Color.LightGray;
+ }
+
+ // System color
+ if (c.IsEmpty)
+ {
+ if (s_htmlSysColorTable == null)
+ {
+ InitializeHtmlSysColorTable();
+ }
+
+ object o = s_htmlSysColorTable[htmlColor.ToLower(CultureInfo.InvariantCulture)];
+ if (o != null)
+ {
+ c = (Color)o;
+ }
+ }
+
+ // resort to type converter which will handle named colors
+ if (c.IsEmpty)
+ {
+ c = ColorConverterCommon.ConvertFromString(htmlColor, CultureInfo.CurrentCulture);
+ }
+
+ return c;
+ }
+
+ /// <include file='doc\ColorTranslator.uex' path='docs/doc[@for="ColorTranslator.ToHtml"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Translates the specified <see cref='System.Drawing.Color'/> to an Html string color representation.
+ /// </para>
+ /// </devdoc>
+ public static string ToHtml(Color c)
+ {
+ string colorString = String.Empty;
+
+ if (c.IsEmpty)
+ return colorString;
+
+ if (c.IsSystemColor)
+ {
+ switch (c.ToKnownColor())
+ {
+ case KnownColor.ActiveBorder: colorString = "activeborder"; break;
+ case KnownColor.GradientActiveCaption:
+ case KnownColor.ActiveCaption: colorString = "activecaption"; break;
+ case KnownColor.AppWorkspace: colorString = "appworkspace"; break;
+ case KnownColor.Desktop: colorString = "background"; break;
+ case KnownColor.Control: colorString = "buttonface"; break;
+ case KnownColor.ControlLight: colorString = "buttonface"; break;
+ case KnownColor.ControlDark: colorString = "buttonshadow"; break;
+ case KnownColor.ControlText: colorString = "buttontext"; break;
+ case KnownColor.ActiveCaptionText: colorString = "captiontext"; break;
+ case KnownColor.GrayText: colorString = "graytext"; break;
+ case KnownColor.HotTrack:
+ case KnownColor.Highlight: colorString = "highlight"; break;
+ case KnownColor.MenuHighlight:
+ case KnownColor.HighlightText: colorString = "highlighttext"; break;
+ case KnownColor.InactiveBorder: colorString = "inactiveborder"; break;
+ case KnownColor.GradientInactiveCaption:
+ case KnownColor.InactiveCaption: colorString = "inactivecaption"; break;
+ case KnownColor.InactiveCaptionText: colorString = "inactivecaptiontext"; break;
+ case KnownColor.Info: colorString = "infobackground"; break;
+ case KnownColor.InfoText: colorString = "infotext"; break;
+ case KnownColor.MenuBar:
+ case KnownColor.Menu: colorString = "menu"; break;
+ case KnownColor.MenuText: colorString = "menutext"; break;
+ case KnownColor.ScrollBar: colorString = "scrollbar"; break;
+ case KnownColor.ControlDarkDark: colorString = "threeddarkshadow"; break;
+ case KnownColor.ControlLightLight: colorString = "buttonhighlight"; break;
+ case KnownColor.Window: colorString = "window"; break;
+ case KnownColor.WindowFrame: colorString = "windowframe"; break;
+ case KnownColor.WindowText: colorString = "windowtext"; break;
+ }
+ }
+ else if (c.IsNamedColor)
+ {
+ if (c == Color.LightGray)
+ {
+ // special case due to mismatch between Html and enum spelling
+ colorString = "LightGrey";
+ }
+ else
+ {
+ colorString = c.Name;
+ }
+ }
+ else
+ {
+ colorString = "#" + c.R.ToString("X2", null) +
+ c.G.ToString("X2", null) +
+ c.B.ToString("X2", null);
+ }
+
+ return colorString;
+ }
+
+ private static void InitializeHtmlSysColorTable()
+ {
+ s_htmlSysColorTable = new Hashtable(26);
+ s_htmlSysColorTable["activeborder"] = Color.FromKnownColor(KnownColor.ActiveBorder);
+ s_htmlSysColorTable["activecaption"] = Color.FromKnownColor(KnownColor.ActiveCaption);
+ s_htmlSysColorTable["appworkspace"] = Color.FromKnownColor(KnownColor.AppWorkspace);
+ s_htmlSysColorTable["background"] = Color.FromKnownColor(KnownColor.Desktop);
+ s_htmlSysColorTable["buttonface"] = Color.FromKnownColor(KnownColor.Control);
+ s_htmlSysColorTable["buttonhighlight"] = Color.FromKnownColor(KnownColor.ControlLightLight);
+ s_htmlSysColorTable["buttonshadow"] = Color.FromKnownColor(KnownColor.ControlDark);
+ s_htmlSysColorTable["buttontext"] = Color.FromKnownColor(KnownColor.ControlText);
+ s_htmlSysColorTable["captiontext"] = Color.FromKnownColor(KnownColor.ActiveCaptionText);
+ s_htmlSysColorTable["graytext"] = Color.FromKnownColor(KnownColor.GrayText);
+ s_htmlSysColorTable["highlight"] = Color.FromKnownColor(KnownColor.Highlight);
+ s_htmlSysColorTable["highlighttext"] = Color.FromKnownColor(KnownColor.HighlightText);
+ s_htmlSysColorTable["inactiveborder"] = Color.FromKnownColor(KnownColor.InactiveBorder);
+ s_htmlSysColorTable["inactivecaption"] = Color.FromKnownColor(KnownColor.InactiveCaption);
+ s_htmlSysColorTable["inactivecaptiontext"] = Color.FromKnownColor(KnownColor.InactiveCaptionText);
+ s_htmlSysColorTable["infobackground"] = Color.FromKnownColor(KnownColor.Info);
+ s_htmlSysColorTable["infotext"] = Color.FromKnownColor(KnownColor.InfoText);
+ s_htmlSysColorTable["menu"] = Color.FromKnownColor(KnownColor.Menu);
+ s_htmlSysColorTable["menutext"] = Color.FromKnownColor(KnownColor.MenuText);
+ s_htmlSysColorTable["scrollbar"] = Color.FromKnownColor(KnownColor.ScrollBar);
+ s_htmlSysColorTable["threeddarkshadow"] = Color.FromKnownColor(KnownColor.ControlDarkDark);
+ s_htmlSysColorTable["threedface"] = Color.FromKnownColor(KnownColor.Control);
+ s_htmlSysColorTable["threedhighlight"] = Color.FromKnownColor(KnownColor.ControlLight);
+ s_htmlSysColorTable["threedlightshadow"] = Color.FromKnownColor(KnownColor.ControlLightLight);
+ s_htmlSysColorTable["window"] = Color.FromKnownColor(KnownColor.Window);
+ s_htmlSysColorTable["windowframe"] = Color.FromKnownColor(KnownColor.WindowFrame);
+ s_htmlSysColorTable["windowtext"] = Color.FromKnownColor(KnownColor.WindowText);
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/CombineMode.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/CombineMode.cs
new file mode 100644
index 0000000000..a5c7b05014
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/CombineMode.cs
@@ -0,0 +1,57 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /**
+ * Combine mode constants
+ */
+ /// <include file='doc\CombineMode.uex' path='docs/doc[@for="CombineMode"]/*' />
+ /// <devdoc>
+ /// Defines how different clipping regions can
+ /// be combined.
+ /// </devdoc>
+ public enum CombineMode
+ {
+ /// <include file='doc\CombineMode.uex' path='docs/doc[@for="CombineMode.Replace"]/*' />
+ /// <devdoc>
+ /// One clipping region is replaced by another.
+ /// </devdoc>
+ Replace = 0,
+ /// <include file='doc\CombineMode.uex' path='docs/doc[@for="CombineMode.Intersect"]/*' />
+ /// <devdoc>
+ /// The two clipping regions are combined by
+ /// taking their intersection.
+ /// </devdoc>
+ Intersect = 1,
+ /// <include file='doc\CombineMode.uex' path='docs/doc[@for="CombineMode.Union"]/*' />
+ /// <devdoc>
+ /// The two clipping regions are combined by
+ /// taking the union of both.
+ /// </devdoc>
+ Union = 2,
+ /// <include file='doc\CombineMode.uex' path='docs/doc[@for="CombineMode.Xor"]/*' />
+ /// <devdoc>
+ /// The two clipping regions are combined by
+ /// taking only the area enclosed by one or the other regions, but not both.
+ /// </devdoc>
+ Xor = 3,
+ /// <include file='doc\CombineMode.uex' path='docs/doc[@for="CombineMode.Exclude"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Two clipping regions are combined by taking
+ /// the area of the first region that does not intersect with the second.
+ /// </para>
+ /// </devdoc>
+ Exclude = 4,
+ /// <include file='doc\CombineMode.uex' path='docs/doc[@for="CombineMode.Complement"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Two clipping regions are combined by taking
+ /// the area of the second region that does not intersect with the first.
+ /// </para>
+ /// </devdoc>
+ Complement = 5
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/CompositingMode.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/CompositingMode.cs
new file mode 100644
index 0000000000..dfdaec75fa
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/CompositingMode.cs
@@ -0,0 +1,36 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /*
+ * Alpha compositing mode constants
+ *
+ * @notes Should we scrap this for the first version
+ * and support only SrcOver instead?
+ */
+
+ /// <include file='doc\CompositingMode.uex' path='docs/doc[@for="CompositingMode"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Defines how the source image is composited with the background image.
+ /// </para>
+ /// </devdoc>
+ public enum CompositingMode
+ {
+ /// <include file='doc\CompositingMode.uex' path='docs/doc[@for="CompositingMode.SourceOver"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// The source pixels overwrite the background pixels.
+ /// </para>
+ /// </devdoc>
+ SourceOver = 0,
+ /// <include file='doc\CompositingMode.uex' path='docs/doc[@for="CompositingMode.SourceCopy"]/*' />
+ /// <devdoc>
+ /// The source pixels are combined with the
+ /// background pixels.
+ /// </devdoc>
+ SourceCopy = 1
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/CompositingQuality.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/CompositingQuality.cs
new file mode 100644
index 0000000000..3e2fe818a3
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/CompositingQuality.cs
@@ -0,0 +1,45 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /// <include file='doc\CompositingQuality.uex' path='docs/doc[@for="CompositingQuality"]/*' />
+ /// <devdoc>
+ /// Specifies the quality level to use during
+ /// compositing.
+ /// </devdoc>
+ public enum CompositingQuality
+ {
+ /// <include file='doc\CompositingQuality.uex' path='docs/doc[@for="CompositingQuality.Invalid"]/*' />
+ /// <devdoc>
+ /// Invalid quality.
+ /// </devdoc>
+ Invalid = QualityMode.Invalid,
+ /// <include file='doc\CompositingQuality.uex' path='docs/doc[@for="CompositingQuality.Default"]/*' />
+ /// <devdoc>
+ /// Default quality.
+ /// </devdoc>
+ Default = QualityMode.Default,
+ /// <include file='doc\CompositingQuality.uex' path='docs/doc[@for="CompositingQuality.HighSpeed"]/*' />
+ /// <devdoc>
+ /// Low quality, high speed.
+ /// </devdoc>
+ HighSpeed = QualityMode.Low,
+ /// <include file='doc\CompositingQuality.uex' path='docs/doc[@for="CompositingQuality.HighQuality"]/*' />
+ /// <devdoc>
+ /// High quality, low speed.
+ /// </devdoc>
+ HighQuality = QualityMode.High,
+ /// <include file='doc\CompositingQuality.uex' path='docs/doc[@for="CompositingQuality.GammaCorrected"]/*' />
+ /// <devdoc>
+ /// Gamma correction is used.
+ /// </devdoc>
+ GammaCorrected,
+ /// <include file='doc\CompositingQuality.uex' path='docs/doc[@for="CompositingQuality.AssumeLinear"]/*' />
+ /// <devdoc>
+ /// Assume linear values.
+ /// </devdoc>
+ AssumeLinear
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/CoordinateSpace.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/CoordinateSpace.cs
new file mode 100644
index 0000000000..03322300ba
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/CoordinateSpace.cs
@@ -0,0 +1,45 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /**
+ * Coordinate space identifiers
+ */
+ /// <include file='doc\CoordinateSpace.uex' path='docs/doc[@for="CoordinateSpace"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the system to use when evaluating coordinates.
+ /// </para>
+ /// </devdoc>
+ public enum CoordinateSpace
+ {
+ /// <include file='doc\CoordinateSpace.uex' path='docs/doc[@for="CoordinateSpace.World"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies that coordinates are in the world coordinate context. World
+ /// coordinates are used in a non physical enviroment such as a modeling
+ /// environment.
+ /// </para>
+ /// </devdoc>
+ World = 0,
+ /// <include file='doc\CoordinateSpace.uex' path='docs/doc[@for="CoordinateSpace.Page"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies that coordinates are in the page coordinate context. Page
+ /// coordinates are typically used in a multiple page documents environment.
+ /// </para>
+ /// </devdoc>
+ Page = 1,
+ /// <include file='doc\CoordinateSpace.uex' path='docs/doc[@for="CoordinateSpace.Device"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies that coordinates are in the device coordinate context. Device
+ /// coordinates occur in screen coordinates just before they are drawn on the
+ /// screen.
+ /// </para>
+ /// </devdoc>
+ Device = 2
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/CustomLineCap.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/CustomLineCap.cs
new file mode 100644
index 0000000000..8d83abd73f
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/CustomLineCap.cs
@@ -0,0 +1,320 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ using System.Runtime.InteropServices;
+
+ /// <include file='doc\CustomLineCap.uex' path='docs/doc[@for="CustomLineCap"]/*' />
+ /// <devdoc>
+ /// Encapsulates a custom user-defined line
+ /// cap.
+ /// </devdoc>
+ public class CustomLineCap : MarshalByRefObject, ICloneable, IDisposable
+ {
+#if FINALIZATION_WATCH
+ private string allocationSite = Graphics.GetAllocationStack();
+#endif
+
+
+ /*
+ * Handle to native line cap object
+ */
+ internal SafeCustomLineCapHandle nativeCap = null;
+
+ private bool _disposed = false;
+
+ // For subclass creation
+ internal CustomLineCap() { }
+
+ /// <include file='doc\CustomLineCap.uex' path='docs/doc[@for="CustomLineCap.CustomLineCap"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.CustomLineCap'/> class with the specified outline
+ /// and fill.
+ /// </para>
+ /// </devdoc>
+ public CustomLineCap(GraphicsPath fillPath,
+ GraphicsPath strokePath) :
+ this(fillPath, strokePath, LineCap.Flat)
+ { }
+
+ /// <include file='doc\CustomLineCap.uex' path='docs/doc[@for="CustomLineCap.CustomLineCap1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.CustomLineCap'/> class from the
+ /// specified existing <see cref='System.Drawing.Drawing2D.LineCap'/> with the specified outline and
+ /// fill.
+ /// </para>
+ /// </devdoc>
+ public CustomLineCap(GraphicsPath fillPath,
+ GraphicsPath strokePath,
+ LineCap baseCap) :
+ this(fillPath, strokePath, baseCap, 0)
+ { }
+
+ /// <include file='doc\CustomLineCap.uex' path='docs/doc[@for="CustomLineCap.CustomLineCap2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.CustomLineCap'/> class from the
+ /// specified existing <see cref='System.Drawing.Drawing2D.LineCap'/> with the specified outline, fill, and
+ /// inset.
+ /// </para>
+ /// </devdoc>
+ public CustomLineCap(GraphicsPath fillPath,
+ GraphicsPath strokePath,
+ LineCap baseCap,
+ float baseInset)
+ {
+ IntPtr nativeLineCap = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateCustomLineCap(
+ new HandleRef(fillPath, (fillPath == null) ? IntPtr.Zero : fillPath.nativePath),
+ new HandleRef(strokePath, (strokePath == null) ? IntPtr.Zero : strokePath.nativePath),
+ baseCap, baseInset, out nativeLineCap);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeLineCap(nativeLineCap);
+ }
+
+ internal CustomLineCap(IntPtr nativeLineCap)
+ {
+ SetNativeLineCap(nativeLineCap);
+ }
+
+ internal void SetNativeLineCap(IntPtr handle)
+ {
+ if (handle == IntPtr.Zero)
+ throw new ArgumentNullException("handle");
+
+ nativeCap = new SafeCustomLineCapHandle(handle);
+ }
+
+ /// <include file='doc\CustomLineCap.uex' path='docs/doc[@for="CustomLineCap.Dispose"]/*' />
+ /// <devdoc>
+ /// Cleans up Windows resources for this
+ /// <see cref='System.Drawing.Drawing2D.CustomLineCap'/>.
+ /// </devdoc>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <include file='doc\CustomLineCap.uex' path='docs/doc[@for="CustomLineCap.Dispose2"]/*' />
+ protected virtual void Dispose(bool disposing)
+ {
+ if (_disposed)
+ return;
+
+#if FINALIZATION_WATCH
+ if (!disposing && nativeCap != null)
+ Debug.WriteLine("**********************\nDisposed through finalization:\n" + allocationSite);
+#endif
+ // propagate the explicit dispose call to the child
+ if (disposing && nativeCap != null)
+ {
+ nativeCap.Dispose();
+ }
+
+ _disposed = true;
+ }
+
+ /// <include file='doc\CustomLineCap.uex' path='docs/doc[@for="CustomLineCap.Finalize"]/*' />
+ /// <devdoc>
+ /// Cleans up Windows resources for this
+ /// <see cref='System.Drawing.Drawing2D.CustomLineCap'/>.
+ /// </devdoc>
+ ~CustomLineCap()
+ {
+ Dispose(false);
+ }
+
+ /// <include file='doc\CustomLineCap.uex' path='docs/doc[@for="CustomLineCap.Clone"]/*' />
+ /// <devdoc>
+ /// Creates an exact copy of this <see cref='System.Drawing.Drawing2D.CustomLineCap'/>.
+ /// </devdoc>
+ public object Clone()
+ {
+ IntPtr cloneCap = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCloneCustomLineCap(new HandleRef(this, nativeCap), out cloneCap);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return CustomLineCap.CreateCustomLineCapObject(cloneCap);
+ }
+
+ internal static CustomLineCap CreateCustomLineCapObject(IntPtr cap)
+ {
+ CustomLineCapType capType = 0;
+
+ int status = SafeNativeMethods.Gdip.GdipGetCustomLineCapType(new HandleRef(null, cap), out capType);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ SafeNativeMethods.Gdip.GdipDeleteCustomLineCap(new HandleRef(null, cap));
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ switch (capType)
+ {
+ case CustomLineCapType.Default:
+ return new CustomLineCap(cap);
+
+ case CustomLineCapType.AdjustableArrowCap:
+ return new AdjustableArrowCap(cap);
+ }
+
+ SafeNativeMethods.Gdip.GdipDeleteCustomLineCap(new HandleRef(null, cap));
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.NotImplemented);
+ }
+
+ /// <include file='doc\CustomLineCap.uex' path='docs/doc[@for="CustomLineCap.SetStrokeCaps"]/*' />
+ /// <devdoc>
+ /// Sets the caps used to start and end lines.
+ /// </devdoc>
+ public void SetStrokeCaps(LineCap startCap, LineCap endCap)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetCustomLineCapStrokeCaps(new HandleRef(this, nativeCap), startCap, endCap);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\CustomLineCap.uex' path='docs/doc[@for="CustomLineCap.GetStrokeCaps"]/*' />
+ /// <devdoc>
+ /// Gets the caps used to start and end lines.
+ /// </devdoc>
+ public void GetStrokeCaps(out LineCap startCap, out LineCap endCap)
+ {
+ int status = SafeNativeMethods.Gdip.GdipGetCustomLineCapStrokeCaps(new HandleRef(this, nativeCap), out startCap, out endCap);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ private void _SetStrokeJoin(LineJoin lineJoin)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetCustomLineCapStrokeJoin(new HandleRef(this, nativeCap), lineJoin);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ private LineJoin _GetStrokeJoin()
+ {
+ LineJoin lineJoin;
+
+ int status = SafeNativeMethods.Gdip.GdipGetCustomLineCapStrokeJoin(new HandleRef(this, nativeCap), out lineJoin);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return lineJoin;
+ }
+
+ /// <include file='doc\CustomLineCap.uex' path='docs/doc[@for="CustomLineCap.StrokeJoin"]/*' />
+ /// <devdoc>
+ /// Gets or sets the <see cref='System.Drawing.Drawing2D.LineJoin'/> used by this custom cap.
+ /// </devdoc>
+ public LineJoin StrokeJoin
+ {
+ get { return _GetStrokeJoin(); }
+ set { _SetStrokeJoin(value); }
+ }
+
+ private void _SetBaseCap(LineCap baseCap)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetCustomLineCapBaseCap(new HandleRef(this, nativeCap), baseCap);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ private LineCap _GetBaseCap()
+ {
+ LineCap baseCap;
+ int status = SafeNativeMethods.Gdip.GdipGetCustomLineCapBaseCap(new HandleRef(this, nativeCap), out baseCap);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return baseCap;
+ }
+
+ /// <include file='doc\CustomLineCap.uex' path='docs/doc[@for="CustomLineCap.BaseCap"]/*' />
+ /// <devdoc>
+ /// Gets or sets the <see cref='System.Drawing.Drawing2D.LineCap'/> on which this <see cref='System.Drawing.Drawing2D.CustomLineCap'/> is based.
+ /// </devdoc>
+ public LineCap BaseCap
+ {
+ get { return _GetBaseCap(); }
+ set { _SetBaseCap(value); }
+ }
+
+ private void _SetBaseInset(float inset)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetCustomLineCapBaseInset(new HandleRef(this, nativeCap), inset);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ private float _GetBaseInset()
+ {
+ float inset;
+ int status = SafeNativeMethods.Gdip.GdipGetCustomLineCapBaseInset(new HandleRef(this, nativeCap), out inset);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return inset;
+ }
+
+ /// <include file='doc\CustomLineCap.uex' path='docs/doc[@for="CustomLineCap.BaseInset"]/*' />
+ /// <devdoc>
+ /// Gets or sets the distance between the cap
+ /// and the line.
+ /// </devdoc>
+ public float BaseInset
+ {
+ get { return _GetBaseInset(); }
+ set { _SetBaseInset(value); }
+ }
+
+ private void _SetWidthScale(float widthScale)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetCustomLineCapWidthScale(new HandleRef(this, nativeCap), widthScale);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ private float _GetWidthScale()
+ {
+ float widthScale;
+ int status = SafeNativeMethods.Gdip.GdipGetCustomLineCapWidthScale(new HandleRef(this, nativeCap), out widthScale);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return widthScale;
+ }
+
+ /// <include file='doc\CustomLineCap.uex' path='docs/doc[@for="CustomLineCap.WidthScale"]/*' />
+ /// <devdoc>
+ /// Gets or sets the amount by which to scale
+ /// the width of the cap.
+ /// </devdoc>
+ public float WidthScale
+ {
+ get { return _GetWidthScale(); }
+ set { _SetWidthScale(value); }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/CustomLineCapType.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/CustomLineCapType.cs
new file mode 100644
index 0000000000..3ac7d202ba
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/CustomLineCapType.cs
@@ -0,0 +1,15 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /**
+ * Various custom line cap types
+ */
+ internal enum CustomLineCapType
+ {
+ Default = 0,
+ AdjustableArrowCap = 1
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/DashStyle.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/DashStyle.cs
new file mode 100644
index 0000000000..531ea97393
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/DashStyle.cs
@@ -0,0 +1,58 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /**
+ * Dash style constants (sdkinc\GDIplusEnums.h)
+ */
+ /// <include file='doc\DashStyle.uex' path='docs/doc[@for="DashStyle"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the style of dashed lines drawn with a <see cref='System.Drawing.Pen'/> .
+ /// </para>
+ /// </devdoc>
+ public enum DashStyle
+ {
+ /// <include file='doc\DashStyle.uex' path='docs/doc[@for="DashStyle.Solid"]/*' />
+ /// <devdoc>
+ /// Specifies a solid line.
+ /// </devdoc>
+ Solid = 0,
+ /// <include file='doc\DashStyle.uex' path='docs/doc[@for="DashStyle.Dash"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies a line comprised of dashes.
+ /// </para>
+ /// </devdoc>
+ Dash = 1,
+ /// <include file='doc\DashStyle.uex' path='docs/doc[@for="DashStyle.Dot"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies a line comprised of dots.
+ /// </para>
+ /// </devdoc>
+ Dot = 2,
+ /// <include file='doc\DashStyle.uex' path='docs/doc[@for="DashStyle.DashDot"]/*' />
+ /// <devdoc>
+ /// Specifies a line comprised of an alternating
+ /// pattern of dash-dot-dash-dot.
+ /// </devdoc>
+ DashDot = 3,
+ /// <include file='doc\DashStyle.uex' path='docs/doc[@for="DashStyle.DashDotDot"]/*' />
+ /// <devdoc>
+ /// Specifies a line comprised of an alternating
+ /// pattern of dash-dot-dot-dash-dot-dot.
+ /// </devdoc>
+ DashDotDot = 4,
+ /// <include file='doc\DashStyle.uex' path='docs/doc[@for="DashStyle.Custom"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies a user-defined custom dash
+ /// style.
+ /// </para>
+ /// </devdoc>
+ Custom = 5
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/EmfPlusFlags.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/EmfPlusFlags.cs
new file mode 100644
index 0000000000..22e725b845
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/EmfPlusFlags.cs
@@ -0,0 +1,15 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ /**
+ * EMF+ Flags
+ */
+ internal enum EmfPlusFlags
+ {
+ Display = 0x00000001,
+ NonDualGdi = 0x00000002
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/EmfPlusRecordType.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/EmfPlusRecordType.cs
new file mode 100644
index 0000000000..e2c0279680
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/EmfPlusRecordType.cs
@@ -0,0 +1,1311 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ /*
+ * EmfPlusRecordType constants
+ */
+
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the methods available in a metafile to read and write graphic
+ /// commands.
+ /// </para>
+ /// </devdoc>
+ public enum EmfPlusRecordType
+ {
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfRecordBase"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfRecordBase = 0x00010000,
+
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfSetBkColor"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfSetBkColor = WmfRecordBase | 0x201,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfSetBkMode"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfSetBkMode = WmfRecordBase | 0x102,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfSetMapMode"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfSetMapMode = WmfRecordBase | 0x103,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfSetROP2"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfSetROP2 = WmfRecordBase | 0x104,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfSetRelAbs"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfSetRelAbs = WmfRecordBase | 0x105,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfSetPolyFillMode"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfSetPolyFillMode = WmfRecordBase | 0x106,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfSetStretchBltMode"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfSetStretchBltMode = WmfRecordBase | 0x107,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfSetTextCharExtra"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfSetTextCharExtra = WmfRecordBase | 0x108,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfSetTextColor"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfSetTextColor = WmfRecordBase | 0x209,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfSetTextJustification"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfSetTextJustification = WmfRecordBase | 0x20A,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfSetWindowOrg"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfSetWindowOrg = WmfRecordBase | 0x20B,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfSetWindowExt"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfSetWindowExt = WmfRecordBase | 0x20C,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfSetViewportOrg"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfSetViewportOrg = WmfRecordBase | 0x20D,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfSetViewportExt"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfSetViewportExt = WmfRecordBase | 0x20E,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfOffsetWindowOrg"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfOffsetWindowOrg = WmfRecordBase | 0x20F,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfScaleWindowExt"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfScaleWindowExt = WmfRecordBase | 0x410,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfOffsetViewportOrg"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfOffsetViewportOrg = WmfRecordBase | 0x211,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfScaleViewportExt"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfScaleViewportExt = WmfRecordBase | 0x412,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfLineTo"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfLineTo = WmfRecordBase | 0x213,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfMoveTo"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfMoveTo = WmfRecordBase | 0x214,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfExcludeClipRect"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfExcludeClipRect = WmfRecordBase | 0x415,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfIntersectClipRect"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfIntersectClipRect = WmfRecordBase | 0x416,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfArc"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfArc = WmfRecordBase | 0x817,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfEllipse"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfEllipse = WmfRecordBase | 0x418,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfFloodFill"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfFloodFill = WmfRecordBase | 0x419,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfPie"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfPie = WmfRecordBase | 0x81A,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfRectangle"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfRectangle = WmfRecordBase | 0x41B,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfRoundRect"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfRoundRect = WmfRecordBase | 0x61C,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfPatBlt"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfPatBlt = WmfRecordBase | 0x61D,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfSaveDC"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfSaveDC = WmfRecordBase | 0x01E,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfSetPixel"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfSetPixel = WmfRecordBase | 0x41F,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfOffsetCilpRgn"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfOffsetCilpRgn = WmfRecordBase | 0x220,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfTextOut"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfTextOut = WmfRecordBase | 0x521,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfBitBlt"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfBitBlt = WmfRecordBase | 0x922,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfStretchBlt"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfStretchBlt = WmfRecordBase | 0xB23,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfPolygon"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfPolygon = WmfRecordBase | 0x324,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfPolyline"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfPolyline = WmfRecordBase | 0x325,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfEscape"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfEscape = WmfRecordBase | 0x626,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfRestoreDC"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfRestoreDC = WmfRecordBase | 0x127,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfFillRegion"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfFillRegion = WmfRecordBase | 0x228,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfFrameRegion"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfFrameRegion = WmfRecordBase | 0x429,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfInvertRegion"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfInvertRegion = WmfRecordBase | 0x12A,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfPaintRegion"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfPaintRegion = WmfRecordBase | 0x12B,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfSelectClipRegion"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfSelectClipRegion = WmfRecordBase | 0x12C,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfSelectObject"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfSelectObject = WmfRecordBase | 0x12D,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfSetTextAlign"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfSetTextAlign = WmfRecordBase | 0x12E,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfChord"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfChord = WmfRecordBase | 0x830,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfSetMapperFlags"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfSetMapperFlags = WmfRecordBase | 0x231,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfExtTextOut"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfExtTextOut = WmfRecordBase | 0xA32,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfSetDibToDev"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfSetDibToDev = WmfRecordBase | 0xD33,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfSelectPalette"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfSelectPalette = WmfRecordBase | 0x234,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfRealizePalette"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfRealizePalette = WmfRecordBase | 0x035,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfAnimatePalette"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfAnimatePalette = WmfRecordBase | 0x436,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfSetPalEntries"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfSetPalEntries = WmfRecordBase | 0x037,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfPolyPolygon"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfPolyPolygon = WmfRecordBase | 0x538,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfResizePalette"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfResizePalette = WmfRecordBase | 0x139,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfDibBitBlt"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfDibBitBlt = WmfRecordBase | 0x940,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfDibStretchBlt"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfDibStretchBlt = WmfRecordBase | 0xb41,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfDibCreatePatternBrush"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfDibCreatePatternBrush = WmfRecordBase | 0x142,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfStretchDib"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfStretchDib = WmfRecordBase | 0xf43,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfExtFloodFill"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfExtFloodFill = WmfRecordBase | 0x548,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfSetLayout"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfSetLayout = WmfRecordBase | 0x149, // META_SETLAYOUT
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfDeleteObject"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfDeleteObject = WmfRecordBase | 0x1f0,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfCreatePalette"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfCreatePalette = WmfRecordBase | 0x0f7,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfCreatePatternBrush"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfCreatePatternBrush = WmfRecordBase | 0x1f9,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfCreatePenIndirect"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfCreatePenIndirect = WmfRecordBase | 0x2fa,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfCreateFontIndirect"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfCreateFontIndirect = WmfRecordBase | 0x2fb,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfCreateBrushIndirect"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfCreateBrushIndirect = WmfRecordBase | 0x2fc,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.WmfCreateRegion"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ WmfCreateRegion = WmfRecordBase | 0x6ff,
+
+ // Since we have to enumerate GDI records right along with GDI+ records,
+ // we list all the GDI records here so that they can be part of the
+ // same enumeration type which is used in the enumeration callback.
+
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfHeader"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfHeader = 1,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfPolyBezier"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfPolyBezier = 2,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfPolygon"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfPolygon = 3,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfPolyline"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfPolyline = 4,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfPolyBezierTo"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfPolyBezierTo = 5,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfPolyLineTo"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfPolyLineTo = 6,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfPolyPolyline"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfPolyPolyline = 7,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfPolyPolygon"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfPolyPolygon = 8,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetWindowExtEx"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetWindowExtEx = 9,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetWindowOrgEx"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetWindowOrgEx = 10,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetViewportExtEx"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetViewportExtEx = 11,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetViewportOrgEx"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetViewportOrgEx = 12,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetBrushOrgEx"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetBrushOrgEx = 13,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfEof"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfEof = 14,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetPixelV"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetPixelV = 15,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetMapperFlags"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetMapperFlags = 16,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetMapMode"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetMapMode = 17,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetBkMode"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetBkMode = 18,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetPolyFillMode"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetPolyFillMode = 19,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetROP2"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetROP2 = 20,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetStretchBltMode"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetStretchBltMode = 21,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetTextAlign"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetTextAlign = 22,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetColorAdjustment"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetColorAdjustment = 23,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetTextColor"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetTextColor = 24,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetBkColor"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetBkColor = 25,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfOffsetClipRgn"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfOffsetClipRgn = 26,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfMoveToEx"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfMoveToEx = 27,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetMetaRgn"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetMetaRgn = 28,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfExcludeClipRect"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfExcludeClipRect = 29,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfIntersectClipRect"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfIntersectClipRect = 30,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfScaleViewportExtEx"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfScaleViewportExtEx = 31,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfScaleWindowExtEx"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfScaleWindowExtEx = 32,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSaveDC"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSaveDC = 33,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfRestoreDC"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfRestoreDC = 34,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetWorldTransform"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetWorldTransform = 35,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfModifyWorldTransform"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfModifyWorldTransform = 36,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSelectObject"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSelectObject = 37,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfCreatePen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfCreatePen = 38,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfCreateBrushIndirect"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfCreateBrushIndirect = 39,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfDeleteObject"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfDeleteObject = 40,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfAngleArc"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfAngleArc = 41,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfEllipse"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfEllipse = 42,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfRectangle"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfRectangle = 43,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfRoundRect"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfRoundRect = 44,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfRoundArc"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfRoundArc = 45,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfChord"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfChord = 46,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfPie"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfPie = 47,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSelectPalette"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSelectPalette = 48,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfCreatePalette"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfCreatePalette = 49,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetPaletteEntries"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetPaletteEntries = 50,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfResizePalette"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfResizePalette = 51,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfRealizePalette"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfRealizePalette = 52,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfExtFloodFill"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfExtFloodFill = 53,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfLineTo"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfLineTo = 54,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfArcTo"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfArcTo = 55,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfPolyDraw"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfPolyDraw = 56,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetArcDirection"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetArcDirection = 57,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetMiterLimit"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetMiterLimit = 58,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfBeginPath"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfBeginPath = 59,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfEndPath"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfEndPath = 60,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfCloseFigure"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfCloseFigure = 61,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfFillPath"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfFillPath = 62,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfStrokeAndFillPath"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfStrokeAndFillPath = 63,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfStrokePath"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfStrokePath = 64,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfFlattenPath"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfFlattenPath = 65,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfWidenPath"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfWidenPath = 66,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSelectClipPath"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSelectClipPath = 67,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfAbortPath"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfAbortPath = 68,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfReserved069"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfReserved069 = 69,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfGdiComment"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfGdiComment = 70,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfFillRgn"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfFillRgn = 71,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfFrameRgn"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfFrameRgn = 72,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfInvertRgn"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfInvertRgn = 73,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfPaintRgn"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfPaintRgn = 74,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfExtSelectClipRgn"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfExtSelectClipRgn = 75,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfBitBlt"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfBitBlt = 76,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfStretchBlt"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfStretchBlt = 77,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfMaskBlt"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfMaskBlt = 78,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfPlgBlt"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfPlgBlt = 79,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetDIBitsToDevice"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetDIBitsToDevice = 80,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfStretchDIBits"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfStretchDIBits = 81,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfExtCreateFontIndirect"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfExtCreateFontIndirect = 82,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfExtTextOutA"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfExtTextOutA = 83,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfExtTextOutW"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfExtTextOutW = 84,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfPolyBezier16"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfPolyBezier16 = 85,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfPolygon16"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfPolygon16 = 86,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfPolyline16"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfPolyline16 = 87,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfPolyBezierTo16"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfPolyBezierTo16 = 88,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfPolylineTo16"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfPolylineTo16 = 89,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfPolyPolyline16"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfPolyPolyline16 = 90,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfPolyPolygon16"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfPolyPolygon16 = 91,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfPolyDraw16"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfPolyDraw16 = 92,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfCreateMonoBrush"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfCreateMonoBrush = 93,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfCreateDibPatternBrushPt"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfCreateDibPatternBrushPt = 94,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfExtCreatePen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfExtCreatePen = 95,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfPolyTextOutA"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfPolyTextOutA = 96,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfPolyTextOutW"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfPolyTextOutW = 97,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetIcmMode"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetIcmMode = 98, // EMR_SETICMMODE,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfCreateColorSpace"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfCreateColorSpace = 99, // EMR_CREATECOLORSPACE,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetColorSpace"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetColorSpace = 100, // EMR_SETCOLORSPACE,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfDeleteColorSpace"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfDeleteColorSpace = 101, // EMR_DELETECOLORSPACE,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfGlsRecord"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfGlsRecord = 102, // EMR_GLSRECORD,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfGlsBoundedRecord"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfGlsBoundedRecord = 103, // EMR_GLSBOUNDEDRECORD,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfPixelFormat"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfPixelFormat = 104, // EMR_PIXELFORMAT,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfDrawEscape"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfDrawEscape = 105, // EMR_RESERVED_105,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfExtEscape"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfExtEscape = 106, // EMR_RESERVED_106,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfStartDoc"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfStartDoc = 107, // EMR_RESERVED_107,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSmallTextOut"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSmallTextOut = 108, // EMR_RESERVED_108,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfForceUfiMapping"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfForceUfiMapping = 109, // EMR_RESERVED_109,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfNamedEscpae"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfNamedEscpae = 110, // EMR_RESERVED_110,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfColorCorrectPalette"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfColorCorrectPalette = 111, // EMR_COLORCORRECTPALETTE,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetIcmProfileA"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetIcmProfileA = 112, // EMR_SETICMPROFILEA,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetIcmProfileW"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetIcmProfileW = 113, // EMR_SETICMPROFILEW,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfAlphaBlend"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfAlphaBlend = 114, // EMR_ALPHABLEND,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetLayout"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetLayout = 115, // EMR_SETLAYOUT,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfTransparentBlt"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfTransparentBlt = 116, // EMR_TRANSPARENTBLT,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfReserved117"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfReserved117 = 117,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfGradientFill"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfGradientFill = 118, // EMR_GRADIENTFILL,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetLinkedUfis"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetLinkedUfis = 119, // EMR_RESERVED_119,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfSetTextJustification"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfSetTextJustification = 120, // EMR_RESERVED_120,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfColorMatchToTargetW"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfColorMatchToTargetW = 121, // EMR_COLORMATCHTOTARGETW,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfCreateColorSpaceW"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfCreateColorSpaceW = 122, // EMR_CREATECOLORSPACEW,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfMax"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfMax = 122,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfMin"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfMin = 1,
+
+ // That is the END of the GDI EMF records.
+
+ // Now we start the list of EMF+ records. We leave quite
+ // a bit of room here for the addition of any new GDI
+ // records that may be added later.
+
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EmfPlusRecordBase"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EmfPlusRecordBase = 0x00004000,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.Invalid"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Invalid = EmfPlusRecordBase,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.Header"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Header,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EndOfFile"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EndOfFile,
+
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.Comment"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Comment,
+
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.GetDC"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ GetDC, // the application grabbed the metafile dc
+
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.MultiFormatStart"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ MultiFormatStart,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.MultiFormatSection"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ MultiFormatSection,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.MultiFormatEnd"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ MultiFormatEnd,
+
+ // For all Persistent Objects
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.Object"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Object,
+ // Drawing Records
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.Clear"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Clear,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.FillRects"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ FillRects,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.DrawRects"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ DrawRects,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.FillPolygon"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ FillPolygon,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.DrawLines"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ DrawLines,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.FillEllipse"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ FillEllipse,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.DrawEllipse"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ DrawEllipse,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.FillPie"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ FillPie,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.DrawPie"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ DrawPie,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.DrawArc"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ DrawArc,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.FillRegion"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ FillRegion,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.FillPath"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ FillPath,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.DrawPath"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ DrawPath,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.FillClosedCurve"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ FillClosedCurve,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.DrawClosedCurve"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ DrawClosedCurve,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.DrawCurve"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ DrawCurve,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.DrawBeziers"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ DrawBeziers,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.DrawImage"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ DrawImage,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.DrawImagePoints"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ DrawImagePoints,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.DrawString"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ DrawString,
+
+ // Graphics State Records
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.SetRenderingOrigin"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ SetRenderingOrigin,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.SetAntiAliasMode"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ SetAntiAliasMode,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.SetTextRenderingHint"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ SetTextRenderingHint,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.SetTextContrast"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ SetTextContrast,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.SetInterpolationMode"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ SetInterpolationMode,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.SetPixelOffsetMode"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ SetPixelOffsetMode,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.SetCompositingMode"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ SetCompositingMode,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.SetCompositingQuality"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ SetCompositingQuality,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.Save"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Save,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.Restore"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Restore,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.BeginContainer"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ BeginContainer,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.BeginContainerNoParams"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ BeginContainerNoParams,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.EndContainer"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ EndContainer,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.SetWorldTransform"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ SetWorldTransform,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.ResetWorldTransform"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ ResetWorldTransform,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.MultiplyWorldTransform"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ MultiplyWorldTransform,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.TranslateWorldTransform"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ TranslateWorldTransform,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.ScaleWorldTransform"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ ScaleWorldTransform,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.RotateWorldTransform"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ RotateWorldTransform,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.SetPageTransform"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ SetPageTransform,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.ResetClip"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ ResetClip,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.SetClipRect"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ SetClipRect,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.SetClipPath"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ SetClipPath,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.SetClipRegion"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ SetClipRegion,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.OffsetClip"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ OffsetClip,
+
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.DrawDriverString"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ DrawDriverString,
+
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.Total"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Total,
+
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.Max"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Max = Total - 1,
+ /// <include file='doc\EmfPlusRecordType.uex' path='docs/doc[@for="EmfPlusRecordType.Min"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Min = Header
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/EmfType.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/EmfType.cs
new file mode 100644
index 0000000000..b463052e46
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/EmfType.cs
@@ -0,0 +1,43 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ /**
+ * EmfType Type
+ */
+ /// <include file='doc\EmfType.uex' path='docs/doc[@for="EmfType"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the metafile type.
+ /// </para>
+ /// </devdoc>
+ public enum EmfType
+ {
+ /// <include file='doc\EmfType.uex' path='docs/doc[@for="EmfType.EmfOnly"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Windows enhanced metafile. Contains GDI commands. Metafiles of this type are
+ /// refered to as an EMF file.
+ /// </para>
+ /// </devdoc>
+ EmfOnly = MetafileType.Emf,
+ /// <include file='doc\EmfType.uex' path='docs/doc[@for="EmfType.EmfPlusOnly"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Windows enhanced metafile plus. Contains GDI+ commands. Metafiles of this
+ /// type are refered to as an EMF+ file.
+ /// </para>
+ /// </devdoc>
+ EmfPlusOnly = MetafileType.EmfPlusOnly,
+ /// <include file='doc\EmfType.uex' path='docs/doc[@for="EmfType.EmfPlusDual"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Dual Windows enhanced metafile. Contains equivalent GDI and GDI+ commands.
+ /// Metafiles of this type are refered to as an EMF+ file.
+ /// </para>
+ /// </devdoc>
+ EmfPlusDual = MetafileType.EmfPlusDual
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/Encoder.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/Encoder.cs
new file mode 100644
index 0000000000..bdba3631cc
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/Encoder.cs
@@ -0,0 +1,88 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ /**
+ * Encoder Parameter types
+ */
+ // note : READONLY ARE USELESS HERE, but since we shipped like that already, might as well leave it there...
+ /// <include file='doc\Encoder.uex' path='docs/doc[@for="Encoder"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public sealed class Encoder
+ {
+ /// <include file='doc\Encoder.uex' path='docs/doc[@for="Encoder.Compression"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static readonly Encoder Compression = new Encoder(new Guid(unchecked((int)0xe09d739d), unchecked((short)0xccd4), unchecked((short)0x44ee), new byte[] { 0x8e, 0xba, 0x3f, 0xbf, 0x8b, 0xe4, 0xfc, 0x58 }));
+ /// <include file='doc\Encoder.uex' path='docs/doc[@for="Encoder.ColorDepth"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static readonly Encoder ColorDepth = new Encoder(new Guid(0x66087055, unchecked((short)0xad66), unchecked((short)0x4c7c), new byte[] { 0x9a, 0x18, 0x38, 0xa2, 0x31, 0x0b, 0x83, 0x37 }));
+ /// <include file='doc\Encoder.uex' path='docs/doc[@for="Encoder.ScanMethod"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static readonly Encoder ScanMethod = new Encoder(new Guid(0x3a4e2661, (short)0x3109, (short)0x4e56, new byte[] { 0x85, 0x36, 0x42, 0xc1, 0x56, 0xe7, 0xdc, 0xfa }));
+ /// <include file='doc\Encoder.uex' path='docs/doc[@for="Encoder.Version"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static readonly Encoder Version = new Encoder(new Guid(0x24d18c76, unchecked((short)0x814a), unchecked((short)0x41a4), new byte[] { 0xbf, 0x53, 0x1c, 0x21, 0x9c, 0xcc, 0xf7, 0x97 }));
+ /// <include file='doc\Encoder.uex' path='docs/doc[@for="Encoder.RenderMethod"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static readonly Encoder RenderMethod = new Encoder(new Guid(0x6d42c53a, (short)0x229a, (short)0x4825, new byte[] { 0x8b, 0xb7, 0x5c, 0x99, 0xe2, 0xb9, 0xa8, 0xb8 }));
+ /// <include file='doc\Encoder.uex' path='docs/doc[@for="Encoder.Quality"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static readonly Encoder Quality = new Encoder(new Guid(0x1d5be4b5, unchecked((short)0xfa4a), unchecked((short)0x452d), new byte[] { 0x9c, 0xdd, 0x5d, 0xb3, 0x51, 0x05, 0xe7, 0xeb }));
+ /// <include file='doc\Encoder.uex' path='docs/doc[@for="Encoder.Transformation"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static readonly Encoder Transformation = new Encoder(new Guid(unchecked((int)0x8d0eb2d1), unchecked((short)0xa58e), unchecked((short)0x4ea8), new byte[] { 0xaa, 0x14, 0x10, 0x80, 0x74, 0xb7, 0xb6, 0xf9 }));
+ /// <include file='doc\Encoder.uex' path='docs/doc[@for="Encoder.LuminanceTable"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static readonly Encoder LuminanceTable = new Encoder(new Guid(unchecked((int)0xedb33bce), unchecked((short)0x0266), unchecked((short)0x4a77), new byte[] { 0xb9, 0x04, 0x27, 0x21, 0x60, 0x99, 0xe7, 0x17 }));
+ /// <include file='doc\Encoder.uex' path='docs/doc[@for="Encoder.ChrominanceTable"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static readonly Encoder ChrominanceTable = new Encoder(new Guid(unchecked((int)0xf2e455dc), unchecked((short)0x09b3), unchecked((short)0x4316), new byte[] { 0x82, 0x60, 0x67, 0x6a, 0xda, 0x32, 0x48, 0x1c }));
+ /// <include file='doc\Encoder.uex' path='docs/doc[@for="Encoder.SaveFlag"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static readonly Encoder SaveFlag = new Encoder(new Guid(unchecked((int)0x292266fc), unchecked((short)0xac40), unchecked((short)0x47bf), new byte[] { 0x8c, 0xfc, 0xa8, 0x5b, 0x89, 0xa6, 0x55, 0xde }));
+
+ private Guid _guid;
+
+ /// <include file='doc\Encoder.uex' path='docs/doc[@for="Encoder.Encoder"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public Encoder(Guid guid)
+ {
+ _guid = guid;
+ }
+
+ /// <include file='doc\Encoder.uex' path='docs/doc[@for="Encoder.Guid"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public Guid Guid
+ {
+ get { return _guid; }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/EncoderParameter.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/EncoderParameter.cs
new file mode 100644
index 0000000000..4c34ce564f
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/EncoderParameter.cs
@@ -0,0 +1,546 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ using System.Runtime.InteropServices;
+
+ /// <include file='doc\EncoderParameter.uex' path='docs/doc[@for="EncoderParameter"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ [StructLayout(LayoutKind.Sequential)]
+ public sealed class EncoderParameter : IDisposable
+ {
+#pragma warning disable CS0618 // Legacy code: We don't care about using obsolete API's.
+ [MarshalAs(UnmanagedType.Struct)]
+#pragma warning restore CS0618
+ private Guid _parameterGuid; // GUID of the parameter
+ private int _numberOfValues; // Number of the parameter values
+ private EncoderParameterValueType _parameterValueType; // Value type, like ValueTypeLONG etc.
+ private IntPtr _parameterValue; // A pointer to the parameter values
+
+ /// <include file='doc\EncoderParameter.uex' path='docs/doc[@for="EncoderParameter.Finalize"]/*' />
+ ~EncoderParameter()
+ {
+ Dispose(false);
+ }
+
+ /// <include file='doc\EncoderParameter.uex' path='docs/doc[@for="EncoderParameter.Encoder"]/*' />
+ /// <devdoc>
+ /// Gets/Sets the Encoder for the EncoderPameter.
+ /// </devdoc>
+ public Encoder Encoder
+ {
+ get
+ {
+ return new Encoder(_parameterGuid);
+ }
+ set
+ {
+ _parameterGuid = value.Guid;
+ }
+ }
+
+ /// <include file='doc\EncoderParameter.uex' path='docs/doc[@for="EncoderParameter.Type"]/*' />
+ /// <devdoc>
+ /// Gets the EncoderParameterValueType object from the EncoderParameter.
+ /// </devdoc>
+ public EncoderParameterValueType Type
+ {
+ get
+ {
+ return _parameterValueType;
+ }
+ }
+
+ /// <include file='doc\EncoderParameter.uex' path='docs/doc[@for="EncoderParameter.ValueType"]/*' />
+ /// <devdoc>
+ /// Gets the EncoderParameterValueType object from the EncoderParameter.
+ /// </devdoc>
+ public EncoderParameterValueType ValueType
+ {
+ get
+ {
+ return _parameterValueType;
+ }
+ }
+
+ /// <include file='doc\EncoderParameter.uex' path='docs/doc[@for="EncoderParameter.NumberOfValues"]/*' />
+ /// <devdoc>
+ /// Gets the NumberOfValues from the EncoderParameter.
+ /// </devdoc>
+ public int NumberOfValues
+ {
+ get
+ {
+ return _numberOfValues;
+ }
+ }
+
+
+ /// <include file='doc\EncoderParameter.uex' path='docs/doc[@for="EncoderParameter.Dispose"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.KeepAlive(this);
+ GC.SuppressFinalize(this);
+ }
+
+ private void Dispose(bool disposing)
+ {
+ if (_parameterValue != IntPtr.Zero)
+ Marshal.FreeHGlobal(_parameterValue);
+ _parameterValue = IntPtr.Zero;
+ }
+
+ /// <include file='doc\EncoderParameter.uex' path='docs/doc[@for="EncoderParameter.EncoderParameter"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public EncoderParameter(Encoder encoder, byte value)
+ {
+ _parameterGuid = encoder.Guid;
+
+ _parameterValueType = EncoderParameterValueType.ValueTypeByte;
+ _numberOfValues = 1;
+ _parameterValue = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Byte)));
+
+ if (_parameterValue == IntPtr.Zero)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.OutOfMemory);
+
+ Marshal.WriteByte(_parameterValue, value);
+ GC.KeepAlive(this);
+ }
+
+ /// <include file='doc\EncoderParameter.uex' path='docs/doc[@for="EncoderParameter.EncoderParameter1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public EncoderParameter(Encoder encoder, byte value, bool undefined)
+ {
+ _parameterGuid = encoder.Guid;
+
+ if (undefined == true)
+ _parameterValueType = EncoderParameterValueType.ValueTypeUndefined;
+ else
+ _parameterValueType = EncoderParameterValueType.ValueTypeByte;
+ _numberOfValues = 1;
+ _parameterValue = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Byte)));
+
+ if (_parameterValue == IntPtr.Zero)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.OutOfMemory);
+
+ Marshal.WriteByte(_parameterValue, value);
+ GC.KeepAlive(this);
+ }
+
+ /// <include file='doc\EncoderParameter.uex' path='docs/doc[@for="EncoderParameter.EncoderParameter2"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public EncoderParameter(Encoder encoder, short value)
+ {
+ _parameterGuid = encoder.Guid;
+
+ _parameterValueType = EncoderParameterValueType.ValueTypeShort;
+ _numberOfValues = 1;
+ _parameterValue = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Int16)));
+
+ if (_parameterValue == IntPtr.Zero)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.OutOfMemory);
+
+ Marshal.WriteInt16(_parameterValue, value);
+ GC.KeepAlive(this);
+ }
+
+ /// <include file='doc\EncoderParameter.uex' path='docs/doc[@for="EncoderParameter.EncoderParameter3"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public EncoderParameter(Encoder encoder, long value)
+ {
+ _parameterGuid = encoder.Guid;
+
+ _parameterValueType = EncoderParameterValueType.ValueTypeLong;
+ _numberOfValues = 1;
+ _parameterValue = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Int32)));
+
+ if (_parameterValue == IntPtr.Zero)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.OutOfMemory);
+
+ Marshal.WriteInt32(_parameterValue, unchecked((int)value));
+ GC.KeepAlive(this);
+ }
+
+ // Consider supporting a 'float' and converting to numerator/denominator
+ /// <include file='doc\EncoderParameter.uex' path='docs/doc[@for="EncoderParameter.EncoderParameter4"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public EncoderParameter(Encoder encoder, int numerator, int denominator)
+ {
+ _parameterGuid = encoder.Guid;
+
+ _parameterValueType = EncoderParameterValueType.ValueTypeRational;
+ _numberOfValues = 1;
+ int size = Marshal.SizeOf(typeof(Int32));
+ _parameterValue = Marshal.AllocHGlobal(2 * size);
+
+ if (_parameterValue == IntPtr.Zero)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.OutOfMemory);
+
+ Marshal.WriteInt32(_parameterValue, numerator);
+ Marshal.WriteInt32(Add(_parameterValue, size), denominator);
+ GC.KeepAlive(this);
+ }
+
+ // Consider supporting a 'float' and converting to numerator/denominator
+ /// <include file='doc\EncoderParameter.uex' path='docs/doc[@for="EncoderParameter.EncoderParameter5"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public EncoderParameter(Encoder encoder, long rangebegin, long rangeend)
+ {
+ _parameterGuid = encoder.Guid;
+
+ _parameterValueType = EncoderParameterValueType.ValueTypeLongRange;
+ _numberOfValues = 1;
+ int size = Marshal.SizeOf(typeof(Int32));
+ _parameterValue = Marshal.AllocHGlobal(2 * size);
+
+ if (_parameterValue == IntPtr.Zero)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.OutOfMemory);
+
+ Marshal.WriteInt32(_parameterValue, unchecked((int)rangebegin));
+ Marshal.WriteInt32(Add(_parameterValue, size), unchecked((int)rangeend));
+ GC.KeepAlive(this);
+ }
+
+ // Consider supporting a 'float' and converting to numerator/denominator
+ /// <include file='doc\EncoderParameter.uex' path='docs/doc[@for="EncoderParameter.EncoderParameter6"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public EncoderParameter(Encoder encoder,
+ int numerator1, int demoninator1,
+ int numerator2, int demoninator2)
+ {
+ _parameterGuid = encoder.Guid;
+
+ _parameterValueType = EncoderParameterValueType.ValueTypeRationalRange;
+ _numberOfValues = 1;
+ int size = Marshal.SizeOf(typeof(Int32));
+ _parameterValue = Marshal.AllocHGlobal(4 * size);
+
+ if (_parameterValue == IntPtr.Zero)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.OutOfMemory);
+
+ Marshal.WriteInt32(_parameterValue, numerator1);
+ Marshal.WriteInt32(Add(_parameterValue, size), demoninator1);
+ Marshal.WriteInt32(Add(_parameterValue, 2 * size), numerator2);
+ Marshal.WriteInt32(Add(_parameterValue, 3 * size), demoninator2);
+ GC.KeepAlive(this);
+ }
+
+ /// <include file='doc\EncoderParameter.uex' path='docs/doc[@for="EncoderParameter.EncoderParameter7"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public EncoderParameter(Encoder encoder, string value)
+ {
+ _parameterGuid = encoder.Guid;
+
+ _parameterValueType = EncoderParameterValueType.ValueTypeAscii;
+ _numberOfValues = value.Length;
+ _parameterValue = Marshal.StringToHGlobalAnsi(value);
+ GC.KeepAlive(this);
+
+ if (_parameterValue == IntPtr.Zero)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.OutOfMemory);
+ }
+
+ /// <include file='doc\EncoderParameter.uex' path='docs/doc[@for="EncoderParameter.EncoderParameter8"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public EncoderParameter(Encoder encoder, byte[] value)
+ {
+ _parameterGuid = encoder.Guid;
+
+ _parameterValueType = EncoderParameterValueType.ValueTypeByte;
+ _numberOfValues = value.Length;
+
+ _parameterValue = Marshal.AllocHGlobal(_numberOfValues);
+
+ if (_parameterValue == IntPtr.Zero)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.OutOfMemory);
+
+ Marshal.Copy(value, 0, _parameterValue, _numberOfValues);
+ GC.KeepAlive(this);
+ }
+
+ /// <include file='doc\EncoderParameter.uex' path='docs/doc[@for="EncoderParameter.EncoderParameter9"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public EncoderParameter(Encoder encoder, byte[] value, bool undefined)
+ {
+ _parameterGuid = encoder.Guid;
+
+ if (undefined == true)
+ _parameterValueType = EncoderParameterValueType.ValueTypeUndefined;
+ else
+ _parameterValueType = EncoderParameterValueType.ValueTypeByte;
+
+ _numberOfValues = value.Length;
+ _parameterValue = Marshal.AllocHGlobal(_numberOfValues);
+
+ if (_parameterValue == IntPtr.Zero)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.OutOfMemory);
+
+ Marshal.Copy(value, 0, _parameterValue, _numberOfValues);
+ GC.KeepAlive(this);
+ }
+
+ /// <include file='doc\EncoderParameter.uex' path='docs/doc[@for="EncoderParameter.EncoderParameter10"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public EncoderParameter(Encoder encoder, short[] value)
+ {
+ _parameterGuid = encoder.Guid;
+
+ _parameterValueType = EncoderParameterValueType.ValueTypeShort;
+ _numberOfValues = value.Length;
+ int size = Marshal.SizeOf(typeof(short));
+
+ _parameterValue = Marshal.AllocHGlobal(checked(_numberOfValues * size));
+
+ if (_parameterValue == IntPtr.Zero)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.OutOfMemory);
+
+ Marshal.Copy(value, 0, _parameterValue, _numberOfValues);
+ GC.KeepAlive(this);
+ }
+
+ /// <include file='doc\EncoderParameter.uex' path='docs/doc[@for="EncoderParameter.EncoderParameter11"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public unsafe EncoderParameter(Encoder encoder, long[] value)
+ {
+ _parameterGuid = encoder.Guid;
+
+ _parameterValueType = EncoderParameterValueType.ValueTypeLong;
+ _numberOfValues = value.Length;
+ int size = Marshal.SizeOf(typeof(Int32));
+
+ _parameterValue = Marshal.AllocHGlobal(checked(_numberOfValues * size));
+
+ if (_parameterValue == IntPtr.Zero)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.OutOfMemory);
+
+ int* dest = (int*)_parameterValue;
+ fixed (long* source = value)
+ {
+ for (int i = 0; i < value.Length; i++)
+ {
+ dest[i] = unchecked((int)source[i]);
+ }
+ }
+ GC.KeepAlive(this);
+ }
+
+ // Consider supporting a 'float' and converting to numerator/denominator
+ /// <include file='doc\EncoderParameter.uex' path='docs/doc[@for="EncoderParameter.EncoderParameter12"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public EncoderParameter(Encoder encoder, int[] numerator, int[] denominator)
+ {
+ _parameterGuid = encoder.Guid;
+
+ if (numerator.Length != denominator.Length)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter);
+
+ _parameterValueType = EncoderParameterValueType.ValueTypeRational;
+ _numberOfValues = numerator.Length;
+ int size = Marshal.SizeOf(typeof(Int32));
+
+ _parameterValue = Marshal.AllocHGlobal(checked(_numberOfValues * 2 * size));
+
+ if (_parameterValue == IntPtr.Zero)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.OutOfMemory);
+
+ for (int i = 0; i < _numberOfValues; i++)
+ {
+ Marshal.WriteInt32(Add(i * 2 * size, _parameterValue), (int)numerator[i]);
+ Marshal.WriteInt32(Add((i * 2 + 1) * size, _parameterValue), (int)denominator[i]);
+ }
+ GC.KeepAlive(this);
+ }
+
+ // Consider supporting a 'float' and converting to numerator/denominator
+ /// <include file='doc\EncoderParameter.uex' path='docs/doc[@for="EncoderParameter.EncoderParameter13"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public EncoderParameter(Encoder encoder, long[] rangebegin, long[] rangeend)
+ {
+ _parameterGuid = encoder.Guid;
+
+ if (rangebegin.Length != rangeend.Length)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter);
+
+ _parameterValueType = EncoderParameterValueType.ValueTypeLongRange;
+ _numberOfValues = rangebegin.Length;
+ int size = Marshal.SizeOf(typeof(Int32));
+
+ _parameterValue = Marshal.AllocHGlobal(checked(_numberOfValues * 2 * size));
+
+ if (_parameterValue == IntPtr.Zero)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.OutOfMemory);
+
+ for (int i = 0; i < _numberOfValues; i++)
+ {
+ Marshal.WriteInt32(Add(i * 2 * size, _parameterValue), unchecked((int)rangebegin[i]));
+ Marshal.WriteInt32(Add((i * 2 + 1) * size, _parameterValue), unchecked((int)rangeend[i]));
+ }
+ GC.KeepAlive(this);
+ }
+
+ // Consider supporting a 'float' and converting to numerator/denominator
+ /// <include file='doc\EncoderParameter.uex' path='docs/doc[@for="EncoderParameter.EncoderParameter14"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public EncoderParameter(Encoder encoder,
+ int[] numerator1, int[] denominator1,
+ int[] numerator2, int[] denominator2)
+ {
+ _parameterGuid = encoder.Guid;
+
+ if (numerator1.Length != denominator1.Length ||
+ numerator1.Length != denominator2.Length ||
+ denominator1.Length != denominator2.Length)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter);
+
+ _parameterValueType = EncoderParameterValueType.ValueTypeRationalRange;
+ _numberOfValues = numerator1.Length;
+ int size = Marshal.SizeOf(typeof(Int32));
+
+ _parameterValue = Marshal.AllocHGlobal(checked(_numberOfValues * 4 * size));
+
+ if (_parameterValue == IntPtr.Zero)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.OutOfMemory);
+
+ for (int i = 0; i < _numberOfValues; i++)
+ {
+ Marshal.WriteInt32(Add(_parameterValue, 4 * i * size), numerator1[i]);
+ Marshal.WriteInt32(Add(_parameterValue, (4 * i + 1) * size), denominator1[i]);
+ Marshal.WriteInt32(Add(_parameterValue, (4 * i + 2) * size), numerator2[i]);
+ Marshal.WriteInt32(Add(_parameterValue, (4 * i + 3) * size), denominator2[i]);
+ }
+ GC.KeepAlive(this);
+ }
+
+ // Consider supporting a 'float' and converting to numerator/denominator
+ /// <include file='doc\EncoderParameter.uex' path='docs/doc[@for="EncoderParameter.EncoderParameter15"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ [Obsolete("This constructor has been deprecated. Use EncoderParameter(Encoder encoder, int numberValues, EncoderParameterValueType type, IntPtr value) instead. http://go.microsoft.com/fwlink/?linkid=14202")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public EncoderParameter(Encoder encoder, int NumberOfValues, int Type, int Value)
+ {
+ int size;
+
+ switch ((EncoderParameterValueType)Type)
+ {
+ case EncoderParameterValueType.ValueTypeByte:
+ case EncoderParameterValueType.ValueTypeAscii: size = 1; break;
+ case EncoderParameterValueType.ValueTypeShort: size = 2; break;
+ case EncoderParameterValueType.ValueTypeLong: size = 4; break;
+ case EncoderParameterValueType.ValueTypeRational:
+ case EncoderParameterValueType.ValueTypeLongRange: size = 2 * 4; break;
+ case EncoderParameterValueType.ValueTypeUndefined: size = 1; break;
+ case EncoderParameterValueType.ValueTypeRationalRange: size = 2 * 2 * 4; break;
+ default:
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.WrongState);
+ }
+
+ int bytes = checked(size * NumberOfValues);
+
+ _parameterValue = Marshal.AllocHGlobal(bytes);
+
+ if (_parameterValue == IntPtr.Zero)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.OutOfMemory);
+
+ for (int i = 0; i < bytes; i++)
+ {
+ Marshal.WriteByte(Add(_parameterValue, i), Marshal.ReadByte((IntPtr)(Value + i)));
+ }
+
+ _parameterValueType = (EncoderParameterValueType)Type;
+ _numberOfValues = NumberOfValues;
+ _parameterGuid = encoder.Guid;
+ GC.KeepAlive(this);
+ }
+
+ /// <include file='doc\EncoderParameter.uex' path='docs/doc[@for="EncoderParameter.EncoderParameter16"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2004:RemoveCallsToGCKeepAlive")]
+ public EncoderParameter(Encoder encoder, int numberValues, EncoderParameterValueType type, IntPtr value)
+ {
+ int size;
+
+ switch (type)
+ {
+ case EncoderParameterValueType.ValueTypeByte:
+ case EncoderParameterValueType.ValueTypeAscii: size = 1; break;
+ case EncoderParameterValueType.ValueTypeShort: size = 2; break;
+ case EncoderParameterValueType.ValueTypeLong: size = 4; break;
+ case EncoderParameterValueType.ValueTypeRational:
+ case EncoderParameterValueType.ValueTypeLongRange: size = 2 * 4; break;
+ case EncoderParameterValueType.ValueTypeUndefined: size = 1; break;
+ case EncoderParameterValueType.ValueTypeRationalRange: size = 2 * 2 * 4; break;
+ default:
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.WrongState);
+ }
+
+ int bytes = checked(size * numberValues);
+
+ _parameterValue = Marshal.AllocHGlobal(bytes);
+
+ if (_parameterValue == IntPtr.Zero)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.OutOfMemory);
+
+ for (int i = 0; i < bytes; i++)
+ {
+ Marshal.WriteByte(Add(_parameterValue, i), Marshal.ReadByte((IntPtr)(value + i)));
+ }
+
+ _parameterValueType = type;
+ _numberOfValues = numberValues;
+ _parameterGuid = encoder.Guid;
+ GC.KeepAlive(this);
+ }
+
+ private static IntPtr Add(IntPtr a, int b)
+ {
+ return (IntPtr)((long)a + (long)b);
+ }
+
+ private static IntPtr Add(int a, IntPtr b)
+ {
+ return (IntPtr)((long)a + (long)b);
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/EncoderParameterValueType.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/EncoderParameterValueType.cs
new file mode 100644
index 0000000000..f77f4a21c1
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/EncoderParameterValueType.cs
@@ -0,0 +1,75 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ /**
+ * EncoderParameter Value Type
+ */
+ /// <include file='doc\EncoderParameterValueType.uex' path='docs/doc[@for="EncoderParameterValueType"]/*' />
+ /// <devdoc>
+ /// Specifies a EncoderParameter data type.
+ /// </devdoc>
+ public enum EncoderParameterValueType
+ {
+ /// <include file='doc\EncoderParameterValueType.uex' path='docs/doc[@for="EncoderParameterValueType.ValueTypeByte"]/*' />
+ /// <devdoc>
+ /// The data is an 8-bit unsigned value.
+ /// </devdoc>
+ ValueTypeByte = 1, // 8-bit unsigned int
+ /// <include file='doc\EncoderParameterValueType.uex' path='docs/doc[@for="EncoderParameterValueType.ValueTypeAscii"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// The data is an 8-bit ASCII value.
+ /// </para>
+ /// </devdoc>
+ ValueTypeAscii = 2, // 8-bit byte containing one 7-bit ASCII
+ // code. NULL terminated.
+ /// <include file='doc\EncoderParameterValueType.uex' path='docs/doc[@for="EncoderParameterValueType.ValueTypeShort"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// The data is a 16-bit unsigned value.
+ /// </para>
+ /// </devdoc>
+ ValueTypeShort = 3, // 16-bit unsigned int
+ /// <include file='doc\EncoderParameterValueType.uex' path='docs/doc[@for="EncoderParameterValueType.ValueTypeLong"]/*' />
+ /// <devdoc>
+ /// The data is a 32-bit unsigned value.
+ /// </devdoc>
+ ValueTypeLong = 4, // 32-bit unsigned int
+ /// <include file='doc\EncoderParameterValueType.uex' path='docs/doc[@for="EncoderParameterValueType.ValueTypeRational"]/*' />
+ /// <devdoc>
+ /// The data is two long integers, specifying
+ /// the numerator and the denominator of a rational number, respectively.
+ /// </devdoc>
+ ValueTypeRational = 5, // Two Longs. The first Long is the
+ // numerator, the second Long expresses the
+ // denomintor.
+ /// <include file='doc\EncoderParameterValueType.uex' path='docs/doc[@for="EncoderParameterValueType.ValueTypeLongRange"]/*' />
+ /// <devdoc>
+ /// Two values that specify a range of numbers.
+ /// </devdoc>
+ ValueTypeLongRange = 6, // Two longs which specify a range of
+ // integer values. The first Long specifies
+ // the lower end and the second one
+ // specifies the higher end. All values
+ // are inclusive at both ends
+ /// <include file='doc\EncoderParameterValueType.uex' path='docs/doc[@for="EncoderParameterValueType.ValueTypeUndefined"]/*' />
+ /// <devdoc>
+ /// An 8-bit undefined value.
+ /// </devdoc>
+ ValueTypeUndefined = 7, // 8-bit byte that can take any value
+ // depending on field definition
+ /// <include file='doc\EncoderParameterValueType.uex' path='docs/doc[@for="EncoderParameterValueType.ValueTypeRationalRange"]/*' />
+ /// <devdoc>
+ /// A range of rational numbers.
+ /// </devdoc>
+ ValueTypeRationalRange = 8 // Two Rationals. The first Rational
+ // specifies the lower end and the second
+ // specifies the higher end. All values
+ // are inclusive at both ends
+ }
+}
+
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/EncoderParameters.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/EncoderParameters.cs
new file mode 100644
index 0000000000..6e3b963567
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/EncoderParameters.cs
@@ -0,0 +1,139 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ using Marshal = System.Runtime.InteropServices.Marshal;
+
+ //[StructLayout(LayoutKind.Sequential)]
+ /// <include file='doc\EncoderParameters.uex' path='docs/doc[@for="EncoderParameters"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public sealed class EncoderParameters : IDisposable
+ {
+ private EncoderParameter[] _param;
+
+ /// <include file='doc\EncoderParameters.uex' path='docs/doc[@for="EncoderParameters.EncoderParameters"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public EncoderParameters(int count)
+ {
+ _param = new EncoderParameter[count];
+ }
+
+ /// <include file='doc\EncoderParameters.uex' path='docs/doc[@for="EncoderParameters.EncoderParameters1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public EncoderParameters()
+ {
+ _param = new EncoderParameter[1];
+ }
+
+ /// <include file='doc\EncoderParameters.uex' path='docs/doc[@for="EncoderParameters.Param"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public EncoderParameter[] Param
+ {
+ get
+ {
+ return _param;
+ }
+ set
+ {
+ _param = value;
+ }
+ }
+
+ /// <devdoc>
+ /// Copy the EncoderParameters data into a chunk of memory to be consumed by native GDI+ code.
+ ///
+ /// We need to marshal the EncoderParameters info from/to native GDI+ ourselve since the definition of the managed/unmanaged classes
+ /// are different and the native class is a bit weird. The native EncoderParameters class is defined in GDI+ as follows:
+ ///
+ /// class EncoderParameters {
+ /// UINT Count; // Number of parameters in this structure
+ /// EncoderParameter Parameter[1]; // Parameter values
+ /// };
+ ///
+ /// We don't have the 'Count' field since the managed array contains it. In order for this structure to work with more than one
+ /// EncoderParameter we need to preallocate memory for the extra n-1 elements, something like this:
+ ///
+ /// EncoderParameters* pEncoderParameters = (EncoderParameters*) malloc(sizeof(EncoderParameters) + (n-1) * sizeof(EncoderParameter));
+ ///
+ /// Also, in 64-bit platforms, 'Count' is aligned in 8 bytes (4 extra padding bytes) so we use IntPtr instead of Int32 to account for
+ /// that.
+ /// </devdoc>
+ internal IntPtr ConvertToMemory()
+ {
+ int size = Marshal.SizeOf(typeof(EncoderParameter));
+
+ int length = _param.Length;
+ IntPtr memory = Marshal.AllocHGlobal(checked(length * size + Marshal.SizeOf(typeof(IntPtr))));
+
+ if (memory == IntPtr.Zero)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.OutOfMemory);
+ }
+
+ Marshal.WriteIntPtr(memory, (IntPtr)length);
+
+ long arrayOffset = checked((long)memory + Marshal.SizeOf(typeof(IntPtr)));
+
+ for (int i = 0; i < length; i++)
+ {
+ Marshal.StructureToPtr(_param[i], (IntPtr)(arrayOffset + i * size), false);
+ }
+
+ return memory;
+ }
+
+ /// <devdoc>
+ /// Copy the native GDI+ EncoderParameters data from a chunk of memory into a managed EncoderParameters object.
+ /// See ConvertToMemory for more info.
+ /// </devdoc>
+ internal static EncoderParameters ConvertFromMemory(IntPtr memory)
+ {
+ if (memory == IntPtr.Zero)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter);
+ }
+
+ int count = Marshal.ReadIntPtr(memory).ToInt32();
+
+ EncoderParameters p = new EncoderParameters(count);
+ int size = Marshal.SizeOf(typeof(EncoderParameter));
+ long arrayOffset = (long)memory + Marshal.SizeOf(typeof(IntPtr));
+
+ for (int i = 0; i < count; i++)
+ {
+ Guid guid = (Guid)UnsafeNativeMethods.PtrToStructure((IntPtr)(i * size + arrayOffset), typeof(Guid));
+ int numberOfValues = Marshal.ReadInt32((IntPtr)(i * size + arrayOffset + 16));
+ EncoderParameterValueType type = (EncoderParameterValueType)Marshal.ReadInt32((IntPtr)(i * size + arrayOffset + 20));
+ IntPtr value = Marshal.ReadIntPtr((IntPtr)(i * size + arrayOffset + 24));
+
+ p._param[i] = new EncoderParameter(new Encoder(guid), numberOfValues, type, value);
+ }
+
+ return p;
+ }
+
+ /// <include file='doc\EncoderParameters.uex' path='docs/doc[@for="EncoderParameters.Dispose"]/*' />
+ public void Dispose()
+ {
+ foreach (EncoderParameter p in _param)
+ {
+ if (p != null)
+ {
+ p.Dispose();
+ }
+ }
+ _param = null;
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/EncoderValue.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/EncoderValue.cs
new file mode 100644
index 0000000000..61a24e60db
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/EncoderValue.cs
@@ -0,0 +1,139 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ /**
+ * EncoderParameter Value Type
+ */
+ /// <include file='doc\EncoderValue.uex' path='docs/doc[@for="EncoderValue"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// The EncoderValue enum.
+ /// </para>
+ /// </devdoc>
+ public enum EncoderValue
+ {
+ /// <include file='doc\EncoderValue.uex' path='docs/doc[@for="EncoderValue.ColorTypeCMYK"]/*' />
+ /// <devdoc>
+ /// Specifies the CMYK color space.
+ /// </devdoc>
+ ColorTypeCMYK,
+ /// <include file='doc\EncoderValue.uex' path='docs/doc[@for="EncoderValue.ColorTypeYCCK"]/*' />
+ /// <devdoc>
+ /// Specifies the YCCK color space.
+ /// </devdoc>
+ ColorTypeYCCK,
+ /// <include file='doc\EncoderValue.uex' path='docs/doc[@for="EncoderValue.CompressionLZW"]/*' />
+ /// <devdoc>
+ /// Specifies the LZW compression method.
+ /// </devdoc>
+ CompressionLZW,
+ /// <include file='doc\EncoderValue.uex' path='docs/doc[@for="EncoderValue.CompressionCCITT3"]/*' />
+ /// <devdoc>
+ /// For a TIFF image, specifies the CCITT3 compression method.
+ /// </devdoc>
+ CompressionCCITT3,
+ /// <include file='doc\EncoderValue.uex' path='docs/doc[@for="EncoderValue.CompressionCCITT4"]/*' />
+ /// <devdoc>
+ /// For a TIFF image, specifies the CCITT4 compression method.
+ /// </devdoc>
+ CompressionCCITT4,
+ /// <include file='doc\EncoderValue.uex' path='docs/doc[@for="EncoderValue.CompressionRle"]/*' />
+ /// <devdoc>
+ /// For a TIFF image, specifies the RLE compression method.
+ /// </devdoc>
+ CompressionRle,
+ /// <include file='doc\EncoderValue.uex' path='docs/doc[@for="EncoderValue.CompressionNone"]/*' />
+ /// <devdoc>
+ /// For a TIFF image, specifies no compression.
+ /// </devdoc>
+ CompressionNone,
+ /// <include file='doc\EncoderValue.uex' path='docs/doc[@for="EncoderValue.ScanMethodInterlaced"]/*' />
+ /// <devdoc>
+ /// Specifies interlaced mode.
+ /// </devdoc>
+ ScanMethodInterlaced,
+ /// <include file='doc\EncoderValue.uex' path='docs/doc[@for="EncoderValue.ScanMethodNonInterlaced"]/*' />
+ /// <devdoc>
+ /// Specifies non-interlaced mode.
+ /// </devdoc>
+ ScanMethodNonInterlaced,
+ /// <include file='doc\EncoderValue.uex' path='docs/doc[@for="EncoderValue.VersionGif87"]/*' />
+ /// <devdoc>
+ /// For a GIF image, specifies version 87.
+ /// </devdoc>
+ VersionGif87,
+ /// <include file='doc\EncoderValue.uex' path='docs/doc[@for="EncoderValue.VersionGif89"]/*' />
+ /// <devdoc>
+ /// For a GIF images, specifies version 89a.
+ /// </devdoc>
+ VersionGif89,
+ /// <include file='doc\EncoderValue.uex' path='docs/doc[@for="EncoderValue.RenderProgressive"]/*' />
+ /// <devdoc>
+ /// Specifies progressive mode.
+ /// </devdoc>
+ RenderProgressive,
+ /// <include file='doc\EncoderValue.uex' path='docs/doc[@for="EncoderValue.RenderNonProgressive"]/*' />
+ /// <devdoc>
+ /// Specifies non-progressive mode.
+ /// </devdoc>
+ RenderNonProgressive,
+ /// <include file='doc\EncoderValue.uex' path='docs/doc[@for="EncoderValue.TransformRotate90"]/*' />
+ /// <devdoc>
+ /// For a JPEG image, specifies lossless 90-degree clockwise rotation.
+ /// </devdoc>
+ TransformRotate90,
+ /// <include file='doc\EncoderValue.uex' path='docs/doc[@for="EncoderValue.TransformRotate180"]/*' />
+ /// <devdoc>
+ /// For a JPEG image, specifies lossless 180-degree rotation.
+ /// </devdoc>
+ TransformRotate180,
+ /// <include file='doc\EncoderValue.uex' path='docs/doc[@for="EncoderValue.TransformRotate270"]/*' />
+ /// <devdoc>
+ /// For a JPEG image, specifies lossless 270-degree clockwise rotation.
+ /// </devdoc>
+ TransformRotate270,
+ /// <include file='doc\EncoderValue.uex' path='docs/doc[@for="EncoderValue.TransformFlipHorizontal"]/*' />
+ /// <devdoc>
+ /// For a JPEG image, specifies a lossless horizontal flip.
+ /// </devdoc>
+ TransformFlipHorizontal,
+ /// <include file='doc\EncoderValue.uex' path='docs/doc[@for="EncoderValue.TransformFlipVertical"]/*' />
+ /// <devdoc>
+ /// For a JPEG image, specifies a lossless vertical flip.
+ /// </devdoc>
+ TransformFlipVertical,
+ /// <include file='doc\EncoderValue.uex' path='docs/doc[@for="EncoderValue.MultiFrame"]/*' />
+ /// <devdoc>
+ /// Specifies multiframe encoding.
+ /// </devdoc>
+ MultiFrame,
+ /// <include file='doc\EncoderValue.uex' path='docs/doc[@for="EncoderValue.LastFrame"]/*' />
+ /// <devdoc>
+ /// Specifies the last frame of a multi-frame image.
+ /// </devdoc>
+ LastFrame,
+ /// <include file='doc\EncoderValue.uex' path='docs/doc[@for="EncoderValue.Flush"]/*' />
+ /// <devdoc>
+ /// Specifies that the encoder object is to be closed.
+ /// </devdoc>
+ Flush,
+ /// <include file='doc\EncoderValue.uex' path='docs/doc[@for="EncoderValue.FrameDimensionTime"]/*' />
+ /// <devdoc>
+ /// For a GIF image, specifies the time frame dimension.
+ /// </devdoc>
+ FrameDimensionTime,
+ /// <include file='doc\EncoderValue.uex' path='docs/doc[@for="EncoderValue.FrameDimensionResolution"]/*' />
+ /// <devdoc>
+ /// Specifies the resolution frame dimension.
+ /// </devdoc>
+ FrameDimensionResolution,
+ /// <include file='doc\EncoderValue.uex' path='docs/doc[@for="EncoderValue.FrameDimensionPage"]/*' />
+ /// <devdoc>
+ /// For a TIFF image, specifies the page frame dimension
+ /// </devdoc>
+ FrameDimensionPage
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/FillMode.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/FillMode.cs
new file mode 100644
index 0000000000..49ac81d8d2
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/FillMode.cs
@@ -0,0 +1,43 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /*
+ * Fill mode constants
+ */
+
+ /// <include file='doc\FillMode.uex' path='docs/doc[@for="FillMode"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies how the interior of a closed path
+ /// is filled.
+ /// </para>
+ /// </devdoc>
+ public enum FillMode
+ {
+ /**
+ * Odd-even fill rule
+ */
+ /// <include file='doc\FillMode.uex' path='docs/doc[@for="FillMode.Alternate"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the alternate fill mode.
+ /// </para>
+ /// </devdoc>
+ Alternate = 0,
+
+ /**
+ * Non-zero winding fill rule
+ */
+ /// <include file='doc\FillMode.uex' path='docs/doc[@for="FillMode.Winding"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the winding fill mode.
+ /// </para>
+ /// </devdoc>
+ Winding = 1
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/FlushIntention.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/FlushIntention.cs
new file mode 100644
index 0000000000..88e1c2baec
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/FlushIntention.cs
@@ -0,0 +1,39 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ // FlushIntentionFlush merely means that all the pending commands have been passed to
+ // the hardware, and that the final results will be shown as soon as the hardware finishes
+ // its rendering. FlushIntentionSync means to wait for the hardware to actually finish its
+ // rendering before returning - this is important for animation and timing loops.
+ /// <include file='doc\FlushIntention.uex' path='docs/doc[@for="FlushIntention"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies whether commands in the graphics stack are terminated (flushed)
+ /// immediately or executed as soon as possible.
+ /// </para>
+ /// </devdoc>
+ public enum FlushIntention
+ {
+ // Flush all batched rendering operations
+ /// <include file='doc\FlushIntention.uex' path='docs/doc[@for="FlushIntention.Flush"]/*' />
+ /// <devdoc>
+ /// Specifies the stack of all graphics
+ /// operations is flushed immediately.
+ /// </devdoc>
+ Flush = 0,
+
+ // Flush all batched rendering operations and wait for them to complete
+ /// <include file='doc\FlushIntention.uex' path='docs/doc[@for="FlushIntention.Sync"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies that all graphics operations on the stack are execyted as soon as
+ /// possible. This synchronizes the graphics state.
+ /// </para>
+ /// </devdoc>
+ Sync = 1
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/Font.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/Font.cs
new file mode 100644
index 0000000000..46a382b599
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/Font.cs
@@ -0,0 +1,1041 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.ComponentModel;
+ using System.Diagnostics;
+ using System.Drawing.Internal;
+ using System.Globalization;
+ using System.Runtime.InteropServices;
+ using System.Runtime.Serialization;
+ using System.Security.Permissions;
+
+ /*
+ * Represent a font object
+ */
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font"]/*' />
+ /// <devdoc>
+ /// Defines a particular format for text,
+ /// including font face, size, and style attributes.
+ /// </devdoc>
+ [ComVisible(true)]
+ public sealed class Font : MarshalByRefObject, ICloneable, ISerializable, IDisposable
+ {
+ private const int LogFontCharSetOffset = 23;
+ private const int LogFontNameOffset = 28;
+
+ private IntPtr _nativeFont;
+ private float _fontSize;
+ private FontStyle _fontStyle;
+ private FontFamily _fontFamily;
+ private GraphicsUnit _fontUnit;
+ private byte _gdiCharSet = SafeNativeMethods.DEFAULT_CHARSET;
+ private bool _gdiVerticalFont;
+ private string _systemFontName = "";
+ private string _originalFontName;
+
+ ///<devdoc>
+ /// Creates the GDI+ native font object.
+ ///</devdoc>
+ private void CreateNativeFont()
+ {
+ Debug.Assert(_nativeFont == IntPtr.Zero, "nativeFont already initialized, this will generate a handle leak.");
+ Debug.Assert(_fontFamily != null, "fontFamily not initialized.");
+
+ // Note: GDI+ creates singleton font family objects (from the corresponding font file) and reference count them so
+ // if creating the font object from an external FontFamily, this object's FontFamily will share the same native object.
+ int status = SafeNativeMethods.Gdip.GdipCreateFont(
+ new HandleRef(this, _fontFamily.NativeFamily),
+ _fontSize,
+ _fontStyle,
+ _fontUnit,
+ out _nativeFont);
+
+ // Special case this common error message to give more information
+ if (status == SafeNativeMethods.Gdip.FontStyleNotFound)
+ {
+ throw new ArgumentException(SR.Format(SR.GdiplusFontStyleNotFound, _fontFamily.Name, _fontStyle.ToString()));
+ }
+ else if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.ISerializable.GetObjectData"]/*' />
+ /// <devdoc>
+ /// ISerializable private implementation
+ /// </devdoc>
+ /// <internalonly/>
+ [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
+ void ISerializable.GetObjectData(SerializationInfo si, StreamingContext context)
+ {
+ // Serialize the original Font name rather than the fallback font name if we have one
+ si.AddValue("Name", String.IsNullOrEmpty(OriginalFontName) ? Name : OriginalFontName);
+ si.AddValue("Size", Size);
+ si.AddValue("Style", Style);
+ si.AddValue("Unit", Unit);
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.Font"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Font'/> class from
+ /// the specified existing <see cref='System.Drawing.Font'/> and <see cref='System.Drawing.FontStyle'/>.
+ /// </para>
+ /// </devdoc>
+ public Font(Font prototype, FontStyle newStyle)
+ {
+ // Copy over the originalFontName because it won't get initialized
+ _originalFontName = prototype.OriginalFontName;
+ Initialize(prototype.FontFamily, prototype.Size, newStyle, prototype.Unit, SafeNativeMethods.DEFAULT_CHARSET, false);
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.Font1"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Font'/> class with
+ /// the specified attributes.
+ /// </devdoc>
+ public Font(FontFamily family, float emSize, FontStyle style, GraphicsUnit unit)
+ {
+ Initialize(family, emSize, style, unit, SafeNativeMethods.DEFAULT_CHARSET, false);
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.Font9"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Font'/> class with
+ /// the specified attributes.
+ /// </devdoc>
+ public Font(FontFamily family, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet)
+ {
+ Initialize(family, emSize, style, unit, gdiCharSet, false);
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.Font11"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Font'/> class with
+ /// the specified attributes.
+ /// </devdoc>
+ public Font(FontFamily family, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet, bool gdiVerticalFont)
+ {
+ Initialize(family, emSize, style, unit, gdiCharSet, gdiVerticalFont);
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.Font10"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Font'/> class with
+ /// the specified attributes.
+ /// </devdoc>
+ public Font(string familyName, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet)
+ {
+ Initialize(familyName, emSize, style, unit, gdiCharSet, IsVerticalName(familyName));
+ }
+
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.Font12"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Font'/> class with
+ /// the specified attributes.
+ /// </devdoc>
+ public Font(string familyName, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet, bool gdiVerticalFont)
+ {
+ if (float.IsNaN(emSize) || float.IsInfinity(emSize) || emSize <= 0)
+ {
+ throw new ArgumentException(SR.Format(SR.InvalidBoundArgument, "emSize", emSize, 0, "System.Single.MaxValue"), "emSize");
+ }
+
+ Initialize(familyName, emSize, style, unit, gdiCharSet, gdiVerticalFont);
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.Font2"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Font'/> class with
+ /// the specified attributes.
+ /// </devdoc>
+ public Font(FontFamily family, float emSize, FontStyle style)
+ {
+ Initialize(family, emSize, style, GraphicsUnit.Point, SafeNativeMethods.DEFAULT_CHARSET, false);
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.Font3"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Font'/> class with
+ /// the specified attributes.
+ /// </devdoc>
+ public Font(FontFamily family, float emSize, GraphicsUnit unit)
+ {
+ Initialize(family, emSize, FontStyle.Regular, unit, SafeNativeMethods.DEFAULT_CHARSET, false);
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.Font4"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Font'/> class with
+ /// the specified attributes.
+ /// </devdoc>
+ public Font(FontFamily family, float emSize)
+ {
+ Initialize(family, emSize, FontStyle.Regular, GraphicsUnit.Point, SafeNativeMethods.DEFAULT_CHARSET, false);
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.Font5"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Font'/> class with
+ /// the specified attributes.
+ /// </devdoc>
+ public Font(string familyName, float emSize, FontStyle style, GraphicsUnit unit)
+ {
+ Initialize(familyName, emSize, style, unit, SafeNativeMethods.DEFAULT_CHARSET, IsVerticalName(familyName));
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.Font6"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Font'/> class with
+ /// the specified
+ /// attributes.
+ /// </para>
+ /// </devdoc>
+ public Font(string familyName, float emSize, FontStyle style)
+ {
+ Initialize(familyName, emSize, style, GraphicsUnit.Point, SafeNativeMethods.DEFAULT_CHARSET, IsVerticalName(familyName));
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.Font7"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Font'/> class with
+ /// the specified attributes.
+ /// </devdoc>
+ public Font(string familyName, float emSize, GraphicsUnit unit)
+ {
+ Initialize(familyName, emSize, FontStyle.Regular, unit, SafeNativeMethods.DEFAULT_CHARSET, IsVerticalName(familyName));
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.Font8"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Font'/> class with
+ /// the specified attributes.
+ /// </devdoc>
+ public Font(string familyName, float emSize)
+ {
+ Initialize(familyName, emSize, FontStyle.Regular, GraphicsUnit.Point, SafeNativeMethods.DEFAULT_CHARSET, IsVerticalName(familyName));
+ }
+
+ /// <devdoc>
+ /// Constructor to initialize fields from an exisiting native GDI+ object reference.
+ /// Used by ToLogFont.
+ /// </devdoc>
+ private Font(IntPtr nativeFont, byte gdiCharSet, bool gdiVerticalFont)
+ {
+ Debug.Assert(_nativeFont == IntPtr.Zero, "GDI+ native font already initialized, this will generate a handle leak");
+ Debug.Assert(nativeFont != IntPtr.Zero, "nativeFont is null");
+
+ int status = 0;
+ float size = 0;
+ GraphicsUnit unit = GraphicsUnit.Point;
+ FontStyle style = FontStyle.Regular;
+ IntPtr nativeFamily = IntPtr.Zero;
+
+ _nativeFont = nativeFont;
+
+ status = SafeNativeMethods.Gdip.GdipGetFontUnit(new HandleRef(this, nativeFont), out unit);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ status = SafeNativeMethods.Gdip.GdipGetFontSize(new HandleRef(this, nativeFont), out size);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ status = SafeNativeMethods.Gdip.GdipGetFontStyle(new HandleRef(this, nativeFont), out style);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ status = SafeNativeMethods.Gdip.GdipGetFamily(new HandleRef(this, nativeFont), out nativeFamily);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetFontFamily(new FontFamily(nativeFamily));
+
+ Initialize(_fontFamily, size, style, unit, gdiCharSet, gdiVerticalFont);
+ }
+
+ /// <devdoc>
+ /// Initializes this object's fields.
+ /// </devdoc>
+ private void Initialize(string familyName, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet, bool gdiVerticalFont)
+ {
+ _originalFontName = familyName;
+
+ SetFontFamily(new FontFamily(StripVerticalName(familyName), true /* createDefaultOnFail */ ));
+ Initialize(_fontFamily, emSize, style, unit, gdiCharSet, gdiVerticalFont);
+ }
+
+ /// <devdoc>
+ /// Initializes this object's fields.
+ /// </devdoc>
+ private void Initialize(FontFamily family, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet, bool gdiVerticalFont)
+ {
+ if (family == null)
+ {
+ throw new ArgumentNullException("family");
+ }
+
+ if (float.IsNaN(emSize) || float.IsInfinity(emSize) || emSize <= 0)
+ {
+ throw new ArgumentException(SR.Format(SR.InvalidBoundArgument, "emSize", emSize, 0, "System.Single.MaxValue"), "emSize");
+ }
+
+ int status;
+
+ _fontSize = emSize;
+ _fontStyle = style;
+ _fontUnit = unit;
+ _gdiCharSet = gdiCharSet;
+ _gdiVerticalFont = gdiVerticalFont;
+
+ if (_fontFamily == null)
+ {
+ // GDI+ FontFamily is a singleton object.
+ SetFontFamily(new FontFamily(family.NativeFamily));
+ }
+
+ if (_nativeFont == IntPtr.Zero)
+ {
+ CreateNativeFont();
+ }
+
+ // Get actual size.
+ status = SafeNativeMethods.Gdip.GdipGetFontSize(new HandleRef(this, _nativeFont), out _fontSize);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.FromHfont"]/*' />
+ /// <devdoc>
+ /// Creates a <see cref='System.Drawing.Font'/> from the specified Windows
+ /// handle.
+ /// </devdoc>
+ public static Font FromHfont(IntPtr hfont)
+ {
+ SafeNativeMethods.LOGFONT lf = new SafeNativeMethods.LOGFONT();
+ SafeNativeMethods.GetObject(new HandleRef(null, hfont), lf);
+
+ Font result;
+ IntPtr screenDC = UnsafeNativeMethods.GetDC(NativeMethods.NullHandleRef);
+ try
+ {
+ result = Font.FromLogFont(lf, screenDC);
+ }
+ finally
+ {
+ UnsafeNativeMethods.ReleaseDC(NativeMethods.NullHandleRef, new HandleRef(null, screenDC));
+ }
+
+ return result;
+ }
+
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.FromLogFont"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Font FromLogFont(object lf)
+ {
+ IntPtr screenDC = UnsafeNativeMethods.GetDC(NativeMethods.NullHandleRef);
+ Font result;
+ try
+ {
+ result = Font.FromLogFont(lf, screenDC);
+ }
+ finally
+ {
+ UnsafeNativeMethods.ReleaseDC(NativeMethods.NullHandleRef, new HandleRef(null, screenDC));
+ }
+ return result;
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.FromLogFont1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Font FromLogFont(object lf, IntPtr hdc)
+ {
+ IntPtr font = IntPtr.Zero;
+ int status;
+
+ if (Marshal.SystemDefaultCharSize == 1)
+ status = SafeNativeMethods.Gdip.GdipCreateFontFromLogfontA(new HandleRef(null, hdc), lf, out font);
+ else
+ status = SafeNativeMethods.Gdip.GdipCreateFontFromLogfontW(new HandleRef(null, hdc), lf, out font);
+
+ // Special case this incredibly common error message to give more information
+ if (status == SafeNativeMethods.Gdip.NotTrueTypeFont)
+ throw new ArgumentException(SR.Format(SR.GdiplusNotTrueTypeFont_NoName));
+ else if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ // GDI+ returns font = 0 even though the status is Ok.
+ if (font == IntPtr.Zero)
+ throw new ArgumentException(SR.Format(SR.GdiplusNotTrueTypeFont, lf.ToString()));
+
+ bool gdiVerticalFont;
+ if (Marshal.SystemDefaultCharSize == 1)
+ {
+#pragma warning disable 0618
+ gdiVerticalFont = (Marshal.ReadByte(lf, LogFontNameOffset) == (byte)(short)'@');
+#pragma warning restore 0618
+ }
+ else
+ {
+#pragma warning disable 0618
+ gdiVerticalFont = (Marshal.ReadInt16(lf, LogFontNameOffset) == (short)'@');
+#pragma warning restore 0618
+ }
+#pragma warning disable 0618
+ return new Font(font, Marshal.ReadByte(lf, LogFontCharSetOffset), gdiVerticalFont);
+#pragma warning restore 0618
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.FromHdc"]/*' />
+ /// <devdoc>
+ /// Creates a Font from the specified Windows
+ /// handle to a device context.
+ /// </devdoc>
+ public static Font FromHdc(IntPtr hdc)
+ {
+ IntPtr font = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateFontFromDC(new HandleRef(null, hdc), ref font);
+
+ // Special case this incredibly common error message to give more information
+ if (status == SafeNativeMethods.Gdip.NotTrueTypeFont)
+ throw new ArgumentException(SR.Format(SR.GdiplusNotTrueTypeFont_NoName));
+ else if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return new Font(font, 0, false);
+ }
+
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.Clone"]/*' />
+ /// <devdoc>
+ /// Creates an exact copy of this <see cref='System.Drawing.Font'/>.
+ /// </devdoc>
+ public object Clone()
+ {
+ IntPtr cloneFont = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCloneFont(new HandleRef(this, _nativeFont), out cloneFont);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ Font newCloneFont = new Font(cloneFont, _gdiCharSet, _gdiVerticalFont);
+
+ return newCloneFont;
+ }
+
+
+ /// <devdoc>
+ /// Get native GDI+ object pointer.
+ /// This property triggers the creation of the GDI+ native object if not initialized yet.
+ /// </devdoc>
+ internal IntPtr NativeFont
+ {
+ get
+ {
+ Debug.Assert(_nativeFont != IntPtr.Zero, "this.nativeFont == IntPtr.Zero.");
+ return _nativeFont;
+ }
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.FontFamily"]/*' />
+ /// <devdoc>
+ /// Gets the <see cref='System.Drawing.FontFamily'/> of this <see cref='System.Drawing.Font'/>.
+ /// </devdoc>
+ [Browsable(false)]
+ public FontFamily FontFamily
+ {
+ get
+ {
+ Debug.Assert(_fontFamily != null, "fontFamily should never be null");
+ return _fontFamily;
+ }
+ }
+
+ private void SetFontFamily(FontFamily family)
+ {
+ _fontFamily = family;
+
+ // GDI+ creates ref-counted singleton FontFamily objects based on the family name so all managed
+ // objects with same family name share the underlying GDI+ native pointer. The unmanged object is
+ // destroyed when its ref-count gets to zero.
+ // Make sure this.fontFamily is not finalized so the underlying singleton object is kept alive.
+ GC.SuppressFinalize(_fontFamily);
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.Finalize"]/*' />
+ /// <devdoc>
+ /// Cleans up Windows resources for this <see cref='System.Drawing.Font'/>.
+ /// </devdoc>
+ ~Font()
+ {
+ Dispose(false);
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.Dispose"]/*' />
+ /// <devdoc>
+ /// Cleans up Windows resources for this <see cref='System.Drawing.Font'/>.
+ /// </devdoc>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ private void Dispose(bool disposing)
+ {
+ if (_nativeFont != IntPtr.Zero)
+ {
+ try
+ {
+#if DEBUG
+ int status =
+#endif
+ SafeNativeMethods.Gdip.GdipDeleteFont(new HandleRef(this, _nativeFont));
+#if DEBUG
+ Debug.Assert(status == SafeNativeMethods.Gdip.Ok, "GDI+ returned an error status: " + status.ToString(CultureInfo.InvariantCulture));
+#endif
+ }
+ catch (Exception ex)
+ {
+ if (ClientUtils.IsCriticalException(ex))
+ {
+ throw;
+ }
+
+ Debug.Fail("Exception thrown during Dispose: " + ex.ToString());
+ }
+ finally
+ {
+ _nativeFont = IntPtr.Zero;
+ }
+ }
+ }
+
+ private static bool IsVerticalName(string familyName)
+ {
+ return familyName != null && familyName.Length > 0 && familyName[0] == '@';
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.Bold"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets a value indicating whether this <see cref='System.Drawing.Font'/> is bold.
+ /// </para>
+ /// </devdoc>
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool Bold
+ {
+ get
+ {
+ return (Style & FontStyle.Bold) != 0;
+ }
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.GdiCharSet"]/*' />
+ /// <devdoc>
+ /// Returns the GDI char set for this instance of a font. This will only
+ /// be valid if this font was created from a classic GDI font definition,
+ /// like a LOGFONT or HFONT, or it was passed into the constructor.
+ ///
+ /// This is here for compatability with native Win32 intrinsic controls
+ /// on non-Unicode platforms.
+ /// </devdoc>
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public byte GdiCharSet
+ {
+ get
+ {
+ return _gdiCharSet;
+ }
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.GdiVerticalFont"]/*' />
+ /// <devdoc>
+ /// Determines if this font was created to represt a GDI vertical font.
+ /// his will only be valid if this font was created from a classic GDI
+ /// font definition, like a LOGFONT or HFONT, or it was passed into the
+ /// constructor.
+ ///
+ /// This is here for compatability with native Win32 intrinsic controls
+ /// on non-Unicode platforms.
+ /// </devdoc>
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool GdiVerticalFont
+ {
+ get
+ {
+ return _gdiVerticalFont;
+ }
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.Italic"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets a value indicating whether this <see cref='System.Drawing.Font'/> is Italic.
+ /// </para>
+ /// </devdoc>
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool Italic
+ {
+ get
+ {
+ return (Style & FontStyle.Italic) != 0;
+ }
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.Name"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the face name of this <see cref='System.Drawing.Font'/> .
+ /// </para>
+ /// </devdoc>
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Name
+ {
+ get { return FontFamily.Name; }
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.OriginalFontName"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// This property is required by the framework and not intended to be used directly.
+ /// </para>
+ /// </devdoc>
+ [Browsable(false)]
+ public string OriginalFontName
+ {
+ get { return _originalFontName; }
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.Strikeout"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets a value indicating whether this <see cref='System.Drawing.Font'/> is strikeout (has a line
+ /// through it).
+ /// </para>
+ /// </devdoc>
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool Strikeout
+ {
+ get
+ {
+ return (Style & FontStyle.Strikeout) != 0;
+ }
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.Underline"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets a value indicating whether this <see cref='System.Drawing.Font'/> is underlined.
+ /// </para>
+ /// </devdoc>
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool Underline
+ {
+ get
+ {
+ return (Style & FontStyle.Underline) != 0;
+ }
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.Equals"]/*' />
+ /// <devdoc>
+ /// Returns a value indicating whether the
+ /// specified object is a <see cref='System.Drawing.Font'/> equivalent to this <see cref='System.Drawing.Font'/>.
+ /// </devdoc>
+ public override bool Equals(object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ Font font = obj as Font;
+
+ if (font == null)
+ {
+ return false;
+ }
+
+ // Note: If this and/or the passed-in font are disposed, this method can still return true since we check for cached properties
+ // here.
+
+ // We need to call properties on the passed-in object since it could be a proxy in a remoting scenario and proxies don't
+ // have access to private/internal fields.
+ return font.FontFamily.Equals(FontFamily) &&
+ font.GdiVerticalFont == GdiVerticalFont &&
+ font.GdiCharSet == GdiCharSet &&
+ font.Style == Style &&
+ font.Size == Size &&
+ font.Unit == Unit;
+ }
+
+
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.GetHashCode"]/*' />
+ /// <devdoc>
+ /// Gets the hash code for this <see cref='System.Drawing.Font'/>.
+ /// </devdoc>
+ public override int GetHashCode()
+ {
+ return unchecked((int)((((UInt32)_fontStyle << 13) | ((UInt32)_fontStyle >> 19)) ^
+ (((UInt32)_fontUnit << 26) | ((UInt32)_fontUnit >> 6)) ^
+ (((UInt32)_fontSize << 7) | ((UInt32)_fontSize >> 25))));
+ }
+
+ private static string StripVerticalName(string familyName)
+ {
+ if (familyName != null && familyName.Length > 1 && familyName[0] == '@')
+ {
+ return familyName.Substring(1);
+ }
+ return familyName;
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.ToString"]/*' />
+ /// <devdoc>
+ /// Returns a human-readable string
+ /// representation of this <see cref='System.Drawing.Font'/>.
+ /// </devdoc>
+ public override string ToString()
+ {
+ return string.Format(CultureInfo.CurrentCulture, "[{0}: Name={1}, Size={2}, Units={3}, GdiCharSet={4}, GdiVerticalFont={5}]",
+ GetType().Name,
+ FontFamily.Name,
+ _fontSize,
+ (int)_fontUnit,
+ _gdiCharSet,
+ _gdiVerticalFont);
+ }
+
+
+
+ // Operations
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.ToLogFont"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void ToLogFont(object logFont)
+ {
+ IntPtr screenDC = UnsafeNativeMethods.GetDC(NativeMethods.NullHandleRef);
+ try
+ {
+ Graphics graphics = Graphics.FromHdcInternal(screenDC);
+
+ try
+ {
+ ToLogFont(logFont, graphics);
+ }
+ finally
+ {
+ graphics.Dispose();
+ }
+ }
+ finally
+ {
+ UnsafeNativeMethods.ReleaseDC(NativeMethods.NullHandleRef, new HandleRef(null, screenDC));
+ }
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.ToLogFont1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public unsafe void ToLogFont(object logFont, Graphics graphics)
+ {
+ if (graphics == null)
+ throw new ArgumentNullException("graphics");
+
+ int status;
+
+ // handle proper marshalling of LogFontName as Unicode or ANSI
+ if (Marshal.SystemDefaultCharSize == 1)
+ status = SafeNativeMethods.Gdip.GdipGetLogFontA(new HandleRef(this, NativeFont), new HandleRef(graphics, graphics.NativeGraphics), logFont);
+ else
+ status = SafeNativeMethods.Gdip.GdipGetLogFontW(new HandleRef(this, NativeFont), new HandleRef(graphics, graphics.NativeGraphics), logFont);
+
+ // append "@" to the begining of the string if we are
+ // a gdiVerticalFont.
+ //
+ if (_gdiVerticalFont)
+ {
+ if (Marshal.SystemDefaultCharSize == 1)
+ {
+ // copy contents of name, over 1 byte
+ //
+ for (int i = 30; i >= 0; i--)
+ {
+#pragma warning disable 0618
+ Marshal.WriteByte(logFont,
+ LogFontNameOffset + i + 1,
+ Marshal.ReadByte(logFont, LogFontNameOffset + i));
+#pragma warning restore 0618
+ }
+
+ // write ANSI '@' sign at begining of name
+ //
+#pragma warning disable 0618
+ Marshal.WriteByte(logFont, LogFontNameOffset, (byte)(int)'@');
+#pragma warning restore 0618
+ }
+ else
+ {
+ // copy contents of name, over 2 bytes (UNICODE)
+ //
+ for (int i = 60; i >= 0; i -= 2)
+ {
+#pragma warning disable 0618
+ Marshal.WriteInt16(logFont,
+ LogFontNameOffset + i + 2,
+ Marshal.ReadInt16(logFont, LogFontNameOffset + i));
+#pragma warning restore 0618
+ }
+
+ // write UNICODE '@' sign at begining of name
+ //
+#pragma warning disable 0618
+ Marshal.WriteInt16(logFont, LogFontNameOffset, (short)'@');
+#pragma warning restore 0618
+ }
+ }
+#pragma warning disable 0618
+ if (Marshal.ReadByte(logFont, LogFontCharSetOffset) == 0)
+ {
+ Marshal.WriteByte(logFont, LogFontCharSetOffset, _gdiCharSet);
+ }
+#pragma warning restore 0618
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.ToHfont"]/*' />
+ /// <devdoc>
+ /// Returns a handle to this <see cref='System.Drawing.Font'/>.
+ /// </devdoc>
+ public IntPtr ToHfont()
+ {
+ SafeNativeMethods.LOGFONT lf = new SafeNativeMethods.LOGFONT();
+
+ ToLogFont(lf);
+
+ IntPtr handle = IntUnsafeNativeMethods.IntCreateFontIndirect(lf);
+
+ if (handle == IntPtr.Zero)
+ {
+ throw new Win32Exception();
+ }
+
+ return handle;
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.GetHeight"]/*' />
+ /// <devdoc>
+ /// Returns the height of this Font in the
+ /// specified graphics context.
+ /// </devdoc>
+ public float GetHeight(Graphics graphics)
+ {
+ if (graphics == null)
+ throw new ArgumentNullException("graphics");
+
+ float ht;
+
+ int status = SafeNativeMethods.Gdip.GdipGetFontHeight(new HandleRef(this, NativeFont), new HandleRef(graphics, graphics.NativeGraphics), out ht);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return ht;
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.GetHeight1"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public float GetHeight()
+ {
+ IntPtr screenDC = UnsafeNativeMethods.GetDC(NativeMethods.NullHandleRef);
+ float height = 0.0f;
+ try
+ {
+ using (Graphics graphics = Graphics.FromHdcInternal(screenDC))
+ {
+ height = GetHeight(graphics);
+ }
+ }
+ finally
+ {
+ UnsafeNativeMethods.ReleaseDC(NativeMethods.NullHandleRef, new HandleRef(null, screenDC));
+ }
+
+ return height;
+ }
+
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.GetHeight2"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public float GetHeight(float dpi)
+ {
+ float ht;
+
+ int status = SafeNativeMethods.Gdip.GdipGetFontHeightGivenDPI(new HandleRef(this, NativeFont), dpi, out ht);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return ht;
+ }
+
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.Style"]/*' />
+ /// <devdoc>
+ /// Gets style information for this <see cref='System.Drawing.Font'/>.
+ /// </devdoc>
+ [
+ Browsable(false)
+ ]
+ public FontStyle Style
+ {
+ get
+ {
+ return _fontStyle;
+ }
+ }
+
+ // Return value is in Unit (the unit the font was created in)
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.Size"]/*' />
+ /// <devdoc>
+ /// Gets the size of this <see cref='System.Drawing.Font'/>.
+ /// </devdoc>
+ public float Size
+ {
+ get
+ {
+ return _fontSize;
+ }
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.SizeInPoints"]/*' />
+ /// <devdoc>
+ /// Gets the size, in points, of this <see cref='System.Drawing.Font'/>.
+ /// </devdoc>
+ [Browsable(false)]
+ public float SizeInPoints
+ {
+ get
+ {
+ if (Unit == GraphicsUnit.Point)
+ return Size;
+ else
+ {
+ float emHeightInPoints;
+
+ IntPtr screenDC = UnsafeNativeMethods.GetDC(NativeMethods.NullHandleRef);
+
+ try
+ {
+ using (Graphics graphics = Graphics.FromHdcInternal(screenDC))
+ {
+ float pixelsPerPoint = (float)(graphics.DpiY / 72.0);
+ float lineSpacingInPixels = GetHeight(graphics);
+ float emHeightInPixels = lineSpacingInPixels * FontFamily.GetEmHeight(Style) / FontFamily.GetLineSpacing(Style);
+
+ emHeightInPoints = emHeightInPixels / pixelsPerPoint;
+ }
+ }
+ finally
+ {
+ UnsafeNativeMethods.ReleaseDC(NativeMethods.NullHandleRef, new HandleRef(null, screenDC));
+ }
+
+ return emHeightInPoints;
+ }
+ }
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.Unit"]/*' />
+ /// <devdoc>
+ /// Gets the unit of measure for this <see cref='System.Drawing.Font'/>.
+ /// </devdoc>
+ public GraphicsUnit Unit
+ {
+ get
+ {
+ return _fontUnit;
+ }
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.Height"]/*' />
+ /// <devdoc>
+ /// Gets the height of this <see cref='System.Drawing.Font'/>.
+ /// </devdoc>
+ [
+ Browsable(false)
+ ]
+ public int Height
+ {
+ get
+ {
+ return (int)Math.Ceiling(GetHeight());
+ }
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.IsSystemFont"]/*' />
+ /// <devdoc>
+ /// Returns true if this <see cref='System.Drawing.Font'/> is a SystemFont.
+ /// </devdoc>
+ [
+ Browsable(false)
+ ]
+ public bool IsSystemFont
+ {
+ get
+ {
+ return !String.IsNullOrEmpty(_systemFontName);
+ }
+ }
+
+ /// <include file='doc\Font.uex' path='docs/doc[@for="Font.SystemFontName"]/*' />
+ /// <devdoc>
+ /// Gets the name of this <see cref='System.Drawing.SystemFont'/>.
+ /// </devdoc>
+ [
+ Browsable(false)
+ ]
+ public string SystemFontName
+ {
+ get
+ {
+ return _systemFontName;
+ }
+ }
+
+ // This is used by SystemFonts when constructing a system Font objects.
+ internal void SetSystemFontName(string systemFontName)
+ {
+ _systemFontName = systemFontName;
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/FontCollection.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/FontCollection.cs
new file mode 100644
index 0000000000..86cb2a414b
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/FontCollection.cs
@@ -0,0 +1,98 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Text
+{
+ using System.Diagnostics;
+ using System.Runtime.InteropServices;
+
+ /// <include file='doc\FontCollection.uex' path='docs/doc[@for="FontCollection"]/*' />
+ /// <devdoc>
+ /// When inherited, enumerates the FontFamily
+ /// objects in a collection of fonts.
+ /// </devdoc>
+ public abstract class FontCollection : IDisposable
+ {
+ internal IntPtr nativeFontCollection;
+
+
+ internal FontCollection()
+ {
+ nativeFontCollection = IntPtr.Zero;
+ }
+
+ /// <include file='doc\FontCollection.uex' path='docs/doc[@for="FontCollection.Dispose"]/*' />
+ /// <devdoc>
+ /// Disposes of this <see cref='System.Drawing.Text.FontCollection'/>
+ /// </devdoc>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <include file='doc\FontCollection.uex' path='docs/doc[@for="FontCollection.Dispose2"]/*' />
+ protected virtual void Dispose(bool disposing)
+ {
+ // nothing...
+ }
+
+ /// <include file='doc\FontCollection.uex' path='docs/doc[@for="FontCollection.Families"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the array of <see cref='System.Drawing.FontFamily'/>
+ /// objects associated with this <see cref='System.Drawing.Text.FontCollection'/>.
+ /// </para>
+ /// </devdoc>
+ public FontFamily[] Families
+ {
+ get
+ {
+ int numSought = 0;
+
+ int status = SafeNativeMethods.Gdip.GdipGetFontCollectionFamilyCount(new HandleRef(this, nativeFontCollection), out numSought);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ IntPtr[] gpfamilies = new IntPtr[numSought];
+
+ int numFound = 0;
+
+ status = SafeNativeMethods.Gdip.GdipGetFontCollectionFamilyList(new HandleRef(this, nativeFontCollection), numSought, gpfamilies,
+ out numFound);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+
+ Debug.Assert(numSought == numFound, "GDI+ can't give a straight answer about how many fonts there are");
+ FontFamily[] families = new FontFamily[numFound];
+ for (int f = 0; f < numFound; f++)
+ {
+ IntPtr native;
+ SafeNativeMethods.Gdip.GdipCloneFontFamily(new HandleRef(null, (IntPtr)gpfamilies[f]), out native);
+ families[f] = new FontFamily(native);
+ }
+
+ return families;
+ }
+ }
+
+ /**
+ * Object cleanup
+ */
+ /// <include file='doc\FontCollection.uex' path='docs/doc[@for="FontCollection.Finalize"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Allows an object to free resources before the object is
+ /// reclaimed by the Garbage Collector (<see langword='GC'/>).
+ /// </para>
+ /// </devdoc>
+ ~FontCollection()
+ {
+ Dispose(false);
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/FontFamily.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/FontFamily.cs
new file mode 100644
index 0000000000..fb87c48ed9
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/FontFamily.cs
@@ -0,0 +1,520 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*
+* font family object (sdkinc\GDIplusFontFamily.h)
+*/
+
+namespace System.Drawing
+{
+ using System.Diagnostics;
+ using System.Drawing.Text;
+ using System.Globalization;
+ using System.Runtime.InteropServices;
+ using System.Text;
+
+ /**
+ * Represent a FontFamily object
+ */
+ /// <include file='doc\FontFamily.uex' path='docs/doc[@for="FontFamily"]/*' />
+ /// <devdoc>
+ /// Abstracts a group of type faces having a
+ /// similar basic design but having certain variation in styles.
+ /// </devdoc>
+ public sealed class FontFamily : MarshalByRefObject, IDisposable
+ {
+ private const int LANG_NEUTRAL = 0;
+ private IntPtr _nativeFamily;
+ private bool _createDefaultOnFail;
+
+#if DEBUG
+ private static object s_lockObj = new object();
+ private static int s_idCount = 0;
+ private int _id;
+#endif
+
+ /// <devdoc>
+ /// Sets the GDI+ native family.
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts")]
+ private void SetNativeFamily(IntPtr family)
+ {
+ Debug.Assert(_nativeFamily == IntPtr.Zero, "Setting GDI+ native font family when already initialized.");
+ Debug.Assert(family != IntPtr.Zero, "Setting GDI+ native font family to null.");
+
+ _nativeFamily = family;
+#if DEBUG
+ lock (s_lockObj)
+ {
+ _id = ++s_idCount;
+ }
+#endif
+ }
+
+ ///<devdoc>
+ /// Internal constructor to initialize the native GDI+ font to an existing one.
+ /// Used to create generic fonts and by FontCollection class.
+ ///</devdoc>
+ internal FontFamily(IntPtr family)
+ {
+ SetNativeFamily(family);
+ }
+
+ /// <include file='doc\FontFamily.uex' path='docs/doc[@for="FontFamily.FontFamily3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.FontFamily'/>
+ /// class with the specified name.
+ ///
+ /// The <paramref name="createDefaultOnFail"/> parameter determines how errors are
+ /// handled when creating a font based on a font family that does not exist on the
+ /// end user's system at run time. If this parameter is true, then a fall-back font
+ /// will always be used instead. If this parameter is false, an exception will be thrown.
+ /// </para>
+ /// </devdoc>
+ internal FontFamily(string name, bool createDefaultOnFail)
+ {
+ _createDefaultOnFail = createDefaultOnFail;
+ CreateFontFamily(name, null);
+ }
+
+ /// <include file='doc\FontFamily.uex' path='docs/doc[@for="FontFamily.FontFamily"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.FontFamily'/>
+ /// class with the specified name.
+ /// </para>
+ /// </devdoc>
+ public FontFamily(string name)
+ {
+ CreateFontFamily(name, null);
+ }
+
+ /// <include file='doc\FontFamily.uex' path='docs/doc[@for="FontFamily.FontFamily1"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.FontFamily'/>
+ /// class in the specified <see cref='System.Drawing.Text.FontCollection'/> and with the specified name.
+ /// </devdoc>
+ public FontFamily(string name, FontCollection fontCollection)
+ {
+ CreateFontFamily(name, fontCollection);
+ }
+
+ /// <devdoc>
+ /// Creates the native font family object.
+ /// Note: GDI+ creates singleton font family objects (from the corresponding font file) and reference count them.
+ /// </devdoc>
+ private void CreateFontFamily(string name, FontCollection fontCollection)
+ {
+ IntPtr fontfamily = IntPtr.Zero;
+ IntPtr nativeFontCollection = (fontCollection == null) ? IntPtr.Zero : fontCollection.nativeFontCollection;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateFontFamilyFromName(name, new HandleRef(fontCollection, nativeFontCollection), out fontfamily);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ if (_createDefaultOnFail)
+ {
+ fontfamily = GetGdipGenericSansSerif(); // This throws if failed.
+ }
+ else
+ {
+ // Special case this incredibly common error message to give more information
+ if (status == SafeNativeMethods.Gdip.FontFamilyNotFound)
+ {
+ throw new ArgumentException(SR.Format(SR.GdiplusFontFamilyNotFound, name));
+ }
+ else if (status == SafeNativeMethods.Gdip.NotTrueTypeFont)
+ {
+ throw new ArgumentException(SR.Format(SR.GdiplusNotTrueTypeFont, name));
+ }
+ else
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+ }
+
+ SetNativeFamily(fontfamily);
+ }
+
+ /// <include file='doc\FontFamily.uex' path='docs/doc[@for="FontFamily.FontFamily2"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.FontFamily'/>
+ /// class from the specified generic font family.
+ /// </devdoc>
+ public FontFamily(GenericFontFamilies genericFamily)
+ {
+ IntPtr fontfamily = IntPtr.Zero;
+ int status;
+
+ switch (genericFamily)
+ {
+ case GenericFontFamilies.Serif:
+ {
+ status = SafeNativeMethods.Gdip.GdipGetGenericFontFamilySerif(out fontfamily);
+ break;
+ }
+ case GenericFontFamilies.SansSerif:
+ {
+ status = SafeNativeMethods.Gdip.GdipGetGenericFontFamilySansSerif(out fontfamily);
+ break;
+ }
+ case GenericFontFamilies.Monospace:
+ default:
+ {
+ status = SafeNativeMethods.Gdip.GdipGetGenericFontFamilyMonospace(out fontfamily);
+ break;
+ }
+ }
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeFamily(fontfamily);
+ }
+
+ /// <include file='doc\FontFamily.uex' path='docs/doc[@for="FontFamily.Finalize"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Allows an object to free resources before the object is reclaimed by the
+ /// Garbage Collector (<see langword='GC'/>).
+ /// </para>
+ /// </devdoc>
+ ~FontFamily()
+ {
+ Dispose(false);
+ }
+
+ /// <devdoc>
+ /// The GDI+ native font family. It is shared by all FontFamily objects with same family name.
+ /// </devdoc>
+ internal IntPtr NativeFamily
+ {
+ get
+ {
+ //Debug.Assert( this.nativeFamily != IntPtr.Zero, "this.nativeFamily == IntPtr.Zero." );
+ return _nativeFamily;
+ }
+ }
+
+ // The managed wrappers do not expose a Clone method, as it's really nothing more
+ // than AddRef (it doesn't copy the underlying GpFont), and in a garbage collected
+ // world, that's not very useful.
+
+ /// <include file='doc\FontFamily.uex' path='docs/doc[@for="FontFamily.Equals"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public override bool Equals(object obj)
+ {
+ if (obj == this)
+ return true;
+
+ FontFamily ff = obj as FontFamily;
+
+ if (ff == null)
+ return false;
+
+ // We can safely use the ptr to the native GDI+ FontFamily because it is common to
+ // all objects of the same family (singleton RO object).
+ return ff.NativeFamily == NativeFamily;
+ }
+
+ /// <include file='doc\FontFamily.uex' path='docs/doc[@for="FontFamily.ToString"]/*' />
+ /// <devdoc>
+ /// Converts this <see cref='System.Drawing.FontFamily'/> to a
+ /// human-readable string.
+ /// </devdoc>
+ public override string ToString()
+ {
+ return string.Format(CultureInfo.CurrentCulture, "[{0}: Name={1}]", GetType().Name, Name);
+ }
+
+ /// <include file='doc\FontFamily.uex' path='docs/doc[@for="FontFamily.GetHashCode"]/*' />
+ /// <devdoc>
+ /// Gets a hash code for this <see cref='System.Drawing.FontFamily'/>.
+ /// </devdoc>
+ public override int GetHashCode()
+ {
+ return GetName(LANG_NEUTRAL).GetHashCode();
+ }
+
+ private static int CurrentLanguage
+ {
+ get
+ {
+ return System.Globalization.CultureInfo.CurrentUICulture.LCID;
+ }
+ }
+
+ /// <include file='doc\FontFamily.uex' path='docs/doc[@for="FontFamily.Dispose"]/*' />
+ /// <devdoc>
+ /// Disposes of this <see cref='System.Drawing.FontFamily'/>.
+ /// </devdoc>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ private void Dispose(bool disposing)
+ {
+ if (_nativeFamily != IntPtr.Zero)
+ {
+ try
+ {
+#if DEBUG
+ int status =
+#endif
+ SafeNativeMethods.Gdip.GdipDeleteFontFamily(new HandleRef(this, _nativeFamily));
+#if DEBUG
+ Debug.Assert(status == SafeNativeMethods.Gdip.Ok, "GDI+ returned an error status: " + status.ToString(CultureInfo.InvariantCulture));
+#endif
+ }
+ catch (Exception ex)
+ {
+ if (ClientUtils.IsCriticalException(ex))
+ {
+ throw;
+ }
+
+ Debug.Fail("Exception thrown during Dispose: " + ex.ToString());
+ }
+ finally
+ {
+ _nativeFamily = IntPtr.Zero;
+ }
+ }
+ }
+
+ /// <include file='doc\FontFamily.uex' path='docs/doc[@for="FontFamily.Name"]/*' />
+ /// <devdoc>
+ /// Gets the name of this <see cref='System.Drawing.FontFamily'/>.
+ /// </devdoc>
+ public String Name
+ {
+ get
+ {
+ return GetName(CurrentLanguage);
+ }
+ }
+
+ /// <include file='doc\FontFamily.uex' path='docs/doc[@for="FontFamily.GetName"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Retuns the name of this <see cref='System.Drawing.FontFamily'/> in
+ /// the specified language.
+ /// </para>
+ /// </devdoc>
+ public String GetName(int language)
+ {
+ // LF_FACESIZE is 32
+ StringBuilder name = new StringBuilder(32);
+
+ int status = SafeNativeMethods.Gdip.GdipGetFamilyName(new HandleRef(this, NativeFamily), name, language);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return name.ToString();
+ }
+
+
+ /// <include file='doc\FontFamily.uex' path='docs/doc[@for="FontFamily.Families"]/*' />
+ /// <devdoc>
+ /// Returns an array that contains all of the
+ /// <see cref='System.Drawing.FontFamily'/> objects associated with the current graphics
+ /// context.
+ /// </devdoc>
+ public static FontFamily[] Families
+ {
+ get
+ {
+ return new InstalledFontCollection().Families;
+ }
+ }
+
+ /// <include file='doc\FontFamily.uex' path='docs/doc[@for="FontFamily.GenericSansSerif"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets a generic SansSerif <see cref='System.Drawing.FontFamily'/>.
+ /// </para>
+ /// </devdoc>
+ public static FontFamily GenericSansSerif
+ {
+ get
+ {
+ return new FontFamily(GetGdipGenericSansSerif());
+ }
+ }
+
+ private static IntPtr GetGdipGenericSansSerif()
+ {
+ IntPtr fontfamily = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipGetGenericFontFamilySansSerif(out fontfamily);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return fontfamily;
+ }
+
+ /// <include file='doc\FontFamily.uex' path='docs/doc[@for="FontFamily.GenericSerif"]/*' />
+ /// <devdoc>
+ /// Gets a generic Serif <see cref='System.Drawing.FontFamily'/>.
+ /// </devdoc>
+ public static FontFamily GenericSerif
+ {
+ get
+ {
+ return new FontFamily(GetNativeGenericSerif());
+ }
+ }
+
+ private static IntPtr GetNativeGenericSerif()
+ {
+ IntPtr fontfamily = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipGetGenericFontFamilySerif(out fontfamily);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return fontfamily;
+ }
+
+ /// <include file='doc\FontFamily.uex' path='docs/doc[@for="FontFamily.GenericMonospace"]/*' />
+ /// <devdoc>
+ /// Gets a generic monospace <see cref='System.Drawing.FontFamily'/>.
+ /// </devdoc>
+ public static FontFamily GenericMonospace
+ {
+ get
+ {
+ return new FontFamily(GetNativeGenericMonospace());
+ }
+ }
+
+ private static IntPtr GetNativeGenericMonospace()
+ {
+ IntPtr fontfamily = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipGetGenericFontFamilyMonospace(out fontfamily);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return fontfamily;
+ }
+
+ // No longer support in FontFamily
+ // Obsolete API and need to be removed later
+ //
+ /// <include file='doc\FontFamily.uex' path='docs/doc[@for="FontFamily.GetFamilies"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Returns an array that contains all of the <see cref='System.Drawing.FontFamily'/> objects associated with
+ /// the specified graphics context.
+ /// </para>
+ /// </devdoc>
+ [Obsolete("Do not use method GetFamilies, use property Families instead")]
+ public static FontFamily[] GetFamilies(Graphics graphics)
+ {
+ if (graphics == null)
+ throw new ArgumentNullException("graphics");
+
+ return new InstalledFontCollection().Families;
+ }
+
+ /// <include file='doc\FontFamily.uex' path='docs/doc[@for="FontFamily.IsStyleAvailable"]/*' />
+ /// <devdoc>
+ /// Indicates whether the specified <see cref='System.Drawing.FontStyle'/> is
+ /// available.
+ /// </devdoc>
+ public bool IsStyleAvailable(FontStyle style)
+ {
+ int bresult;
+
+ int status = SafeNativeMethods.Gdip.GdipIsStyleAvailable(new HandleRef(this, NativeFamily), style, out bresult);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return bresult != 0;
+ }
+
+ /// <include file='doc\FontFamily.uex' path='docs/doc[@for="FontFamily.GetEmHeight"]/*' />
+ /// <devdoc>
+ /// Gets the size of the Em square for the
+ /// specified style in font design units.
+ /// </devdoc>
+ public int GetEmHeight(FontStyle style)
+ {
+ int result = 0;
+
+ int status = SafeNativeMethods.Gdip.GdipGetEmHeight(new HandleRef(this, NativeFamily), style, out result);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return result;
+ }
+
+
+ /// <include file='doc\FontFamily.uex' path='docs/doc[@for="FontFamily.GetCellAscent"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Returns the ascender metric for Windows.
+ /// </para>
+ /// </devdoc>
+ public int GetCellAscent(FontStyle style)
+ {
+ int result = 0;
+
+ int status = SafeNativeMethods.Gdip.GdipGetCellAscent(new HandleRef(this, NativeFamily), style, out result);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return result;
+ }
+
+ /// <include file='doc\FontFamily.uex' path='docs/doc[@for="FontFamily.GetCellDescent"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Returns the descender metric for Windows.
+ /// </para>
+ /// </devdoc>
+ public int GetCellDescent(FontStyle style)
+ {
+ int result = 0;
+
+ int status = SafeNativeMethods.Gdip.GdipGetCellDescent(new HandleRef(this, NativeFamily), style, out result);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return result;
+ }
+
+ /// <include file='doc\FontFamily.uex' path='docs/doc[@for="FontFamily.GetLineSpacing"]/*' />
+ /// <devdoc>
+ /// Returns the distance between two
+ /// consecutive lines of text for this <see cref='System.Drawing.FontFamily'/> with the specified <see cref='System.Drawing.FontStyle'/>.
+ /// </devdoc>
+ public int GetLineSpacing(FontStyle style)
+ {
+ int result = 0;
+
+ int status = SafeNativeMethods.Gdip.GdipGetLineSpacing(new HandleRef(this, NativeFamily), style, out result);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return result;
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/FontStyle.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/FontStyle.cs
new file mode 100644
index 0000000000..ff4a9647ce
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/FontStyle.cs
@@ -0,0 +1,50 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*
+* font style constants (sdkinc\GDIplusEnums.h)
+*/
+
+namespace System.Drawing
+{
+ /// <include file='doc\FontStyle.uex' path='docs/doc[@for="FontStyle"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies style information applied to
+ /// text.
+ /// </para>
+ /// </devdoc>
+ [
+ Flags
+ ]
+ public enum FontStyle
+ {
+ /// <include file='doc\FontStyle.uex' path='docs/doc[@for="FontStyle.Regular"]/*' />
+ /// <devdoc>
+ /// Normal text.
+ /// </devdoc>
+ Regular = 0,
+ /// <include file='doc\FontStyle.uex' path='docs/doc[@for="FontStyle.Bold"]/*' />
+ /// <devdoc>
+ /// Bold text.
+ /// </devdoc>
+ Bold = 1,
+ /// <include file='doc\FontStyle.uex' path='docs/doc[@for="FontStyle.Italic"]/*' />
+ /// <devdoc>
+ /// Italic text.
+ /// </devdoc>
+ Italic = 2,
+ /// <include file='doc\FontStyle.uex' path='docs/doc[@for="FontStyle.Underline"]/*' />
+ /// <devdoc>
+ /// Underlined text.
+ /// </devdoc>
+ Underline = 4,
+ /// <include file='doc\FontStyle.uex' path='docs/doc[@for="FontStyle.Strikeout"]/*' />
+ /// <devdoc>
+ /// Text with a line through the middle.
+ /// </devdoc>
+ Strikeout = 8,
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/FrameDimension.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/FrameDimension.cs
new file mode 100644
index 0000000000..39f7583f81
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/FrameDimension.cs
@@ -0,0 +1,103 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ /**
+ * frame dimension constants (used with Bitmap.FrameDimensionsList)
+ */
+ /// <include file='doc\FrameDimension.uex' path='docs/doc[@for="FrameDimension"]/*' />
+ /// <devdoc>
+ ///
+ /// </devdoc>
+ // [TypeConverterAttribute(typeof(FrameDimensionConverter))]
+ public sealed class FrameDimension
+ {
+ // Frame dimension GUIDs, from sdkinc\imgguids.h
+ private static FrameDimension s_time = new FrameDimension(new Guid("{6aedbd6d-3fb5-418a-83a6-7f45229dc872}"));
+ private static FrameDimension s_resolution = new FrameDimension(new Guid("{84236f7b-3bd3-428f-8dab-4ea1439ca315}"));
+ private static FrameDimension s_page = new FrameDimension(new Guid("{7462dc86-6180-4c7e-8e3f-ee7333a7a483}"));
+
+ private Guid _guid;
+
+ /// <include file='doc\FrameDimension.uex' path='docs/doc[@for="FrameDimension.FrameDimension"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.FrameDimension'/> class with the specified GUID.
+ /// </devdoc>
+ public FrameDimension(Guid guid)
+ {
+ _guid = guid;
+ }
+
+ /// <include file='doc\FrameDimension.uex' path='docs/doc[@for="FrameDimension.Guid"]/*' />
+ /// <devdoc>
+ /// Specifies a global unique identifier (GUID)
+ /// that represents this <see cref='System.Drawing.Imaging.FrameDimension'/>.
+ /// </devdoc>
+ public Guid Guid
+ {
+ get { return _guid; }
+ }
+
+ /// <include file='doc\FrameDimension.uex' path='docs/doc[@for="FrameDimension.Time"]/*' />
+ /// <devdoc>
+ /// The time dimension.
+ /// </devdoc>
+ public static FrameDimension Time
+ {
+ get { return s_time; }
+ }
+
+ /// <include file='doc\FrameDimension.uex' path='docs/doc[@for="FrameDimension.Resolution"]/*' />
+ /// <devdoc>
+ /// The resolution dimension.
+ /// </devdoc>
+ public static FrameDimension Resolution
+ {
+ get { return s_resolution; }
+ }
+
+ /// <include file='doc\FrameDimension.uex' path='docs/doc[@for="FrameDimension.Page"]/*' />
+ /// <devdoc>
+ /// The page dimension.
+ /// </devdoc>
+ public static FrameDimension Page
+ {
+ get { return s_page; }
+ }
+ /// <include file='doc\FrameDimension.uex' path='docs/doc[@for="FrameDimension.Equals"]/*' />
+ /// <devdoc>
+ /// Returns a value indicating whether the
+ /// specified object is an <see cref='System.Drawing.Imaging.FrameDimension'/> equivalent to this <see cref='System.Drawing.Imaging.FrameDimension'/>.
+ /// </devdoc>
+ public override bool Equals(object o)
+ {
+ FrameDimension format = o as FrameDimension;
+ if (format == null)
+ return false;
+ return _guid == format._guid;
+ }
+
+ /// <include file='doc\FrameDimension.uex' path='docs/doc[@for="FrameDimension.GetHashCode"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public override int GetHashCode()
+ {
+ return _guid.GetHashCode();
+ }
+
+ /// <include file='doc\FrameDimension.uex' path='docs/doc[@for="FrameDimension.ToString"]/*' />
+ /// <devdoc>
+ /// Converts this <see cref='System.Drawing.Imaging.FrameDimension'/> to a human-readable string.
+ /// </devdoc>
+ public override string ToString()
+ {
+ if (this == s_time) return "Time";
+ if (this == s_resolution) return "Resolution";
+ if (this == s_page) return "Page";
+ return "[FrameDimension: " + _guid + "]";
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/GPPOINT.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/GPPOINT.cs
new file mode 100644
index 0000000000..a356967aae
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/GPPOINT.cs
@@ -0,0 +1,36 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Internal
+{
+ using System.Runtime.InteropServices;
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal class GPPOINT
+ {
+ internal int X;
+ internal int Y;
+
+ internal GPPOINT()
+ {
+ }
+
+ internal GPPOINT(PointF pt)
+ {
+ X = (int)pt.X;
+ Y = (int)pt.Y;
+ }
+
+ internal GPPOINT(Point pt)
+ {
+ X = pt.X;
+ Y = pt.Y;
+ }
+
+ internal PointF ToPoint()
+ {
+ return new PointF(X, Y);
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/GPPOINTF.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/GPPOINTF.cs
new file mode 100644
index 0000000000..2265b13dc3
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/GPPOINTF.cs
@@ -0,0 +1,36 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Internal
+{
+ using System.Runtime.InteropServices;
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal class GPPOINTF
+ {
+ internal float X;
+ internal float Y;
+
+ internal GPPOINTF()
+ {
+ }
+
+ internal GPPOINTF(PointF pt)
+ {
+ X = pt.X;
+ Y = pt.Y;
+ }
+
+ internal GPPOINTF(Point pt)
+ {
+ X = (float)pt.X;
+ Y = (float)pt.Y;
+ }
+
+ internal PointF ToPoint()
+ {
+ return new PointF(X, Y);
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/GPRECT.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/GPRECT.cs
new file mode 100644
index 0000000000..321316f08d
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/GPRECT.cs
@@ -0,0 +1,38 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Internal
+{
+ using System.Runtime.InteropServices;
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct GPRECT
+ {
+ internal int X;
+ internal int Y;
+ internal int Width;
+ internal int Height;
+
+ internal GPRECT(int x, int y, int width, int height)
+ {
+ X = x;
+ Y = y;
+ Width = width;
+ Height = height;
+ }
+
+ internal GPRECT(Rectangle rect)
+ {
+ X = rect.X;
+ Y = rect.Y;
+ Width = rect.Width;
+ Height = rect.Height;
+ }
+
+ internal Rectangle ToRectangle()
+ {
+ return new Rectangle(X, Y, Width, Height);
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/GPRECTF.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/GPRECTF.cs
new file mode 100644
index 0000000000..59805efa30
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/GPRECTF.cs
@@ -0,0 +1,46 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Internal
+{
+ using System.Runtime.InteropServices;
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct GPRECTF
+ {
+ internal float X;
+ internal float Y;
+ internal float Width;
+ internal float Height;
+
+ internal GPRECTF(float x, float y, float width, float height)
+ {
+ X = x;
+ Y = y;
+ Width = width;
+ Height = height;
+ }
+
+ internal GPRECTF(RectangleF rect)
+ {
+ X = rect.X;
+ Y = rect.Y;
+ Width = rect.Width;
+ Height = rect.Height;
+ }
+
+ internal SizeF SizeF
+ {
+ get
+ {
+ return new SizeF(Width, Height);
+ }
+ }
+
+ internal RectangleF ToRectangleF()
+ {
+ return new RectangleF(X, Y, Width, Height);
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/GPStream.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/GPStream.cs
new file mode 100644
index 0000000000..32bbb36d7b
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/GPStream.cs
@@ -0,0 +1,277 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Internal
+{
+ using System.IO;
+ using System.Runtime.InteropServices;
+ using System.Security.Permissions;
+
+ internal class GPStream : UnsafeNativeMethods.IStream
+ {
+ protected Stream dataStream;
+
+ // to support seeking ahead of the stream length...
+ private long _virtualPosition = -1;
+
+ internal GPStream(Stream stream)
+ {
+ if (!stream.CanSeek)
+ {
+ const int ReadBlock = 256;
+ byte[] bytes = new byte[ReadBlock];
+ int readLen;
+ int current = 0;
+ do
+ {
+ if (bytes.Length < current + ReadBlock)
+ {
+ byte[] newData = new byte[bytes.Length * 2];
+ Array.Copy(bytes, newData, bytes.Length);
+ bytes = newData;
+ }
+ readLen = stream.Read(bytes, current, ReadBlock);
+ current += readLen;
+ } while (readLen != 0);
+
+ dataStream = new MemoryStream(bytes);
+ }
+ else
+ {
+ dataStream = stream;
+ }
+ }
+
+ private void ActualizeVirtualPosition()
+ {
+ if (_virtualPosition == -1) return;
+
+ if (_virtualPosition > dataStream.Length)
+ dataStream.SetLength(_virtualPosition);
+
+ dataStream.Position = _virtualPosition;
+
+ _virtualPosition = -1;
+ }
+
+ public virtual UnsafeNativeMethods.IStream Clone()
+ {
+ NotImplemented();
+ return null;
+ }
+
+ public virtual void Commit(int grfCommitFlags)
+ {
+ dataStream.Flush();
+ // Extend the length of the file if needed.
+ ActualizeVirtualPosition();
+ }
+
+ [
+ UIPermission(SecurityAction.Demand, Window = UIPermissionWindow.AllWindows),
+ SecurityPermission(SecurityAction.Assert, Flags = SecurityPermissionFlag.UnmanagedCode)
+ ]
+ public virtual long CopyTo(UnsafeNativeMethods.IStream pstm, long cb, long[] pcbRead)
+ {
+ int bufsize = 4096; // one page
+ IntPtr buffer = Marshal.AllocHGlobal(bufsize);
+ if (buffer == IntPtr.Zero) throw new OutOfMemoryException();
+ long written = 0;
+ try
+ {
+ while (written < cb)
+ {
+ int toRead = bufsize;
+ if (written + toRead > cb) toRead = (int)(cb - written);
+ int read = Read(buffer, toRead);
+ if (read == 0) break;
+ if (pstm.Write(buffer, read) != read)
+ {
+ throw EFail("Wrote an incorrect number of bytes");
+ }
+ written += read;
+ }
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buffer);
+ }
+ if (pcbRead != null && pcbRead.Length > 0)
+ {
+ pcbRead[0] = written;
+ }
+
+ return written;
+ }
+
+ public virtual Stream GetDataStream()
+ {
+ return dataStream;
+ }
+
+ public virtual void LockRegion(long libOffset, long cb, int dwLockType)
+ {
+ }
+
+ protected static ExternalException EFail(string msg)
+ {
+ throw new ExternalException(msg, SafeNativeMethods.E_FAIL);
+ }
+
+ protected static void NotImplemented()
+ {
+ throw new ExternalException(SR.Format(SR.NotImplemented), SafeNativeMethods.E_NOTIMPL);
+ }
+
+ public virtual int Read(IntPtr buf, /* cpr: int offset,*/ int length)
+ {
+ // System.Text.Out.WriteLine("IStream::Read(" + length + ")");
+ byte[] buffer = new byte[length];
+ int count = Read(buffer, length);
+ Marshal.Copy(buffer, 0, buf, length);
+ return count;
+ }
+
+ public virtual int Read(byte[] buffer, /* cpr: int offset,*/ int length)
+ {
+ ActualizeVirtualPosition();
+ return dataStream.Read(buffer, 0, length);
+ }
+
+ public virtual void Revert()
+ {
+ NotImplemented();
+ }
+
+ public virtual long Seek(long offset, int origin)
+ {
+ // Console.WriteLine("IStream::Seek("+ offset + ", " + origin + ")");
+ long pos = _virtualPosition;
+ if (_virtualPosition == -1)
+ {
+ pos = dataStream.Position;
+ }
+ long len = dataStream.Length;
+ switch (origin)
+ {
+ case SafeNativeMethods.StreamConsts.STREAM_SEEK_SET:
+ if (offset <= len)
+ {
+ dataStream.Position = offset;
+ _virtualPosition = -1;
+ }
+ else
+ {
+ _virtualPosition = offset;
+ }
+ break;
+ case SafeNativeMethods.StreamConsts.STREAM_SEEK_END:
+ if (offset <= 0)
+ {
+ dataStream.Position = len + offset;
+ _virtualPosition = -1;
+ }
+ else
+ {
+ _virtualPosition = len + offset;
+ }
+ break;
+ case SafeNativeMethods.StreamConsts.STREAM_SEEK_CUR:
+ if (offset + pos <= len)
+ {
+ dataStream.Position = pos + offset;
+ _virtualPosition = -1;
+ }
+ else
+ {
+ _virtualPosition = offset + pos;
+ }
+ break;
+ }
+ if (_virtualPosition != -1)
+ {
+ return _virtualPosition;
+ }
+ else
+ {
+ return dataStream.Position;
+ }
+ }
+
+ public virtual void SetSize(long value)
+ {
+ dataStream.SetLength(value);
+ }
+
+ public void Stat(IntPtr pstatstg, int grfStatFlag)
+ {
+ STATSTG stats = new STATSTG();
+ stats.cbSize = dataStream.Length;
+ Marshal.StructureToPtr(stats, pstatstg, true);
+ }
+
+ public virtual void UnlockRegion(long libOffset, long cb, int dwLockType)
+ {
+ }
+
+ public virtual int Write(IntPtr buf, /* cpr: int offset,*/ int length)
+ {
+ byte[] buffer = new byte[length];
+ Marshal.Copy(buf, buffer, 0, length);
+ return Write(buffer, length);
+ }
+
+ public virtual int Write(byte[] buffer, /* cpr: int offset,*/ int length)
+ {
+ ActualizeVirtualPosition();
+ dataStream.Write(buffer, 0, length);
+ return length;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ public class STATSTG
+ {
+ public IntPtr pwcsName = IntPtr.Zero;
+ public int type;
+ [MarshalAs(UnmanagedType.I8)]
+ public long cbSize;
+ [MarshalAs(UnmanagedType.I8)]
+ public long mtime;
+ [MarshalAs(UnmanagedType.I8)]
+ public long ctime;
+ [MarshalAs(UnmanagedType.I8)]
+ public long atime;
+ [MarshalAs(UnmanagedType.I4)]
+ public int grfMode;
+ [MarshalAs(UnmanagedType.I4)]
+ public int grfLocksSupported;
+
+ public int clsid_data1;
+ [MarshalAs(UnmanagedType.I2)]
+ public short clsid_data2;
+ [MarshalAs(UnmanagedType.I2)]
+ public short clsid_data3;
+ [MarshalAs(UnmanagedType.U1)]
+ public byte clsid_b0;
+ [MarshalAs(UnmanagedType.U1)]
+ public byte clsid_b1;
+ [MarshalAs(UnmanagedType.U1)]
+ public byte clsid_b2;
+ [MarshalAs(UnmanagedType.U1)]
+ public byte clsid_b3;
+ [MarshalAs(UnmanagedType.U1)]
+ public byte clsid_b4;
+ [MarshalAs(UnmanagedType.U1)]
+ public byte clsid_b5;
+ [MarshalAs(UnmanagedType.U1)]
+ public byte clsid_b6;
+ [MarshalAs(UnmanagedType.U1)]
+ public byte clsid_b7;
+ [MarshalAs(UnmanagedType.I4)]
+ public int grfStateBits;
+ [MarshalAs(UnmanagedType.I4)]
+ public int reserved;
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/Gdiplus.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/Gdiplus.cs
new file mode 100644
index 0000000000..8c38be40f8
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/Gdiplus.cs
@@ -0,0 +1,4736 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+BITMAP.bmBits")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+DIBSECTION.dshSection")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+Gdip.initToken")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+Gdip+StartupInput.DebugEventCallback")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+Gdip+StartupOutput.hook")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+Gdip+StartupOutput.unhook")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+ICONINFO.hbmColor")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+ICONINFO.hbmMask")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+MSG.hwnd")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+MSG.lParam")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+MSG.wParam")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+OBJECTHEADER.pInfo")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PICTDESC.union1")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLG.hDC")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLG.hDevMode")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLG.hDevNames")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLG.hInstance")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLG.hPrintTemplate")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLG.hSetupTemplate")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLG.hwndOwner")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLG.lCustData")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLGX86.hDC")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLGX86.hDevMode")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLGX86.hDevNames")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLGX86.hInstance")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLGX86.hPrintTemplate")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLGX86.hSetupTemplate")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLGX86.hwndOwner")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLGX86.lCustData")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.Drawing.SafeNativeMethods+StreamConsts..ctor()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.Drawing.SafeNativeMethods+POINT..ctor()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.Drawing.SafeNativeMethods+LOGPEN..ctor()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.Drawing.SafeNativeMethods+DIBSECTION..ctor()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.Drawing.SafeNativeMethods..ctor()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.Drawing.SafeNativeMethods+Ole..ctor()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.Drawing.SafeNativeMethods+CommonHandles..ctor()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "System.Drawing.SafeNativeMethods+CommonHandles")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "System.Drawing.SafeNativeMethods+ENHMETAHEADER")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "System.Drawing.SafeNativeMethods+StreamConsts")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "System.Drawing.SafeNativeMethods+Ole")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "System.Drawing.SafeNativeMethods+Gdip")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.Drawing.SafeNativeMethods+ENHMETAHEADER..ctor()")]
+
+
+
+
+
+namespace System.Drawing
+{
+ using System.Internal;
+ using System.Text;
+ using System.Collections;
+ using System.Runtime.InteropServices;
+ using System.ComponentModel;
+ using System.Diagnostics;
+ using System.Diagnostics.CodeAnalysis;
+ using System;
+ using System.IO;
+ using Microsoft.Win32;
+ using System.Drawing;
+ using System.Drawing.Internal;
+ using System.Drawing.Imaging;
+ using System.Drawing.Text;
+ using System.Drawing.Drawing2D;
+ using System.Threading;
+ using System.Security.Permissions;
+ using System.Security;
+ using System.Runtime.ConstrainedExecution;
+ using System.Globalization;
+ using System.Runtime.Versioning;
+
+ [System.Security.SuppressUnmanagedCodeSecurityAttribute()]
+ internal class SafeNativeMethods
+ {
+ // we make this a nested class so that we don't have to initialize GDI+ to access SafeNativeMethods (mostly gdi/user32)
+ [System.Security.SuppressUnmanagedCodeSecurityAttribute()]
+ internal class Gdip
+ {
+ private static readonly TraceSwitch s_gdiPlusInitialization = new TraceSwitch("GdiPlusInitialization", "Tracks GDI+ initialization and teardown");
+
+ private static IntPtr s_initToken;
+ private const string ThreadDataSlotName = "system.drawing.threaddata";
+
+ static Gdip()
+ {
+ Initialize();
+ }
+
+ /// <devdoc>
+ /// Returns true if GDI+ has been started, but not shut down
+ /// </devdoc>
+ private static bool Initialized
+ {
+ get
+ {
+ return s_initToken != IntPtr.Zero;
+ }
+ }
+
+ /// <devdoc>
+ /// This property will give us back a hashtable we can use to store
+ /// all of our static brushes and pens on a per-thread basis. This way
+ /// we can avoid 'object in use' crashes when different threads are
+ /// referencing the same drawing object.
+ /// </devdoc>
+ internal static IDictionary ThreadData
+ {
+ get
+ {
+ LocalDataStoreSlot slot = Thread.GetNamedDataSlot(ThreadDataSlotName);
+ IDictionary threadData = (IDictionary)Thread.GetData(slot);
+ if (threadData == null)
+ {
+ threadData = new Hashtable();
+ Thread.SetData(slot, threadData);
+ }
+ return threadData;
+ }
+ }
+
+ // Clean up thread data
+ //
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ private static void ClearThreadData()
+ {
+ Debug.WriteLineIf(s_gdiPlusInitialization.TraceVerbose, "Releasing TLS data");
+ LocalDataStoreSlot slot = Thread.GetNamedDataSlot(ThreadDataSlotName);
+ Thread.SetData(slot, null);
+ }
+
+ /// <devdoc>
+ /// Initializes GDI+
+ /// This should only be called by our constructor (static), we do not expect multiple calls per domain
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1804:RemoveUnusedLocals")]
+ private static void Initialize()
+ {
+ Debug.Assert(s_initToken == IntPtr.Zero, "GdiplusInitialization: Initialize should not be called more than once in the same domain!");
+ Debug.WriteLineIf(s_gdiPlusInitialization.TraceVerbose, "Initialize GDI+ [" + AppDomain.CurrentDomain.FriendlyName + "]");
+ Debug.Indent();
+
+ StartupInput input = StartupInput.GetDefault();
+ StartupOutput output;
+
+ // GDI+ ref counts multiple calls to Startup in the same process, so calls from multiple
+ // domains are ok, just make sure to pair each w/GdiplusShutdown
+ int status = GdiplusStartup(out s_initToken, ref input, out output);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ Debug.Unindent();
+
+ // Sync to event for handling shutdown
+ AppDomain currentDomain = AppDomain.CurrentDomain;
+ currentDomain.ProcessExit += new EventHandler(SafeNativeMethods.Gdip.OnProcessExit);
+
+ // Also sync to DomainUnload for non-default domains since they will not get a ProcessExit if
+ // they are unloaded prior to ProcessExit (and this object's static fields are scoped to AppDomains,
+ // so we must cleanup on AppDomain shutdown)
+ if (!currentDomain.IsDefaultAppDomain())
+ {
+ currentDomain.DomainUnload += new EventHandler(SafeNativeMethods.Gdip.OnProcessExit);
+ }
+ }
+
+ /// <devdoc>
+ /// Shutsdown GDI+
+ /// </devdoc>
+ private static void Shutdown()
+ {
+ Debug.WriteLineIf(s_gdiPlusInitialization.TraceVerbose, "Shutdown GDI+ [" + AppDomain.CurrentDomain.FriendlyName + "]");
+ Debug.Indent();
+
+ if (Initialized)
+ {
+ Debug.WriteLineIf(s_gdiPlusInitialization.TraceVerbose, "Not already shutdown");
+
+ ClearThreadData();
+
+ // Due to conditions at shutdown, we can't be sure all objects will be finalized here: e.g. a Global variable
+ // in the application/domain may still be holding a GDI+ object. If so, calling GdiplusShutdown will free the GDI+ heap,
+ // causing AppVerifier exceptions due to active crit sections.
+ // For now, we will simply not call shutdown, the resultant heap leak should occur most often during shutdown anyway.
+ // If GDI+ moves their allocations to the standard heap we can revisit.
+
+#if GDIP_SHUTDOWN
+ // Let any thread data collect and finalize before
+ // we tear down GDI+
+ //
+ Debug.WriteLineIf(GdiPlusInitialization.TraceVerbose, "Running garbage collector");
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ GC.Collect();
+
+ // Shutdown GDI+
+ //
+ Debug.WriteLineIf(GdiPlusInitialization.TraceVerbose, "Instruct GDI+ to shutdown");
+
+ GdiplusShutdown(new HandleRef(null, initToken));
+ initToken = IntPtr.Zero;
+#endif
+
+ // unhook our shutdown handlers as we do not need to shut down more than once
+ AppDomain currentDomain = AppDomain.CurrentDomain;
+ currentDomain.ProcessExit -= new EventHandler(SafeNativeMethods.Gdip.OnProcessExit);
+ if (!currentDomain.IsDefaultAppDomain())
+ {
+ currentDomain.DomainUnload -= new EventHandler(SafeNativeMethods.Gdip.OnProcessExit);
+ }
+ }
+ Debug.Unindent();
+ }
+
+
+ // When we get notification that the process/domain is terminating, we will
+ // try to shutdown GDI+ if we haven't already.
+ //
+ [PrePrepareMethod]
+ private static void OnProcessExit(object sender, EventArgs e)
+ {
+ Debug.WriteLineIf(s_gdiPlusInitialization.TraceVerbose, "Process exited");
+ Shutdown();
+ }
+
+ // Fix for Dev10 560430. When we call it in static constructor of other classes,
+ // JIT will make sure the static constructor of Gdip has been called before,
+ // and GDI+ has been initialized.
+ internal static void DummyFunction()
+ {
+ }
+
+ //----------------------------------------------------------------------------------------
+ // Initialization methods (GdiplusInit.h)
+ //----------------------------------------------------------------------------------------
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ private static extern int GdiplusStartup(out IntPtr token, ref StartupInput input, out StartupOutput output);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ private static extern void GdiplusShutdown(HandleRef token);
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct StartupInput
+ {
+ public int GdiplusVersion; // Must be 1
+
+ // public DebugEventProc DebugEventCallback; // Ignored on free builds
+ public IntPtr DebugEventCallback;
+
+ public bool SuppressBackgroundThread; // FALSE unless you're prepared to call
+ // the hook/unhook functions properly
+
+ public bool SuppressExternalCodecs; // FALSE unless you want GDI+ only to use
+ // its internal image codecs.
+
+ public static StartupInput GetDefault()
+ {
+ StartupInput result = new StartupInput();
+ result.GdiplusVersion = 1;
+ // result.DebugEventCallback = null;
+ result.SuppressBackgroundThread = false;
+ result.SuppressExternalCodecs = false;
+ return result;
+ }
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct StartupOutput
+ {
+ // The following 2 fields won't be used. They were originally intended
+ // for getting GDI+ to run on our thread - however there are marshalling
+ // dealing with function *'s and what not - so we make explicit calls
+ // to gdi+ after the fact, via the GdiplusNotificationHook and
+ // GdiplusNotificationUnhook methods.
+ public IntPtr hook;//not used
+ public IntPtr unhook;//not used.
+ }
+
+ private enum DebugEventLevel
+ {
+ Fatal,
+ Warning,
+ }
+
+
+ // private delegate void DebugEventProc(DebugEventLevel level, /* char* */ string message);
+
+ //----------------------------------------------------------------------------------------
+ // Path methods
+ //----------------------------------------------------------------------------------------
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreatePath(int brushMode, out IntPtr path);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreatePath2(HandleRef points, HandleRef types, int count, int brushMode, out IntPtr path);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreatePath2I(HandleRef points, HandleRef types, int count, int brushMode, out IntPtr path);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipClonePath(HandleRef path, out IntPtr clonepath);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, EntryPoint = "GdipDeletePath", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ private static extern int IntGdipDeletePath(HandleRef path);
+ internal static int GdipDeletePath(HandleRef path)
+ {
+ if (!Initialized) return SafeNativeMethods.Gdip.Ok;
+ int result = IntGdipDeletePath(path);
+ return result;
+ }
+
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipResetPath(HandleRef path);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPointCount(HandleRef path, out int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPathTypes(HandleRef path, byte[] types, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPathPoints(HandleRef path, HandleRef points, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPathFillMode(HandleRef path, out int fillmode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPathFillMode(HandleRef path, int fillmode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPathData(HandleRef path, IntPtr pathData);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipStartPathFigure(HandleRef path);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipClosePathFigure(HandleRef path);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipClosePathFigures(HandleRef path);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPathMarker(HandleRef path);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipClearPathMarkers(HandleRef path);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipReversePath(HandleRef path);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPathLastPoint(HandleRef path, GPPOINTF lastPoint);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathLine(HandleRef path, float x1, float y1, float x2,
+ float y2);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathLine2(HandleRef path, HandleRef memorypts, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathArc(HandleRef path, float x, float y, float width,
+ float height, float startAngle,
+ float sweepAngle);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathBezier(HandleRef path, float x1, float y1, float x2,
+ float y2, float x3, float y3, float x4,
+ float y4);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathBeziers(HandleRef path, HandleRef memorypts, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathCurve(HandleRef path, HandleRef memorypts, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathCurve2(HandleRef path, HandleRef memorypts, int count,
+ float tension);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathCurve3(HandleRef path, HandleRef memorypts, int count,
+ int offset, int numberOfSegments,
+ float tension);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathClosedCurve(HandleRef path, HandleRef memorypts,
+ int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathClosedCurve2(HandleRef path, HandleRef memorypts,
+ int count, float tension);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathRectangle(HandleRef path, float x, float y, float width,
+ float height);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathRectangles(HandleRef path, HandleRef rects, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathEllipse(HandleRef path, float x, float y,
+ float width, float height);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathPie(HandleRef path, float x, float y, float width,
+ float height, float startAngle,
+ float sweepAngle);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathPolygon(HandleRef path, HandleRef memorypts, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathPath(HandleRef path, HandleRef addingPath, bool connect);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathString(HandleRef path, string s, int length,
+ HandleRef fontFamily, int style, float emSize,
+ ref GPRECTF layoutRect, HandleRef format);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathStringI(HandleRef path, string s, int length,
+ HandleRef fontFamily, int style, float emSize,
+ ref GPRECT layoutRect, HandleRef format);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathLineI(HandleRef path, int x1, int y1, int x2,
+ int y2);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathLine2I(HandleRef path, HandleRef memorypts, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathArcI(HandleRef path, int x, int y, int width,
+ int height, float startAngle,
+ float sweepAngle);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathBezierI(HandleRef path, int x1, int y1, int x2,
+ int y2, int x3, int y3, int x4,
+ int y4);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathBeziersI(HandleRef path, HandleRef memorypts, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathCurveI(HandleRef path, HandleRef memorypts, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathCurve2I(HandleRef path, HandleRef memorypts, int count,
+ float tension);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathCurve3I(HandleRef path, HandleRef memorypts, int count,
+ int offset, int numberOfSegments,
+ float tension);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathClosedCurveI(HandleRef path, HandleRef memorypts,
+ int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathClosedCurve2I(HandleRef path, HandleRef memorypts,
+ int count, float tension);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathRectangleI(HandleRef path, int x, int y, int width,
+ int height);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathRectanglesI(HandleRef path, HandleRef rects, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathEllipseI(HandleRef path, int x, int y,
+ int width, int height);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathPieI(HandleRef path, int x, int y, int width,
+ int height, float startAngle,
+ float sweepAngle);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipAddPathPolygonI(HandleRef path, HandleRef memorypts, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipFlattenPath(HandleRef path, HandleRef matrixfloat, float flatness);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipWidenPath(HandleRef path, HandleRef pen, HandleRef matrix, float flatness);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipWarpPath(HandleRef path, HandleRef matrix, HandleRef points, int count,
+ float srcX, float srcY, float srcWidth, float srcHeight,
+ WarpMode warpMode, float flatness);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipTransformPath(HandleRef path, HandleRef matrix);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPathWorldBounds(HandleRef path, ref GPRECTF gprectf, HandleRef matrix, HandleRef pen);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipIsVisiblePathPoint(HandleRef path, float x, float y,
+ HandleRef graphics, out int boolean);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipIsVisiblePathPointI(HandleRef path, int x, int y,
+ HandleRef graphics, out int boolean);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipIsOutlineVisiblePathPoint(HandleRef path, float x, float y, HandleRef pen,
+ HandleRef graphics, out int boolean);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipIsOutlineVisiblePathPointI(HandleRef path, int x, int y, HandleRef pen,
+ HandleRef graphics, out int boolean);
+
+ //----------------------------------------------------------------------------------------
+ // GraphicsPath Enumeration methods
+ //----------------------------------------------------------------------------------------
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreatePathIter(out IntPtr pathIter, HandleRef path);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, EntryPoint = "GdipDeletePathIter", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ private static extern int IntGdipDeletePathIter(HandleRef pathIter);
+ internal static int GdipDeletePathIter(HandleRef pathIter)
+ {
+ if (!Initialized) return SafeNativeMethods.Gdip.Ok;
+ int result = IntGdipDeletePathIter(pathIter);
+ return result;
+ }
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipPathIterNextSubpath(HandleRef pathIter, out int resultCount,
+ out int startIndex, out int endIndex, out bool isClosed);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipPathIterNextSubpathPath(HandleRef pathIter, out int resultCount,
+ HandleRef path, out bool isClosed);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipPathIterNextPathType(HandleRef pathIter, out int resultCount,
+ out byte pathType, out int startIndex,
+ out int endIndex);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipPathIterNextMarker(HandleRef pathIter, out int resultCount,
+ out int startIndex, out int endIndex);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipPathIterNextMarkerPath(HandleRef pathIter, out int resultCount,
+ HandleRef path);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipPathIterGetCount(HandleRef pathIter, out int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipPathIterGetSubpathCount(HandleRef pathIter, out int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipPathIterHasCurve(HandleRef pathIter, out bool hasCurve);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipPathIterRewind(HandleRef pathIter);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipPathIterEnumerate(HandleRef pathIter, out int resultCount,
+ IntPtr memoryPts, [In, Out] byte[] types, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipPathIterCopyData(HandleRef pathIter, out int resultCount,
+ IntPtr memoryPts, [In, Out] byte[] types, int startIndex,
+ int endIndex);
+
+ //----------------------------------------------------------------------------------------
+ // Matrix methods
+ //----------------------------------------------------------------------------------------
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateMatrix(out IntPtr matrix);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateMatrix2(float m11, float m12,
+ float m21, float m22, float dx,
+ float dy, out IntPtr matrix);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateMatrix3(ref GPRECTF rect, HandleRef dstplg, out IntPtr matrix);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateMatrix3I(ref GPRECT rect, HandleRef dstplg, out IntPtr matrix);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCloneMatrix(HandleRef matrix, out IntPtr cloneMatrix);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, EntryPoint = "GdipDeleteMatrix", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ private static extern int IntGdipDeleteMatrix(HandleRef matrix);
+ internal static int GdipDeleteMatrix(HandleRef matrix)
+ {
+ if (!Initialized) return SafeNativeMethods.Gdip.Ok;
+ int result = IntGdipDeleteMatrix(matrix);
+ return result;
+ }
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetMatrixElements(HandleRef matrix, float m11,
+ float m12, float m21,
+ float m22, float dx, float dy);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipMultiplyMatrix(HandleRef matrix, HandleRef matrix2, MatrixOrder order);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipTranslateMatrix(HandleRef matrix, float offsetX,
+ float offsetY, MatrixOrder order);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipScaleMatrix(HandleRef matrix, float scaleX, float scaleY, MatrixOrder order);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipRotateMatrix(HandleRef matrix, float angle, MatrixOrder order);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipShearMatrix(HandleRef matrix, float shearX, float shearY, MatrixOrder order);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipInvertMatrix(HandleRef matrix);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipTransformMatrixPoints(HandleRef matrix, HandleRef pts, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipTransformMatrixPointsI(HandleRef matrix, HandleRef pts, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipVectorTransformMatrixPoints(HandleRef matrix, HandleRef pts,
+ int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipVectorTransformMatrixPointsI(HandleRef matrix, HandleRef pts,
+ int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetMatrixElements(HandleRef matrix, IntPtr m);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipIsMatrixInvertible(HandleRef matrix, out int boolean);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipIsMatrixIdentity(HandleRef matrix, out int boolean);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipIsMatrixEqual(HandleRef matrix, HandleRef matrix2,
+ out int boolean);
+
+ //----------------------------------------------------------------------------------------
+ // Region methods
+ //----------------------------------------------------------------------------------------
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateRegion(out IntPtr region);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateRegionRect(ref GPRECTF gprectf, out IntPtr region);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateRegionRectI(ref GPRECT gprect, out IntPtr region);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateRegionPath(HandleRef path, out IntPtr region);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateRegionRgnData(byte[] rgndata, int size, out IntPtr region);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateRegionHrgn(HandleRef hRgn, out IntPtr region);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCloneRegion(HandleRef region, out IntPtr cloneregion);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, EntryPoint = "GdipDeleteRegion", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ private static extern int IntGdipDeleteRegion(HandleRef region);
+ internal static int GdipDeleteRegion(HandleRef region)
+ {
+ if (!Initialized) return SafeNativeMethods.Gdip.Ok;
+ int result = IntGdipDeleteRegion(region);
+ return result;
+ }
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetInfinite(HandleRef region);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetEmpty(HandleRef region);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCombineRegionRect(HandleRef region, ref GPRECTF gprectf, CombineMode mode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCombineRegionRectI(HandleRef region, ref GPRECT gprect, CombineMode mode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCombineRegionPath(HandleRef region, HandleRef path, CombineMode mode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCombineRegionRegion(HandleRef region, HandleRef region2, CombineMode mode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipTranslateRegion(HandleRef region, float dx, float dy);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipTranslateRegionI(HandleRef region, int dx, int dy);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipTransformRegion(HandleRef region, HandleRef matrix);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetRegionBounds(HandleRef region, HandleRef graphics, ref GPRECTF gprectf);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetRegionHRgn(HandleRef region, HandleRef graphics, out IntPtr hrgn);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipIsEmptyRegion(HandleRef region, HandleRef graphics, out int boolean);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipIsInfiniteRegion(HandleRef region, HandleRef graphics, out int boolean);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipIsEqualRegion(HandleRef region, HandleRef region2, HandleRef graphics,
+ out int boolean);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetRegionDataSize(HandleRef region, out int bufferSize);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetRegionData(HandleRef region,
+ byte[] regionData,
+ int bufferSize,
+ out int sizeFilled);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipIsVisibleRegionPoint(HandleRef region, float X, float Y,
+ HandleRef graphics, out int boolean);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipIsVisibleRegionPointI(HandleRef region, int X, int Y,
+ HandleRef graphics, out int boolean);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipIsVisibleRegionRect(HandleRef region, float X, float Y,
+ float width, float height,
+ HandleRef graphics, out int boolean);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipIsVisibleRegionRectI(HandleRef region, int X, int Y,
+ int width, int height,
+ HandleRef graphics, out int boolean);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetRegionScansCount(HandleRef region, out int count, HandleRef matrix);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetRegionScans(HandleRef region, IntPtr rects, out int count, HandleRef matrix);
+
+
+ //----------------------------------------------------------------------------------------
+ // Brush methods
+ //----------------------------------------------------------------------------------------
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCloneBrush(HandleRef brush, out IntPtr clonebrush);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, EntryPoint = "GdipDeleteBrush", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ private static extern int IntGdipDeleteBrush(HandleRef brush);
+ internal static int GdipDeleteBrush(HandleRef brush)
+ {
+ if (!Initialized) return SafeNativeMethods.Gdip.Ok;
+ int result = IntGdipDeleteBrush(brush);
+ return result;
+ }
+
+ //----------------------------------------------------------------------------------------
+ // Hatch Brush
+ //----------------------------------------------------------------------------------------
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateHatchBrush(int hatchstyle, int forecol, int backcol, out IntPtr brush);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetHatchStyle(HandleRef brush, out int hatchstyle);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetHatchForegroundColor(HandleRef brush, out int forecol);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetHatchBackgroundColor(HandleRef brush, out int backcol);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateTexture(HandleRef bitmap, int wrapmode, out IntPtr texture);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateTexture2(HandleRef bitmap, int wrapmode, float x,
+ float y, float width, float height,
+ out IntPtr texture);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateTextureIA(HandleRef bitmap, HandleRef imageAttrib,
+ float x, float y, float width, float height,
+ out IntPtr texture);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateTexture2I(HandleRef bitmap, int wrapmode, int x,
+ int y, int width, int height,
+ out IntPtr texture);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateTextureIAI(HandleRef bitmap, HandleRef imageAttrib,
+ int x, int y, int width, int height,
+ out IntPtr texture);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetTextureTransform(HandleRef brush, HandleRef matrix);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetTextureTransform(HandleRef brush, HandleRef matrix);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipResetTextureTransform(HandleRef brush);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipMultiplyTextureTransform(HandleRef brush,
+ HandleRef matrix,
+ MatrixOrder order);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipTranslateTextureTransform(HandleRef brush,
+ float dx,
+ float dy,
+ MatrixOrder order);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipScaleTextureTransform(HandleRef brush,
+ float sx,
+ float sy,
+ MatrixOrder order);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipRotateTextureTransform(HandleRef brush,
+ float angle,
+ MatrixOrder order);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetTextureWrapMode(HandleRef brush, int wrapMode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetTextureWrapMode(HandleRef brush, out int wrapMode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetTextureImage(HandleRef brush, out IntPtr image);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateSolidFill(int color, out IntPtr brush);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetSolidFillColor(HandleRef brush, int color);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetSolidFillColor(HandleRef brush, out int color);
+
+ //----------------------------------------------------------------------------------------
+ // Linear Gradient Brush
+ //----------------------------------------------------------------------------------------
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateLineBrush(GPPOINTF point1, GPPOINTF point2, int color1, int color2, int wrapMode, out IntPtr lineGradient);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateLineBrushI(GPPOINT point1, GPPOINT point2, int color1, int color2, int wrapMode, out IntPtr lineGradient);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateLineBrushFromRect(ref GPRECTF rect, int color1, int color2, int lineGradientMode, int wrapMode,
+ out IntPtr lineGradient);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateLineBrushFromRectI(ref GPRECT rect, int color1, int color2, int lineGradientMode, int wrapMode,
+ out IntPtr lineGradient);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateLineBrushFromRectWithAngle(ref GPRECTF rect, int color1, int color2, float angle, bool isAngleScaleable,
+ int wrapMode, out IntPtr lineGradient);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateLineBrushFromRectWithAngleI(ref GPRECT rect, int color1, int color2, float angle, bool isAngleScaleable,
+ int wrapMode, out IntPtr lineGradient);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetLineColors(HandleRef brush, int color1, int color2);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetLineColors(HandleRef brush, int[] colors);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetLineRect(HandleRef brush, ref GPRECTF gprectf);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetLineGammaCorrection(HandleRef brush, out bool useGammaCorrection);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetLineGammaCorrection(HandleRef brush, bool useGammaCorrection);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetLineSigmaBlend(HandleRef brush, float focus, float scale);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetLineLinearBlend(HandleRef brush, float focus, float scale);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetLineBlendCount(HandleRef brush, out int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetLineBlend(HandleRef brush, IntPtr blend, IntPtr positions, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetLineBlend(HandleRef brush, HandleRef blend, HandleRef positions, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetLinePresetBlendCount(HandleRef brush, out int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetLinePresetBlend(HandleRef brush, IntPtr blend, IntPtr positions, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetLinePresetBlend(HandleRef brush, HandleRef blend, HandleRef positions, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetLineWrapMode(HandleRef brush, int wrapMode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetLineWrapMode(HandleRef brush, out int wrapMode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipResetLineTransform(HandleRef brush);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipMultiplyLineTransform(HandleRef brush, HandleRef matrix, MatrixOrder order);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetLineTransform(HandleRef brush, HandleRef matrix);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetLineTransform(HandleRef brush, HandleRef matrix);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipTranslateLineTransform(HandleRef brush, float dx, float dy, MatrixOrder order);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipScaleLineTransform(HandleRef brush, float sx, float sy, MatrixOrder order);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipRotateLineTransform(HandleRef brush, float angle, MatrixOrder order);
+
+ //----------------------------------------------------------------------------------------
+ // Path Gradient Brush
+ //----------------------------------------------------------------------------------------
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreatePathGradient(HandleRef points, int count, int wrapMode, out IntPtr brush);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreatePathGradientI(HandleRef points, int count, int wrapMode, out IntPtr brush);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreatePathGradientFromPath(HandleRef path, out IntPtr brush);
+
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPathGradientCenterColor(HandleRef brush,
+ out int color);
+
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPathGradientCenterColor(HandleRef brush,
+ int color);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPathGradientSurroundColorsWithCount(HandleRef brush,
+ int[] color,
+ ref int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPathGradientSurroundColorsWithCount(HandleRef brush,
+ int[] argb,
+ ref int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPathGradientCenterPoint(HandleRef brush,
+ GPPOINTF point);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPathGradientCenterPoint(HandleRef brush,
+ GPPOINTF point);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPathGradientRect(HandleRef brush,
+ ref GPRECTF gprectf);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPathGradientPointCount(HandleRef brush,
+ out int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPathGradientSurroundColorCount(HandleRef brush,
+ out int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPathGradientBlendCount(HandleRef brush,
+ out int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPathGradientBlend(HandleRef brush,
+ IntPtr blend,
+ IntPtr positions,
+ int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPathGradientBlend(HandleRef brush,
+ HandleRef blend,
+ HandleRef positions,
+ int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPathGradientPresetBlendCount(HandleRef brush, out int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPathGradientPresetBlend(HandleRef brush, IntPtr blend,
+ IntPtr positions, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPathGradientPresetBlend(HandleRef brush, HandleRef blend,
+ HandleRef positions, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPathGradientSigmaBlend(HandleRef brush,
+ float focus,
+ float scale);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPathGradientLinearBlend(HandleRef brush,
+ float focus,
+ float scale);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPathGradientWrapMode(HandleRef brush,
+ int wrapmode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPathGradientWrapMode(HandleRef brush,
+ out int wrapmode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPathGradientTransform(HandleRef brush,
+ HandleRef matrix);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPathGradientTransform(HandleRef brush,
+ HandleRef matrix);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipResetPathGradientTransform(HandleRef brush);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipMultiplyPathGradientTransform(HandleRef brush, HandleRef matrix, MatrixOrder order);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipTranslatePathGradientTransform(HandleRef brush, float dx, float dy, MatrixOrder order);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipScalePathGradientTransform(HandleRef brush, float sx, float sy, MatrixOrder order);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipRotatePathGradientTransform(HandleRef brush, float angle, MatrixOrder order);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPathGradientFocusScales(HandleRef brush,
+ float[] xScale,
+ float[] yScale);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPathGradientFocusScales(HandleRef brush,
+ float xScale,
+ float yScale);
+
+ //----------------------------------------------------------------------------------------
+ // Pen methods
+ //----------------------------------------------------------------------------------------
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreatePen1(int argb, float width, int unit,
+ out IntPtr pen);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreatePen2(HandleRef brush, float width, int unit,
+ out IntPtr pen);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipClonePen(HandleRef pen, out IntPtr clonepen);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, EntryPoint = "GdipDeletePen", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ private static extern int IntGdipDeletePen(HandleRef Pen);
+ internal static int GdipDeletePen(HandleRef pen)
+ {
+ if (!Initialized) return SafeNativeMethods.Gdip.Ok;
+ int result = IntGdipDeletePen(pen);
+ return result;
+ }
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPenMode(HandleRef pen, PenAlignment penAlign);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPenMode(HandleRef pen, out PenAlignment penAlign);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPenWidth(HandleRef pen, float width);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPenWidth(HandleRef pen, float[] width);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPenLineCap197819(HandleRef pen, int startCap, int endCap, int dashCap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPenStartCap(HandleRef pen, int startCap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPenEndCap(HandleRef pen, int endCap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPenStartCap(HandleRef pen, out int startCap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPenEndCap(HandleRef pen, out int endCap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPenDashCap197819(HandleRef pen, out int dashCap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPenDashCap197819(HandleRef pen, int dashCap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPenLineJoin(HandleRef pen, int lineJoin);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPenLineJoin(HandleRef pen, out int lineJoin);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPenCustomStartCap(HandleRef pen, HandleRef customCap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPenCustomStartCap(HandleRef pen, out IntPtr customCap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPenCustomEndCap(HandleRef pen, HandleRef customCap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPenCustomEndCap(HandleRef pen, out IntPtr customCap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPenMiterLimit(HandleRef pen, float miterLimit);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPenMiterLimit(HandleRef pen, float[] miterLimit);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPenTransform(HandleRef pen, HandleRef matrix);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPenTransform(HandleRef pen, HandleRef matrix);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipResetPenTransform(HandleRef brush);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipMultiplyPenTransform(HandleRef brush, HandleRef matrix, MatrixOrder order);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipTranslatePenTransform(HandleRef brush, float dx, float dy, MatrixOrder order);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipScalePenTransform(HandleRef brush, float sx, float sy, MatrixOrder order);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipRotatePenTransform(HandleRef brush, float angle, MatrixOrder order);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPenColor(HandleRef pen, int argb);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPenColor(HandleRef pen, out int argb);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPenBrushFill(HandleRef pen, HandleRef brush);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPenBrushFill(HandleRef pen, out IntPtr brush);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPenFillType(HandleRef pen, out int pentype);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPenDashStyle(HandleRef pen, out int dashstyle);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPenDashStyle(HandleRef pen, int dashstyle);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPenDashArray(HandleRef pen, HandleRef memorydash, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPenDashOffset(HandleRef pen, float[] dashoffset);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPenDashOffset(HandleRef pen, float dashoffset);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPenDashCount(HandleRef pen, out int dashcount);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPenDashArray(HandleRef pen, IntPtr memorydash, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPenCompoundCount(HandleRef pen, out int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPenCompoundArray(HandleRef pen, float[] array, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPenCompoundArray(HandleRef pen, float[] array, int count);
+
+ //----------------------------------------------------------------------------------------
+ // CustomLineCap methods
+ //----------------------------------------------------------------------------------------
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateCustomLineCap(HandleRef fillpath, HandleRef strokepath, LineCap baseCap, float baseInset, out IntPtr customCap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, EntryPoint = "GdipDeleteCustomLineCap", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ private static extern int IntGdipDeleteCustomLineCap(HandleRef customCap);
+ internal static int GdipDeleteCustomLineCap(HandleRef customCap)
+ {
+ if (!Initialized) return SafeNativeMethods.Gdip.Ok;
+ int result = IntGdipDeleteCustomLineCap(customCap);
+ return result;
+ }
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCloneCustomLineCap(HandleRef customCap, out IntPtr clonedCap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetCustomLineCapType(HandleRef customCap,
+ out CustomLineCapType capType);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetCustomLineCapStrokeCaps(HandleRef customCap,
+ LineCap startCap,
+ LineCap endCap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetCustomLineCapStrokeCaps(HandleRef customCap,
+ out LineCap startCap,
+ out LineCap endCap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetCustomLineCapStrokeJoin(HandleRef customCap,
+ LineJoin lineJoin);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetCustomLineCapStrokeJoin(HandleRef customCap,
+ out LineJoin lineJoin);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetCustomLineCapBaseCap(HandleRef customCap,
+ LineCap baseCap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetCustomLineCapBaseCap(HandleRef customCap,
+ out LineCap baseCap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetCustomLineCapBaseInset(HandleRef customCap,
+ float inset);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetCustomLineCapBaseInset(HandleRef customCap,
+ out float inset);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetCustomLineCapWidthScale(HandleRef customCap,
+ float widthScale);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetCustomLineCapWidthScale(HandleRef customCap,
+ out float widthScale);
+
+ //----------------------------------------------------------------------------------------
+ // AdjustableArrowCap methods
+ //----------------------------------------------------------------------------------------
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateAdjustableArrowCap(float height, float width, bool isFilled, out IntPtr adjustableArrowCap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetAdjustableArrowCapHeight(HandleRef adjustableArrowCap,
+ float height);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetAdjustableArrowCapHeight(HandleRef adjustableArrowCap,
+ out float height);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetAdjustableArrowCapWidth(HandleRef adjustableArrowCap,
+ float width);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetAdjustableArrowCapWidth(HandleRef adjustableArrowCap,
+ out float width);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetAdjustableArrowCapMiddleInset(HandleRef adjustableArrowCap,
+ float middleInset);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetAdjustableArrowCapMiddleInset(HandleRef adjustableArrowCap,
+ out float middleInset);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetAdjustableArrowCapFillState(HandleRef adjustableArrowCap,
+ bool fillState);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetAdjustableArrowCapFillState(HandleRef adjustableArrowCap,
+ out bool fillState);
+
+ //----------------------------------------------------------------------------------------
+ // Image methods
+ //----------------------------------------------------------------------------------------
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipLoadImageFromStream(UnsafeNativeMethods.IStream stream, out IntPtr image);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipLoadImageFromFile(string filename, out IntPtr image);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipLoadImageFromStreamICM(UnsafeNativeMethods.IStream stream, out IntPtr image);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipLoadImageFromFileICM(string filename, out IntPtr image);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCloneImage(HandleRef image, out IntPtr cloneimage);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, EntryPoint = "GdipDisposeImage", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ private static extern int IntGdipDisposeImage(HandleRef image);
+ internal static int GdipDisposeImage(HandleRef image)
+ {
+ if (!Initialized) return SafeNativeMethods.Gdip.Ok;
+ int result = IntGdipDisposeImage(image);
+ return result;
+ }
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSaveImageToFile(HandleRef image, string filename,
+ ref Guid classId, HandleRef encoderParams);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSaveImageToStream(HandleRef image, UnsafeNativeMethods.IStream stream,
+ ref Guid classId, HandleRef encoderParams);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSaveAdd(HandleRef image, HandleRef encoderParams);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSaveAddImage(HandleRef image, HandleRef newImage, HandleRef encoderParams);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetImageGraphicsContext(HandleRef image, out IntPtr graphics);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetImageBounds(HandleRef image, ref GPRECTF gprectf, out GraphicsUnit unit);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetImageDimension(HandleRef image, out float width, out float height);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetImageType(HandleRef image, out int type);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetImageWidth(HandleRef image, out int width);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetImageHeight(HandleRef image, out int height);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetImageHorizontalResolution(HandleRef image, out float horzRes);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetImageVerticalResolution(HandleRef image, out float vertRes);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetImageFlags(HandleRef image, out int flags);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetImageRawFormat(HandleRef image, ref Guid format);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetImagePixelFormat(HandleRef image, out int format);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetImageThumbnail(HandleRef image, int thumbWidth, int thumbHeight,
+ out IntPtr thumbImage,
+ Image.GetThumbnailImageAbort callback,
+ IntPtr callbackdata);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetEncoderParameterListSize(HandleRef image, ref Guid clsid,
+ out int size);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetEncoderParameterList(HandleRef image, ref Guid clsid, int size,
+ IntPtr buffer);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipImageGetFrameDimensionsCount(HandleRef image, out int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipImageGetFrameDimensionsList(HandleRef image,
+ IntPtr buffer,
+ int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipImageGetFrameCount(HandleRef image, ref Guid dimensionID, int[] count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipImageSelectActiveFrame(HandleRef image, ref Guid dimensionID, int frameIndex);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipImageRotateFlip(HandleRef image, int rotateFlipType);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetImagePalette(HandleRef image, IntPtr palette, int size);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetImagePalette(HandleRef image, IntPtr palette);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetImagePaletteSize(HandleRef image, out int size);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPropertyCount(HandleRef image, out int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPropertyIdList(HandleRef image, int count, int[] list);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPropertyItemSize(HandleRef image, int propid, out int size);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPropertyItem(HandleRef image, int propid, int size, IntPtr buffer);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPropertySize(HandleRef image, out int totalSize, ref int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetAllPropertyItems(HandleRef image, int totalSize, int count, IntPtr buffer);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipRemovePropertyItem(HandleRef image, int propid);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPropertyItem(HandleRef image, PropertyItemInternal propitem);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipImageForceValidation(HandleRef image);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetImageDecodersSize(out int numDecoders, out int size);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetImageDecoders(int numDecoders, int size, IntPtr decoders);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetImageEncodersSize(out int numEncoders, out int size);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetImageEncoders(int numEncoders, int size, IntPtr encoders);
+
+ //----------------------------------------------------------------------------------------
+ // Bitmap methods
+ //----------------------------------------------------------------------------------------
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateBitmapFromStream(UnsafeNativeMethods.IStream stream, out IntPtr bitmap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateBitmapFromFile(string filename, out IntPtr bitmap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateBitmapFromStreamICM(UnsafeNativeMethods.IStream stream, out IntPtr bitmap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateBitmapFromFileICM(string filename, out IntPtr bitmap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateBitmapFromScan0(int width, int height, int stride, int format, HandleRef scan0, out IntPtr bitmap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateBitmapFromGraphics(int width, int height, HandleRef graphics, out IntPtr bitmap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateBitmapFromHBITMAP(HandleRef hbitmap, HandleRef hpalette, out IntPtr bitmap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateBitmapFromHICON(HandleRef hicon, out IntPtr bitmap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateBitmapFromResource(HandleRef hresource, HandleRef name, out IntPtr bitmap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateHBITMAPFromBitmap(HandleRef nativeBitmap, out IntPtr hbitmap, int argbBackground);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateHICONFromBitmap(HandleRef nativeBitmap, out IntPtr hicon);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCloneBitmapArea(float x, float y, float width, float height, int format, HandleRef srcbitmap, out IntPtr dstbitmap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCloneBitmapAreaI(int x, int y, int width, int height, int format, HandleRef srcbitmap, out IntPtr dstbitmap);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipBitmapLockBits(HandleRef bitmap,
+ ref GPRECT rect,
+ ImageLockMode flags, // ImageLockMode
+ PixelFormat format, // PixelFormat
+ [In, Out] BitmapData lockedBitmapData);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipBitmapUnlockBits(HandleRef bitmap,
+ BitmapData lockedBitmapData);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipBitmapGetPixel(HandleRef bitmap, int x, int y, out int argb);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipBitmapSetPixel(HandleRef bitmap, int x, int y, int argb);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipBitmapSetResolution(HandleRef bitmap, float dpix, float dpiy);
+
+ //----------------------------------------------------------------------------------------
+ // ImageAttributes methods
+ //----------------------------------------------------------------------------------------
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateImageAttributes(out IntPtr imageattr);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCloneImageAttributes(HandleRef imageattr, out IntPtr cloneImageattr);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, EntryPoint = "GdipDisposeImageAttributes", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ private static extern int IntGdipDisposeImageAttributes(HandleRef imageattr);
+ internal static int GdipDisposeImageAttributes(HandleRef imageattr)
+ {
+ if (!Initialized) return SafeNativeMethods.Gdip.Ok;
+ int result = IntGdipDisposeImageAttributes(imageattr);
+ return result;
+ }
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetImageAttributesColorMatrix(HandleRef imageattr,
+ ColorAdjustType type,
+ bool enableFlag,
+ ColorMatrix colorMatrix,
+ ColorMatrix grayMatrix,
+ ColorMatrixFlag flags);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetImageAttributesThreshold(HandleRef imageattr,
+ ColorAdjustType type,
+ bool enableFlag,
+ float threshold);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetImageAttributesGamma(HandleRef imageattr,
+ ColorAdjustType type,
+ bool enableFlag,
+ float gamma);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetImageAttributesNoOp(HandleRef imageattr,
+ ColorAdjustType type,
+ bool enableFlag);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetImageAttributesColorKeys(HandleRef imageattr,
+ ColorAdjustType type,
+ bool enableFlag,
+ int colorLow, // yes, ref, not out
+ int colorHigh);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetImageAttributesOutputChannel(HandleRef imageattr,
+ ColorAdjustType type,
+ bool enableFlag,
+ ColorChannelFlag flags);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetImageAttributesOutputChannelColorProfile(
+ HandleRef imageattr,
+ ColorAdjustType type,
+ bool enableFlag,
+ string colorProfileFilename);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetImageAttributesRemapTable(HandleRef imageattr,
+ ColorAdjustType type,
+ bool enableFlag,
+ int mapSize,
+ HandleRef map);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetImageAttributesWrapMode(HandleRef imageattr,
+ int wrapmode,
+ int argb,
+ bool clamp);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetImageAttributesAdjustedPalette(HandleRef imageattr,
+ HandleRef palette,
+ ColorAdjustType type);
+
+ //----------------------------------------------------------------------------------------
+ // Graphics methods
+ //----------------------------------------------------------------------------------------
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipFlush(HandleRef graphics, FlushIntention intention);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateFromHDC(HandleRef hdc, out IntPtr graphics);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateFromHDC2(HandleRef hdc, HandleRef hdevice, out IntPtr graphics);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateFromHWND(HandleRef hwnd, out IntPtr graphics);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, EntryPoint = "GdipDeleteGraphics", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ private static extern int IntGdipDeleteGraphics(HandleRef graphics);
+ internal static int GdipDeleteGraphics(HandleRef graphics)
+ {
+ if (!Initialized) return SafeNativeMethods.Gdip.Ok;
+ int result = IntGdipDeleteGraphics(graphics);
+ return result;
+ }
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetDC(HandleRef graphics, out IntPtr hdc);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, EntryPoint = "GdipReleaseDC", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ private static extern int IntGdipReleaseDC(HandleRef graphics, HandleRef hdc);
+ internal static int GdipReleaseDC(HandleRef graphics, HandleRef hdc)
+ {
+ if (!Initialized) return SafeNativeMethods.Gdip.Ok;
+ int result = IntGdipReleaseDC(graphics, hdc);
+ return result;
+ }
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetCompositingMode(HandleRef graphics, int compositeMode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetTextRenderingHint(HandleRef graphics, TextRenderingHint textRenderingHint);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetTextContrast(HandleRef graphics, int textContrast);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetInterpolationMode(HandleRef graphics, int mode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetCompositingMode(HandleRef graphics, out int compositeMode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetRenderingOrigin(HandleRef graphics, int x, int y);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetRenderingOrigin(HandleRef graphics, out int x, out int y);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetCompositingQuality(HandleRef graphics, CompositingQuality quality);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetCompositingQuality(HandleRef graphics, out CompositingQuality quality);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetSmoothingMode(HandleRef graphics, SmoothingMode smoothingMode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetSmoothingMode(HandleRef graphics, out SmoothingMode smoothingMode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPixelOffsetMode(HandleRef graphics, PixelOffsetMode pixelOffsetMode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPixelOffsetMode(HandleRef graphics, out PixelOffsetMode pixelOffsetMode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetTextRenderingHint(HandleRef graphics, out TextRenderingHint textRenderingHint);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetTextContrast(HandleRef graphics, out int textContrast);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetInterpolationMode(HandleRef graphics, out int mode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetWorldTransform(HandleRef graphics, HandleRef matrix);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipResetWorldTransform(HandleRef graphics);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipMultiplyWorldTransform(HandleRef graphics, HandleRef matrix, MatrixOrder order);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipTranslateWorldTransform(HandleRef graphics, float dx, float dy, MatrixOrder order);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipScaleWorldTransform(HandleRef graphics, float sx, float sy, MatrixOrder order);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipRotateWorldTransform(HandleRef graphics, float angle, MatrixOrder order);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetWorldTransform(HandleRef graphics, HandleRef matrix);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPageUnit(HandleRef graphics, out int unit);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetPageScale(HandleRef graphics, float[] scale);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPageUnit(HandleRef graphics, int unit);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetPageScale(HandleRef graphics, float scale);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetDpiX(HandleRef graphics, float[] dpi);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetDpiY(HandleRef graphics, float[] dpi);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipTransformPoints(HandleRef graphics, int destSpace,
+ int srcSpace, IntPtr points, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipTransformPointsI(HandleRef graphics, int destSpace,
+ int srcSpace, IntPtr points, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetNearestColor(HandleRef graphics, ref int color);
+
+ // Create the Win9x Halftone Palette (even on NT) with correct Desktop colors
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern IntPtr GdipCreateHalftonePalette();
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawLine(HandleRef graphics, HandleRef pen, float x1, float y1,
+ float x2, float y2);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawLineI(HandleRef graphics, HandleRef pen, int x1, int y1,
+ int x2, int y2);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawLines(HandleRef graphics, HandleRef pen, HandleRef points,
+ int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawLinesI(HandleRef graphics, HandleRef pen, HandleRef points,
+ int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawArc(HandleRef graphics, HandleRef pen, float x, float y,
+ float width, float height, float startAngle,
+ float sweepAngle);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawArcI(HandleRef graphics, HandleRef pen, int x, int y,
+ int width, int height, float startAngle,
+ float sweepAngle);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawBezier(HandleRef graphics, HandleRef pen, float x1, float y1,
+ float x2, float y2, float x3, float y3,
+ float x4, float y4);
+
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawBeziers(HandleRef graphics, HandleRef pen, HandleRef points,
+ int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawBeziersI(HandleRef graphics, HandleRef pen, HandleRef points,
+ int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawRectangle(HandleRef graphics, HandleRef pen, float x, float y,
+ float width, float height);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawRectangleI(HandleRef graphics, HandleRef pen, int x, int y,
+ int width, int height);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawRectangles(HandleRef graphics, HandleRef pen, HandleRef rects,
+ int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawRectanglesI(HandleRef graphics, HandleRef pen, HandleRef rects,
+ int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawEllipse(HandleRef graphics, HandleRef pen, float x, float y,
+ float width, float height);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawEllipseI(HandleRef graphics, HandleRef pen, int x, int y,
+ int width, int height);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawPie(HandleRef graphics, HandleRef pen, float x, float y,
+ float width, float height, float startAngle,
+ float sweepAngle);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawPieI(HandleRef graphics, HandleRef pen, int x, int y,
+ int width, int height, float startAngle,
+ float sweepAngle);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawPolygon(HandleRef graphics, HandleRef pen, HandleRef points,
+ int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawPolygonI(HandleRef graphics, HandleRef pen, HandleRef points,
+ int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawPath(HandleRef graphics, HandleRef pen, HandleRef path);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawCurve(HandleRef graphics, HandleRef pen, HandleRef points,
+ int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawCurveI(HandleRef graphics, HandleRef pen, HandleRef points,
+ int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawCurve2(HandleRef graphics, HandleRef pen, HandleRef points,
+ int count, float tension);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawCurve2I(HandleRef graphics, HandleRef pen, HandleRef points,
+ int count, float tension);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawCurve3(HandleRef graphics, HandleRef pen, HandleRef points,
+ int count, int offset,
+ int numberOfSegments, float tension);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawCurve3I(HandleRef graphics, HandleRef pen, HandleRef points,
+ int count, int offset,
+ int numberOfSegments, float tension);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawClosedCurve(HandleRef graphics, HandleRef pen, HandleRef points,
+ int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawClosedCurveI(HandleRef graphics, HandleRef pen, HandleRef points,
+ int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawClosedCurve2(HandleRef graphics, HandleRef pen, HandleRef points,
+ int count, float tension);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawClosedCurve2I(HandleRef graphics, HandleRef pen, HandleRef points,
+ int count, float tension);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGraphicsClear(HandleRef graphics, int argb);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipFillRectangle(HandleRef graphics, HandleRef brush, float x, float y,
+ float width, float height);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipFillRectangleI(HandleRef graphics, HandleRef brush, int x, int y,
+ int width, int height);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipFillRectangles(HandleRef graphics, HandleRef brush, HandleRef rects,
+ int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipFillRectanglesI(HandleRef graphics, HandleRef brush, HandleRef rects,
+ int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipFillPolygon(HandleRef graphics, HandleRef brush, HandleRef points,
+ int count, int brushMode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipFillPolygonI(HandleRef graphics, HandleRef brush, HandleRef points,
+ int count, int brushMode);
+
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipFillEllipse(HandleRef graphics, HandleRef brush, float x, float y,
+ float width, float height);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipFillEllipseI(HandleRef graphics, HandleRef brush, int x, int y,
+ int width, int height);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipFillPie(HandleRef graphics, HandleRef brush, float x, float y,
+ float width, float height, float startAngle,
+ float sweepAngle);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipFillPieI(HandleRef graphics, HandleRef brush, int x, int y,
+ int width, int height, float startAngle,
+ float sweepAngle);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipFillPath(HandleRef graphics, HandleRef brush, HandleRef path);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipFillClosedCurve(HandleRef graphics, HandleRef brush, HandleRef points,
+ int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipFillClosedCurveI(HandleRef graphics, HandleRef brush, HandleRef points,
+ int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipFillClosedCurve2(HandleRef graphics, HandleRef brush, HandleRef points,
+ int count, float tension,
+ int mode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipFillClosedCurve2I(HandleRef graphics, HandleRef brush, HandleRef points,
+ int count, float tension,
+ int mode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipFillRegion(HandleRef graphics, HandleRef brush, HandleRef region);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawImage(HandleRef graphics, HandleRef image, float x, float y);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawImageI(HandleRef graphics, HandleRef image, int x, int y);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawImageRect(HandleRef graphics, HandleRef image, float x,
+ float y, float width, float height);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawImageRectI(HandleRef graphics, HandleRef image, int x,
+ int y, int width, int height);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawImagePoints(HandleRef graphics, HandleRef image,
+ HandleRef points, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawImagePointsI(HandleRef graphics, HandleRef image,
+ HandleRef points, int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawImagePointRect(HandleRef graphics, HandleRef image, float x,
+ float y, float srcx, float srcy,
+ float srcwidth, float srcheight,
+ int srcunit);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawImagePointRectI(HandleRef graphics, HandleRef image, int x,
+ int y, int srcx, int srcy,
+ int srcwidth, int srcheight,
+ int srcunit);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawImageRectRect(HandleRef graphics, HandleRef image,
+ float dstx, float dsty,
+ float dstwidth, float dstheight,
+ float srcx, float srcy,
+ float srcwidth, float srcheight,
+ int srcunit, HandleRef imageAttributes,
+ Graphics.DrawImageAbort callback, HandleRef callbackdata);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawImageRectRectI(HandleRef graphics, HandleRef image,
+ int dstx, int dsty,
+ int dstwidth, int dstheight,
+ int srcx, int srcy,
+ int srcwidth, int srcheight,
+ int srcunit, HandleRef imageAttributes,
+ Graphics.DrawImageAbort callback, HandleRef callbackdata);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawImagePointsRect(HandleRef graphics, HandleRef image,
+ HandleRef points, int count, float srcx,
+ float srcy, float srcwidth,
+ float srcheight, int srcunit,
+ HandleRef imageAttributes,
+ Graphics.DrawImageAbort callback, HandleRef callbackdata);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawImagePointsRectI(HandleRef graphics, HandleRef image,
+ HandleRef points, int count, int srcx,
+ int srcy, int srcwidth,
+ int srcheight, int srcunit,
+ HandleRef imageAttributes,
+ Graphics.DrawImageAbort callback, HandleRef callbackdata);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipEnumerateMetafileDestPoint(HandleRef graphics,
+ HandleRef metafile,
+ GPPOINTF destPoint,
+ Graphics.EnumerateMetafileProc callback,
+ HandleRef callbackdata,
+ HandleRef imageattributes);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipEnumerateMetafileDestPointI(HandleRef graphics,
+ HandleRef metafile,
+ GPPOINT destPoint,
+ Graphics.EnumerateMetafileProc callback,
+ HandleRef callbackdata,
+ HandleRef imageattributes);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipEnumerateMetafileDestRect(HandleRef graphics,
+ HandleRef metafile,
+ ref GPRECTF destRect,
+ Graphics.EnumerateMetafileProc callback,
+ HandleRef callbackdata,
+ HandleRef imageattributes);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipEnumerateMetafileDestRectI(HandleRef graphics,
+ HandleRef metafile,
+ ref GPRECT destRect,
+ Graphics.EnumerateMetafileProc callback,
+ HandleRef callbackdata,
+ HandleRef imageattributes);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipEnumerateMetafileDestPoints(HandleRef graphics,
+ HandleRef metafile,
+ IntPtr destPoints,
+ int count,
+ Graphics.EnumerateMetafileProc callback,
+ HandleRef callbackdata,
+ HandleRef imageattributes);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipEnumerateMetafileDestPointsI(HandleRef graphics,
+ HandleRef metafile,
+ IntPtr destPoints,
+ int count,
+ Graphics.EnumerateMetafileProc callback,
+ HandleRef callbackdata,
+ HandleRef imageattributes);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipEnumerateMetafileSrcRectDestPoint(HandleRef graphics,
+ HandleRef metafile,
+ GPPOINTF destPoint,
+ ref GPRECTF srcRect,
+ int pageUnit,
+ Graphics.EnumerateMetafileProc callback,
+ HandleRef callbackdata,
+ HandleRef imageattributes);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipEnumerateMetafileSrcRectDestPointI(HandleRef graphics,
+ HandleRef metafile,
+ GPPOINT destPoint,
+ ref GPRECT srcRect,
+ int pageUnit,
+ Graphics.EnumerateMetafileProc callback,
+ HandleRef callbackdata,
+ HandleRef imageattributes);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipEnumerateMetafileSrcRectDestRect(HandleRef graphics,
+ HandleRef metafile,
+ ref GPRECTF destRect,
+ ref GPRECTF srcRect,
+ int pageUnit,
+ Graphics.EnumerateMetafileProc callback,
+ HandleRef callbackdata,
+ HandleRef imageattributes);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipEnumerateMetafileSrcRectDestRectI(HandleRef graphics,
+ HandleRef metafile,
+ ref GPRECT destRect,
+ ref GPRECT srcRect,
+ int pageUnit,
+ Graphics.EnumerateMetafileProc callback,
+ HandleRef callbackdata,
+ HandleRef imageattributes);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipEnumerateMetafileSrcRectDestPoints(HandleRef graphics,
+ HandleRef metafile,
+ IntPtr destPoints,
+ int count,
+ ref GPRECTF srcRect,
+ int pageUnit,
+ Graphics.EnumerateMetafileProc callback,
+ HandleRef callbackdata,
+ HandleRef imageattributes);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipEnumerateMetafileSrcRectDestPointsI(HandleRef graphics,
+ HandleRef metafile,
+ IntPtr destPoints,
+ int count,
+ ref GPRECT srcRect,
+ int pageUnit,
+ Graphics.EnumerateMetafileProc callback,
+ HandleRef callbackdata,
+ HandleRef imageattributes);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipPlayMetafileRecord(HandleRef graphics,
+ EmfPlusRecordType recordType,
+ int flags,
+ int dataSize,
+ byte[] data);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetClipGraphics(HandleRef graphics, HandleRef srcgraphics, CombineMode mode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetClipRect(HandleRef graphics, float x, float y,
+ float width, float height, CombineMode mode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetClipRectI(HandleRef graphics, int x, int y,
+ int width, int height, CombineMode mode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetClipPath(HandleRef graphics, HandleRef path, CombineMode mode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetClipRegion(HandleRef graphics, HandleRef region, CombineMode mode);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipResetClip(HandleRef graphics);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipTranslateClip(HandleRef graphics, float dx, float dy);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetClip(HandleRef graphics, HandleRef region);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetClipBounds(HandleRef graphics, ref GPRECTF rect);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipIsClipEmpty(HandleRef graphics,
+ out int boolean);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetVisibleClipBounds(HandleRef graphics, ref GPRECTF rect);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipIsVisibleClipEmpty(HandleRef graphics,
+ out int boolean);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipIsVisiblePoint(HandleRef graphics, float x, float y,
+ out int boolean);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipIsVisiblePointI(HandleRef graphics, int x, int y,
+ out int boolean);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipIsVisibleRect(HandleRef graphics, float x, float y,
+ float width, float height,
+ out int boolean);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipIsVisibleRectI(HandleRef graphics, int x, int y,
+ int width, int height,
+ out int boolean);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSaveGraphics(HandleRef graphics, out int state);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipRestoreGraphics(HandleRef graphics, int state);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipBeginContainer(HandleRef graphics, ref GPRECTF dstRect,
+ ref GPRECTF srcRect, int unit,
+ out int state);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipBeginContainer2(HandleRef graphics, out int state);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipBeginContainerI(HandleRef graphics, ref GPRECT dstRect,
+ ref GPRECT srcRect, int unit,
+ out int state);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipEndContainer(HandleRef graphics, int state);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetMetafileHeaderFromWmf(HandleRef hMetafile, // WMF
+ WmfPlaceableFileHeader wmfplaceable,
+ [In, Out] MetafileHeaderWmf metafileHeaderWmf);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetMetafileHeaderFromEmf(HandleRef hEnhMetafile, // EMF
+ [In, Out] MetafileHeaderEmf metafileHeaderEmf);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetMetafileHeaderFromFile(string filename,
+ IntPtr header);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetMetafileHeaderFromStream(UnsafeNativeMethods.IStream stream,
+ IntPtr header);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetMetafileHeaderFromMetafile(HandleRef metafile,
+ IntPtr header);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetHemfFromMetafile(HandleRef metafile,
+ out IntPtr hEnhMetafile);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateMetafileFromWmf(HandleRef hMetafile, [MarshalAs(UnmanagedType.Bool)]bool deleteWmf, WmfPlaceableFileHeader wmfplacealbeHeader, out IntPtr metafile);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateMetafileFromEmf(HandleRef hEnhMetafile, bool deleteEmf, out IntPtr metafile);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateMetafileFromFile(string file, out IntPtr metafile);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateMetafileFromStream(UnsafeNativeMethods.IStream stream, out IntPtr metafile);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipRecordMetafile(HandleRef referenceHdc,
+ int emfType,
+ ref GPRECTF frameRect,
+ int frameUnit,
+ string description,
+ out IntPtr metafile);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipRecordMetafile(HandleRef referenceHdc,
+ int emfType,
+ HandleRef pframeRect,
+ int frameUnit,
+ string description,
+ out IntPtr metafile);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipRecordMetafileI(HandleRef referenceHdc,
+ int emfType,
+ ref GPRECT frameRect,
+ int frameUnit,
+ string description,
+ out IntPtr metafile);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipRecordMetafileFileName(string fileName,
+ HandleRef referenceHdc,
+ int emfType,
+ ref GPRECTF frameRect,
+ int frameUnit,
+ string description,
+ out IntPtr metafile);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipRecordMetafileFileName(string fileName,
+ HandleRef referenceHdc,
+ int emfType,
+ HandleRef pframeRect,
+ int frameUnit,
+ string description,
+ out IntPtr metafile);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipRecordMetafileFileNameI(string fileName,
+ HandleRef referenceHdc,
+ int emfType,
+ ref GPRECT frameRect,
+ int frameUnit,
+ string description,
+ out IntPtr metafile);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipRecordMetafileStream(UnsafeNativeMethods.IStream stream,
+ HandleRef referenceHdc,
+ int emfType,
+ ref GPRECTF frameRect,
+ int frameUnit,
+ string description,
+ out IntPtr metafile);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipRecordMetafileStream(UnsafeNativeMethods.IStream stream,
+ HandleRef referenceHdc,
+ int emfType,
+ HandleRef pframeRect,
+ int frameUnit,
+ string description,
+ out IntPtr metafile);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipRecordMetafileStreamI(UnsafeNativeMethods.IStream stream,
+ HandleRef referenceHdc,
+ int emfType,
+ ref GPRECT frameRect,
+ int frameUnit,
+ string description,
+ out IntPtr metafile);
+
+
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipComment(HandleRef graphics, int sizeData, byte[] data);
+
+ //----------------------------------------------------------------------------------------
+ // Font Collection
+ //----------------------------------------------------------------------------------------
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipNewInstalledFontCollection(out IntPtr fontCollection);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipNewPrivateFontCollection(out IntPtr fontCollection);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, EntryPoint = "GdipDeletePrivateFontCollection", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ private static extern int IntGdipDeletePrivateFontCollection(out IntPtr fontCollection);
+ internal static int GdipDeletePrivateFontCollection(out IntPtr fontCollection)
+ {
+ if (!Initialized)
+ {
+ fontCollection = IntPtr.Zero;
+ return SafeNativeMethods.Gdip.Ok;
+ }
+ int result = IntGdipDeletePrivateFontCollection(out fontCollection);
+ return result;
+ }
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetFontCollectionFamilyCount(HandleRef fontCollection, out int numFound);
+
+ // should be IntPtr
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetFontCollectionFamilyList(HandleRef fontCollection, int numSought, IntPtr[] gpfamilies,
+ out int numFound);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipPrivateAddFontFile(HandleRef fontCollection, string filename);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipPrivateAddMemoryFont(HandleRef fontCollection, HandleRef memory, int length);
+
+ //----------------------------------------------------------------------------------------
+ // FontFamily
+ //----------------------------------------------------------------------------------------
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateFontFamilyFromName(string name, HandleRef fontCollection, out IntPtr FontFamily);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetGenericFontFamilySansSerif(out IntPtr fontfamily);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetGenericFontFamilySerif(out IntPtr fontfamily);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetGenericFontFamilyMonospace(out IntPtr fontfamily);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, EntryPoint = "GdipDeleteFontFamily", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ private static extern int IntGdipDeleteFontFamily(HandleRef fontFamily);
+ internal static int GdipDeleteFontFamily(HandleRef fontFamily)
+ {
+ if (!Initialized) return SafeNativeMethods.Gdip.Ok;
+ int result = IntGdipDeleteFontFamily(fontFamily);
+ return result;
+ }
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCloneFontFamily(HandleRef fontfamily, out IntPtr clonefontfamily);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetFamilyName(HandleRef family, StringBuilder name, int language);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipIsStyleAvailable(HandleRef family, FontStyle style, out int isStyleAvailable);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetEmHeight(HandleRef family, FontStyle style, out int EmHeight);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetCellAscent(HandleRef family, FontStyle style, out int CellAscent);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetCellDescent(HandleRef family, FontStyle style, out int CellDescent);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetLineSpacing(HandleRef family, FontStyle style, out int LineSpaceing);
+ //----------------------------------------------------------------------------------------
+ // Font
+ //----------------------------------------------------------------------------------------
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateFontFromDC(HandleRef hdc, ref IntPtr font);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Ansi)] // DIFFERENT: ANSI, not Unicode
+#pragma warning disable CS0618 // Legacy code: We don't care about using obsolete API's.
+ internal static extern int GdipCreateFontFromLogfontA(HandleRef hdc, [In, Out, MarshalAs(UnmanagedType.AsAny)] object lf, out IntPtr font);
+#pragma warning restore CS0618
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+#pragma warning disable CS0618 // Legacy code: We don't care about using obsolete API's.
+ internal static extern int GdipCreateFontFromLogfontW(HandleRef hdc, [In, Out, MarshalAs(UnmanagedType.AsAny)] object lf, out IntPtr font);
+#pragma warning restore CS0618
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateFont(HandleRef fontFamily, float emSize, FontStyle style, GraphicsUnit unit, out IntPtr font);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+#pragma warning disable CS0618 // Legacy code: We don't care about using obsolete API's.
+ internal static extern int GdipGetLogFontW(HandleRef font, HandleRef graphics, [In, Out, MarshalAs(UnmanagedType.AsAny)] object lf);
+#pragma warning restore CS0618
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Ansi)] // 3 = Unicode
+#pragma warning disable CS0618 // Legacy code: We don't care about using obsolete API's.
+ internal static extern int GdipGetLogFontA(HandleRef font, HandleRef graphics, [In, Out, MarshalAs(UnmanagedType.AsAny)] object lf);
+#pragma warning restore CS0618
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
+ internal static extern int GdipCloneFont(HandleRef font, out IntPtr cloneFont);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, EntryPoint = "GdipDeleteFont", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ private static extern int IntGdipDeleteFont(HandleRef font);
+ internal static int GdipDeleteFont(HandleRef font)
+ {
+ if (!Initialized) return SafeNativeMethods.Gdip.Ok;
+ int result = IntGdipDeleteFont(font);
+ return result;
+ }
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetFamily(HandleRef font, out IntPtr family);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
+ internal static extern int GdipGetFontStyle(HandleRef font, out FontStyle style);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetFontSize(HandleRef font, out float size);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetFontHeight(HandleRef font, HandleRef graphics, out float size);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetFontHeightGivenDPI(HandleRef font, float dpi, out float size);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
+ internal static extern int GdipGetFontUnit(HandleRef font, out GraphicsUnit unit);
+
+ // Text
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipDrawString(HandleRef graphics, string textString, int length, HandleRef font, ref GPRECTF layoutRect,
+ HandleRef stringFormat, HandleRef brush);
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipMeasureString(HandleRef graphics, string textString, int length, HandleRef font, ref GPRECTF layoutRect,
+ HandleRef stringFormat, [In, Out] ref GPRECTF boundingBox, out int codepointsFitted, out int linesFilled);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipMeasureCharacterRanges(HandleRef graphics, string textString, int length, HandleRef font, ref GPRECTF layoutRect, HandleRef stringFormat,
+ int characterCount, [In, Out] IntPtr[] region);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetStringFormatMeasurableCharacterRanges(HandleRef format, int rangeCount, [In, Out] CharacterRange[] range);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCreateStringFormat(StringFormatFlags options, int language, out IntPtr format);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipStringFormatGetGenericDefault(out IntPtr format);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipStringFormatGetGenericTypographic(out IntPtr format);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, EntryPoint = "GdipDeleteStringFormat", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ private static extern int IntGdipDeleteStringFormat(HandleRef format);
+ internal static int GdipDeleteStringFormat(HandleRef format)
+ {
+ if (!Initialized) return SafeNativeMethods.Gdip.Ok;
+ int result = IntGdipDeleteStringFormat(format);
+ return result;
+ }
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipCloneStringFormat(HandleRef format, out IntPtr newFormat);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetStringFormatFlags(HandleRef format, StringFormatFlags options);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetStringFormatFlags(HandleRef format, out StringFormatFlags result);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetStringFormatAlign(HandleRef format, StringAlignment align);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetStringFormatAlign(HandleRef format, out StringAlignment align);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetStringFormatLineAlign(HandleRef format, StringAlignment align);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetStringFormatLineAlign(HandleRef format, out StringAlignment align);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetStringFormatHotkeyPrefix(HandleRef format, HotkeyPrefix hotkeyPrefix);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetStringFormatHotkeyPrefix(HandleRef format, out HotkeyPrefix hotkeyPrefix);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetStringFormatTabStops(HandleRef format, float firstTabOffset, int count, float[] tabStops);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetStringFormatTabStops(HandleRef format, int count, out float firstTabOffset, [In, Out]float[] tabStops);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetStringFormatTabStopCount(HandleRef format, out int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetStringFormatMeasurableCharacterRangeCount(HandleRef format, out int count);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetStringFormatTrimming(HandleRef format, StringTrimming trimming);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetStringFormatTrimming(HandleRef format, out StringTrimming trimming);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipSetStringFormatDigitSubstitution(HandleRef format, int langID, StringDigitSubstitute sds);
+
+ [DllImport(ExternDll.Gdiplus, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)] // 3 = Unicode
+ internal static extern int GdipGetStringFormatDigitSubstitution(HandleRef format, out int langID, out StringDigitSubstitute sds);
+
+ //----------------------------------------------------------------------------------------
+ // Status codes
+ //----------------------------------------------------------------------------------------
+ internal const int Ok = 0;
+ internal const int GenericError = 1;
+ internal const int InvalidParameter = 2;
+ internal const int OutOfMemory = 3;
+ internal const int ObjectBusy = 4;
+ internal const int InsufficientBuffer = 5;
+ internal const int NotImplemented = 6;
+ internal const int Win32Error = 7;
+ internal const int WrongState = 8;
+ internal const int Aborted = 9;
+ internal const int FileNotFound = 10;
+ internal const int ValueOverflow = 11;
+ internal const int AccessDenied = 12;
+ internal const int UnknownImageFormat = 13;
+ internal const int FontFamilyNotFound = 14;
+ internal const int FontStyleNotFound = 15;
+ internal const int NotTrueTypeFont = 16;
+ internal const int UnsupportedGdiplusVersion = 17;
+ internal const int GdiplusNotInitialized = 18;
+ internal const int PropertyNotFound = 19;
+ internal const int PropertyNotSupported = 20;
+
+ internal static Exception StatusException(int status)
+ {
+ Debug.Assert(status != Ok, "Throwing an exception for an 'Ok' return code");
+
+ switch (status)
+ {
+ case GenericError: return new ExternalException(SR.Format(SR.GdiplusGenericError), E_FAIL);
+ case InvalidParameter: return new ArgumentException(SR.Format(SR.GdiplusInvalidParameter));
+ case OutOfMemory: return new OutOfMemoryException(SR.Format(SR.GdiplusOutOfMemory));
+ case ObjectBusy: return new InvalidOperationException(SR.Format(SR.GdiplusObjectBusy));
+ case InsufficientBuffer: return new OutOfMemoryException(SR.Format(SR.GdiplusInsufficientBuffer));
+ case NotImplemented: return new NotImplementedException(SR.Format(SR.GdiplusNotImplemented));
+ case Win32Error: return new ExternalException(SR.Format(SR.GdiplusGenericError), E_FAIL);
+ case WrongState: return new InvalidOperationException(SR.Format(SR.GdiplusWrongState));
+ case Aborted: return new ExternalException(SR.Format(SR.GdiplusAborted), E_ABORT);
+ case FileNotFound: return new FileNotFoundException(SR.Format(SR.GdiplusFileNotFound));
+ case ValueOverflow: return new OverflowException(SR.Format(SR.GdiplusOverflow));
+ case AccessDenied: return new ExternalException(SR.Format(SR.GdiplusAccessDenied), E_ACCESSDENIED);
+ case UnknownImageFormat: return new ArgumentException(SR.Format(SR.GdiplusUnknownImageFormat));
+ case PropertyNotFound: return new ArgumentException(SR.Format(SR.GdiplusPropertyNotFoundError));
+ case PropertyNotSupported: return new ArgumentException(SR.Format(SR.GdiplusPropertyNotSupportedError));
+
+
+ case FontFamilyNotFound:
+ Debug.Fail("We should be special casing FontFamilyNotFound so we can provide the font name");
+ return new ArgumentException(SR.Format(SR.GdiplusFontFamilyNotFound, "?"));
+
+ case FontStyleNotFound:
+ Debug.Fail("We should be special casing FontStyleNotFound so we can provide the font name");
+ return new ArgumentException(SR.Format(SR.GdiplusFontStyleNotFound, "?", "?"));
+
+ case NotTrueTypeFont:
+ Debug.Fail("We should be special casing NotTrueTypeFont so we can provide the font name");
+ return new ArgumentException(SR.Format(SR.GdiplusNotTrueTypeFont_NoName));
+
+ case UnsupportedGdiplusVersion:
+ return new ExternalException(SR.Format(SR.GdiplusUnsupportedGdiplusVersion), E_FAIL);
+
+ case GdiplusNotInitialized:
+ return new ExternalException(SR.Format(SR.GdiplusNotInitialized), E_FAIL);
+ }
+
+ return new ExternalException(SR.Format(SR.GdiplusUnknown), E_UNEXPECTED);
+ }
+
+ //----------------------------------------------------------------------------------------
+ // Helper function: Convert GpPointF* memory block to PointF[]
+ //----------------------------------------------------------------------------------------
+ internal static PointF[] ConvertGPPOINTFArrayF(IntPtr memory, int count)
+ {
+ if (memory == IntPtr.Zero)
+ throw new ArgumentNullException("memory");
+
+ PointF[] points = new PointF[count];
+
+ int index;
+ GPPOINTF pt = new GPPOINTF();
+
+ int size = (int)Marshal.SizeOf(pt.GetType());
+
+ for (index = 0; index < count; index++)
+ {
+ pt = (GPPOINTF)UnsafeNativeMethods.PtrToStructure((IntPtr)((long)memory + index * size), pt.GetType());
+ points[index] = new PointF(pt.X, pt.Y);
+ }
+
+ return points;
+ }
+
+ //----------------------------------------------------------------------------------------
+ // Helper function: Convert GpPoint* memory block to Point[]
+ //----------------------------------------------------------------------------------------
+ internal static Point[] ConvertGPPOINTArray(IntPtr memory, int count)
+ {
+ if (memory == IntPtr.Zero)
+ throw new ArgumentNullException("memory");
+
+ Point[] points = new Point[count];
+
+ int index;
+ GPPOINT pt = new GPPOINT();
+
+ int size = (int)Marshal.SizeOf(pt.GetType());
+
+ for (index = 0; index < count; index++)
+ {
+ pt = (GPPOINT)UnsafeNativeMethods.PtrToStructure((IntPtr)((long)memory + index * size), pt.GetType());
+ points[index] = new Point((int)pt.X, (int)pt.Y);
+ }
+
+ return points;
+ }
+
+ //----------------------------------------------------------------------------------------
+ // Helper function: Convert PointF[] to native memory block GpPointF*
+ //----------------------------------------------------------------------------------------
+ internal static IntPtr ConvertPointToMemory(PointF[] points)
+ {
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ int index;
+
+ int size = (int)Marshal.SizeOf(typeof(GPPOINTF));
+ int count = points.Length;
+
+ IntPtr memory = Marshal.AllocHGlobal(checked(count * size));
+
+ for (index = 0; index < count; index++)
+ {
+ Marshal.StructureToPtr(new GPPOINTF(points[index]), (IntPtr)(checked((long)memory + index * size)), false);
+ }
+
+ return memory;
+ }
+
+ //----------------------------------------------------------------------------------------
+ // Helper function: Convert Point[] to native memory block GpPoint*
+ //----------------------------------------------------------------------------------------
+ internal static IntPtr ConvertPointToMemory(Point[] points)
+ {
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ int index;
+
+ int size = (int)Marshal.SizeOf(typeof(GPPOINT));
+ int count = points.Length;
+
+ IntPtr memory = Marshal.AllocHGlobal(checked(count * size));
+
+ for (index = 0; index < count; index++)
+ {
+ Marshal.StructureToPtr(new GPPOINT(points[index]), (IntPtr)(checked((long)memory + index * size)), false);
+ }
+
+ return memory;
+ }
+
+ //----------------------------------------------------------------------------------------
+ // Helper function: Convert RectangleF[] to native memory block GpRectF*
+ //----------------------------------------------------------------------------------------
+ internal static IntPtr ConvertRectangleToMemory(RectangleF[] rect)
+ {
+ if (rect == null)
+ throw new ArgumentNullException("rect");
+
+ int index;
+
+ int size = (int)Marshal.SizeOf(typeof(GPRECTF));
+ int count = rect.Length;
+
+ IntPtr memory = Marshal.AllocHGlobal(checked(count * size));
+
+ for (index = 0; index < count; index++)
+ {
+ Marshal.StructureToPtr(new GPRECTF(rect[index]), (IntPtr)(checked((long)memory + index * size)), false);
+ }
+
+ return memory;
+ }
+
+ //----------------------------------------------------------------------------------------
+ // Helper function: Convert Rectangle[] to native memory block GpRect*
+ //----------------------------------------------------------------------------------------
+ internal static IntPtr ConvertRectangleToMemory(Rectangle[] rect)
+ {
+ if (rect == null)
+ throw new ArgumentNullException("rect");
+
+ int index;
+
+ int size = (int)Marshal.SizeOf(typeof(GPRECT));
+ int count = rect.Length;
+
+ IntPtr memory = Marshal.AllocHGlobal(checked(count * size));
+
+ for (index = 0; index < count; index++)
+ {
+ Marshal.StructureToPtr(new GPRECT(rect[index]), (IntPtr)(checked((long)memory + index * size)), false);
+ }
+
+ return memory;
+ }
+ }
+
+ public static IntPtr InvalidIntPtr = ((IntPtr)((int)(-1)));
+
+
+ public const int ERROR_CANCELLED = 1223;
+
+ public const int
+ RASTERCAPS = 38,
+ RC_PALETTE = 0x0100,
+ SIZEPALETTE = 104,
+ SYSPAL_STATIC = 1,
+
+ BS_SOLID = 0,
+ HOLLOW_BRUSH = 5,
+
+ // Binary raster operations.
+ R2_BLACK = 1, /* 0 */
+ R2_NOTMERGEPEN = 2, /* DPon */
+ R2_MASKNOTPEN = 3, /* DPna */
+ R2_NOTCOPYPEN = 4, /* PN */
+ R2_MASKPENNOT = 5, /* PDna */
+ R2_NOT = 6, /* Dn */
+ R2_XORPEN = 7, /* DPx */
+ R2_NOTMASKPEN = 8, /* DPan */
+ R2_MASKPEN = 9, /* DPa */
+ R2_NOTXORPEN = 10, /* DPxn */
+ R2_NOP = 11, /* D */
+ R2_MERGENOTPEN = 12, /* DPno */
+ R2_COPYPEN = 13, /* P */
+ R2_MERGEPENNOT = 14, /* PDno */
+ R2_MERGEPEN = 15, /* DPo */
+ R2_WHITE = 16, /* 1 */
+
+ UOI_FLAGS = 1,
+ WSF_VISIBLE = 0x0001,
+ E_UNEXPECTED = unchecked((int)0x8000FFFF),
+ E_NOTIMPL = unchecked((int)0x80004001),
+ E_OUTOFMEMORY = unchecked((int)0x8007000E),
+ E_INVALIDARG = unchecked((int)0x80070057),
+ E_NOINTERFACE = unchecked((int)0x80004002),
+ E_POINTER = unchecked((int)0x80004003),
+ E_HANDLE = unchecked((int)0x80070006),
+ E_ABORT = unchecked((int)0x80004004),
+ E_FAIL = unchecked((int)0x80004005),
+ E_ACCESSDENIED = unchecked((int)0x80070005),
+ PM_NOREMOVE = 0x0000,
+ PM_REMOVE = 0x0001,
+ PM_NOYIELD = 0x0002,
+ GMEM_FIXED = 0x0000,
+ GMEM_MOVEABLE = 0x0002,
+ GMEM_NOCOMPACT = 0x0010,
+ GMEM_NODISCARD = 0x0020,
+ GMEM_ZEROINIT = 0x0040,
+ GMEM_MODIFY = 0x0080,
+ GMEM_DISCARDABLE = 0x0100,
+ GMEM_NOT_BANKED = 0x1000,
+ GMEM_SHARE = 0x2000,
+ GMEM_DDESHARE = 0x2000,
+ GMEM_NOTIFY = 0x4000,
+ GMEM_LOWER = 0x1000,
+ GMEM_VALID_FLAGS = 0x7F72,
+ GMEM_INVALID_HANDLE = unchecked((int)0x8000),
+ DM_UPDATE = 1,
+ DM_COPY = 2,
+ DM_PROMPT = 4,
+ DM_MODIFY = 8,
+ DM_IN_BUFFER = 8,
+ DM_IN_PROMPT = 4,
+ DM_OUT_BUFFER = 2,
+ DM_OUT_DEFAULT = 1,
+ DT_PLOTTER = 0,
+ DT_RASDISPLAY = 1,
+ DT_RASPRINTER = 2,
+ DT_RASCAMERA = 3,
+ DT_CHARSTREAM = 4,
+ DT_METAFILE = 5,
+ DT_DISPFILE = 6,
+ TECHNOLOGY = 2,
+ DC_FIELDS = 1,
+ DC_PAPERS = 2,
+ DC_PAPERSIZE = 3,
+ DC_MINEXTENT = 4,
+ DC_MAXEXTENT = 5,
+ DC_BINS = 6,
+ DC_DUPLEX = 7,
+ DC_SIZE = 8,
+ DC_EXTRA = 9,
+ DC_VERSION = 10,
+ DC_DRIVER = 11,
+ DC_BINNAMES = 12,
+ DC_ENUMRESOLUTIONS = 13,
+ DC_FILEDEPENDENCIES = 14,
+ DC_TRUETYPE = 15,
+ DC_PAPERNAMES = 16,
+ DC_ORIENTATION = 17,
+ DC_COPIES = 18,
+ PD_ALLPAGES = 0x00000000,
+ PD_SELECTION = 0x00000001,
+ PD_PAGENUMS = 0x00000002,
+ PD_CURRENTPAGE = 0x00400000,
+ PD_NOSELECTION = 0x00000004,
+ PD_NOPAGENUMS = 0x00000008,
+ PD_NOCURRENTPAGE = 0x00800000,
+ PD_COLLATE = 0x00000010,
+ PD_PRINTTOFILE = 0x00000020,
+ PD_PRINTSETUP = 0x00000040,
+ PD_NOWARNING = 0x00000080,
+ PD_RETURNDC = 0x00000100,
+ PD_RETURNIC = 0x00000200,
+ PD_RETURNDEFAULT = 0x00000400,
+ PD_SHOWHELP = 0x00000800,
+ PD_ENABLEPRINTHOOK = 0x00001000,
+ PD_ENABLESETUPHOOK = 0x00002000,
+ PD_ENABLEPRINTTEMPLATE = 0x00004000,
+ PD_ENABLESETUPTEMPLATE = 0x00008000,
+ PD_ENABLEPRINTTEMPLATEHANDLE = 0x00010000,
+ PD_ENABLESETUPTEMPLATEHANDLE = 0x00020000,
+ PD_USEDEVMODECOPIES = 0x00040000,
+ PD_USEDEVMODECOPIESANDCOLLATE = 0x00040000,
+ PD_DISABLEPRINTTOFILE = 0x00080000,
+ PD_HIDEPRINTTOFILE = 0x00100000,
+ PD_NONETWORKBUTTON = 0x00200000,
+ DI_MASK = 0x0001,
+ DI_IMAGE = 0x0002,
+ DI_NORMAL = 0x0003,
+ DI_COMPAT = 0x0004,
+ DI_DEFAULTSIZE = 0x0008,
+ IDC_ARROW = 32512,
+ IDC_IBEAM = 32513,
+ IDC_WAIT = 32514,
+ IDC_CROSS = 32515,
+ IDC_UPARROW = 32516,
+ IDC_SIZE = 32640,
+ IDC_ICON = 32641,
+ IDC_SIZENWSE = 32642,
+ IDC_SIZENESW = 32643,
+ IDC_SIZEWE = 32644,
+ IDC_SIZENS = 32645,
+ IDC_SIZEALL = 32646,
+ IDC_NO = 32648,
+ IDC_APPSTARTING = 32650,
+ IDC_HELP = 32651,
+ IMAGE_BITMAP = 0,
+ IMAGE_ICON = 1,
+ IMAGE_CURSOR = 2,
+ IMAGE_ENHMETAFILE = 3,
+ IDI_APPLICATION = 32512,
+ IDI_HAND = 32513,
+ IDI_QUESTION = 32514,
+ IDI_EXCLAMATION = 32515,
+ IDI_ASTERISK = 32516,
+ IDI_WINLOGO = 32517,
+ IDI_WARNING = 32515,
+ IDI_ERROR = 32513,
+ IDI_INFORMATION = 32516,
+ IDI_SHIELD = 32518,
+ SRCCOPY = 0x00CC0020,
+ PLANES = 14,
+ PS_SOLID = 0,
+ PS_DASH = 1,
+ PS_DOT = 2,
+ PS_DASHDOT = 3,
+ PS_DASHDOTDOT = 4,
+ PS_NULL = 5,
+ PS_INSIDEFRAME = 6,
+ PS_USERSTYLE = 7,
+ PS_ALTERNATE = 8,
+ PS_STYLE_MASK = 0x0000000F,
+ PS_ENDCAP_ROUND = 0x00000000,
+ PS_ENDCAP_SQUARE = 0x00000100,
+ PS_ENDCAP_FLAT = 0x00000200,
+ PS_ENDCAP_MASK = 0x00000F00,
+ PS_JOIN_ROUND = 0x00000000,
+ PS_JOIN_BEVEL = 0x00001000,
+ PS_JOIN_MITER = 0x00002000,
+ PS_JOIN_MASK = 0x0000F000,
+ PS_COSMETIC = 0x00000000,
+ PS_GEOMETRIC = 0x00010000,
+ PS_TYPE_MASK = 0x000F0000,
+ BITSPIXEL = 12,
+ ALTERNATE = 1,
+ LOGPIXELSX = 88,
+ LOGPIXELSY = 90,
+ PHYSICALWIDTH = 110,
+ PHYSICALHEIGHT = 111,
+ PHYSICALOFFSETX = 112,
+ PHYSICALOFFSETY = 113,
+ WINDING = 2,
+ VERTRES = 10,
+ HORZRES = 8,
+ DM_SPECVERSION = 0x0401,
+ DM_ORIENTATION = 0x00000001,
+ DM_PAPERSIZE = 0x00000002,
+ DM_PAPERLENGTH = 0x00000004,
+ DM_PAPERWIDTH = 0x00000008,
+ DM_SCALE = 0x00000010,
+ DM_COPIES = 0x00000100,
+ DM_DEFAULTSOURCE = 0x00000200,
+ DM_PRINTQUALITY = 0x00000400,
+ DM_COLOR = 0x00000800,
+ DM_DUPLEX = 0x00001000,
+ DM_YRESOLUTION = 0x00002000,
+ DM_TTOPTION = 0x00004000,
+ DM_COLLATE = 0x00008000,
+ DM_FORMNAME = 0x00010000,
+ DM_LOGPIXELS = 0x00020000,
+ DM_BITSPERPEL = 0x00040000,
+ DM_PELSWIDTH = 0x00080000,
+ DM_PELSHEIGHT = 0x00100000,
+ DM_DISPLAYFLAGS = 0x00200000,
+ DM_DISPLAYFREQUENCY = 0x00400000,
+ DM_PANNINGWIDTH = 0x00800000,
+ DM_PANNINGHEIGHT = 0x01000000,
+ DM_ICMMETHOD = 0x02000000,
+ DM_ICMINTENT = 0x04000000,
+ DM_MEDIATYPE = 0x08000000,
+ DM_DITHERTYPE = 0x10000000,
+ DM_ICCMANUFACTURER = 0x20000000,
+ DM_ICCMODEL = 0x40000000,
+ DMORIENT_PORTRAIT = 1,
+ DMORIENT_LANDSCAPE = 2,
+ DMPAPER_LETTER = 1,
+ DMPAPER_LETTERSMALL = 2,
+ DMPAPER_TABLOID = 3,
+ DMPAPER_LEDGER = 4,
+ DMPAPER_LEGAL = 5,
+ DMPAPER_STATEMENT = 6,
+ DMPAPER_EXECUTIVE = 7,
+ DMPAPER_A3 = 8,
+ DMPAPER_A4 = 9,
+ DMPAPER_A4SMALL = 10,
+ DMPAPER_A5 = 11,
+ DMPAPER_B4 = 12,
+ DMPAPER_B5 = 13,
+ DMPAPER_FOLIO = 14,
+ DMPAPER_QUARTO = 15,
+ DMPAPER_10X14 = 16,
+ DMPAPER_11X17 = 17,
+ DMPAPER_NOTE = 18,
+ DMPAPER_ENV_9 = 19,
+ DMPAPER_ENV_10 = 20,
+ DMPAPER_ENV_11 = 21,
+ DMPAPER_ENV_12 = 22,
+ DMPAPER_ENV_14 = 23,
+ DMPAPER_CSHEET = 24,
+ DMPAPER_DSHEET = 25,
+ DMPAPER_ESHEET = 26,
+ DMPAPER_ENV_DL = 27,
+ DMPAPER_ENV_C5 = 28,
+ DMPAPER_ENV_C3 = 29,
+ DMPAPER_ENV_C4 = 30,
+ DMPAPER_ENV_C6 = 31,
+ DMPAPER_ENV_C65 = 32,
+ DMPAPER_ENV_B4 = 33,
+ DMPAPER_ENV_B5 = 34,
+ DMPAPER_ENV_B6 = 35,
+ DMPAPER_ENV_ITALY = 36,
+ DMPAPER_ENV_MONARCH = 37,
+ DMPAPER_ENV_PERSONAL = 38,
+ DMPAPER_FANFOLD_US = 39,
+ DMPAPER_FANFOLD_STD_GERMAN = 40,
+ DMPAPER_FANFOLD_LGL_GERMAN = 41,
+ DMPAPER_ISO_B4 = 42,
+ DMPAPER_JAPANESE_POSTCARD = 43,
+ DMPAPER_9X11 = 44,
+ DMPAPER_10X11 = 45,
+ DMPAPER_15X11 = 46,
+ DMPAPER_ENV_INVITE = 47,
+ DMPAPER_RESERVED_48 = 48,
+ DMPAPER_RESERVED_49 = 49,
+ DMPAPER_LETTER_EXTRA = 50,
+ DMPAPER_LEGAL_EXTRA = 51,
+ DMPAPER_TABLOID_EXTRA = 52,
+ DMPAPER_A4_EXTRA = 53,
+ DMPAPER_LETTER_TRANSVERSE = 54,
+ DMPAPER_A4_TRANSVERSE = 55,
+ DMPAPER_LETTER_EXTRA_TRANSVERSE = 56,
+ DMPAPER_A_PLUS = 57,
+ DMPAPER_B_PLUS = 58,
+ DMPAPER_LETTER_PLUS = 59,
+ DMPAPER_A4_PLUS = 60,
+ DMPAPER_A5_TRANSVERSE = 61,
+ DMPAPER_B5_TRANSVERSE = 62,
+ DMPAPER_A3_EXTRA = 63,
+ DMPAPER_A5_EXTRA = 64,
+ DMPAPER_B5_EXTRA = 65,
+ DMPAPER_A2 = 66,
+ DMPAPER_A3_TRANSVERSE = 67,
+ DMPAPER_A3_EXTRA_TRANSVERSE = 68,
+
+ // WINVER >= 0x0500
+ DMPAPER_DBL_JAPANESE_POSTCARD = 69, /* Japanese Double Postcard 200 x 148 mm */
+ DMPAPER_A6 = 70, /* A6 105 x 148 mm */
+ DMPAPER_JENV_KAKU2 = 71, /* Japanese Envelope Kaku #2 */
+ DMPAPER_JENV_KAKU3 = 72, /* Japanese Envelope Kaku #3 */
+ DMPAPER_JENV_CHOU3 = 73, /* Japanese Envelope Chou #3 */
+ DMPAPER_JENV_CHOU4 = 74, /* Japanese Envelope Chou #4 */
+ DMPAPER_LETTER_ROTATED = 75, /* Letter Rotated 11 x 8 1/2 11 in */
+ DMPAPER_A3_ROTATED = 76, /* A3 Rotated 420 x 297 mm */
+ DMPAPER_A4_ROTATED = 77, /* A4 Rotated 297 x 210 mm */
+ DMPAPER_A5_ROTATED = 78, /* A5 Rotated 210 x 148 mm */
+ DMPAPER_B4_JIS_ROTATED = 79, /* B4 (JIS) Rotated 364 x 257 mm */
+ DMPAPER_B5_JIS_ROTATED = 80, /* B5 (JIS) Rotated 257 x 182 mm */
+ DMPAPER_JAPANESE_POSTCARD_ROTATED = 81, /* Japanese Postcard Rotated 148 x 100 mm */
+ DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED = 82, /* Double Japanese Postcard Rotated 148 x 200 mm */
+ DMPAPER_A6_ROTATED = 83, /* A6 Rotated 148 x 105 mm */
+ DMPAPER_JENV_KAKU2_ROTATED = 84, /* Japanese Envelope Kaku #2 Rotated */
+ DMPAPER_JENV_KAKU3_ROTATED = 85, /* Japanese Envelope Kaku #3 Rotated */
+ DMPAPER_JENV_CHOU3_ROTATED = 86, /* Japanese Envelope Chou #3 Rotated */
+ DMPAPER_JENV_CHOU4_ROTATED = 87, /* Japanese Envelope Chou #4 Rotated */
+ DMPAPER_B6_JIS = 88, /* B6 (JIS) 128 x 182 mm */
+ DMPAPER_B6_JIS_ROTATED = 89, /* B6 (JIS) Rotated 182 x 128 mm */
+ DMPAPER_12X11 = 90, /* 12 x 11 in */
+ DMPAPER_JENV_YOU4 = 91, /* Japanese Envelope You #4 */
+ DMPAPER_JENV_YOU4_ROTATED = 92, /* Japanese Envelope You #4 Rotated*/
+ DMPAPER_P16K = 93, /* PRC 16K 146 x 215 mm */
+ DMPAPER_P32K = 94, /* PRC 32K 97 x 151 mm */
+ DMPAPER_P32KBIG = 95, /* PRC 32K(Big) 97 x 151 mm */
+ DMPAPER_PENV_1 = 96, /* PRC Envelope #1 102 x 165 mm */
+ DMPAPER_PENV_2 = 97, /* PRC Envelope #2 102 x 176 mm */
+ DMPAPER_PENV_3 = 98, /* PRC Envelope #3 125 x 176 mm */
+ DMPAPER_PENV_4 = 99, /* PRC Envelope #4 110 x 208 mm */
+ DMPAPER_PENV_5 = 100, /* PRC Envelope #5 110 x 220 mm */
+ DMPAPER_PENV_6 = 101, /* PRC Envelope #6 120 x 230 mm */
+ DMPAPER_PENV_7 = 102, /* PRC Envelope #7 160 x 230 mm */
+ DMPAPER_PENV_8 = 103, /* PRC Envelope #8 120 x 309 mm */
+ DMPAPER_PENV_9 = 104, /* PRC Envelope #9 229 x 324 mm */
+ DMPAPER_PENV_10 = 105, /* PRC Envelope #10 324 x 458 mm */
+ DMPAPER_P16K_ROTATED = 106, /* PRC 16K Rotated */
+ DMPAPER_P32K_ROTATED = 107, /* PRC 32K Rotated */
+ DMPAPER_P32KBIG_ROTATED = 108, /* PRC 32K(Big) Rotated */
+ DMPAPER_PENV_1_ROTATED = 109, /* PRC Envelope #1 Rotated 165 x 102 mm */
+ DMPAPER_PENV_2_ROTATED = 110, /* PRC Envelope #2 Rotated 176 x 102 mm */
+ DMPAPER_PENV_3_ROTATED = 111, /* PRC Envelope #3 Rotated 176 x 125 mm */
+ DMPAPER_PENV_4_ROTATED = 112, /* PRC Envelope #4 Rotated 208 x 110 mm */
+ DMPAPER_PENV_5_ROTATED = 113, /* PRC Envelope #5 Rotated 220 x 110 mm */
+ DMPAPER_PENV_6_ROTATED = 114, /* PRC Envelope #6 Rotated 230 x 120 mm */
+ DMPAPER_PENV_7_ROTATED = 115, /* PRC Envelope #7 Rotated 230 x 160 mm */
+ DMPAPER_PENV_8_ROTATED = 116, /* PRC Envelope #8 Rotated 309 x 120 mm */
+ DMPAPER_PENV_9_ROTATED = 117, /* PRC Envelope #9 Rotated 324 x 229 mm */
+ DMPAPER_PENV_10_ROTATED = 118, /* PRC Envelope #10 Rotated 458 x 324 mm */
+
+ DMPAPER_LAST = DMPAPER_PENV_10_ROTATED,
+ DMPAPER_USER = 256,
+
+ DMBIN_UPPER = 1,
+ DMBIN_ONLYONE = 1,
+ DMBIN_LOWER = 2,
+ DMBIN_MIDDLE = 3,
+ DMBIN_MANUAL = 4,
+ DMBIN_ENVELOPE = 5,
+ DMBIN_ENVMANUAL = 6,
+ DMBIN_AUTO = 7,
+ DMBIN_TRACTOR = 8,
+ DMBIN_SMALLFMT = 9,
+ DMBIN_LARGEFMT = 10,
+ DMBIN_LARGECAPACITY = 11,
+ DMBIN_CASSETTE = 14,
+ DMBIN_FORMSOURCE = 15,
+ DMBIN_LAST = 15,
+ DMBIN_USER = 256,
+ DMRES_DRAFT = -1,
+ DMRES_LOW = -2,
+ DMRES_MEDIUM = -3,
+ DMRES_HIGH = -4,
+ DMCOLOR_MONOCHROME = 1,
+ DMCOLOR_COLOR = 2,
+ DMDUP_SIMPLEX = 1,
+ DMDUP_VERTICAL = 2,
+ DMDUP_HORIZONTAL = 3,
+ DMTT_BITMAP = 1,
+ DMTT_DOWNLOAD = 2,
+ DMTT_SUBDEV = 3,
+ DMTT_DOWNLOAD_OUTLINE = 4,
+ DMCOLLATE_FALSE = 0,
+ DMCOLLATE_TRUE = 1,
+ DMDISPLAYFLAGS_TEXTMODE = 0x00000004,
+ DMICMMETHOD_NONE = 1,
+ DMICMMETHOD_SYSTEM = 2,
+ DMICMMETHOD_DRIVER = 3,
+ DMICMMETHOD_DEVICE = 4,
+ DMICMMETHOD_USER = 256,
+ DMICM_SATURATE = 1,
+ DMICM_CONTRAST = 2,
+ DMICM_COLORMETRIC = 3,
+ DMICM_USER = 256,
+ DMMEDIA_STANDARD = 1,
+ DMMEDIA_TRANSPARENCY = 2,
+ DMMEDIA_GLOSSY = 3,
+ DMMEDIA_USER = 256,
+ DMDITHER_NONE = 1,
+ DMDITHER_COARSE = 2,
+ DMDITHER_FINE = 3,
+ DMDITHER_LINEART = 4,
+ DMDITHER_GRAYSCALE = 5,
+ DMDITHER_USER = 256,
+ PRINTER_ENUM_DEFAULT = 0x00000001,
+ PRINTER_ENUM_LOCAL = 0x00000002,
+ PRINTER_ENUM_CONNECTIONS = 0x00000004,
+ PRINTER_ENUM_FAVORITE = 0x00000004,
+ PRINTER_ENUM_NAME = 0x00000008,
+ PRINTER_ENUM_REMOTE = 0x00000010,
+ PRINTER_ENUM_SHARED = 0x00000020,
+ PRINTER_ENUM_NETWORK = 0x00000040,
+ PRINTER_ENUM_EXPAND = 0x00004000,
+ PRINTER_ENUM_CONTAINER = 0x00008000,
+ PRINTER_ENUM_ICONMASK = 0x00ff0000,
+ PRINTER_ENUM_ICON1 = 0x00010000,
+ PRINTER_ENUM_ICON2 = 0x00020000,
+ PRINTER_ENUM_ICON3 = 0x00040000,
+ PRINTER_ENUM_ICON4 = 0x00080000,
+ PRINTER_ENUM_ICON5 = 0x00100000,
+ PRINTER_ENUM_ICON6 = 0x00200000,
+ PRINTER_ENUM_ICON7 = 0x00400000,
+ PRINTER_ENUM_ICON8 = 0x00800000,
+ DC_BINADJUST = 19,
+ DC_EMF_COMPLIANT = 20,
+ DC_DATATYPE_PRODUCED = 21,
+ DC_COLLATE = 22,
+ DCTT_BITMAP = 0x0000001,
+ DCTT_DOWNLOAD = 0x0000002,
+ DCTT_SUBDEV = 0x0000004,
+ DCTT_DOWNLOAD_OUTLINE = 0x0000008,
+ DCBA_FACEUPNONE = 0x0000,
+ DCBA_FACEUPCENTER = 0x0001,
+ DCBA_FACEUPLEFT = 0x0002,
+ DCBA_FACEUPRIGHT = 0x0003,
+ DCBA_FACEDOWNNONE = 0x0100,
+ DCBA_FACEDOWNCENTER = 0x0101,
+ DCBA_FACEDOWNLEFT = 0x0102,
+ DCBA_FACEDOWNRIGHT = 0x0103,
+ SRCPAINT = 0x00EE0086, /* dest = source OR dest */
+ SRCAND = 0x008800C6, /* dest = source AND dest */
+ SRCINVERT = 0x00660046, /* dest = source XOR dest */
+ SRCERASE = 0x00440328, /* dest = source AND (NOT dest ) */
+ NOTSRCCOPY = 0x00330008, /* dest = (NOT source) */
+ NOTSRCERASE = 0x001100A6, /* dest = (NOT src) AND (NOT dest) */
+ MERGECOPY = 0x00C000CA, /* dest = (source AND pattern) */
+ MERGEPAINT = 0x00BB0226, /* dest = (NOT source) OR dest */
+ PATCOPY = 0x00F00021, /* dest = pattern */
+ PATPAINT = 0x00FB0A09, /* dest = DPSnoo */
+ PATINVERT = 0x005A0049, /* dest = pattern XOR dest */
+ DSTINVERT = 0x00550009, /* dest = (NOT dest) */
+ BLACKNESS = 0x00000042, /* dest = BLACK */
+ WHITENESS = 0x00FF0062, /* dest = WHITE */
+ CAPTUREBLT = 0x40000000, /* Include layered windows */
+ SM_CXSCREEN = 0,
+ SM_CYSCREEN = 1,
+ SM_CXVSCROLL = 2,
+ SM_CYHSCROLL = 3,
+ SM_CYCAPTION = 4,
+ SM_CXBORDER = 5,
+ SM_CYBORDER = 6,
+ SM_CXDLGFRAME = 7,
+ SM_CYDLGFRAME = 8,
+ SM_CYVTHUMB = 9,
+ SM_CXHTHUMB = 10,
+ SM_CXICON = 11,
+ SM_CYICON = 12,
+ SM_CXCURSOR = 13,
+ SM_CYCURSOR = 14,
+ SM_CYMENU = 15,
+ SM_CXFULLSCREEN = 16,
+ SM_CYFULLSCREEN = 17,
+ SM_CYKANJIWINDOW = 18,
+ SM_MOUSEPRESENT = 19,
+ SM_CYVSCROLL = 20,
+ SM_CXHSCROLL = 21,
+ SM_DEBUG = 22,
+ SM_SWAPBUTTON = 23,
+ SM_RESERVED1 = 24,
+ SM_RESERVED2 = 25,
+ SM_RESERVED3 = 26,
+ SM_RESERVED4 = 27,
+ SM_CXMIN = 28,
+ SM_CYMIN = 29,
+ SM_CXSIZE = 30,
+ SM_CYSIZE = 31,
+ SM_CXFRAME = 32,
+ SM_CYFRAME = 33,
+ SM_CXMINTRACK = 34,
+ SM_CYMINTRACK = 35,
+ SM_CXDOUBLECLK = 36,
+ SM_CYDOUBLECLK = 37,
+ SM_CXICONSPACING = 38,
+ SM_CYICONSPACING = 39,
+ SM_MENUDROPALIGNMENT = 40,
+ SM_PENWINDOWS = 41,
+ SM_DBCSENABLED = 42,
+ SM_CMOUSEBUTTONS = 43,
+ SM_CXFIXEDFRAME = 7,
+ SM_CYFIXEDFRAME = 8,
+ SM_CXSIZEFRAME = 32,
+ SM_CYSIZEFRAME = 33,
+ SM_SECURE = 44,
+ SM_CXEDGE = 45,
+ SM_CYEDGE = 46,
+ SM_CXMINSPACING = 47,
+ SM_CYMINSPACING = 48,
+ SM_CXSMICON = 49,
+ SM_CYSMICON = 50,
+ SM_CYSMCAPTION = 51,
+ SM_CXSMSIZE = 52,
+ SM_CYSMSIZE = 53,
+ SM_CXMENUSIZE = 54,
+ SM_CYMENUSIZE = 55,
+ SM_ARRANGE = 56,
+ SM_CXMINIMIZED = 57,
+ SM_CYMINIMIZED = 58,
+ SM_CXMAXTRACK = 59,
+ SM_CYMAXTRACK = 60,
+ SM_CXMAXIMIZED = 61,
+ SM_CYMAXIMIZED = 62,
+ SM_NETWORK = 63,
+ SM_CLEANBOOT = 67,
+ SM_CXDRAG = 68,
+ SM_CYDRAG = 69,
+ SM_SHOWSOUNDS = 70,
+ SM_CXMENUCHECK = 71,
+ SM_CYMENUCHECK = 72,
+ SM_SLOWMACHINE = 73,
+ SM_MIDEASTENABLED = 74,
+ SM_MOUSEWHEELPRESENT = 75,
+ SM_XVIRTUALSCREEN = 76,
+ SM_YVIRTUALSCREEN = 77,
+ SM_CXVIRTUALSCREEN = 78,
+ SM_CYVIRTUALSCREEN = 79,
+ SM_CMONITORS = 80,
+ SM_SAMEDISPLAYFORMAT = 81,
+ SM_CMETRICS = 83,
+
+ /* SetGraphicsMode(hdc, iMode ) */
+ GM_COMPATIBLE = 1,
+ GM_ADVANCED = 2,
+ MWT_IDENTITY = 1,
+
+ /* FONT WEIGHT (BOLD) VALUES */
+ FW_DONTCARE = 0,
+ FW_NORMAL = 400,
+ FW_BOLD = 700,
+ // some others...
+
+ /* FONT CHARACTER SET */
+ ANSI_CHARSET = 0,
+ DEFAULT_CHARSET = 1,
+ // plus others ....
+
+ /* Font OutPrecision */
+ OUT_DEFAULT_PRECIS = 0,
+ OUT_TT_PRECIS = 4,
+ OUT_TT_ONLY_PRECIS = 7,
+ // some others...
+
+ /* Font clip precision */
+ CLIP_DEFAULT_PRECIS = 0,
+ // some others...
+
+ /* Font Quality */
+ DEFAULT_QUALITY = 0,
+
+ /* Mapping Modes */
+ MM_TEXT = 1,
+ // some others...
+
+ /* Object Definitions for GetCurrentObject() and others. */
+ OBJ_FONT = 6,
+ // some others...
+
+
+ /* Text Aligment */
+ // TA_NOUPDATECP = 0,
+ // TA_LEFT = 0,
+ // TA_TOP = 0,
+ TA_DEFAULT = 0,
+
+ FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x00000100,
+ FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200,
+ FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000,
+ FORMAT_MESSAGE_DEFAULT = FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM;
+ // some others...
+
+
+ public const int NOMIRRORBITMAP = unchecked((int)0x80000000); /* Do not Mirror the bitmap in this call */
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "CreateCompatibleBitmap", CharSet = CharSet.Auto)]
+ public static extern IntPtr IntCreateCompatibleBitmap(HandleRef hDC, int width, int height);
+ public static IntPtr CreateCompatibleBitmap(HandleRef hDC, int width, int height)
+ {
+ return System.Internal.HandleCollector.Add(IntCreateCompatibleBitmap(hDC, width, height), SafeNativeMethods.CommonHandles.GDI);
+ }
+
+
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "CreateBitmap", CharSet = CharSet.Auto)]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
+ public static extern IntPtr IntCreateBitmap(int width, int height, int planes, int bpp, IntPtr bitmapData);
+ public static IntPtr CreateBitmap(int width, int height, int planes, int bpp, IntPtr bitmapData)
+ {
+ return System.Internal.HandleCollector.Add(IntCreateBitmap(width, height, planes, bpp, bitmapData), SafeNativeMethods.CommonHandles.GDI);
+ }
+
+
+ // FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future.
+ //[DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, EntryPoint="CreatePatternBrush", CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ //private static extern IntPtr /*HBRUSH*/ IntCreatePatternBrush(HandleRef hbmp);
+ //public static IntPtr /*HBRUSH*/ CreatePatternBrush(HandleRef hbmp) {
+ // return System.Internal.HandleCollector.Add(IntCreatePatternBrush(hbmp), SafeNativeMethods.CommonHandles.GDI);
+ //}
+
+ /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future.
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=CharSet.Auto)]
+ public static extern long GetBitmapBits(HandleRef hbmp, long nBytes, byte[] buffer);
+ */
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int BitBlt(HandleRef hDC, int x, int y, int nWidth, int nHeight,
+ HandleRef hSrcDC, int xSrc, int ySrc, int dwRop);
+ /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future.
+ [DllImport(ExternDll.Gdi32)]
+ public static extern IntPtr GetDIBits(HandleRef hdc, HandleRef hbm, int arg1, int arg2, IntPtr arg3, NativeMethods.BITMAPINFOHEADER bmi, int arg5);
+ */
+
+ [DllImport(ExternDll.Gdi32)]
+ public static extern int GetDIBits(HandleRef hdc, HandleRef hbm, int arg1, int arg2, IntPtr arg3, ref NativeMethods.BITMAPINFO_FLAT bmi, int arg5);
+
+ /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future.
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetPaletteEntries(HandleRef hpal, int iStartIndex, int nEntries, int[] lppe);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetPaletteEntries(HandleRef hpal, int iStartIndex, int nEntries, IntPtr lppe);
+ */
+
+ [DllImport(ExternDll.Gdi32)]
+ public static extern uint GetPaletteEntries(HandleRef hpal, int iStartIndex, int nEntries, byte[] lppe);
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "CreateDIBSection", CharSet = CharSet.Auto)]
+ public static extern IntPtr IntCreateDIBSection(HandleRef hdc, ref NativeMethods.BITMAPINFO_FLAT bmi, int iUsage, ref IntPtr ppvBits, IntPtr hSection, int dwOffset);
+ public static IntPtr CreateDIBSection(HandleRef hdc, ref NativeMethods.BITMAPINFO_FLAT bmi, int iUsage, ref IntPtr ppvBits, IntPtr hSection, int dwOffset)
+ {
+ return System.Internal.HandleCollector.Add(IntCreateDIBSection(hdc, ref bmi, iUsage, ref ppvBits, hSection, dwOffset), SafeNativeMethods.CommonHandles.GDI);
+ }
+
+ [DllImport(ExternDll.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern IntPtr GlobalFree(HandleRef handle);
+ [DllImport(ExternDll.Gdi32, SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int StartDoc(HandleRef hDC, DOCINFO lpDocInfo);
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int StartPage(HandleRef hDC);
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int EndPage(HandleRef hDC);
+ // public static extern int SetAbortProc(m_hDC, (ABORTPROC)lpfn);
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int AbortDoc(HandleRef hDC);
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int EndDoc(HandleRef hDC);
+
+ [DllImport(ExternDll.Comdlg32, SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool PrintDlg([In, Out] PRINTDLG lppd);
+
+ [DllImport(ExternDll.Comdlg32, SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool PrintDlg([In, Out] PRINTDLGX86 lppd);
+
+ /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future.
+ [DllImport(ExternDll.Comdlg32, SetLastError=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int PageSetupDlg([In, Out] PAGESETUPDLG lppsd);
+ */
+
+ [DllImport(ExternDll.Winspool, SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int DeviceCapabilities(string pDevice, string pPort, short fwCapabilities, IntPtr pOutput, IntPtr /*DEVMODE*/ pDevMode);
+
+ [DllImport(ExternDll.Winspool, SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, BestFitMapping = false)]
+ public static extern int DocumentProperties(HandleRef hwnd, HandleRef hPrinter, string pDeviceName, IntPtr /*DEVMODE*/ pDevModeOutput, HandleRef /*DEVMODE*/ pDevModeInput, int fMode);
+
+ [DllImport(ExternDll.Winspool, SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, BestFitMapping = false)]
+ public static extern int DocumentProperties(HandleRef hwnd, HandleRef hPrinter, string pDeviceName, IntPtr /*DEVMODE*/ pDevModeOutput, IntPtr /*DEVMODE*/ pDevModeInput, int fMode);
+
+ /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future.
+ [DllImport(ExternDll.Winspool, SetLastError=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetPrinter(HandleRef hPrinter, int level, HandleRef pPrinter, int cbBuf, int[] pcbNeeded);
+
+ [DllImport(ExternDll.Winspool, SetLastError=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool OpenPrinter(string pPrinterName, HandleRef [] phPrinter, HandleRef pDefault);
+
+ [DllImport(ExternDll.Winspool, SetLastError=true, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int ClosePrinter(HandleRef hPrinter);
+ */
+
+ [DllImport(ExternDll.Winspool, SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int EnumPrinters(int flags, string name, int level, IntPtr pPrinterEnum/*buffer*/,
+ int cbBuf, out int pcbNeeded, out int pcReturned);
+
+ [DllImport(ExternDll.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern IntPtr GlobalLock(HandleRef handle);
+ [DllImport(ExternDll.Gdi32, SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern IntPtr /*HDC*/ ResetDC(HandleRef hDC, HandleRef /*DEVMODE*/ lpDevMode);
+ [DllImport(ExternDll.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool GlobalUnlock(HandleRef handle);
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "CreateRectRgn", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ private static extern IntPtr IntCreateRectRgn(int x1, int y1, int x2, int y2);
+ public static IntPtr CreateRectRgn(int x1, int y1, int x2, int y2)
+ {
+ return System.Internal.HandleCollector.Add(IntCreateRectRgn(x1, y1, x2, y2), SafeNativeMethods.CommonHandles.GDI);
+ }
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetClipRgn(HandleRef hDC, HandleRef hRgn);
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int SelectClipRgn(HandleRef hDC, HandleRef hRgn);
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2101:SpecifyMarshalingForPInvokeStringArguments")]
+ [DllImport(ExternDll.Gdi32, SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int AddFontResourceEx(string lpszFilename, int fl, IntPtr pdv);
+
+ public static int AddFontFile(string fileName)
+ {
+ // This is not supported in Win9x systems.
+ if (Marshal.SystemDefaultCharSize == 1)
+ {
+ return 0;
+ }
+
+ return AddFontResourceEx(fileName, /*FR_PRIVATE*/ 0x10, IntPtr.Zero);
+ }
+
+
+ /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future.
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int ExcludeClipRect(HandleRef hDC, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int SaveDC(HandleRef hDC);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool RestoreDC(HandleRef hDC, int nSavedDC);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool SetWorldTransform(HandleRef hDC, NativeMethods.XFORM xform);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool ModifyWorldTransform( HandleRef hdc, NativeMethods.XFORM lpXform, int iMode );
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool GetWorldTransform( HandleRef hdc, NativeMethods.XFORM lpXform );
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int SetGraphicsMode(HandleRef hDC, int iMode);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetGraphicsMode(HandleRef hDC);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetNearestColor(HandleRef hDC, int color);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetRgnBox(HandleRef hRegion, ref RECT clipRect);
+
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, EntryPoint="CreateCompatibleDC", CharSet=CharSet.Auto)]
+ public static extern IntPtr IntCreateCompatibleDC(HandleRef hDC);
+ public static IntPtr CreateCompatibleDC(HandleRef hDC) {
+ return System.Internal.HandleCollector.Add(IntCreateCompatibleDC(hDC), SafeNativeMethods.CommonHandles.GDI);
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool Polygon(HandleRef hDC, SafeNativeMethods.POINT[] points, int nCount);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int SetPolyFillMode(HandleRef hDC, int nPolyFillMode);
+ */
+
+
+ internal static IntPtr SaveClipRgn(IntPtr hDC)
+ {
+ IntPtr hTempRgn = CreateRectRgn(0, 0, 0, 0);
+ IntPtr hSaveRgn = IntPtr.Zero;
+ try
+ {
+ int result = GetClipRgn(new HandleRef(null, hDC), new HandleRef(null, hTempRgn));
+ if (result > 0)
+ {
+ hSaveRgn = hTempRgn;
+ hTempRgn = IntPtr.Zero;
+ }
+ }
+ finally
+ {
+ if (hTempRgn != IntPtr.Zero)
+ DeleteObject(new HandleRef(null, hTempRgn));
+ }
+ return hSaveRgn;
+ }
+
+ internal static void RestoreClipRgn(IntPtr hDC, IntPtr hRgn)
+ {
+ try
+ {
+ SelectClipRgn(new HandleRef(null, hDC), new HandleRef(null, hRgn));
+ }
+ finally
+ {
+ if (hRgn != IntPtr.Zero)
+ DeleteObject(new HandleRef(null, hRgn));
+ }
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int ExtEscape(HandleRef hDC, int nEscape, int cbInput, ref int inData, int cbOutput, [Out] out int outData);
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int ExtEscape(HandleRef hDC, int nEscape, int cbInput, byte[] inData, int cbOutput, [Out] out int outData);
+ public const int QUERYESCSUPPORT = 8, CHECKJPEGFORMAT = 4119, CHECKPNGFORMAT = 4120;
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int IntersectClipRect(HandleRef hDC, int x1, int y1, int x2, int y2);
+ [DllImport(ExternDll.Kernel32, SetLastError = true, ExactSpelling = true, EntryPoint = "GlobalAlloc", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern IntPtr IntGlobalAlloc(int uFlags, UIntPtr dwBytes); // size should be 32/64bits compatible
+ public static IntPtr GlobalAlloc(int uFlags, uint dwBytes)
+ {
+ return IntGlobalAlloc(uFlags, new UIntPtr(dwBytes));
+ }
+ [DllImport(ExternDll.Kernel32)]
+ static internal extern void ZeroMemory(IntPtr destination, UIntPtr length);
+
+ //
+ // WARNING: Don't uncomment this code unless you absolutelly need it. Use instead Marshal.GetLastWin32Error
+ // and mark your PInvoke [DllImport(..., SetLastError=true)]
+ // From MSDN:
+ // GetLastWin32Error exposes the Win32 GetLastError API method from Kernel32.DLL. This method exists because
+ // it is not safe to make a direct platform invoke call to GetLastError to obtain this information. If you
+ // want to access this error code, you must call GetLastWin32Error rather than writing your own platform invoke
+ // definition for GetLastError and calling it. The common language runtime can make internal calls to APIs that
+ // overwrite the operating system maintained GetLastError.
+ //
+ //[DllImport(ExternDll.Kernel32, SetLastError=true, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ //public extern static int GetLastError();
+
+ public const int ERROR_ACCESS_DENIED = 5;
+ public const int ERROR_INVALID_PARAMETER = 87;
+ public const int ERROR_PROC_NOT_FOUND = 127;
+
+
+ [System.Runtime.InteropServices.StructLayout(LayoutKind.Sequential)]
+ public class ENHMETAHEADER
+ {
+ /// The ENHMETAHEADER structure is defined natively as a union with WmfHeader.
+ /// Extreme care should be taken if changing the layout of the corresponding managaed
+ /// structures to minimize the risk of buffer overruns. The affected managed classes
+ /// are the following: ENHMETAHEADER, MetaHeader, MetafileHeaderWmf, MetafileHeaderEmf.
+ public int iType;
+ public int nSize = 40; // ndirect.DllLib.sizeOf( this )
+ // rclBounds was a by-value RECTL structure
+ public int rclBounds_left;
+ public int rclBounds_top;
+ public int rclBounds_right;
+ public int rclBounds_bottom;
+ // rclFrame was a by-value RECTL structure
+ public int rclFrame_left;
+ public int rclFrame_top;
+ public int rclFrame_right;
+ public int rclFrame_bottom;
+ public int dSignature;
+ public int nVersion;
+ public int nBytes;
+ public int nRecords;
+ public short nHandles;
+ public short sReserved;
+ public int nDescription;
+ public int offDescription;
+ public int nPalEntries;
+ // szlDevice was a by-value SIZE structure
+ public int szlDevice_cx;
+ public int szlDevice_cy;
+ // szlMillimeters was a by-value SIZE structure
+ public int szlMillimeters_cx;
+ public int szlMillimeters_cy;
+ public int cbPixelFormat;
+ public int offPixelFormat;
+ public int bOpenGL;
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
+ public class DOCINFO
+ {
+ public int cbSize = 20; //ndirect.DllLib.sizeOf(this);
+ public String lpszDocName;
+ public String lpszOutput;
+ public String lpszDatatype;
+ public int fwType;
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
+ public class PRINTDLG
+ {
+ public int lStructSize;
+ public IntPtr hwndOwner;
+ public IntPtr hDevMode;
+ public IntPtr hDevNames;
+ public IntPtr hDC;
+ public int Flags;
+ public short nFromPage;
+ public short nToPage;
+ public short nMinPage;
+ public short nMaxPage;
+ public short nCopies;
+ public IntPtr hInstance;
+ public IntPtr lCustData;
+ public IntPtr lpfnPrintHook;
+ public IntPtr lpfnSetupHook;
+ public string lpPrintTemplateName;
+ public string lpSetupTemplateName;
+ public IntPtr hPrintTemplate;
+ public IntPtr hSetupTemplate;
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 1)]
+ public class PRINTDLGX86
+ {
+ public int lStructSize;
+ public IntPtr hwndOwner;
+ public IntPtr hDevMode;
+ public IntPtr hDevNames;
+ public IntPtr hDC;
+ public int Flags;
+ public short nFromPage;
+ public short nToPage;
+ public short nMinPage;
+ public short nMaxPage;
+ public short nCopies;
+ public IntPtr hInstance;
+ public IntPtr lCustData;
+ public IntPtr lpfnPrintHook;
+ public IntPtr lpfnSetupHook;
+ public string lpPrintTemplateName;
+ public string lpSetupTemplateName;
+ public IntPtr hPrintTemplate;
+ public IntPtr hSetupTemplate;
+ }
+
+
+
+ public enum StructFormat
+ {
+ Ansi = 1,
+ Unicode = 2,
+ Auto = 3,
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct RECT
+ {
+ public int left;
+ public int top;
+ public int right;
+ public int bottom;
+
+ /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future.
+ public static RECT FromXYWH(int x, int y, int width, int height) {
+ return new RECT(x,
+ y,
+ x + width,
+ y + height);
+ }
+
+ public Size Size
+ {
+ get
+ {
+ return new Size(this.right - this.left, this.bottom - this.top);
+ }
+ }
+ */
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct MSG
+ {
+ public IntPtr hwnd;
+ public int message;
+ public IntPtr wParam;
+ public IntPtr lParam;
+ public int time;
+ // pt was a by-value POINT structure
+ public int pt_x;
+ public int pt_y;
+ }
+ [StructLayout(LayoutKind.Sequential)]
+ public class ICONINFO
+ {
+ public int fIcon;
+ public int xHotspot;
+ public int yHotspot;
+ public IntPtr hbmMask = IntPtr.Zero;
+ public IntPtr hbmColor = IntPtr.Zero;
+ }
+ [StructLayout(LayoutKind.Sequential)]
+ public class BITMAP
+ {
+ public int bmType;
+ public int bmWidth;
+ public int bmHeight;
+ public int bmWidthBytes;
+ public short bmPlanes;
+ public short bmBitsPixel;
+ public IntPtr bmBits = IntPtr.Zero;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ public class BITMAPINFOHEADER
+ {
+ public int biSize = 40; // ndirect.DllLib.sizeOf( this );
+ public int biWidth;
+ public int biHeight;
+ public short biPlanes;
+ public short biBitCount;
+ public int biCompression;
+ public int biSizeImage;
+ public int biXPelsPerMeter;
+ public int biYPelsPerMeter;
+ public int biClrUsed;
+ public int biClrImportant;
+ }
+
+
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
+ public class LOGFONT
+ {
+ public int lfHeight;
+ public int lfWidth;
+ public int lfEscapement;
+ public int lfOrientation;
+ public int lfWeight;
+ public byte lfItalic;
+ public byte lfUnderline;
+ public byte lfStrikeOut;
+ public byte lfCharSet;
+ public byte lfOutPrecision;
+ public byte lfClipPrecision;
+ public byte lfQuality;
+ public byte lfPitchAndFamily;
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 32)]
+ public string lfFaceName;
+
+ public LOGFONT()
+ {
+ }
+
+ public LOGFONT(LOGFONT lf)
+ {
+ Debug.Assert(lf != null, "lf is null");
+
+ lfHeight = lf.lfHeight;
+ lfWidth = lf.lfWidth;
+ lfEscapement = lf.lfEscapement;
+ lfOrientation = lf.lfOrientation;
+ lfWeight = lf.lfWeight;
+ lfItalic = lf.lfItalic;
+ lfUnderline = lf.lfUnderline;
+ lfStrikeOut = lf.lfStrikeOut;
+ lfCharSet = lf.lfCharSet;
+ lfOutPrecision = lf.lfOutPrecision;
+ lfClipPrecision = lf.lfClipPrecision;
+ lfQuality = lf.lfQuality;
+ lfPitchAndFamily = lf.lfPitchAndFamily;
+ lfFaceName = lf.lfFaceName;
+ }
+
+ public override string ToString()
+ {
+ return
+ "lfHeight=" + lfHeight + ", " +
+ "lfWidth=" + lfWidth + ", " +
+ "lfEscapement=" + lfEscapement + ", " +
+ "lfOrientation=" + lfOrientation + ", " +
+ "lfWeight=" + lfWeight + ", " +
+ "lfItalic=" + lfItalic + ", " +
+ "lfUnderline=" + lfUnderline + ", " +
+ "lfStrikeOut=" + lfStrikeOut + ", " +
+ "lfCharSet=" + lfCharSet + ", " +
+ "lfOutPrecision=" + lfOutPrecision + ", " +
+ "lfClipPrecision=" + lfClipPrecision + ", " +
+ "lfQuality=" + lfQuality + ", " +
+ "lfPitchAndFamily=" + lfPitchAndFamily + ", " +
+ "lfFaceName=" + lfFaceName;
+ }
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+ public struct TEXTMETRIC
+ {
+ public int tmHeight;
+ public int tmAscent;
+ public int tmDescent;
+ public int tmInternalLeading;
+ public int tmExternalLeading;
+ public int tmAveCharWidth;
+ public int tmMaxCharWidth;
+ public int tmWeight;
+ public int tmOverhang;
+ public int tmDigitizedAspectX;
+ public int tmDigitizedAspectY;
+ public char tmFirstChar;
+ public char tmLastChar;
+ public char tmDefaultChar;
+ public char tmBreakChar;
+ public byte tmItalic;
+ public byte tmUnderlined;
+ public byte tmStruckOut;
+ public byte tmPitchAndFamily;
+ public byte tmCharSet;
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
+ public struct TEXTMETRICA
+ {
+ public int tmHeight;
+ public int tmAscent;
+ public int tmDescent;
+ public int tmInternalLeading;
+ public int tmExternalLeading;
+ public int tmAveCharWidth;
+ public int tmMaxCharWidth;
+ public int tmWeight;
+ public int tmOverhang;
+ public int tmDigitizedAspectX;
+ public int tmDigitizedAspectY;
+ public byte tmFirstChar;
+ public byte tmLastChar;
+ public byte tmDefaultChar;
+ public byte tmBreakChar;
+ public byte tmItalic;
+ public byte tmUnderlined;
+ public byte tmStruckOut;
+ public byte tmPitchAndFamily;
+ public byte tmCharSet;
+ }
+
+ [StructLayout(LayoutKind.Sequential, Pack = 2)]
+ public struct ICONDIR
+ {
+ public short idReserved;
+ public short idType;
+ public short idCount;
+ public ICONDIRENTRY idEntries;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct ICONDIRENTRY
+ {
+ public byte bWidth;
+ public byte bHeight;
+ public byte bColorCount;
+ public byte bReserved;
+ public short wPlanes;
+ public short wBitCount;
+ public int dwBytesInRes;
+ public int dwImageOffset;
+ }
+
+ public class Ole
+ {
+ /*
+ * Pictypes
+ */
+ public const int PICTYPE_UNINITIALIZED = -1;
+ public const int PICTYPE_NONE = 0;
+ public const int PICTYPE_BITMAP = 1;
+ public const int PICTYPE_METAFILE = 2;
+ public const int PICTYPE_ICON = 3;
+ public const int PICTYPE_ENHMETAFILE = 4;
+
+ public const int STATFLAG_DEFAULT = 0;
+ public const int STATFLAG_NONAME = 1;
+ }
+
+
+ [StructLayout(LayoutKind.Sequential)]
+ public class PICTDESC
+ {
+ internal int cbSizeOfStruct;
+ public int picType;
+ internal IntPtr union1;
+ internal int union2;
+ internal int union3;
+
+ /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future.
+ public static PICTDESC CreateBitmapPICTDESC(IntPtr hbitmap, IntPtr hpal) {
+ PICTDESC pictdesc = new PICTDESC();
+ pictdesc.cbSizeOfStruct = 16;
+ pictdesc.picType = Ole.PICTYPE_BITMAP;
+ pictdesc.union1 = hbitmap;
+ pictdesc.union2 = unchecked((int)(((long)hpal) & 0xffffffff));
+ pictdesc.union3 = (int)(((long)hpal) >> 32);
+ return pictdesc;
+ }
+ */
+
+ public static PICTDESC CreateIconPICTDESC(IntPtr hicon)
+ {
+ PICTDESC pictdesc = new PICTDESC();
+ pictdesc.cbSizeOfStruct = 12;
+ pictdesc.picType = Ole.PICTYPE_ICON;
+ pictdesc.union1 = hicon;
+ return pictdesc;
+ }
+
+ /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future.
+ public static PICTDESC CreateEnhMetafilePICTDESC(IntPtr hEMF) {
+ PICTDESC pictdesc = new PICTDESC();
+ pictdesc.cbSizeOfStruct = 12;
+ pictdesc.picType = Ole.PICTYPE_ENHMETAFILE;
+ pictdesc.union1 = hEMF;
+ return pictdesc;
+ }
+
+ public static PICTDESC CreateWinMetafilePICTDESC(IntPtr hmetafile, int x, int y) {
+ PICTDESC pictdesc = new PICTDESC();
+ pictdesc.cbSizeOfStruct = 20;
+ pictdesc.picType = Ole.PICTYPE_METAFILE;
+ pictdesc.union1 = hmetafile;
+ pictdesc.union2 = x;
+ pictdesc.union3 = y;
+ return pictdesc;
+ }
+ */
+
+ public virtual IntPtr GetHandle()
+ {
+ return union1;
+ }
+
+ /*public virtual IntPtr GetHPal() {
+ Debug.Assert((union2 >= 0) && (union3 >= 0));
+
+ long u2 = union2;
+ long u3 = union3;
+ if (picType == Ole.PICTYPE_BITMAP)
+ return (IntPtr)(u2 | (u3 << 32));
+ */
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
+ public class DEVMODE
+ {
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 32)]
+ public string dmDeviceName;
+ public short dmSpecVersion;
+ public short dmDriverVersion;
+ public short dmSize;
+ public short dmDriverExtra;
+ public int dmFields;
+ public short dmOrientation;
+ public short dmPaperSize;
+ public short dmPaperLength;
+ public short dmPaperWidth;
+ public short dmScale;
+ public short dmCopies;
+ public short dmDefaultSource;
+ public short dmPrintQuality;
+ public short dmColor;
+ public short dmDuplex;
+ public short dmYResolution;
+ public short dmTTOption;
+ public short dmCollate;
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 32)]
+ public string dmFormName;
+ public short dmLogPixels;
+ public int dmBitsPerPel;
+ public int dmPelsWidth;
+ public int dmPelsHeight;
+ public int dmDisplayFlags;
+ public int dmDisplayFrequency;
+ public int dmICMMethod;
+ public int dmICMIntent;
+ public int dmMediaType;
+ public int dmDitherType;
+ public int dmICCManufacturer;
+ public int dmICCModel;
+ public int dmPanningWidth;
+ public int dmPanningHeight;
+
+
+ public override string ToString()
+ {
+ return "[DEVMODE: "
+ + "dmDeviceName=" + dmDeviceName
+ + ", dmSpecVersion=" + dmSpecVersion
+ + ", dmDriverVersion=" + dmDriverVersion
+ + ", dmSize=" + dmSize
+ + ", dmDriverExtra=" + dmDriverExtra
+ + ", dmFields=" + dmFields
+ + ", dmOrientation=" + dmOrientation
+ + ", dmPaperSize=" + dmPaperSize
+ + ", dmPaperLength=" + dmPaperLength
+ + ", dmPaperWidth=" + dmPaperWidth
+ + ", dmScale=" + dmScale
+ + ", dmCopies=" + dmCopies
+ + ", dmDefaultSource=" + dmDefaultSource
+ + ", dmPrintQuality=" + dmPrintQuality
+ + ", dmColor=" + dmColor
+ + ", dmDuplex=" + dmDuplex
+ + ", dmYResolution=" + dmYResolution
+ + ", dmTTOption=" + dmTTOption
+ + ", dmCollate=" + dmCollate
+ + ", dmFormName=" + dmFormName
+ + ", dmLogPixels=" + dmLogPixels
+ + ", dmBitsPerPel=" + dmBitsPerPel
+ + ", dmPelsWidth=" + dmPelsWidth
+ + ", dmPelsHeight=" + dmPelsHeight
+ + ", dmDisplayFlags=" + dmDisplayFlags
+ + ", dmDisplayFrequency=" + dmDisplayFrequency
+ + ", dmICMMethod=" + dmICMMethod
+ + ", dmICMIntent=" + dmICMIntent
+ + ", dmMediaType=" + dmMediaType
+ + ", dmDitherType=" + dmDitherType
+ + ", dmICCManufacturer=" + dmICCManufacturer
+ + ", dmICCModel=" + dmICCModel
+ + ", dmPanningWidth=" + dmPanningWidth
+ + ", dmPanningHeight=" + dmPanningHeight
+ + "]";
+ }
+ }
+
+ public sealed class CommonHandles
+ {
+ static CommonHandles()
+ {
+#if DEBUG
+ // Setup the DebugHandleTracker
+ System.Internal.DebugHandleTracker.Initialize();
+ AppDomain.CurrentDomain.DomainUnload += new EventHandler(CurrentDomain_DomainUnload);
+ AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit);
+#endif
+ }
+
+ /// <include file='doc\SafeNativeMethods.uex' path='docs/doc[@for="SafeNativeMethods.CommonHandles.Accelerator"]/*' />
+ /// <devdoc>
+ /// Handle type for accelerator tables.
+ /// </devdoc>
+ public static readonly int Accelerator = System.Internal.HandleCollector.RegisterType("Accelerator", 80, 50);
+
+ /// <include file='doc\SafeNativeMethods.uex' path='docs/doc[@for="SafeNativeMethods.CommonHandles.Cursor"]/*' />
+ /// <devdoc>
+ /// handle type for cursors.
+ /// </devdoc>
+ public static readonly int Cursor = System.Internal.HandleCollector.RegisterType("Cursor", 20, 500);
+
+ /// <include file='doc\SafeNativeMethods.uex' path='docs/doc[@for="SafeNativeMethods.CommonHandles.EMF"]/*' />
+ /// <devdoc>
+ /// Handle type for enhanced metafiles.
+ /// </devdoc>
+ public static readonly int EMF = System.Internal.HandleCollector.RegisterType("EnhancedMetaFile", 20, 500);
+
+ /// <include file='doc\SafeNativeMethods.uex' path='docs/doc[@for="SafeNativeMethods.CommonHandles.Find"]/*' />
+ /// <devdoc>
+ /// Handle type for file find handles.
+ /// </devdoc>
+ public static readonly int Find = System.Internal.HandleCollector.RegisterType("Find", 0, 1000);
+
+ /// <include file='doc\SafeNativeMethods.uex' path='docs/doc[@for="SafeNativeMethods.CommonHandles.GDI"]/*' />
+ /// <devdoc>
+ /// Handle type for GDI objects.
+ /// </devdoc>
+ public static readonly int GDI = System.Internal.HandleCollector.RegisterType("GDI", 50, 500);
+
+ /// <include file='doc\SafeNativeMethods.uex' path='docs/doc[@for="SafeNativeMethods.CommonHandles.HDC"]/*' />
+ /// <devdoc>
+ /// Handle type for HDC's that count against the Win98 limit of five DC's. HDC's
+ /// which are not scarce, such as HDC's for bitmaps, are counted as GDIHANDLE's.
+ /// </devdoc>
+ public static readonly int HDC = System.Internal.HandleCollector.RegisterType("HDC", 100, 2); // wait for 2 dc's before collecting
+
+ /// <include file='doc\SafeNativeMethods.uex' path='docs/doc[@for="SafeNativeMethods.CommonHandles.Icon"]/*' />
+ /// <devdoc>
+ /// Handle type for icons.
+ /// </devdoc>
+ public static readonly int Icon = System.Internal.HandleCollector.RegisterType("Icon", 20, 500);
+
+ /// <include file='doc\SafeNativeMethods.uex' path='docs/doc[@for="SafeNativeMethods.CommonHandles.Kernel"]/*' />
+ /// <devdoc>
+ /// Handle type for kernel objects.
+ /// </devdoc>
+ public static readonly int Kernel = System.Internal.HandleCollector.RegisterType("Kernel", 0, 1000);
+
+ /// <include file='doc\SafeNativeMethods.uex' path='docs/doc[@for="SafeNativeMethods.CommonHandles.Menu"]/*' />
+ /// <devdoc>
+ /// Handle type for files.
+ /// </devdoc>
+ public static readonly int Menu = System.Internal.HandleCollector.RegisterType("Menu", 30, 1000);
+
+ /// <include file='doc\SafeNativeMethods.uex' path='docs/doc[@for="SafeNativeMethods.CommonHandles.Window"]/*' />
+ /// <devdoc>
+ /// Handle type for windows.
+ /// </devdoc>
+ public static readonly int Window = System.Internal.HandleCollector.RegisterType("Window", 5, 1000);
+
+#if DEBUG
+ private static void CurrentDomain_DomainUnload(object sender, EventArgs e)
+ {
+ System.Internal.DebugHandleTracker.CheckLeaks();
+ }
+
+ private static void CurrentDomain_ProcessExit(object sender, EventArgs e)
+ {
+ System.Internal.DebugHandleTracker.CheckLeaks();
+ }
+#endif
+ }
+
+
+ public class StreamConsts
+ {
+ public const int LOCK_WRITE = 0x1;
+ public const int LOCK_EXCLUSIVE = 0x2;
+ public const int LOCK_ONLYONCE = 0x4;
+ public const int STATFLAG_DEFAULT = 0x0;
+ public const int STATFLAG_NONAME = 0x1;
+ public const int STATFLAG_NOOPEN = 0x2;
+ public const int STGC_DEFAULT = 0x0;
+ public const int STGC_OVERWRITE = 0x1;
+ public const int STGC_ONLYIFCURRENT = 0x2;
+ public const int STGC_DANGEROUSLYCOMMITMERELYTODISKCACHE = 0x4;
+ public const int STREAM_SEEK_SET = 0x0;
+ public const int STREAM_SEEK_CUR = 0x1;
+ public const int STREAM_SEEK_END = 0x2;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "DeleteObject", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ internal static extern int IntDeleteObject(HandleRef hObject);
+ public static int DeleteObject(HandleRef hObject)
+ {
+ System.Internal.HandleCollector.Remove((IntPtr)hObject, SafeNativeMethods.CommonHandles.GDI);
+ return IntDeleteObject(hObject);
+ }
+
+ /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future.
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling = true, EntryPoint = "DeleteDC", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ internal static extern bool IntDeleteDC(HandleRef hDC);
+ public static bool DeleteDC(HandleRef hDC)
+ {
+ System.Internal.HandleCollector.Remove((IntPtr)hDC, SafeNativeMethods.CommonHandles.GDI);
+ return IntDeleteDC(hDC);
+ }
+ */
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)]
+ public static extern IntPtr SelectObject(HandleRef hdc, HandleRef obj);
+
+ /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future.
+ [DllImport(ExternDll.User32, SetLastError=true, EntryPoint="CreateIconIndirect")]
+ private static extern IntPtr IntCreateIconIndirect(SafeNativeMethods.ICONINFO piconinfo);
+ public static IntPtr CreateIconIndirect(SafeNativeMethods.ICONINFO piconinfo) {
+ return System.Internal.HandleCollector.Add(IntCreateIconIndirect(piconinfo), SafeNativeMethods.CommonHandles.Icon);
+ }
+ */
+
+ [DllImport(ExternDll.User32, SetLastError = true, EntryPoint = "CreateIconFromResourceEx")]
+ private unsafe static extern IntPtr IntCreateIconFromResourceEx(byte* pbIconBits, int cbIconBits, bool fIcon, int dwVersion, int csDesired, int cyDesired, int flags);
+
+ public unsafe static IntPtr CreateIconFromResourceEx(byte* pbIconBits, int cbIconBits, bool fIcon, int dwVersion, int csDesired, int cyDesired, int flags)
+ {
+ return System.Internal.HandleCollector.Add(IntCreateIconFromResourceEx(pbIconBits, cbIconBits, fIcon, dwVersion, csDesired, cyDesired, flags), SafeNativeMethods.CommonHandles.Icon);
+ }
+
+ [DllImport(ExternDll.Shell32, CharSet = System.Runtime.InteropServices.CharSet.Auto, BestFitMapping = false, EntryPoint = "ExtractAssociatedIcon")]
+ public unsafe static extern IntPtr IntExtractAssociatedIcon(HandleRef hInst, StringBuilder iconPath, ref int index);
+
+ public unsafe static IntPtr ExtractAssociatedIcon(HandleRef hInst, StringBuilder iconPath, ref int index)
+ {
+ return System.Internal.HandleCollector.Add(IntExtractAssociatedIcon(hInst, iconPath, ref index), SafeNativeMethods.CommonHandles.Icon);
+ }
+
+ [DllImport(ExternDll.User32, SetLastError = true, EntryPoint = "LoadIcon", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ private static extern IntPtr IntLoadIcon(HandleRef hInst, IntPtr iconId);
+ public static IntPtr LoadIcon(HandleRef hInst, int iconId)
+ { // we only use the case were the low word of the IntPtr is used a resource id but it still has to be an intptr
+ return IntLoadIcon(hInst, new IntPtr(iconId)); // on 32bits it'll be the same size, wider on 64bits
+ }
+
+ [DllImport(ExternDll.Comctl32, SetLastError = true, EntryPoint = "LoadIconWithScaleDown", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ private static extern int IntLoadIconWithScaleDown(HandleRef hInst, IntPtr iconId, int cx, int cy, ref IntPtr phico);
+ public static int LoadIconWithScaleDown(HandleRef hInst, int iconId, int cx, int cy, ref IntPtr phico)
+ { // we only use the case were the low word of the IntPtr is used a resource id but it still has to be an intptr
+ return IntLoadIconWithScaleDown(hInst, new IntPtr(iconId), cx, cy, ref phico); // on 32bits it'll be the same size, wider on 64bits
+ }
+
+ [DllImport(ExternDll.User32, SetLastError = true, ExactSpelling = true, EntryPoint = "DestroyIcon", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ private static extern bool IntDestroyIcon(HandleRef hIcon);
+ public static bool DestroyIcon(HandleRef hIcon)
+ {
+ System.Internal.HandleCollector.Remove((IntPtr)hIcon, SafeNativeMethods.CommonHandles.Icon);
+ return IntDestroyIcon(hIcon);
+ }
+
+ [DllImport(ExternDll.User32, SetLastError = true, ExactSpelling = true, EntryPoint = "CopyImage", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ private static extern IntPtr IntCopyImage(HandleRef hImage, int uType, int cxDesired, int cyDesired, int fuFlags);
+ public static IntPtr CopyImage(HandleRef hImage, int uType, int cxDesired, int cyDesired, int fuFlags)
+ {
+ int handleType;
+ switch (uType)
+ {
+ case SafeNativeMethods.IMAGE_ICON:
+ handleType = SafeNativeMethods.CommonHandles.Icon;
+ break;
+ default:
+ handleType = SafeNativeMethods.CommonHandles.GDI;
+ break;
+ }
+ return System.Internal.HandleCollector.Add(IntCopyImage(hImage, uType, cxDesired, cyDesired, fuFlags), handleType);
+ }
+
+ // GetObject stuff
+ [DllImport(ExternDll.Gdi32, SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetObject(HandleRef hObject, int nSize, [In, Out] SafeNativeMethods.BITMAP bm);
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetObject(HandleRef hObject, int nSize, [In, Out] SafeNativeMethods.LOGFONT lf);
+ public static int GetObject(HandleRef hObject, SafeNativeMethods.LOGFONT lp)
+ {
+ return GetObject(hObject, System.Runtime.InteropServices.Marshal.SizeOf(typeof(SafeNativeMethods.LOGFONT)), lp);
+ }
+
+ /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future.
+ [DllImport(ExternDll.Gdi32, SetLastError=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetObject(HandleRef hObject, int nSize, [In, Out] SafeNativeMethods.DIBSECTION ds);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetObject(HandleRef hObject, int nSize, [In, Out] SafeNativeMethods.LOGPEN lp);
+ public static int GetObject(HandleRef hObject, SafeNativeMethods.LOGPEN lp) {
+ return GetObject(hObject, System.Runtime.InteropServices.Marshal.SizeOf(typeof(SafeNativeMethods.LOGPEN)), lp);
+ }
+ [DllImport(ExternDll.Gdi32, SetLastError=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetObject(HandleRef hObject, int nSize, [In, Out] SafeNativeMethods.LOGBRUSH lb);
+ public static int GetObject(HandleRef hObject, SafeNativeMethods.LOGBRUSH lb) {
+ return GetObject(hObject, System.Runtime.InteropServices.Marshal.SizeOf(typeof(SafeNativeMethods.LOGBRUSH)), lb);
+ }
+
+ //HPALETTE
+ [DllImport(ExternDll.Gdi32, SetLastError=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetObject(HandleRef hObject, int nSize, ref int nEntries);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetObject(HandleRef hObject, int nSize, int[] nEntries);
+ */
+
+ [DllImport(ExternDll.User32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool GetIconInfo(HandleRef hIcon, [In, Out] SafeNativeMethods.ICONINFO info);
+
+ [DllImport(ExternDll.User32, SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetSysColor(int nIndex);
+
+ /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future.
+ [DllImport(ExternDll.User32, SetLastError=true, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool DrawIcon(HandleRef hDC, int x, int y, HandleRef hIcon);
+ */
+
+ [DllImport(ExternDll.User32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool DrawIconEx(HandleRef hDC, int x, int y, HandleRef hIcon, int width, int height, int iStepIfAniCursor, HandleRef hBrushFlickerFree, int diFlags);
+
+ /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future.
+ [DllImport(ExternDll.Oleaut32, PreserveSig=false)]
+ public static extern IPicture OleLoadPicture(UnsafeNativeMethods.IStream pStream, int lSize, bool fRunmode, ref Guid refiid);
+
+ [DllImport(ExternDll.Oleaut32, PreserveSig=false)]
+ public static extern IPicture OleLoadPictureEx(UnsafeNativeMethods.IStream pStream, int lSize, bool fRunmode, ref Guid refiid, int width, int height, int dwFlags);
+ */
+
+
+#if CUSTOM_MARSHALING_ISTREAM
+ [DllImport(ExternDll.Oleaut32, PreserveSig=false)]
+ public static extern IPicture OleLoadPictureEx(
+ [return: MarshalAs(UnmanagedType.CustomMarshaler,MarshalType="StreamToIStreamMarshaler")] Stream pStream,
+ int lSize, bool fRunmode, ref Guid refiid, int width, int height, int dwFlags);
+
+
+#endif
+ [DllImport(ExternDll.Oleaut32, PreserveSig = false)]
+ public static extern IPicture OleCreatePictureIndirect(SafeNativeMethods.PICTDESC pictdesc, [In]ref Guid refiid, bool fOwn);
+
+ [
+ ComImport(),
+ Guid("7BF80980-BF32-101A-8BBB-00AA00300CAB"),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
+
+ ]
+ public interface IPicture
+ {
+ [SuppressUnmanagedCodeSecurity()]
+ IntPtr GetHandle();
+
+ [SuppressUnmanagedCodeSecurity()]
+ IntPtr GetHPal();
+
+ [return: MarshalAs(UnmanagedType.I2)]
+ [SuppressUnmanagedCodeSecurity()]
+ short GetPictureType();
+
+ [SuppressUnmanagedCodeSecurity()]
+ int GetWidth();
+
+ [SuppressUnmanagedCodeSecurity()]
+ int GetHeight();
+
+ [SuppressUnmanagedCodeSecurity()]
+ void Render();
+
+ [SuppressUnmanagedCodeSecurity()]
+ void SetHPal(
+ [In]
+ IntPtr phpal);
+
+ [SuppressUnmanagedCodeSecurity()]
+ IntPtr GetCurDC();
+
+ [SuppressUnmanagedCodeSecurity()]
+ void SelectPicture(
+ [In]
+ IntPtr hdcIn,
+ [Out, MarshalAs(UnmanagedType.LPArray)]
+ int[] phdcOut,
+ [Out, MarshalAs(UnmanagedType.LPArray)]
+ int[] phbmpOut);
+
+ [return: MarshalAs(UnmanagedType.Bool)]
+ [SuppressUnmanagedCodeSecurity()]
+ bool GetKeepOriginalFormat();
+
+ [SuppressUnmanagedCodeSecurity()]
+ void SetKeepOriginalFormat(
+ [In, MarshalAs(UnmanagedType.Bool)]
+ bool pfkeep);
+
+ [SuppressUnmanagedCodeSecurity()]
+ void PictureChanged();
+
+ [SuppressUnmanagedCodeSecurity()]
+ [System.Runtime.InteropServices.PreserveSig]
+ int SaveAsFile(
+ [In, MarshalAs(UnmanagedType.Interface)]
+ UnsafeNativeMethods.IStream pstm,
+ [In]
+ int fSaveMemCopy,
+ [Out]
+ out int pcbSize);
+
+ [SuppressUnmanagedCodeSecurity()]
+ int GetAttributes();
+
+ [SuppressUnmanagedCodeSecurity()]
+ void SetHdc(
+ [In]
+ IntPtr hdc);
+ }
+
+
+ // for pulling encoded IPictures out of Access Databases
+ //
+ [StructLayout(LayoutKind.Sequential)]
+ public struct OBJECTHEADER
+ {
+ public short signature; // this looks like it's always 0x1c15
+ public short headersize; // how big all this goo ends up being. after this is the actual object data.
+ public short objectType; // we don't care about anything else...they don't seem to be meaningful anyway.
+ public short nameLen;
+ public short classLen;
+ public short nameOffset;
+ public short classOffset;
+ public short width;
+ public short height;
+ public IntPtr pInfo;
+ }
+
+
+ //values used in our known colortable
+ internal enum Win32SystemColors
+ {
+ ActiveBorder = 0x0A,
+ ActiveCaption = 0x02,
+ ActiveCaptionText = 0x09,
+ AppWorkspace = 0x0C,
+ ButtonFace = 0x0F,
+ ButtonHighlight = 0x14,
+ ButtonShadow = 0x10,
+ Control = 0x0F,
+ ControlDark = 0x10,
+ ControlDarkDark = 0x15,
+ ControlLight = 0x16,
+ ControlLightLight = 0x14,
+ ControlText = 0x12,
+ Desktop = 0x01,
+ GradientActiveCaption = 0x1B,
+ GradientInactiveCaption = 0x1C,
+ GrayText = 0x11,
+ Highlight = 0x0D,
+ HighlightText = 0x0E,
+ HotTrack = 0x1A,
+ InactiveBorder = 0x0B,
+ InactiveCaption = 0x03,
+ InactiveCaptionText = 0x13,
+ Info = 0x18,
+ InfoText = 0x17,
+ Menu = 0x04,
+ MenuBar = 0x1E,
+ MenuHighlight = 0x1D,
+ MenuText = 0x07,
+ ScrollBar = 0x00,
+ Window = 0x05,
+ WindowFrame = 0x06,
+ WindowText = 0x08
+ }
+
+
+ // GDI stuff
+
+ // see wingdi.h
+ public enum BackgroundMode : int
+ {
+ TRANSPARENT = 1,
+ OPAQUE = 2
+ }
+
+ // FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future.
+ //[DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ //public static extern int /*COLORREF*/ SetTextColor(HandleRef hDC, int crColor);
+
+ // FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future.
+ //[DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ //public static extern int /*COLORREF*/ GetTextColor(HandleRef hDC);
+
+ /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future.
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int SetBkColor(HandleRef hDC, int clr);
+
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int SetBkMode(HandleRef hDC, int nBkMode);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetBkColor(HandleRef hDC);
+
+ [DllImport(ExternDll.User32, SetLastError=true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int DrawText(HandleRef hDC, string lpszString, int nCount, ref SafeNativeMethods.RECT lpRect, int nFormat);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetTextExtentPoint32(HandleRef hDC, string str, int len, [In, Out] SafeNativeMethods.SIZE size);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling = true, CharSet = CharSet.Auto)]
+ public static extern bool LineTo(HandleRef hdc, int x, int y);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling = true, CharSet = CharSet.Auto)]
+ public static extern bool MoveToEx(HandleRef hdc, int x, int y, SafeNativeMethods.POINT pt);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling = true, CharSet = CharSet.Auto)]
+ public static extern bool Rectangle(HandleRef hdc, int left, int top, int right, int bottom);
+
+ [DllImport(ExternDll.User32, SetLastError=true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int FillRect(HandleRef hdc, [In] ref SafeNativeMethods.RECT rect, HandleRef hbrush);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling = true, EntryPoint = "CreateSolidBrush", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ private static extern IntPtr IntCreateSolidBrush(int crColor);
+ public static IntPtr CreateSolidBrush(int crColor)
+ {
+ return System.Internal.HandleCollector.Add(IntCreateSolidBrush(crColor), SafeNativeMethods.CommonHandles.GDI);
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling = true, EntryPoint = "CreateHatchBrush", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ private static extern IntPtr IntCreateHatchBrush(int fnStyle, int crColor);
+ public static IntPtr CreateHatchBrush(int fnStyle, int crColor)
+ {
+ return System.Internal.HandleCollector.Add(IntCreateHatchBrush(fnStyle, crColor), SafeNativeMethods.CommonHandles.GDI);
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling = true, EntryPoint = "CreatePen", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ private static extern IntPtr IntCreatePen(int fnStyle, int nWidth, int crColor);
+ public static IntPtr CreatePen(int fnStyle, int nWidth, int crColor)
+ {
+ return System.Internal.HandleCollector.Add(IntCreatePen(fnStyle, nWidth, crColor), SafeNativeMethods.CommonHandles.GDI);
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling = true, EntryPoint = "ExtCreatePen", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ private static extern IntPtr IntExtCreatePen(int fnStyle, int dwWidth, SafeNativeMethods.LOGBRUSH lplb, int dwStyleCount, [MarshalAs(UnmanagedType.LPArray)] int[] lpStyle);
+ public static IntPtr ExtCreatePen(int fnStyle, int dwWidth, SafeNativeMethods.LOGBRUSH lplb, int dwStyleCount, int[] lpStyle)
+ {
+ return System.Internal.HandleCollector.Add(IntExtCreatePen(fnStyle, dwWidth, lplb, dwStyleCount, lpStyle), SafeNativeMethods.CommonHandles.GDI);
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int SetROP2(HandleRef hDC, int nDrawMode);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int SetMapMode(HandleRef hDC, int nMapMode);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern IntPtr GetCurrentObject(HandleRef hDC, uint uObjectType);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
+ public static extern int GetTextMetricsW(HandleRef hDC, [In, Out] ref SafeNativeMethods.TEXTMETRIC lptm);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet = System.Runtime.InteropServices.CharSet.Ansi)]
+ public static extern int GetTextMetricsA(HandleRef hDC, [In, Out] ref SafeNativeMethods.TEXTMETRICA lptm);
+
+ public static int GetTextMetrics(HandleRef hDC, ref SafeNativeMethods.TEXTMETRIC lptm) {
+ if (Marshal.SystemDefaultCharSize == 1)
+ {
+ // ANSI
+ SafeNativeMethods.TEXTMETRICA lptmA = new SafeNativeMethods.TEXTMETRICA();
+ int retVal = SafeNativeMethods.GetTextMetricsA(hDC, ref lptmA);
+
+ lptm.tmHeight = lptmA.tmHeight;
+ lptm.tmAscent = lptmA.tmAscent;
+ lptm.tmDescent = lptmA.tmDescent;
+ lptm.tmInternalLeading = lptmA.tmInternalLeading;
+ lptm.tmExternalLeading = lptmA.tmExternalLeading;
+ lptm.tmAveCharWidth = lptmA.tmAveCharWidth;
+ lptm.tmMaxCharWidth = lptmA.tmMaxCharWidth;
+ lptm.tmWeight = lptmA.tmWeight;
+ lptm.tmOverhang = lptmA.tmOverhang;
+ lptm.tmDigitizedAspectX = lptmA.tmDigitizedAspectX;
+ lptm.tmDigitizedAspectY = lptmA.tmDigitizedAspectY;
+ lptm.tmFirstChar = (char) lptmA.tmFirstChar;
+ lptm.tmLastChar = (char) lptmA.tmLastChar;
+ lptm.tmDefaultChar = (char) lptmA.tmDefaultChar;
+ lptm.tmBreakChar = (char) lptmA.tmBreakChar;
+ lptm.tmItalic = lptmA.tmItalic;
+ lptm.tmUnderlined = lptmA.tmUnderlined;
+ lptm.tmStruckOut = lptmA.tmStruckOut;
+ lptm.tmPitchAndFamily = lptmA.tmPitchAndFamily;
+ lptm.tmCharSet = lptmA.tmCharSet;
+
+ return retVal;
+ }
+ else
+ {
+ // Unicode
+ return SafeNativeMethods.GetTextMetricsW(hDC, ref lptm);
+ }
+ }
+
+ [DllImport(ExternDll.Kernel32, SetLastError=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int FormatMessage(int dwFlags, HandleRef lpSource, int dwMessageId, int dwLanguageId, StringBuilder lpBuffer, int nSize, HandleRef arguments);
+
+ [DllImport(ExternDll.Kernel32, SetLastError=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetUserDefaultLCID();
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int SetTextAlign(HandleRef hDC, int nMode);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetSystemPaletteUse(HandleRef hDc);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetSystemPaletteUse(HandleRef hDc, int iStartIndex, int nEntries, HandleRef lppe);
+ */
+
+ // FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future.
+ //[DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, EntryPoint="CreatePalette", CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ //private static extern IntPtr /*HPALETTE*/ IntCreatePalette(HandleRef lplgpl);
+ //public static IntPtr /*HPALETTE*/ CreatePalette(HandleRef lplgpl) {
+ // IntPtr result = IntCreatePalette(lplgpl);
+ // if(result == IntPtr.Zero) {
+ // Debug.WriteLine("IntCreatePalette failed : " + DbgUtil.GetLastErrorStr());
+ // throw new Win32Exception();
+ // }
+ // return System.Internal.HandleCollector.Add(result, SafeNativeMethods.CommonHandles.GDI);
+ //}
+
+
+ /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future.
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int SetPixel(HandleRef hDc, int x, int y, int color);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool Ellipse(HandleRef hDc, int x1, int y1, int x2, int y2);
+
+ [DllImport(ExternDll.User32, SetLastError=true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool DrawFocusRect(HandleRef hDc, ref SafeNativeMethods.RECT lpRect);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool GdiFlush();
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, CharSet=CharSet.Auto)]
+ public static extern int GetObject(HandleRef hObject, int nSize, [In, Out] NativeMethods.BITMAP bm);
+
+
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, EntryPoint="CreateDIBSection", CharSet=CharSet.Auto)]
+ public static extern IntPtr IntCreateDIBSection(HandleRef hdc, ref NativeMethods.BITMAPINFO bmi, int iUsage, ref IntPtr ppvBits, IntPtr hSection, int dwOffset);
+ public static IntPtr CreateDIBSection(HandleRef hdc, ref NativeMethods.BITMAPINFO bmi, int iUsage, ref IntPtr ppvBits, IntPtr hSection, int dwOffset) {
+ return System.Internal.HandleCollector.Add(IntCreateDIBSection(hdc, ref bmi, iUsage, ref ppvBits, hSection, dwOffset), SafeNativeMethods.CommonHandles.GDI);
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool DPtoLP(HandleRef hDC, [In, Out] ref POINT lpRect, int nCount);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetMapMode(HandleRef hDC);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool BeginPath(HandleRef hDC);
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool EndPath(HandleRef hDC);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool StrokePath(HandleRef hDC);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool AngleArc(HandleRef hDC, int x, int y, int radius, float startAngle, float endAngle);
+
+ [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool Arc(HandleRef hDC, int nLeftRect, // x-coord of rectangle's upper-left corner
+ int nTopRect, // y-coord of rectangle's upper-left corner
+ int nRightRect, // x-coord of rectangle's lower-right corner
+ int nBottomRect, // y-coord of rectangle's lower-right corner
+ int nXStartArc, // x-coord of first radial ending point
+ int nYStartArc, // y-coord of first radial ending point
+ int nXEndArc, // x-coord of second radial ending point
+ int nYEndArc // y-coord of second radial ending point
+ );
+
+ */
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/GenericFontFamilies.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/GenericFontFamilies.cs
new file mode 100644
index 0000000000..e09d00939c
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/GenericFontFamilies.cs
@@ -0,0 +1,32 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Text
+{
+ /**
+ * GenericFontFamilies
+ */
+ /// <include file='doc\GenericFontFamilies.uex' path='docs/doc[@for="GenericFontFamilies"]/*' />
+ /// <devdoc>
+ /// Specifies a generic <see cref='System.Drawing.FontFamily'/>.
+ /// </devdoc>
+ public enum GenericFontFamilies
+ {
+ /// <include file='doc\GenericFontFamilies.uex' path='docs/doc[@for="GenericFontFamilies.Serif"]/*' />
+ /// <devdoc>
+ /// A generic Serif <see cref='System.Drawing.FontFamily'/>.
+ /// </devdoc>
+ Serif,
+ /// <include file='doc\GenericFontFamilies.uex' path='docs/doc[@for="GenericFontFamilies.SansSerif"]/*' />
+ /// <devdoc>
+ /// A generic SansSerif <see cref='System.Drawing.FontFamily'/>.
+ /// </devdoc>
+ SansSerif,
+ /// <include file='doc\GenericFontFamilies.uex' path='docs/doc[@for="GenericFontFamilies.Monospace"]/*' />
+ /// <devdoc>
+ /// A generic Monospace <see cref='System.Drawing.FontFamily'/>.
+ /// </devdoc>
+ Monospace
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/GraphicsContainer.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/GraphicsContainer.cs
new file mode 100644
index 0000000000..532ad86000
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/GraphicsContainer.cs
@@ -0,0 +1,30 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /**
+ * Represent the internal data of a Graphics Container object
+ */
+ /// <include file='doc\GraphicsContainer.uex' path='docs/doc[@for="GraphicsContainer"]/*' />
+ /// <devdoc>
+ /// Represents the internal data of a graphics
+ /// container.
+ /// </devdoc>
+ public sealed class GraphicsContainer : MarshalByRefObject
+ {
+ /**
+ * @notes How do we want to expose region data?
+ *
+ * @notes Need serialization methods too. Needs to be defined.
+ */
+
+ internal GraphicsContainer(int graphicsContainer)
+ {
+ nativeGraphicsContainer = graphicsContainer;
+ }
+
+ internal int nativeGraphicsContainer;
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/GraphicsPath.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/GraphicsPath.cs
new file mode 100644
index 0000000000..1300c06253
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/GraphicsPath.cs
@@ -0,0 +1,1887 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ using System.ComponentModel;
+ using System.Diagnostics;
+ using System.Drawing.Internal;
+ using System.Globalization;
+ using System.Runtime.InteropServices;
+
+ /**
+ * Represent a Path object
+ */
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath"]/*' />
+ /// <devdoc>
+ /// Represents a series of connected lines and
+ /// curves.
+ /// </devdoc>
+ public sealed class GraphicsPath : MarshalByRefObject, ICloneable, IDisposable
+ {
+ /*
+ * handle to native path object
+ */
+ internal IntPtr nativePath;
+
+ /**
+ * Create a new path object with the default fill mode
+ */
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.GraphicsPath"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.GraphicsPath'/> class with a <see cref='System.Drawing.Drawing2D.FillMode'/> of <see cref='System.Drawing.Drawing2D.FillMode.Alternate'/>
+ /// .
+ /// </para>
+ /// </devdoc>
+ public GraphicsPath() : this(System.Drawing.Drawing2D.FillMode.Alternate) { }
+
+ /**
+ * Create a new path object with the specified fill mode
+ */
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.GraphicsPath1"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.GraphicsPath'/> class with the specified <see cref='System.Drawing.Drawing2D.FillMode'/>.
+ /// </devdoc>
+ public GraphicsPath(FillMode fillMode)
+ {
+ IntPtr nativePath = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreatePath(unchecked((int)fillMode), out nativePath);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ this.nativePath = nativePath;
+ }
+
+ // float version
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.GraphicsPath2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the
+ /// <see cref='System.Drawing.Drawing2D.GraphicsPath'/> array with the
+ /// specified <see cref='System.Drawing.Drawing2D.GraphicsPath.PathTypes'/>
+ /// and <see cref='System.Drawing.Drawing2D.GraphicsPath.PathPoints'/> arrays.
+ /// </para>
+ /// </devdoc>
+ public GraphicsPath(PointF[] pts, byte[] types) :
+ this(pts, types, System.Drawing.Drawing2D.FillMode.Alternate)
+ { }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.GraphicsPath3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.GraphicsPath'/> array with the
+ /// specified <see cref='System.Drawing.Drawing2D.GraphicsPath.PathTypes'/> and <see cref='System.Drawing.Drawing2D.GraphicsPath.PathPoints'/> arrays and with the
+ /// specified <see cref='System.Drawing.Drawing2D.FillMode'/>.
+ /// </para>
+ /// </devdoc>
+ public GraphicsPath(PointF[] pts, byte[] types, FillMode fillMode)
+ {
+ if (pts == null)
+ throw new ArgumentNullException("pts");
+ IntPtr nativePath = IntPtr.Zero;
+
+ if (pts.Length != types.Length)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter);
+
+ int count = types.Length;
+ IntPtr ptbuf = SafeNativeMethods.Gdip.ConvertPointToMemory(pts);
+ IntPtr typebuf = Marshal.AllocHGlobal(count);
+ try
+ {
+ Marshal.Copy(types, 0, typebuf, count);
+
+ int status = SafeNativeMethods.Gdip.GdipCreatePath2(new HandleRef(null, ptbuf), new HandleRef(null, typebuf), count,
+ unchecked((int)fillMode), out nativePath);
+
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(ptbuf);
+ Marshal.FreeHGlobal(typebuf);
+ }
+
+ this.nativePath = nativePath;
+ }
+
+ // int version
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.GraphicsPath4"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the
+ /// <see cref='System.Drawing.Drawing2D.GraphicsPath'/> array with the
+ /// specified <see cref='System.Drawing.Drawing2D.GraphicsPath.PathTypes'/>
+ /// and <see cref='System.Drawing.Drawing2D.GraphicsPath.PathPoints'/> arrays.
+ /// </para>
+ /// </devdoc>
+ public GraphicsPath(Point[] pts, byte[] types) :
+ this(pts, types, System.Drawing.Drawing2D.FillMode.Alternate)
+ { }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.GraphicsPath5"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.GraphicsPath'/> array with the
+ /// specified <see cref='System.Drawing.Drawing2D.GraphicsPath.PathTypes'/> and <see cref='System.Drawing.Drawing2D.GraphicsPath.PathPoints'/> arrays and with the
+ /// specified <see cref='System.Drawing.Drawing2D.FillMode'/>.
+ /// </para>
+ /// </devdoc>
+ public GraphicsPath(Point[] pts, byte[] types, FillMode fillMode)
+ {
+ if (pts == null)
+ throw new ArgumentNullException("pts");
+ IntPtr nativePath = IntPtr.Zero;
+
+ if (pts.Length != types.Length)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter);
+
+ int count = types.Length;
+ IntPtr ptbuf = SafeNativeMethods.Gdip.ConvertPointToMemory(pts);
+ IntPtr typebuf = Marshal.AllocHGlobal(count);
+ try
+ {
+ Marshal.Copy(types, 0, typebuf, count);
+
+ int status = SafeNativeMethods.Gdip.GdipCreatePath2I(new HandleRef(null, ptbuf), new HandleRef(null, typebuf), count,
+ unchecked((int)fillMode), out nativePath);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(ptbuf);
+ Marshal.FreeHGlobal(typebuf);
+ }
+
+ this.nativePath = nativePath;
+ }
+
+ /**
+ * Make a copy of the current path object
+ */
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.Clone"]/*' />
+ /// <devdoc>
+ /// Creates an exact copy of this <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </devdoc>
+ public object Clone()
+ {
+ IntPtr clonePath = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipClonePath(new HandleRef(this, nativePath), out clonePath);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return new GraphicsPath(clonePath, 0);
+ }
+
+ /**
+ * 'extra' parameter is necessary to avoid conflict with
+ * other constructor GraphicsPath(int fillmode)
+ */
+
+ private GraphicsPath(IntPtr nativePath, int extra)
+ {
+ if (nativePath == IntPtr.Zero)
+ throw new ArgumentNullException("nativePath");
+
+ this.nativePath = nativePath;
+ }
+
+ /**
+ * Dispose of resources associated with the
+ */
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.Dispose"]/*' />
+ /// <devdoc>
+ /// Eliminates resources for this <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </devdoc>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+ private void Dispose(bool disposing)
+ {
+ if (nativePath != IntPtr.Zero)
+ {
+ try
+ {
+#if DEBUG
+ int status =
+#endif
+ SafeNativeMethods.Gdip.GdipDeletePath(new HandleRef(this, nativePath));
+#if DEBUG
+ Debug.Assert(status == SafeNativeMethods.Gdip.Ok, "GDI+ returned an error status: " + status.ToString(CultureInfo.InvariantCulture));
+#endif
+ }
+ catch (Exception ex)
+ {
+ if (ClientUtils.IsSecurityOrCriticalException(ex))
+ {
+ throw;
+ }
+
+ Debug.Fail("Exception thrown during Dispose: " + ex.ToString());
+ }
+ finally
+ {
+ nativePath = IntPtr.Zero;
+ }
+ }
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.Finalize"]/*' />
+ /// <devdoc>
+ /// Eliminates resources for this <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </devdoc>
+ ~GraphicsPath()
+ {
+ Dispose(false);
+ }
+
+ /**
+ * Reset the path object to empty
+ */
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.Reset"]/*' />
+ /// <devdoc>
+ /// Empties the <see cref='System.Drawing.Drawing2D.GraphicsPath.PathPoints'/>
+ /// and <see cref='System.Drawing.Drawing2D.GraphicsPath.PathTypes'/> arrays
+ /// and sets the <see cref='System.Drawing.Drawing2D.GraphicsPath.FillMode'/> to
+ /// <see cref='System.Drawing.Drawing2D.FillMode.Alternate'/>.
+ /// </devdoc>
+ public void Reset()
+ {
+ int status = SafeNativeMethods.Gdip.GdipResetPath(new HandleRef(this, nativePath));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /**
+ * Get path fill mode information
+ */
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.FillMode"]/*' />
+ /// <devdoc>
+ /// Gets or sets a <see cref='System.Drawing.Drawing2D.FillMode'/> that determines how the interiors of
+ /// shapes in this <see cref='System.Drawing.Drawing2D.GraphicsPath'/> are filled.
+ /// </devdoc>
+ public FillMode FillMode
+ {
+ get
+ {
+ int fillmode = 0;
+
+ int status = SafeNativeMethods.Gdip.GdipGetPathFillMode(new HandleRef(this, nativePath), out fillmode);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return (FillMode)fillmode;
+ }
+ set
+ {
+ //validate the FillMode enum
+ //valid values are 0x0 to 0x1
+ if (!ClientUtils.IsEnumValid(value, unchecked((int)value), (int)FillMode.Alternate, (int)FillMode.Winding))
+ {
+ throw new InvalidEnumArgumentException("value", unchecked((int)value), typeof(FillMode));
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipSetPathFillMode(new HandleRef(this, nativePath), (int)value);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ private PathData _GetPathData()
+ {
+ int ptSize = (int)Marshal.SizeOf(typeof(GPPOINTF));
+
+ int numPts = PointCount;
+
+ PathData pathData = new PathData();
+ pathData.Types = new byte[numPts];
+
+ IntPtr memoryPathData = Marshal.AllocHGlobal(3 * IntPtr.Size);
+ IntPtr memoryPoints = Marshal.AllocHGlobal(checked(ptSize * numPts));
+ try
+ {
+ GCHandle typesHandle = GCHandle.Alloc(pathData.Types, GCHandleType.Pinned);
+ try
+ {
+ IntPtr typesPtr = typesHandle.AddrOfPinnedObject();
+ //IntPtr typesPtr = Marshal.AddrOfArrayElement(pathData.Types, IntPtr.Zero);
+
+ Marshal.StructureToPtr(numPts, memoryPathData, false);
+ Marshal.StructureToPtr(memoryPoints, (IntPtr)((long)memoryPathData + IntPtr.Size), false);
+ Marshal.StructureToPtr(typesPtr, (IntPtr)((long)memoryPathData + 2 * IntPtr.Size), false);
+
+ int status = SafeNativeMethods.Gdip.GdipGetPathData(new HandleRef(this, nativePath), memoryPathData);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ pathData.Points = SafeNativeMethods.Gdip.ConvertGPPOINTFArrayF(memoryPoints, numPts);
+ }
+ finally
+ {
+ typesHandle.Free();
+ }
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(memoryPathData);
+ Marshal.FreeHGlobal(memoryPoints);
+ }
+
+ return pathData;
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.PathData"]/*' />
+ /// <devdoc>
+ /// Gets a <see cref='System.Drawing.Drawing2D.PathData'/> object that
+ /// encapsulates both the <see cref='System.Drawing.Drawing2D.GraphicsPath.PathPoints'/> and <see cref='System.Drawing.Drawing2D.GraphicsPath.PathTypes'/> arrays of this <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </devdoc>
+ public PathData PathData
+ {
+ get
+ {
+ return _GetPathData();
+ }
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.StartFigure"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Starts a new figure without closing the
+ /// current figure. All subsequent points added to the path are added to this new
+ /// figure.
+ /// </para>
+ /// </devdoc>
+ public void StartFigure()
+ {
+ int status = SafeNativeMethods.Gdip.GdipStartPathFigure(new HandleRef(this, nativePath));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.CloseFigure"]/*' />
+ /// <devdoc>
+ /// Closes the current figure and starts a new
+ /// figure. If the current figure contains a sequence of connected lines and curves,
+ /// it closes the loop by connecting a line from the ending point to the starting
+ /// point.
+ /// </devdoc>
+ public void CloseFigure()
+ {
+ int status = SafeNativeMethods.Gdip.GdipClosePathFigure(new HandleRef(this, nativePath));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.CloseAllFigures"]/*' />
+ /// <devdoc>
+ /// Closes all open figures in a path and
+ /// starts a new figure. It closes each open figure by connecting a line from it's
+ /// ending point to it's starting point.
+ /// </devdoc>
+ public void CloseAllFigures()
+ {
+ int status = SafeNativeMethods.Gdip.GdipClosePathFigures(new HandleRef(this, nativePath));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.SetMarkers"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Sets a marker on this <see cref='System.Drawing.Drawing2D.GraphicsPath'/> .
+ /// </para>
+ /// </devdoc>
+ public void SetMarkers()
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetPathMarker(new HandleRef(this, nativePath));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.ClearMarkers"]/*' />
+ /// <devdoc>
+ /// Clears all markers from this <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </devdoc>
+ public void ClearMarkers()
+ {
+ int status = SafeNativeMethods.Gdip.GdipClearPathMarkers(new HandleRef(this, nativePath));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.Reverse"]/*' />
+ /// <devdoc>
+ /// Reverses the order of points in the <see cref='System.Drawing.Drawing2D.GraphicsPath.PathPoints'/> array of this <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </devdoc>
+ public void Reverse()
+ {
+ int status = SafeNativeMethods.Gdip.GdipReversePath(new HandleRef(this, nativePath));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.GetLastPoint"]/*' />
+ /// <devdoc>
+ /// Gets the last point in the <see cref='System.Drawing.Drawing2D.GraphicsPath.PathPoints'/> array of this <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </devdoc>
+ public PointF GetLastPoint()
+ {
+ GPPOINTF gppt = new GPPOINTF();
+
+ int status = SafeNativeMethods.Gdip.GdipGetPathLastPoint(new HandleRef(this, nativePath), gppt);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return gppt.ToPoint();
+ }
+
+ /*
+ * Hit testing
+ */
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.IsVisible"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Indicates whether the specified point is contained
+ /// within this <see cref='System.Drawing.Drawing2D.GraphicsPath'/>
+ /// .
+ /// </para>
+ /// </devdoc>
+ public bool IsVisible(float x, float y)
+ {
+ return IsVisible(new PointF(x, y), (Graphics)null);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.IsVisible1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Indicates whether the specified point is contained
+ /// within this <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </para>
+ /// </devdoc>
+ public bool IsVisible(PointF point)
+ {
+ return IsVisible(point, (Graphics)null);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.IsVisible2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Indicates whether the specified point is contained within this <see cref='System.Drawing.Drawing2D.GraphicsPath'/> in the visible clip region of the
+ /// specified <see cref='System.Drawing.Graphics'/>.
+ /// </para>
+ /// </devdoc>
+ public bool IsVisible(float x, float y, Graphics graphics)
+ {
+ return IsVisible(new PointF(x, y), graphics);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.IsVisible3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Indicates whether the specified point is contained within this <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </para>
+ /// </devdoc>
+ public bool IsVisible(PointF pt, Graphics graphics)
+ {
+ int isVisible;
+
+ int status = SafeNativeMethods.Gdip.GdipIsVisiblePathPoint(new HandleRef(this, nativePath),
+ pt.X,
+ pt.Y,
+ new HandleRef(graphics, (graphics != null) ?
+ graphics.NativeGraphics : IntPtr.Zero),
+ out isVisible);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return isVisible != 0;
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.IsVisible4"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Indicates whether the specified point is contained within this <see cref='System.Drawing.Drawing2D.GraphicsPath'/> .
+ /// </para>
+ /// </devdoc>
+ public bool IsVisible(int x, int y)
+ {
+ return IsVisible(new Point(x, y), (Graphics)null);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.IsVisible5"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Indicates whether the specified point is contained within this <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </para>
+ /// </devdoc>
+ public bool IsVisible(Point point)
+ {
+ return IsVisible(point, (Graphics)null);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.IsVisible6"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Indicates whether the specified point is contained within this <see cref='System.Drawing.Drawing2D.GraphicsPath'/> in the visible clip region of the
+ /// specified <see cref='System.Drawing.Graphics'/>.
+ /// </para>
+ /// </devdoc>
+ public bool IsVisible(int x, int y, Graphics graphics)
+ {
+ return IsVisible(new Point(x, y), graphics);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.IsVisible7"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Indicates whether the specified point is contained within this <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </para>
+ /// </devdoc>
+ public bool IsVisible(Point pt, Graphics graphics)
+ {
+ int isVisible;
+
+ int status = SafeNativeMethods.Gdip.GdipIsVisiblePathPointI(new HandleRef(this, nativePath),
+ pt.X,
+ pt.Y,
+ new HandleRef(graphics, (graphics != null) ?
+ graphics.NativeGraphics : IntPtr.Zero),
+ out isVisible);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return isVisible != 0;
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.IsOutlineVisible"]/*' />
+ /// <devdoc>
+ /// Indicates whether an outline drawn by the
+ /// specified <see cref='System.Drawing.Pen'/> at the specified location is contained
+ /// within this <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </devdoc>
+ public bool IsOutlineVisible(float x, float y, Pen pen)
+ {
+ return IsOutlineVisible(new PointF(x, y), pen, (Graphics)null);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.IsOutlineVisible1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Indicates whether an outline drawn by the specified <see cref='System.Drawing.Pen'/> at the
+ /// specified location is contained within this <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </para>
+ /// </devdoc>
+ public bool IsOutlineVisible(PointF point, Pen pen)
+ {
+ return IsOutlineVisible(point, pen, (Graphics)null);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.IsOutlineVisible2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Indicates whether an outline drawn by the specified <see cref='System.Drawing.Pen'/> at the
+ /// specified location is contained within this <see cref='System.Drawing.Drawing2D.GraphicsPath'/> and within the visible clip region of
+ /// the specified <see cref='System.Drawing.Graphics'/>.
+ /// </para>
+ /// </devdoc>
+ public bool IsOutlineVisible(float x, float y, Pen pen, Graphics graphics)
+ {
+ return IsOutlineVisible(new PointF(x, y), pen, graphics);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.IsOutlineVisible3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Indicates whether an outline drawn by the specified
+ /// <see cref='System.Drawing.Pen'/> at the specified
+ /// location is contained within this <see cref='System.Drawing.Drawing2D.GraphicsPath'/> and within the visible clip region of
+ /// the specified <see cref='System.Drawing.Graphics'/>.
+ /// </para>
+ /// </devdoc>
+ public bool IsOutlineVisible(PointF pt, Pen pen, Graphics graphics)
+ {
+ int isVisible;
+
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+
+ int status = SafeNativeMethods.Gdip.GdipIsOutlineVisiblePathPoint(new HandleRef(this, nativePath),
+ pt.X,
+ pt.Y,
+ new HandleRef(pen, pen.NativePen),
+ new HandleRef(graphics, (graphics != null) ?
+ graphics.NativeGraphics : IntPtr.Zero),
+ out isVisible);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return isVisible != 0;
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.IsOutlineVisible4"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Indicates whether an outline drawn by the specified <see cref='System.Drawing.Pen'/> at the
+ /// specified location is contained within this <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </para>
+ /// </devdoc>
+ public bool IsOutlineVisible(int x, int y, Pen pen)
+ {
+ return IsOutlineVisible(new Point(x, y), pen, (Graphics)null);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.IsOutlineVisible5"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Indicates whether an outline drawn by the specified <see cref='System.Drawing.Pen'/> at the
+ /// specified location is contained within this <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </para>
+ /// </devdoc>
+ public bool IsOutlineVisible(Point point, Pen pen)
+ {
+ return IsOutlineVisible(point, pen, (Graphics)null);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.IsOutlineVisible6"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Indicates whether an outline drawn by the specified <see cref='System.Drawing.Pen'/> at the
+ /// specified location is contained within this <see cref='System.Drawing.Drawing2D.GraphicsPath'/> and within the visible clip region of
+ /// the specified <see cref='System.Drawing.Graphics'/>.
+ /// </para>
+ /// </devdoc>
+ public bool IsOutlineVisible(int x, int y, Pen pen, Graphics graphics)
+ {
+ return IsOutlineVisible(new Point(x, y), pen, graphics);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.IsOutlineVisible7"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Indicates whether an outline drawn by the specified
+ /// <see cref='System.Drawing.Pen'/> at the specified
+ /// location is contained within this <see cref='System.Drawing.Drawing2D.GraphicsPath'/> and within the visible clip region of
+ /// the specified <see cref='System.Drawing.Graphics'/>.
+ /// </para>
+ /// </devdoc>
+ public bool IsOutlineVisible(Point pt, Pen pen, Graphics graphics)
+ {
+ int isVisible;
+
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+
+ int status = SafeNativeMethods.Gdip.GdipIsOutlineVisiblePathPointI(new HandleRef(this, nativePath),
+ pt.X,
+ pt.Y,
+ new HandleRef(pen, pen.NativePen),
+ new HandleRef(graphics, (graphics != null) ?
+ graphics.NativeGraphics : IntPtr.Zero),
+ out isVisible);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return isVisible != 0;
+ }
+
+ /*
+ * Add lines to the path object
+ */
+ // float version
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddLine"]/*' />
+ /// <devdoc>
+ /// Appends a line segment to this <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </devdoc>
+ public void AddLine(PointF pt1, PointF pt2)
+ {
+ AddLine(pt1.X, pt1.Y, pt2.X, pt2.Y);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddLine1"]/*' />
+ /// <devdoc>
+ /// Appends a line segment to this <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </devdoc>
+ public void AddLine(float x1, float y1, float x2, float y2)
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathLine(new HandleRef(this, nativePath), x1, y1, x2, y2);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddLines"]/*' />
+ /// <devdoc>
+ /// Appends a series of connected line
+ /// segments to the end of this <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </devdoc>
+ public void AddLines(PointF[] points)
+ {
+ if (points == null)
+ throw new ArgumentNullException("points");
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathLine2(new HandleRef(this, nativePath), new HandleRef(null, buf), points.Length);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ // int version
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddLine2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Appends a line segment to this <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </para>
+ /// </devdoc>
+ public void AddLine(Point pt1, Point pt2)
+ {
+ AddLine(pt1.X, pt1.Y, pt2.X, pt2.Y);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddLine3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Appends a line segment to this <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </para>
+ /// </devdoc>
+ public void AddLine(int x1, int y1, int x2, int y2)
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathLineI(new HandleRef(this, nativePath), x1, y1, x2, y2);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddLines1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Appends a series of connected line segments to the end of this <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </para>
+ /// </devdoc>
+ public void AddLines(Point[] points)
+ {
+ if (points == null)
+ throw new ArgumentNullException("points");
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathLine2I(new HandleRef(this, nativePath), new HandleRef(null, buf), points.Length);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ /*
+ * Add an arc to the path object
+ */
+ // float version
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddArc"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Appends an elliptical arc to the current
+ /// figure.
+ /// </para>
+ /// </devdoc>
+ public void AddArc(RectangleF rect, float startAngle, float sweepAngle)
+ {
+ AddArc(rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddArc1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Appends an elliptical arc to the current figure.
+ /// </para>
+ /// </devdoc>
+ public void AddArc(float x, float y, float width, float height,
+ float startAngle, float sweepAngle)
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathArc(new HandleRef(this, nativePath), x, y, width, height,
+ startAngle, sweepAngle);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ // int version
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddArc2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Appends an elliptical arc to the current figure.
+ /// </para>
+ /// </devdoc>
+ public void AddArc(Rectangle rect, float startAngle, float sweepAngle)
+ {
+ AddArc(rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddArc3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Appends an elliptical arc to the current figure.
+ /// </para>
+ /// </devdoc>
+ public void AddArc(int x, int y, int width, int height,
+ float startAngle, float sweepAngle)
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathArcI(new HandleRef(this, nativePath), x, y, width, height,
+ startAngle, sweepAngle);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /*
+ * Add Bezier curves to the path object
+ */
+ // float version
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddBezier"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a cubic Bzier curve to the current
+ /// figure.
+ /// </para>
+ /// </devdoc>
+ public void AddBezier(PointF pt1, PointF pt2, PointF pt3, PointF pt4)
+ {
+ AddBezier(pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddBezier1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a cubic Bzier curve to the current
+ /// figure.
+ /// </para>
+ /// </devdoc>
+ public void AddBezier(float x1, float y1, float x2, float y2,
+ float x3, float y3, float x4, float y4)
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathBezier(new HandleRef(this, nativePath), x1, y1, x2, y2,
+ x3, y3, x4, y4);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddBeziers"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a sequence of connected cubic Bzier
+ /// curves to the current figure.
+ /// </para>
+ /// </devdoc>
+ public void AddBeziers(PointF[] points)
+ {
+ if (points == null)
+ throw new ArgumentNullException("points");
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathBeziers(new HandleRef(this, nativePath), new HandleRef(null, buf), points.Length);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ // int version
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddBezier2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a cubic Bzier curve to the current figure.
+ /// </para>
+ /// </devdoc>
+ public void AddBezier(Point pt1, Point pt2, Point pt3, Point pt4)
+ {
+ AddBezier(pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddBezier3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a cubic Bzier curve to the current
+ /// figure.
+ /// </para>
+ /// </devdoc>
+ public void AddBezier(int x1, int y1, int x2, int y2,
+ int x3, int y3, int x4, int y4)
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathBezierI(new HandleRef(this, nativePath), x1, y1, x2, y2,
+ x3, y3, x4, y4);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddBeziers1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a sequence of connected cubic Bzier curves to the
+ /// current figure.
+ /// </para>
+ /// </devdoc>
+ public void AddBeziers(params Point[] points)
+ {
+ if (points == null)
+ throw new ArgumentNullException("points");
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathBeziersI(new HandleRef(this, nativePath), new HandleRef(null, buf), points.Length);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ /*
+ * Add cardinal splines to the path object
+ */
+ // float version
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddCurve"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a spline curve to the current figure.
+ /// A Cardinal spline curve is used because the curve travels through each of the
+ /// points in the array.
+ /// </para>
+ /// </devdoc>
+ public void AddCurve(PointF[] points)
+ {
+ if (points == null)
+ throw new ArgumentNullException("points");
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathCurve(new HandleRef(this, nativePath), new HandleRef(null, buf), points.Length);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddCurve1"]/*' />
+ /// <devdoc>
+ /// Adds a spline curve to the current figure.
+ /// </devdoc>
+ public void AddCurve(PointF[] points, float tension)
+ {
+ if (points == null)
+ throw new ArgumentNullException("points");
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathCurve2(new HandleRef(this, nativePath), new HandleRef(null, buf),
+ points.Length, tension);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddCurve2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a spline curve to the current figure.
+ /// </para>
+ /// </devdoc>
+ public void AddCurve(PointF[] points, int offset, int numberOfSegments,
+ float tension)
+ {
+ if (points == null)
+ throw new ArgumentNullException("points");
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathCurve3(new HandleRef(this, nativePath), new HandleRef(null, buf),
+ points.Length, offset,
+ numberOfSegments, tension);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ // int version
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddCurve3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a spline curve to the current figure. A Cardinal spline curve is used
+ /// because the curve travels through each of the points in the array.
+ /// </para>
+ /// </devdoc>
+ public void AddCurve(Point[] points)
+ {
+ if (points == null)
+ throw new ArgumentNullException("points");
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathCurveI(new HandleRef(this, nativePath), new HandleRef(null, buf), points.Length);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddCurve4"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a spline curve to the current figure.
+ /// </para>
+ /// </devdoc>
+ public void AddCurve(Point[] points, float tension)
+ {
+ if (points == null)
+ throw new ArgumentNullException("points");
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathCurve2I(new HandleRef(this, nativePath), new HandleRef(null, buf),
+ points.Length, tension);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddCurve5"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a spline curve to the current figure.
+ /// </para>
+ /// </devdoc>
+ public void AddCurve(Point[] points, int offset, int numberOfSegments,
+ float tension)
+ {
+ if (points == null)
+ throw new ArgumentNullException("points");
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathCurve3I(new HandleRef(this, nativePath), new HandleRef(null, buf),
+ points.Length, offset,
+ numberOfSegments, tension);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ // float version
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddClosedCurve"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a closed curve to the current figure. A Cardinal spline curve is
+ /// used because the curve travels through each of the points in the array.
+ /// </para>
+ /// </devdoc>
+ public void AddClosedCurve(PointF[] points)
+ {
+ if (points == null)
+ throw new ArgumentNullException("points");
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathClosedCurve(new HandleRef(this, nativePath), new HandleRef(null, buf), points.Length);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddClosedCurve1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a closed curve to the current figure. A Cardinal spline curve is
+ /// used because the curve travels through each of the points in the array.
+ /// </para>
+ /// </devdoc>
+ public void AddClosedCurve(PointF[] points, float tension)
+ {
+ if (points == null)
+ throw new ArgumentNullException("points");
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathClosedCurve2(new HandleRef(this, nativePath), new HandleRef(null, buf), points.Length, tension);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ // int version
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddClosedCurve2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a closed curve to the current figure. A Cardinal spline curve is used
+ /// because the curve travels through each of the points in the array.
+ /// </para>
+ /// </devdoc>
+ public void AddClosedCurve(Point[] points)
+ {
+ if (points == null)
+ throw new ArgumentNullException("points");
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathClosedCurveI(new HandleRef(this, nativePath), new HandleRef(null, buf), points.Length);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddClosedCurve3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a closed curve to the current figure. A Cardinal spline curve is used
+ /// because the curve travels through each of the points in the array.
+ /// </para>
+ /// </devdoc>
+ public void AddClosedCurve(Point[] points, float tension)
+ {
+ if (points == null)
+ throw new ArgumentNullException("points");
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathClosedCurve2I(new HandleRef(this, nativePath), new HandleRef(null, buf), points.Length, tension);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddRectangle"]/*' />
+ /// <devdoc>
+ /// Adds a rectangle to the current figure.
+ /// </devdoc>
+ public void AddRectangle(RectangleF rect)
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathRectangle(new HandleRef(this, nativePath), rect.X, rect.Y,
+ rect.Width, rect.Height);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddRectangles"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a series of rectangles to the current
+ /// figure.
+ /// </para>
+ /// </devdoc>
+ public void AddRectangles(RectangleF[] rects)
+ {
+ if (rects == null)
+ throw new ArgumentNullException("rects");
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertRectangleToMemory(rects);
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathRectangles(new HandleRef(this, nativePath), new HandleRef(null, buf), rects.Length);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ // int version
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddRectangle1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a rectangle to the current figure.
+ /// </para>
+ /// </devdoc>
+ public void AddRectangle(Rectangle rect)
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathRectangleI(new HandleRef(this, nativePath), rect.X, rect.Y,
+ rect.Width, rect.Height);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddRectangles1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a series of rectangles to the current figure.
+ /// </para>
+ /// </devdoc>
+ public void AddRectangles(Rectangle[] rects)
+ {
+ if (rects == null)
+ throw new ArgumentNullException("rects");
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertRectangleToMemory(rects);
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathRectanglesI(new HandleRef(this, nativePath), new HandleRef(null, buf), rects.Length);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ // float version
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddEllipse"]/*' />
+ /// <devdoc>
+ /// Adds an ellipse to the current figure.
+ /// </devdoc>
+ public void AddEllipse(RectangleF rect)
+ {
+ AddEllipse(rect.X, rect.Y, rect.Width, rect.Height);
+ }
+
+ /**
+ * Add an ellipse to the current path
+ *
+ * !!! Need to handle the status code returned
+ * by the native GDI+ APIs.
+ */
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddEllipse1"]/*' />
+ /// <devdoc>
+ /// Adds an ellipse to the current figure.
+ /// </devdoc>
+ public void AddEllipse(float x, float y, float width, float height)
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathEllipse(new HandleRef(this, nativePath), x, y, width, height);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ // int version
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddEllipse2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds an ellipse to the current figure.
+ /// </para>
+ /// </devdoc>
+ public void AddEllipse(Rectangle rect)
+ {
+ AddEllipse(rect.X, rect.Y, rect.Width, rect.Height);
+ }
+
+ /**
+ * Add an ellipse to the current path
+ *
+ * !!! Need to handle the status code returned
+ * by the native GDI+ APIs.
+ */
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddEllipse3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds an ellipse to the current figure.
+ /// </para>
+ /// </devdoc>
+ public void AddEllipse(int x, int y, int width, int height)
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathEllipseI(new HandleRef(this, nativePath), x, y, width, height);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddPie"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds the outline of a pie shape to the
+ /// current figure.
+ /// </para>
+ /// </devdoc>
+ public void AddPie(Rectangle rect, float startAngle, float sweepAngle)
+ {
+ AddPie(rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
+ }
+
+ // float version
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddPie1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds the outline of a pie shape to the current
+ /// figure.
+ /// </para>
+ /// </devdoc>
+ public void AddPie(float x, float y, float width, float height,
+ float startAngle, float sweepAngle)
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathPie(new HandleRef(this, nativePath), x, y, width, height,
+ startAngle, sweepAngle);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ // int version
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddPie2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds the outline of a pie shape to the current
+ /// figure.
+ /// </para>
+ /// </devdoc>
+ public void AddPie(int x, int y, int width, int height,
+ float startAngle, float sweepAngle)
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathPieI(new HandleRef(this, nativePath), x, y, width, height,
+ startAngle, sweepAngle);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ // float version
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddPolygon"]/*' />
+ /// <devdoc>
+ /// Adds a polygon to the current figure.
+ /// </devdoc>
+ public void AddPolygon(PointF[] points)
+ {
+ if (points == null)
+ throw new ArgumentNullException("points");
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathPolygon(new HandleRef(this, nativePath), new HandleRef(null, buf), points.Length);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ // int version
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddPolygon1"]/*' />
+ /// <devdoc>
+ /// Adds a polygon to the current figure.
+ /// </devdoc>
+ public void AddPolygon(Point[] points)
+ {
+ if (points == null)
+ throw new ArgumentNullException("points");
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipAddPathPolygonI(new HandleRef(this, nativePath), new HandleRef(null, buf), points.Length);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddPath"]/*' />
+ /// <devdoc>
+ /// Appends the specified <see cref='System.Drawing.Drawing2D.GraphicsPath'/> to this <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </devdoc>
+ public void AddPath(GraphicsPath addingPath,
+ bool connect)
+ {
+ if (addingPath == null)
+ throw new ArgumentNullException("addingPath");
+
+ int status = SafeNativeMethods.Gdip.GdipAddPathPath(new HandleRef(this, nativePath), new HandleRef(addingPath, addingPath.nativePath), connect);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /*
+ * Add text string to the path object
+ *
+ * @notes The final form of this API is yet to be defined.
+ * @notes What are the choices for the format parameter?
+ */
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddString"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a text string to the current figure.
+ /// </para>
+ /// </devdoc>
+ public void AddString(String s, FontFamily family, int style, float emSize,
+ PointF origin, StringFormat format)
+ {
+ GPRECTF rectf = new GPRECTF(origin.X, origin.Y, 0, 0);
+
+ int status = SafeNativeMethods.Gdip.GdipAddPathString(new HandleRef(this, nativePath),
+ s,
+ s.Length,
+ new HandleRef(family, (family != null) ? family.NativeFamily : IntPtr.Zero),
+ style,
+ emSize,
+ ref rectf,
+ new HandleRef(format, (format != null) ? format.nativeFormat : IntPtr.Zero));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddString1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a text string to the current figure.
+ /// </para>
+ /// </devdoc>
+ public void AddString(String s, FontFamily family, int style, float emSize,
+ Point origin, StringFormat format)
+ {
+ GPRECT rect = new GPRECT(origin.X, origin.Y, 0, 0);
+
+ int status = SafeNativeMethods.Gdip.GdipAddPathStringI(new HandleRef(this, nativePath),
+ s,
+ s.Length,
+ new HandleRef(family, (family != null) ? family.NativeFamily : IntPtr.Zero),
+ style,
+ emSize,
+ ref rect,
+ new HandleRef(format, (format != null) ? format.nativeFormat : IntPtr.Zero));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddString2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a text string to the current figure.
+ /// </para>
+ /// </devdoc>
+ public void AddString(String s, FontFamily family, int style, float emSize,
+ RectangleF layoutRect, StringFormat format)
+ {
+ GPRECTF rectf = new GPRECTF(layoutRect);
+ int status = SafeNativeMethods.Gdip.GdipAddPathString(new HandleRef(this, nativePath),
+ s,
+ s.Length,
+ new HandleRef(family, (family != null) ? family.NativeFamily : IntPtr.Zero),
+ style,
+ emSize,
+ ref rectf,
+ new HandleRef(format, (format != null) ? format.nativeFormat : IntPtr.Zero));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.AddString3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a text string to the current figure.
+ /// </para>
+ /// </devdoc>
+ public void AddString(String s, FontFamily family, int style, float emSize,
+ Rectangle layoutRect, StringFormat format)
+ {
+ GPRECT rect = new GPRECT(layoutRect);
+ int status = SafeNativeMethods.Gdip.GdipAddPathStringI(new HandleRef(this, nativePath),
+ s,
+ s.Length,
+ new HandleRef(family, (family != null) ? family.NativeFamily : IntPtr.Zero),
+ style,
+ emSize,
+ ref rect,
+ new HandleRef(format, (format != null) ? format.nativeFormat : IntPtr.Zero));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.Transform"]/*' />
+ /// <devdoc>
+ /// Applies a transform matrix to this <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </devdoc>
+ public void Transform(Matrix matrix)
+ {
+ if (matrix == null)
+ throw new ArgumentNullException("matrix");
+
+ // !! Is this an optimization? We should catch this in GdipTransformPath
+ if (matrix.nativeMatrix == IntPtr.Zero)
+ return;
+
+ int status = SafeNativeMethods.Gdip.GdipTransformPath(new HandleRef(this, nativePath),
+ new HandleRef(matrix, matrix.nativeMatrix));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.GetBounds"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Returns a rectangle that bounds this <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </para>
+ /// </devdoc>
+ public RectangleF GetBounds()
+ {
+ return GetBounds(null);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.GetBounds1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Returns a rectangle that bounds this <see cref='System.Drawing.Drawing2D.GraphicsPath'/> when it
+ /// is transformed by the specified <see cref='System.Drawing.Drawing2D.Matrix'/>.
+ /// </para>
+ /// </devdoc>
+ public RectangleF GetBounds(Matrix matrix)
+ {
+ return GetBounds(matrix, null);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.GetBounds2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Returns a rectangle that bounds this <see cref='System.Drawing.Drawing2D.GraphicsPath'/> when it is
+ /// transformed by the specified <see cref='System.Drawing.Drawing2D.Matrix'/>. and drawn with the specified <see cref='System.Drawing.Pen'/>.
+ /// </para>
+ /// </devdoc>
+ public RectangleF GetBounds(Matrix matrix, Pen pen)
+ {
+ GPRECTF gprectf = new GPRECTF();
+
+ IntPtr nativeMatrix = IntPtr.Zero, nativePen = IntPtr.Zero;
+
+ if (matrix != null)
+ nativeMatrix = matrix.nativeMatrix;
+
+ if (pen != null)
+ nativePen = pen.NativePen;
+
+ int status = SafeNativeMethods.Gdip.GdipGetPathWorldBounds(new HandleRef(this, nativePath),
+ ref gprectf,
+ new HandleRef(matrix, nativeMatrix),
+ new HandleRef(pen, nativePen));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return gprectf.ToRectangleF();
+ }
+
+ /*
+ * Flatten the path object
+ */
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.Flatten"]/*' />
+ /// <devdoc>
+ /// Converts each curve in this <see cref='System.Drawing.Drawing2D.GraphicsPath'/> into a sequence of connected line
+ /// segments.
+ /// </devdoc>
+ public void Flatten()
+ {
+ Flatten(null);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.Flatten1"]/*' />
+ /// <devdoc>
+ /// Converts each curve in this <see cref='System.Drawing.Drawing2D.GraphicsPath'/> into a sequence of connected line
+ /// segments.
+ /// </devdoc>
+ public void Flatten(Matrix matrix)
+ {
+ Flatten(matrix, 0.25f);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.Flatten2"]/*' />
+ /// <devdoc>
+ /// Converts each curve in this <see cref='System.Drawing.Drawing2D.GraphicsPath'/> into a sequence of connected line
+ /// segments.
+ /// </devdoc>
+ public void Flatten(Matrix matrix, float flatness)
+ {
+ int status = SafeNativeMethods.Gdip.GdipFlattenPath(new HandleRef(this, nativePath),
+ new HandleRef(matrix, (matrix == null) ? IntPtr.Zero : matrix.nativeMatrix),
+ flatness);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+
+ /**
+ * Widen the path object
+ *
+ * @notes We don't have an API yet.
+ * Should we just take in a GeometricPen as parameter?
+ */
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.Widen"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void Widen(Pen pen)
+ {
+ float flatness = (float)2.0 / (float)3.0;
+ Widen(pen, (Matrix)null, flatness);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.Widen1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void Widen(Pen pen, Matrix matrix)
+ {
+ float flatness = (float)2.0 / (float)3.0;
+ Widen(pen, matrix, flatness);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.Widen2"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void Widen(Pen pen,
+ Matrix matrix,
+ float flatness)
+ {
+ IntPtr nativeMatrix;
+
+ if (matrix == null)
+ nativeMatrix = IntPtr.Zero;
+ else
+ nativeMatrix = matrix.nativeMatrix;
+
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+
+ // GDI+ wrongly returns an out of memory status
+ // when there is nothing in the path, so we have to check
+ // before calling the widen method and do nothing if we dont have
+ // anything in the path
+ int pointCount;
+ SafeNativeMethods.Gdip.GdipGetPointCount(new HandleRef(this, nativePath), out pointCount);
+
+ if (pointCount == 0)
+ return;
+
+ int status = SafeNativeMethods.Gdip.GdipWidenPath(new HandleRef(this, nativePath),
+ new HandleRef(pen, pen.NativePen),
+ new HandleRef(matrix, nativeMatrix),
+ flatness);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.Warp"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void Warp(PointF[] destPoints, RectangleF srcRect)
+ { Warp(destPoints, srcRect, null); }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.Warp1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void Warp(PointF[] destPoints, RectangleF srcRect, Matrix matrix)
+ { Warp(destPoints, srcRect, matrix, WarpMode.Perspective); }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.Warp2"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void Warp(PointF[] destPoints, RectangleF srcRect, Matrix matrix,
+ WarpMode warpMode)
+ { Warp(destPoints, srcRect, matrix, warpMode, 0.25f); }
+
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.Warp3"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void Warp(PointF[] destPoints, RectangleF srcRect, Matrix matrix,
+ WarpMode warpMode, float flatness)
+ {
+ if (destPoints == null)
+ throw new ArgumentNullException("destPoints");
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(destPoints);
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipWarpPath(new HandleRef(this, nativePath),
+ new HandleRef(matrix, (matrix == null) ? IntPtr.Zero : matrix.nativeMatrix),
+ new HandleRef(null, buf),
+ destPoints.Length,
+ srcRect.X,
+ srcRect.Y,
+ srcRect.Width,
+ srcRect.Height,
+ warpMode,
+ flatness);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ /**
+ * Return the number of points in the current path
+ */
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.PointCount"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public int PointCount
+ {
+ get
+ {
+ int count = 0;
+
+ int status = SafeNativeMethods.Gdip.GdipGetPointCount(new HandleRef(this, nativePath), out count);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return count;
+ }
+ }
+
+ /**
+ * Return the path point type information
+ */
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.PathTypes"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public byte[] PathTypes
+ {
+ get
+ {
+ int count = PointCount;
+
+ byte[] types = new byte[count];
+
+ int status = SafeNativeMethods.Gdip.GdipGetPathTypes(new HandleRef(this, nativePath), types, count);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return types;
+ }
+ }
+
+ /*
+ * Return the path point coordinate information
+ * @notes Should there be PathData that contains types[] and points[]
+ * for get & set purposes.
+ */
+ // float points
+ /// <include file='doc\GraphicsPath.uex' path='docs/doc[@for="GraphicsPath.PathPoints"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public PointF[] PathPoints
+ {
+ get
+ {
+ int count = PointCount;
+ int size = (int)Marshal.SizeOf(typeof(GPPOINTF));
+ IntPtr buf = Marshal.AllocHGlobal(checked(count * size));
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipGetPathPoints(new HandleRef(this, nativePath), new HandleRef(null, buf), count);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ PointF[] points = SafeNativeMethods.Gdip.ConvertGPPOINTFArrayF(buf, count);
+ return points;
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/GraphicsPathIterator.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/GraphicsPathIterator.cs
new file mode 100644
index 0000000000..4c93d67633
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/GraphicsPathIterator.cs
@@ -0,0 +1,356 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ using System.Diagnostics;
+ using System.Runtime.InteropServices;
+ using System.Drawing.Internal;
+ using System.Globalization;
+
+ /**
+ * Represent a Path Iterator object
+ */
+ /// <include file='doc\GraphicsPathIterator.uex' path='docs/doc[@for="GraphicsPathIterator"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Provides helper functions for the <see cref='System.Drawing.Drawing2D.GraphicsPath'/> class.
+ /// </para>
+ /// </devdoc>
+ public sealed class GraphicsPathIterator : MarshalByRefObject, IDisposable
+ {
+ /**
+ * Create a new path iterator object
+ */
+ /// <include file='doc\GraphicsPathIterator.uex' path='docs/doc[@for="GraphicsPathIterator.GraphicsPathIterator"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.GraphicsPathIterator'/> class with the specified <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </devdoc>
+ public GraphicsPathIterator(GraphicsPath path)
+ {
+ IntPtr nativeIter = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreatePathIter(out nativeIter, new HandleRef(path, (path == null) ? IntPtr.Zero : path.nativePath));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ this.nativeIter = nativeIter;
+ }
+
+ /**
+ * Dispose of resources associated with the
+ */
+ /// <include file='doc\GraphicsPathIterator.uex' path='docs/doc[@for="GraphicsPathIterator.Dispose"]/*' />
+ /// <devdoc>
+ /// Cleans up Windows resources for this
+ /// <see cref='System.Drawing.Drawing2D.GraphicsPathIterator'/>.
+ /// </devdoc>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ private void Dispose(bool disposing)
+ {
+ if (nativeIter != IntPtr.Zero)
+ {
+ try
+ {
+#if DEBUG
+ int status =
+#endif
+ SafeNativeMethods.Gdip.GdipDeletePathIter(new HandleRef(this, nativeIter));
+#if DEBUG
+ Debug.Assert(status == SafeNativeMethods.Gdip.Ok, "GDI+ returned an error status: " + status.ToString(CultureInfo.InvariantCulture));
+#endif
+ }
+ catch (Exception ex)
+ {
+ if (ClientUtils.IsSecurityOrCriticalException(ex))
+ {
+ throw;
+ }
+
+ Debug.Fail("Exception thrown during Dispose: " + ex.ToString());
+ }
+ finally
+ {
+ nativeIter = IntPtr.Zero;
+ }
+ }
+ }
+
+ /// <include file='doc\GraphicsPathIterator.uex' path='docs/doc[@for="GraphicsPathIterator.Finalize"]/*' />
+ /// <devdoc>
+ /// Cleans up Windows resources for this
+ /// <see cref='System.Drawing.Drawing2D.GraphicsPathIterator'/>.
+ /// </devdoc>
+ ~GraphicsPathIterator()
+ {
+ Dispose(false);
+ }
+
+ /**
+ * Next subpath in path
+ */
+ /// <include file='doc\GraphicsPathIterator.uex' path='docs/doc[@for="GraphicsPathIterator.NextSubpath"]/*' />
+ /// <devdoc>
+ /// Returns the number of subpaths in the
+ /// <see cref='System.Drawing.Drawing2D.GraphicsPath'/>. The start index and end index of the
+ /// next subpath are contained in out parameters.
+ /// </devdoc>
+ public int NextSubpath(out int startIndex, out int endIndex, out bool isClosed)
+ {
+ int resultCount = 0;
+ int tempStart = 0;
+ int tempEnd = 0;
+ int status = SafeNativeMethods.Gdip.GdipPathIterNextSubpath(new HandleRef(this, nativeIter), out resultCount,
+ out tempStart, out tempEnd, out isClosed);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ else
+ {
+ startIndex = tempStart;
+ endIndex = tempEnd;
+ }
+
+ return resultCount;
+ }
+
+ /**
+ * Next subpath in path
+ */
+ /// <include file='doc\GraphicsPathIterator.uex' path='docs/doc[@for="GraphicsPathIterator.NextSubpath1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public int NextSubpath(GraphicsPath path, out bool isClosed)
+ {
+ int resultCount = 0;
+ int status = SafeNativeMethods.Gdip.GdipPathIterNextSubpathPath(new HandleRef(this, nativeIter), out resultCount,
+ new HandleRef(path, (path == null) ? IntPtr.Zero : path.nativePath), out isClosed);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return resultCount;
+ }
+
+ /**
+ * Next type in subpath
+ */
+ /// <include file='doc\GraphicsPathIterator.uex' path='docs/doc[@for="GraphicsPathIterator.NextPathType"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public int NextPathType(out byte pathType, out int startIndex, out int endIndex)
+ {
+ int resultCount = 0;
+ int status = SafeNativeMethods.Gdip.GdipPathIterNextPathType(new HandleRef(this, nativeIter), out resultCount,
+ out pathType, out startIndex, out endIndex);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return resultCount;
+ }
+
+ /**
+ * Next marker in subpath
+ */
+ /// <include file='doc\GraphicsPathIterator.uex' path='docs/doc[@for="GraphicsPathIterator.NextMarker"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public int NextMarker(out int startIndex, out int endIndex)
+ {
+ int resultCount = 0;
+ int status = SafeNativeMethods.Gdip.GdipPathIterNextMarker(new HandleRef(this, nativeIter), out resultCount,
+ out startIndex, out endIndex);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return resultCount;
+ }
+
+ /**
+ * Next marker in subpath
+ */
+ /// <include file='doc\GraphicsPathIterator.uex' path='docs/doc[@for="GraphicsPathIterator.NextMarker1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public int NextMarker(GraphicsPath path)
+ {
+ int resultCount = 0;
+ int status = SafeNativeMethods.Gdip.GdipPathIterNextMarkerPath(new HandleRef(this, nativeIter), out resultCount,
+ new HandleRef(path, (path == null) ? IntPtr.Zero : path.nativePath));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return resultCount;
+ }
+
+ /// <include file='doc\GraphicsPathIterator.uex' path='docs/doc[@for="GraphicsPathIterator.Count"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public int Count
+ {
+ get
+ {
+ int resultCount = 0;
+ int status = SafeNativeMethods.Gdip.GdipPathIterGetCount(new HandleRef(this, nativeIter), out resultCount);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return resultCount;
+ }
+ }
+
+ /// <include file='doc\GraphicsPathIterator.uex' path='docs/doc[@for="GraphicsPathIterator.SubpathCount"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public int SubpathCount
+ {
+ get
+ {
+ int resultCount = 0;
+ int status = SafeNativeMethods.Gdip.GdipPathIterGetSubpathCount(new HandleRef(this, nativeIter), out resultCount);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return resultCount;
+ }
+ }
+
+ /// <include file='doc\GraphicsPathIterator.uex' path='docs/doc[@for="GraphicsPathIterator.HasCurve"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public bool HasCurve()
+ {
+ bool hasCurve = false;
+
+ int status = SafeNativeMethods.Gdip.GdipPathIterHasCurve(new HandleRef(this, nativeIter), out hasCurve);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return hasCurve;
+ }
+
+ /// <include file='doc\GraphicsPathIterator.uex' path='docs/doc[@for="GraphicsPathIterator.Rewind"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void Rewind()
+ {
+ int status = SafeNativeMethods.Gdip.GdipPathIterRewind(new HandleRef(this, nativeIter));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\GraphicsPathIterator.uex' path='docs/doc[@for="GraphicsPathIterator.Enumerate"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public int Enumerate(ref PointF[] points, ref byte[] types)
+ {
+ if (points.Length != types.Length)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter);
+
+ int resultCount = 0;
+ int size = (int)Marshal.SizeOf(typeof(GPPOINTF));
+ int count = points.Length;
+ byte[] typesLocal = new byte[count];
+
+ IntPtr memoryPts = Marshal.AllocHGlobal(checked(count * size));
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipPathIterEnumerate(new HandleRef(this, nativeIter), out resultCount,
+ memoryPts, typesLocal, count);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ if (resultCount < count)
+ {
+ SafeNativeMethods.ZeroMemory((IntPtr)(checked((long)memoryPts + resultCount * size)), (UIntPtr)((count - resultCount) * size));
+ }
+
+ points = SafeNativeMethods.Gdip.ConvertGPPOINTFArrayF(memoryPts, count);
+ typesLocal.CopyTo(types, 0);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(memoryPts);
+ }
+
+ return resultCount;
+ }
+
+ /// <include file='doc\GraphicsPathIterator.uex' path='docs/doc[@for="GraphicsPathIterator.CopyData"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// points - pointF array to copy the retrieved point data
+ /// types - type array to copy the retrieved type data
+ /// startIndex - start index of the origianl data
+ /// endIndex - end index of the origianl data
+ /// </para>
+ /// </devdoc>
+ public int CopyData(ref PointF[] points, ref byte[] types, int startIndex, int endIndex)
+ {
+ if ((points.Length != types.Length) || (endIndex - startIndex + 1 > points.Length))
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter);
+
+ int resultCount = 0;
+ int size = (int)Marshal.SizeOf(typeof(GPPOINTF));
+ int count = points.Length;
+ byte[] typesLocal = new byte[count];
+
+ IntPtr memoryPts = Marshal.AllocHGlobal(checked(count * size));
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipPathIterCopyData(new HandleRef(this, nativeIter), out resultCount,
+ memoryPts, typesLocal, startIndex, endIndex);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ if (resultCount < count)
+ {
+ SafeNativeMethods.ZeroMemory((IntPtr)(checked((long)memoryPts + resultCount * size)), (UIntPtr)((count - resultCount) * size));
+ }
+
+ points = SafeNativeMethods.Gdip.ConvertGPPOINTFArrayF(memoryPts, count);
+ typesLocal.CopyTo(types, 0);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(memoryPts);
+ }
+
+ return resultCount;
+ }
+
+ /*
+ * handle to native path iterator object
+ */
+ internal IntPtr nativeIter;
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/GraphicsState.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/GraphicsState.cs
new file mode 100644
index 0000000000..58e0952cf5
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/GraphicsState.cs
@@ -0,0 +1,21 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /// <include file='doc\GraphicsState.uex' path='docs/doc[@for="GraphicsState"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public sealed class GraphicsState : MarshalByRefObject
+ {
+ internal int nativeState;
+
+ internal GraphicsState(int nativeState)
+ {
+ this.nativeState = nativeState;
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/HatchBrush.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/HatchBrush.cs
new file mode 100644
index 0000000000..e1893618f9
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/HatchBrush.cs
@@ -0,0 +1,141 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ using System.Runtime.InteropServices;
+ using System.Diagnostics;
+
+ /**
+ * Represent a HatchBrush brush object
+ */
+ /// <include file='doc\HatchBrush.uex' path='docs/doc[@for="HatchBrush"]/*' />
+ /// <devdoc>
+ /// Defines a rectangular brush with a hatch
+ /// style, a foreground color, and a background color.
+ /// </devdoc>
+ public sealed class HatchBrush : Brush
+ {
+ /**
+ * Create a new hatch brush object
+ */
+ /// <include file='doc\HatchBrush.uex' path='docs/doc[@for="HatchBrush.HatchBrush"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.HatchBrush'/> class with the specified <see cref='System.Drawing.Drawing2D.HatchStyle'/> and foreground color.
+ /// </para>
+ /// </devdoc>
+ public HatchBrush(HatchStyle hatchstyle, Color foreColor) :
+ this(hatchstyle, foreColor, Color.FromArgb(unchecked((int)0xff000000)))
+ {
+ }
+
+ /// <include file='doc\HatchBrush.uex' path='docs/doc[@for="HatchBrush.HatchBrush1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.HatchBrush'/> class with the specified <see cref='System.Drawing.Drawing2D.HatchStyle'/>,
+ /// foreground color, and background color.
+ /// </para>
+ /// </devdoc>
+ public HatchBrush(HatchStyle hatchstyle, Color foreColor, Color backColor)
+ {
+ IntPtr brush = IntPtr.Zero;
+ int status = SafeNativeMethods.Gdip.GdipCreateHatchBrush(unchecked((int)hatchstyle), foreColor.ToArgb(), backColor.ToArgb(), out brush);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeBrushInternal(brush);
+ }
+
+ /// <devdoc>
+ /// Constructor to initialize this object from a GDI+ native reference.
+ /// </devdoc>
+ internal HatchBrush(IntPtr nativeBrush)
+ {
+ Debug.Assert(nativeBrush != IntPtr.Zero, "Initializing native brush with null.");
+ SetNativeBrushInternal(nativeBrush);
+ }
+
+ /// <include file='doc\HatchBrush.uex' path='docs/doc[@for="HatchBrush.Clone"]/*' />
+ /// <devdoc>
+ /// Creates an exact copy of this <see cref='System.Drawing.Drawing2D.HatchBrush'/>.
+ /// </devdoc>
+ public override object Clone()
+ {
+ IntPtr cloneBrush = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCloneBrush(new HandleRef(this, NativeBrush), out cloneBrush);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return new HatchBrush(cloneBrush);
+ }
+
+ /**
+ * Get hatch brush object attributes
+ */
+ /// <include file='doc\HatchBrush.uex' path='docs/doc[@for="HatchBrush.HatchStyle"]/*' />
+ /// <devdoc>
+ /// Gets the hatch style of this <see cref='System.Drawing.Drawing2D.HatchBrush'/>.
+ /// </devdoc>
+ public HatchStyle HatchStyle
+ {
+ get
+ {
+ int hatchStyle = 0;
+
+ int status = SafeNativeMethods.Gdip.GdipGetHatchStyle(new HandleRef(this, NativeBrush), out hatchStyle);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return (HatchStyle)hatchStyle;
+ }
+ }
+
+ /// <include file='doc\HatchBrush.uex' path='docs/doc[@for="HatchBrush.ForegroundColor"]/*' />
+ /// <devdoc>
+ /// Gets the color of hatch lines drawn by this
+ /// <see cref='System.Drawing.Drawing2D.HatchBrush'/>.
+ /// </devdoc>
+ public Color ForegroundColor
+ {
+ get
+ {
+ int forecol;
+
+ int status = SafeNativeMethods.Gdip.GdipGetHatchForegroundColor(new HandleRef(this, NativeBrush), out forecol);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return Color.FromArgb(forecol);
+ }
+ }
+
+ /// <include file='doc\HatchBrush.uex' path='docs/doc[@for="HatchBrush.BackgroundColor"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the color of spaces between the hatch
+ /// lines drawn by this <see cref='System.Drawing.Drawing2D.HatchBrush'/>.
+ /// </para>
+ /// </devdoc>
+ public Color BackgroundColor
+ {
+ get
+ {
+ int backcol;
+
+ int status = SafeNativeMethods.Gdip.GdipGetHatchBackgroundColor(new HandleRef(this, NativeBrush), out backcol);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return Color.FromArgb(backcol);
+ }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/HatchStyle.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/HatchStyle.cs
new file mode 100644
index 0000000000..cdef717999
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/HatchStyle.cs
@@ -0,0 +1,358 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle"]/*' />
+ /// <devdoc>
+ /// Specifies the different patterns available
+ /// for <see cref='System.Drawing.Drawing2D.HatchBrush'/> objects.
+ /// </devdoc>
+ public enum HatchStyle
+ {
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.Horizontal"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A pattern of horizontal lines.
+ /// </para>
+ /// </devdoc>
+ Horizontal = 0,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.Vertical"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A pattern of vertical lines.
+ /// </para>
+ /// </devdoc>
+ Vertical = 1,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.ForwardDiagonal"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A pattern of lines on a diagonal from top-left to bottom-right.
+ /// </para>
+ /// </devdoc>
+ ForwardDiagonal = 2,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.BackwardDiagonal"]/*' />
+ /// <devdoc>
+ /// A pattern of lines on a diagonal from
+ /// top-right to bottom-left.
+ /// </devdoc>
+ BackwardDiagonal = 3,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.Cross"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A pattern of criss-cross horizontal and vertical lines.
+ /// </para>
+ /// </devdoc>
+ Cross = 4,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.DiagonalCross"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A pattern of criss-cross diagonal lines.
+ /// </para>
+ /// </devdoc>
+ DiagonalCross = 5,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.Percent05"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ Percent05 = 6,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.Percent10"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ Percent10 = 7,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.Percent20"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ Percent20 = 8,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.Percent25"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ Percent25 = 9,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.Percent30"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ Percent30 = 10,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.Percent40"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ Percent40 = 11,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.Percent50"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ Percent50 = 12,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.Percent60"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ Percent60 = 13,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.Percent70"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ Percent70 = 14,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.Percent75"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ Percent75 = 15,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.Percent80"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ Percent80 = 16,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.Percent90"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ Percent90 = 17,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.LightDownwardDiagonal"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ LightDownwardDiagonal = 18,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.LightUpwardDiagonal"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ LightUpwardDiagonal = 19,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.DarkDownwardDiagonal"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ DarkDownwardDiagonal = 20,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.DarkUpwardDiagonal"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ DarkUpwardDiagonal = 21,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.WideDownwardDiagonal"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ WideDownwardDiagonal = 22,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.WideUpwardDiagonal"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ WideUpwardDiagonal = 23,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.LightVertical"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ LightVertical = 24,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.LightHorizontal"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ LightHorizontal = 25,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.NarrowVertical"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ NarrowVertical = 26,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.NarrowHorizontal"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ NarrowHorizontal = 27,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.DarkVertical"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ DarkVertical = 28,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.DarkHorizontal"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ DarkHorizontal = 29,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.DashedDownwardDiagonal"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ DashedDownwardDiagonal = 30,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.DashedUpwardDiagonal"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ DashedUpwardDiagonal = 31,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.DashedHorizontal"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ DashedHorizontal = 32,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.DashedVertical"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ DashedVertical = 33,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.SmallConfetti"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ SmallConfetti = 34,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.LargeConfetti"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ LargeConfetti = 35,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.ZigZag"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ ZigZag = 36,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.Wave"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ Wave = 37,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.DiagonalBrick"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ DiagonalBrick = 38,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.HorizontalBrick"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ HorizontalBrick = 39,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.Weave"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ Weave = 40,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.Plaid"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ Plaid = 41,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.Divot"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ Divot = 42,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.DottedGrid"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ DottedGrid = 43,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.DottedDiamond"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ DottedDiamond = 44,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.Shingle"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ Shingle = 45,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.Trellis"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ Trellis = 46,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.Sphere"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ Sphere = 47,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.SmallGrid"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ SmallGrid = 48,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.SmallCheckerBoard"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ SmallCheckerBoard = 49,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.LargeCheckerBoard"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ LargeCheckerBoard = 50,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.OutlinedDiamond"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ OutlinedDiamond = 51,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.SolidDiamond"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ SolidDiamond = 52,
+
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.LargeGrid"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ LargeGrid = Cross,
+
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.Min"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ Min = Horizontal,
+ /// <include file='doc\HatchStyle.uex' path='docs/doc[@for="HatchStyle.Max"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ Max = LargeGrid
+ };
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/HotkeyPrefix.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/HotkeyPrefix.cs
new file mode 100644
index 0000000000..db9aa51fe6
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/HotkeyPrefix.cs
@@ -0,0 +1,38 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Text
+{
+ /// <include file='doc\HotkeyPrefix.uex' path='docs/doc[@for="HotkeyPrefix"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the type of display for hotkey prefixes for text.
+ /// </para>
+ /// </devdoc>
+ public enum HotkeyPrefix
+ {
+ /// <include file='doc\HotkeyPrefix.uex' path='docs/doc[@for="HotkeyPrefix.None"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// No hotkey prefix.
+ /// </para>
+ /// </devdoc>
+ None = 0,
+ /// <include file='doc\HotkeyPrefix.uex' path='docs/doc[@for="HotkeyPrefix.Show"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Display the hotkey prefix.
+ /// </para>
+ /// </devdoc>
+ Show = 1,
+ /// <include file='doc\HotkeyPrefix.uex' path='docs/doc[@for="HotkeyPrefix.Hide"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Do not display the hotkey prefix.
+ /// </para>
+ /// </devdoc>
+ Hide = 2
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/ISystemEventTracker.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/ISystemEventTracker.cs
new file mode 100644
index 0000000000..3fd555f575
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/ISystemEventTracker.cs
@@ -0,0 +1,13 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Internal
+{
+ // See SystemColorTracker
+ internal interface ISystemColorTracker
+ {
+ void OnSystemColorChanged();
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/ImageAttributes.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/ImageAttributes.cs
new file mode 100644
index 0000000000..6026cc88ae
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/ImageAttributes.cs
@@ -0,0 +1,754 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ using System.Runtime.InteropServices;
+ using System.Diagnostics;
+ using System.Drawing.Drawing2D;
+ using System.Globalization;
+
+ // sdkinc\GDIplusImageAttributes.h
+
+ // There are 5 possible sets of color adjustments:
+ // ColorAdjustDefault,
+ // ColorAdjustBitmap,
+ // ColorAdjustBrush,
+ // ColorAdjustPen,
+ // ColorAdjustText,
+
+ // Bitmaps, Brushes, Pens, and Text will all use any color adjustments
+ // that have been set into the default ImageAttributes until their own
+ // color adjustments have been set. So as soon as any "Set" method is
+ // called for Bitmaps, Brushes, Pens, or Text, then they start from
+ // scratch with only the color adjustments that have been set for them.
+ // Calling Reset removes any individual color adjustments for a type
+ // and makes it revert back to using all the default color adjustments
+ // (if any). The SetToIdentity method is a way to force a type to
+ // have no color adjustments at all, regardless of what previous adjustments
+ // have been set for the defaults or for that type.
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes"]/*' />
+ /// <devdoc>
+ /// Contains information about how image colors
+ /// are manipulated during rendering.
+ /// </devdoc>
+ [StructLayout(LayoutKind.Sequential)]
+ public sealed class ImageAttributes : ICloneable, IDisposable
+ {
+#if FINALIZATION_WATCH
+ private string allocationSite = Graphics.GetAllocationStack();
+#endif
+
+
+ /*
+ * Handle to native image attributes object
+ */
+
+ internal IntPtr nativeImageAttributes;
+
+ internal void SetNativeImageAttributes(IntPtr handle)
+ {
+ if (handle == IntPtr.Zero)
+ throw new ArgumentNullException("handle");
+
+ nativeImageAttributes = handle;
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.ImageAttributes"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.ImageAttributes'/> class.
+ /// </devdoc>
+ public ImageAttributes()
+ {
+ IntPtr newImageAttributes = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateImageAttributes(out newImageAttributes);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeImageAttributes(newImageAttributes);
+ }
+
+ internal ImageAttributes(IntPtr newNativeImageAttributes)
+ {
+ SetNativeImageAttributes(newNativeImageAttributes);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.Dispose"]/*' />
+ /// <devdoc>
+ /// Cleans up Windows resources for this
+ /// <see cref='System.Drawing.Imaging.ImageAttributes'/>.
+ /// </devdoc>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ private void Dispose(bool disposing)
+ {
+#if FINALIZATION_WATCH
+ if (!disposing && nativeImageAttributes != IntPtr.Zero)
+ Debug.WriteLine("**********************\nDisposed through finalization:\n" + allocationSite);
+#endif
+ if (nativeImageAttributes != IntPtr.Zero)
+ {
+ try
+ {
+#if DEBUG
+ int status =
+#endif
+ SafeNativeMethods.Gdip.GdipDisposeImageAttributes(new HandleRef(this, nativeImageAttributes));
+#if DEBUG
+ Debug.Assert(status == SafeNativeMethods.Gdip.Ok, "GDI+ returned an error status: " + status.ToString(CultureInfo.InvariantCulture));
+#endif
+ }
+ catch (Exception ex)
+ {
+ if (ClientUtils.IsSecurityOrCriticalException(ex))
+ {
+ throw;
+ }
+
+ Debug.Fail("Exception thrown during Dispose: " + ex.ToString());
+ }
+ finally
+ {
+ nativeImageAttributes = IntPtr.Zero;
+ }
+ }
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.Finalize"]/*' />
+ /// <devdoc>
+ /// Cleans up Windows resources for this
+ /// <see cref='System.Drawing.Imaging.ImageAttributes'/>.
+ /// </devdoc>
+ ~ImageAttributes()
+ {
+ Dispose(false);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.Clone"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Creates an exact copy of this <see cref='System.Drawing.Imaging.ImageAttributes'/>.
+ /// </para>
+ /// </devdoc>
+ public object Clone()
+ {
+ IntPtr clone = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCloneImageAttributes(
+ new HandleRef(this, nativeImageAttributes),
+ out clone);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return new ImageAttributes(clone);
+ }
+
+ /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future.
+ void SetToIdentity()
+ {
+ SetToIdentity(ColorAdjustType.Default);
+ }
+
+ void SetToIdentity(ColorAdjustType type)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetImageAttributesToIdentity(new HandleRef(this, nativeImageAttributes), type);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ void Reset()
+ {
+ Reset(ColorAdjustType.Default);
+ }
+
+ void Reset(ColorAdjustType type)
+ {
+ int status = SafeNativeMethods.Gdip.GdipResetImageAttributes(new HandleRef(this, nativeImageAttributes), type);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ */
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetColorMatrix"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Sets the 5 X 5 color adjust matrix to the
+ /// specified <see cref='System.Drawing.Drawing2D.Matrix'/>.
+ /// </para>
+ /// </devdoc>
+ public void SetColorMatrix(ColorMatrix newColorMatrix)
+ {
+ SetColorMatrix(newColorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Default);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetColorMatrix1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Sets the 5 X 5 color adjust matrix to the specified 'Matrix' with the specified 'ColorMatrixFlags'.
+ /// </para>
+ /// </devdoc>
+ public void SetColorMatrix(ColorMatrix newColorMatrix, ColorMatrixFlag flags)
+ {
+ SetColorMatrix(newColorMatrix, flags, ColorAdjustType.Default);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetColorMatrix2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Sets the 5 X 5 color adjust matrix to the specified 'Matrix' with the
+ /// specified 'ColorMatrixFlags'.
+ /// </para>
+ /// </devdoc>
+ public void SetColorMatrix(ColorMatrix newColorMatrix, ColorMatrixFlag mode, ColorAdjustType type)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetImageAttributesColorMatrix(
+ new HandleRef(this, nativeImageAttributes),
+ type,
+ true,
+ newColorMatrix,
+ null,
+ mode);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.ClearColorMatrix"]/*' />
+ /// <devdoc>
+ /// Clears the color adjust matrix to all
+ /// zeroes.
+ /// </devdoc>
+ public void ClearColorMatrix()
+ {
+ ClearColorMatrix(ColorAdjustType.Default);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.ClearColorMatrix1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Clears the color adjust matrix.
+ /// </para>
+ /// </devdoc>
+ public void ClearColorMatrix(ColorAdjustType type)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetImageAttributesColorMatrix(
+ new HandleRef(this, nativeImageAttributes),
+ type,
+ false,
+ null,
+ null,
+ ColorMatrixFlag.Default);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetColorMatrices"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Sets a color adjust matrix for image colors
+ /// and a separate gray scale adjust matrix for gray scale values.
+ /// </para>
+ /// </devdoc>
+ public void SetColorMatrices(ColorMatrix newColorMatrix, ColorMatrix grayMatrix)
+ {
+ SetColorMatrices(newColorMatrix, grayMatrix, ColorMatrixFlag.Default, ColorAdjustType.Default);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetColorMatrices1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void SetColorMatrices(ColorMatrix newColorMatrix, ColorMatrix grayMatrix, ColorMatrixFlag flags)
+ {
+ SetColorMatrices(newColorMatrix, grayMatrix, flags, ColorAdjustType.Default);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetColorMatrices2"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void SetColorMatrices(ColorMatrix newColorMatrix, ColorMatrix grayMatrix, ColorMatrixFlag mode,
+ ColorAdjustType type)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetImageAttributesColorMatrix(
+ new HandleRef(this, nativeImageAttributes),
+ type,
+ true,
+ newColorMatrix,
+ grayMatrix,
+ mode);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetThreshold"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void SetThreshold(float threshold)
+ {
+ SetThreshold(threshold, ColorAdjustType.Default);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetThreshold1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void SetThreshold(float threshold, ColorAdjustType type)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetImageAttributesThreshold(
+ new HandleRef(this, nativeImageAttributes),
+ type,
+ true,
+ threshold);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.ClearThreshold"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void ClearThreshold()
+ {
+ ClearThreshold(ColorAdjustType.Default);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.ClearThreshold1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void ClearThreshold(ColorAdjustType type)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetImageAttributesThreshold(
+ new HandleRef(this, nativeImageAttributes),
+ type,
+ false,
+ 0.0f);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetGamma"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void SetGamma(float gamma)
+ {
+ SetGamma(gamma, ColorAdjustType.Default);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetGamma1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void SetGamma(float gamma, ColorAdjustType type)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetImageAttributesGamma(
+ new HandleRef(this, nativeImageAttributes),
+ type,
+ true,
+ gamma);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.ClearGamma"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void ClearGamma()
+ {
+ ClearGamma(ColorAdjustType.Default);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.ClearGamma1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void ClearGamma(ColorAdjustType type)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetImageAttributesGamma(
+ new HandleRef(this, nativeImageAttributes),
+ type,
+ false,
+ 0.0f);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetNoOp"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void SetNoOp()
+ {
+ SetNoOp(ColorAdjustType.Default);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetNoOp1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void SetNoOp(ColorAdjustType type)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetImageAttributesNoOp(
+ new HandleRef(this, nativeImageAttributes),
+ type,
+ true);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.ClearNoOp"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void ClearNoOp()
+ {
+ ClearNoOp(ColorAdjustType.Default);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.ClearNoOp1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void ClearNoOp(ColorAdjustType type)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetImageAttributesNoOp(
+ new HandleRef(this, nativeImageAttributes),
+ type,
+ false);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetColorKey"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void SetColorKey(Color colorLow, Color colorHigh)
+ {
+ SetColorKey(colorLow, colorHigh, ColorAdjustType.Default);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetColorKey1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void SetColorKey(Color colorLow, Color colorHigh, ColorAdjustType type)
+ {
+ int lowInt = colorLow.ToArgb();
+ int highInt = colorHigh.ToArgb();
+
+ int status = SafeNativeMethods.Gdip.GdipSetImageAttributesColorKeys(
+ new HandleRef(this, nativeImageAttributes),
+ type,
+ true,
+ lowInt,
+ highInt);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.ClearColorKey"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void ClearColorKey()
+ {
+ ClearColorKey(ColorAdjustType.Default);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.ClearColorKey1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void ClearColorKey(ColorAdjustType type)
+ {
+ int zero = 0;
+ int status = SafeNativeMethods.Gdip.GdipSetImageAttributesColorKeys(
+ new HandleRef(this, nativeImageAttributes),
+ type,
+ false,
+ zero,
+ zero);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetOutputChannel"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void SetOutputChannel(ColorChannelFlag flags)
+ {
+ SetOutputChannel(flags, ColorAdjustType.Default);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetOutputChannel1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void SetOutputChannel(ColorChannelFlag flags, ColorAdjustType type)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetImageAttributesOutputChannel(
+ new HandleRef(this, nativeImageAttributes),
+ type,
+ true,
+ flags);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.ClearOutputChannel"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void ClearOutputChannel()
+ {
+ ClearOutputChannel(ColorAdjustType.Default);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.ClearOutputChannel1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void ClearOutputChannel(ColorAdjustType type)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetImageAttributesOutputChannel(
+ new HandleRef(this, nativeImageAttributes),
+ type,
+ false,
+ ColorChannelFlag.ColorChannelLast);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetOutputChannelColorProfile"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void SetOutputChannelColorProfile(String colorProfileFilename)
+ {
+ SetOutputChannelColorProfile(colorProfileFilename, ColorAdjustType.Default);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetOutputChannelColorProfile1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void SetOutputChannelColorProfile(String colorProfileFilename,
+ ColorAdjustType type)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetImageAttributesOutputChannelColorProfile(
+ new HandleRef(this, nativeImageAttributes),
+ type,
+ true,
+ colorProfileFilename);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.ClearOutputChannelColorProfile"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void ClearOutputChannelColorProfile()
+ {
+ ClearOutputChannel(ColorAdjustType.Default);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.ClearOutputChannelColorProfile1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void ClearOutputChannelColorProfile(ColorAdjustType type)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetImageAttributesOutputChannel(
+ new HandleRef(this, nativeImageAttributes),
+ type,
+ false,
+ ColorChannelFlag.ColorChannelLast);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetRemapTable"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void SetRemapTable(ColorMap[] map)
+ {
+ SetRemapTable(map, ColorAdjustType.Default);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetRemapTable1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void SetRemapTable(ColorMap[] map, ColorAdjustType type)
+ {
+ int index = 0;
+ int mapSize = map.Length;
+ int size = 4; // Marshal.SizeOf(index.GetType());
+ IntPtr memory = Marshal.AllocHGlobal(checked(mapSize * size * 2));
+
+ try
+ {
+ for (index = 0; index < mapSize; index++)
+ {
+ Marshal.StructureToPtr(map[index].OldColor.ToArgb(), (IntPtr)((long)memory + index * size * 2), false);
+ Marshal.StructureToPtr(map[index].NewColor.ToArgb(), (IntPtr)((long)memory + index * size * 2 + size), false);
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipSetImageAttributesRemapTable(
+ new HandleRef(this, nativeImageAttributes),
+ type,
+ true,
+ mapSize,
+ new HandleRef(null, memory));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(memory);
+ }
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.ClearRemapTable"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void ClearRemapTable()
+ {
+ ClearRemapTable(ColorAdjustType.Default);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.ClearRemapTable1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void ClearRemapTable(ColorAdjustType type)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetImageAttributesRemapTable(
+ new HandleRef(this, nativeImageAttributes),
+ type,
+ false,
+ 0,
+ NativeMethods.NullHandleRef);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetBrushRemapTable"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void SetBrushRemapTable(ColorMap[] map)
+ {
+ SetRemapTable(map, ColorAdjustType.Brush);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.ClearBrushRemapTable"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void ClearBrushRemapTable()
+ {
+ ClearRemapTable(ColorAdjustType.Brush);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetWrapMode"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void SetWrapMode(WrapMode mode)
+ {
+ SetWrapMode(mode, new Color(), false);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetWrapMode1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void SetWrapMode(WrapMode mode, Color color)
+ {
+ SetWrapMode(mode, color, false);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetWrapMode2"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void SetWrapMode(WrapMode mode, Color color, bool clamp)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetImageAttributesWrapMode(
+ new HandleRef(this, nativeImageAttributes),
+ unchecked((int)mode),
+ color.ToArgb(),
+ clamp);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.GetAdjustedPalette"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void GetAdjustedPalette(ColorPalette palette, ColorAdjustType type)
+ {
+ // does inplace adjustment
+ IntPtr memory = palette.ConvertToMemory();
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipGetImageAttributesAdjustedPalette(
+ new HandleRef(this, nativeImageAttributes), new HandleRef(null, memory), type);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ palette.ConvertFromMemory(memory);
+ }
+ finally
+ {
+ if (memory != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(memory);
+ }
+ }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/ImageCodecFlags.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/ImageCodecFlags.cs
new file mode 100644
index 0000000000..caa89b3725
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/ImageCodecFlags.cs
@@ -0,0 +1,64 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ /**
+ * Color channel flag constants
+ */
+ /// <include file='doc\ImageCodecFlags.uex' path='docs/doc[@for="ImageCodecFlags"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ [Flags()]
+ public enum ImageCodecFlags
+ {
+ /// <include file='doc\ImageCodecFlags.uex' path='docs/doc[@for="ImageCodecFlags.Encoder"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Encoder = 0x00000001,
+ /// <include file='doc\ImageCodecFlags.uex' path='docs/doc[@for="ImageCodecFlags.Decoder"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Decoder = 0x00000002,
+ /// <include file='doc\ImageCodecFlags.uex' path='docs/doc[@for="ImageCodecFlags.SupportBitmap"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ SupportBitmap = 0x00000004,
+ /// <include file='doc\ImageCodecFlags.uex' path='docs/doc[@for="ImageCodecFlags.SupportVector"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ SupportVector = 0x00000008,
+ /// <include file='doc\ImageCodecFlags.uex' path='docs/doc[@for="ImageCodecFlags.SeekableEncode"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ SeekableEncode = 0x00000010,
+ /// <include file='doc\ImageCodecFlags.uex' path='docs/doc[@for="ImageCodecFlags.BlockingDecode"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ BlockingDecode = 0x00000020,
+
+ /// <include file='doc\ImageCodecFlags.uex' path='docs/doc[@for="ImageCodecFlags.Builtin"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Builtin = 0x00010000,
+ /// <include file='doc\ImageCodecFlags.uex' path='docs/doc[@for="ImageCodecFlags.System"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ System = 0x00020000,
+ /// <include file='doc\ImageCodecFlags.uex' path='docs/doc[@for="ImageCodecFlags.User"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ User = 0x00040000
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/ImageCodecInfo.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/ImageCodecInfo.cs
new file mode 100644
index 0000000000..919d65b419
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/ImageCodecInfo.cs
@@ -0,0 +1,307 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ using System.Runtime.InteropServices;
+
+ // sdkinc\imaging.h
+ /// <include file='doc\ImageCodecInfo.uex' path='docs/doc[@for="ImageCodecInfo"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public sealed class ImageCodecInfo
+ {
+ private Guid _clsid;
+ private Guid _formatID;
+ private string _codecName;
+ private string _dllName;
+ private string _formatDescription;
+ private string _filenameExtension;
+ private string _mimeType;
+ private ImageCodecFlags _flags;
+ private int _version;
+ private byte[][] _signaturePatterns;
+ private byte[][] _signatureMasks;
+
+ internal ImageCodecInfo()
+ {
+ }
+
+ /// <include file='doc\ImageCodecInfo.uex' path='docs/doc[@for="ImageCodecInfo.Clsid"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public Guid Clsid
+ {
+ get { return _clsid; }
+ set { _clsid = value; }
+ }
+ /// <include file='doc\ImageCodecInfo.uex' path='docs/doc[@for="ImageCodecInfo.FormatID"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public Guid FormatID
+ {
+ get { return _formatID; }
+ set { _formatID = value; }
+ }
+ /// <include file='doc\ImageCodecInfo.uex' path='docs/doc[@for="ImageCodecInfo.CodecName"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public string CodecName
+ {
+ get { return _codecName; }
+ set { _codecName = value; }
+ }
+ /// <include file='doc\ImageCodecInfo.uex' path='docs/doc[@for="ImageCodecInfo.DllName"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public string DllName
+ {
+ get
+ {
+ return _dllName;
+ }
+ set
+ {
+ _dllName = value;
+ }
+ }
+ /// <include file='doc\ImageCodecInfo.uex' path='docs/doc[@for="ImageCodecInfo.FormatDescription"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public string FormatDescription
+ {
+ get { return _formatDescription; }
+ set { _formatDescription = value; }
+ }
+ /// <include file='doc\ImageCodecInfo.uex' path='docs/doc[@for="ImageCodecInfo.FilenameExtension"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public string FilenameExtension
+ {
+ get { return _filenameExtension; }
+ set { _filenameExtension = value; }
+ }
+ /// <include file='doc\ImageCodecInfo.uex' path='docs/doc[@for="ImageCodecInfo.MimeType"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public string MimeType
+ {
+ get { return _mimeType; }
+ set { _mimeType = value; }
+ }
+ /// <include file='doc\ImageCodecInfo.uex' path='docs/doc[@for="ImageCodecInfo.Flags"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public ImageCodecFlags Flags
+ {
+ get { return _flags; }
+ set { _flags = value; }
+ }
+ /// <include file='doc\ImageCodecInfo.uex' path='docs/doc[@for="ImageCodecInfo.Version"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public int Version
+ {
+ get { return _version; }
+ set { _version = value; }
+ }
+ /// <include file='doc\ImageCodecInfo.uex' path='docs/doc[@for="ImageCodecInfo.SignaturePatterns"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ [CLSCompliant(false)]
+ public byte[][] SignaturePatterns
+ {
+ get { return _signaturePatterns; }
+ set { _signaturePatterns = value; }
+ }
+ /// <include file='doc\ImageCodecInfo.uex' path='docs/doc[@for="ImageCodecInfo.SignatureMasks"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ [CLSCompliant(false)]
+ public byte[][] SignatureMasks
+ {
+ get { return _signatureMasks; }
+ set { _signatureMasks = value; }
+ }
+
+ // Encoder/Decoder selection APIs
+
+ /// <include file='doc\ImageCodecInfo.uex' path='docs/doc[@for="ImageCodecInfo.GetImageDecoders"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static ImageCodecInfo[] GetImageDecoders()
+ {
+ ImageCodecInfo[] imageCodecs;
+ int numDecoders;
+ int size;
+
+ int status = SafeNativeMethods.Gdip.GdipGetImageDecodersSize(out numDecoders, out size);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ IntPtr memory = Marshal.AllocHGlobal(size);
+
+ try
+ {
+ status = SafeNativeMethods.Gdip.GdipGetImageDecoders(numDecoders, size, memory);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ imageCodecs = ImageCodecInfo.ConvertFromMemory(memory, numDecoders);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(memory);
+ }
+
+ return imageCodecs;
+ }
+
+ /// <include file='doc\ImageCodecInfo.uex' path='docs/doc[@for="ImageCodecInfo.GetImageEncoders"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static ImageCodecInfo[] GetImageEncoders()
+ {
+ ImageCodecInfo[] imageCodecs;
+ int numEncoders;
+ int size;
+
+ int status = SafeNativeMethods.Gdip.GdipGetImageEncodersSize(out numEncoders, out size);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ IntPtr memory = Marshal.AllocHGlobal(size);
+
+ try
+ {
+ status = SafeNativeMethods.Gdip.GdipGetImageEncoders(numEncoders, size, memory);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ imageCodecs = ImageCodecInfo.ConvertFromMemory(memory, numEncoders);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(memory);
+ }
+
+ return imageCodecs;
+ }
+
+ /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future.
+ internal static ImageCodecInfoPrivate ConvertToMemory(ImageCodecInfo imagecs)
+ {
+ ImageCodecInfoPrivate imagecsp = new ImageCodecInfoPrivate();
+
+ imagecsp.Clsid = imagecs.Clsid;
+ imagecsp.FormatID = imagecs.FormatID;
+
+ imagecsp.CodecName = Marshal.StringToHGlobalUni(imagecs.CodecName);
+ imagecsp.DllName = Marshal.StringToHGlobalUni(imagecs.DllName);
+ imagecsp.FormatDescription = Marshal.StringToHGlobalUni(imagecs.FormatDescription);
+ imagecsp.FilenameExtension = Marshal.StringToHGlobalUni(imagecs.FilenameExtension);
+ imagecsp.MimeType = Marshal.StringToHGlobalUni(imagecs.MimeType);
+
+ imagecsp.Flags = (int)imagecs.Flags;
+ imagecsp.Version = (int)imagecs.Version;
+ imagecsp.SigCount = imagecs.SignaturePatterns.Length;
+ imagecsp.SigSize = imagecs.SignaturePatterns[0].Length;
+
+ imagecsp.SigPattern = Marshal.AllocHGlobal(imagecsp.SigCount*imagecsp.SigSize);
+ imagecsp.SigMask = Marshal.AllocHGlobal(imagecsp.SigCount*imagecsp.SigSize);
+
+ for (int i=0; i<imagecsp.SigCount; i++)
+ {
+ Marshal.Copy(imagecs.SignaturePatterns[i],
+ 0,
+ (IntPtr)((long)imagecsp.SigPattern + i*imagecsp.SigSize),
+ imagecsp.SigSize);
+
+ Marshal.Copy(imagecs.SignatureMasks[i],
+ 0,
+ (IntPtr)((long)imagecsp.SigMask + i*imagecsp.SigSize),
+ imagecsp.SigSize);
+ }
+
+ return imagecsp;
+ }
+
+ internal static void FreeMemory(ImageCodecInfoPrivate imagecodecp)
+ {
+ Marshal.FreeHGlobal(imagecodecp.CodecName);
+ Marshal.FreeHGlobal(imagecodecp.FormatDescription);
+ Marshal.FreeHGlobal(imagecodecp.FilenameExtension);
+ Marshal.FreeHGlobal(imagecodecp.MimeType);
+ Marshal.FreeHGlobal(imagecodecp.SigPattern);
+ Marshal.FreeHGlobal(imagecodecp.SigMask);
+ }
+ */
+
+ private static ImageCodecInfo[] ConvertFromMemory(IntPtr memoryStart, int numCodecs)
+ {
+ ImageCodecInfo[] codecs = new ImageCodecInfo[numCodecs];
+
+ int index;
+
+ for (index = 0; index < numCodecs; index++)
+ {
+ IntPtr curcodec = (IntPtr)((long)memoryStart + (int)Marshal.SizeOf(typeof(ImageCodecInfoPrivate)) * index);
+ ImageCodecInfoPrivate codecp = new ImageCodecInfoPrivate();
+ UnsafeNativeMethods.PtrToStructure(curcodec, codecp);
+
+ codecs[index] = new ImageCodecInfo();
+ codecs[index].Clsid = codecp.Clsid;
+ codecs[index].FormatID = codecp.FormatID;
+ codecs[index].CodecName = Marshal.PtrToStringUni(codecp.CodecName);
+ codecs[index].DllName = Marshal.PtrToStringUni(codecp.DllName);
+ codecs[index].FormatDescription = Marshal.PtrToStringUni(codecp.FormatDescription);
+ codecs[index].FilenameExtension = Marshal.PtrToStringUni(codecp.FilenameExtension);
+ codecs[index].MimeType = Marshal.PtrToStringUni(codecp.MimeType);
+
+ codecs[index].Flags = (ImageCodecFlags)codecp.Flags;
+ codecs[index].Version = (int)codecp.Version;
+
+ codecs[index].SignaturePatterns = new byte[codecp.SigCount][];
+ codecs[index].SignatureMasks = new byte[codecp.SigCount][];
+
+ for (int j = 0; j < codecp.SigCount; j++)
+ {
+ codecs[index].SignaturePatterns[j] = new byte[codecp.SigSize];
+ codecs[index].SignatureMasks[j] = new byte[codecp.SigSize];
+
+ Marshal.Copy((IntPtr)((long)codecp.SigMask + j * codecp.SigSize), codecs[index].SignatureMasks[j], 0, codecp.SigSize);
+ Marshal.Copy((IntPtr)((long)codecp.SigPattern + j * codecp.SigSize), codecs[index].SignaturePatterns[j], 0, codecp.SigSize);
+ }
+ }
+
+ return codecs;
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/ImageCodecInfoPrivate.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/ImageCodecInfoPrivate.cs
new file mode 100644
index 0000000000..b205e2905e
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/ImageCodecInfoPrivate.cs
@@ -0,0 +1,36 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ using System.Runtime.InteropServices;
+
+ // sdkinc\imaging.h
+ [StructLayout(LayoutKind.Sequential, Pack = 8)]
+ internal class ImageCodecInfoPrivate
+ {
+#pragma warning disable CS0618 // Legacy code: We don't care about using obsolete API's.
+ [MarshalAs(UnmanagedType.Struct)]
+#pragma warning restore CS0618
+ public Guid Clsid;
+#pragma warning disable CS0618 // Legacy code: We don't care about using obsolete API's.
+ [MarshalAs(UnmanagedType.Struct)]
+#pragma warning restore CS0618
+ public Guid FormatID;
+
+ public IntPtr CodecName = IntPtr.Zero;
+ public IntPtr DllName = IntPtr.Zero;
+ public IntPtr FormatDescription = IntPtr.Zero;
+ public IntPtr FilenameExtension = IntPtr.Zero;
+ public IntPtr MimeType = IntPtr.Zero;
+
+ public int Flags;
+ public int Version;
+ public int SigCount;
+ public int SigSize;
+
+ public IntPtr SigPattern = IntPtr.Zero;
+ public IntPtr SigMask = IntPtr.Zero;
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/ImageFlags.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/ImageFlags.cs
new file mode 100644
index 0000000000..7765a23240
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/ImageFlags.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ /**
+ * Color channel flag constants
+ */
+ /// <include file='doc\ImageFlags.uex' path='docs/doc[@for="ImageFlags"]/*' />
+ /// <devdoc>
+ /// Specifies the attributes of the pixel data
+ /// contained in an <see langword='Image'/> object.
+ /// </devdoc>
+ [Flags()]
+ public enum ImageFlags
+ {
+ /// <include file='doc\ImageFlags.uex' path='docs/doc[@for="ImageFlags.None"]/*' />
+ /// <devdoc>
+ /// There is no format information.
+ /// </devdoc>
+ None = 0,
+
+ // Low-word: shared with SINKFLAG_x
+
+ /// <include file='doc\ImageFlags.uex' path='docs/doc[@for="ImageFlags.Scalable"]/*' />
+ /// <devdoc>
+ /// Pixel data is scalable.
+ /// </devdoc>
+ Scalable = 0x0001,
+ /// <include file='doc\ImageFlags.uex' path='docs/doc[@for="ImageFlags.HasAlpha"]/*' />
+ /// <devdoc>
+ /// Pixel data contains alpha information.
+ /// </devdoc>
+ HasAlpha = 0x0002,
+ /// <include file='doc\ImageFlags.uex' path='docs/doc[@for="ImageFlags.HasTranslucent"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ HasTranslucent = 0x0004,
+ /// <include file='doc\ImageFlags.uex' path='docs/doc[@for="ImageFlags.PartiallyScalable"]/*' />
+ /// <devdoc>
+ /// Pixel data is partially scalable, but there
+ /// are some limitations.
+ /// </devdoc>
+ PartiallyScalable = 0x0008,
+
+ // Low-word: color space definition
+
+ /// <include file='doc\ImageFlags.uex' path='docs/doc[@for="ImageFlags.ColorSpaceRgb"]/*' />
+ /// <devdoc>
+ /// Pixel data uses an RGB color space.
+ /// </devdoc>
+ ColorSpaceRgb = 0x0010,
+ /// <include file='doc\ImageFlags.uex' path='docs/doc[@for="ImageFlags.ColorSpaceCmyk"]/*' />
+ /// <devdoc>
+ /// Pixel data uses a CMYK color space.
+ /// </devdoc>
+ ColorSpaceCmyk = 0x0020,
+ /// <include file='doc\ImageFlags.uex' path='docs/doc[@for="ImageFlags.ColorSpaceGray"]/*' />
+ /// <devdoc>
+ /// Pixel data is grayscale.
+ /// </devdoc>
+ ColorSpaceGray = 0x0040,
+ /// <include file='doc\ImageFlags.uex' path='docs/doc[@for="ImageFlags.ColorSpaceYcbcr"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ ColorSpaceYcbcr = 0x0080,
+ /// <include file='doc\ImageFlags.uex' path='docs/doc[@for="ImageFlags.ColorSpaceYcck"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ ColorSpaceYcck = 0x0100,
+
+ // Low-word: image size info
+
+ /// <include file='doc\ImageFlags.uex' path='docs/doc[@for="ImageFlags.HasRealDpi"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ HasRealDpi = 0x1000,
+ /// <include file='doc\ImageFlags.uex' path='docs/doc[@for="ImageFlags.HasRealPixelSize"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ HasRealPixelSize = 0x2000,
+
+ // High-word
+
+ /// <include file='doc\ImageFlags.uex' path='docs/doc[@for="ImageFlags.ReadOnly"]/*' />
+ /// <devdoc>
+ /// Pixel data is read-only.
+ /// </devdoc>
+ ReadOnly = 0x00010000,
+ /// <include file='doc\ImageFlags.uex' path='docs/doc[@for="ImageFlags.Caching"]/*' />
+ /// <devdoc>
+ /// Pixel data can be cached for faster access.
+ /// </devdoc>
+ Caching = 0x00020000
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/ImageFormat.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/ImageFormat.cs
new file mode 100644
index 0000000000..1df7ee392d
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/ImageFormat.cs
@@ -0,0 +1,208 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ /**
+ * Image format constants
+ */
+ /// <include file='doc\ImageFormat.uex' path='docs/doc[@for="ImageFormat"]/*' />
+ /// <devdoc>
+ /// Specifies the format of the image.
+ /// </devdoc>
+ public sealed class ImageFormat
+ {
+ // Format IDs
+ // private static ImageFormat undefined = new ImageFormat(new Guid("{b96b3ca9-0728-11d3-9d7b-0000f81ef32e}"));
+ private static ImageFormat s_memoryBMP = new ImageFormat(new Guid("{b96b3caa-0728-11d3-9d7b-0000f81ef32e}"));
+ private static ImageFormat s_bmp = new ImageFormat(new Guid("{b96b3cab-0728-11d3-9d7b-0000f81ef32e}"));
+ private static ImageFormat s_emf = new ImageFormat(new Guid("{b96b3cac-0728-11d3-9d7b-0000f81ef32e}"));
+ private static ImageFormat s_wmf = new ImageFormat(new Guid("{b96b3cad-0728-11d3-9d7b-0000f81ef32e}"));
+ private static ImageFormat s_jpeg = new ImageFormat(new Guid("{b96b3cae-0728-11d3-9d7b-0000f81ef32e}"));
+ private static ImageFormat s_png = new ImageFormat(new Guid("{b96b3caf-0728-11d3-9d7b-0000f81ef32e}"));
+ private static ImageFormat s_gif = new ImageFormat(new Guid("{b96b3cb0-0728-11d3-9d7b-0000f81ef32e}"));
+ private static ImageFormat s_tiff = new ImageFormat(new Guid("{b96b3cb1-0728-11d3-9d7b-0000f81ef32e}"));
+ private static ImageFormat s_exif = new ImageFormat(new Guid("{b96b3cb2-0728-11d3-9d7b-0000f81ef32e}"));
+ private static ImageFormat s_photoCD = new ImageFormat(new Guid("{b96b3cb3-0728-11d3-9d7b-0000f81ef32e}"));
+ private static ImageFormat s_flashPIX = new ImageFormat(new Guid("{b96b3cb4-0728-11d3-9d7b-0000f81ef32e}"));
+ private static ImageFormat s_icon = new ImageFormat(new Guid("{b96b3cb5-0728-11d3-9d7b-0000f81ef32e}"));
+
+
+ private Guid _guid;
+
+ /// <include file='doc\ImageFormat.uex' path='docs/doc[@for="ImageFormat.ImageFormat"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.ImageFormat'/> class with the specified GUID.
+ /// </devdoc>
+ public ImageFormat(Guid guid)
+ {
+ _guid = guid;
+ }
+
+ /// <include file='doc\ImageFormat.uex' path='docs/doc[@for="ImageFormat.Guid"]/*' />
+ /// <devdoc>
+ /// Specifies a global unique identifier (GUID)
+ /// that represents this <see cref='System.Drawing.Imaging.ImageFormat'/>.
+ /// </devdoc>
+ public Guid Guid
+ {
+ get { return _guid; }
+ }
+
+ /// <include file='doc\ImageFormat.uex' path='docs/doc[@for="ImageFormat.MemoryBmp"]/*' />
+ /// <devdoc>
+ /// Specifies a memory bitmap image format.
+ /// </devdoc>
+ public static ImageFormat MemoryBmp
+ {
+ get { return s_memoryBMP; }
+ }
+
+ /// <include file='doc\ImageFormat.uex' path='docs/doc[@for="ImageFormat.Bmp"]/*' />
+ /// <devdoc>
+ /// Specifies the bitmap image format.
+ /// </devdoc>
+ public static ImageFormat Bmp
+ {
+ get { return s_bmp; }
+ }
+
+ /// <include file='doc\ImageFormat.uex' path='docs/doc[@for="ImageFormat.Emf"]/*' />
+ /// <devdoc>
+ /// Specifies the enhanced Windows metafile
+ /// image format.
+ /// </devdoc>
+ public static ImageFormat Emf
+ {
+ get { return s_emf; }
+ }
+
+ /// <include file='doc\ImageFormat.uex' path='docs/doc[@for="ImageFormat.Wmf"]/*' />
+ /// <devdoc>
+ /// Specifies the Windows metafile image
+ /// format.
+ /// </devdoc>
+ public static ImageFormat Wmf
+ {
+ get { return s_wmf; }
+ }
+
+ /// <include file='doc\ImageFormat.uex' path='docs/doc[@for="ImageFormat.Gif"]/*' />
+ /// <devdoc>
+ /// Specifies the GIF image format.
+ /// </devdoc>
+ public static ImageFormat Gif
+ {
+ get { return s_gif; }
+ }
+
+ /// <include file='doc\ImageFormat.uex' path='docs/doc[@for="ImageFormat.Jpeg"]/*' />
+ /// <devdoc>
+ /// Specifies the JPEG image format.
+ /// </devdoc>
+ public static ImageFormat Jpeg
+ {
+ get { return s_jpeg; }
+ }
+
+ /// <include file='doc\ImageFormat.uex' path='docs/doc[@for="ImageFormat.Png"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the W3C PNG image format.
+ /// </para>
+ /// </devdoc>
+ public static ImageFormat Png
+ {
+ get { return s_png; }
+ }
+
+ /// <include file='doc\ImageFormat.uex' path='docs/doc[@for="ImageFormat.Tiff"]/*' />
+ /// <devdoc>
+ /// Specifies the Tag Image File
+ /// Format (TIFF) image format.
+ /// </devdoc>
+ public static ImageFormat Tiff
+ {
+ get { return s_tiff; }
+ }
+
+ /// <include file='doc\ImageFormat.uex' path='docs/doc[@for="ImageFormat.Exif"]/*' />
+ /// <devdoc>
+ /// Specifies the Exchangable Image Format
+ /// (EXIF).
+ /// </devdoc>
+ public static ImageFormat Exif
+ {
+ get { return s_exif; }
+ }
+
+ /// <include file='doc\ImageFormat.uex' path='docs/doc[@for="ImageFormat.Icon"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the Windows icon image format.
+ /// </para>
+ /// </devdoc>
+ public static ImageFormat Icon
+ {
+ get { return s_icon; }
+ }
+
+ /// <include file='doc\ImageFormat.uex' path='docs/doc[@for="ImageFormat.Equals"]/*' />
+ /// <devdoc>
+ /// Returns a value indicating whether the
+ /// specified object is an <see cref='System.Drawing.Imaging.ImageFormat'/> equivalent to this <see cref='System.Drawing.Imaging.ImageFormat'/>.
+ /// </devdoc>
+ public override bool Equals(object o)
+ {
+ ImageFormat format = o as ImageFormat;
+ if (format == null)
+ return false;
+ return _guid == format._guid;
+ }
+
+ /// <include file='doc\ImageFormat.uex' path='docs/doc[@for="ImageFormat.GetHashCode"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Returns a hash code.
+ /// </para>
+ /// </devdoc>
+ public override int GetHashCode()
+ {
+ return _guid.GetHashCode();
+ }
+
+#if !FEATURE_PAL
+ // Find any random encoder which supports this format
+ internal ImageCodecInfo FindEncoder()
+ {
+ ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders();
+ foreach (ImageCodecInfo codec in codecs)
+ {
+ if (codec.FormatID.Equals(_guid))
+ return codec;
+ }
+ return null;
+ }
+#endif
+
+ /// <include file='doc\ImageFormat.uex' path='docs/doc[@for="ImageFormat.ToString"]/*' />
+ /// <devdoc>
+ /// Converts this <see cref='System.Drawing.Imaging.ImageFormat'/> to a human-readable string.
+ /// </devdoc>
+ public override string ToString()
+ {
+ if (this == s_memoryBMP) return "MemoryBMP";
+ if (this == s_bmp) return "Bmp";
+ if (this == s_emf) return "Emf";
+ if (this == s_wmf) return "Wmf";
+ if (this == s_gif) return "Gif";
+ if (this == s_jpeg) return "Jpeg";
+ if (this == s_png) return "Png";
+ if (this == s_tiff) return "Tiff";
+ if (this == s_exif) return "Exif";
+ if (this == s_icon) return "Icon";
+ return "[ImageFormat: " + _guid + "]";
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/ImageLockMode.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/ImageLockMode.cs
new file mode 100644
index 0000000000..4f8049a7f6
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/ImageLockMode.cs
@@ -0,0 +1,46 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ //
+ // Access modes used when calling IImage::LockBits
+ //
+ /// <include file='doc\ImageLockMode.uex' path='docs/doc[@for="ImageLockMode"]/*' />
+ /// <devdoc>
+ /// Indicates the access mode for an <see cref='System.Drawing.Image'/>.
+ /// </devdoc>
+ public enum ImageLockMode
+ {
+ /// <include file='doc\ImageLockMode.uex' path='docs/doc[@for="ImageLockMode.ReadOnly"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the image is read-only.
+ /// </para>
+ /// </devdoc>
+ ReadOnly = 0x0001,
+ /// <include file='doc\ImageLockMode.uex' path='docs/doc[@for="ImageLockMode.WriteOnly"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the image is
+ /// write-only.
+ /// </para>
+ /// </devdoc>
+ WriteOnly = 0x0002,
+ /// <include file='doc\ImageLockMode.uex' path='docs/doc[@for="ImageLockMode.ReadWrite"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the image is
+ /// read-write.
+ /// </para>
+ /// </devdoc>
+ ReadWrite = ReadOnly | WriteOnly,
+ /// <include file='doc\ImageLockMode.uex' path='docs/doc[@for="ImageLockMode.UserInputBuffer"]/*' />
+ /// <devdoc>
+ /// Indicates the image resides in a user input
+ /// buffer, to which the user controls access.
+ /// </devdoc>
+ UserInputBuffer = 0x0004,
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/InstalledFontCollection.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/InstalledFontCollection.cs
new file mode 100644
index 0000000000..d7fc469522
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/InstalledFontCollection.cs
@@ -0,0 +1,31 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Text
+{
+ /// <include file='doc\InstalledFontCollection.uex' path='docs/doc[@for="InstalledFontCollection"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Represents the fonts installed on the
+ /// system.
+ /// </para>
+ /// </devdoc>
+ public sealed class InstalledFontCollection : FontCollection
+ {
+ /// <include file='doc\InstalledFontCollection.uex' path='docs/doc[@for="InstalledFontCollection.InstalledFontCollection"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Text.InstalledFontCollection'/> class.
+ /// </devdoc>
+ public InstalledFontCollection()
+ {
+ nativeFontCollection = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipNewInstalledFontCollection(out nativeFontCollection);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/InterpolationMode.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/InterpolationMode.cs
new file mode 100644
index 0000000000..5a1ae21a13
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/InterpolationMode.cs
@@ -0,0 +1,67 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /**
+ * Various wrap modes for brushes
+ */
+ /// <include file='doc\InterpolationMode.uex' path='docs/doc[@for="InterpolationMode"]/*' />
+ /// <devdoc>
+ /// Specifies how data is interpolated between
+ /// endpoints.
+ /// </devdoc>
+ public enum InterpolationMode
+ {
+ /// <include file='doc\InterpolationMode.uex' path='docs/doc[@for="InterpolationMode.Invalid"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Equivalent to <see cref='System.Drawing.Drawing2D.QualityMode.Invalid'/>
+ /// </para>
+ /// </devdoc>
+ Invalid = QualityMode.Invalid,
+ /// <include file='doc\InterpolationMode.uex' path='docs/doc[@for="InterpolationMode.Default"]/*' />
+ /// <devdoc>
+ /// Specifies default mode.
+ /// </devdoc>
+ Default = QualityMode.Default,
+ /// <include file='doc\InterpolationMode.uex' path='docs/doc[@for="InterpolationMode.Low"]/*' />
+ /// <devdoc>
+ /// Specifies low quality.
+ /// </devdoc>
+ Low = QualityMode.Low,
+ /// <include file='doc\InterpolationMode.uex' path='docs/doc[@for="InterpolationMode.High"]/*' />
+ /// <devdoc>
+ /// Specifies high quality.
+ /// </devdoc>
+ High = QualityMode.High,
+ /// <include file='doc\InterpolationMode.uex' path='docs/doc[@for="InterpolationMode.Bilinear"]/*' />
+ /// <devdoc>
+ /// Specifies bilinear interpolation.
+ /// </devdoc>
+ Bilinear,
+ /// <include file='doc\InterpolationMode.uex' path='docs/doc[@for="InterpolationMode.Bicubic"]/*' />
+ /// <devdoc>
+ /// Specifies bicubic interpolation.
+ /// </devdoc>
+ Bicubic,
+ /// <include file='doc\InterpolationMode.uex' path='docs/doc[@for="InterpolationMode.NearestNeighbor"]/*' />
+ /// <devdoc>
+ /// Specifies nearest neighbor interpolation.
+ /// </devdoc>
+ NearestNeighbor,
+ /// <include file='doc\InterpolationMode.uex' path='docs/doc[@for="InterpolationMode.HighQualityBilinear"]/*' />
+ /// <devdoc>
+ /// Specifies high qulaity bilenear
+ /// interpolation.
+ /// </devdoc>
+ HighQualityBilinear,
+ /// <include file='doc\InterpolationMode.uex' path='docs/doc[@for="InterpolationMode.HighQualityBicubic"]/*' />
+ /// <devdoc>
+ /// Specifies high quality bicubic
+ /// interpolation.
+ /// </devdoc>
+ HighQualityBicubic
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/LineCap.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/LineCap.cs
new file mode 100644
index 0000000000..c9a854f403
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/LineCap.cs
@@ -0,0 +1,81 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /**
+ * Line cap constants
+ */
+ /// <include file='doc\LineCap.uex' path='docs/doc[@for="LineCap"]/*' />
+ /// <devdoc>
+ /// Specifies the available cap
+ /// styles with which a <see cref='System.Drawing.Pen'/> can end a line.
+ /// </devdoc>
+ public enum LineCap
+ {
+ /// <include file='doc\LineCap.uex' path='docs/doc[@for="LineCap.Flat"]/*' />
+ /// <devdoc>
+ /// Specifies a flat line cap.
+ /// </devdoc>
+ Flat = 0,
+ /// <include file='doc\LineCap.uex' path='docs/doc[@for="LineCap.Square"]/*' />
+ /// <devdoc>
+ /// Specifies a square line cap.
+ /// </devdoc>
+ Square = 1,
+ /// <include file='doc\LineCap.uex' path='docs/doc[@for="LineCap.Round"]/*' />
+ /// <devdoc>
+ /// Specifies a round line cap.
+ /// </devdoc>
+ Round = 2,
+ /// <include file='doc\LineCap.uex' path='docs/doc[@for="LineCap.Triangle"]/*' />
+ /// <devdoc>
+ /// Specifies a triangular line cap.
+ /// </devdoc>
+ Triangle = 3,
+
+ /// <include file='doc\LineCap.uex' path='docs/doc[@for="LineCap.NoAnchor"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ NoAnchor = 0x10, // corresponds to flat cap
+ /// <include file='doc\LineCap.uex' path='docs/doc[@for="LineCap.SquareAnchor"]/*' />
+ /// <devdoc>
+ /// Specifies no line cap.
+ /// </devdoc>
+ SquareAnchor = 0x11, // corresponds to square cap
+ /// <include file='doc\LineCap.uex' path='docs/doc[@for="LineCap.RoundAnchor"]/*' />
+ /// <devdoc>
+ /// Specifies a round anchor cap.
+ /// </devdoc>
+ RoundAnchor = 0x12, // corresponds to round cap
+ /// <include file='doc\LineCap.uex' path='docs/doc[@for="LineCap.DiamondAnchor"]/*' />
+ /// <devdoc>
+ /// Specifies a diamond anchor cap.
+ /// </devdoc>
+ DiamondAnchor = 0x13, // corresponds to triangle cap
+ /// <include file='doc\LineCap.uex' path='docs/doc[@for="LineCap.ArrowAnchor"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies an arrow-shaped anchor cap.
+ /// </para>
+ /// </devdoc>
+ ArrowAnchor = 0x14, // no correspondence
+
+ /// <include file='doc\LineCap.uex' path='docs/doc[@for="LineCap.Custom"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies a custom line cap.
+ /// </para>
+ /// </devdoc>
+ Custom = 0xff, // custom cap
+
+ /// <include file='doc\LineCap.uex' path='docs/doc[@for="LineCap.AnchorMask"]/*' />
+ /// <devdoc>
+ /// Specifies a mask used to check whether a
+ /// line cap is an anchor cap.
+ /// </devdoc>
+ AnchorMask = 0xf0 // mask to check for anchor or not.
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/LineJoin.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/LineJoin.cs
new file mode 100644
index 0000000000..25bc930743
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/LineJoin.cs
@@ -0,0 +1,42 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /**
+ * Line join constants
+ */
+ /// <include file='doc\LineJoin.uex' path='docs/doc[@for="LineJoin"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies how to join two intersecting lines in a
+ /// <see cref='System.Drawing.Drawing2D.GraphicsPath'/> at their intersection.
+ /// </para>
+ /// </devdoc>
+ public enum LineJoin
+ {
+ /// <include file='doc\LineJoin.uex' path='docs/doc[@for="LineJoin.Miter"]/*' />
+ /// <devdoc>
+ /// Specifies an angled miter join.
+ /// </devdoc>
+ Miter = 0,
+ /// <include file='doc\LineJoin.uex' path='docs/doc[@for="LineJoin.Bevel"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies a beveled join.
+ /// </para>
+ /// </devdoc>
+ Bevel = 1,
+ /// <include file='doc\LineJoin.uex' path='docs/doc[@for="LineJoin.Round"]/*' />
+ /// <devdoc>
+ /// Specifies a smooth, rounded join.
+ /// </devdoc>
+ Round = 2,
+ /// <include file='doc\LineJoin.uex' path='docs/doc[@for="LineJoin.MiterClipped"]/*' />
+ /// <devdoc>
+ /// Specifies a mitered clipped join
+ /// </devdoc>
+ MiterClipped = 3
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/LinearGradientBrush.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/LinearGradientBrush.cs
new file mode 100644
index 0000000000..36ad66c708
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/LinearGradientBrush.cs
@@ -0,0 +1,934 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ using System.Diagnostics;
+ using System.ComponentModel;
+ using System.Runtime.InteropServices;
+ using System.Drawing.Internal;
+
+ /**
+ * Represent a LinearGradient brush object
+ */
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Encapsulates a <see cref='System.Drawing.Brush'/> with a linear gradient.
+ /// </para>
+ /// </devdoc>
+ public sealed class LinearGradientBrush : Brush
+ {
+ private bool _interpolationColorsWasSet;
+
+ /**
+ * Create a new rectangle gradient brush object
+ */
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.LinearGradientBrush"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.LinearGradientBrush'/> class with the specified points and
+ /// colors.
+ /// </devdoc>
+ public LinearGradientBrush(PointF point1, PointF point2,
+ Color color1, Color color2)
+ {
+ IntPtr brush = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateLineBrush(new GPPOINTF(point1),
+ new GPPOINTF(point2),
+ color1.ToArgb(),
+ color2.ToArgb(),
+ (int)WrapMode.Tile,
+ out brush);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeBrushInternal(brush);
+ }
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.LinearGradientBrush1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.LinearGradientBrush'/> class with the
+ /// specified points and colors.
+ /// </para>
+ /// </devdoc>
+ public LinearGradientBrush(Point point1, Point point2,
+ Color color1, Color color2)
+ {
+ IntPtr brush = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateLineBrushI(new GPPOINT(point1),
+ new GPPOINT(point2),
+ color1.ToArgb(),
+ color2.ToArgb(),
+ (int)WrapMode.Tile,
+ out brush);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeBrushInternal(brush);
+ }
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.LinearGradientBrush2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Encapsulates a new instance of the <see cref='System.Drawing.Drawing2D.LinearGradientBrush'/> class with
+ /// the specified points, colors, and orientation.
+ /// </para>
+ /// </devdoc>
+ public LinearGradientBrush(RectangleF rect, Color color1, Color color2,
+ LinearGradientMode linearGradientMode)
+ {
+ //validate the LinearGradientMode enum
+ //valid values are 0x0 to 0x3
+ if (!ClientUtils.IsEnumValid(linearGradientMode, unchecked((int)linearGradientMode), (int)LinearGradientMode.Horizontal, (int)LinearGradientMode.BackwardDiagonal))
+ {
+ throw new InvalidEnumArgumentException("linearGradientMode", unchecked((int)linearGradientMode), typeof(LinearGradientMode));
+ }
+
+ //validate the rect
+ if (rect.Width == 0.0 || rect.Height == 0.0)
+ {
+ throw new ArgumentException(SR.Format(SR.GdiplusInvalidRectangle, rect.ToString()));
+ }
+
+ IntPtr brush = IntPtr.Zero;
+
+ GPRECTF gprectf = new GPRECTF(rect);
+ int status = SafeNativeMethods.Gdip.GdipCreateLineBrushFromRect(ref gprectf,
+ color1.ToArgb(),
+ color2.ToArgb(),
+ unchecked((int)linearGradientMode),
+ (int)WrapMode.Tile,
+ out brush);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeBrushInternal(brush);
+ }
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.LinearGradientBrush3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Encapsulates a new instance of the <see cref='System.Drawing.Drawing2D.LinearGradientBrush'/> class with the
+ /// specified points, colors, and orientation.
+ /// </para>
+ /// </devdoc>
+ public LinearGradientBrush(Rectangle rect, Color color1, Color color2,
+ LinearGradientMode linearGradientMode)
+ {
+ //validate the LinearGradientMode enum
+ //valid values are 0x0 to 0x3
+ if (!ClientUtils.IsEnumValid(linearGradientMode, unchecked((int)linearGradientMode), (int)LinearGradientMode.Horizontal, (int)LinearGradientMode.BackwardDiagonal))
+ {
+ throw new InvalidEnumArgumentException("linearGradientMode", unchecked((int)linearGradientMode), typeof(LinearGradientMode));
+ }
+
+ //validate the rect
+ if (rect.Width == 0 || rect.Height == 0)
+ {
+ throw new ArgumentException(SR.Format(SR.GdiplusInvalidRectangle, rect.ToString()));
+ }
+
+ IntPtr brush = IntPtr.Zero;
+
+ GPRECT gpRect = new GPRECT(rect);
+ int status = SafeNativeMethods.Gdip.GdipCreateLineBrushFromRectI(ref gpRect,
+ color1.ToArgb(),
+ color2.ToArgb(),
+ unchecked((int)linearGradientMode),
+ (int)WrapMode.Tile,
+ out brush);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeBrushInternal(brush);
+ }
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.LinearGradientBrush4"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Encapsulates a new instance of the <see cref='System.Drawing.Drawing2D.LinearGradientBrush'/> class with the
+ /// specified points, colors, and orientation.
+ /// </para>
+ /// </devdoc>
+ public LinearGradientBrush(RectangleF rect, Color color1, Color color2,
+ float angle)
+ : this(rect, color1, color2, angle, false)
+ { }
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.LinearGradientBrush5"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Encapsulates a new instance of the <see cref='System.Drawing.Drawing2D.LinearGradientBrush'/> class with the
+ /// specified points, colors, and orientation.
+ /// </para>
+ /// </devdoc>
+ public LinearGradientBrush(RectangleF rect, Color color1, Color color2,
+ float angle, bool isAngleScaleable)
+ {
+ IntPtr brush = IntPtr.Zero;
+
+ //validate the rect
+ if (rect.Width == 0.0 || rect.Height == 0.0)
+ {
+ throw new ArgumentException(SR.Format(SR.GdiplusInvalidRectangle, rect.ToString()));
+ }
+
+ GPRECTF gprectf = new GPRECTF(rect);
+ int status = SafeNativeMethods.Gdip.GdipCreateLineBrushFromRectWithAngle(ref gprectf,
+ color1.ToArgb(),
+ color2.ToArgb(),
+ angle,
+ isAngleScaleable,
+ (int)WrapMode.Tile,
+ out brush);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeBrushInternal(brush);
+ }
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.LinearGradientBrush6"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Encapsulates a new instance of the <see cref='System.Drawing.Drawing2D.LinearGradientBrush'/> class with the
+ /// specified points, colors, and orientation.
+ /// </para>
+ /// </devdoc>
+ public LinearGradientBrush(Rectangle rect, Color color1, Color color2,
+ float angle)
+ : this(rect, color1, color2, angle, false)
+ {
+ }
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.LinearGradientBrush7"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Encapsulates a new instance of the <see cref='System.Drawing.Drawing2D.LinearGradientBrush'/> class with the
+ /// specified points, colors, and orientation.
+ /// </para>
+ /// </devdoc>
+ public LinearGradientBrush(Rectangle rect, Color color1, Color color2,
+ float angle, bool isAngleScaleable)
+ {
+ IntPtr brush = IntPtr.Zero;
+
+ //validate the rect
+ if (rect.Width == 0 || rect.Height == 0)
+ {
+ throw new ArgumentException(SR.Format(SR.GdiplusInvalidRectangle, rect.ToString()));
+ }
+
+ GPRECT gprect = new GPRECT(rect);
+ int status = SafeNativeMethods.Gdip.GdipCreateLineBrushFromRectWithAngleI(ref gprect,
+ color1.ToArgb(),
+ color2.ToArgb(),
+ angle,
+ isAngleScaleable,
+ (int)WrapMode.Tile,
+ out brush);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeBrushInternal(brush);
+ }
+
+ /// <devdoc>
+ /// Constructor to initialized this object to be owned by GDI+.
+ /// </devdoc>
+ internal LinearGradientBrush(IntPtr nativeBrush)
+ {
+ Debug.Assert(nativeBrush != IntPtr.Zero, "Initializing native brush with null.");
+ SetNativeBrushInternal(nativeBrush);
+ }
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.Clone"]/*' />
+ /// <devdoc>
+ /// Creates an exact copy of this <see cref='System.Drawing.Drawing2D.LinearGradientBrush'/>.
+ /// </devdoc>
+ public override object Clone()
+ {
+ IntPtr cloneBrush = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCloneBrush(new HandleRef(this, NativeBrush), out cloneBrush);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return new LinearGradientBrush(cloneBrush);
+ }
+
+ /**
+ * Get/set colors
+ */
+
+ private void _SetLinearColors(Color color1, Color color2)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetLineColors(new HandleRef(this, NativeBrush),
+ color1.ToArgb(),
+ color2.ToArgb());
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ private Color[] _GetLinearColors()
+ {
+ int[] colors =
+ new int[]
+ {
+ 0,
+ 0
+ };
+
+ int status = SafeNativeMethods.Gdip.GdipGetLineColors(new HandleRef(this, NativeBrush), colors);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ Color[] lineColor = new Color[2];
+
+ lineColor[0] = Color.FromArgb(colors[0]);
+ lineColor[1] = Color.FromArgb(colors[1]);
+
+ return lineColor;
+ }
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.LinearColors"]/*' />
+ /// <devdoc>
+ /// Gets or sets the starting and ending colors of the
+ /// gradient.
+ /// </devdoc>
+ public Color[] LinearColors
+ {
+ get { return _GetLinearColors(); }
+ set { _SetLinearColors(value[0], value[1]); }
+ }
+
+ /**
+ * Get source rectangle
+ */
+ private RectangleF _GetRectangle()
+ {
+ GPRECTF rect = new GPRECTF();
+
+ int status = SafeNativeMethods.Gdip.GdipGetLineRect(new HandleRef(this, NativeBrush), ref rect);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return rect.ToRectangleF();
+ }
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.Rectangle"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets a rectangular region that defines the
+ /// starting and ending points of the gradient.
+ /// </para>
+ /// </devdoc>
+ public RectangleF Rectangle
+ {
+ get { return _GetRectangle(); }
+ }
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.GammaCorrection"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets a value indicating whether
+ /// gamma correction is enabled for this <see cref='System.Drawing.Drawing2D.LinearGradientBrush'/>.
+ /// </para>
+ /// </devdoc>
+ public bool GammaCorrection
+ {
+ get
+ {
+ bool useGammaCorrection;
+
+ int status = SafeNativeMethods.Gdip.GdipGetLineGammaCorrection(new HandleRef(this, NativeBrush),
+ out useGammaCorrection);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return useGammaCorrection;
+ }
+ set
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetLineGammaCorrection(new HandleRef(this, NativeBrush),
+ value);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /**
+ * Get/set blend factors
+ *
+ * @notes If the blendFactors.Length = 1, then it's treated
+ * as the falloff parameter. Otherwise, it's the array
+ * of blend factors.
+ */
+
+ private Blend _GetBlend()
+ {
+ // VSWHidbey 518309 - interpolation colors and blends don't get along. Just getting
+ // the Blend when InterpolationColors was set puts the Brush into an unusable state afterwards.
+ // so to avoid that (mostly the problem of having Blend pop up in the debugger window and cause this problem)
+ // we just bail here.
+ //
+ if (_interpolationColorsWasSet)
+ {
+ return null;
+ }
+
+ Blend blend;
+
+ // Figure out the size of blend factor array
+ int retval = 0;
+ int status = SafeNativeMethods.Gdip.GdipGetLineBlendCount(new HandleRef(this, NativeBrush), out retval);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ if (retval <= 0)
+ {
+ return null;
+ }
+
+ // Allocate temporary native memory buffer
+ int count = retval;
+
+ IntPtr factors = IntPtr.Zero;
+ IntPtr positions = IntPtr.Zero;
+
+ try
+ {
+ int size = checked(4 * count);
+ factors = Marshal.AllocHGlobal(size);
+ positions = Marshal.AllocHGlobal(size);
+
+ // Retrieve horizontal blend factors
+ status = SafeNativeMethods.Gdip.GdipGetLineBlend(new HandleRef(this, NativeBrush), factors, positions, count);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ // Return the result in a managed array
+ blend = new Blend(count);
+
+ Marshal.Copy(factors, blend.Factors, 0, count);
+ Marshal.Copy(positions, blend.Positions, 0, count);
+ }
+ finally
+ {
+ if (factors != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(factors);
+ }
+ if (positions != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(positions);
+ }
+ }
+
+ return blend;
+ }
+
+ private void _SetBlend(Blend blend)
+ {
+ // Allocate temporary native memory buffer
+ // and copy input blend factors into it.
+
+ int count = blend.Factors.Length;
+
+ IntPtr factors = IntPtr.Zero;
+ IntPtr positions = IntPtr.Zero;
+
+ try
+ {
+ int size = checked(4 * count);
+ factors = Marshal.AllocHGlobal(size);
+ positions = Marshal.AllocHGlobal(size);
+
+ Marshal.Copy(blend.Factors, 0, factors, count);
+ Marshal.Copy(blend.Positions, 0, positions, count);
+
+ // Set blend factors
+
+ int status = SafeNativeMethods.Gdip.GdipSetLineBlend(new HandleRef(this, NativeBrush), new HandleRef(null, factors), new HandleRef(null, positions), count);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+ finally
+ {
+ if (factors != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(factors);
+ }
+ if (positions != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(positions);
+ }
+ }
+ }
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.Blend"]/*' />
+ /// <devdoc>
+ /// Gets or sets a <see cref='System.Drawing.Drawing2D.Blend'/> that specifies
+ /// positions and factors that define a custom falloff for the gradient.
+ /// </devdoc>
+ public Blend Blend
+ {
+ get { return _GetBlend(); }
+ set { _SetBlend(value); }
+ }
+
+ /*
+ * SigmaBlend & LinearBlend not yet implemented
+ */
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.SetSigmaBellShape"]/*' />
+ /// <devdoc>
+ /// Creates a gradient falloff based on a
+ /// bell-shaped curve.
+ /// </devdoc>
+ public void SetSigmaBellShape(float focus)
+ {
+ SetSigmaBellShape(focus, (float)1.0);
+ }
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.SetSigmaBellShape1"]/*' />
+ /// <devdoc>
+ /// Creates a gradient falloff based on a
+ /// bell-shaped curve.
+ /// </devdoc>
+ public void SetSigmaBellShape(float focus, float scale)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetLineSigmaBlend(new HandleRef(this, NativeBrush), focus, scale);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.SetBlendTriangularShape"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Creates a triangular gradient.
+ /// </para>
+ /// </devdoc>
+ public void SetBlendTriangularShape(float focus)
+ {
+ SetBlendTriangularShape(focus, (float)1.0);
+ }
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.SetBlendTriangularShape1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Creates a triangular gradient.
+ /// </para>
+ /// </devdoc>
+ public void SetBlendTriangularShape(float focus, float scale)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetLineLinearBlend(new HandleRef(this, NativeBrush), focus, scale);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /*
+ * Preset Color Blend
+ */
+
+ private ColorBlend _GetInterpolationColors()
+ {
+ ColorBlend blend;
+
+ if (!_interpolationColorsWasSet)
+ {
+ throw new ArgumentException(SR.Format(SR.InterpolationColorsCommon,
+ SR.Format(SR.InterpolationColorsColorBlendNotSet), ""));
+ }
+ // Figure out the size of blend factor array
+
+ int retval = 0;
+ int status = SafeNativeMethods.Gdip.GdipGetLinePresetBlendCount(new HandleRef(this, NativeBrush), out retval);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ // Allocate temporary native memory buffer
+
+ int count = retval;
+
+ IntPtr colors = IntPtr.Zero;
+ IntPtr positions = IntPtr.Zero;
+
+ try
+ {
+ int size = checked(4 * count);
+ colors = Marshal.AllocHGlobal(size);
+ positions = Marshal.AllocHGlobal(size);
+
+ // Retrieve horizontal blend factors
+
+ status = SafeNativeMethods.Gdip.GdipGetLinePresetBlend(new HandleRef(this, NativeBrush), colors, positions, count);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ // Return the result in a managed array
+
+ blend = new ColorBlend(count);
+
+ int[] argb = new int[count];
+ Marshal.Copy(colors, argb, 0, count);
+ Marshal.Copy(positions, blend.Positions, 0, count);
+
+ // copy ARGB values into Color array of ColorBlend
+ blend.Colors = new Color[argb.Length];
+
+ for (int i = 0; i < argb.Length; i++)
+ {
+ blend.Colors[i] = Color.FromArgb(argb[i]);
+ }
+ }
+ finally
+ {
+ if (colors != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(colors);
+ }
+ if (positions != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(positions);
+ }
+ }
+
+ return blend;
+ }
+
+ private void _SetInterpolationColors(ColorBlend blend)
+ {
+ _interpolationColorsWasSet = true;
+
+ // Validate the ColorBlend object.
+ if (blend == null)
+ {
+ throw new ArgumentException(SR.Format(SR.InterpolationColorsCommon,
+ SR.Format(SR.InterpolationColorsInvalidColorBlendObject), ""));
+ }
+ else if (blend.Colors.Length < 2)
+ {
+ throw new ArgumentException(SR.Format(SR.InterpolationColorsCommon,
+ SR.Format(SR.InterpolationColorsInvalidColorBlendObject),
+ SR.Format(SR.InterpolationColorsLength)));
+ }
+ else if (blend.Colors.Length != blend.Positions.Length)
+ {
+ throw new ArgumentException(SR.Format(SR.InterpolationColorsCommon,
+ SR.Format(SR.InterpolationColorsInvalidColorBlendObject),
+ SR.Format(SR.InterpolationColorsLengthsDiffer)));
+ }
+ else if (blend.Positions[0] != 0.0f)
+ {
+ throw new ArgumentException(SR.Format(SR.InterpolationColorsCommon,
+ SR.Format(SR.InterpolationColorsInvalidColorBlendObject),
+ SR.Format(SR.InterpolationColorsInvalidStartPosition)));
+ }
+ else if (blend.Positions[blend.Positions.Length - 1] != 1.0f)
+ {
+ throw new ArgumentException(SR.Format(SR.InterpolationColorsCommon,
+ SR.Format(SR.InterpolationColorsInvalidColorBlendObject),
+ SR.Format(SR.InterpolationColorsInvalidEndPosition)));
+ }
+
+
+ // Allocate temporary native memory buffer
+ // and copy input blend factors into it.
+
+ int count = blend.Colors.Length;
+
+ IntPtr colors = IntPtr.Zero;
+ IntPtr positions = IntPtr.Zero;
+
+ try
+ {
+ int size = checked(4 * count);
+ colors = Marshal.AllocHGlobal(size);
+ positions = Marshal.AllocHGlobal(size);
+
+ int[] argbs = new int[count];
+ for (int i = 0; i < count; i++)
+ {
+ argbs[i] = blend.Colors[i].ToArgb();
+ }
+
+ Marshal.Copy(argbs, 0, colors, count);
+ Marshal.Copy(blend.Positions, 0, positions, count);
+
+ // Set blend factors
+
+ int status = SafeNativeMethods.Gdip.GdipSetLinePresetBlend(new HandleRef(this, NativeBrush), new HandleRef(null, colors), new HandleRef(null, positions), count);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+ finally
+ {
+ if (colors != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(colors);
+ }
+ if (positions != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(positions);
+ }
+ }
+ }
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.InterpolationColors"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets a <see cref='System.Drawing.Drawing2D.ColorBlend'/> that defines a multi-color linear
+ /// gradient.
+ /// </para>
+ /// </devdoc>
+ public ColorBlend InterpolationColors
+ {
+ get { return _GetInterpolationColors(); }
+ set { _SetInterpolationColors(value); }
+ }
+
+ /**
+ * Set/get brush wrapping mode
+ */
+ private void _SetWrapMode(WrapMode wrapMode)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetLineWrapMode(new HandleRef(this, NativeBrush), unchecked((int)wrapMode));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ private WrapMode _GetWrapMode()
+ {
+ int mode = 0;
+
+ int status = SafeNativeMethods.Gdip.GdipGetLineWrapMode(new HandleRef(this, NativeBrush), out mode);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return (WrapMode)mode;
+ }
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.WrapMode"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets a <see cref='System.Drawing.Drawing2D.WrapMode'/> that indicates the wrap mode for this <see cref='System.Drawing.Drawing2D.LinearGradientBrush'/>.
+ /// </para>
+ /// </devdoc>
+ public WrapMode WrapMode
+ {
+ get
+ {
+ return _GetWrapMode();
+ }
+ set
+ {
+ //validate the WrapMode enum
+ //valid values are 0x0 to 0x4
+ if (!ClientUtils.IsEnumValid(value, unchecked((int)value), (int)WrapMode.Tile, (int)WrapMode.Clamp))
+ {
+ throw new InvalidEnumArgumentException("value", unchecked((int)value), typeof(WrapMode));
+ }
+
+ _SetWrapMode(value);
+ }
+ }
+
+ /**
+ * Set/get brush transform
+ */
+ private void _SetTransform(Matrix matrix)
+ {
+ if (matrix == null)
+ throw new ArgumentNullException("matrix");
+
+ int status = SafeNativeMethods.Gdip.GdipSetLineTransform(new HandleRef(this, NativeBrush), new HandleRef(matrix, matrix.nativeMatrix));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ private Matrix _GetTransform()
+ {
+ Matrix matrix = new Matrix();
+
+ // NOTE: new Matrix() will throw an exception if matrix == null.
+
+ int status = SafeNativeMethods.Gdip.GdipGetLineTransform(new HandleRef(this, NativeBrush), new HandleRef(matrix, matrix.nativeMatrix));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return matrix;
+ }
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.Transform"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets a <see cref='System.Drawing.Drawing2D.Matrix'/> that defines a local geometrical transform for
+ /// this <see cref='System.Drawing.Drawing2D.LinearGradientBrush'/>.
+ /// </para>
+ /// </devdoc>
+ public Matrix Transform
+ {
+ get { return _GetTransform(); }
+ set { _SetTransform(value); }
+ }
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.ResetTransform"]/*' />
+ /// <devdoc>
+ /// Resets the <see cref='System.Drawing.Drawing2D.LinearGradientBrush.Transform'/> property to identity.
+ /// </devdoc>
+ public void ResetTransform()
+ {
+ int status = SafeNativeMethods.Gdip.GdipResetLineTransform(new HandleRef(this, NativeBrush));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.MultiplyTransform"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Multiplies the <see cref='System.Drawing.Drawing2D.Matrix'/> that represents the local geometrical
+ /// transform of this <see cref='System.Drawing.Drawing2D.LinearGradientBrush'/> by the specified <see cref='System.Drawing.Drawing2D.Matrix'/> by prepending the specified <see cref='System.Drawing.Drawing2D.Matrix'/>.
+ /// </para>
+ /// </devdoc>
+ public void MultiplyTransform(Matrix matrix)
+ {
+ MultiplyTransform(matrix, MatrixOrder.Prepend);
+ }
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.MultiplyTransform1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Multiplies the <see cref='System.Drawing.Drawing2D.Matrix'/> that represents the local geometrical
+ /// transform of this <see cref='System.Drawing.Drawing2D.LinearGradientBrush'/> by the specified <see cref='System.Drawing.Drawing2D.Matrix'/> in the specified order.
+ /// </para>
+ /// </devdoc>
+ public void MultiplyTransform(Matrix matrix, MatrixOrder order)
+ {
+ if (matrix == null)
+ {
+ throw new ArgumentNullException("matrix");
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipMultiplyLineTransform(new HandleRef(this, NativeBrush),
+ new HandleRef(matrix, matrix.nativeMatrix),
+ order);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.TranslateTransform"]/*' />
+ /// <devdoc>
+ /// Translates the local geometrical transform
+ /// by the specified dimmensions. This method prepends the translation to the
+ /// transform.
+ /// </devdoc>
+ public void TranslateTransform(float dx, float dy)
+ { TranslateTransform(dx, dy, MatrixOrder.Prepend); }
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.TranslateTransform1"]/*' />
+ /// <devdoc>
+ /// Translates the local geometrical transform
+ /// by the specified dimmensions in the specified order.
+ /// </devdoc>
+ public void TranslateTransform(float dx, float dy, MatrixOrder order)
+ {
+ int status = SafeNativeMethods.Gdip.GdipTranslateLineTransform(new HandleRef(this, NativeBrush),
+ dx,
+ dy,
+ order);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.ScaleTransform"]/*' />
+ /// <devdoc>
+ /// Scales the local geometric transform by the
+ /// specified amounts. This method prepends the scaling matrix to the transform.
+ /// </devdoc>
+ public void ScaleTransform(float sx, float sy)
+ { ScaleTransform(sx, sy, MatrixOrder.Prepend); }
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.ScaleTransform1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Scales the local geometric transform by the
+ /// specified amounts in the specified order.
+ /// </para>
+ /// </devdoc>
+ public void ScaleTransform(float sx, float sy, MatrixOrder order)
+ {
+ int status = SafeNativeMethods.Gdip.GdipScaleLineTransform(new HandleRef(this, NativeBrush),
+ sx,
+ sy,
+ order);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.RotateTransform"]/*' />
+ /// <devdoc>
+ /// Rotates the local geometric transform by the
+ /// specified amount. This method prepends the rotation to the transform.
+ /// </devdoc>
+ public void RotateTransform(float angle)
+ { RotateTransform(angle, MatrixOrder.Prepend); }
+
+ /// <include file='doc\LinearGradientBrush.uex' path='docs/doc[@for="LinearGradientBrush.RotateTransform1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Rotates the local geometric transform by the specified
+ /// amount in the specified order.
+ /// </para>
+ /// </devdoc>
+ public void RotateTransform(float angle, MatrixOrder order)
+ {
+ int status = SafeNativeMethods.Gdip.GdipRotateLineTransform(new HandleRef(this, NativeBrush),
+ angle,
+ order);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/LinearGradientMode.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/LinearGradientMode.cs
new file mode 100644
index 0000000000..b3463987cb
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/LinearGradientMode.cs
@@ -0,0 +1,44 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /**
+ * Linear Gradient mode constants
+ */
+ /// <include file='doc\LinearGradientMode.uex' path='docs/doc[@for="LinearGradientMode"]/*' />
+ /// <devdoc>
+ /// Specifies the direction of a linear
+ /// gradient.
+ /// </devdoc>
+ public enum LinearGradientMode
+ {
+ /// <include file='doc\LinearGradientMode.uex' path='docs/doc[@for="LinearGradientMode.Horizontal"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies a gradient from left to right.
+ /// </para>
+ /// </devdoc>
+ Horizontal = 0,
+ /// <include file='doc\LinearGradientMode.uex' path='docs/doc[@for="LinearGradientMode.Vertical"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies a gradient from top to bottom.
+ /// </para>
+ /// </devdoc>
+ Vertical = 1,
+ /// <include file='doc\LinearGradientMode.uex' path='docs/doc[@for="LinearGradientMode.ForwardDiagonal"]/*' />
+ /// <devdoc>
+ /// Specifies a gradient from upper-left to
+ /// lower-right.
+ /// </devdoc>
+ ForwardDiagonal = 2,
+ /// <include file='doc\LinearGradientMode.uex' path='docs/doc[@for="LinearGradientMode.BackwardDiagonal"]/*' />
+ /// <devdoc>
+ /// Specifies a gradient from upper-right to
+ /// lower-left.
+ /// </devdoc>
+ BackwardDiagonal = 3
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/METAHEADER.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/METAHEADER.cs
new file mode 100644
index 0000000000..a8e3092e8d
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/METAHEADER.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ using System.Runtime.InteropServices;
+
+ /// <include file='doc\METAHEADER.uex' path='docs/doc[@for="MetaHeader"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ [StructLayout(LayoutKind.Sequential, Pack = 2)]
+ public sealed class MetaHeader
+ {
+ /// The ENHMETAHEADER structure is defined natively as a union with WmfHeader.
+ /// Extreme care should be taken if changing the layout of the corresponding managaed
+ /// structures to minimize the risk of buffer overruns. The affected managed classes
+ /// are the following: ENHMETAHEADER, MetaHeader, MetafileHeaderWmf, MetafileHeaderEmf.
+ private short _type;
+ private short _headerSize;
+ private short _version;
+ private int _size;
+ private short _noObjects;
+ private int _maxRecord;
+ private short _noParameters;
+
+ /// <include file='doc\METAHEADER.uex' path='docs/doc[@for="MetaHeader.Type"]/*' />
+ /// <devdoc>
+ /// Represents the type of the associated
+ /// <see cref='System.Drawing.Imaging.Metafile'/>.
+ /// </devdoc>
+ public short Type
+ {
+ get { return _type; }
+ set { _type = value; }
+ }
+ /// <include file='doc\METAHEADER.uex' path='docs/doc[@for="MetaHeader.HeaderSize"]/*' />
+ /// <devdoc>
+ /// Represents the sizi, in bytes, of the
+ /// header file.
+ /// </devdoc>
+ public short HeaderSize
+ {
+ get { return _headerSize; }
+ set { _headerSize = value; }
+ }
+ /// <include file='doc\METAHEADER.uex' path='docs/doc[@for="MetaHeader.Version"]/*' />
+ /// <devdoc>
+ /// Represents the version number of the header
+ /// format.
+ /// </devdoc>
+ public short Version
+ {
+ get { return _version; }
+ set { _version = value; }
+ }
+ /// <include file='doc\METAHEADER.uex' path='docs/doc[@for="MetaHeader.Size"]/*' />
+ /// <devdoc>
+ /// Represents the sizi, in bytes, of the
+ /// associated <see cref='System.Drawing.Imaging.Metafile'/>.
+ /// </devdoc>
+ public int Size
+ {
+ get { return _size; }
+ set { _size = value; }
+ }
+ /// <include file='doc\METAHEADER.uex' path='docs/doc[@for="MetaHeader.NoObjects"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public short NoObjects
+ {
+ get { return _noObjects; }
+ set { _noObjects = value; }
+ }
+ /// <include file='doc\METAHEADER.uex' path='docs/doc[@for="MetaHeader.MaxRecord"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public int MaxRecord
+ {
+ get { return _maxRecord; }
+ set { _maxRecord = value; }
+ }
+ /// <include file='doc\METAHEADER.uex' path='docs/doc[@for="MetaHeader.NoParameters"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public short NoParameters
+ {
+ get { return _noParameters; }
+ set { _noParameters = value; }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/Matrix.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/Matrix.cs
new file mode 100644
index 0000000000..7112769b2b
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/Matrix.cs
@@ -0,0 +1,706 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ using System.Runtime.InteropServices;
+ using System.Drawing.Internal;
+
+ /**
+ * Represent a Matrix object
+ */
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix"]/*' />
+ /// <devdoc>
+ /// Encapsulates a 3 X 3 affine matrix that
+ /// represents a geometric transform.
+ /// </devdoc>
+ public sealed class Matrix : MarshalByRefObject, IDisposable
+ {
+ internal IntPtr nativeMatrix;
+
+ /*
+ * Create a new identity matrix
+ */
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.Matrix"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.Matrix'/> class.
+ /// </devdoc>
+ public Matrix()
+ {
+ IntPtr matrix = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateMatrix(out matrix);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ nativeMatrix = matrix;
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.Matrix1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initialized a new instance of the <see cref='System.Drawing.Drawing2D.Matrix'/> class with the specified
+ /// elements.
+ /// </para>
+ /// </devdoc>
+ public Matrix(float m11,
+ float m12,
+ float m21,
+ float m22,
+ float dx,
+ float dy)
+ {
+ IntPtr matrix = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateMatrix2(m11, m12, m21, m22, dx, dy,
+ out matrix);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ nativeMatrix = matrix;
+ }
+
+ // float version
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.Matrix2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.Matrix'/> class to the geometrical transform
+ /// defined by the specified rectangle and array of points.
+ /// </para>
+ /// </devdoc>
+ public Matrix(RectangleF rect, PointF[] plgpts)
+ {
+ if (plgpts == null)
+ {
+ throw new ArgumentNullException("plgpts");
+ }
+ if (plgpts.Length != 3)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter);
+ }
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(plgpts);
+
+ try
+ {
+ IntPtr matrix = IntPtr.Zero;
+
+ GPRECTF gprectf = new GPRECTF(rect);
+ int status = SafeNativeMethods.Gdip.GdipCreateMatrix3(ref gprectf, new HandleRef(null, buf), out matrix);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ nativeMatrix = matrix;
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ // int version
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.Matrix3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.Matrix'/> class to the geometrical transform
+ /// defined by the specified rectangle and array of points.
+ /// </para>
+ /// </devdoc>
+ public Matrix(Rectangle rect, Point[] plgpts)
+ {
+ if (plgpts == null)
+ {
+ throw new ArgumentNullException("plgpts");
+ }
+ if (plgpts.Length != 3)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter);
+ }
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(plgpts);
+
+ try
+ {
+ IntPtr matrix = IntPtr.Zero;
+
+ GPRECT gprect = new GPRECT(rect);
+ int status = SafeNativeMethods.Gdip.GdipCreateMatrix3I(ref gprect, new HandleRef(null, buf), out matrix);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ nativeMatrix = matrix;
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.Dispose"]/*' />
+ /// <devdoc>
+ /// Cleans up resources allocated for this
+ /// <see cref='System.Drawing.Drawing2D.Matrix'/>.
+ /// </devdoc>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ private void Dispose(bool disposing)
+ {
+ if (nativeMatrix != IntPtr.Zero)
+ {
+ SafeNativeMethods.Gdip.GdipDeleteMatrix(new HandleRef(this, nativeMatrix));
+ nativeMatrix = IntPtr.Zero;
+ }
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.Finalize"]/*' />
+ /// <devdoc>
+ /// Cleans up resources allocated for this
+ /// <see cref='System.Drawing.Drawing2D.Matrix'/>.
+ /// </devdoc>
+ ~Matrix()
+ {
+ Dispose(false);
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.Clone"]/*' />
+ /// <devdoc>
+ /// Creates an exact copy of this <see cref='System.Drawing.Drawing2D.Matrix'/>.
+ /// </devdoc>
+ public Matrix Clone()
+ {
+ IntPtr cloneMatrix = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCloneMatrix(new HandleRef(this, nativeMatrix), out cloneMatrix);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return new Matrix(cloneMatrix);
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.Elements"]/*' />
+ /// <devdoc>
+ /// Gets an array of floating-point values that
+ /// represent the elements of this <see cref='System.Drawing.Drawing2D.Matrix'/>.
+ /// </devdoc>
+ public float[] Elements
+ {
+ get
+ {
+ float[] m;
+
+ IntPtr buf = Marshal.AllocHGlobal(6 * 8); // 6 elements x 8 bytes (float)
+
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipGetMatrixElements(new HandleRef(this, nativeMatrix), buf);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ m = new float[6];
+
+ Marshal.Copy(buf, m, 0, 6);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+
+ return m;
+ }
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.OffsetX"]/*' />
+ /// <devdoc>
+ /// Gets the x translation value (the dx value,
+ /// or the element in the third row and first column) of this <see cref='System.Drawing.Drawing2D.Matrix'/>.
+ /// </devdoc>
+ public float OffsetX
+ {
+ get { return Elements[4]; }
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.OffsetY"]/*' />
+ /// <devdoc>
+ /// Gets the y translation value (the dy
+ /// value, or the element in the third row and second column) of this <see cref='System.Drawing.Drawing2D.Matrix'/>.
+ /// </devdoc>
+ public float OffsetY
+ {
+ get { return Elements[5]; }
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.Reset"]/*' />
+ /// <devdoc>
+ /// Resets this <see cref='System.Drawing.Drawing2D.Matrix'/> to identity.
+ /// </devdoc>
+ public void Reset()
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetMatrixElements(new HandleRef(this, nativeMatrix),
+ 1.0f, 0.0f, 0.0f,
+ 1.0f, 0.0f, 0.0f);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.Multiply"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Multiplies this <see cref='System.Drawing.Drawing2D.Matrix'/> by the specified <see cref='System.Drawing.Drawing2D.Matrix'/> by prepending the specified <see cref='System.Drawing.Drawing2D.Matrix'/>.
+ /// </para>
+ /// </devdoc>
+ public void Multiply(Matrix matrix)
+ {
+ Multiply(matrix, MatrixOrder.Prepend);
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.Multiply1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Multiplies this <see cref='System.Drawing.Drawing2D.Matrix'/> by the specified <see cref='System.Drawing.Drawing2D.Matrix'/> in the specified order.
+ /// </para>
+ /// </devdoc>
+ public void Multiply(Matrix matrix, MatrixOrder order)
+ {
+ if (matrix == null)
+ {
+ throw new ArgumentNullException("matrix");
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipMultiplyMatrix(new HandleRef(this, nativeMatrix), new HandleRef(matrix, matrix.nativeMatrix),
+ order);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.Translate"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Applies the specified translation vector to
+ /// the this <see cref='System.Drawing.Drawing2D.Matrix'/> by
+ /// prepending the translation vector.
+ /// </para>
+ /// </devdoc>
+ public void Translate(float offsetX, float offsetY)
+ {
+ Translate(offsetX, offsetY, MatrixOrder.Prepend);
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.Translate1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Applies the specified translation vector to
+ /// the this <see cref='System.Drawing.Drawing2D.Matrix'/> in the specified order.
+ /// </para>
+ /// </devdoc>
+ public void Translate(float offsetX, float offsetY, MatrixOrder order)
+ {
+ int status = SafeNativeMethods.Gdip.GdipTranslateMatrix(new HandleRef(this, nativeMatrix),
+ offsetX, offsetY, order);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.Scale"]/*' />
+ /// <devdoc>
+ /// Applies the specified scale vector to this
+ /// <see cref='System.Drawing.Drawing2D.Matrix'/> by prepending the scale vector.
+ /// </devdoc>
+ public void Scale(float scaleX, float scaleY)
+ {
+ Scale(scaleX, scaleY, MatrixOrder.Prepend);
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.Scale1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Applies the specified scale vector to this
+ /// <see cref='System.Drawing.Drawing2D.Matrix'/> using the specified order.
+ /// </para>
+ /// </devdoc>
+ public void Scale(float scaleX, float scaleY, MatrixOrder order)
+ {
+ int status = SafeNativeMethods.Gdip.GdipScaleMatrix(new HandleRef(this, nativeMatrix), scaleX, scaleY, order);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.Rotate"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Rotates this <see cref='System.Drawing.Drawing2D.Matrix'/> clockwise about the
+ /// origin by the specified angle.
+ /// </para>
+ /// </devdoc>
+ public void Rotate(float angle)
+ {
+ Rotate(angle, MatrixOrder.Prepend);
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.Rotate1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Rotates this <see cref='System.Drawing.Drawing2D.Matrix'/> clockwise about the
+ /// origin by the specified
+ /// angle in the specified order.
+ /// </para>
+ /// </devdoc>
+ public void Rotate(float angle, MatrixOrder order)
+ {
+ int status = SafeNativeMethods.Gdip.GdipRotateMatrix(new HandleRef(this, nativeMatrix), angle, order);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.RotateAt"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Applies a clockwise rotation about the
+ /// specified point to this <see cref='System.Drawing.Drawing2D.Matrix'/> by prepending the rotation.
+ /// </para>
+ /// </devdoc>
+ public void RotateAt(float angle, PointF point)
+ {
+ RotateAt(angle, point, MatrixOrder.Prepend);
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.RotateAt1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Applies a clockwise rotation about the specified point
+ /// to this <see cref='System.Drawing.Drawing2D.Matrix'/> in the
+ /// specified order.
+ /// </para>
+ /// </devdoc>
+ public void RotateAt(float angle, PointF point, MatrixOrder order)
+ {
+ int status;
+
+ // !! TO DO: We cheat with error codes here...
+ if (order == MatrixOrder.Prepend)
+ {
+ status = SafeNativeMethods.Gdip.GdipTranslateMatrix(new HandleRef(this, nativeMatrix), point.X, point.Y, order);
+ status |= SafeNativeMethods.Gdip.GdipRotateMatrix(new HandleRef(this, nativeMatrix), angle, order);
+ status |= SafeNativeMethods.Gdip.GdipTranslateMatrix(new HandleRef(this, nativeMatrix), -point.X, -point.Y, order);
+ }
+ else
+ {
+ status = SafeNativeMethods.Gdip.GdipTranslateMatrix(new HandleRef(this, nativeMatrix), -point.X, -point.Y, order);
+ status |= SafeNativeMethods.Gdip.GdipRotateMatrix(new HandleRef(this, nativeMatrix), angle, order);
+ status |= SafeNativeMethods.Gdip.GdipTranslateMatrix(new HandleRef(this, nativeMatrix), point.X, point.Y, order);
+ }
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.Shear"]/*' />
+ /// <devdoc>
+ /// Applies the specified shear
+ /// vector to this <see cref='System.Drawing.Drawing2D.Matrix'/> by prepending the shear vector.
+ /// </devdoc>
+ public void Shear(float shearX, float shearY)
+ {
+ int status = SafeNativeMethods.Gdip.GdipShearMatrix(new HandleRef(this, nativeMatrix), shearX, shearY, MatrixOrder.Prepend);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.Shear1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Applies the specified shear
+ /// vector to this <see cref='System.Drawing.Drawing2D.Matrix'/> in the specified order.
+ /// </para>
+ /// </devdoc>
+ public void Shear(float shearX, float shearY, MatrixOrder order)
+ {
+ int status = SafeNativeMethods.Gdip.GdipShearMatrix(new HandleRef(this, nativeMatrix), shearX, shearY, order);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.Invert"]/*' />
+ /// <devdoc>
+ /// Inverts this <see cref='System.Drawing.Drawing2D.Matrix'/>, if it is
+ /// invertible.
+ /// </devdoc>
+ public void Invert()
+ {
+ int status = SafeNativeMethods.Gdip.GdipInvertMatrix(new HandleRef(this, nativeMatrix));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ // float version
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.TransformPoints"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Applies the geometrical transform this <see cref='System.Drawing.Drawing2D.Matrix'/>represents to an
+ /// array of points.
+ /// </para>
+ /// </devdoc>
+ public void TransformPoints(PointF[] pts)
+ {
+ if (pts == null)
+ throw new ArgumentNullException("pts");
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(pts);
+
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipTransformMatrixPoints(new HandleRef(this, nativeMatrix),
+ new HandleRef(null, buf),
+ pts.Length);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ PointF[] newPts = SafeNativeMethods.Gdip.ConvertGPPOINTFArrayF(buf, pts.Length);
+
+ for (int i = 0; i < pts.Length; i++)
+ {
+ pts[i] = newPts[i];
+ }
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ // int version
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.TransformPoints1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Applies the geometrical transform this <see cref='System.Drawing.Drawing2D.Matrix'/> represents to an array of points.
+ /// </para>
+ /// </devdoc>
+ public void TransformPoints(Point[] pts)
+ {
+ if (pts == null)
+ throw new ArgumentNullException("pts");
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(pts);
+
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipTransformMatrixPointsI(new HandleRef(this, nativeMatrix),
+ new HandleRef(null, buf),
+ pts.Length);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ // must do an in-place copy because we only have a reference
+ Point[] newPts = SafeNativeMethods.Gdip.ConvertGPPOINTArray(buf, pts.Length);
+
+ for (int i = 0; i < pts.Length; i++)
+ {
+ pts[i] = newPts[i];
+ }
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.TransformVectors"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void TransformVectors(PointF[] pts)
+ {
+ if (pts == null)
+ {
+ throw new ArgumentNullException("pts");
+ }
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(pts);
+
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipVectorTransformMatrixPoints(new HandleRef(this, nativeMatrix),
+ new HandleRef(null, buf),
+ pts.Length);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ // must do an in-place copy because we only have a reference
+ PointF[] newPts = SafeNativeMethods.Gdip.ConvertGPPOINTFArrayF(buf, pts.Length);
+
+ for (int i = 0; i < pts.Length; i++)
+ {
+ pts[i] = newPts[i];
+ }
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ // int version
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.VectorTransformPoints"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void VectorTransformPoints(Point[] pts)
+ {
+ TransformVectors(pts);
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.TransformVectors1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void TransformVectors(Point[] pts)
+ {
+ if (pts == null)
+ {
+ throw new ArgumentNullException("pts");
+ }
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(pts);
+
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipVectorTransformMatrixPointsI(new HandleRef(this, nativeMatrix),
+ new HandleRef(null, buf),
+ pts.Length);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ // must do an in-place copy because we only have a reference
+ Point[] newPts = SafeNativeMethods.Gdip.ConvertGPPOINTArray(buf, pts.Length);
+
+ for (int i = 0; i < pts.Length; i++)
+ {
+ pts[i] = newPts[i];
+ }
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.IsInvertible"]/*' />
+ /// <devdoc>
+ /// Gets a value indicating whether this
+ /// <see cref='System.Drawing.Drawing2D.Matrix'/> is invertible.
+ /// </devdoc>
+ public bool IsInvertible
+ {
+ get
+ {
+ int isInvertible;
+
+ int status = SafeNativeMethods.Gdip.GdipIsMatrixInvertible(new HandleRef(this, nativeMatrix), out isInvertible);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return isInvertible != 0;
+ }
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.IsIdentity"]/*' />
+ /// <devdoc>
+ /// Gets a value indicating whether this <see cref='System.Drawing.Drawing2D.Matrix'/> is the identity matrix.
+ /// </devdoc>
+ public bool IsIdentity
+ {
+ get
+ {
+ int isIdentity;
+
+ int status = SafeNativeMethods.Gdip.GdipIsMatrixIdentity(new HandleRef(this, nativeMatrix), out isIdentity);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return isIdentity != 0;
+ }
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.Equals"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Tests whether the specified object is a
+ /// <see cref='System.Drawing.Drawing2D.Matrix'/> and is identical to this <see cref='System.Drawing.Drawing2D.Matrix'/>.
+ /// </para>
+ /// </devdoc>
+ public override bool Equals(object obj)
+ {
+ Matrix matrix2 = obj as Matrix;
+ if (matrix2 == null) return false;
+
+ int isEqual;
+
+ int status = SafeNativeMethods.Gdip.GdipIsMatrixEqual(new HandleRef(this, nativeMatrix),
+ new HandleRef(matrix2, matrix2.nativeMatrix),
+ out isEqual);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return isEqual != 0;
+ }
+
+ /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.GetHashCode"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Returns a hash code.
+ /// </para>
+ /// </devdoc>
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+
+ internal Matrix(IntPtr nativeMatrix)
+ {
+ SetNativeMatrix(nativeMatrix);
+ }
+
+ internal void SetNativeMatrix(IntPtr nativeMatrix)
+ {
+ this.nativeMatrix = nativeMatrix;
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/MatrixOrder.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/MatrixOrder.cs
new file mode 100644
index 0000000000..672181cb8f
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/MatrixOrder.cs
@@ -0,0 +1,33 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /**
+ * Various wrap modes for brushes
+ */
+ /// <include file='doc\MatrixOrder.uex' path='docs/doc[@for="MatrixOrder"]/*' />
+ /// <devdoc>
+ /// Specifies the order for matrix transform
+ /// operations.
+ /// </devdoc>
+ public enum MatrixOrder
+ {
+ /// <include file='doc\MatrixOrder.uex' path='docs/doc[@for="MatrixOrder.Prepend"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// The new operation is applied before the old
+ /// operation.
+ /// </para>
+ /// </devdoc>
+ Prepend = 0,
+ /// <include file='doc\MatrixOrder.uex' path='docs/doc[@for="MatrixOrder.Append"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// The new operation is applied after the old operation.
+ /// </para>
+ /// </devdoc>
+ Append = 1
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/Metafile.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/Metafile.cs
new file mode 100644
index 0000000000..cf9fba5424
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/Metafile.cs
@@ -0,0 +1,920 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ using System.Runtime.InteropServices;
+ using System.IO;
+ using System.Drawing.Internal;
+ using System.Runtime.Serialization;
+
+ /**
+ * Represent a metafile image
+ */
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile"]/*' />
+ /// <devdoc>
+ /// Defines a graphic metafile. A metafile
+ /// contains records that describe a sequence of graphics operations that can be
+ /// recorded and played back.
+ /// </devdoc>
+ [Serializable]
+ public sealed class Metafile : Image
+ {
+ /*
+ * Create a new metafile object from a metafile handle (WMF)
+ */
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class from the specified handle and
+ /// <see cref='System.Drawing.Imaging.WmfPlaceableFileHeader'/>.
+ /// </para>
+ /// </devdoc>
+ public Metafile(IntPtr hmetafile, WmfPlaceableFileHeader wmfHeader) :
+ this(hmetafile, wmfHeader, false)
+ { }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class from the specified handle and
+ /// <see cref='System.Drawing.Imaging.WmfPlaceableFileHeader'/>.
+ /// </para>
+ /// </devdoc>
+ public Metafile(IntPtr hmetafile, WmfPlaceableFileHeader wmfHeader, bool deleteWmf)
+ {
+ IntPtr metafile = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateMetafileFromWmf(new HandleRef(null, hmetafile), deleteWmf, wmfHeader, out metafile);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeImage(metafile);
+ }
+
+ /*
+ * Create a new metafile object from an enhanced metafile handle
+ */
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class from the
+ /// specified handle and <see cref='System.Drawing.Imaging.WmfPlaceableFileHeader'/>.
+ /// </para>
+ /// </devdoc>
+ public Metafile(IntPtr henhmetafile, bool deleteEmf)
+ {
+ IntPtr metafile = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateMetafileFromEmf(new HandleRef(null, henhmetafile), deleteEmf, out metafile);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeImage(metafile);
+ }
+
+ /**
+ * Create a new metafile object from a file
+ */
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile3"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class from the specified filename.
+ /// </devdoc>
+ public Metafile(string filename)
+ {
+ IntPtr metafile = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateMetafileFromFile(filename, out metafile);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeImage(metafile);
+ }
+
+ /**
+ * Create a new metafile object from a stream
+ */
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile4"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class from the specified stream.
+ /// </devdoc>
+ public Metafile(Stream stream)
+ {
+ if (stream == null)
+ throw new ArgumentException(SR.Format(SR.InvalidArgument, "stream", "null"));
+
+ IntPtr metafile = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateMetafileFromStream(new GPStream(stream), out metafile);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeImage(metafile);
+ }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile5"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class from the specified handle to a
+ /// device context.
+ /// </devdoc>
+ public Metafile(IntPtr referenceHdc, EmfType emfType) :
+ this(referenceHdc, emfType, null)
+ { }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile6"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class from the
+ /// specified handle to a device context.
+ /// </para>
+ /// </devdoc>
+ public Metafile(IntPtr referenceHdc, EmfType emfType, String description)
+ {
+ IntPtr metafile = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipRecordMetafile(new HandleRef(null, referenceHdc),
+ unchecked((int)emfType),
+ NativeMethods.NullHandleRef,
+ unchecked((int)MetafileFrameUnit.GdiCompatible),
+ description,
+ out metafile);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeImage(metafile);
+ }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile7"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class from the specified device context,
+ /// bounded by the specified rectangle.
+ /// </para>
+ /// </devdoc>
+ public Metafile(IntPtr referenceHdc, RectangleF frameRect) :
+ this(referenceHdc, frameRect, MetafileFrameUnit.GdiCompatible)
+ { }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile8"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class from the specified device context,
+ /// bounded by the specified rectangle.
+ /// </para>
+ /// </devdoc>
+ public Metafile(IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit) :
+ this(referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual)
+ { }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile9"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class from the
+ /// specified device context, bounded by the specified rectangle.
+ /// </para>
+ /// </devdoc>
+ public Metafile(IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type) :
+ this(referenceHdc, frameRect, frameUnit, type, null)
+ { }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile10"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class from the specified device context,
+ /// bounded by the specified rectangle.
+ /// </para>
+ /// </devdoc>
+ public Metafile(IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type, String description)
+ {
+ IntPtr metafile = IntPtr.Zero;
+
+ GPRECTF rectf = new GPRECTF(frameRect);
+ int status = SafeNativeMethods.Gdip.GdipRecordMetafile(new HandleRef(null, referenceHdc),
+ unchecked((int)type),
+ ref rectf,
+ unchecked((int)frameUnit),
+ description, out metafile);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeImage(metafile);
+ }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile11"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class from the
+ /// specified device context, bounded by the specified rectangle.
+ /// </para>
+ /// </devdoc>
+ public Metafile(IntPtr referenceHdc, Rectangle frameRect) :
+ this(referenceHdc, frameRect, MetafileFrameUnit.GdiCompatible)
+ { }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile12"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class from the
+ /// specified device context, bounded by the specified rectangle.
+ /// </para>
+ /// </devdoc>
+ public Metafile(IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit) :
+ this(referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual)
+ { }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile13"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class from the
+ /// specified device context, bounded by the specified rectangle.
+ /// </para>
+ /// </devdoc>
+ public Metafile(IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type) :
+ this(referenceHdc, frameRect, frameUnit, type, null)
+ { }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile14"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class from the
+ /// specified device context, bounded by the specified rectangle.
+ /// </para>
+ /// </devdoc>
+ public Metafile(IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, string desc)
+ {
+ IntPtr metafile = IntPtr.Zero;
+
+ int status;
+
+ if (frameRect.IsEmpty)
+ {
+ status = SafeNativeMethods.Gdip.GdipRecordMetafile(new HandleRef(null, referenceHdc),
+ unchecked((int)type),
+ NativeMethods.NullHandleRef,
+ unchecked((int)MetafileFrameUnit.GdiCompatible),
+ desc,
+ out metafile);
+ }
+ else
+ {
+ GPRECT gprect = new GPRECT(frameRect);
+ status = SafeNativeMethods.Gdip.GdipRecordMetafileI(new HandleRef(null, referenceHdc),
+ unchecked((int)type),
+ ref gprect,
+ unchecked((int)frameUnit),
+ desc,
+ out metafile);
+ }
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeImage(metafile);
+ }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile15"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class with the specified
+ /// filename.
+ /// </devdoc>
+ public Metafile(string fileName, IntPtr referenceHdc) :
+ this(fileName, referenceHdc, EmfType.EmfPlusDual, null)
+ { }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile16"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class with the specified
+ /// filename.
+ /// </para>
+ /// </devdoc>
+ public Metafile(string fileName, IntPtr referenceHdc, EmfType type) :
+ this(fileName, referenceHdc, type, null)
+ { }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile17"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class with the specified filename.
+ /// </para>
+ /// </devdoc>
+ public Metafile(string fileName, IntPtr referenceHdc, EmfType type, String description)
+ {
+ IntPtr metafile = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipRecordMetafileFileName(fileName, new HandleRef(null, referenceHdc),
+ unchecked((int)type),
+ NativeMethods.NullHandleRef,
+ unchecked((int)MetafileFrameUnit.GdiCompatible),
+ description,
+ out metafile);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeImage(metafile);
+ }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile18"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class with the specified filename.
+ /// </para>
+ /// </devdoc>
+ public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect) :
+ this(fileName, referenceHdc, frameRect, MetafileFrameUnit.GdiCompatible)
+ { }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile19"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class with the specified filename.
+ /// </para>
+ /// </devdoc>
+ public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect,
+ MetafileFrameUnit frameUnit) :
+ this(fileName, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual)
+ { }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile20"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class with the specified filename.
+ /// </para>
+ /// </devdoc>
+ public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect,
+ MetafileFrameUnit frameUnit, EmfType type) :
+ this(fileName, referenceHdc, frameRect, frameUnit, type, null)
+ { }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile21"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class with the
+ /// specified filename.
+ /// </para>
+ /// </devdoc>
+ public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, string desc) :
+ this(fileName, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual, desc)
+ { }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile22"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class with the
+ /// specified filename.
+ /// </para>
+ /// </devdoc>
+ public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect,
+ MetafileFrameUnit frameUnit, EmfType type, String description)
+ {
+ IntPtr metafile = IntPtr.Zero;
+
+ GPRECTF rectf = new GPRECTF(frameRect);
+ int status = SafeNativeMethods.Gdip.GdipRecordMetafileFileName(fileName,
+ new HandleRef(null, referenceHdc),
+ unchecked((int)type),
+ ref rectf,
+ unchecked((int)frameUnit),
+ description,
+ out metafile);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeImage(metafile);
+ }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile23"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class with the
+ /// specified filename.
+ /// </para>
+ /// </devdoc>
+ public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect) :
+ this(fileName, referenceHdc, frameRect, MetafileFrameUnit.GdiCompatible)
+ { }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile24"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class with the
+ /// specified filename.
+ /// </para>
+ /// </devdoc>
+ public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect,
+ MetafileFrameUnit frameUnit) :
+ this(fileName, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual)
+ { }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile25"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class with the
+ /// specified filename.
+ /// </para>
+ /// </devdoc>
+ public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect,
+ MetafileFrameUnit frameUnit, EmfType type) :
+ this(fileName, referenceHdc, frameRect, frameUnit, type, null)
+ { }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile26"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class with the
+ /// specified filename.
+ /// </para>
+ /// </devdoc>
+ public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, string description) :
+ this(fileName, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual, description)
+ { }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile27"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class with the
+ /// specified filename.
+ /// </para>
+ /// </devdoc>
+ public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, string description)
+ {
+ IntPtr metafile = IntPtr.Zero;
+
+ int status;
+
+ if (frameRect.IsEmpty)
+ {
+ status = SafeNativeMethods.Gdip.GdipRecordMetafileFileName(fileName,
+ new HandleRef(null, referenceHdc),
+ unchecked((int)type),
+ NativeMethods.NullHandleRef,
+ unchecked((int)frameUnit),
+ description,
+ out metafile);
+ }
+ else
+ {
+ GPRECT gprect = new GPRECT(frameRect);
+ status = SafeNativeMethods.Gdip.GdipRecordMetafileFileNameI(fileName,
+ new HandleRef(null, referenceHdc),
+ unchecked((int)type),
+ ref gprect,
+ unchecked((int)frameUnit),
+ description,
+ out metafile);
+ }
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeImage(metafile);
+ }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile28"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class from the specified data
+ /// stream.
+ /// </para>
+ /// </devdoc>
+ public Metafile(Stream stream, IntPtr referenceHdc) :
+ this(stream, referenceHdc, EmfType.EmfPlusDual, null)
+ { }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile29"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class from the specified data
+ /// stream.
+ /// </para>
+ /// </devdoc>
+ public Metafile(Stream stream, IntPtr referenceHdc, EmfType type) :
+ this(stream, referenceHdc, type, null)
+ { }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile30"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class from the specified data stream.
+ /// </para>
+ /// </devdoc>
+ public Metafile(Stream stream, IntPtr referenceHdc, EmfType type, string description)
+ {
+ IntPtr metafile = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipRecordMetafileStream(new GPStream(stream),
+ new HandleRef(null, referenceHdc),
+ unchecked((int)type),
+ NativeMethods.NullHandleRef,
+ unchecked((int)MetafileFrameUnit.GdiCompatible),
+ description,
+ out metafile);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeImage(metafile);
+ }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile31"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class from the specified data stream.
+ /// </para>
+ /// </devdoc>
+ public Metafile(Stream stream, IntPtr referenceHdc, RectangleF frameRect) :
+ this(stream, referenceHdc, frameRect, MetafileFrameUnit.GdiCompatible)
+ { }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile32"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class with the
+ /// specified filename.
+ /// </para>
+ /// </devdoc>
+ public Metafile(Stream stream, IntPtr referenceHdc, RectangleF frameRect,
+ MetafileFrameUnit frameUnit) :
+ this(stream, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual)
+ { }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile33"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class with the
+ /// specified filename.
+ /// </para>
+ /// </devdoc>
+ public Metafile(Stream stream, IntPtr referenceHdc, RectangleF frameRect,
+ MetafileFrameUnit frameUnit, EmfType type) :
+ this(stream, referenceHdc, frameRect, frameUnit, type, null)
+ { }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile34"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class with the
+ /// specified filename.
+ /// </para>
+ /// </devdoc>
+ public Metafile(Stream stream, IntPtr referenceHdc, RectangleF frameRect,
+ MetafileFrameUnit frameUnit, EmfType type, string description)
+ {
+ IntPtr metafile = IntPtr.Zero;
+
+ GPRECTF rectf = new GPRECTF(frameRect);
+ int status = SafeNativeMethods.Gdip.GdipRecordMetafileStream(new GPStream(stream),
+ new HandleRef(null, referenceHdc),
+ unchecked((int)type),
+ ref rectf,
+ unchecked((int)frameUnit),
+ description,
+ out metafile);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeImage(metafile);
+ }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile35"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class from the
+ /// specified data stream.
+ /// </para>
+ /// </devdoc>
+ public Metafile(Stream stream, IntPtr referenceHdc, Rectangle frameRect) :
+ this(stream, referenceHdc, frameRect, MetafileFrameUnit.GdiCompatible)
+ { }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile36"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class with the
+ /// specified filename.
+ /// </para>
+ /// </devdoc>
+ public Metafile(Stream stream, IntPtr referenceHdc, Rectangle frameRect,
+ MetafileFrameUnit frameUnit) :
+ this(stream, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual)
+ { }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile37"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class with the
+ /// specified filename.
+ /// </para>
+ /// </devdoc>
+ public Metafile(Stream stream, IntPtr referenceHdc, Rectangle frameRect,
+ MetafileFrameUnit frameUnit, EmfType type) :
+ this(stream, referenceHdc, frameRect, frameUnit, type, null)
+ { }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile38"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class with the
+ /// specified filename.
+ /// </para>
+ /// </devdoc>
+ public Metafile(Stream stream, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit,
+ EmfType type, string description)
+ {
+ IntPtr metafile = IntPtr.Zero;
+
+ int status;
+
+ if (frameRect.IsEmpty)
+ {
+ status = SafeNativeMethods.Gdip.GdipRecordMetafileStream(new GPStream(stream),
+ new HandleRef(null, referenceHdc),
+ unchecked((int)type),
+ NativeMethods.NullHandleRef,
+ unchecked((int)frameUnit),
+ description,
+ out metafile);
+ }
+ else
+ {
+ GPRECT gprect = new GPRECT(frameRect);
+ status = SafeNativeMethods.Gdip.GdipRecordMetafileStreamI(new GPStream(stream),
+ new HandleRef(null, referenceHdc),
+ unchecked((int)type),
+ ref gprect,
+ unchecked((int)frameUnit),
+ description,
+ out metafile);
+ }
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeImage(metafile);
+ }
+
+ /**
+ * Constructor used in deserialization
+ */
+ private Metafile(SerializationInfo info, StreamingContext context) : base(info, context)
+ {
+ }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.GetMetafileHeader"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Returns the <see cref='System.Drawing.Imaging.MetafileHeader'/> associated with the specified <see cref='System.Drawing.Imaging.Metafile'/>.
+ /// </para>
+ /// </devdoc>
+ public static MetafileHeader GetMetafileHeader(IntPtr hmetafile, WmfPlaceableFileHeader wmfHeader)
+ {
+ MetafileHeader header = new MetafileHeader();
+
+ header.wmf = new MetafileHeaderWmf();
+
+ int status = SafeNativeMethods.Gdip.GdipGetMetafileHeaderFromWmf(new HandleRef(null, hmetafile), wmfHeader, header.wmf);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return header;
+ }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.GetMetafileHeader1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Returns the <see cref='System.Drawing.Imaging.MetafileHeader'/> associated with the specified <see cref='System.Drawing.Imaging.Metafile'/>.
+ /// </para>
+ /// </devdoc>
+ public static MetafileHeader GetMetafileHeader(IntPtr henhmetafile)
+ {
+ MetafileHeader header = new MetafileHeader();
+ header.emf = new MetafileHeaderEmf();
+
+ int status = SafeNativeMethods.Gdip.GdipGetMetafileHeaderFromEmf(new HandleRef(null, henhmetafile), header.emf);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return header;
+ }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.GetMetafileHeader2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Returns the <see cref='System.Drawing.Imaging.MetafileHeader'/> associated with the specified <see cref='System.Drawing.Imaging.Metafile'/>.
+ /// </para>
+ /// </devdoc>
+ public static MetafileHeader GetMetafileHeader(string fileName)
+ {
+ MetafileHeader header = new MetafileHeader();
+
+ IntPtr memory = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MetafileHeaderEmf)));
+
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipGetMetafileHeaderFromFile(fileName, memory);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ int[] type = new int[] { 0 };
+
+ Marshal.Copy(memory, type, 0, 1);
+
+ MetafileType metafileType = (MetafileType)type[0];
+
+ if (metafileType == MetafileType.Wmf ||
+ metafileType == MetafileType.WmfPlaceable)
+ {
+ // WMF header
+ header.wmf = (MetafileHeaderWmf)UnsafeNativeMethods.PtrToStructure(memory, typeof(MetafileHeaderWmf));
+ header.emf = null;
+ }
+ else
+ {
+ // EMF header
+ header.wmf = null;
+ header.emf = (MetafileHeaderEmf)UnsafeNativeMethods.PtrToStructure(memory, typeof(MetafileHeaderEmf));
+ }
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(memory);
+ }
+
+ return header;
+ }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.GetMetafileHeader3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Returns the <see cref='System.Drawing.Imaging.MetafileHeader'/> associated with the specified <see cref='System.Drawing.Imaging.Metafile'/>.
+ /// </para>
+ /// </devdoc>
+ public static MetafileHeader GetMetafileHeader(Stream stream)
+ {
+ MetafileHeader header;
+
+ IntPtr memory = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MetafileHeaderEmf)));
+
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipGetMetafileHeaderFromStream(new GPStream(stream), memory);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ int[] type = new int[] { 0 };
+
+ Marshal.Copy(memory, type, 0, 1);
+
+ MetafileType metafileType = (MetafileType)type[0];
+
+ header = new MetafileHeader();
+
+ if (metafileType == MetafileType.Wmf ||
+ metafileType == MetafileType.WmfPlaceable)
+ {
+ // WMF header
+ header.wmf = (MetafileHeaderWmf)UnsafeNativeMethods.PtrToStructure(memory, typeof(MetafileHeaderWmf));
+ header.emf = null;
+ }
+ else
+ {
+ // EMF header
+ header.wmf = null;
+ header.emf = (MetafileHeaderEmf)UnsafeNativeMethods.PtrToStructure(memory, typeof(MetafileHeaderEmf));
+ }
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(memory);
+ }
+
+ return header;
+ }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.GetMetafileHeader4"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Returns the <see cref='System.Drawing.Imaging.MetafileHeader'/> associated with this <see cref='System.Drawing.Imaging.Metafile'/>.
+ /// </para>
+ /// </devdoc>
+ public MetafileHeader GetMetafileHeader()
+ {
+ MetafileHeader header;
+
+ IntPtr memory = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MetafileHeaderEmf)));
+
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipGetMetafileHeaderFromMetafile(new HandleRef(this, nativeImage), memory);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ int[] type = new int[] { 0 };
+
+ Marshal.Copy(memory, type, 0, 1);
+
+ MetafileType metafileType = (MetafileType)type[0];
+
+ header = new MetafileHeader();
+
+ if (metafileType == MetafileType.Wmf ||
+ metafileType == MetafileType.WmfPlaceable)
+ {
+ // WMF header
+ header.wmf = (MetafileHeaderWmf)UnsafeNativeMethods.PtrToStructure(memory, typeof(MetafileHeaderWmf));
+ header.emf = null;
+ }
+ else
+ {
+ // EMF header
+ header.wmf = null;
+ header.emf = (MetafileHeaderEmf)UnsafeNativeMethods.PtrToStructure(memory, typeof(MetafileHeaderEmf));
+ }
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(memory);
+ }
+
+ return header;
+ }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.GetHenhmetafile"]/*' />
+ /// <devdoc>
+ /// Returns a Windows handle to an enhanced
+ /// <see cref='System.Drawing.Imaging.Metafile'/>.
+ /// </devdoc>
+ public IntPtr GetHenhmetafile()
+ {
+ IntPtr hEmf = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipGetHemfFromMetafile(new HandleRef(this, nativeImage), out hEmf);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return hEmf;
+ }
+
+ /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.PlayRecord"]/*' />
+ /// <devdoc>
+ /// Plays an EMF+ file.
+ /// </devdoc>
+ public void PlayRecord(EmfPlusRecordType recordType,
+ int flags,
+ int dataSize,
+ byte[] data)
+ {
+ // Used in conjunction with Graphics.EnumerateMetafile to play an EMF+
+ // The data must be DWORD aligned if it's an EMF or EMF+. It must be
+ // WORD aligned if it's a WMF.
+
+ int status = SafeNativeMethods.Gdip.GdipPlayMetafileRecord(new HandleRef(this, nativeImage),
+ recordType,
+ flags,
+ dataSize,
+ data);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /*
+ * Create a new metafile object from a native metafile handle.
+ * This is only for internal purpose.
+ */
+ internal static Metafile FromGDIplus(IntPtr nativeImage)
+ {
+ Metafile metafile = new Metafile();
+ metafile.SetNativeImage(nativeImage);
+ return metafile;
+ }
+
+ private Metafile()
+ {
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/MetafileFrameUnit.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/MetafileFrameUnit.cs
new file mode 100644
index 0000000000..fae4d86708
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/MetafileFrameUnit.cs
@@ -0,0 +1,61 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ /**
+ * Page unit constants
+ */
+ /// <include file='doc\MetafileFrameUnit.uex' path='docs/doc[@for="MetafileFrameUnit"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the unit of measurement for the
+ /// rectangle used to size and position a metafile. This is specified during the
+ /// creation of the <see cref='System.Drawing.Imaging.Metafile'/>.
+ /// </para>
+ /// </devdoc>
+ public enum MetafileFrameUnit
+ {
+ /// <include file='doc\MetafileFrameUnit.uex' path='docs/doc[@for="MetafileFrameUnit.Pixel"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies a pixel as the unit of measure.
+ /// </para>
+ /// </devdoc>
+ Pixel = GraphicsUnit.Pixel,
+ /// <include file='doc\MetafileFrameUnit.uex' path='docs/doc[@for="MetafileFrameUnit.Point"]/*' />
+ /// <devdoc>
+ /// Specifies a printer's point as
+ /// the unit of measure.
+ /// </devdoc>
+ Point = GraphicsUnit.Point,
+ /// <include file='doc\MetafileFrameUnit.uex' path='docs/doc[@for="MetafileFrameUnit.Inch"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies an inch as the unit of measure.
+ /// </para>
+ /// </devdoc>
+ Inch = GraphicsUnit.Inch,
+ /// <include file='doc\MetafileFrameUnit.uex' path='docs/doc[@for="MetafileFrameUnit.Document"]/*' />
+ /// <devdoc>
+ /// Specifies 1/300 of an inch as the unit of
+ /// measure.
+ /// </devdoc>
+ Document = GraphicsUnit.Document,
+ /// <include file='doc\MetafileFrameUnit.uex' path='docs/doc[@for="MetafileFrameUnit.Millimeter"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies a millimeter as the unit of
+ /// measure.
+ /// </para>
+ /// </devdoc>
+ Millimeter = GraphicsUnit.Millimeter,
+ /// <include file='doc\MetafileFrameUnit.uex' path='docs/doc[@for="MetafileFrameUnit.GdiCompatible"]/*' />
+ /// <devdoc>
+ /// Specifies .01 millimeter as the unit of
+ /// measure. Provided for compatibility with GDI.
+ /// </devdoc>
+ GdiCompatible
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/MetafileHeader.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/MetafileHeader.cs
new file mode 100644
index 0000000000..9e1ae89d65
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/MetafileHeader.cs
@@ -0,0 +1,321 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ using System.Runtime.InteropServices;
+
+ /// <include file='doc\MetafileHeader.uex' path='docs/doc[@for="MetafileHeader"]/*' />
+ /// <devdoc>
+ /// Contains attributes of an
+ /// associated <see cref='System.Drawing.Imaging.Metafile'/>.
+ /// </devdoc>
+ [StructLayout(LayoutKind.Sequential)]
+ public sealed class MetafileHeader
+ {
+ // determine which to use by nullity
+ internal MetafileHeaderWmf wmf;
+ internal MetafileHeaderEmf emf;
+
+ internal MetafileHeader()
+ {
+ }
+
+ /// <include file='doc\MetafileHeader.uex' path='docs/doc[@for="MetafileHeader.Type"]/*' />
+ /// <devdoc>
+ /// Gets the type of the associated <see cref='System.Drawing.Imaging.Metafile'/>.
+ /// </devdoc>
+ public MetafileType Type
+ {
+ get
+ {
+ return IsWmf() ? wmf.type : emf.type;
+ }
+ }
+
+ /// <include file='doc\MetafileHeader.uex' path='docs/doc[@for="MetafileHeader.MetafileSize"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the size, in bytes, of the associated
+ /// <see cref='System.Drawing.Imaging.Metafile'/>.
+ /// </para>
+ /// </devdoc>
+ public int MetafileSize
+ {
+ get
+ {
+ return IsWmf() ? wmf.size : emf.size;
+ }
+ }
+
+ /// <include file='doc\MetafileHeader.uex' path='docs/doc[@for="MetafileHeader.Version"]/*' />
+ /// <devdoc>
+ /// Gets the version number of the associated
+ /// <see cref='System.Drawing.Imaging.Metafile'/>.
+ /// </devdoc>
+ public int Version
+ {
+ get
+ {
+ return IsWmf() ? wmf.version : emf.version;
+ }
+ }
+
+ /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future.
+ private EmfPlusFlags EmfPlusFlags
+ {
+ get
+ {
+ return IsWmf() ? wmf.emfPlusFlags : emf.emfPlusFlags;
+ }
+ }
+ */
+
+ /// <include file='doc\MetafileHeader.uex' path='docs/doc[@for="MetafileHeader.DpiX"]/*' />
+ /// <devdoc>
+ /// Gets the horizontal resolution, in
+ /// dots-per-inch, of the associated <see cref='System.Drawing.Imaging.Metafile'/>.
+ /// </devdoc>
+ public float DpiX
+ {
+ get
+ {
+ return IsWmf() ? wmf.dpiX : emf.dpiX;
+ }
+ }
+
+ /// <include file='doc\MetafileHeader.uex' path='docs/doc[@for="MetafileHeader.DpiY"]/*' />
+ /// <devdoc>
+ /// Gets the vertical resolution, in
+ /// dots-per-inch, of the associated <see cref='System.Drawing.Imaging.Metafile'/>.
+ /// </devdoc>
+ public float DpiY
+ {
+ get
+ {
+ return IsWmf() ? wmf.dpiY : emf.dpiY;
+ }
+ }
+
+ /// <include file='doc\MetafileHeader.uex' path='docs/doc[@for="MetafileHeader.Bounds"]/*' />
+ /// <devdoc>
+ /// Gets a <see cref='System.Drawing.Rectangle'/> that bounds the associated
+ /// <see cref='System.Drawing.Imaging.Metafile'/>.
+ /// </devdoc>
+ public Rectangle Bounds
+ {
+ get
+ {
+ return IsWmf() ?
+ new Rectangle(wmf.X, wmf.Y, wmf.Width, wmf.Height) :
+ new Rectangle(emf.X, emf.Y, emf.Width, emf.Height);
+ }
+ }
+
+ /// <include file='doc\MetafileHeader.uex' path='docs/doc[@for="MetafileHeader.IsWmf"]/*' />
+ /// <devdoc>
+ /// Returns a value indicating whether the
+ /// associated <see cref='System.Drawing.Imaging.Metafile'/> is in the Windows metafile
+ /// format.
+ /// </devdoc>
+ public bool IsWmf()
+ {
+ if ((wmf == null) && (emf == null))
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter);
+
+ if ((wmf != null) &&
+ ((wmf.type == MetafileType.Wmf) ||
+ (wmf.type == MetafileType.WmfPlaceable)))
+ return true;
+ else
+ return false;
+ }
+
+ /// <include file='doc\MetafileHeader.uex' path='docs/doc[@for="MetafileHeader.IsWmfPlaceable"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Returns a value indicating whether the
+ /// associated <see cref='System.Drawing.Imaging.Metafile'/> is in the Windows Placeable metafile
+ /// format.
+ /// </para>
+ /// </devdoc>
+ public bool IsWmfPlaceable()
+ {
+ if (wmf == null && emf == null)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter);
+
+ return ((wmf != null) && (wmf.type == MetafileType.WmfPlaceable));
+ }
+
+ /// <include file='doc\MetafileHeader.uex' path='docs/doc[@for="MetafileHeader.IsEmf"]/*' />
+ /// <devdoc>
+ /// Returns a value indicating whether the
+ /// associated <see cref='System.Drawing.Imaging.Metafile'/> is in the Windows enhanced metafile
+ /// format.
+ /// </devdoc>
+ public bool IsEmf()
+ {
+ if (wmf == null && emf == null)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter);
+
+ return ((emf != null) && (emf.type == MetafileType.Emf));
+ }
+
+ /// <include file='doc\MetafileHeader.uex' path='docs/doc[@for="MetafileHeader.IsEmfOrEmfPlus"]/*' />
+ /// <devdoc>
+ /// Returns a value indicating whether the
+ /// associated <see cref='System.Drawing.Imaging.Metafile'/> is in the Windows enhanced metafile
+ /// format or the Windows enhanced metafile plus.
+ /// </devdoc>
+ public bool IsEmfOrEmfPlus()
+ {
+ if (wmf == null && emf == null)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter);
+
+ return ((emf != null) && (emf.type >= MetafileType.Emf));
+ }
+
+ /// <include file='doc\MetafileHeader.uex' path='docs/doc[@for="MetafileHeader.IsEmfPlus"]/*' />
+ /// <devdoc>
+ /// Returns a value indicating whether the
+ /// associated <see cref='System.Drawing.Imaging.Metafile'/> is in the Windows enhanced metafile
+ /// plus format.
+ /// </devdoc>
+ public bool IsEmfPlus()
+ {
+ if (wmf == null && emf == null)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter);
+
+ return ((emf != null) && (emf.type >= MetafileType.EmfPlusOnly));
+ }
+
+ /// <include file='doc\MetafileHeader.uex' path='docs/doc[@for="MetafileHeader.IsEmfPlusDual"]/*' />
+ /// <devdoc>
+ /// Returns a value indicating whether the
+ /// associated <see cref='System.Drawing.Imaging.Metafile'/> is in the Dual enhanced
+ /// metafile format. This format supports both the enhanced and the enhanced
+ /// plus format.
+ /// </devdoc>
+ public bool IsEmfPlusDual()
+ {
+ if (wmf == null && emf == null)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter);
+
+ return ((emf != null) && (emf.type == MetafileType.EmfPlusDual));
+ }
+
+ /// <include file='doc\MetafileHeader.uex' path='docs/doc[@for="MetafileHeader.IsEmfPlusOnly"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Returns a value indicating whether the associated <see cref='System.Drawing.Imaging.Metafile'/> supports only the Windows
+ /// enhanced metafile plus format.
+ /// </para>
+ /// </devdoc>
+ public bool IsEmfPlusOnly()
+ {
+ if (wmf == null && emf == null)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter);
+
+ return ((emf != null) && (emf.type == MetafileType.EmfPlusOnly));
+ }
+
+ /// <include file='doc\MetafileHeader.uex' path='docs/doc[@for="MetafileHeader.IsDisplay"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Returns a value indicating whether the associated <see cref='System.Drawing.Imaging.Metafile'/> is device-dependent.
+ /// </para>
+ /// </devdoc>
+ public bool IsDisplay()
+ {
+ return IsEmfPlus() &&
+ (((unchecked((int)emf.emfPlusFlags)) & ((int)EmfPlusFlags.Display)) != 0);
+ }
+
+ /// <include file='doc\MetafileHeader.uex' path='docs/doc[@for="MetafileHeader.WmfHeader"]/*' />
+ /// <devdoc>
+ /// Gets the WMF header file for the associated
+ /// <see cref='System.Drawing.Imaging.Metafile'/>.
+ /// </devdoc>
+ public MetaHeader WmfHeader
+ {
+ get
+ {
+ if (wmf == null)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter);
+
+ return wmf.WmfHeader;
+ }
+ }
+
+
+ /// <include file='doc\MetafileHeader.uex' path='docs/doc[@for="MetafileHeader.EmfHeader"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the WMF header file for the associated <see cref='System.Drawing.Imaging.Metafile'/>.
+ /// </para>
+ /// </devdoc>
+ /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future.
+ internal SafeNativeMethods.ENHMETAHEADER EmfHeader
+ {
+ get
+ {
+ if (emf == null)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter);
+
+ return emf.EmfHeader;
+ }
+ }
+ */
+
+ /// <include file='doc\MetafileHeader.uex' path='docs/doc[@for="MetafileHeader.EmfPlusHeaderSize"]/*' />
+ /// <devdoc>
+ /// Gets the size, in bytes, of the
+ /// enhanced metafile plus header file.
+ /// </devdoc>
+ public int EmfPlusHeaderSize
+ {
+ get
+ {
+ if (wmf == null && emf == null)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter);
+
+ return IsWmf() ? wmf.EmfPlusHeaderSize : emf.EmfPlusHeaderSize;
+ }
+ }
+
+ /// <include file='doc\MetafileHeader.uex' path='docs/doc[@for="MetafileHeader.LogicalDpiX"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the logical horizontal resolution, in
+ /// dots-per-inch, of the associated <see cref='System.Drawing.Imaging.Metafile'/>.
+ /// </para>
+ /// </devdoc>
+ public int LogicalDpiX
+ {
+ get
+ {
+ if (wmf == null && emf == null)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter);
+
+ return IsWmf() ? wmf.LogicalDpiX : emf.LogicalDpiX;
+ }
+ }
+
+ /// <include file='doc\MetafileHeader.uex' path='docs/doc[@for="MetafileHeader.LogicalDpiY"]/*' />
+ /// <devdoc>
+ /// Gets the logical vertical resolution, in
+ /// dots-per-inch, of the associated <see cref='System.Drawing.Imaging.Metafile'/>.
+ /// </devdoc>
+ public int LogicalDpiY
+ {
+ get
+ {
+ if (wmf == null && emf == null)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter);
+
+ return IsWmf() ? wmf.LogicalDpiY : emf.LogicalDpiX;
+ }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/MetafileHeaderEmf.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/MetafileHeaderEmf.cs
new file mode 100644
index 0000000000..4d852f0292
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/MetafileHeaderEmf.cs
@@ -0,0 +1,31 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ using System.Runtime.InteropServices;
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal class MetafileHeaderEmf
+ {
+ /// The ENHMETAHEADER structure is defined natively as a union with WmfHeader.
+ /// Extreme care should be taken if changing the layout of the corresponding managaed
+ /// structures to minimize the risk of buffer overruns. The affected managed classes
+ /// are the following: ENHMETAHEADER, MetaHeader, MetafileHeaderWmf, MetafileHeaderEmf.
+ public MetafileType type = MetafileType.Invalid;
+ public int size;
+ public int version;
+ public EmfPlusFlags emfPlusFlags = 0;
+ public float dpiX;
+ public float dpiY;
+ public int X;
+ public int Y;
+ public int Width;
+ public int Height;
+ public SafeNativeMethods.ENHMETAHEADER EmfHeader;
+ public int EmfPlusHeaderSize;
+ public int LogicalDpiX;
+ public int LogicalDpiY;
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/MetafileHeaderWmf.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/MetafileHeaderWmf.cs
new file mode 100644
index 0000000000..dc2d1e82cf
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/MetafileHeaderWmf.cs
@@ -0,0 +1,56 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ using System.Runtime.InteropServices;
+
+ [StructLayout(LayoutKind.Sequential, Pack = 8)]
+ internal class MetafileHeaderWmf
+ {
+ /// The ENHMETAHEADER structure is defined natively as a union with WmfHeader.
+ /// Extreme care should be taken if changing the layout of the corresponding managaed
+ /// structures to minimize the risk of buffer overruns. The affected managed classes
+ /// are the following: ENHMETAHEADER, MetaHeader, MetafileHeaderWmf, MetafileHeaderEmf.
+ public MetafileType type = MetafileType.Invalid;
+ public int size = Marshal.SizeOf(typeof(MetafileHeaderWmf));
+ public int version;
+ public EmfPlusFlags emfPlusFlags = 0;
+ public float dpiX;
+ public float dpiY;
+ public int X;
+ public int Y;
+ public int Width;
+ public int Height;
+
+ //The below datatype, WmfHeader, file is defined natively
+ //as a union with EmfHeader. Since EmfHeader is a larger
+ //structure, we need to pad the struct below so that this
+ //will marshal correctly.
+#pragma warning disable CS0618 // Legacy code: We don't care about using obsolete API's.
+ [MarshalAs(UnmanagedType.Struct)]
+#pragma warning restore CS0618
+ public MetaHeader WmfHeader = new MetaHeader();
+ public int dummy1;
+ public int dummy2;
+ public int dummy3;
+ public int dummy4;
+ public int dummy5;
+ public int dummy6;
+ public int dummy7;
+ public int dummy8;
+ public int dummy9;
+ public int dummy10;
+ public int dummy11;
+ public int dummy12;
+ public int dummy13;
+ public int dummy14;
+ public int dummy15;
+ public int dummy16;
+
+ public int EmfPlusHeaderSize;
+ public int LogicalDpiX;
+ public int LogicalDpiY;
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/MetafileType.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/MetafileType.cs
new file mode 100644
index 0000000000..1d14721add
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/MetafileType.cs
@@ -0,0 +1,50 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ /**
+ * MetafileType Type
+ */
+ /// <include file='doc\MetafileType.uex' path='docs/doc[@for="MetafileType"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the format of a <see cref='System.Drawing.Imaging.Metafile'/>.
+ /// </para>
+ /// </devdoc>
+ public enum MetafileType
+ {
+ /// <include file='doc\MetafileType.uex' path='docs/doc[@for="MetafileType.Invalid"]/*' />
+ /// <devdoc>
+ /// Specifies an invalid type.
+ /// </devdoc>
+ Invalid, // Invalid metafile
+ /// <include file='doc\MetafileType.uex' path='docs/doc[@for="MetafileType.Wmf"]/*' />
+ /// <devdoc>
+ /// Specifies a standard Windows metafile.
+ /// </devdoc>
+ Wmf, // Standard WMF
+ /// <include file='doc\MetafileType.uex' path='docs/doc[@for="MetafileType.WmfPlaceable"]/*' />
+ /// <devdoc>
+ /// Specifies a Windows Placeable metafile.
+ /// </devdoc>
+ WmfPlaceable, // Placeable Metafile format
+ /// <include file='doc\MetafileType.uex' path='docs/doc[@for="MetafileType.Emf"]/*' />
+ /// <devdoc>
+ /// Specifies a Windows enhanced metafile.
+ /// </devdoc>
+ Emf, // EMF (not EMF+)
+ /// <include file='doc\MetafileType.uex' path='docs/doc[@for="MetafileType.EmfPlusOnly"]/*' />
+ /// <devdoc>
+ /// Specifies a Windows enhanced metafile plus.
+ /// </devdoc>
+ EmfPlusOnly, // EMF+ without dual, down-level records
+ /// <include file='doc\MetafileType.uex' path='docs/doc[@for="MetafileType.EmfPlusDual"]/*' />
+ /// <devdoc>
+ /// Specifies both enhanced and enhanced plus
+ /// commands in the same file.
+ /// </devdoc>
+ EmfPlusDual, // EMF+ with dual, down-level records
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/PaletteFlags.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/PaletteFlags.cs
new file mode 100644
index 0000000000..505c7c3f30
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/PaletteFlags.cs
@@ -0,0 +1,33 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ /// <include file='doc\PaletteFlags.uex' path='docs/doc[@for="PaletteFlags"]/*' />
+ /// <devdoc>
+ /// Specifies the type of color data in the
+ /// system palette. The data can be color data with alpha, grayscale only, or
+ /// halftone data.
+ /// </devdoc>
+ [Flags]
+ public enum PaletteFlags
+ {
+ /// <include file='doc\PaletteFlags.uex' path='docs/doc[@for="PaletteFlags.HasAlpha"]/*' />
+ /// <devdoc>
+ /// Specifies alpha data.
+ /// </devdoc>
+ HasAlpha = 0x0001,
+ /// <include file='doc\PaletteFlags.uex' path='docs/doc[@for="PaletteFlags.GrayScale"]/*' />
+ /// <devdoc>
+ /// Specifies grayscale data.
+ /// </devdoc>
+ GrayScale = 0x0002,
+ /// <include file='doc\PaletteFlags.uex' path='docs/doc[@for="PaletteFlags.Halftone"]/*' />
+ /// <devdoc>
+ /// Specifies halftone data.
+ /// </devdoc>
+ Halftone = 0x0004
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/PathData.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/PathData.cs
new file mode 100644
index 0000000000..177a60e095
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/PathData.cs
@@ -0,0 +1,64 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /**
+ * Represent the internal data of a path object
+ */
+ /// <include file='doc\PathData.uex' path='docs/doc[@for="PathData"]/*' />
+ /// <devdoc>
+ /// Contains the graphical data that makes up a
+ /// <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </devdoc>
+ public sealed class PathData
+ {
+ private PointF[] _points;
+ private byte[] _types;
+
+ /// <include file='doc\PathData.uex' path='docs/doc[@for="PathData.PathData"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.PathData'/> class.
+ /// </devdoc>
+ public PathData()
+ {
+ }
+
+ /// <include file='doc\PathData.uex' path='docs/doc[@for="PathData.Points"]/*' />
+ /// <devdoc>
+ /// Contains an array of <see cref='System.Drawing.PointF'/> objects
+ /// that represent the points through which the path is constructed.
+ /// </devdoc>
+ public PointF[] Points
+ {
+ get
+ {
+ return _points;
+ }
+ set
+ {
+ _points = value;
+ }
+ }
+
+ /// <include file='doc\PathData.uex' path='docs/doc[@for="PathData.Types"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Contains an array of <see cref='System.Drawing.Drawing2D.PathPointType'/> objects that represent the types of
+ /// data in the corresponding elements of the <see cref='System.Drawing.Drawing2D.PathData. _points'/> array.
+ /// </para>
+ /// </devdoc>
+ public byte[] Types
+ {
+ get
+ {
+ return _types;
+ }
+ set
+ {
+ _types = value;
+ }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/PathGradientBrush.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/PathGradientBrush.cs
new file mode 100644
index 0000000000..fd8b796b39
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/PathGradientBrush.cs
@@ -0,0 +1,899 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ using System.Runtime.InteropServices;
+ using System.Diagnostics;
+ using System.ComponentModel;
+ using System.Drawing.Internal;
+
+ /**
+ * Represent a PathGradient brush object
+ */
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush"]/*' />
+ /// <devdoc>
+ /// Encapsulates a <see cref='System.Drawing.Brush'/> that fills the interior of a
+ /// <see cref='System.Drawing.Drawing2D.GraphicsPath'/> with a gradient.
+ /// </devdoc>
+ public sealed class PathGradientBrush : Brush
+ {
+ /**
+ * Create a new rectangle gradient brush object
+ */
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.PathGradientBrush"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.PathGradientBrush'/> class with the specified points.
+ /// </para>
+ /// </devdoc>
+ public PathGradientBrush(PointF[] points)
+ : this(points, System.Drawing.Drawing2D.WrapMode.Clamp)
+ {
+ }
+
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.PathGradientBrush1"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.PathGradientBrush'/> class with the specified points and
+ /// wrap mode.
+ /// </devdoc>
+ public PathGradientBrush(PointF[] points, WrapMode wrapMode)
+ {
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ //validate the WrapMode enum
+ //valid values are 0x0 to 0x4
+ if (!ClientUtils.IsEnumValid(wrapMode, unchecked((int)wrapMode), (int)WrapMode.Tile, (int)WrapMode.Clamp))
+ {
+ throw new InvalidEnumArgumentException("wrapMode", unchecked((int)wrapMode), typeof(WrapMode));
+ }
+
+ IntPtr brush = IntPtr.Zero;
+ IntPtr pointsBuf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipCreatePathGradient(new HandleRef(null, pointsBuf),
+ points.Length,
+ unchecked((int)wrapMode),
+ out brush);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeBrushInternal(brush);
+ }
+ finally
+ {
+ // Inside SafeNativeMethods.Gdip.ConvertPointToMemory, Marshal.AllocHGlobal
+ // is used to allocate unmanaged memory. Therefore, we need to free it
+ // manually with Marshal.FreeHGlobal
+ if (pointsBuf != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(pointsBuf);
+ }
+ }
+ }
+
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.PathGradientBrush2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.PathGradientBrush'/> class with the
+ /// specified points.
+ /// </para>
+ /// </devdoc>
+ public PathGradientBrush(Point[] points)
+ : this(points, System.Drawing.Drawing2D.WrapMode.Clamp)
+ {
+ }
+
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.PathGradientBrush3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.PathGradientBrush'/> class with the
+ /// specified points and wrap mode.
+ /// </para>
+ /// </devdoc>
+ public PathGradientBrush(Point[] points, WrapMode wrapMode)
+ {
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ //validate the WrapMode enum
+ if (!ClientUtils.IsEnumValid(wrapMode, unchecked((int)wrapMode), (int)WrapMode.Tile, (int)WrapMode.Clamp))
+ {
+ throw new InvalidEnumArgumentException("wrapMode", unchecked((int)wrapMode), typeof(WrapMode));
+ }
+
+ IntPtr brush = IntPtr.Zero;
+ IntPtr pointsBuf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ try
+ {
+ int status = SafeNativeMethods.Gdip.GdipCreatePathGradientI(new HandleRef(null, pointsBuf),
+ points.Length,
+ unchecked((int)wrapMode),
+ out brush);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeBrushInternal(brush);
+ }
+ finally
+ {
+ // Inside SafeNativeMethods.Gdip.ConvertPointToMemory, Marshal.AllocHGlobal
+ // is used to allocate unmanaged memory. Therefore, we need to free it
+ // manually with Marshal.FreeHGlobal
+ if (pointsBuf != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(pointsBuf);
+ }
+ }
+ }
+
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.PathGradientBrush4"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Drawing2D.PathGradientBrush'/>
+ /// class with the specified path.
+ /// </para>
+ /// </devdoc>
+ public PathGradientBrush(GraphicsPath path)
+ {
+ if (path == null)
+ throw new ArgumentNullException("path");
+
+ IntPtr brush = IntPtr.Zero;
+ int status = SafeNativeMethods.Gdip.GdipCreatePathGradientFromPath(new HandleRef(path, path.nativePath),
+ out brush);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeBrushInternal(brush);
+ }
+
+ /// <devdoc>
+ /// Constructor to initialized this object to be owned by GDI+.
+ /// </devdoc>
+ internal PathGradientBrush(IntPtr nativeBrush)
+ {
+ Debug.Assert(nativeBrush != IntPtr.Zero, "Initializing native brush with null.");
+ SetNativeBrushInternal(nativeBrush);
+ }
+
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.Clone"]/*' />
+ /// <devdoc>
+ /// Creates an exact copy of this <see cref='System.Drawing.Drawing2D.PathGradientBrush'/>.
+ /// </devdoc>
+ public override object Clone()
+ {
+ IntPtr cloneBrush = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCloneBrush(new HandleRef(this, NativeBrush), out cloneBrush);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return new PathGradientBrush(cloneBrush);
+ }
+
+ /**
+ * Set/get center color attributes
+ */
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.CenterColor"]/*' />
+ /// <devdoc>
+ /// Gets or sets the color at the center of the
+ /// path gradient.
+ /// </devdoc>
+ public Color CenterColor
+ {
+ get
+ {
+ int argb;
+
+ int status = SafeNativeMethods.Gdip.GdipGetPathGradientCenterColor(new HandleRef(this, NativeBrush), out argb);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return Color.FromArgb(argb);
+ }
+
+ set
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetPathGradientCenterColor(new HandleRef(this, NativeBrush), value.ToArgb());
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /**
+ * Get/set colors
+ * !! NOTE: We do not have methods for GetSurroundColor or SetSurroundColor,
+ * May need to add usage of Collection class
+ */
+
+ private void _SetSurroundColors(Color[] colors)
+ {
+ int count;
+
+ int status = SafeNativeMethods.Gdip.GdipGetPathGradientSurroundColorCount(new HandleRef(this, NativeBrush),
+ out count);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ if ((colors.Length > count) || (count <= 0))
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter);
+
+ count = colors.Length;
+ int[] argbs = new int[count];
+ for (int i = 0; i < colors.Length; i++)
+ argbs[i] = colors[i].ToArgb();
+
+ status = SafeNativeMethods.Gdip.GdipSetPathGradientSurroundColorsWithCount(new HandleRef(this, NativeBrush),
+ argbs,
+ ref count);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ private Color[] _GetSurroundColors()
+ {
+ int count;
+
+ int status = SafeNativeMethods.Gdip.GdipGetPathGradientSurroundColorCount(new HandleRef(this, NativeBrush),
+ out count);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ int[] argbs = new int[count];
+
+ status = SafeNativeMethods.Gdip.GdipGetPathGradientSurroundColorsWithCount(new HandleRef(this, NativeBrush),
+ argbs,
+ ref count);
+
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ Color[] colors = new Color[count];
+ for (int i = 0; i < count; i++)
+ colors[i] = Color.FromArgb(argbs[i]);
+
+ return colors;
+ }
+
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.SurroundColors"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets an array of colors that
+ /// correspond to the points in the path this <see cref='System.Drawing.Drawing2D.LinearGradientBrush'/> fills.
+ /// </para>
+ /// </devdoc>
+ public Color[] SurroundColors
+ {
+ get { return _GetSurroundColors(); }
+ set { _SetSurroundColors(value); }
+ }
+
+ /**
+ * Set/get center point
+ */
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.CenterPoint"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets the center point of the path
+ /// gradient.
+ /// </para>
+ /// </devdoc>
+ public PointF CenterPoint
+ {
+ get
+ {
+ GPPOINTF point = new GPPOINTF();
+
+ int status = SafeNativeMethods.Gdip.GdipGetPathGradientCenterPoint(new HandleRef(this, NativeBrush), point);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return point.ToPoint();
+ }
+
+ set
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetPathGradientCenterPoint(new HandleRef(this, NativeBrush), new GPPOINTF(value));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /**
+ * Get source rectangle
+ */
+ private RectangleF _GetRectangle()
+ {
+ GPRECTF rect = new GPRECTF();
+
+ int status = SafeNativeMethods.Gdip.GdipGetPathGradientRect(new HandleRef(this, NativeBrush), ref rect);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return rect.ToRectangleF();
+ }
+
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.Rectangle"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets a bounding rectangle for this <see cref='System.Drawing.Drawing2D.PathGradientBrush'/>.
+ /// </para>
+ /// </devdoc>
+ public RectangleF Rectangle
+ {
+ get { return _GetRectangle(); }
+ }
+
+ /**
+ * Set/get blend factors
+ */
+ private Blend _GetBlend()
+ {
+ Blend blend;
+
+ // Figure out the size of blend factor array
+ int retval = 0;
+ int status = SafeNativeMethods.Gdip.GdipGetPathGradientBlendCount(new HandleRef(this, NativeBrush), out retval);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ // Allocate temporary native memory buffer
+
+ int count = retval;
+
+ IntPtr factors = IntPtr.Zero;
+ IntPtr positions = IntPtr.Zero;
+
+ try
+ {
+ int size = checked(4 * count);
+ factors = Marshal.AllocHGlobal(size);
+ positions = Marshal.AllocHGlobal(size);
+
+ // Retrieve horizontal blend factors
+
+ status = SafeNativeMethods.Gdip.GdipGetPathGradientBlend(new HandleRef(this, NativeBrush), factors, positions, count);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ // Return the result in a managed array
+
+ blend = new Blend(count);
+
+ Marshal.Copy(factors, blend.Factors, 0, count);
+ Marshal.Copy(positions, blend.Positions, 0, count);
+ }
+ finally
+ {
+ if (factors != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(factors);
+ }
+ if (positions != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(positions);
+ }
+ }
+
+ return blend;
+ }
+
+ private void _SetBlend(Blend blend)
+ {
+ // Allocate temporary native memory buffer
+ // and copy input blend factors into it.
+
+ int count = blend.Factors.Length;
+
+ IntPtr factors = IntPtr.Zero;
+ IntPtr positions = IntPtr.Zero;
+
+ try
+ {
+ int size = checked(4 * count);
+ factors = Marshal.AllocHGlobal(size);
+ positions = Marshal.AllocHGlobal(size);
+
+ Marshal.Copy(blend.Factors, 0, factors, count);
+ Marshal.Copy(blend.Positions, 0, positions, count);
+
+ // Set blend factors
+
+ int status = SafeNativeMethods.Gdip.GdipSetPathGradientBlend(new HandleRef(this, NativeBrush), new HandleRef(null, factors), new HandleRef(null, positions), count);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+ finally
+ {
+ if (factors != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(factors);
+ }
+ if (positions != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(positions);
+ }
+ }
+ }
+
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.Blend"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets a <see cref='System.Drawing.Drawing2D.Blend'/> that specifies positions and factors
+ /// that define a custom falloff for the gradient.
+ /// </para>
+ /// </devdoc>
+ public Blend Blend
+ {
+ get { return _GetBlend(); }
+ set { _SetBlend(value); }
+ }
+
+ /*
+ * SigmaBlend & LinearBlend
+ */
+
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.SetSigmaBellShape"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Creates a gradient falloff based on a bell-shaped curve.
+ /// </para>
+ /// </devdoc>
+ public void SetSigmaBellShape(float focus)
+ {
+ SetSigmaBellShape(focus, (float)1.0);
+ }
+
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.SetSigmaBellShape1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Creates a gradient falloff based on a bell-shaped curve.
+ /// </para>
+ /// </devdoc>
+ public void SetSigmaBellShape(float focus, float scale)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetPathGradientSigmaBlend(new HandleRef(this, NativeBrush), focus, scale);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.SetBlendTriangularShape"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Creates a triangular gradient.
+ /// </para>
+ /// </devdoc>
+ public void SetBlendTriangularShape(float focus)
+ {
+ SetBlendTriangularShape(focus, (float)1.0);
+ }
+
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.SetBlendTriangularShape1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Creates a triangular gradient.
+ /// </para>
+ /// </devdoc>
+ public void SetBlendTriangularShape(float focus, float scale)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetPathGradientLinearBlend(new HandleRef(this, NativeBrush), focus, scale);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /*
+ * Preset Color Blend
+ */
+
+ private ColorBlend _GetInterpolationColors()
+ {
+ ColorBlend blend;
+
+ // Figure out the size of blend factor array
+ int retval = 0;
+ int status = SafeNativeMethods.Gdip.GdipGetPathGradientPresetBlendCount(new HandleRef(this, NativeBrush), out retval);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ // If retVal is 0, then there is nothing to marshal.
+ // In this case, we'll return an empty ColorBlend...
+ //
+ if (retval == 0)
+ {
+ return new ColorBlend();
+ }
+
+ // Allocate temporary native memory buffer
+
+ int count = retval;
+
+ IntPtr colors = IntPtr.Zero;
+ IntPtr positions = IntPtr.Zero;
+
+ try
+ {
+ int size = checked(4 * count);
+ colors = Marshal.AllocHGlobal(size);
+ positions = Marshal.AllocHGlobal(size);
+
+ // Retrieve horizontal blend factors
+
+ status = SafeNativeMethods.Gdip.GdipGetPathGradientPresetBlend(new HandleRef(this, NativeBrush), colors, positions, count);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ // Return the result in a managed array
+
+ blend = new ColorBlend(count);
+
+ int[] argb = new int[count];
+ Marshal.Copy(colors, argb, 0, count);
+ Marshal.Copy(positions, blend.Positions, 0, count);
+
+ // copy ARGB values into Color array of ColorBlend
+ blend.Colors = new Color[argb.Length];
+
+ for (int i = 0; i < argb.Length; i++)
+ {
+ blend.Colors[i] = Color.FromArgb(argb[i]);
+ }
+ }
+ finally
+ {
+ if (colors != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(colors);
+ }
+ if (positions != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(positions);
+ }
+ }
+
+ return blend;
+ }
+
+ private void _SetInterpolationColors(ColorBlend blend)
+ {
+ // Allocate temporary native memory buffer
+ // and copy input blend factors into it.
+
+ int count = blend.Colors.Length;
+
+ IntPtr colors = IntPtr.Zero;
+ IntPtr positions = IntPtr.Zero;
+
+ try
+ {
+ int size = checked(4 * count);
+ colors = Marshal.AllocHGlobal(size);
+ positions = Marshal.AllocHGlobal(size);
+
+ int[] argbs = new int[count];
+ for (int i = 0; i < count; i++)
+ {
+ argbs[i] = blend.Colors[i].ToArgb();
+ }
+
+ Marshal.Copy(argbs, 0, colors, count);
+ Marshal.Copy(blend.Positions, 0, positions, count);
+
+ // Set blend factors
+
+ int status = SafeNativeMethods.Gdip.GdipSetPathGradientPresetBlend(new HandleRef(this, NativeBrush), new HandleRef(null, colors), new HandleRef(null, positions), count);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+ finally
+ {
+ if (colors != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(colors);
+ }
+ if (positions != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(positions);
+ }
+ }
+ }
+
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.InterpolationColors"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets a <see cref='System.Drawing.Drawing2D.ColorBlend'/> that defines a multi-color linear
+ /// gradient.
+ /// </para>
+ /// </devdoc>
+ public ColorBlend InterpolationColors
+ {
+ get { return _GetInterpolationColors(); }
+ set { _SetInterpolationColors(value); }
+ }
+
+ /**
+ * Set/get brush transform
+ */
+ private void _SetTransform(Matrix matrix)
+ {
+ if (matrix == null)
+ throw new ArgumentNullException("matrix");
+
+ int status = SafeNativeMethods.Gdip.GdipSetPathGradientTransform(new HandleRef(this, NativeBrush), new HandleRef(matrix, matrix.nativeMatrix));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ private Matrix _GetTransform()
+ {
+ Matrix matrix = new Matrix();
+
+ int status = SafeNativeMethods.Gdip.GdipGetPathGradientTransform(new HandleRef(this, NativeBrush), new HandleRef(matrix, matrix.nativeMatrix));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return matrix;
+ }
+
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.Transform"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets a <see cref='System.Drawing.Drawing2D.Matrix'/> that defines a local geometrical
+ /// transform for this <see cref='System.Drawing.Drawing2D.PathGradientBrush'/>.
+ /// </para>
+ /// </devdoc>
+ public Matrix Transform
+ {
+ get { return _GetTransform(); }
+ set { _SetTransform(value); }
+ }
+
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.ResetTransform"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Resets the <see cref='System.Drawing.Drawing2D.PathGradientBrush.Transform'/> property to
+ /// identity.
+ /// </para>
+ /// </devdoc>
+ public void ResetTransform()
+ {
+ int status = SafeNativeMethods.Gdip.GdipResetPathGradientTransform(new HandleRef(this, NativeBrush));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.MultiplyTransform"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Multiplies the <see cref='System.Drawing.Drawing2D.Matrix'/> that represents the local geometrical
+ /// transform of this <see cref='System.Drawing.Drawing2D.PathGradientBrush'/> by the specified <see cref='System.Drawing.Drawing2D.Matrix'/> by prepending the specified <see cref='System.Drawing.Drawing2D.Matrix'/>.
+ /// </para>
+ /// </devdoc>
+ public void MultiplyTransform(Matrix matrix)
+ {
+ MultiplyTransform(matrix, MatrixOrder.Prepend);
+ }
+
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.MultiplyTransform1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Multiplies the <see cref='System.Drawing.Drawing2D.Matrix'/> that represents the local geometrical
+ /// transform of this <see cref='System.Drawing.Drawing2D.PathGradientBrush'/> by the specified <see cref='System.Drawing.Drawing2D.Matrix'/> in the specified order.
+ /// </para>
+ /// </devdoc>
+ public void MultiplyTransform(Matrix matrix, MatrixOrder order)
+ {
+ if (matrix == null)
+ throw new ArgumentNullException("matrix");
+
+ int status = SafeNativeMethods.Gdip.GdipMultiplyPathGradientTransform(new HandleRef(this, NativeBrush),
+ new HandleRef(matrix, matrix.nativeMatrix),
+ order);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.TranslateTransform"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Translates the local geometrical transform by the specified dimmensions. This
+ /// method prepends the translation to the transform.
+ /// </para>
+ /// </devdoc>
+ public void TranslateTransform(float dx, float dy)
+ {
+ TranslateTransform(dx, dy, MatrixOrder.Prepend);
+ }
+
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.TranslateTransform1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Translates the local geometrical transform by the specified dimmensions in
+ /// the specified order.
+ /// </para>
+ /// </devdoc>
+ public void TranslateTransform(float dx, float dy, MatrixOrder order)
+ {
+ int status = SafeNativeMethods.Gdip.GdipTranslatePathGradientTransform(new HandleRef(this, NativeBrush),
+ dx, dy, order);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.ScaleTransform"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Scales the local geometric transform by the specified amounts. This method
+ /// prepends the scaling matrix to the transform.
+ /// </para>
+ /// </devdoc>
+ public void ScaleTransform(float sx, float sy)
+ {
+ ScaleTransform(sx, sy, MatrixOrder.Prepend);
+ }
+
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.ScaleTransform1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Scales the local geometric transform by the specified amounts in the
+ /// specified order.
+ /// </para>
+ /// </devdoc>
+ public void ScaleTransform(float sx, float sy, MatrixOrder order)
+ {
+ int status = SafeNativeMethods.Gdip.GdipScalePathGradientTransform(new HandleRef(this, NativeBrush),
+ sx, sy, order);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.RotateTransform"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Rotates the local geometric transform by the specified amount. This method
+ /// prepends the rotation to the transform.
+ /// </para>
+ /// </devdoc>
+ public void RotateTransform(float angle)
+ {
+ RotateTransform(angle, MatrixOrder.Prepend);
+ }
+
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.RotateTransform1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Rotates the local geometric transform by the specified amount in the
+ /// specified order.
+ /// </para>
+ /// </devdoc>
+ public void RotateTransform(float angle, MatrixOrder order)
+ {
+ int status = SafeNativeMethods.Gdip.GdipRotatePathGradientTransform(new HandleRef(this, NativeBrush),
+ angle, order);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /**
+ * Set/get brush focus scales
+ */
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.FocusScales"]/*' />
+ /// <devdoc>
+ /// Gets or sets the focus point for the
+ /// gradient falloff.
+ /// </devdoc>
+ public PointF FocusScales
+ {
+ get
+ {
+ float[] scaleX = new float[] { 0.0f };
+ float[] scaleY = new float[] { 0.0f };
+
+ int status = SafeNativeMethods.Gdip.GdipGetPathGradientFocusScales(new HandleRef(this, NativeBrush), scaleX, scaleY);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return new PointF(scaleX[0], scaleY[0]);
+ }
+ set
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetPathGradientFocusScales(new HandleRef(this, NativeBrush), value.X, value.Y);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /**
+ * Set/get brush wrapping mode
+ */
+ private void _SetWrapMode(WrapMode wrapMode)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetPathGradientWrapMode(new HandleRef(this, NativeBrush), unchecked((int)wrapMode));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ private WrapMode _GetWrapMode()
+ {
+ int mode = 0;
+
+ int status = SafeNativeMethods.Gdip.GdipGetPathGradientWrapMode(new HandleRef(this, NativeBrush), out mode);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return (WrapMode)mode;
+ }
+
+ /// <include file='doc\PathGradientBrush.uex' path='docs/doc[@for="PathGradientBrush.WrapMode"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets a <see cref='System.Drawing.Drawing2D.WrapMode'/> that indicates the wrap mode for this
+ /// <see cref='System.Drawing.Drawing2D.PathGradientBrush'/>.
+ /// </para>
+ /// </devdoc>
+ public WrapMode WrapMode
+ {
+ get
+ {
+ return _GetWrapMode();
+ }
+ set
+ {
+ //validate the WrapMode enum
+ if (!ClientUtils.IsEnumValid(value, unchecked((int)value), (int)WrapMode.Tile, (int)WrapMode.Clamp))
+ {
+ throw new InvalidEnumArgumentException("value", unchecked((int)value), typeof(WrapMode));
+ }
+
+ _SetWrapMode(value);
+ }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/PathPointType.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/PathPointType.cs
new file mode 100644
index 0000000000..f7910ec97f
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/PathPointType.cs
@@ -0,0 +1,65 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /**
+ * Path Point Type
+ */
+ /// <include file='doc\PathPointType.uex' path='docs/doc[@for="PathPointType"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the type of graphical point
+ /// contained at a specific point in a <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </para>
+ /// </devdoc>
+ public enum PathPointType
+ {
+ /// <include file='doc\PathPointType.uex' path='docs/doc[@for="PathPointType.Start"]/*' />
+ /// <devdoc>
+ /// Specifies the starting point of a <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </devdoc>
+ Start = 0, // move
+ /// <include file='doc\PathPointType.uex' path='docs/doc[@for="PathPointType.Line"]/*' />
+ /// <devdoc>
+ /// Specifies a line segment.
+ /// </devdoc>
+ Line = 1, // line
+ /// <include file='doc\PathPointType.uex' path='docs/doc[@for="PathPointType.Bezier"]/*' />
+ /// <devdoc>
+ /// Specifies a default Bezier curve.
+ /// </devdoc>
+ Bezier = 3, // default Beizer (= cubic Bezier)
+ /// <include file='doc\PathPointType.uex' path='docs/doc[@for="PathPointType.PathTypeMask"]/*' />
+ /// <devdoc>
+ /// Specifies a mask point.
+ /// </devdoc>
+ PathTypeMask = 0x07, // type mask (lowest 3 bits).
+ /// <include file='doc\PathPointType.uex' path='docs/doc[@for="PathPointType.DashMode"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies that the corresponding segment is dashed.
+ /// </para>
+ /// </devdoc>
+ DashMode = 0x10, // currently in dash mode.
+ /// <include file='doc\PathPointType.uex' path='docs/doc[@for="PathPointType.PathMarker"]/*' />
+ /// <devdoc>
+ /// Specifies a path marker.
+ /// </devdoc>
+ PathMarker = 0x20, // a marker for the path.
+ /// <include file='doc\PathPointType.uex' path='docs/doc[@for="PathPointType.CloseSubpath"]/*' />
+ /// <devdoc>
+ /// Specifies the ending point of a subpath.
+ /// </devdoc>
+ CloseSubpath = 0x80, // closed flag
+
+ // Path types used for advanced path.
+
+ /// <include file='doc\PathPointType.uex' path='docs/doc[@for="PathPointType.Bezier3"]/*' />
+ /// <devdoc>
+ /// Specifies a cubic Bezier curve.
+ /// </devdoc>
+ Bezier3 = 3, // cubic Bezier
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/PenAlignment.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/PenAlignment.cs
new file mode 100644
index 0000000000..fc8cb1b09f
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/PenAlignment.cs
@@ -0,0 +1,58 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /**
+ * Pen alignment constants
+ */
+ /// <include file='doc\PenAlignment.uex' path='docs/doc[@for="PenAlignment"]/*' />
+ /// <devdoc>
+ /// Specifies the algnment of a <see cref='System.Drawing.Pen'/> in relation
+ /// to the line being drawn.
+ /// </devdoc>
+ public enum PenAlignment
+ {
+ /// <include file='doc\PenAlignment.uex' path='docs/doc[@for="PenAlignment.Center"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies that the <see cref='System.Drawing.Pen'/> is positioned at the center of
+ /// the line being drawn.
+ /// </para>
+ /// </devdoc>
+ Center = 0,
+ /// <include file='doc\PenAlignment.uex' path='docs/doc[@for="PenAlignment.Inset"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies that the <see cref='System.Drawing.Pen'/> is positioned on the insede of
+ /// the line being drawn.
+ /// </para>
+ /// </devdoc>
+ Inset = 1,
+ /// <include file='doc\PenAlignment.uex' path='docs/doc[@for="PenAlignment.Outset"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies that the <see cref='System.Drawing.Pen'/> is positioned on the outside
+ /// of the line being drawn.
+ /// </para>
+ /// </devdoc>
+ Outset = 2,
+ /// <include file='doc\PenAlignment.uex' path='docs/doc[@for="PenAlignment.Left"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies that the <see cref='System.Drawing.Pen'/> is positioned to the left of
+ /// the line being drawn.
+ /// </para>
+ /// </devdoc>
+ Left = 3,
+ /// <include file='doc\PenAlignment.uex' path='docs/doc[@for="PenAlignment.Right"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies that the <see cref='System.Drawing.Pen'/> is positioned to the right of
+ /// the line being drawn.
+ /// </para>
+ /// </devdoc>
+ Right = 4
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/PenType.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/PenType.cs
new file mode 100644
index 0000000000..2ee42bfa3e
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/PenType.cs
@@ -0,0 +1,45 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /**
+ * PenType Type
+ */
+ /// <include file='doc\PenType.uex' path='docs/doc[@for="PenType"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the type of fill a <see cref='System.Drawing.Pen'/> uses to
+ /// fill lines.
+ /// </para>
+ /// </devdoc>
+ public enum PenType
+ {
+ /// <include file='doc\PenType.uex' path='docs/doc[@for="PenType.SolidColor"]/*' />
+ /// <devdoc>
+ /// Specifies a solid fill.
+ /// </devdoc>
+ SolidColor = BrushType.SolidColor,
+ /// <include file='doc\PenType.uex' path='docs/doc[@for="PenType.HatchFill"]/*' />
+ /// <devdoc>
+ /// Specifies a hatch fill.
+ /// </devdoc>
+ HatchFill = BrushType.HatchFill,
+ /// <include file='doc\PenType.uex' path='docs/doc[@for="PenType.TextureFill"]/*' />
+ /// <devdoc>
+ /// Specifies a bitmap texture fill.
+ /// </devdoc>
+ TextureFill = BrushType.TextureFill,
+ /// <include file='doc\PenType.uex' path='docs/doc[@for="PenType.PathGradient"]/*' />
+ /// <devdoc>
+ /// Specifies a path gradient fill.
+ /// </devdoc>
+ PathGradient = BrushType.PathGradient,
+ /// <include file='doc\PenType.uex' path='docs/doc[@for="PenType.LinearGradient"]/*' />
+ /// <devdoc>
+ /// Specifies a linear gradient fill.
+ /// </devdoc>
+ LinearGradient = BrushType.LinearGradient,
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/PixelFormat.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/PixelFormat.cs
new file mode 100644
index 0000000000..84ac4a4aaf
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/PixelFormat.cs
@@ -0,0 +1,214 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ /*
+ * In-memory pixel data formats:
+ * bits 0-7 = format index
+ * bits 8-15 = pixel size (in bits)
+ * bits 16-23 = flags
+ * bits 24-31 = reserved
+ */
+
+ //
+ // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+ // XX XX
+ // XX If you modify this file, please update Image.GetColorDepth() XX
+ // XX XX
+ // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+ //
+ /// <include file='doc\PixelFormat.uex' path='docs/doc[@for="PixelFormat"]/*' />
+ /// <devdoc>
+ /// Specifies the format of the color data for
+ /// each pixel in the image.
+ /// </devdoc>
+ public enum PixelFormat
+ {
+ /// <include file='doc\PixelFormat.uex' path='docs/doc[@for="PixelFormat.Indexed"]/*' />
+ /// <devdoc>
+ /// Specifies that pixel data contains
+ /// color indexed values which means they are an index to colors in the system color
+ /// table, as opposed to individual color values.
+ /// </devdoc>
+ Indexed = 0x00010000,
+ /// <include file='doc\PixelFormat.uex' path='docs/doc[@for="PixelFormat.Gdi"]/*' />
+ /// <devdoc>
+ /// Specifies that pixel data contains GDI
+ /// colors.
+ /// </devdoc>
+ Gdi = 0x00020000,
+ /// <include file='doc\PixelFormat.uex' path='docs/doc[@for="PixelFormat.Alpha"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies that pixel data contains alpha values that are
+ /// not pre-multiplied.
+ /// </para>
+ /// </devdoc>
+ Alpha = 0x00040000,
+ /// <include file='doc\PixelFormat.uex' path='docs/doc[@for="PixelFormat.PAlpha"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies that pixel format contains pre-multipled alpha values.
+ /// </para>
+ /// </devdoc>
+ PAlpha = 0x00080000, // What's this?
+ /// <include file='doc\PixelFormat.uex' path='docs/doc[@for="PixelFormat.Extended"]/*' />
+ /// <devdoc>
+ /// Specifies that
+ /// </devdoc>
+ Extended = 0x00100000,
+ /// <include file='doc\PixelFormat.uex' path='docs/doc[@for="PixelFormat.Canonical"]/*' />
+ /// <devdoc>
+ /// Specifies that
+ /// </devdoc>
+ Canonical = 0x00200000,
+ /// <include file='doc\PixelFormat.uex' path='docs/doc[@for="PixelFormat.Undefined"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies that pixel format is undefined.
+ /// </para>
+ /// </devdoc>
+ Undefined = 0,
+ /// <include file='doc\PixelFormat.uex' path='docs/doc[@for="PixelFormat.DontCare"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies that pixel format is a don't care.
+ /// </para>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ DontCare = 0,
+ // makes it into devtools, we can change this.
+ /// <include file='doc\PixelFormat.uex' path='docs/doc[@for="PixelFormat.Format1bppIndexed"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies thatpixel format is 1 bit per pixel indexed
+ /// color. The color table therefore has two colors in it.
+ /// </para>
+ /// </devdoc>
+ Format1bppIndexed = 1 | (1 << 8) | (int)Indexed | (int)Gdi,
+ /// <include file='doc\PixelFormat.uex' path='docs/doc[@for="PixelFormat.Format4bppIndexed"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies that pixel format is 4 bits per pixel indexed
+ /// color. The color table therefore has 16 colors in it.
+ /// </para>
+ /// </devdoc>
+ Format4bppIndexed = 2 | (4 << 8) | (int)Indexed | (int)Gdi,
+ /// <include file='doc\PixelFormat.uex' path='docs/doc[@for="PixelFormat.Format8bppIndexed"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies that pixel format is 8 bits per pixel indexed
+ /// color. The color table therefore has 256 colors in it.
+ /// </para>
+ /// </devdoc>
+ Format8bppIndexed = 3 | (8 << 8) | (int)Indexed | (int)Gdi,
+ /// <include file='doc\PixelFormat.uex' path='docs/doc[@for="PixelFormat.Format16bppGrayScale"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Format16bppGrayScale = 4 | (16 << 8) | (int)Extended,
+ /// <include file='doc\PixelFormat.uex' path='docs/doc[@for="PixelFormat.Format16bppRgb555"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies that pixel format is 16 bits per pixel. The
+ /// color information specifies 65536 shades of gray.
+ /// </para>
+ /// </devdoc>
+ Format16bppRgb555 = 5 | (16 << 8) | (int)Gdi,
+ /// <include file='doc\PixelFormat.uex' path='docs/doc[@for="PixelFormat.Format16bppRgb565"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies that pixel format is 16 bits per pixel. The
+ /// color information specifies 32768 shades of color of which 5 bits are red, 5
+ /// bits are green and 5 bits are blue.
+ /// </para>
+ /// </devdoc>
+ Format16bppRgb565 = 6 | (16 << 8) | (int)Gdi,
+ /// <include file='doc\PixelFormat.uex' path='docs/doc[@for="PixelFormat.Format16bppArgb1555"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies that pixel format
+ /// is 16 bits per pixel. The color information specifies 32768
+ /// shades of color of which 5 bits are red, 5 bits are green, 5
+ /// bits are blue and 1 bit is alpha.
+ /// </para>
+ /// </devdoc>
+ Format16bppArgb1555 = 7 | (16 << 8) | (int)Alpha | (int)Gdi,
+ /// <include file='doc\PixelFormat.uex' path='docs/doc[@for="PixelFormat.Format24bppRgb"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies that pixel format is 24 bits per pixel. The
+ /// color information specifies 16777216 shades of color of which 8 bits are red, 8
+ /// bits are green and 8 bits are blue.
+ /// </para>
+ /// </devdoc>
+ Format24bppRgb = 8 | (24 << 8) | (int)Gdi,
+ /// <include file='doc\PixelFormat.uex' path='docs/doc[@for="PixelFormat.Format32bppRgb"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies that pixel format is 24 bits per pixel. The
+ /// color information specifies 16777216 shades of color of which 8 bits are red, 8
+ /// bits are green and 8 bits are blue.
+ /// </para>
+ /// </devdoc>
+ Format32bppRgb = 9 | (32 << 8) | (int)Gdi,
+ /// <include file='doc\PixelFormat.uex' path='docs/doc[@for="PixelFormat.Format32bppArgb"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies that pixel format is 32 bits per pixel. The
+ /// color information specifies 16777216 shades of color of which 8 bits are red, 8
+ /// bits are green and 8 bits are blue. The 8 additional bits are alpha bits.
+ /// </para>
+ /// </devdoc>
+ Format32bppArgb = 10 | (32 << 8) | (int)Alpha | (int)Gdi | (int)Canonical,
+ /// <include file='doc\PixelFormat.uex' path='docs/doc[@for="PixelFormat.Format32bppPArgb"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies that
+ /// pixel format is 32 bits per pixel. The color information
+ /// specifies 16777216 shades of color of which 8 bits are red, 8 bits are
+ /// green and 8 bits are blue. The 8 additional bits are pre-multiplied alpha bits. .
+ /// </para>
+ /// </devdoc>
+ Format32bppPArgb = 11 | (32 << 8) | (int)Alpha | (int)PAlpha | (int)Gdi,
+ /// <include file='doc\PixelFormat.uex' path='docs/doc[@for="PixelFormat.Format48bppRgb"]/*' />
+ /// <devdoc>
+ /// Specifies that pixel format is 48 bits per pixel.
+ /// The color information specifies 16777216 shades of color of which 8 bits are
+ /// red, 8 bits are green and 8 bits are blue. The 8 additional bits are alpha bits.
+ /// </devdoc>
+ Format48bppRgb = 12 | (48 << 8) | (int)Extended,
+ /// <include file='doc\PixelFormat.uex' path='docs/doc[@for="PixelFormat.Format64bppArgb"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies pixel format is 64 bits per pixel. The
+ /// color information specifies 16777216 shades of color of which 16 bits are red, 16
+ /// bits are green and 16 bits are blue. The 16 additional bits are alpha bits.
+ /// </para>
+ /// </devdoc>
+ Format64bppArgb = 13 | (64 << 8) | (int)Alpha | (int)Canonical | (int)Extended,
+ /// <include file='doc\PixelFormat.uex' path='docs/doc[@for="PixelFormat.Format64bppPArgb"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies that pixel format is 64 bits per pixel. The
+ /// color information specifies 16777216 shades of color of which 16 bits are red,
+ /// 16 bits are green and 16 bits are blue. The 16 additional bits are
+ /// pre-multiplied alpha bits.
+ /// </para>
+ /// </devdoc>
+ Format64bppPArgb = 14 | (64 << 8) | (int)Alpha | (int)PAlpha | (int)Extended,
+
+ /// <include file='doc\PixelFormat.uex' path='docs/doc[@for="PixelFormat.Max"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies that pixel format is 64 bits per pixel. The
+ /// color information specifies 16777216 shades of color of which 16 bits are red,
+ /// 16 bits are green and 16 bits are blue. The 16 additional bits are alpha bits.
+ /// </para>
+ /// </devdoc>
+ Max = 15,
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/PixelOffsetMode.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/PixelOffsetMode.cs
new file mode 100644
index 0000000000..ee02085767
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/PixelOffsetMode.cs
@@ -0,0 +1,48 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /// <include file='doc\PixelOffsetMode.uex' path='docs/doc[@for="PixelOffsetMode"]/*' />
+ /// <devdoc>
+ /// Specifies how pixels are offset during
+ /// rendering.
+ /// </devdoc>
+ public enum PixelOffsetMode
+ {
+ /// <include file='doc\PixelOffsetMode.uex' path='docs/doc[@for="PixelOffsetMode.Invalid"]/*' />
+ /// <devdoc>
+ /// Specifies an invalid mode.
+ /// </devdoc>
+ Invalid = QualityMode.Invalid,
+ /// <include file='doc\PixelOffsetMode.uex' path='docs/doc[@for="PixelOffsetMode.Default"]/*' />
+ /// <devdoc>
+ /// Specifies the default mode.
+ /// </devdoc>
+ Default = QualityMode.Default,
+ /// <include file='doc\PixelOffsetMode.uex' path='docs/doc[@for="PixelOffsetMode.HighSpeed"]/*' />
+ /// <devdoc>
+ /// Specifies high low quality (high
+ /// performance) mode.
+ /// </devdoc>
+ HighSpeed = QualityMode.Low,
+ /// <include file='doc\PixelOffsetMode.uex' path='docs/doc[@for="PixelOffsetMode.HighQuality"]/*' />
+ /// <devdoc>
+ /// Specifies high quality (lower performance)
+ /// mode.
+ /// </devdoc>
+ HighQuality = QualityMode.High,
+ /// <include file='doc\PixelOffsetMode.uex' path='docs/doc[@for="PixelOffsetMode.None"]/*' />
+ /// <devdoc>
+ /// Specifies no pixel offset.
+ /// </devdoc>
+ None, // no pixel offset
+ /// <include file='doc\PixelOffsetMode.uex' path='docs/doc[@for="PixelOffsetMode.Half"]/*' />
+ /// <devdoc>
+ /// Specifies that pixels are offset by -.5
+ /// units both horizontally and vertically for high performance anti-aliasing.
+ /// </devdoc>
+ Half // offset by -0.5, -0.5 for fast anti-alias perf
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/PlayRecordCallback.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/PlayRecordCallback.cs
new file mode 100644
index 0000000000..301e0b7808
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/PlayRecordCallback.cs
@@ -0,0 +1,16 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ /// <include file='doc\PlayRecordCAllback.uex' path='docs/doc[@for="PlayRecodCallBack"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public delegate void PlayRecordCallback(EmfPlusRecordType recordType,
+ int flags,
+ int dataSize,
+ IntPtr recordData);
+}
+
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/PrivateFontCollection.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/PrivateFontCollection.cs
new file mode 100644
index 0000000000..2fc0bfac6b
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/PrivateFontCollection.cs
@@ -0,0 +1,104 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Text
+{
+ using System.Diagnostics;
+ using System.Runtime.InteropServices;
+ using System.Globalization;
+
+ /// <include file='doc\PrivateFontCollection.uex' path='docs/doc[@for="PrivateFontCollection"]/*' />
+ /// <devdoc>
+ /// Encapsulates a collection of <see cref='System.Drawing.Font'/> objecs.
+ /// </devdoc>
+ public sealed class PrivateFontCollection : FontCollection
+ {
+ /// <include file='doc\PrivateFontCollection.uex' path='docs/doc[@for="PrivateFontCollection.PrivateFontCollection"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Text.PrivateFontCollection'/> class.
+ /// </para>
+ /// </devdoc>
+ public PrivateFontCollection()
+ {
+ nativeFontCollection = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipNewPrivateFontCollection(out nativeFontCollection);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\PrivateFontCollection.uex' path='docs/doc[@for="PrivateFontCollection.Dispose"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Cleans up Windows resources for this
+ /// <see cref='System.Drawing.Text.PrivateFontCollection'/> .
+ /// </para>
+ /// </devdoc>
+ protected override void Dispose(bool disposing)
+ {
+ if (nativeFontCollection != IntPtr.Zero)
+ {
+ try
+ {
+#if DEBUG
+ int status =
+#endif
+ SafeNativeMethods.Gdip.GdipDeletePrivateFontCollection(out nativeFontCollection);
+#if DEBUG
+ Debug.Assert(status == SafeNativeMethods.Gdip.Ok, "GDI+ returned an error status: " + status.ToString(CultureInfo.InvariantCulture));
+#endif
+ }
+ catch (Exception ex)
+ {
+ if (ClientUtils.IsSecurityOrCriticalException(ex))
+ {
+ throw;
+ }
+
+ Debug.Fail("Exception thrown during Dispose: " + ex.ToString());
+ }
+ finally
+ {
+ nativeFontCollection = IntPtr.Zero;
+ }
+ }
+
+ base.Dispose(disposing);
+ }
+
+ /// <include file='doc\PrivateFontCollection.uex' path='docs/doc[@for="PrivateFontCollection.AddFontFile"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a font from the specified file to
+ /// this <see cref='System.Drawing.Text.PrivateFontCollection'/>.
+ /// </para>
+ /// </devdoc>
+ public void AddFontFile(string filename)
+ {
+ int status = SafeNativeMethods.Gdip.GdipPrivateAddFontFile(new HandleRef(this, nativeFontCollection), filename);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ // Register private font with GDI as well so pure GDI-based controls (TextBox, Button for instance) can access it.
+ SafeNativeMethods.AddFontFile(filename);
+ }
+
+ /// <include file='doc\PrivateFontCollection.uex' path='docs/doc[@for="PrivateFontCollection.AddMemoryFont"]/*' />
+ /// <devdoc>
+ /// Adds a font contained in system memory to
+ /// this <see cref='System.Drawing.Text.PrivateFontCollection'/>.
+ /// </devdoc>
+ public void AddMemoryFont(IntPtr memory, int length)
+ {
+ int status = SafeNativeMethods.Gdip.GdipPrivateAddMemoryFont(new HandleRef(this, nativeFontCollection), new HandleRef(null, memory), length);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/PropertyItem.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/PropertyItem.cs
new file mode 100644
index 0000000000..63cc60d4b0
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/PropertyItem.cs
@@ -0,0 +1,62 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ // sdkinc\imaging.h
+ /// <include file='doc\PropertyItem.uex' path='docs/doc[@for="PropertyItem"]/*' />
+ /// <devdoc>
+ /// Encapsulates a metadata property to be
+ /// included in an image file.
+ /// </devdoc>
+ public sealed class PropertyItem
+ {
+ private int _id;
+ private int _len;
+ private short _type;
+ private byte[] _value;
+
+ internal PropertyItem()
+ {
+ }
+
+ /// <include file='doc\PropertyItem.uex' path='docs/doc[@for="PropertyItem.Id"]/*' />
+ /// <devdoc>
+ /// Represents the ID of the property.
+ /// </devdoc>
+ public int Id
+ {
+ get { return _id; }
+ set { _id = value; }
+ }
+ /// <include file='doc\PropertyItem.uex' path='docs/doc[@for="PropertyItem.Len"]/*' />
+ /// <devdoc>
+ /// Represents the length of the property.
+ /// </devdoc>
+ public int Len
+ {
+ get { return _len; }
+ set { _len = value; }
+ }
+ /// <include file='doc\PropertyItem.uex' path='docs/doc[@for="PropertyItem.Type"]/*' />
+ /// <devdoc>
+ /// Represents the type of the property.
+ /// </devdoc>
+ public short Type
+ {
+ get { return _type; }
+ set { _type = value; }
+ }
+ /// <include file='doc\PropertyItem.uex' path='docs/doc[@for="PropertyItem.Value"]/*' />
+ /// <devdoc>
+ /// Contains the property value.
+ /// </devdoc>
+ public byte[] Value
+ {
+ get { return _value; }
+ set { _value = value; }
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/QualityMode.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/QualityMode.cs
new file mode 100644
index 0000000000..07ef4b7916
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/QualityMode.cs
@@ -0,0 +1,39 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /// <include file='doc\QualityMode.uex' path='docs/doc[@for="QualityMode"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the overall quality of rendering
+ /// of graphics shapes.
+ /// </para>
+ /// </devdoc>
+ public enum QualityMode
+ {
+ /// <include file='doc\QualityMode.uex' path='docs/doc[@for="QualityMode.Invalid"]/*' />
+ /// <devdoc>
+ /// Specifies an invalid mode.
+ /// </devdoc>
+ Invalid = -1,
+ /// <include file='doc\QualityMode.uex' path='docs/doc[@for="QualityMode.Default"]/*' />
+ /// <devdoc>
+ /// Specifies the default mode.
+ /// </devdoc>
+ Default = 0,
+ /// <include file='doc\QualityMode.uex' path='docs/doc[@for="QualityMode.Low"]/*' />
+ /// <devdoc>
+ /// Specifies low quality, high performance
+ /// rendering.
+ /// </devdoc>
+ Low = 1, // for apps that need the best performance
+ /// <include file='doc\QualityMode.uex' path='docs/doc[@for="QualityMode.High"]/*' />
+ /// <devdoc>
+ /// Specifies high quality, lower performance
+ /// rendering.
+ /// </devdoc>
+ High = 2 // for apps that need the best rendering quality
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/RectangleFEx.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/RectangleFEx.cs
new file mode 100644
index 0000000000..16cf97b958
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/RectangleFEx.cs
@@ -0,0 +1,14 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Internal
+{
+ internal static class RectangleFEx
+ {
+ public static GPRECTF ToGPRECTF(this RectangleF rect)
+ {
+ return new GPRECTF(rect.X, rect.Y, rect.Width, rect.Height);
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/RegionData.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/RegionData.cs
new file mode 100644
index 0000000000..a6f3094cc5
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/RegionData.cs
@@ -0,0 +1,40 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /// <include file='doc\RegionData.uex' path='docs/doc[@for="RegionData"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Encapsulates the data that makes up a <see cref='System.Drawing.Region'/>.
+ /// </para>
+ /// </devdoc>
+ public sealed class RegionData
+ {
+ private byte[] _data;
+
+ internal RegionData(byte[] data)
+ {
+ _data = data;
+ }
+
+ /// <include file='doc\RegionData.uex' path='docs/doc[@for="RegionData.Data"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// An array of characters that contain the data that makes up a <see cref='System.Drawing.Region'/>.
+ /// </para>
+ /// </devdoc>
+ public byte[] Data
+ {
+ get
+ {
+ return _data;
+ }
+ set
+ {
+ _data = value;
+ }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/SafeCustomLineCapHandle.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/SafeCustomLineCapHandle.cs
new file mode 100644
index 0000000000..e2326e995d
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/SafeCustomLineCapHandle.cs
@@ -0,0 +1,69 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ using System.Diagnostics;
+ using System.Globalization;
+ using System.Runtime.InteropServices;
+ using System.Security;
+
+ [SecurityCritical]
+ internal class SafeCustomLineCapHandle : SafeHandle
+ {
+ // Create a SafeHandle, informing the base class
+ // that this SafeHandle instance "owns" the handle,
+ // and therefore SafeHandle should call
+ // our ReleaseHandle method when the SafeHandle
+ // is no longer in use.
+ internal SafeCustomLineCapHandle(IntPtr h)
+ : base(IntPtr.Zero, true)
+ {
+ SetHandle(h);
+ }
+
+ [SecurityCritical]
+ override protected bool ReleaseHandle()
+ {
+ int status = SafeNativeMethods.Gdip.Ok;
+ if (!IsInvalid)
+ {
+ try
+ {
+ status = SafeNativeMethods.Gdip.GdipDeleteCustomLineCap(new HandleRef(this, handle));
+ }
+ catch (Exception ex)
+ {
+ if (ClientUtils.IsSecurityOrCriticalException(ex))
+ {
+ throw;
+ }
+
+ Debug.Fail("Exception thrown during ReleaseHandle: " + ex.ToString());
+ }
+ finally
+ {
+ handle = IntPtr.Zero;
+ }
+ Debug.Assert(status == SafeNativeMethods.Gdip.Ok, "GDI+ returned an error status: " + status.ToString(CultureInfo.InvariantCulture));
+ }
+ return status == SafeNativeMethods.Gdip.Ok;
+ }
+
+ public override bool IsInvalid
+ {
+ get { return handle == IntPtr.Zero; }
+ }
+
+ public static implicit operator IntPtr(SafeCustomLineCapHandle handle)
+ {
+ return (handle == null) ? IntPtr.Zero : handle.handle;
+ }
+
+ public static explicit operator SafeCustomLineCapHandle(IntPtr handle)
+ {
+ return new SafeCustomLineCapHandle(handle);
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/SmoothingMode.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/SmoothingMode.cs
new file mode 100644
index 0000000000..c573e143d6
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/SmoothingMode.cs
@@ -0,0 +1,55 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /// <include file='doc\SmoothingMode.uex' path='docs/doc[@for="SmoothingMode"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the overall quality of rendering of graphics
+ /// shapes.
+ /// </para>
+ /// </devdoc>
+ public enum SmoothingMode
+ {
+ /// <include file='doc\SmoothingMode.uex' path='docs/doc[@for="SmoothingMode.Invalid"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies an invalid mode.
+ /// </para>
+ /// </devdoc>
+ Invalid = QualityMode.Invalid,
+ /// <include file='doc\SmoothingMode.uex' path='docs/doc[@for="SmoothingMode.Default"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the default mode.
+ /// </para>
+ /// </devdoc>
+ Default = QualityMode.Default,
+ /// <include file='doc\SmoothingMode.uex' path='docs/doc[@for="SmoothingMode.HighSpeed"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies low quality, high performance rendering.
+ /// </para>
+ /// </devdoc>
+ HighSpeed = QualityMode.Low,
+ /// <include file='doc\SmoothingMode.uex' path='docs/doc[@for="SmoothingMode.HighQuality"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies high quality, lower performance rendering.
+ /// </para>
+ /// </devdoc>
+ HighQuality = QualityMode.High,
+ /// <include file='doc\SmoothingMode.uex' path='docs/doc[@for="SmoothingMode.None"]/*' />
+ /// <devdoc>
+ /// Specifies no anti-aliasing.
+ /// </devdoc>
+ None,
+ /// <include file='doc\SmoothingMode.uex' path='docs/doc[@for="SmoothingMode.AntiAlias"]/*' />
+ /// <devdoc>
+ /// Specifies anti-aliased rendering.
+ /// </devdoc>
+ AntiAlias
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/StringAlignment.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/StringAlignment.cs
new file mode 100644
index 0000000000..ec2c65164e
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/StringAlignment.cs
@@ -0,0 +1,45 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ /**
+ * used for both vertical and horizontal alignment.
+ */
+ /// <include file='doc\StringAlignment.uex' path='docs/doc[@for="StringAlignment"]/*' />
+ /// <devdoc>
+ /// Specifies the alignment of a text string
+ /// relative to its layout rectangle.
+ /// </devdoc>
+ public enum StringAlignment
+ {
+ // left or top in English
+ /// <include file='doc\StringAlignment.uex' path='docs/doc[@for="StringAlignment.Near"]/*' />
+ /// <devdoc>
+ /// Specifies the text be aligned near the
+ /// layout. In a left-to-right layout, the near position is left. In a right-to-left
+ /// layout, the near position is right.
+ /// </devdoc>
+ Near = 0,
+
+ /// <include file='doc\StringAlignment.uex' path='docs/doc[@for="StringAlignment.Center"]/*' />
+ /// <devdoc>
+ /// Specifies that text is aligned in the
+ /// center of the layout rectangle.
+ /// </devdoc>
+ Center = 1,
+
+ // NO ALTERNATE SPELLINGS!
+ // Centre = 1,
+
+ // right or bottom in English
+ /// <include file='doc\StringAlignment.uex' path='docs/doc[@for="StringAlignment.Far"]/*' />
+ /// <devdoc>
+ /// Specifies that text is aligned far from the
+ /// origin position of the layout rectangle. In a left-to-right layout, the far
+ /// position is right. In a right-to-left layout, the far position is left.
+ /// </devdoc>
+ Far = 2
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/StringDigitSubstitute.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/StringDigitSubstitute.cs
new file mode 100644
index 0000000000..500f76a766
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/StringDigitSubstitute.cs
@@ -0,0 +1,39 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+// font style constants (sdkinc\GDIplusEnums.h)
+
+namespace System.Drawing
+{
+ /// <include file='doc\StringDigitSubstitute.uex' path='docs/doc[@for="StringDigitSubstitute"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies style information applied to
+ /// String Digit Substitute.
+ /// </para>
+ /// </devdoc>
+ public enum StringDigitSubstitute
+ {
+ /// <include file='doc\StringDigitSubstitute.uex' path='docs/doc[@for="StringDigitSubstitute.User"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ User = 0, // As NLS setting
+ /// <include file='doc\StringDigitSubstitute.uex' path='docs/doc[@for="StringDigitSubstitute.None"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ None = 1,
+ /// <include file='doc\StringDigitSubstitute.uex' path='docs/doc[@for="StringDigitSubstitute.National"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ National = 2,
+ /// <include file='doc\StringDigitSubstitute.uex' path='docs/doc[@for="StringDigitSubstitute.Traditional"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Traditional = 3
+ };
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/StringFormat.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/StringFormat.cs
new file mode 100644
index 0000000000..e737d7c1f8
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/StringFormat.cs
@@ -0,0 +1,575 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.Diagnostics;
+ using System.ComponentModel;
+ using System.Drawing.Text;
+ using System.Runtime.InteropServices;
+ using System.Globalization;
+
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="CharacterRange"]/*' />
+ [StructLayout(LayoutKind.Sequential)]
+ public struct CharacterRange
+ {
+ private int _first;
+ private int _length;
+
+ /**
+ * Create a new CharacterRange object
+ */
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="CharacterRange.CharacterRange"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.CharacterRange'/> class
+ /// with the specified coordinates.
+ /// </para>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public CharacterRange(int First, int Length)
+ {
+ _first = First;
+ _length = Length;
+ }
+
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="CharacterRange.First"]/*' />
+ /// <devdoc>
+ /// Gets the First character position of this <see cref='System.Drawing.CharacterRange'/>.
+ /// </devdoc>
+ public int First
+ {
+ get
+ {
+ return _first;
+ }
+ set
+ {
+ _first = value;
+ }
+ }
+
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="CharacterRange.Length"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the Length of this <see cref='System.Drawing.CharacterRange'/>.
+ /// </para>
+ /// </devdoc>
+ public int Length
+ {
+ get
+ {
+ return _length;
+ }
+ set
+ {
+ _length = value;
+ }
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (obj.GetType() != typeof(CharacterRange))
+ return false;
+
+ CharacterRange cr = (CharacterRange)obj;
+ return ((_first == cr.First) && (_length == cr.Length));
+ }
+
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="CharacterRange.EqualOperator"]/*' />
+ public static bool operator ==(CharacterRange cr1, CharacterRange cr2)
+ {
+ return ((cr1.First == cr2.First) && (cr1.Length == cr2.Length));
+ }
+
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="CharacterRange.InequalOperator"]/*' />
+ public static bool operator !=(CharacterRange cr1, CharacterRange cr2)
+ {
+ return !(cr1 == cr2);
+ }
+
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="CharacterRange.GetHashCode"]/*' />
+ public override int GetHashCode()
+ {
+ return unchecked(_first << 8 + _length);
+ }
+ }
+
+ /**
+ * Represent a Stringformat object
+ */
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="StringFormat"]/*' />
+ /// <devdoc>
+ /// Encapsulates text layout information (such
+ /// as alignment and linespacing), display manipulations (such as ellipsis insertion
+ /// and national digit substitution) and OpenType features.
+ /// </devdoc>
+ public sealed class StringFormat : MarshalByRefObject, ICloneable, IDisposable
+ {
+ internal IntPtr nativeFormat;
+
+ private StringFormat(IntPtr format)
+ {
+ nativeFormat = format;
+ }
+
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="StringFormat.StringFormat"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.StringFormat'/>
+ /// class.
+ /// </devdoc>
+ public StringFormat() : this(0, 0)
+ {
+ }
+
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="StringFormat.StringFormat1"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.StringFormat'/>
+ /// class with the specified <see cref='System.Drawing.StringFormatFlags'/>.
+ /// </devdoc>
+ public StringFormat(StringFormatFlags options) :
+ this(options, 0)
+ {
+ }
+
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="StringFormat.StringFormat2"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.StringFormat'/>
+ /// class with the specified <see cref='System.Drawing.StringFormatFlags'/> and language.
+ /// </devdoc>
+ public StringFormat(StringFormatFlags options, int language)
+ {
+ int status = SafeNativeMethods.Gdip.GdipCreateStringFormat(options, language, out nativeFormat);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="StringFormat.StringFormat3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.StringFormat'/> class from the specified
+ /// existing <see cref='System.Drawing.StringFormat'/>.
+ /// </para>
+ /// </devdoc>
+ public StringFormat(StringFormat format)
+ {
+ if (format == null)
+ {
+ throw new ArgumentNullException("format");
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipCloneStringFormat(new HandleRef(format, format.nativeFormat), out nativeFormat);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="StringFormat.Dispose"]/*' />
+ /// <devdoc>
+ /// Cleans up Windows resources for this
+ /// <see cref='System.Drawing.StringFormat'/>.
+ /// </devdoc>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="StringFormat.Dispose2"]/*' />
+ private void Dispose(bool disposing)
+ {
+ if (nativeFormat != IntPtr.Zero)
+ {
+ try
+ {
+#if DEBUG
+ int status =
+#endif
+ SafeNativeMethods.Gdip.GdipDeleteStringFormat(new HandleRef(this, nativeFormat));
+#if DEBUG
+ Debug.Assert(status == SafeNativeMethods.Gdip.Ok, "GDI+ returned an error status: " + status.ToString(CultureInfo.InvariantCulture));
+#endif
+ }
+ catch (Exception ex)
+ {
+ if (ClientUtils.IsCriticalException(ex))
+ {
+ throw;
+ }
+
+ Debug.Fail("Exception thrown during Dispose: " + ex.ToString());
+ }
+ finally
+ {
+ nativeFormat = IntPtr.Zero;
+ }
+ }
+ }
+
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="StringFormat.Clone"]/*' />
+ /// <devdoc>
+ /// Creates an exact copy of this <see cref='System.Drawing.StringFormat'/>.
+ /// </devdoc>
+ public object Clone()
+ {
+ IntPtr cloneFormat = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCloneStringFormat(new HandleRef(this, nativeFormat), out cloneFormat);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ StringFormat newCloneStringFormat = new StringFormat(cloneFormat);
+
+ return newCloneStringFormat;
+ }
+
+
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="StringFormat.FormatFlags"]/*' />
+ /// <devdoc>
+ /// Gets or sets a <see cref='System.Drawing.StringFormatFlags'/> that contains formatting information.
+ /// </devdoc>
+ public StringFormatFlags FormatFlags
+ {
+ get
+ {
+ StringFormatFlags format;
+
+ int status = SafeNativeMethods.Gdip.GdipGetStringFormatFlags(new HandleRef(this, nativeFormat), out format);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return format;
+ }
+ set
+ {
+ Debug.Assert(nativeFormat != IntPtr.Zero, "NativeFormat is null!");
+ int status = SafeNativeMethods.Gdip.GdipSetStringFormatFlags(new HandleRef(this, nativeFormat), value);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="StringFormat.SetMeasurableCharacterRanges"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Sets the measure of characters to the specified
+ /// range.
+ /// </para>
+ /// </devdoc>
+ public void SetMeasurableCharacterRanges(CharacterRange[] ranges)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetStringFormatMeasurableCharacterRanges(new HandleRef(this, nativeFormat), ranges.Length, ranges);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ // For English, this is horizontal alignment
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="StringFormat.Alignment"]/*' />
+ /// <devdoc>
+ /// Specifies text alignment information.
+ /// </devdoc>
+ public StringAlignment Alignment
+ {
+ get
+ {
+ StringAlignment alignment = 0;
+ Debug.Assert(nativeFormat != IntPtr.Zero, "NativeFormat is null!");
+ int status = SafeNativeMethods.Gdip.GdipGetStringFormatAlign(new HandleRef(this, nativeFormat), out alignment);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return alignment;
+ }
+ set
+ {
+ //valid values are 0x0 to 0x2
+ if (!ClientUtils.IsEnumValid(value, unchecked((int)value), (int)StringAlignment.Near, (int)StringAlignment.Far))
+ {
+ throw new InvalidEnumArgumentException("value", unchecked((int)value), typeof(StringAlignment));
+ }
+
+ Debug.Assert(nativeFormat != IntPtr.Zero, "NativeFormat is null!");
+ int status = SafeNativeMethods.Gdip.GdipSetStringFormatAlign(new HandleRef(this, nativeFormat), value);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ // For English, this is vertical alignment
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="StringFormat.LineAlignment"]/*' />
+ /// <devdoc>
+ /// Gets or sets the line alignment.
+ /// </devdoc>
+ public StringAlignment LineAlignment
+ {
+ get
+ {
+ StringAlignment alignment = 0;
+ Debug.Assert(nativeFormat != IntPtr.Zero, "NativeFormat is null!");
+ int status = SafeNativeMethods.Gdip.GdipGetStringFormatLineAlign(new HandleRef(this, nativeFormat), out alignment);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return alignment;
+ }
+ set
+ {
+ if (value < 0 || value > StringAlignment.Far)
+ {
+ throw new InvalidEnumArgumentException("value", unchecked((int)value), typeof(StringAlignment));
+ }
+
+ Debug.Assert(nativeFormat != IntPtr.Zero, "NativeFormat is null!");
+ int status = SafeNativeMethods.Gdip.GdipSetStringFormatLineAlign(new HandleRef(this, nativeFormat), value);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="StringFormat.HotkeyPrefix"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets the <see cref='System.Drawing.StringFormat.HotkeyPrefix'/> for this <see cref='System.Drawing.StringFormat'/> .
+ /// </para>
+ /// </devdoc>
+ public HotkeyPrefix HotkeyPrefix
+ {
+ get
+ {
+ HotkeyPrefix hotkeyPrefix;
+ Debug.Assert(nativeFormat != IntPtr.Zero, "NativeFormat is null!");
+ int status = SafeNativeMethods.Gdip.GdipGetStringFormatHotkeyPrefix(new HandleRef(this, nativeFormat), out hotkeyPrefix);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return hotkeyPrefix;
+ }
+ set
+ {
+ //valid values are 0x0 to 0x2
+ if (!ClientUtils.IsEnumValid(value, unchecked((int)value), (int)HotkeyPrefix.None, (int)HotkeyPrefix.Hide))
+ {
+ throw new InvalidEnumArgumentException("value", unchecked((int)value), typeof(HotkeyPrefix));
+ }
+
+ Debug.Assert(nativeFormat != IntPtr.Zero, "NativeFormat is null!");
+ int status = SafeNativeMethods.Gdip.GdipSetStringFormatHotkeyPrefix(new HandleRef(this, nativeFormat), value);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="StringFormat.SetTabStops"]/*' />
+ /// <devdoc>
+ /// Sets tab stops for this <see cref='System.Drawing.StringFormat'/>.
+ /// </devdoc>
+ public void SetTabStops(float firstTabOffset, float[] tabStops)
+ {
+ if (firstTabOffset < 0)
+ throw new ArgumentException(SR.Format(SR.InvalidArgument, "firstTabOffset", firstTabOffset));
+
+ int status = SafeNativeMethods.Gdip.GdipSetStringFormatTabStops(new HandleRef(this, nativeFormat), firstTabOffset, tabStops.Length, tabStops);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="StringFormat.GetTabStops"]/*' />
+ /// <devdoc>
+ /// Gets the tab stops for this <see cref='System.Drawing.StringFormat'/>.
+ /// </devdoc>
+ public float[] GetTabStops(out float firstTabOffset)
+ {
+ int count = 0;
+ int status = SafeNativeMethods.Gdip.GdipGetStringFormatTabStopCount(new HandleRef(this, nativeFormat), out count);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ float[] tabStops = new float[count];
+ status = SafeNativeMethods.Gdip.GdipGetStringFormatTabStops(new HandleRef(this, nativeFormat), count, out firstTabOffset, tabStops);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return tabStops;
+ }
+
+
+ // String trimming. How to handle more text than can be displayed
+ // in the limits available.
+
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="StringFormat.Trimming"]/*' />
+ /// <devdoc>
+ /// Gets or sets the <see cref='System.Drawing.StringTrimming'/>
+ /// for this <see cref='System.Drawing.StringFormat'/>.
+ /// </devdoc>
+ public StringTrimming Trimming
+ {
+ get
+ {
+ StringTrimming trimming;
+ int status = SafeNativeMethods.Gdip.GdipGetStringFormatTrimming(new HandleRef(this, nativeFormat), out trimming);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ return trimming;
+ }
+
+ set
+ {
+ //valid values are 0x0 to 0x5
+ if (!ClientUtils.IsEnumValid(value, unchecked((int)value), (int)StringTrimming.None, (int)StringTrimming.EllipsisPath))
+ {
+ throw new InvalidEnumArgumentException("value", unchecked((int)value), typeof(StringTrimming));
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipSetStringFormatTrimming(new HandleRef(this, nativeFormat), value);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="StringFormat.GenericDefault"]/*' />
+ /// <devdoc>
+ /// Gets a generic default <see cref='System.Drawing.StringFormat'/>.
+ /// Remarks from MSDN: A generic, default StringFormat object has the following characteristics:
+ /// - No string format flags are set.
+ /// - Character alignment and line alignment are set to StringAlignmentNear.
+ /// - Language ID is set to neutral language, which means that the current language associated with the calling thread is used.
+ /// - String digit substitution is set to StringDigitSubstituteUser.
+ /// - Hot key prefix is set to HotkeyPrefixNone.
+ /// - Number of tab stops is set to zero.
+ /// - String trimming is set to StringTrimmingCharacter.
+ /// </devdoc>
+ public static StringFormat GenericDefault
+ {
+ get
+ {
+ IntPtr format;
+ int status = SafeNativeMethods.Gdip.GdipStringFormatGetGenericDefault(out format);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return new StringFormat(format);
+ }
+ }
+
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="StringFormat.GenericTypographic"]/*' />
+ /// <devdoc>
+ /// Gets a generic typographic <see cref='System.Drawing.StringFormat'/>.
+ /// Remarks from MSDN: A generic, typographic StringFormat object has the following characteristics:
+ /// - String format flags StringFormatFlagsLineLimit, StringFormatFlagsNoClip, and StringFormatFlagsNoFitBlackBox are set.
+ /// - Character alignment and line alignment are set to StringAlignmentNear.
+ /// - Language ID is set to neutral language, which means that the current language associated with the calling thread is used.
+ /// - String digit substitution is set to StringDigitSubstituteUser.
+ /// - Hot key prefix is set to HotkeyPrefixNone.
+ /// - Number of tab stops is set to zero.
+ /// - String trimming is set to StringTrimmingNone.
+ /// </devdoc>
+ public static StringFormat GenericTypographic
+ {
+ get
+ {
+ IntPtr format;
+ int status = SafeNativeMethods.Gdip.GdipStringFormatGetGenericTypographic(out format);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return new StringFormat(format);
+ }
+ }
+
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="StringFormat.SetDigitSubstitution"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void SetDigitSubstitution(int language, StringDigitSubstitute substitute)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetStringFormatDigitSubstitution(new HandleRef(this, nativeFormat), language, substitute);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="StringFormat.DigitSubstitutionMethod"]/*' />
+ /// <devdoc>
+ /// Gets the <see cref='System.Drawing.StringDigitSubstitute'/>
+ /// for this <see cref='System.Drawing.StringFormat'/>.
+ /// </devdoc>
+ public StringDigitSubstitute DigitSubstitutionMethod
+ {
+ get
+ {
+ StringDigitSubstitute digitSubstitute;
+ int lang = 0;
+
+ int status = SafeNativeMethods.Gdip.GdipGetStringFormatDigitSubstitution(new HandleRef(this, nativeFormat), out lang, out digitSubstitute);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return digitSubstitute;
+ }
+ }
+
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="StringFormat.DigitSubstitutionLanguage"]/*' />
+ /// <devdoc>
+ /// Gets the language of <see cref='System.Drawing.StringDigitSubstitute'/>
+ /// for this <see cref='System.Drawing.StringFormat'/>.
+ /// </devdoc>
+ public int DigitSubstitutionLanguage
+ {
+ get
+ {
+ StringDigitSubstitute digitSubstitute;
+ int language = 0;
+ int status = SafeNativeMethods.Gdip.GdipGetStringFormatDigitSubstitution(new HandleRef(this, nativeFormat), out language, out digitSubstitute);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return language;
+ }
+ }
+
+ /**
+ * Object cleanup
+ */
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="StringFormat.Finalize"]/*' />
+ /// <devdoc>
+ /// Cleans up Windows resources for this
+ /// <see cref='System.Drawing.StringFormat'/>.
+ /// </devdoc>
+ ~StringFormat()
+ {
+ Dispose(false);
+ }
+
+ /// <include file='doc\StringFormat.uex' path='docs/doc[@for="StringFormat.ToString"]/*' />
+ /// <devdoc>
+ /// Converts this <see cref='System.Drawing.StringFormat'/> to
+ /// a human-readable string.
+ /// </devdoc>
+ public override string ToString()
+ {
+ return "[StringFormat, FormatFlags=" + FormatFlags.ToString() + "]";
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/StringFormatFlags.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/StringFormatFlags.cs
new file mode 100644
index 0000000000..4cd31cccc8
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/StringFormatFlags.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ /// <include file='doc\StringFormatFlags.uex' path='docs/doc[@for="StringFormatFlags"]/*' />
+ /// <devdoc>
+ /// Specifies the display and layout
+ /// information for text strings.
+ /// </devdoc>
+ [Flags()]
+ public enum StringFormatFlags
+ {
+ /// <include file='doc\StringFormatFlags.uex' path='docs/doc[@for="StringFormatFlags.DirectionRightToLeft"]/*' />
+ /// <devdoc>
+ /// Specifies that text is right to left.
+ /// </devdoc>
+ DirectionRightToLeft = 0x00000001,
+
+ /// <include file='doc\StringFormatFlags.uex' path='docs/doc[@for="StringFormatFlags.DirectionVertical"]/*' />
+ /// <devdoc>
+ /// Specifies that text is vertical.
+ /// </devdoc>
+ DirectionVertical = 0x00000002,
+
+ /// <include file='doc\StringFormatFlags.uex' path='docs/doc[@for="StringFormatFlags.FitBlackBox"]/*' />
+ /// <devdoc>
+ /// Specifies that no part of any glyph
+ /// overhangs the bounding rectangle. By default some glyphs overhang the rectangle
+ /// slightly where necessary to appear at the edge visually. For example when an
+ /// italic lower case letter f in a font such as Garamond is aligned at the far left
+ /// of a rectangle, the lower part of the f will reach slightly further left than
+ /// the left edge of the rectangle. Setting this flag will ensure no painting
+ /// outside the rectangle but will cause the aligned edges of adjacent lines of text
+ /// to appear uneven.
+ ///
+ /// WARNING:
+ /// The GDI+ equivalent for this is StringFormatFlags::StringFormatFlagsNoFitBlackBox,
+ /// which is defined as 0x4. This was a mistake introduced since the first version of
+ /// the product and fixing it at this point would be a breaking change.
+ /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdicpp/GDIPlus/GDIPlusreference/enumerations/stringformatflags.asp,
+ /// See also VSWhidbey#434198.
+ /// </devdoc>
+ FitBlackBox = 0x00000004,
+
+ /// <include file='doc\StringFormatFlags.uex' path='docs/doc[@for="StringFormatFlags.DisplayFormatControl"]/*' />
+ /// <devdoc>
+ /// Causes control characters such as the
+ /// left-to-right mark to be shown in the output with a representative glyph.
+ /// </devdoc>
+ DisplayFormatControl = 0x00000020,
+
+ /// <include file='doc\StringFormatFlags.uex' path='docs/doc[@for="StringFormatFlags.NoFontFallback"]/*' />
+ /// <devdoc>
+ /// Disables fallback to alternate fonts for
+ /// characters not supported in the requested font. Any missing characters are
+ /// displayed with the fonts missing glyph, usually an open square.
+ /// </devdoc>
+ NoFontFallback = 0x00000400,
+
+ /// <include file='doc\StringFormatFlags.uex' path='docs/doc[@for="StringFormatFlags.MeasureTrailingSpaces"]/*' />
+ /// <devdoc>
+ /// Specifies that the space at the end of each line is included in a string measurement.
+ /// </devdoc>
+ MeasureTrailingSpaces = 0x00000800,
+
+ /// <include file='doc\StringFormatFlags.uex' path='docs/doc[@for="StringFormatFlags.NoWrap"]/*' />
+ /// <devdoc>
+ /// Specifies that the wrapping of text to the next line is disabled. NoWrap is implied
+ /// when a point of origin is used instead of a layout rectangle. When drawing text within
+ /// a rectangle, by default, text is broken at the last word boundary that is inside the
+ /// rectangle's boundary and wrapped to the next line.
+ /// </devdoc>
+ NoWrap = 0x00001000,
+
+ /// <include file='doc\StringFormatFlags.uex' path='docs/doc[@for="StringFormatFlags.LineLimit"]/*' />
+ /// <devdoc>
+ /// Specifies that only entire lines are laid out in the layout rectangle. By default, layout
+ /// continues until the end of the text or until no more lines are visible as a result of clipping,
+ /// whichever comes first. The default settings allow the last line to be partially obscured by a
+ /// layout rectangle that is not a whole multiple of the line height.
+ /// To ensure that only whole lines are seen, set this flag and be careful to provide a layout
+ /// rectangle at least as tall as the height of one line.
+ /// </devdoc>
+ LineLimit = 0x00002000,
+
+ /// <include file='doc\StringFormatFlags.uex' path='docs/doc[@for="StringFormatFlags.NoClip"]/*' />
+ /// <devdoc>
+ /// Specifies that characters overhanging the layout rectangle and text extending outside the layout
+ /// rectangle are allowed to show. By default, all overhanging characters and text that extends outside
+ /// the layout rectangle are clipped. Any trailing spaces (spaces that are at the end of a line) that
+ /// extend outside the layout rectangle are clipped. Therefore, the setting of this flag will have an
+ /// effect on a string measurement if trailing spaces are being included in the measurement.
+ /// If clipping is enabled, trailing spaces that extend outside the layout rectangle are not included
+ /// in the measurement. If clipping is disabled, all trailing spaces are included in the measurement,
+ /// regardless of whether they are outside the layout rectangle.
+ /// </devdoc>
+ NoClip = 0x00004000
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/StringTrimming.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/StringTrimming.cs
new file mode 100644
index 0000000000..c38638311a
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/StringTrimming.cs
@@ -0,0 +1,56 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ /// <include file='doc\StringTrimming.uex' path='docs/doc[@for="StringTrimming"]/*' />
+ /// <devdoc>
+ /// Specifies how to trim characters from a
+ /// string that does not completely fit into a layout shape.
+ /// </devdoc>
+ public enum StringTrimming
+ {
+ /// <include file='doc\StringTrimming.uex' path='docs/doc[@for="StringTrimming.None"]/*' />
+ /// <devdoc>
+ /// Specifies no trimming.
+ /// </devdoc>
+ None = 0,
+
+ /// <include file='doc\StringTrimming.uex' path='docs/doc[@for="StringTrimming.Character"]/*' />
+ /// <devdoc>
+ /// Specifies that the string is broken at the boundary of the last character that is
+ /// inside the layout rectangle. This is the default.
+ /// </devdoc>
+ Character = 1,
+
+ /// <include file='doc\StringTrimming.uex' path='docs/doc[@for="StringTrimming.Word"]/*' />
+ /// <devdoc>
+ /// Specifies that the string is broken at the boundary of the last word that is inside
+ /// the layout rectangle.
+ /// </devdoc>
+ Word = 2,
+
+ /// <include file='doc\StringTrimming.uex' path='docs/doc[@for="StringTrimming.EllipsisCharacter"]/*' />
+ /// <devdoc>
+ /// Specifies that the string is broken at the boundary of the last character that is inside
+ /// the layout rectangle and an ellipsis (...) is inserted after the character.
+ /// </devdoc>
+ EllipsisCharacter = 3,
+
+ /// <include file='doc\StringTrimming.uex' path='docs/doc[@for="StringTrimming.EllipsisWord"]/*' />
+ /// <devdoc>
+ /// Specifies that the string is broken at the boundary of the last word that is inside the
+ /// layout rectangle and an ellipsis (...) is inserted after the word.
+ /// </devdoc>
+ EllipsisWord = 4,
+
+ /// <include file='doc\StringTrimming.uex' path='docs/doc[@for="StringTrimming.EllipsisPath"]/*' />
+ /// <devdoc>
+ /// Specifies that the center is removed from the string and replaced by an ellipsis.
+ /// The algorithm keeps as much of the last portion of the string as possible.
+ /// </devdoc>
+ EllipsisPath = 5
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/StringUnit.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/StringUnit.cs
new file mode 100644
index 0000000000..05a15acfed
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/StringUnit.cs
@@ -0,0 +1,69 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ /**
+ * used for both vertical and horizontal alignment.
+ */
+ /// <include file='doc\StringUnit.uex' path='docs/doc[@for="StringUnit"]/*' />
+ /// <devdoc>
+ /// Specifies the units of measure for a text
+ /// string.
+ /// </devdoc>
+ public enum StringUnit
+ {
+ /// <include file='doc\StringUnit.uex' path='docs/doc[@for="StringUnit.World"]/*' />
+ /// <devdoc>
+ /// Specifies world units as the unit of
+ /// measure.
+ /// </devdoc>
+ World = GraphicsUnit.World,
+ /// <include file='doc\StringUnit.uex' path='docs/doc[@for="StringUnit.Display"]/*' />
+ /// <devdoc>
+ /// Specifies the device unit as the unit of
+ /// measure.
+ /// </devdoc>
+ Display = GraphicsUnit.Display,
+ /// <include file='doc\StringUnit.uex' path='docs/doc[@for="StringUnit.Pixel"]/*' />
+ /// <devdoc>
+ /// Specifies a pixel as the unit of measure.
+ /// </devdoc>
+ Pixel = GraphicsUnit.Pixel,
+ /// <include file='doc\StringUnit.uex' path='docs/doc[@for="StringUnit.Point"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies a printer's point as the unit of measure.
+ /// </para>
+ /// </devdoc>
+ Point = GraphicsUnit.Point,
+ /// <include file='doc\StringUnit.uex' path='docs/doc[@for="StringUnit.Inch"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies an inch as the unit of measure.
+ /// </para>
+ /// </devdoc>
+ Inch = GraphicsUnit.Inch,
+ /// <include file='doc\StringUnit.uex' path='docs/doc[@for="StringUnit.Document"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies 1/300 of an inch as the unit of measure.
+ /// </para>
+ /// </devdoc>
+ Document = GraphicsUnit.Document,
+ /// <include file='doc\StringUnit.uex' path='docs/doc[@for="StringUnit.Millimeter"]/*' />
+ /// <devdoc>
+ /// Specifies a millimeter as the unit of
+ /// measure
+ /// </devdoc>
+ Millimeter = GraphicsUnit.Millimeter,
+ /// <include file='doc\StringUnit.uex' path='docs/doc[@for="StringUnit.Em"]/*' />
+ /// <devdoc>
+ /// Specifies a printer's em size of 32 as the
+ /// unit of measure.
+ /// </devdoc>
+ Em = 32
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/SystemColorTracker.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/SystemColorTracker.cs
new file mode 100644
index 0000000000..e2ff0fcd7f
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/SystemColorTracker.cs
@@ -0,0 +1,164 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#if FEATURE_SYSTEM_EVENTS
+namespace System.Drawing.Internal
+{
+ using System.Diagnostics;
+ using System.Diagnostics.CodeAnalysis;
+ using System;
+ using System.Drawing;
+ using Microsoft.Win32;
+ using System.Runtime.InteropServices;
+ using System.ComponentModel;
+
+ // Keeps track of objects that need to be notified of system color change events.
+ // Mostly this means maintaining a list of weak references.
+ internal class SystemColorTracker
+ {
+ // when I tried the self host, it went over 500 but never over 1000.
+ private static int INITIAL_SIZE = 200;
+ // If it gets this big, I seriously miscalculated the performance of this object.
+ private static int WARNING_SIZE = 100000;
+ private static float EXPAND_THRESHOLD = 0.75f;
+ private static int EXPAND_FACTOR = 2;
+
+ private static WeakReference[] list = new WeakReference[INITIAL_SIZE];
+ private static int count = 0;
+ private static bool addedTracker;
+
+ // There's no such thing as a delegate to a static method,
+ // so we need to create an instance of something.
+ private SystemColorTracker()
+ {
+ }
+
+ internal static void Add(ISystemColorTracker obj)
+ {
+ lock (typeof(SystemColorTracker))
+ {
+ Debug.Assert(list != null, "List is null");
+ Debug.Assert(list.Length > 0, "INITIAL_SIZE was initialized after list");
+
+ if (list.Length == count)
+ {
+ GarbageCollectList();
+ }
+
+ if (!addedTracker)
+ {
+ addedTracker = true;
+ SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler(OnUserPreferenceChanged);
+ }
+
+ // Strictly speaking, we should grab a lock on this class. But since the chances
+ // of a problem are so low, the consequences so minimal (something will get accidentally dropped
+ // from the list), and the performance of locking so lousy, we'll risk it.
+ int index = count;
+ count++;
+
+ // COM+ takes forever to Finalize() weak references, so it pays to reuse them.
+ if (list[index] == null)
+ list[index] = new WeakReference(obj);
+ else
+ {
+ Debug.Assert(list[index].Target == null, "Trying to reuse a weak reference that isn't broken yet: list[" + index + "], length =" + list.Length);
+ list[index].Target = obj;
+ }
+ }
+ }
+
+ private static void CleanOutBrokenLinks()
+ {
+ // Partition the list -- valid references in the low indices, broken references in the high indices.
+ // This is taken straight out of Sedgewick (p. 118 on quicksort).
+
+ // Basic idea is to find a broken reference on the left side of the list, and swap it with
+ // a valid reference on the right
+ int right = list.Length - 1;
+ int left = 0;
+
+ int length = list.Length;
+
+ // Loop invariant: everything to the left of "left" is a valid reference,
+ // and anything to the right of "right" is broken.
+ for (;;)
+ {
+ while (left < length && list[left].Target != null)
+ left++;
+ while (right >= 0 && list[right].Target == null)
+ right--;
+
+ if (left >= right)
+ {
+ count = left;
+ break;
+ }
+
+ WeakReference temp = list[left];
+ list[left] = list[right];
+ list[right] = temp;
+
+ left++;
+ right--;
+ }
+
+ Debug.Assert(count >= 0 && count <= list.Length, "count not a legal index into list");
+
+#if DEBUG
+ // Check loop invariant.
+
+ // We'd like to assert that any index < count contains a valid pointer,
+ // but since garbage collection can happen at any time, it may have been broken
+ // after we partitioned it.
+ //
+ // for (int i = 0; i < count; i++) {
+ // Debug.Assert(list[i].Target != null, "Null found on the left side of the list");
+ // }
+
+ for (int i = count; i < list.Length; i++)
+ {
+ Debug.Assert(list[i].Target == null, "Partitioning didn't work");
+ }
+#endif
+ }
+
+ private static void GarbageCollectList()
+ {
+ CleanOutBrokenLinks();
+
+ if (count / (float)list.Length > EXPAND_THRESHOLD)
+ {
+ WeakReference[] newList = new WeakReference[list.Length * EXPAND_FACTOR];
+ list.CopyTo(newList, 0);
+ list = newList;
+
+ if (list.Length >= WARNING_SIZE)
+ {
+ Debug.Fail("SystemColorTracker is using way more memory than expected.");
+ }
+ }
+ }
+
+ private static void OnUserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e)
+ {
+
+ // Update pens and brushes
+ if (e.Category == UserPreferenceCategory.Color)
+ {
+ for (int i = 0; i < count; i++)
+ {
+ Debug.Assert(list[i] != null, "null value in active part of list");
+ ISystemColorTracker tracker = (ISystemColorTracker)list[i].Target;
+ if (tracker != null)
+ {
+ // If object still around
+ tracker.OnSystemColorChanged();
+ }
+ }
+ }
+ }
+ }
+}
+#endif
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/TextRenderingHint.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/TextRenderingHint.cs
new file mode 100644
index 0000000000..4bcd20811c
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/TextRenderingHint.cs
@@ -0,0 +1,46 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Text
+{
+ /// <include file='doc\TextRenderingHint.uex' path='docs/doc[@for="TextRenderingHint"]/*' />
+ /// <devdoc>
+ /// Specifies the quality of text rendering.
+ /// </devdoc>
+ public enum TextRenderingHint
+ {
+ /// <include file='doc\TextRenderingHint.uex' path='docs/doc[@for="TextRenderingHint.SystemDefault"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ SystemDefault = 0, // Glyph with system default rendering hint
+ /// <include file='doc\TextRenderingHint.uex' path='docs/doc[@for="TextRenderingHint.SingleBitPerPixelGridFit"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ SingleBitPerPixelGridFit, // Glyph bitmap with hinting
+ /// <include file='doc\TextRenderingHint.uex' path='docs/doc[@for="TextRenderingHint.SingleBitPerPixel"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ SingleBitPerPixel, // Glyph bitmap without hinting
+ /// <include file='doc\TextRenderingHint.uex' path='docs/doc[@for="TextRenderingHint.AntiAliasGridFit"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ AntiAliasGridFit, //Anti-aliasing with hinting
+ /// <include file='doc\TextRenderingHint.uex' path='docs/doc[@for="TextRenderingHint.AntiAlias"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ AntiAlias, // Glyph anti-alias bitmap without hinting
+ // Glyph anti-alias bitmap without hinting
+ /// <include file='doc\TextRenderingHint.uex' path='docs/doc[@for="TextRenderingHint.ClearTypeGridFit"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ ClearTypeGridFit // Glyph CT bitmap with hinting
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/TextureBrush.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/TextureBrush.cs
new file mode 100644
index 0000000000..78c242d2d8
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/TextureBrush.cs
@@ -0,0 +1,565 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.Runtime.InteropServices;
+ using System.Diagnostics;
+ using System.ComponentModel;
+ using System.Drawing.Drawing2D;
+ using System.Drawing.Imaging;
+
+ /**
+ * Represent a Texture brush object
+ */
+ /// <include file='doc\TextureBrush.uex' path='docs/doc[@for="TextureBrush"]/*' />
+ /// <devdoc>
+ /// Encapsulates a <see cref='System.Drawing.Brush'/> that uses an fills the
+ /// interior of a shape with an image.
+ /// </devdoc>
+ public sealed class TextureBrush : Brush
+ {
+ /**
+ * Create a new texture brush object
+ *
+ * @notes Should the rectangle parameter be Rectangle or RectF?
+ * We'll use Rectangle to specify pixel unit source image
+ * rectangle for now. Eventually, we'll need a mechanism
+ * to specify areas of an image in a resolution-independent way.
+ *
+ * @notes We'll make a copy of the bitmap object passed in.
+ */
+
+ // When creating a texture brush from a metafile image, the dstRect
+ // is used to specify the size that the metafile image should be
+ // rendered at in the device units of the destination graphics.
+ // It is NOT used to crop the metafile image, so only the width
+ // and height values matter for metafiles.
+ /// <include file='doc\TextureBrush.uex' path='docs/doc[@for="TextureBrush.TextureBrush"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.TextureBrush'/>
+ /// class with the specified image.
+ /// </devdoc>
+ public TextureBrush(Image bitmap)
+ : this(bitmap, System.Drawing.Drawing2D.WrapMode.Tile)
+ {
+ }
+
+ // When creating a texture brush from a metafile image, the dstRect
+ // is used to specify the size that the metafile image should be
+ // rendered at in the device units of the destination graphics.
+ // It is NOT used to crop the metafile image, so only the width
+ // and height values matter for metafiles.
+ /// <include file='doc\TextureBrush.uex' path='docs/doc[@for="TextureBrush.TextureBrush1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.TextureBrush'/>
+ /// class with the specified image and wrap mode.
+ /// </para>
+ /// </devdoc>
+ public TextureBrush(Image image, WrapMode wrapMode)
+ {
+ if (image == null)
+ throw new ArgumentNullException("image");
+
+ //validate the WrapMode enum
+ //valid values are 0x0 to 0x4
+ if (!ClientUtils.IsEnumValid(wrapMode, unchecked((int)wrapMode), (int)WrapMode.Tile, (int)WrapMode.Clamp))
+ {
+ throw new InvalidEnumArgumentException("wrapMode", unchecked((int)wrapMode), typeof(WrapMode));
+ }
+
+ IntPtr brush = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateTexture(new HandleRef(image, image.nativeImage),
+ (int)wrapMode,
+ out brush);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeBrushInternal(brush);
+ }
+
+ // When creating a texture brush from a metafile image, the dstRect
+ // is used to specify the size that the metafile image should be
+ // rendered at in the device units of the destination graphics.
+ // It is NOT used to crop the metafile image, so only the width
+ // and height values matter for metafiles.
+ // float version
+ /// <include file='doc\TextureBrush.uex' path='docs/doc[@for="TextureBrush.TextureBrush2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.TextureBrush'/>
+ /// class with the specified image, wrap mode, and bounding rectangle.
+ /// </para>
+ /// </devdoc>
+ public TextureBrush(Image image, WrapMode wrapMode, RectangleF dstRect)
+ {
+ if (image == null)
+ throw new ArgumentNullException("image");
+
+ //validate the WrapMode enum
+ //valid values are 0x0 to 0x4
+ if (!ClientUtils.IsEnumValid(wrapMode, unchecked((int)wrapMode), (int)WrapMode.Tile, (int)WrapMode.Clamp))
+ {
+ throw new InvalidEnumArgumentException("wrapMode", unchecked((int)wrapMode), typeof(WrapMode));
+ }
+
+ IntPtr brush = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateTexture2(new HandleRef(image, image.nativeImage),
+ unchecked((int)wrapMode),
+ dstRect.X,
+ dstRect.Y,
+ dstRect.Width,
+ dstRect.Height,
+ out brush);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeBrushInternal(brush);
+ }
+
+ // int version
+ // When creating a texture brush from a metafile image, the dstRect
+ // is used to specify the size that the metafile image should be
+ // rendered at in the device units of the destination graphics.
+ // It is NOT used to crop the metafile image, so only the width
+ // and height values matter for metafiles.
+ /// <include file='doc\TextureBrush.uex' path='docs/doc[@for="TextureBrush.TextureBrush3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.TextureBrush'/>
+ /// class with the specified image, wrap mode, and bounding rectangle.
+ /// </para>
+ /// </devdoc>
+ public TextureBrush(Image image, WrapMode wrapMode, Rectangle dstRect)
+ {
+ if (image == null)
+ throw new ArgumentNullException("image");
+
+ //validate the WrapMode enum
+ //valid values are 0x0 to 0x4
+ if (!ClientUtils.IsEnumValid(wrapMode, unchecked((int)wrapMode), (int)WrapMode.Tile, (int)WrapMode.Clamp))
+ {
+ throw new InvalidEnumArgumentException("wrapMode", unchecked((int)wrapMode), typeof(WrapMode));
+ }
+
+ IntPtr brush = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateTexture2I(new HandleRef(image, image.nativeImage),
+ unchecked((int)wrapMode),
+ dstRect.X,
+ dstRect.Y,
+ dstRect.Width,
+ dstRect.Height,
+ out brush);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ SetNativeBrushInternal(brush);
+ }
+
+
+ // When creating a texture brush from a metafile image, the dstRect
+ // is used to specify the size that the metafile image should be
+ // rendered at in the device units of the destination graphics.
+ // It is NOT used to crop the metafile image, so only the width
+ // and height values matter for metafiles.
+ /// <include file='doc\TextureBrush.uex' path='docs/doc[@for="TextureBrush.TextureBrush4"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.TextureBrush'/> class with the specified image
+ /// and bounding rectangle.
+ /// </para>
+ /// </devdoc>
+ public TextureBrush(Image image, RectangleF dstRect)
+ : this(image, dstRect, (ImageAttributes)null)
+ { }
+
+ // When creating a texture brush from a metafile image, the dstRect
+ // is used to specify the size that the metafile image should be
+ // rendered at in the device units of the destination graphics.
+ // It is NOT used to crop the metafile image, so only the width
+ // and height values matter for metafiles.
+ /// <include file='doc\TextureBrush.uex' path='docs/doc[@for="TextureBrush.TextureBrush5"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.TextureBrush'/> class with the specified
+ /// image, bounding rectangle, and image attributes.
+ /// </para>
+ /// </devdoc>
+ public TextureBrush(Image image, RectangleF dstRect,
+ ImageAttributes imageAttr)
+ {
+ if (image == null)
+ throw new ArgumentNullException("image");
+
+ IntPtr brush = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateTextureIA(new HandleRef(image, image.nativeImage),
+ new HandleRef(imageAttr, (imageAttr == null) ?
+ IntPtr.Zero : imageAttr.nativeImageAttributes),
+ dstRect.X,
+ dstRect.Y,
+ dstRect.Width,
+ dstRect.Height,
+ out brush);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ SetNativeBrushInternal(brush);
+ }
+
+ // When creating a texture brush from a metafile image, the dstRect
+ // is used to specify the size that the metafile image should be
+ // rendered at in the device units of the destination graphics.
+ // It is NOT used to crop the metafile image, so only the width
+ // and height values matter for metafiles.
+ /// <include file='doc\TextureBrush.uex' path='docs/doc[@for="TextureBrush.TextureBrush6"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.TextureBrush'/> class with the specified image
+ /// and bounding rectangle.
+ /// </para>
+ /// </devdoc>
+ public TextureBrush(Image image, Rectangle dstRect)
+ : this(image, dstRect, (ImageAttributes)null)
+ { }
+
+ // When creating a texture brush from a metafile image, the dstRect
+ // is used to specify the size that the metafile image should be
+ // rendered at in the device units of the destination graphics.
+ // It is NOT used to crop the metafile image, so only the width
+ // and height values matter for metafiles.
+ /// <include file='doc\TextureBrush.uex' path='docs/doc[@for="TextureBrush.TextureBrush7"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.TextureBrush'/> class with the specified
+ /// image, bounding rectangle, and image attributes.
+ /// </para>
+ /// </devdoc>
+ public TextureBrush(Image image, Rectangle dstRect,
+ ImageAttributes imageAttr)
+ {
+ if (image == null)
+ throw new ArgumentNullException("image");
+
+ IntPtr brush = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateTextureIAI(new HandleRef(image, image.nativeImage),
+ new HandleRef(imageAttr, (imageAttr == null) ?
+ IntPtr.Zero : imageAttr.nativeImageAttributes),
+ dstRect.X,
+ dstRect.Y,
+ dstRect.Width,
+ dstRect.Height,
+ out brush);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ SetNativeBrushInternal(brush);
+ }
+
+ /// <devdoc>
+ /// Constructor to initialized this object to be owned by GDI+.
+ /// </devdoc>
+ internal TextureBrush(IntPtr nativeBrush)
+ {
+ Debug.Assert(nativeBrush != IntPtr.Zero, "Initializing native brush with null.");
+ SetNativeBrushInternal(nativeBrush);
+ }
+
+ /// <include file='doc\TextureBrush.uex' path='docs/doc[@for="TextureBrush.Clone"]/*' />
+ /// <devdoc>
+ /// Creates an exact copy of this <see cref='System.Drawing.TextureBrush'/>.
+ /// </devdoc>
+ public override Object Clone()
+ {
+ IntPtr cloneBrush = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCloneBrush(new HandleRef(this, NativeBrush), out cloneBrush);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return new TextureBrush(cloneBrush);
+ }
+
+
+ /**
+ * Set/get brush transform
+ */
+ private void _SetTransform(Matrix matrix)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetTextureTransform(new HandleRef(this, NativeBrush), new HandleRef(matrix, matrix.nativeMatrix));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ private Matrix _GetTransform()
+ {
+ Matrix matrix = new Matrix();
+
+ int status = SafeNativeMethods.Gdip.GdipGetTextureTransform(new HandleRef(this, NativeBrush), new HandleRef(matrix, matrix.nativeMatrix));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return matrix;
+ }
+
+ /// <include file='doc\TextureBrush.uex' path='docs/doc[@for="TextureBrush.Transform"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets a <see cref='System.Drawing.Drawing2D.Matrix'/> that defines a local geometrical
+ /// transform for this <see cref='System.Drawing.TextureBrush'/>.
+ /// </para>
+ /// </devdoc>
+ public Matrix Transform
+ {
+ get { return _GetTransform(); }
+ set
+ {
+ if (value == null)
+ {
+ throw new ArgumentNullException("value");
+ }
+
+ _SetTransform(value);
+ }
+ }
+
+ /**
+ * Set/get brush wrapping mode
+ */
+ private void _SetWrapMode(WrapMode wrapMode)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetTextureWrapMode(new HandleRef(this, NativeBrush), unchecked((int)wrapMode));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ private WrapMode _GetWrapMode()
+ {
+ int mode = 0;
+
+ int status = SafeNativeMethods.Gdip.GdipGetTextureWrapMode(new HandleRef(this, NativeBrush), out mode);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return (WrapMode)mode;
+ }
+
+ /// <include file='doc\TextureBrush.uex' path='docs/doc[@for="TextureBrush.WrapMode"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets a <see cref='System.Drawing.Drawing2D.WrapMode'/> that indicates the wrap mode for this
+ /// <see cref='System.Drawing.TextureBrush'/>.
+ /// </para>
+ /// </devdoc>
+ public WrapMode WrapMode
+ {
+ get
+ {
+ return _GetWrapMode();
+ }
+ set
+ {
+ //validate the WrapMode enum
+ //valid values are 0x0 to 0x4
+ if (!ClientUtils.IsEnumValid(value, unchecked((int)value), (int)WrapMode.Tile, (int)WrapMode.Clamp))
+ {
+ throw new InvalidEnumArgumentException("value", unchecked((int)value), typeof(WrapMode));
+ }
+
+ _SetWrapMode(value);
+ }
+ }
+
+ /// <include file='doc\TextureBrush.uex' path='docs/doc[@for="TextureBrush.Image"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the <see cref='System.Drawing.Image'/> associated with this <see cref='System.Drawing.TextureBrush'/>.
+ /// </para>
+ /// </devdoc>
+ public Image Image
+ {
+ get
+ {
+ IntPtr image;
+
+ int status = SafeNativeMethods.Gdip.GdipGetTextureImage(new HandleRef(this, NativeBrush), out image);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return Image.CreateImageObject(image);
+ }
+ }
+
+ /// <include file='doc\TextureBrush.uex' path='docs/doc[@for="TextureBrush.ResetTransform"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Resets the <see cref='System.Drawing.Drawing2D.LinearGradientBrush.Transform'/> property to
+ /// identity.
+ /// </para>
+ /// </devdoc>
+ public void ResetTransform()
+ {
+ int status = SafeNativeMethods.Gdip.GdipResetTextureTransform(new HandleRef(this, NativeBrush));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\TextureBrush.uex' path='docs/doc[@for="TextureBrush.MultiplyTransform"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Multiplies the <see cref='System.Drawing.Drawing2D.Matrix'/> that represents the local geometrical
+ /// transform of this <see cref='System.Drawing.TextureBrush'/> by the specified <see cref='System.Drawing.Drawing2D.Matrix'/> by prepending the specified <see cref='System.Drawing.Drawing2D.Matrix'/>.
+ /// </para>
+ /// </devdoc>
+ public void MultiplyTransform(Matrix matrix)
+ { MultiplyTransform(matrix, MatrixOrder.Prepend); }
+
+ /// <include file='doc\TextureBrush.uex' path='docs/doc[@for="TextureBrush.MultiplyTransform1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Multiplies the <see cref='System.Drawing.Drawing2D.Matrix'/> that represents the local geometrical
+ /// transform of this <see cref='System.Drawing.TextureBrush'/> by the specified <see cref='System.Drawing.Drawing2D.Matrix'/> in the specified order.
+ /// </para>
+ /// </devdoc>
+ public void MultiplyTransform(Matrix matrix, MatrixOrder order)
+ {
+ if (matrix == null)
+ {
+ throw new ArgumentNullException("matrix");
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipMultiplyTextureTransform(new HandleRef(this, NativeBrush),
+ new HandleRef(matrix, matrix.nativeMatrix),
+ order);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\TextureBrush.uex' path='docs/doc[@for="TextureBrush.TranslateTransform"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Translates the local geometrical transform by the specified dimmensions. This
+ /// method prepends the translation to the transform.
+ /// </para>
+ /// </devdoc>
+ public void TranslateTransform(float dx, float dy)
+ { TranslateTransform(dx, dy, MatrixOrder.Prepend); }
+
+ /// <include file='doc\TextureBrush.uex' path='docs/doc[@for="TextureBrush.TranslateTransform1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Translates the local geometrical transform by the specified dimmensions in
+ /// the specified order.
+ /// </para>
+ /// </devdoc>
+ public void TranslateTransform(float dx, float dy, MatrixOrder order)
+ {
+ int status = SafeNativeMethods.Gdip.GdipTranslateTextureTransform(new HandleRef(this, NativeBrush),
+ dx,
+ dy,
+ order);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\TextureBrush.uex' path='docs/doc[@for="TextureBrush.ScaleTransform"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Scales the local geometric transform by the specified amounts. This method
+ /// prepends the scaling matrix to the transform.
+ /// </para>
+ /// </devdoc>
+ public void ScaleTransform(float sx, float sy)
+ { ScaleTransform(sx, sy, MatrixOrder.Prepend); }
+
+ /// <include file='doc\TextureBrush.uex' path='docs/doc[@for="TextureBrush.ScaleTransform1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Scales the local geometric transform by the specified amounts in the
+ /// specified order.
+ /// </para>
+ /// </devdoc>
+ public void ScaleTransform(float sx, float sy, MatrixOrder order)
+ {
+ int status = SafeNativeMethods.Gdip.GdipScaleTextureTransform(new HandleRef(this, NativeBrush),
+ sx,
+ sy,
+ order);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\TextureBrush.uex' path='docs/doc[@for="TextureBrush.RotateTransform"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Rotates the local geometric transform by the specified amount. This method
+ /// prepends the rotation to the transform.
+ /// </para>
+ /// </devdoc>
+ public void RotateTransform(float angle)
+ { RotateTransform(angle, MatrixOrder.Prepend); }
+
+ /// <include file='doc\TextureBrush.uex' path='docs/doc[@for="TextureBrush.RotateTransform1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Rotates the local geometric transform by the specified amount in the
+ /// specified order.
+ /// </para>
+ /// </devdoc>
+ public void RotateTransform(float angle, MatrixOrder order)
+ {
+ int status = SafeNativeMethods.Gdip.GdipRotateTextureTransform(new HandleRef(this, NativeBrush),
+ angle,
+ order);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/Unit.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/Unit.cs
new file mode 100644
index 0000000000..78d43adac2
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/Unit.cs
@@ -0,0 +1,56 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ /// <include file='doc\Unit.uex' path='docs/doc[@for="GraphicsUnit"]/*' />
+ /// <devdoc>
+ /// Specifies the unit of measure for the given
+ /// data.
+ /// </devdoc>
+ public enum GraphicsUnit
+ {
+ /// <include file='doc\Unit.uex' path='docs/doc[@for="GraphicsUnit.World"]/*' />
+ /// <devdoc>
+ /// Specifies the world unit as the unit of
+ /// measure.
+ /// </devdoc>
+ World = 0, // 0 -- World coordinate (non-physical unit)
+ /// <include file='doc\Unit.uex' path='docs/doc[@for="GraphicsUnit.Display"]/*' />
+ /// <devdoc>
+ /// Specifies 1/75 inch as the unit of measure.
+ /// </devdoc>
+ Display = 1, // 1 -- Variable - for PageTransform only
+ /// <include file='doc\Unit.uex' path='docs/doc[@for="GraphicsUnit.Pixel"]/*' />
+ /// <devdoc>
+ /// Specifies a device pixel as the unit of
+ /// measure.
+ /// </devdoc>
+ Pixel = 2, // 2 -- Each unit is one device pixel.
+ /// <include file='doc\Unit.uex' path='docs/doc[@for="GraphicsUnit.Point"]/*' />
+ /// <devdoc>
+ /// Specifies a printer's point (1/72 inch) as
+ /// the unit of measure.
+ /// </devdoc>
+ Point = 3, // 3 -- Each unit is a printer's point, or 1/72 inch.
+ /// <include file='doc\Unit.uex' path='docs/doc[@for="GraphicsUnit.Inch"]/*' />
+ /// <devdoc>
+ /// Specifies the inch as the unit of measure.
+ /// </devdoc>
+ Inch = 4, // 4 -- Each unit is 1 inch.
+ /// <include file='doc\Unit.uex' path='docs/doc[@for="GraphicsUnit.Document"]/*' />
+ /// <devdoc>
+ /// Specifes the document unit (1/300 inch) as
+ /// the unit of measure.
+ /// </devdoc>
+ Document = 5, // 5 -- Each unit is 1/300 inch.
+ /// <include file='doc\Unit.uex' path='docs/doc[@for="GraphicsUnit.Millimeter"]/*' />
+ /// <devdoc>
+ /// Specifies the millimeter as the unit of
+ /// measure.
+ /// </devdoc>
+ Millimeter = 6 // 6 -- Each unit is 1 millimeter.
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/WarpMode.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/WarpMode.cs
new file mode 100644
index 0000000000..e08d2eb920
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/WarpMode.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /**
+ * Various wrap modes for brushes
+ */
+ /// <include file='doc\WarpMode.uex' path='docs/doc[@for="WarpMode"]/*' />
+ /// <devdoc>
+ /// Specifies the warp style.
+ /// </devdoc>
+ public enum WarpMode
+ {
+ /// <include file='doc\WarpMode.uex' path='docs/doc[@for="WarpMode.Perspective"]/*' />
+ /// <devdoc>
+ /// Specifies a perspective warp.
+ /// </devdoc>
+ Perspective = 0,
+ /// <include file='doc\WarpMode.uex' path='docs/doc[@for="WarpMode.Bilinear"]/*' />
+ /// <devdoc>
+ /// Specifies a bilinear warp.
+ /// </devdoc>
+ Bilinear = 1
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/WmfPlaceableFileHeader.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/WmfPlaceableFileHeader.cs
new file mode 100644
index 0000000000..6c9bae3bf8
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/WmfPlaceableFileHeader.cs
@@ -0,0 +1,131 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ using System.Runtime.InteropServices;
+
+ /// <include file='doc\WmfPlaceableFileHeader.uex' path='docs/doc[@for="WmfPlaceableFileHeader"]/*' />
+ /// <devdoc>
+ /// Defines an Placeable Metafile.
+ /// </devdoc>
+ [StructLayout(LayoutKind.Sequential)]
+ public sealed class WmfPlaceableFileHeader
+ {
+ private int _key = unchecked((int)0x9aC6CDD7);
+ private short _hmf;
+ private short _bboxLeft;
+ private short _bboxTop;
+ private short _bboxRight;
+ private short _bboxBottom;
+ private short _inch;
+ private int _reserved;
+ private short _checksum;
+
+ /// <include file='doc\WmfPlaceableFileHeader.uex' path='docs/doc[@for="WmfPlaceableFileHeader.Key"]/*' />
+ /// <devdoc>
+ /// Indicates the presence of a placeable
+ /// metafile header.
+ /// </devdoc>
+ public int Key
+ {
+ get { return _key; }
+ set { _key = value; }
+ }
+
+ /// <include file='doc\WmfPlaceableFileHeader.uex' path='docs/doc[@for="WmfPlaceableFileHeader.Hmf"]/*' />
+ /// <devdoc>
+ /// Stores the handle of the metafile in
+ /// memory.
+ /// </devdoc>
+ public short Hmf
+ {
+ get { return _hmf; }
+ set { _hmf = value; }
+ }
+
+ /// <include file='doc\WmfPlaceableFileHeader.uex' path='docs/doc[@for="WmfPlaceableFileHeader.BboxLeft"]/*' />
+ /// <devdoc>
+ /// The x-coordinate of the upper-left corner
+ /// of the bounding rectangle of the metafile image on the output device.
+ /// </devdoc>
+ public short BboxLeft
+ {
+ get { return _bboxLeft; }
+ set { _bboxLeft = value; }
+ }
+
+ /// <include file='doc\WmfPlaceableFileHeader.uex' path='docs/doc[@for="WmfPlaceableFileHeader.BboxTop"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// The y-coordinate of the upper-left corner of the bounding rectangle of the
+ /// metafile image on the output device.
+ /// </para>
+ /// </devdoc>
+ public short BboxTop
+ {
+ get { return _bboxTop; }
+ set { _bboxTop = value; }
+ }
+
+ /// <include file='doc\WmfPlaceableFileHeader.uex' path='docs/doc[@for="WmfPlaceableFileHeader.BboxRight"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// The x-coordinate of the lower-right corner of the bounding rectangle of the
+ /// metafile image on the output device.
+ /// </para>
+ /// </devdoc>
+ public short BboxRight
+ {
+ get { return _bboxRight; }
+ set { _bboxRight = value; }
+ }
+
+ /// <include file='doc\WmfPlaceableFileHeader.uex' path='docs/doc[@for="WmfPlaceableFileHeader.BboxBottom"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// The y-coordinate of the lower-right corner of the bounding rectangle of the
+ /// metafile image on the output device.
+ /// </para>
+ /// </devdoc>
+ public short BboxBottom
+ {
+ get { return _bboxBottom; }
+ set { _bboxBottom = value; }
+ }
+
+ /// <include file='doc\WmfPlaceableFileHeader.uex' path='docs/doc[@for="WmfPlaceableFileHeader.Inch"]/*' />
+ /// <devdoc>
+ /// Indicates the number of twips per inch.
+ /// </devdoc>
+ public short Inch
+ {
+ get { return _inch; }
+ set { _inch = value; }
+ }
+
+ /// <include file='doc\WmfPlaceableFileHeader.uex' path='docs/doc[@for="WmfPlaceableFileHeader.Reserved"]/*' />
+ /// <devdoc>
+ /// Reserved. Do not use.
+ /// </devdoc>
+ public int Reserved
+ {
+ get { return _reserved; }
+ set { _reserved = value; }
+ }
+
+ /// <include file='doc\WmfPlaceableFileHeader.uex' path='docs/doc[@for="WmfPlaceableFileHeader.Checksum"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Indicates the checksum value for the
+ /// previous ten WORDs in the header.
+ /// </para>
+ /// </devdoc>
+ public short Checksum
+ {
+ get { return _checksum; }
+ set { _checksum = value; }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Advanced/WrapMode.cs b/src/System.Drawing.Common/src/System/Drawing/Advanced/WrapMode.cs
new file mode 100644
index 0000000000..7db0661a0a
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Advanced/WrapMode.cs
@@ -0,0 +1,49 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /**
+ * Various wrap modes for brushes
+ */
+ /// <include file='doc\WrapMode.uex' path='docs/doc[@for="WrapMode"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies how a texture or gradient is tiled when it is
+ /// larger than the area being filled.
+ /// </para>
+ /// </devdoc>
+ public enum WrapMode
+ {
+ /// <include file='doc\WrapMode.uex' path='docs/doc[@for="WrapMode.Tile"]/*' />
+ /// <devdoc>
+ /// Tiles the gradient or texture.
+ /// </devdoc>
+ Tile = 0,
+ /// <include file='doc\WrapMode.uex' path='docs/doc[@for="WrapMode.TileFlipX"]/*' />
+ /// <devdoc>
+ /// Reverses the texture or gradient
+ /// horizontally and then tiles the texture or gradient.
+ /// </devdoc>
+ TileFlipX = 1,
+ /// <include file='doc\WrapMode.uex' path='docs/doc[@for="WrapMode.TileFlipY"]/*' />
+ /// <devdoc>
+ /// Reverses the texture or
+ /// gradient vertically and then tiles the texture or gradient.
+ /// </devdoc>
+ TileFlipY = 2,
+ /// <include file='doc\WrapMode.uex' path='docs/doc[@for="WrapMode.TileFlipXY"]/*' />
+ /// <devdoc>
+ /// Reverses the texture or gradient
+ /// horizontally and vertically and then tiles the texture or gradient.
+ /// </devdoc>
+ TileFlipXY = 3,
+ /// <include file='doc\WrapMode.uex' path='docs/doc[@for="WrapMode.Clamp"]/*' />
+ /// <devdoc>
+ /// Clamps the texture or gradient to the
+ /// object boundary.
+ /// </devdoc>
+ Clamp = 4
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Bitmap.cs b/src/System.Drawing.Common/src/System/Drawing/Bitmap.cs
new file mode 100644
index 0000000000..a36309a2b2
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Bitmap.cs
@@ -0,0 +1,724 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.ComponentModel;
+ using System.Diagnostics.Contracts;
+ using System.Drawing.Imaging;
+ using System.Drawing.Internal;
+ using System.IO;
+ using System.Runtime.InteropServices;
+ using System.Runtime.Serialization;
+ using System.Security.Permissions;
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap"]/*' />
+ /// <devdoc>
+ /// Encapsultates a GDI+ bitmap.
+ /// </devdoc>
+ /**
+ * Represent a bitmap image
+ */
+ [
+ Serializable,
+ ComVisible(true)
+ ]
+ public sealed class Bitmap : Image
+ {
+ private static Color s_defaultTransparentColor = Color.LightGray;
+
+ /*
+ * Predefined bitmap data formats
+ */
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.Bitmap"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the
+ /// <see cref='System.Drawing.Bitmap'/>
+ /// class from the specified file.
+ /// </devdoc>
+ /**
+ * Create a new bitmap object from URL
+ */
+ public Bitmap(String filename)
+ {
+ //GDI+ will read this file multiple times. Get the fully qualified path
+ //so if our app changes default directory we won't get an error
+ //
+ filename = Path.GetFullPath(filename);
+
+ IntPtr bitmap = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateBitmapFromFile(filename, out bitmap);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ status = SafeNativeMethods.Gdip.GdipImageForceValidation(new HandleRef(null, bitmap));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ SafeNativeMethods.Gdip.GdipDisposeImage(new HandleRef(null, bitmap));
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ SetNativeImage(bitmap);
+
+ EnsureSave(this, filename, null);
+ }
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.Bitmap1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Bitmap'/> class from the specified
+ /// file.
+ /// </para>
+ /// </devdoc>
+ public Bitmap(String filename, bool useIcm)
+ {
+ //GDI+ will read this file multiple times. Get the fully qualified path
+ //so if our app changes default directory we won't get an error
+ //
+ filename = Path.GetFullPath(filename);
+
+ IntPtr bitmap = IntPtr.Zero;
+ int status;
+
+ if (useIcm)
+ {
+ status = SafeNativeMethods.Gdip.GdipCreateBitmapFromFileICM(filename, out bitmap);
+ }
+ else
+ {
+ status = SafeNativeMethods.Gdip.GdipCreateBitmapFromFile(filename, out bitmap);
+ }
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ status = SafeNativeMethods.Gdip.GdipImageForceValidation(new HandleRef(null, bitmap));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ SafeNativeMethods.Gdip.GdipDisposeImage(new HandleRef(null, bitmap));
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ SetNativeImage(bitmap);
+
+ EnsureSave(this, filename, null);
+ }
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.Bitmap2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Bitmap'/> class from a specified resource.
+ /// </para>
+ /// </devdoc>
+ public Bitmap(Type type, string resource)
+ {
+ Stream stream = type.Module.Assembly.GetManifestResourceStream(type, resource);
+ if (stream == null)
+ throw new ArgumentException(SR.Format(SR.ResourceNotFound, type, resource));
+
+ IntPtr bitmap = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateBitmapFromStream(new GPStream(stream), out bitmap);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ status = SafeNativeMethods.Gdip.GdipImageForceValidation(new HandleRef(null, bitmap));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ SafeNativeMethods.Gdip.GdipDisposeImage(new HandleRef(null, bitmap));
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ SetNativeImage(bitmap);
+
+ EnsureSave(this, null, stream);
+ }
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.Bitmap3"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the
+ /// <see cref='System.Drawing.Bitmap'/>
+ /// class from the specified data stream.
+ /// </devdoc>
+ /**
+ * Create a new bitmap object from a stream
+ */
+ public Bitmap(Stream stream)
+ {
+ if (stream == null)
+ throw new ArgumentException(SR.Format(SR.InvalidArgument, "stream", "null"));
+
+ IntPtr bitmap = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateBitmapFromStream(new GPStream(stream), out bitmap);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ status = SafeNativeMethods.Gdip.GdipImageForceValidation(new HandleRef(null, bitmap));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ SafeNativeMethods.Gdip.GdipDisposeImage(new HandleRef(null, bitmap));
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ SetNativeImage(bitmap);
+
+ EnsureSave(this, null, stream);
+ }
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.Bitmap4"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Bitmap'/> class from the specified data
+ /// stream.
+ /// </para>
+ /// </devdoc>
+ public Bitmap(Stream stream, bool useIcm)
+ {
+ if (stream == null)
+ throw new ArgumentException(SR.Format(SR.InvalidArgument, "stream", "null"));
+
+ IntPtr bitmap = IntPtr.Zero;
+ int status;
+
+ if (useIcm)
+ {
+ status = SafeNativeMethods.Gdip.GdipCreateBitmapFromStreamICM(new GPStream(stream), out bitmap);
+ }
+ else
+ {
+ status = SafeNativeMethods.Gdip.GdipCreateBitmapFromStream(new GPStream(stream), out bitmap);
+ }
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ status = SafeNativeMethods.Gdip.GdipImageForceValidation(new HandleRef(null, bitmap));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ SafeNativeMethods.Gdip.GdipDisposeImage(new HandleRef(null, bitmap));
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ SetNativeImage(bitmap);
+
+ EnsureSave(this, null, stream);
+ }
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.Bitmap5"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the
+ /// Bitmap class with the specified size, pixel format, and pixel data.
+ /// </para>
+ /// </devdoc>
+ public Bitmap(int width, int height, int stride, PixelFormat format, IntPtr scan0)
+ {
+ IntPtr bitmap = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateBitmapFromScan0(width, height, stride, unchecked((int)format), new HandleRef(null, scan0), out bitmap);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeImage(bitmap);
+ }
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.Bitmap6"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the Bitmap class with the specified
+ /// size and format.
+ /// </para>
+ /// </devdoc>
+ public Bitmap(int width, int height, PixelFormat format)
+ {
+ IntPtr bitmap = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateBitmapFromScan0(width, height, 0, unchecked((int)format), NativeMethods.NullHandleRef, out bitmap);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeImage(bitmap);
+ }
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.Bitmap7"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the
+ /// <see cref='System.Drawing.Bitmap'/>
+ /// class with the specified size.
+ /// </devdoc>
+ public Bitmap(int width, int height) : this(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
+ {
+ }
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.Bitmap8"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the
+ /// <see cref='System.Drawing.Bitmap'/>
+ /// class with the specified size and target <see cref='System.Drawing.Graphics'/>.
+ /// </devdoc>
+ public Bitmap(int width, int height, Graphics g)
+ {
+ if (g == null)
+ throw new ArgumentNullException(SR.Format(SR.InvalidArgument, "g", "null"));
+
+ IntPtr bitmap = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateBitmapFromGraphics(width, height, new HandleRef(g, g.NativeGraphics), out bitmap);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeImage(bitmap);
+ }
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.Bitmap9"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the
+ /// <see cref='System.Drawing.Bitmap'/>
+ /// class, from the specified existing image, with the specified size.
+ /// </devdoc>
+ public Bitmap(Image original) : this(original, original.Width, original.Height)
+ {
+ }
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.Bitmap10"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the
+ /// <see cref='System.Drawing.Bitmap'/>
+ /// class, from the specified existing image, with the specified size.
+ /// </devdoc>
+ public Bitmap(Image original, int width, int height) : this(width, height)
+ {
+ Graphics g = null;
+ try
+ {
+ g = Graphics.FromImage(this);
+ g.Clear(Color.Transparent);
+ g.DrawImage(original, 0, 0, width, height);
+ }
+ finally
+ {
+ if (g != null)
+ {
+ g.Dispose();
+ }
+ }
+ }
+
+ /**
+ * Constructor used in deserialization
+ */
+ private Bitmap(SerializationInfo info, StreamingContext context) : base(info, context)
+ {
+ }
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.FromHicon"]/*' />
+ /// <devdoc>
+ /// Creates a <see cref='System.Drawing.Bitmap'/> from a Windows handle to an
+ /// Icon.
+ /// </devdoc>
+ public static Bitmap FromHicon(IntPtr hicon)
+ {
+ IntPtr bitmap = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateBitmapFromHICON(new HandleRef(null, hicon), out bitmap);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return Bitmap.FromGDIplus(bitmap);
+ }
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.FromResource"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public static Bitmap FromResource(IntPtr hinstance, String bitmapName)
+ {
+ IntPtr bitmap;
+
+ IntPtr name = Marshal.StringToHGlobalUni(bitmapName);
+
+ int status = SafeNativeMethods.Gdip.GdipCreateBitmapFromResource(new HandleRef(null, hinstance),
+ new HandleRef(null, name),
+ out bitmap);
+ Marshal.FreeHGlobal(name);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return Bitmap.FromGDIplus(bitmap);
+ }
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.GetHbitmap"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Creates a Win32 HBITMAP out of the image. You are responsible for
+ /// de-allocating the HBITMAP with Windows.DeleteObject(handle). If the image uses
+ /// transparency, the background will be filled with the specified background
+ /// color.
+ /// </para>
+ /// </devdoc>
+ [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public IntPtr GetHbitmap()
+ {
+ return GetHbitmap(Color.LightGray);
+ }
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.GetHbitmap1"]/*' />
+ /// <devdoc>
+ /// Creates a Win32 HBITMAP out of the image. You are responsible for
+ /// de-allocating the HBITMAP with Windows.DeleteObject(handle).
+ /// If the image uses transparency, the background will be filled with the specified background color.
+ /// </devdoc>
+ [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public IntPtr GetHbitmap(Color background)
+ {
+ IntPtr hBitmap = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateHBITMAPFromBitmap(new HandleRef(this, nativeImage), out hBitmap,
+ ColorTranslator.ToWin32(background));
+ if (status == 2 /* invalid parameter*/ && (Width >= Int16.MaxValue || Height >= Int16.MaxValue))
+ {
+ throw (new ArgumentException(SR.Format(SR.GdiplusInvalidSize)));
+ }
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return hBitmap;
+ }
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.GetHicon"]/*' />
+ /// <devdoc>
+ /// Returns the handle to an icon.
+ /// </devdoc>
+ [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public IntPtr GetHicon()
+ {
+ IntPtr hIcon = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateHICONFromBitmap(new HandleRef(this, nativeImage), out hIcon);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return hIcon;
+ }
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.Bitmap11"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Bitmap'/> class, from the specified
+ /// existing image, with the specified size.
+ /// </para>
+ /// </devdoc>
+ public Bitmap(Image original, Size newSize) :
+ this(original, (object)newSize != null ? newSize.Width : 0, (object)newSize != null ? newSize.Height : 0)
+ {
+ }
+
+ // for use with CreateFromGDIplus
+ private Bitmap()
+ {
+ }
+
+ /*
+ * Create a new bitmap object from a native bitmap handle.
+ * This is only for internal purpose.
+ */
+ internal static Bitmap FromGDIplus(IntPtr handle)
+ {
+ Bitmap result = new Bitmap();
+ result.SetNativeImage(handle);
+ return result;
+ }
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.Clone"]/*' />
+ /// <devdoc>
+ /// Creates a copy of the section of this
+ /// Bitmap defined by <paramref term="rect"/> with a specified <see cref='System.Drawing.Imaging.PixelFormat'/>.
+ /// </devdoc>
+ // int version
+ public Bitmap Clone(Rectangle rect, PixelFormat format)
+ {
+ //validate the rect
+ if (rect.Width == 0 || rect.Height == 0)
+ {
+ throw new ArgumentException(SR.Format(SR.GdiplusInvalidRectangle, rect.ToString()));
+ }
+
+ IntPtr dstHandle = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCloneBitmapAreaI(
+ rect.X,
+ rect.Y,
+ rect.Width,
+ rect.Height,
+ unchecked((int)format),
+ new HandleRef(this, nativeImage),
+ out dstHandle);
+
+ if (status != SafeNativeMethods.Gdip.Ok || dstHandle == IntPtr.Zero)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return Bitmap.FromGDIplus(dstHandle);
+ }
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.Clone1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Creates a copy of the section of this
+ /// Bitmap defined by <paramref term="rect"/> with a specified <see cref='System.Drawing.Imaging.PixelFormat'/>.
+ /// </para>
+ /// </devdoc>
+ // float version
+ public Bitmap Clone(RectangleF rect, PixelFormat format)
+ {
+ //validate the rect
+ if (rect.Width == 0 || rect.Height == 0)
+ {
+ throw new ArgumentException(SR.Format(SR.GdiplusInvalidRectangle, rect.ToString()));
+ }
+
+ IntPtr dstHandle = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCloneBitmapArea(
+ rect.X,
+ rect.Y,
+ rect.Width,
+ rect.Height,
+ unchecked((int)format),
+ new HandleRef(this, nativeImage),
+ out dstHandle);
+
+ if (status != SafeNativeMethods.Gdip.Ok || dstHandle == IntPtr.Zero)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return Bitmap.FromGDIplus(dstHandle);
+ }
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.MakeTransparent"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Makes the default transparent color transparent for this <see cref='System.Drawing.Bitmap'/>
+ /// .
+ /// </para>
+ /// </devdoc>
+ public void MakeTransparent()
+ {
+ Color transparent = s_defaultTransparentColor;
+ if (Height > 0 && Width > 0)
+ transparent = GetPixel(0, Size.Height - 1);
+ if (transparent.A < 255)
+ {
+ // It's already transparent, and if we proceeded, we will do something
+ // unintended like making black transparent
+ return;
+ }
+ MakeTransparent(transparent);
+ }
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.MakeTransparent1"]/*' />
+ /// <devdoc>
+ /// Makes the specified color transparent
+ /// for this <see cref='System.Drawing.Bitmap'/>.
+ /// </devdoc>
+ public void MakeTransparent(Color transparentColor)
+ {
+ if (RawFormat.Guid == ImageFormat.Icon.Guid)
+ {
+ throw new InvalidOperationException(SR.Format(SR.CantMakeIconTransparent));
+ }
+
+ Size size = Size;
+
+ // The new bitmap must be in 32bppARGB format, because that's the only
+ // thing that supports alpha. (And that's what the image is initialized to -- transparent)
+ Bitmap result = null;
+ Graphics graphics = null;
+ try
+ {
+ result = new Bitmap(size.Width, size.Height, PixelFormat.Format32bppArgb);
+ try
+ {
+ graphics = Graphics.FromImage(result);
+ graphics.Clear(Color.Transparent);
+ Rectangle rectangle = new Rectangle(0, 0, size.Width, size.Height);
+
+ ImageAttributes attributes = null;
+ try
+ {
+ attributes = new ImageAttributes();
+ attributes.SetColorKey(transparentColor, transparentColor);
+ graphics.DrawImage(this, rectangle,
+ 0, 0, size.Width, size.Height,
+ GraphicsUnit.Pixel, attributes, null, IntPtr.Zero);
+ }
+ finally
+ {
+ if (attributes != null)
+ {
+ attributes.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (graphics != null)
+ {
+ graphics.Dispose();
+ }
+ }
+
+ // Swap nativeImage pointers to make it look like we modified the image in place
+ IntPtr temp = nativeImage;
+ nativeImage = result.nativeImage;
+ result.nativeImage = temp;
+ }
+ finally
+ {
+ if (result != null)
+ {
+ result.Dispose();
+ }
+ }
+ }
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.LockBits"]/*' />
+ /// <devdoc>
+ /// Locks a Bitmap into system memory.
+ /// </devdoc>
+ [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
+ public BitmapData LockBits(Rectangle rect, ImageLockMode flags, PixelFormat format)
+ {
+ Contract.Ensures(Contract.Result<BitmapData>() != null);
+
+ BitmapData bitmapData = new BitmapData();
+
+ return LockBits(rect, flags, format, bitmapData);
+ }
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.LockBits1"]/*' />
+ /// <devdoc>
+ /// Locks a Bitmap into system memory. This overload takes a user-defined
+ /// BitmapData object and is intended to be used with an ImageLockMode.UserInputBuffer.
+ /// </devdoc>
+ [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
+ public BitmapData LockBits(Rectangle rect, ImageLockMode flags, PixelFormat format, BitmapData bitmapData)
+ {
+ Contract.Ensures(Contract.Result<BitmapData>() != null);
+
+ GPRECT gprect = new GPRECT(rect);
+ int status = SafeNativeMethods.Gdip.GdipBitmapLockBits(new HandleRef(this, nativeImage), ref gprect,
+ flags, format, bitmapData);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return bitmapData;
+ }
+
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.UnlockBits"]/*' />
+ /// <devdoc>
+ /// Unlocks this <see cref='System.Drawing.Bitmap'/> from system memory.
+ /// </devdoc>
+ [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
+ public void UnlockBits(BitmapData bitmapdata)
+ {
+ int status = SafeNativeMethods.Gdip.GdipBitmapUnlockBits(new HandleRef(this, nativeImage), bitmapdata);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.GetPixel"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the color of the specified pixel
+ /// in this <see cref='System.Drawing.Bitmap'/>.
+ /// </para>
+ /// </devdoc>
+ public Color GetPixel(int x, int y)
+ {
+ int color = 0;
+
+ if (x < 0 || x >= Width)
+ {
+ throw new ArgumentOutOfRangeException("x", SR.Format(SR.ValidRangeX));
+ }
+
+ if (y < 0 || y >= Height)
+ {
+ throw new ArgumentOutOfRangeException("y", SR.Format(SR.ValidRangeY));
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipBitmapGetPixel(new HandleRef(this, nativeImage), x, y, out color);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return Color.FromArgb(color);
+ }
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.SetPixel"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Sets the color of the specified pixel in this <see cref='System.Drawing.Bitmap'/> .
+ /// </para>
+ /// </devdoc>
+ public void SetPixel(int x, int y, Color color)
+ {
+ if ((PixelFormat & PixelFormat.Indexed) != 0)
+ {
+ throw new InvalidOperationException(SR.Format(SR.GdiplusCannotSetPixelFromIndexedPixelFormat));
+ }
+
+ if (x < 0 || x >= Width)
+ {
+ throw new ArgumentOutOfRangeException("x", SR.Format(SR.ValidRangeX));
+ }
+
+ if (y < 0 || y >= Height)
+ {
+ throw new ArgumentOutOfRangeException("y", SR.Format(SR.ValidRangeY));
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipBitmapSetPixel(new HandleRef(this, nativeImage), x, y, color.ToArgb());
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.SetResolution"]/*' />
+ /// <devdoc>
+ /// Sets the resolution for this <see cref='System.Drawing.Bitmap'/>.
+ /// </devdoc>
+ public void SetResolution(float xDpi, float yDpi)
+ {
+ int status = SafeNativeMethods.Gdip.GdipBitmapSetResolution(new HandleRef(this, nativeImage), xDpi, yDpi);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/BitmapSelector.cs b/src/System.Drawing.Common/src/System/Drawing/BitmapSelector.cs
new file mode 100644
index 0000000000..d965609a91
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/BitmapSelector.cs
@@ -0,0 +1,251 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.Configuration;
+ using System.Drawing.Configuration;
+ using System.IO;
+ using System.Reflection;
+
+ /// <summary>
+ /// Provides methods to select from multiple bitmaps depending on a "bitmapSuffix" config setting.
+ /// </summary>
+ internal static class BitmapSelector
+ {
+ /// <summary>
+ /// Gets the bitmap ID suffix defined in the application configuration, or string.Empty if
+ /// the suffix is not specified. Internal for unit tests
+ /// </summary>
+ /// <remarks>
+ /// For performance, the suffix is cached in a static variable so it only has to be read
+ /// once per appdomain.
+ /// </remarks>
+ private static string s_suffix;
+ internal static string Suffix
+ {
+ get
+ {
+ if (s_suffix == null)
+ {
+ s_suffix = string.Empty;
+ var section = ConfigurationManager.GetSection("system.drawing") as SystemDrawingSection;
+ if (section != null)
+ {
+ var value = section.BitmapSuffix;
+ if (value != null && value is string)
+ {
+ s_suffix = (string)value;
+ }
+ }
+ }
+ return s_suffix;
+ }
+ set
+ {
+ // So unit tests can clear the cached suffix
+ s_suffix = value;
+ }
+ }
+
+ /// <summary>
+ /// Appends the current suffix to <paramref name="filePath"/>. The suffix is appended
+ /// before the existing extension (if any). Internal for unit tests.
+ /// </summary>
+ /// <returns>
+ /// The new path with the suffix included. If there is no suffix defined or there are
+ /// invalid characters in the original path, the original path is returned.
+ /// </returns>
+ internal static string AppendSuffix(string filePath)
+ {
+ try
+ {
+ return Path.ChangeExtension(filePath, Suffix + Path.GetExtension(filePath));
+ }
+ catch (ArgumentException)
+ { // there are invalid characters in the path
+ return filePath;
+ }
+ }
+
+ /// <summary>
+ /// Returns <paramref name="originalPath"/> with the current suffix appended (before the
+ /// existing extension) if the resulting file path exists; otherwise the original path is
+ /// returned.
+ /// </summary>
+ public static string GetFileName(string originalPath)
+ {
+ if (Suffix == string.Empty)
+ return originalPath;
+
+ string newPath = AppendSuffix(originalPath);
+ return File.Exists(newPath) ? newPath : originalPath;
+ }
+
+ // Calls assembly.GetManifestResourceStream in a try/catch and returns null if not found
+ private static Stream GetResourceStreamHelper(Assembly assembly, Type type, string name)
+ {
+ Stream stream = null;
+ try
+ {
+ stream = assembly.GetManifestResourceStream(type, name);
+ }
+ catch (FileNotFoundException)
+ {
+ }
+ return stream;
+ }
+
+ private static bool DoesAssemblyHaveCustomAttribute(Assembly assembly, string typeName)
+ {
+ return DoesAssemblyHaveCustomAttribute(assembly, assembly.GetType(typeName));
+ }
+
+ private static bool DoesAssemblyHaveCustomAttribute(Assembly assembly, Type attrType)
+ {
+ if (attrType != null)
+ {
+ var attr = assembly.GetCustomAttributes(attrType, false);
+ if (attr.Length > 0)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ // internal for unit tests
+ internal static bool SatelliteAssemblyOptIn(Assembly assembly)
+ {
+ // Try 4.5 public attribute type first
+ if (DoesAssemblyHaveCustomAttribute(assembly, typeof(BitmapSuffixInSatelliteAssemblyAttribute)))
+ {
+ return true;
+ }
+
+ // Also load attribute type by name for dlls compiled against older frameworks
+ return DoesAssemblyHaveCustomAttribute(assembly, "System.Drawing.BitmapSuffixInSatelliteAssemblyAttribute");
+ }
+
+ // internal for unit tests
+ internal static bool SameAssemblyOptIn(Assembly assembly)
+ {
+ // Try 4.5 public attribute type first
+ if (DoesAssemblyHaveCustomAttribute(assembly, typeof(BitmapSuffixInSameAssemblyAttribute)))
+ {
+ return true;
+ }
+
+ // Also load attribute type by name for dlls compiled against older frameworks
+ return DoesAssemblyHaveCustomAttribute(assembly, "System.Drawing.BitmapSuffixInSameAssemblyAttribute");
+ }
+
+ /// <summary>
+ /// Returns a resource stream loaded from the appropriate location according to the current
+ /// suffix.
+ /// </summary>
+ /// <param name="assembly">The assembly from which the stream is loaded</param>
+ /// <param name="type">The type whose namespace is used to scope the manifest resource name</param>
+ /// <param name="originalName">The name of the manifest resource being requested</param>
+ /// <returns>
+ /// The manifest resource stream corresponding to <paramref name="originalName"/> with the
+ /// current suffix applied; or if that is not found, the stream corresponding to <paramref name="originalName"/>.
+ /// </returns>
+ public static Stream GetResourceStream(Assembly assembly, Type type, string originalName)
+ {
+ if (Suffix != string.Empty)
+ {
+ try
+ {
+ // Resource with suffix has highest priority
+ if (SameAssemblyOptIn(assembly))
+ {
+ string newName = AppendSuffix(originalName);
+ Stream stream = GetResourceStreamHelper(assembly, type, newName);
+ if (stream != null)
+ {
+ return stream;
+ }
+ }
+ }
+ catch
+ {
+ // Ignore failures and continue to try other options
+ }
+
+ try
+ {
+ // Satellite assembly has second priority, using the original name
+ if (SatelliteAssemblyOptIn(assembly))
+ {
+ AssemblyName assemblyName = assembly.GetName();
+ assemblyName.Name += Suffix;
+ assemblyName.ProcessorArchitecture = ProcessorArchitecture.None;
+ Assembly satellite = Assembly.Load(assemblyName);
+ if (satellite != null)
+ {
+ Stream stream = GetResourceStreamHelper(satellite, type, originalName);
+ if (stream != null)
+ {
+ return stream;
+ }
+ }
+ }
+ }
+ catch
+ {
+ // Ignore failures and continue to try other options
+ }
+ }
+
+ // Otherwise fall back to specified assembly and original name requested
+ return assembly.GetManifestResourceStream(type, originalName);
+ }
+
+ /// <summary>
+ /// Returns a resource stream loaded from the appropriate location according to the current
+ /// suffix.
+ /// </summary>
+ /// <param name="type">The type from whose assembly the stream is loaded and whose namespace is used to scope the resource name</param>
+ /// <param name="originalName">The name of the manifest resource being requested</param>
+ /// <returns>
+ /// The manifest resource stream corresponding to <paramref name="originalName"/> with the
+ /// current suffix applied; or if that is not found, the stream corresponding to <paramref name="originalName"/>.
+ /// </returns>
+ public static Stream GetResourceStream(Type type, string originalName)
+ {
+ return GetResourceStream(type.Module.Assembly, type, originalName);
+ }
+
+ /// <summary>
+ /// Returns an Icon created from a resource stream loaded from the appropriate location according to the current
+ /// suffix.
+ /// </summary>
+ /// <param name="type">The type from whose assembly the stream is loaded and whose namespace is used to scope the resource name</param>
+ /// <param name="originalName">The name of the manifest resource being requested</param>
+ /// <returns>
+ /// The icon created from a manifest resource stream corresponding to <paramref name="originalName"/> with the
+ /// current suffix applied; or if that is not found, the stream corresponding to <paramref name="originalName"/>.
+ /// </returns>
+ public static Icon CreateIcon(Type type, string originalName)
+ {
+ return new Icon(GetResourceStream(type, originalName));
+ }
+
+ /// <summary>
+ /// Returns an Bitmap created from a resource stream loaded from the appropriate location according to the current
+ /// suffix.
+ /// </summary>
+ /// <param name="type">The type from whose assembly the stream is loaded and whose namespace is used to scope the resource name</param>
+ /// <param name="originalName">The name of the manifest resource being requested</param>
+ /// <returns>
+ /// The bitmap created from a manifest resource stream corresponding to <paramref name="originalName"/> with the
+ /// current suffix applied; or if that is not found, the stream corresponding to <paramref name="originalName"/>.
+ /// </returns>
+ public static Bitmap CreateBitmap(Type type, string originalName)
+ {
+ return new Bitmap(GetResourceStream(type, originalName));
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/BitmapSuffixInSameAssemblyAttribute.cs b/src/System.Drawing.Common/src/System/Drawing/BitmapSuffixInSameAssemblyAttribute.cs
new file mode 100644
index 0000000000..f85b16caf5
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/BitmapSuffixInSameAssemblyAttribute.cs
@@ -0,0 +1,15 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ /// <summary>
+ /// Opt-In flag to look for resources in the same assembly but with the "bitmapSuffix" config setting.
+ /// i.e. System.Web.UI.WebControl.Button.bmp -> System.Web.UI.WebControl.Button.VisualStudio.11.0.bmp
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Assembly)]
+ public class BitmapSuffixInSameAssemblyAttribute : Attribute
+ {
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/BitmapSuffixInSatelliteAssemblyAttribute.cs b/src/System.Drawing.Common/src/System/Drawing/BitmapSuffixInSatelliteAssemblyAttribute.cs
new file mode 100644
index 0000000000..c447ea2844
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/BitmapSuffixInSatelliteAssemblyAttribute.cs
@@ -0,0 +1,15 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ /// <summary>
+ /// Opt-In flag to look for resources in the another assembly with the "bitmapSuffix" config setting
+ /// i.e. System.Web.dll -> System.Web<.VisualStudio.11.0>.dll
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Assembly)]
+ public class BitmapSuffixInSatelliteAssemblyAttribute : Attribute
+ {
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Brush.cs b/src/System.Drawing.Common/src/System/Drawing/Brush.cs
new file mode 100644
index 0000000000..2d77ad6e8a
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Brush.cs
@@ -0,0 +1,133 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.ComponentModel;
+ using System.Diagnostics;
+ using System.Globalization;
+ using System.Runtime.InteropServices;
+
+ /**
+ * Represent a Brush object
+ */
+ /// <include file='doc\Brush.uex' path='docs/doc[@for="Brush"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Classes derrived from this abstract base class define objects used to fill the
+ /// interiors of graphical shapes such as rectangles, ellipses, pies, polygons, and paths.
+ /// </para>
+ /// </devdoc>
+ public abstract class Brush : MarshalByRefObject, ICloneable, IDisposable
+ {
+#if FINALIZATION_WATCH
+ private string allocationSite = Graphics.GetAllocationStack();
+#endif
+ // handle to native GDI+ brush object to be used on demand.
+ /// <include file='doc\Brush.uex' path='docs/doc[@for="Brush.nativeBrush;"]/*' />
+ private IntPtr _nativeBrush;
+
+ /// <include file='doc\Brush.uex' path='docs/doc[@for="Brush.Clone"]/*' />
+ /// <devdoc>
+ /// When overriden in a derived class, creates
+ /// an exact copy of this <see cref='System.Drawing.Brush'/>.
+ /// </devdoc>
+ public abstract object Clone();
+
+
+ /// <devdoc>
+ /// Sets the native GDI+ brush reference.
+ /// Note: This method is intended to be used by derived classes only! (internal protected doesn't work as in C++).
+ /// </devdoc>
+ protected internal void SetNativeBrush(IntPtr brush)
+ {
+ SetNativeBrushInternal(brush);
+ }
+
+ internal void SetNativeBrushInternal(IntPtr brush)
+ {
+ Debug.Assert(brush != IntPtr.Zero, "WARNING: Assigning null to the GDI+ native brush object.");
+ Debug.Assert(_nativeBrush == IntPtr.Zero, "WARNING: Initialized GDI+ native brush object being assigned a new value.");
+
+ _nativeBrush = brush;
+ }
+
+
+ /// <devdoc>
+ /// Gets the GDI+ native object reference. Triggers GDI+ obect initialization.
+ /// </devdoc>
+ [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
+ internal IntPtr NativeBrush
+ {
+ get
+ {
+ //Need to comment this line out to allow for checking this.NativePen == IntPtr.Zero.
+ //Debug.Assert(this.nativeBrush != IntPtr.Zero, "this.nativeBrush == null." );
+ return _nativeBrush;
+ }
+ }
+
+ /// <include file='doc\Brush.uex' path='docs/doc[@for="Brush.Dispose"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Deletes this <see cref='System.Drawing.Brush'/>.
+ /// </para>
+ /// </devdoc>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <include file='doc\Brush.uex' path='docs/doc[@for="Brush.Dispose1"]/*' />
+ protected virtual void Dispose(bool disposing)
+ {
+#if FINALIZATION_WATCH
+ if (!disposing && nativeBrush != IntPtr.Zero )
+ Debug.WriteLine("**********************\nDisposed through finalization:\n" + allocationSite);
+#endif
+
+ if (_nativeBrush != IntPtr.Zero)
+ {
+ try
+ {
+#if DEBUG
+ int status =
+#endif
+ SafeNativeMethods.Gdip.GdipDeleteBrush(new HandleRef(this, _nativeBrush));
+#if DEBUG
+ Debug.Assert(status == SafeNativeMethods.Gdip.Ok, "GDI+ returned an error status: " + status.ToString(CultureInfo.InvariantCulture));
+#endif
+ }
+ catch (Exception ex)
+ {
+ if (ClientUtils.IsSecurityOrCriticalException(ex))
+ {
+ throw;
+ }
+
+ Debug.Fail("Exception thrown during Dispose: " + ex.ToString());
+ }
+ finally
+ {
+ _nativeBrush = IntPtr.Zero;
+ }
+ }
+ }
+
+ /**
+ * Object cleanup
+ */
+ /// <include file='doc\Brush.uex' path='docs/doc[@for="Brush.Finalize"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Releases memory allocated for this <see cref='System.Drawing.Brush'/>.
+ /// </para>
+ /// </devdoc>
+ ~Brush()
+ {
+ Dispose(false);
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Brushes.cs b/src/System.Drawing.Common/src/System/Drawing/Brushes.cs
new file mode 100644
index 0000000000..d8c2d6db5c
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Brushes.cs
@@ -0,0 +1,2698 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes"]/*' />
+ /// <devdoc>
+ /// Brushes for all the standard colors.
+ /// </devdoc>
+ public sealed class Brushes
+ {
+ private static readonly object s_transparentKey = new object();
+ private static readonly object s_aliceBlueKey = new object();
+ private static readonly object s_antiqueWhiteKey = new object();
+ private static readonly object s_aquaKey = new object();
+ private static readonly object s_aquamarineKey = new object();
+ private static readonly object s_azureKey = new object();
+ private static readonly object s_beigeKey = new object();
+ private static readonly object s_bisqueKey = new object();
+ private static readonly object s_blackKey = new object();
+ private static readonly object s_blanchedAlmondKey = new object();
+ private static readonly object s_blueKey = new object();
+ private static readonly object s_blueVioletKey = new object();
+ private static readonly object s_brownKey = new object();
+ private static readonly object s_burlyWoodKey = new object();
+ private static readonly object s_cadetBlueKey = new object();
+ private static readonly object s_chartreuseKey = new object();
+ private static readonly object s_chocolateKey = new object();
+ private static readonly object s_choralKey = new object();
+ private static readonly object s_cornflowerBlueKey = new object();
+ private static readonly object s_cornsilkKey = new object();
+ private static readonly object s_crimsonKey = new object();
+ private static readonly object s_cyanKey = new object();
+ private static readonly object s_darkBlueKey = new object();
+ private static readonly object s_darkCyanKey = new object();
+ private static readonly object s_darkGoldenrodKey = new object();
+ private static readonly object s_darkGrayKey = new object();
+ private static readonly object s_darkGreenKey = new object();
+ private static readonly object s_darkKhakiKey = new object();
+ private static readonly object s_darkMagentaKey = new object();
+ private static readonly object s_darkOliveGreenKey = new object();
+ private static readonly object s_darkOrangeKey = new object();
+ private static readonly object s_darkOrchidKey = new object();
+ private static readonly object s_darkRedKey = new object();
+ private static readonly object s_darkSalmonKey = new object();
+ private static readonly object s_darkSeaGreenKey = new object();
+ private static readonly object s_darkSlateBlueKey = new object();
+ private static readonly object s_darkSlateGrayKey = new object();
+ private static readonly object s_darkTurquoiseKey = new object();
+ private static readonly object s_darkVioletKey = new object();
+ private static readonly object s_deepPinkKey = new object();
+ private static readonly object s_deepSkyBlueKey = new object();
+ private static readonly object s_dimGrayKey = new object();
+ private static readonly object s_dodgerBlueKey = new object();
+ private static readonly object s_firebrickKey = new object();
+ private static readonly object s_floralWhiteKey = new object();
+ private static readonly object s_forestGreenKey = new object();
+ private static readonly object s_fuchiaKey = new object();
+ private static readonly object s_gainsboroKey = new object();
+ private static readonly object s_ghostWhiteKey = new object();
+ private static readonly object s_goldKey = new object();
+ private static readonly object s_goldenrodKey = new object();
+ private static readonly object s_grayKey = new object();
+ private static readonly object s_greenKey = new object();
+ private static readonly object s_greenYellowKey = new object();
+ private static readonly object s_honeydewKey = new object();
+ private static readonly object s_hotPinkKey = new object();
+ private static readonly object s_indianRedKey = new object();
+ private static readonly object s_indigoKey = new object();
+ private static readonly object s_ivoryKey = new object();
+ private static readonly object s_khakiKey = new object();
+ private static readonly object s_lavenderKey = new object();
+ private static readonly object s_lavenderBlushKey = new object();
+ private static readonly object s_lawnGreenKey = new object();
+ private static readonly object s_lemonChiffonKey = new object();
+ private static readonly object s_lightBlueKey = new object();
+ private static readonly object s_lightCoralKey = new object();
+ private static readonly object s_lightCyanKey = new object();
+ private static readonly object s_lightGoldenrodYellowKey = new object();
+ private static readonly object s_lightGreenKey = new object();
+ private static readonly object s_lightGrayKey = new object();
+ private static readonly object s_lightPinkKey = new object();
+ private static readonly object s_lightSalmonKey = new object();
+ private static readonly object s_lightSeaGreenKey = new object();
+ private static readonly object s_lightSkyBlueKey = new object();
+ private static readonly object s_lightSlateGrayKey = new object();
+ private static readonly object s_lightSteelBlueKey = new object();
+ private static readonly object s_lightYellowKey = new object();
+ private static readonly object s_limeKey = new object();
+ private static readonly object s_limeGreenKey = new object();
+ private static readonly object s_linenKey = new object();
+ private static readonly object s_magentaKey = new object();
+ private static readonly object s_maroonKey = new object();
+ private static readonly object s_mediumAquamarineKey = new object();
+ private static readonly object s_mediumBlueKey = new object();
+ private static readonly object s_mediumOrchidKey = new object();
+ private static readonly object s_mediumPurpleKey = new object();
+ private static readonly object s_mediumSeaGreenKey = new object();
+ private static readonly object s_mediumSlateBlueKey = new object();
+ private static readonly object s_mediumSpringGreenKey = new object();
+ private static readonly object s_mediumTurquoiseKey = new object();
+ private static readonly object s_mediumVioletRedKey = new object();
+ private static readonly object s_midnightBlueKey = new object();
+ private static readonly object s_mintCreamKey = new object();
+ private static readonly object s_mistyRoseKey = new object();
+ private static readonly object s_moccasinKey = new object();
+ private static readonly object s_navajoWhiteKey = new object();
+ private static readonly object s_navyKey = new object();
+ private static readonly object s_oldLaceKey = new object();
+ private static readonly object s_oliveKey = new object();
+ private static readonly object s_oliveDrabKey = new object();
+ private static readonly object s_orangeKey = new object();
+ private static readonly object s_orangeRedKey = new object();
+ private static readonly object s_orchidKey = new object();
+ private static readonly object s_paleGoldenrodKey = new object();
+ private static readonly object s_paleGreenKey = new object();
+ private static readonly object s_paleTurquoiseKey = new object();
+ private static readonly object s_paleVioletRedKey = new object();
+ private static readonly object s_papayaWhipKey = new object();
+ private static readonly object s_peachPuffKey = new object();
+ private static readonly object s_peruKey = new object();
+ private static readonly object s_pinkKey = new object();
+ private static readonly object s_plumKey = new object();
+ private static readonly object s_powderBlueKey = new object();
+ private static readonly object s_purpleKey = new object();
+ private static readonly object s_redKey = new object();
+ private static readonly object s_rosyBrownKey = new object();
+ private static readonly object s_royalBlueKey = new object();
+ private static readonly object s_saddleBrownKey = new object();
+ private static readonly object s_salmonKey = new object();
+ private static readonly object s_sandyBrownKey = new object();
+ private static readonly object s_seaGreenKey = new object();
+ private static readonly object s_seaShellKey = new object();
+ private static readonly object s_siennaKey = new object();
+ private static readonly object s_silverKey = new object();
+ private static readonly object s_skyBlueKey = new object();
+ private static readonly object s_slateBlueKey = new object();
+ private static readonly object s_slateGrayKey = new object();
+ private static readonly object s_snowKey = new object();
+ private static readonly object s_springGreenKey = new object();
+ private static readonly object s_steelBlueKey = new object();
+ private static readonly object s_tanKey = new object();
+ private static readonly object s_tealKey = new object();
+ private static readonly object s_thistleKey = new object();
+ private static readonly object s_tomatoKey = new object();
+ private static readonly object s_turquoiseKey = new object();
+ private static readonly object s_violetKey = new object();
+ private static readonly object s_wheatKey = new object();
+ private static readonly object s_whiteKey = new object();
+ private static readonly object s_whiteSmokeKey = new object();
+ private static readonly object s_yellowKey = new object();
+ private static readonly object s_yellowGreenKey = new object();
+
+ private Brushes()
+ {
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Transparent"]/*' />
+ /// <devdoc>
+ /// A transparent brush.
+ /// </devdoc>
+ public static Brush Transparent
+ {
+ get
+ {
+ Brush transparent = (Brush)SafeNativeMethods.Gdip.ThreadData[s_transparentKey];
+ if (transparent == null)
+ {
+ transparent = new SolidBrush(Color.Transparent);
+ SafeNativeMethods.Gdip.ThreadData[s_transparentKey] = transparent;
+ }
+ return transparent;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.AliceBlue"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush AliceBlue
+ {
+ get
+ {
+ Brush aliceBlue = (Brush)SafeNativeMethods.Gdip.ThreadData[s_aliceBlueKey];
+ if (aliceBlue == null)
+ {
+ aliceBlue = new SolidBrush(Color.AliceBlue);
+ SafeNativeMethods.Gdip.ThreadData[s_aliceBlueKey] = aliceBlue;
+ }
+ return aliceBlue;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.AntiqueWhite"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush AntiqueWhite
+ {
+ get
+ {
+ Brush antiqueWhite = (Brush)SafeNativeMethods.Gdip.ThreadData[s_antiqueWhiteKey];
+ if (antiqueWhite == null)
+ {
+ antiqueWhite = new SolidBrush(Color.AntiqueWhite);
+ SafeNativeMethods.Gdip.ThreadData[s_antiqueWhiteKey] = antiqueWhite;
+ }
+ return antiqueWhite;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Aqua"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Aqua
+ {
+ get
+ {
+ Brush aqua = (Brush)SafeNativeMethods.Gdip.ThreadData[s_aquaKey];
+ if (aqua == null)
+ {
+ aqua = new SolidBrush(Color.Aqua);
+ SafeNativeMethods.Gdip.ThreadData[s_aquaKey] = aqua;
+ }
+ return aqua;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Aquamarine"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Aquamarine
+ {
+ get
+ {
+ Brush aquamarine = (Brush)SafeNativeMethods.Gdip.ThreadData[s_aquamarineKey];
+ if (aquamarine == null)
+ {
+ aquamarine = new SolidBrush(Color.Aquamarine);
+ SafeNativeMethods.Gdip.ThreadData[s_aquamarineKey] = aquamarine;
+ }
+ return aquamarine;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Azure"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Azure
+ {
+ get
+ {
+ Brush azure = (Brush)SafeNativeMethods.Gdip.ThreadData[s_azureKey];
+ if (azure == null)
+ {
+ azure = new SolidBrush(Color.Azure);
+ SafeNativeMethods.Gdip.ThreadData[s_azureKey] = azure;
+ }
+ return azure;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Beige"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Beige
+ {
+ get
+ {
+ Brush beige = (Brush)SafeNativeMethods.Gdip.ThreadData[s_beigeKey];
+ if (beige == null)
+ {
+ beige = new SolidBrush(Color.Beige);
+ SafeNativeMethods.Gdip.ThreadData[s_beigeKey] = beige;
+ }
+ return beige;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Bisque"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Bisque
+ {
+ get
+ {
+ Brush bisque = (Brush)SafeNativeMethods.Gdip.ThreadData[s_bisqueKey];
+ if (bisque == null)
+ {
+ bisque = new SolidBrush(Color.Bisque);
+ SafeNativeMethods.Gdip.ThreadData[s_bisqueKey] = bisque;
+ }
+ return bisque;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Black"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Black
+ {
+ get
+ {
+ Brush black = (Brush)SafeNativeMethods.Gdip.ThreadData[s_blackKey];
+ if (black == null)
+ {
+ black = new SolidBrush(Color.Black);
+ SafeNativeMethods.Gdip.ThreadData[s_blackKey] = black;
+ }
+ return black;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.BlanchedAlmond"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush BlanchedAlmond
+ {
+ get
+ {
+ Brush blanchedAlmond = (Brush)SafeNativeMethods.Gdip.ThreadData[s_blanchedAlmondKey];
+ if (blanchedAlmond == null)
+ {
+ blanchedAlmond = new SolidBrush(Color.BlanchedAlmond);
+ SafeNativeMethods.Gdip.ThreadData[s_blanchedAlmondKey] = blanchedAlmond;
+ }
+ return blanchedAlmond;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Blue"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Blue
+ {
+ get
+ {
+ Brush blue = (Brush)SafeNativeMethods.Gdip.ThreadData[s_blueKey];
+ if (blue == null)
+ {
+ blue = new SolidBrush(Color.Blue);
+ SafeNativeMethods.Gdip.ThreadData[s_blueKey] = blue;
+ }
+ return blue;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.BlueViolet"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush BlueViolet
+ {
+ get
+ {
+ Brush blueViolet = (Brush)SafeNativeMethods.Gdip.ThreadData[s_blueVioletKey];
+ if (blueViolet == null)
+ {
+ blueViolet = new SolidBrush(Color.BlueViolet);
+ SafeNativeMethods.Gdip.ThreadData[s_blueVioletKey] = blueViolet;
+ }
+ return blueViolet;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Brown"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Brown
+ {
+ get
+ {
+ Brush brown = (Brush)SafeNativeMethods.Gdip.ThreadData[s_brownKey];
+ if (brown == null)
+ {
+ brown = new SolidBrush(Color.Brown);
+ SafeNativeMethods.Gdip.ThreadData[s_brownKey] = brown;
+ }
+ return brown;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.BurlyWood"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush BurlyWood
+ {
+ get
+ {
+ Brush burlyWood = (Brush)SafeNativeMethods.Gdip.ThreadData[s_burlyWoodKey];
+ if (burlyWood == null)
+ {
+ burlyWood = new SolidBrush(Color.BurlyWood);
+ SafeNativeMethods.Gdip.ThreadData[s_burlyWoodKey] = burlyWood;
+ }
+ return burlyWood;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.CadetBlue"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush CadetBlue
+ {
+ get
+ {
+ Brush cadetBlue = (Brush)SafeNativeMethods.Gdip.ThreadData[s_cadetBlueKey];
+ if (cadetBlue == null)
+ {
+ cadetBlue = new SolidBrush(Color.CadetBlue);
+ SafeNativeMethods.Gdip.ThreadData[s_cadetBlueKey] = cadetBlue;
+ }
+ return cadetBlue;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Chartreuse"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Chartreuse
+ {
+ get
+ {
+ Brush chartreuse = (Brush)SafeNativeMethods.Gdip.ThreadData[s_chartreuseKey];
+ if (chartreuse == null)
+ {
+ chartreuse = new SolidBrush(Color.Chartreuse);
+ SafeNativeMethods.Gdip.ThreadData[s_chartreuseKey] = chartreuse;
+ }
+ return chartreuse;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Chocolate"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Chocolate
+ {
+ get
+ {
+ Brush chocolate = (Brush)SafeNativeMethods.Gdip.ThreadData[s_chocolateKey];
+ if (chocolate == null)
+ {
+ chocolate = new SolidBrush(Color.Chocolate);
+ SafeNativeMethods.Gdip.ThreadData[s_chocolateKey] = chocolate;
+ }
+ return chocolate;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Coral"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Coral
+ {
+ get
+ {
+ Brush choral = (Brush)SafeNativeMethods.Gdip.ThreadData[s_choralKey];
+ if (choral == null)
+ {
+ choral = new SolidBrush(Color.Coral);
+ SafeNativeMethods.Gdip.ThreadData[s_choralKey] = choral;
+ }
+ return choral;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.CornflowerBlue"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush CornflowerBlue
+ {
+ get
+ {
+ Brush cornflowerBlue = (Brush)SafeNativeMethods.Gdip.ThreadData[s_cornflowerBlueKey];
+ if (cornflowerBlue == null)
+ {
+ cornflowerBlue = new SolidBrush(Color.CornflowerBlue);
+ SafeNativeMethods.Gdip.ThreadData[s_cornflowerBlueKey] = cornflowerBlue;
+ }
+ return cornflowerBlue;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Cornsilk"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Cornsilk
+ {
+ get
+ {
+ Brush cornsilk = (Brush)SafeNativeMethods.Gdip.ThreadData[s_cornsilkKey];
+ if (cornsilk == null)
+ {
+ cornsilk = new SolidBrush(Color.Cornsilk);
+ SafeNativeMethods.Gdip.ThreadData[s_cornsilkKey] = cornsilk;
+ }
+ return cornsilk;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Crimson"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Crimson
+ {
+ get
+ {
+ Brush crimson = (Brush)SafeNativeMethods.Gdip.ThreadData[s_crimsonKey];
+ if (crimson == null)
+ {
+ crimson = new SolidBrush(Color.Crimson);
+ SafeNativeMethods.Gdip.ThreadData[s_crimsonKey] = crimson;
+ }
+ return crimson;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Cyan"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Cyan
+ {
+ get
+ {
+ Brush cyan = (Brush)SafeNativeMethods.Gdip.ThreadData[s_cyanKey];
+ if (cyan == null)
+ {
+ cyan = new SolidBrush(Color.Cyan);
+ SafeNativeMethods.Gdip.ThreadData[s_cyanKey] = cyan;
+ }
+ return cyan;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.DarkBlue"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush DarkBlue
+ {
+ get
+ {
+ Brush darkBlue = (Brush)SafeNativeMethods.Gdip.ThreadData[s_darkBlueKey];
+ if (darkBlue == null)
+ {
+ darkBlue = new SolidBrush(Color.DarkBlue);
+ SafeNativeMethods.Gdip.ThreadData[s_darkBlueKey] = darkBlue;
+ }
+ return darkBlue;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.DarkCyan"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush DarkCyan
+ {
+ get
+ {
+ Brush darkCyan = (Brush)SafeNativeMethods.Gdip.ThreadData[s_darkCyanKey];
+ if (darkCyan == null)
+ {
+ darkCyan = new SolidBrush(Color.DarkCyan);
+ SafeNativeMethods.Gdip.ThreadData[s_darkCyanKey] = darkCyan;
+ }
+ return darkCyan;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.DarkGoldenrod"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush DarkGoldenrod
+ {
+ get
+ {
+ Brush darkGoldenrod = (Brush)SafeNativeMethods.Gdip.ThreadData[s_darkGoldenrodKey];
+ if (darkGoldenrod == null)
+ {
+ darkGoldenrod = new SolidBrush(Color.DarkGoldenrod);
+ SafeNativeMethods.Gdip.ThreadData[s_darkGoldenrodKey] = darkGoldenrod;
+ }
+ return darkGoldenrod;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.DarkGray"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush DarkGray
+ {
+ get
+ {
+ Brush darkGray = (Brush)SafeNativeMethods.Gdip.ThreadData[s_darkGrayKey];
+ if (darkGray == null)
+ {
+ darkGray = new SolidBrush(Color.DarkGray);
+ SafeNativeMethods.Gdip.ThreadData[s_darkGrayKey] = darkGray;
+ }
+ return darkGray;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.DarkGreen"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush DarkGreen
+ {
+ get
+ {
+ Brush darkGreen = (Brush)SafeNativeMethods.Gdip.ThreadData[s_darkGreenKey];
+ if (darkGreen == null)
+ {
+ darkGreen = new SolidBrush(Color.DarkGreen);
+ SafeNativeMethods.Gdip.ThreadData[s_darkGreenKey] = darkGreen;
+ }
+ return darkGreen;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.DarkKhaki"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush DarkKhaki
+ {
+ get
+ {
+ Brush darkKhaki = (Brush)SafeNativeMethods.Gdip.ThreadData[s_darkKhakiKey];
+ if (darkKhaki == null)
+ {
+ darkKhaki = new SolidBrush(Color.DarkKhaki);
+ SafeNativeMethods.Gdip.ThreadData[s_darkKhakiKey] = darkKhaki;
+ }
+ return darkKhaki;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.DarkMagenta"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush DarkMagenta
+ {
+ get
+ {
+ Brush darkMagenta = (Brush)SafeNativeMethods.Gdip.ThreadData[s_darkMagentaKey];
+ if (darkMagenta == null)
+ {
+ darkMagenta = new SolidBrush(Color.DarkMagenta);
+ SafeNativeMethods.Gdip.ThreadData[s_darkMagentaKey] = darkMagenta;
+ }
+ return darkMagenta;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.DarkOliveGreen"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush DarkOliveGreen
+ {
+ get
+ {
+ Brush darkOliveGreen = (Brush)SafeNativeMethods.Gdip.ThreadData[s_darkOliveGreenKey];
+ if (darkOliveGreen == null)
+ {
+ darkOliveGreen = new SolidBrush(Color.DarkOliveGreen);
+ SafeNativeMethods.Gdip.ThreadData[s_darkOliveGreenKey] = darkOliveGreen;
+ }
+ return darkOliveGreen;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.DarkOrange"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush DarkOrange
+ {
+ get
+ {
+ Brush darkOrange = (Brush)SafeNativeMethods.Gdip.ThreadData[s_darkOrangeKey];
+ if (darkOrange == null)
+ {
+ darkOrange = new SolidBrush(Color.DarkOrange);
+ SafeNativeMethods.Gdip.ThreadData[s_darkOrangeKey] = darkOrange;
+ }
+ return darkOrange;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.DarkOrchid"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush DarkOrchid
+ {
+ get
+ {
+ Brush darkOrchid = (Brush)SafeNativeMethods.Gdip.ThreadData[s_darkOrchidKey];
+ if (darkOrchid == null)
+ {
+ darkOrchid = new SolidBrush(Color.DarkOrchid);
+ SafeNativeMethods.Gdip.ThreadData[s_darkOrchidKey] = darkOrchid;
+ }
+ return darkOrchid;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.DarkRed"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush DarkRed
+ {
+ get
+ {
+ Brush darkRed = (Brush)SafeNativeMethods.Gdip.ThreadData[s_darkRedKey];
+ if (darkRed == null)
+ {
+ darkRed = new SolidBrush(Color.DarkRed);
+ SafeNativeMethods.Gdip.ThreadData[s_darkRedKey] = darkRed;
+ }
+ return darkRed;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.DarkSalmon"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush DarkSalmon
+ {
+ get
+ {
+ Brush darkSalmon = (Brush)SafeNativeMethods.Gdip.ThreadData[s_darkSalmonKey];
+ if (darkSalmon == null)
+ {
+ darkSalmon = new SolidBrush(Color.DarkSalmon);
+ SafeNativeMethods.Gdip.ThreadData[s_darkSalmonKey] = darkSalmon;
+ }
+ return darkSalmon;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.DarkSeaGreen"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush DarkSeaGreen
+ {
+ get
+ {
+ Brush darkSeaGreen = (Brush)SafeNativeMethods.Gdip.ThreadData[s_darkSeaGreenKey];
+ if (darkSeaGreen == null)
+ {
+ darkSeaGreen = new SolidBrush(Color.DarkSeaGreen);
+ SafeNativeMethods.Gdip.ThreadData[s_darkSeaGreenKey] = darkSeaGreen;
+ }
+ return darkSeaGreen;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.DarkSlateBlue"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush DarkSlateBlue
+ {
+ get
+ {
+ Brush darkSlateBlue = (Brush)SafeNativeMethods.Gdip.ThreadData[s_darkSlateBlueKey];
+ if (darkSlateBlue == null)
+ {
+ darkSlateBlue = new SolidBrush(Color.DarkSlateBlue);
+ SafeNativeMethods.Gdip.ThreadData[s_darkSlateBlueKey] = darkSlateBlue;
+ }
+ return darkSlateBlue;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.DarkSlateGray"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush DarkSlateGray
+ {
+ get
+ {
+ Brush darkSlateGray = (Brush)SafeNativeMethods.Gdip.ThreadData[s_darkSlateGrayKey];
+ if (darkSlateGray == null)
+ {
+ darkSlateGray = new SolidBrush(Color.DarkSlateGray);
+ SafeNativeMethods.Gdip.ThreadData[s_darkSlateGrayKey] = darkSlateGray;
+ }
+ return darkSlateGray;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.DarkTurquoise"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush DarkTurquoise
+ {
+ get
+ {
+ Brush darkTurquoise = (Brush)SafeNativeMethods.Gdip.ThreadData[s_darkTurquoiseKey];
+ if (darkTurquoise == null)
+ {
+ darkTurquoise = new SolidBrush(Color.DarkTurquoise);
+ SafeNativeMethods.Gdip.ThreadData[s_darkTurquoiseKey] = darkTurquoise;
+ }
+ return darkTurquoise;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.DarkViolet"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush DarkViolet
+ {
+ get
+ {
+ Brush darkViolet = (Brush)SafeNativeMethods.Gdip.ThreadData[s_darkVioletKey];
+ if (darkViolet == null)
+ {
+ darkViolet = new SolidBrush(Color.DarkViolet);
+ SafeNativeMethods.Gdip.ThreadData[s_darkVioletKey] = darkViolet;
+ }
+ return darkViolet;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.DeepPink"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush DeepPink
+ {
+ get
+ {
+ Brush deepPink = (Brush)SafeNativeMethods.Gdip.ThreadData[s_deepPinkKey];
+ if (deepPink == null)
+ {
+ deepPink = new SolidBrush(Color.DeepPink);
+ SafeNativeMethods.Gdip.ThreadData[s_deepPinkKey] = deepPink;
+ }
+ return deepPink;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.DeepSkyBlue"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush DeepSkyBlue
+ {
+ get
+ {
+ Brush deepSkyBlue = (Brush)SafeNativeMethods.Gdip.ThreadData[s_deepSkyBlueKey];
+ if (deepSkyBlue == null)
+ {
+ deepSkyBlue = new SolidBrush(Color.DeepSkyBlue);
+ SafeNativeMethods.Gdip.ThreadData[s_deepSkyBlueKey] = deepSkyBlue;
+ }
+ return deepSkyBlue;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.DimGray"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush DimGray
+ {
+ get
+ {
+ Brush dimGray = (Brush)SafeNativeMethods.Gdip.ThreadData[s_dimGrayKey];
+ if (dimGray == null)
+ {
+ dimGray = new SolidBrush(Color.DimGray);
+ SafeNativeMethods.Gdip.ThreadData[s_dimGrayKey] = dimGray;
+ }
+ return dimGray;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.DodgerBlue"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush DodgerBlue
+ {
+ get
+ {
+ Brush dodgerBlue = (Brush)SafeNativeMethods.Gdip.ThreadData[s_dodgerBlueKey];
+ if (dodgerBlue == null)
+ {
+ dodgerBlue = new SolidBrush(Color.DodgerBlue);
+ SafeNativeMethods.Gdip.ThreadData[s_dodgerBlueKey] = dodgerBlue;
+ }
+ return dodgerBlue;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Firebrick"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Firebrick
+ {
+ get
+ {
+ Brush firebrick = (Brush)SafeNativeMethods.Gdip.ThreadData[s_firebrickKey];
+ if (firebrick == null)
+ {
+ firebrick = new SolidBrush(Color.Firebrick);
+ SafeNativeMethods.Gdip.ThreadData[s_firebrickKey] = firebrick;
+ }
+ return firebrick;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.FloralWhite"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush FloralWhite
+ {
+ get
+ {
+ Brush floralWhite = (Brush)SafeNativeMethods.Gdip.ThreadData[s_floralWhiteKey];
+ if (floralWhite == null)
+ {
+ floralWhite = new SolidBrush(Color.FloralWhite);
+ SafeNativeMethods.Gdip.ThreadData[s_floralWhiteKey] = floralWhite;
+ }
+ return floralWhite;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.ForestGreen"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush ForestGreen
+ {
+ get
+ {
+ Brush forestGreen = (Brush)SafeNativeMethods.Gdip.ThreadData[s_forestGreenKey];
+ if (forestGreen == null)
+ {
+ forestGreen = new SolidBrush(Color.ForestGreen);
+ SafeNativeMethods.Gdip.ThreadData[s_forestGreenKey] = forestGreen;
+ }
+ return forestGreen;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Fuchsia"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Fuchsia
+ {
+ get
+ {
+ Brush fuchia = (Brush)SafeNativeMethods.Gdip.ThreadData[s_fuchiaKey];
+ if (fuchia == null)
+ {
+ fuchia = new SolidBrush(Color.Fuchsia);
+ SafeNativeMethods.Gdip.ThreadData[s_fuchiaKey] = fuchia;
+ }
+ return fuchia;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Gainsboro"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Gainsboro
+ {
+ get
+ {
+ Brush gainsboro = (Brush)SafeNativeMethods.Gdip.ThreadData[s_gainsboroKey];
+ if (gainsboro == null)
+ {
+ gainsboro = new SolidBrush(Color.Gainsboro);
+ SafeNativeMethods.Gdip.ThreadData[s_gainsboroKey] = gainsboro;
+ }
+ return gainsboro;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.GhostWhite"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush GhostWhite
+ {
+ get
+ {
+ Brush ghostWhite = (Brush)SafeNativeMethods.Gdip.ThreadData[s_ghostWhiteKey];
+ if (ghostWhite == null)
+ {
+ ghostWhite = new SolidBrush(Color.GhostWhite);
+ SafeNativeMethods.Gdip.ThreadData[s_ghostWhiteKey] = ghostWhite;
+ }
+ return ghostWhite;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Gold"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Gold
+ {
+ get
+ {
+ Brush gold = (Brush)SafeNativeMethods.Gdip.ThreadData[s_goldKey];
+ if (gold == null)
+ {
+ gold = new SolidBrush(Color.Gold);
+ SafeNativeMethods.Gdip.ThreadData[s_goldKey] = gold;
+ }
+ return gold;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Goldenrod"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Goldenrod
+ {
+ get
+ {
+ Brush goldenrod = (Brush)SafeNativeMethods.Gdip.ThreadData[s_goldenrodKey];
+ if (goldenrod == null)
+ {
+ goldenrod = new SolidBrush(Color.Goldenrod);
+ SafeNativeMethods.Gdip.ThreadData[s_goldenrodKey] = goldenrod;
+ }
+ return goldenrod;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Gray"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Gray
+ {
+ get
+ {
+ Brush gray = (Brush)SafeNativeMethods.Gdip.ThreadData[s_grayKey];
+ if (gray == null)
+ {
+ gray = new SolidBrush(Color.Gray);
+ SafeNativeMethods.Gdip.ThreadData[s_grayKey] = gray;
+ }
+ return gray;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Green"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Green
+ {
+ get
+ {
+ Brush green = (Brush)SafeNativeMethods.Gdip.ThreadData[s_greenKey];
+ if (green == null)
+ {
+ green = new SolidBrush(Color.Green);
+ SafeNativeMethods.Gdip.ThreadData[s_greenKey] = green;
+ }
+ return green;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.GreenYellow"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush GreenYellow
+ {
+ get
+ {
+ Brush greenYellow = (Brush)SafeNativeMethods.Gdip.ThreadData[s_greenYellowKey];
+ if (greenYellow == null)
+ {
+ greenYellow = new SolidBrush(Color.GreenYellow);
+ SafeNativeMethods.Gdip.ThreadData[s_greenYellowKey] = greenYellow;
+ }
+ return greenYellow;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Honeydew"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Honeydew
+ {
+ get
+ {
+ Brush honeydew = (Brush)SafeNativeMethods.Gdip.ThreadData[s_honeydewKey];
+ if (honeydew == null)
+ {
+ honeydew = new SolidBrush(Color.Honeydew);
+ SafeNativeMethods.Gdip.ThreadData[s_honeydewKey] = honeydew;
+ }
+ return honeydew;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.HotPink"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush HotPink
+ {
+ get
+ {
+ Brush hotPink = (Brush)SafeNativeMethods.Gdip.ThreadData[s_hotPinkKey];
+ if (hotPink == null)
+ {
+ hotPink = new SolidBrush(Color.HotPink);
+ SafeNativeMethods.Gdip.ThreadData[s_hotPinkKey] = hotPink;
+ }
+ return hotPink;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.IndianRed"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush IndianRed
+ {
+ get
+ {
+ Brush indianRed = (Brush)SafeNativeMethods.Gdip.ThreadData[s_indianRedKey];
+ if (indianRed == null)
+ {
+ indianRed = new SolidBrush(Color.IndianRed);
+ SafeNativeMethods.Gdip.ThreadData[s_indianRedKey] = indianRed;
+ }
+ return indianRed;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Indigo"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Indigo
+ {
+ get
+ {
+ Brush indigo = (Brush)SafeNativeMethods.Gdip.ThreadData[s_indigoKey];
+ if (indigo == null)
+ {
+ indigo = new SolidBrush(Color.Indigo);
+ SafeNativeMethods.Gdip.ThreadData[s_indigoKey] = indigo;
+ }
+ return indigo;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Ivory"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Ivory
+ {
+ get
+ {
+ Brush ivory = (Brush)SafeNativeMethods.Gdip.ThreadData[s_ivoryKey];
+ if (ivory == null)
+ {
+ ivory = new SolidBrush(Color.Ivory);
+ SafeNativeMethods.Gdip.ThreadData[s_ivoryKey] = ivory;
+ }
+ return ivory;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Khaki"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Khaki
+ {
+ get
+ {
+ Brush khaki = (Brush)SafeNativeMethods.Gdip.ThreadData[s_khakiKey];
+ if (khaki == null)
+ {
+ khaki = new SolidBrush(Color.Khaki);
+ SafeNativeMethods.Gdip.ThreadData[s_khakiKey] = khaki;
+ }
+ return khaki;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Lavender"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Lavender
+ {
+ get
+ {
+ Brush lavender = (Brush)SafeNativeMethods.Gdip.ThreadData[s_lavenderKey];
+ if (lavender == null)
+ {
+ lavender = new SolidBrush(Color.Lavender);
+ SafeNativeMethods.Gdip.ThreadData[s_lavenderKey] = lavender;
+ }
+ return lavender;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.LavenderBlush"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush LavenderBlush
+ {
+ get
+ {
+ Brush lavenderBlush = (Brush)SafeNativeMethods.Gdip.ThreadData[s_lavenderBlushKey];
+ if (lavenderBlush == null)
+ {
+ lavenderBlush = new SolidBrush(Color.LavenderBlush);
+ SafeNativeMethods.Gdip.ThreadData[s_lavenderBlushKey] = lavenderBlush;
+ }
+ return lavenderBlush;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.LawnGreen"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush LawnGreen
+ {
+ get
+ {
+ Brush lawnGreen = (Brush)SafeNativeMethods.Gdip.ThreadData[s_lawnGreenKey];
+ if (lawnGreen == null)
+ {
+ lawnGreen = new SolidBrush(Color.LawnGreen);
+ SafeNativeMethods.Gdip.ThreadData[s_lawnGreenKey] = lawnGreen;
+ }
+ return lawnGreen;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.LemonChiffon"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush LemonChiffon
+ {
+ get
+ {
+ Brush lemonChiffon = (Brush)SafeNativeMethods.Gdip.ThreadData[s_lemonChiffonKey];
+ if (lemonChiffon == null)
+ {
+ lemonChiffon = new SolidBrush(Color.LemonChiffon);
+ SafeNativeMethods.Gdip.ThreadData[s_lemonChiffonKey] = lemonChiffon;
+ }
+ return lemonChiffon;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.LightBlue"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush LightBlue
+ {
+ get
+ {
+ Brush lightBlue = (Brush)SafeNativeMethods.Gdip.ThreadData[s_lightBlueKey];
+ if (lightBlue == null)
+ {
+ lightBlue = new SolidBrush(Color.LightBlue);
+ SafeNativeMethods.Gdip.ThreadData[s_lightBlueKey] = lightBlue;
+ }
+ return lightBlue;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.LightCoral"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush LightCoral
+ {
+ get
+ {
+ Brush lightCoral = (Brush)SafeNativeMethods.Gdip.ThreadData[s_lightCoralKey];
+ if (lightCoral == null)
+ {
+ lightCoral = new SolidBrush(Color.LightCoral);
+ SafeNativeMethods.Gdip.ThreadData[s_lightCoralKey] = lightCoral;
+ }
+ return lightCoral;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.LightCyan"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush LightCyan
+ {
+ get
+ {
+ Brush lightCyan = (Brush)SafeNativeMethods.Gdip.ThreadData[s_lightCyanKey];
+ if (lightCyan == null)
+ {
+ lightCyan = new SolidBrush(Color.LightCyan);
+ SafeNativeMethods.Gdip.ThreadData[s_lightCyanKey] = lightCyan;
+ }
+ return lightCyan;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.LightGoldenrodYellow"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush LightGoldenrodYellow
+ {
+ get
+ {
+ Brush lightGoldenrodYellow = (Brush)SafeNativeMethods.Gdip.ThreadData[s_lightGoldenrodYellowKey];
+ if (lightGoldenrodYellow == null)
+ {
+ lightGoldenrodYellow = new SolidBrush(Color.LightGoldenrodYellow);
+ SafeNativeMethods.Gdip.ThreadData[s_lightGoldenrodYellowKey] = lightGoldenrodYellow;
+ }
+ return lightGoldenrodYellow;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.LightGreen"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush LightGreen
+ {
+ get
+ {
+ Brush lightGreen = (Brush)SafeNativeMethods.Gdip.ThreadData[s_lightGreenKey];
+ if (lightGreen == null)
+ {
+ lightGreen = new SolidBrush(Color.LightGreen);
+ SafeNativeMethods.Gdip.ThreadData[s_lightGreenKey] = lightGreen;
+ }
+ return lightGreen;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.LightGray"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush LightGray
+ {
+ get
+ {
+ Brush lightGray = (Brush)SafeNativeMethods.Gdip.ThreadData[s_lightGrayKey];
+ if (lightGray == null)
+ {
+ lightGray = new SolidBrush(Color.LightGray);
+ SafeNativeMethods.Gdip.ThreadData[s_lightGrayKey] = lightGray;
+ }
+ return lightGray;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.LightPink"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush LightPink
+ {
+ get
+ {
+ Brush lightPink = (Brush)SafeNativeMethods.Gdip.ThreadData[s_lightPinkKey];
+ if (lightPink == null)
+ {
+ lightPink = new SolidBrush(Color.LightPink);
+ SafeNativeMethods.Gdip.ThreadData[s_lightPinkKey] = lightPink;
+ }
+ return lightPink;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.LightSalmon"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush LightSalmon
+ {
+ get
+ {
+ Brush lightSalmon = (Brush)SafeNativeMethods.Gdip.ThreadData[s_lightSalmonKey];
+ if (lightSalmon == null)
+ {
+ lightSalmon = new SolidBrush(Color.LightSalmon);
+ SafeNativeMethods.Gdip.ThreadData[s_lightSalmonKey] = lightSalmon;
+ }
+ return lightSalmon;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.LightSeaGreen"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush LightSeaGreen
+ {
+ get
+ {
+ Brush lightSeaGreen = (Brush)SafeNativeMethods.Gdip.ThreadData[s_lightSeaGreenKey];
+ if (lightSeaGreen == null)
+ {
+ lightSeaGreen = new SolidBrush(Color.LightSeaGreen);
+ SafeNativeMethods.Gdip.ThreadData[s_lightSeaGreenKey] = lightSeaGreen;
+ }
+ return lightSeaGreen;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.LightSkyBlue"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush LightSkyBlue
+ {
+ get
+ {
+ Brush lightSkyBlue = (Brush)SafeNativeMethods.Gdip.ThreadData[s_lightSkyBlueKey];
+ if (lightSkyBlue == null)
+ {
+ lightSkyBlue = new SolidBrush(Color.LightSkyBlue);
+ SafeNativeMethods.Gdip.ThreadData[s_lightSkyBlueKey] = lightSkyBlue;
+ }
+ return lightSkyBlue;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.LightSlateGray"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush LightSlateGray
+ {
+ get
+ {
+ Brush lightSlateGray = (Brush)SafeNativeMethods.Gdip.ThreadData[s_lightSlateGrayKey];
+ if (lightSlateGray == null)
+ {
+ lightSlateGray = new SolidBrush(Color.LightSlateGray);
+ SafeNativeMethods.Gdip.ThreadData[s_lightSlateGrayKey] = lightSlateGray;
+ }
+ return lightSlateGray;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.LightSteelBlue"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush LightSteelBlue
+ {
+ get
+ {
+ Brush lightSteelBlue = (Brush)SafeNativeMethods.Gdip.ThreadData[s_lightSteelBlueKey];
+ if (lightSteelBlue == null)
+ {
+ lightSteelBlue = new SolidBrush(Color.LightSteelBlue);
+ SafeNativeMethods.Gdip.ThreadData[s_lightSteelBlueKey] = lightSteelBlue;
+ }
+ return lightSteelBlue;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.LightYellow"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush LightYellow
+ {
+ get
+ {
+ Brush lightYellow = (Brush)SafeNativeMethods.Gdip.ThreadData[s_lightYellowKey];
+ if (lightYellow == null)
+ {
+ lightYellow = new SolidBrush(Color.LightYellow);
+ SafeNativeMethods.Gdip.ThreadData[s_lightYellowKey] = lightYellow;
+ }
+ return lightYellow;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Lime"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Lime
+ {
+ get
+ {
+ Brush lime = (Brush)SafeNativeMethods.Gdip.ThreadData[s_limeKey];
+ if (lime == null)
+ {
+ lime = new SolidBrush(Color.Lime);
+ SafeNativeMethods.Gdip.ThreadData[s_limeKey] = lime;
+ }
+ return lime;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.LimeGreen"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush LimeGreen
+ {
+ get
+ {
+ Brush limeGreen = (Brush)SafeNativeMethods.Gdip.ThreadData[s_limeGreenKey];
+ if (limeGreen == null)
+ {
+ limeGreen = new SolidBrush(Color.LimeGreen);
+ SafeNativeMethods.Gdip.ThreadData[s_limeGreenKey] = limeGreen;
+ }
+ return limeGreen;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Linen"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Linen
+ {
+ get
+ {
+ Brush linen = (Brush)SafeNativeMethods.Gdip.ThreadData[s_linenKey];
+ if (linen == null)
+ {
+ linen = new SolidBrush(Color.Linen);
+ SafeNativeMethods.Gdip.ThreadData[s_linenKey] = linen;
+ }
+ return linen;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Magenta"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Magenta
+ {
+ get
+ {
+ Brush magenta = (Brush)SafeNativeMethods.Gdip.ThreadData[s_magentaKey];
+ if (magenta == null)
+ {
+ magenta = new SolidBrush(Color.Magenta);
+ SafeNativeMethods.Gdip.ThreadData[s_magentaKey] = magenta;
+ }
+ return magenta;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Maroon"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Maroon
+ {
+ get
+ {
+ Brush maroon = (Brush)SafeNativeMethods.Gdip.ThreadData[s_maroonKey];
+ if (maroon == null)
+ {
+ maroon = new SolidBrush(Color.Maroon);
+ SafeNativeMethods.Gdip.ThreadData[s_maroonKey] = maroon;
+ }
+ return maroon;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.MediumAquamarine"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush MediumAquamarine
+ {
+ get
+ {
+ Brush mediumAquamarine = (Brush)SafeNativeMethods.Gdip.ThreadData[s_mediumAquamarineKey];
+ if (mediumAquamarine == null)
+ {
+ mediumAquamarine = new SolidBrush(Color.MediumAquamarine);
+ SafeNativeMethods.Gdip.ThreadData[s_mediumAquamarineKey] = mediumAquamarine;
+ }
+ return mediumAquamarine;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.MediumBlue"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush MediumBlue
+ {
+ get
+ {
+ Brush mediumBlue = (Brush)SafeNativeMethods.Gdip.ThreadData[s_mediumBlueKey];
+ if (mediumBlue == null)
+ {
+ mediumBlue = new SolidBrush(Color.MediumBlue);
+ SafeNativeMethods.Gdip.ThreadData[s_mediumBlueKey] = mediumBlue;
+ }
+ return mediumBlue;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.MediumOrchid"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush MediumOrchid
+ {
+ get
+ {
+ Brush mediumOrchid = (Brush)SafeNativeMethods.Gdip.ThreadData[s_mediumOrchidKey];
+ if (mediumOrchid == null)
+ {
+ mediumOrchid = new SolidBrush(Color.MediumOrchid);
+ SafeNativeMethods.Gdip.ThreadData[s_mediumOrchidKey] = mediumOrchid;
+ }
+ return mediumOrchid;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.MediumPurple"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush MediumPurple
+ {
+ get
+ {
+ Brush mediumPurple = (Brush)SafeNativeMethods.Gdip.ThreadData[s_mediumPurpleKey];
+ if (mediumPurple == null)
+ {
+ mediumPurple = new SolidBrush(Color.MediumPurple);
+ SafeNativeMethods.Gdip.ThreadData[s_mediumPurpleKey] = mediumPurple;
+ }
+ return mediumPurple;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.MediumSeaGreen"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush MediumSeaGreen
+ {
+ get
+ {
+ Brush mediumSeaGreen = (Brush)SafeNativeMethods.Gdip.ThreadData[s_mediumSeaGreenKey];
+ if (mediumSeaGreen == null)
+ {
+ mediumSeaGreen = new SolidBrush(Color.MediumSeaGreen);
+ SafeNativeMethods.Gdip.ThreadData[s_mediumSeaGreenKey] = mediumSeaGreen;
+ }
+ return mediumSeaGreen;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.MediumSlateBlue"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush MediumSlateBlue
+ {
+ get
+ {
+ Brush mediumSlateBlue = (Brush)SafeNativeMethods.Gdip.ThreadData[s_mediumSlateBlueKey];
+ if (mediumSlateBlue == null)
+ {
+ mediumSlateBlue = new SolidBrush(Color.MediumSlateBlue);
+ SafeNativeMethods.Gdip.ThreadData[s_mediumSlateBlueKey] = mediumSlateBlue;
+ }
+ return mediumSlateBlue;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.MediumSpringGreen"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush MediumSpringGreen
+ {
+ get
+ {
+ Brush mediumSpringGreen = (Brush)SafeNativeMethods.Gdip.ThreadData[s_mediumSpringGreenKey];
+ if (mediumSpringGreen == null)
+ {
+ mediumSpringGreen = new SolidBrush(Color.MediumSpringGreen);
+ SafeNativeMethods.Gdip.ThreadData[s_mediumSpringGreenKey] = mediumSpringGreen;
+ }
+ return mediumSpringGreen;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.MediumTurquoise"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush MediumTurquoise
+ {
+ get
+ {
+ Brush mediumTurquoise = (Brush)SafeNativeMethods.Gdip.ThreadData[s_mediumTurquoiseKey];
+ if (mediumTurquoise == null)
+ {
+ mediumTurquoise = new SolidBrush(Color.MediumTurquoise);
+ SafeNativeMethods.Gdip.ThreadData[s_mediumTurquoiseKey] = mediumTurquoise;
+ }
+ return mediumTurquoise;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.MediumVioletRed"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush MediumVioletRed
+ {
+ get
+ {
+ Brush mediumVioletRed = (Brush)SafeNativeMethods.Gdip.ThreadData[s_mediumVioletRedKey];
+ if (mediumVioletRed == null)
+ {
+ mediumVioletRed = new SolidBrush(Color.MediumVioletRed);
+ SafeNativeMethods.Gdip.ThreadData[s_mediumVioletRedKey] = mediumVioletRed;
+ }
+ return mediumVioletRed;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.MidnightBlue"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush MidnightBlue
+ {
+ get
+ {
+ Brush midnightBlue = (Brush)SafeNativeMethods.Gdip.ThreadData[s_midnightBlueKey];
+ if (midnightBlue == null)
+ {
+ midnightBlue = new SolidBrush(Color.MidnightBlue);
+ SafeNativeMethods.Gdip.ThreadData[s_midnightBlueKey] = midnightBlue;
+ }
+ return midnightBlue;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.MintCream"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush MintCream
+ {
+ get
+ {
+ Brush mintCream = (Brush)SafeNativeMethods.Gdip.ThreadData[s_mintCreamKey];
+ if (mintCream == null)
+ {
+ mintCream = new SolidBrush(Color.MintCream);
+ SafeNativeMethods.Gdip.ThreadData[s_mintCreamKey] = mintCream;
+ }
+ return mintCream;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.MistyRose"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush MistyRose
+ {
+ get
+ {
+ Brush mistyRose = (Brush)SafeNativeMethods.Gdip.ThreadData[s_mistyRoseKey];
+ if (mistyRose == null)
+ {
+ mistyRose = new SolidBrush(Color.MistyRose);
+ SafeNativeMethods.Gdip.ThreadData[s_mistyRoseKey] = mistyRose;
+ }
+ return mistyRose;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Moccasin"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Moccasin
+ {
+ get
+ {
+ Brush moccasin = (Brush)SafeNativeMethods.Gdip.ThreadData[s_moccasinKey];
+ if (moccasin == null)
+ {
+ moccasin = new SolidBrush(Color.Moccasin);
+ SafeNativeMethods.Gdip.ThreadData[s_moccasinKey] = moccasin;
+ }
+ return moccasin;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.NavajoWhite"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush NavajoWhite
+ {
+ get
+ {
+ Brush navajoWhite = (Brush)SafeNativeMethods.Gdip.ThreadData[s_navajoWhiteKey];
+ if (navajoWhite == null)
+ {
+ navajoWhite = new SolidBrush(Color.NavajoWhite);
+ SafeNativeMethods.Gdip.ThreadData[s_navajoWhiteKey] = navajoWhite;
+ }
+ return navajoWhite;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Navy"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Navy
+ {
+ get
+ {
+ Brush navy = (Brush)SafeNativeMethods.Gdip.ThreadData[s_navyKey];
+ if (navy == null)
+ {
+ navy = new SolidBrush(Color.Navy);
+ SafeNativeMethods.Gdip.ThreadData[s_navyKey] = navy;
+ }
+ return navy;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.OldLace"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush OldLace
+ {
+ get
+ {
+ Brush oldLace = (Brush)SafeNativeMethods.Gdip.ThreadData[s_oldLaceKey];
+ if (oldLace == null)
+ {
+ oldLace = new SolidBrush(Color.OldLace);
+ SafeNativeMethods.Gdip.ThreadData[s_oldLaceKey] = oldLace;
+ }
+ return oldLace;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Olive"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Olive
+ {
+ get
+ {
+ Brush olive = (Brush)SafeNativeMethods.Gdip.ThreadData[s_oliveKey];
+ if (olive == null)
+ {
+ olive = new SolidBrush(Color.Olive);
+ SafeNativeMethods.Gdip.ThreadData[s_oliveKey] = olive;
+ }
+ return olive;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.OliveDrab"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush OliveDrab
+ {
+ get
+ {
+ Brush oliveDrab = (Brush)SafeNativeMethods.Gdip.ThreadData[s_oliveDrabKey];
+ if (oliveDrab == null)
+ {
+ oliveDrab = new SolidBrush(Color.OliveDrab);
+ SafeNativeMethods.Gdip.ThreadData[s_oliveDrabKey] = oliveDrab;
+ }
+ return oliveDrab;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Orange"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Orange
+ {
+ get
+ {
+ Brush orange = (Brush)SafeNativeMethods.Gdip.ThreadData[s_orangeKey];
+ if (orange == null)
+ {
+ orange = new SolidBrush(Color.Orange);
+ SafeNativeMethods.Gdip.ThreadData[s_orangeKey] = orange;
+ }
+ return orange;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.OrangeRed"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush OrangeRed
+ {
+ get
+ {
+ Brush orangeRed = (Brush)SafeNativeMethods.Gdip.ThreadData[s_orangeRedKey];
+ if (orangeRed == null)
+ {
+ orangeRed = new SolidBrush(Color.OrangeRed);
+ SafeNativeMethods.Gdip.ThreadData[s_orangeRedKey] = orangeRed;
+ }
+ return orangeRed;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Orchid"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Orchid
+ {
+ get
+ {
+ Brush orchid = (Brush)SafeNativeMethods.Gdip.ThreadData[s_orchidKey];
+ if (orchid == null)
+ {
+ orchid = new SolidBrush(Color.Orchid);
+ SafeNativeMethods.Gdip.ThreadData[s_orchidKey] = orchid;
+ }
+ return orchid;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.PaleGoldenrod"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush PaleGoldenrod
+ {
+ get
+ {
+ Brush paleGoldenrod = (Brush)SafeNativeMethods.Gdip.ThreadData[s_paleGoldenrodKey];
+ if (paleGoldenrod == null)
+ {
+ paleGoldenrod = new SolidBrush(Color.PaleGoldenrod);
+ SafeNativeMethods.Gdip.ThreadData[s_paleGoldenrodKey] = paleGoldenrod;
+ }
+ return paleGoldenrod;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.PaleGreen"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush PaleGreen
+ {
+ get
+ {
+ Brush paleGreen = (Brush)SafeNativeMethods.Gdip.ThreadData[s_paleGreenKey];
+ if (paleGreen == null)
+ {
+ paleGreen = new SolidBrush(Color.PaleGreen);
+ SafeNativeMethods.Gdip.ThreadData[s_paleGreenKey] = paleGreen;
+ }
+ return paleGreen;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.PaleTurquoise"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush PaleTurquoise
+ {
+ get
+ {
+ Brush paleTurquoise = (Brush)SafeNativeMethods.Gdip.ThreadData[s_paleTurquoiseKey];
+ if (paleTurquoise == null)
+ {
+ paleTurquoise = new SolidBrush(Color.PaleTurquoise);
+ SafeNativeMethods.Gdip.ThreadData[s_paleTurquoiseKey] = paleTurquoise;
+ }
+ return paleTurquoise;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.PaleVioletRed"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush PaleVioletRed
+ {
+ get
+ {
+ Brush paleVioletRed = (Brush)SafeNativeMethods.Gdip.ThreadData[s_paleVioletRedKey];
+ if (paleVioletRed == null)
+ {
+ paleVioletRed = new SolidBrush(Color.PaleVioletRed);
+ SafeNativeMethods.Gdip.ThreadData[s_paleVioletRedKey] = paleVioletRed;
+ }
+ return paleVioletRed;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.PapayaWhip"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush PapayaWhip
+ {
+ get
+ {
+ Brush papayaWhip = (Brush)SafeNativeMethods.Gdip.ThreadData[s_papayaWhipKey];
+ if (papayaWhip == null)
+ {
+ papayaWhip = new SolidBrush(Color.PapayaWhip);
+ SafeNativeMethods.Gdip.ThreadData[s_papayaWhipKey] = papayaWhip;
+ }
+ return papayaWhip;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.PeachPuff"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush PeachPuff
+ {
+ get
+ {
+ Brush peachPuff = (Brush)SafeNativeMethods.Gdip.ThreadData[s_peachPuffKey];
+ if (peachPuff == null)
+ {
+ peachPuff = new SolidBrush(Color.PeachPuff);
+ SafeNativeMethods.Gdip.ThreadData[s_peachPuffKey] = peachPuff;
+ }
+ return peachPuff;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Peru"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Peru
+ {
+ get
+ {
+ Brush peru = (Brush)SafeNativeMethods.Gdip.ThreadData[s_peruKey];
+ if (peru == null)
+ {
+ peru = new SolidBrush(Color.Peru);
+ SafeNativeMethods.Gdip.ThreadData[s_peruKey] = peru;
+ }
+ return peru;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Pink"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Pink
+ {
+ get
+ {
+ Brush pink = (Brush)SafeNativeMethods.Gdip.ThreadData[s_pinkKey];
+ if (pink == null)
+ {
+ pink = new SolidBrush(Color.Pink);
+ SafeNativeMethods.Gdip.ThreadData[s_pinkKey] = pink;
+ }
+ return pink;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Plum"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Plum
+ {
+ get
+ {
+ Brush plum = (Brush)SafeNativeMethods.Gdip.ThreadData[s_plumKey];
+ if (plum == null)
+ {
+ plum = new SolidBrush(Color.Plum);
+ SafeNativeMethods.Gdip.ThreadData[s_plumKey] = plum;
+ }
+ return plum;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.PowderBlue"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush PowderBlue
+ {
+ get
+ {
+ Brush powderBlue = (Brush)SafeNativeMethods.Gdip.ThreadData[s_powderBlueKey];
+ if (powderBlue == null)
+ {
+ powderBlue = new SolidBrush(Color.PowderBlue);
+ SafeNativeMethods.Gdip.ThreadData[s_powderBlueKey] = powderBlue;
+ }
+ return powderBlue;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Purple"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Purple
+ {
+ get
+ {
+ Brush purple = (Brush)SafeNativeMethods.Gdip.ThreadData[s_purpleKey];
+ if (purple == null)
+ {
+ purple = new SolidBrush(Color.Purple);
+ SafeNativeMethods.Gdip.ThreadData[s_purpleKey] = purple;
+ }
+ return purple;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Red"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Red
+ {
+ get
+ {
+ Brush red = (Brush)SafeNativeMethods.Gdip.ThreadData[s_redKey];
+ if (red == null)
+ {
+ red = new SolidBrush(Color.Red);
+ SafeNativeMethods.Gdip.ThreadData[s_redKey] = red;
+ }
+ return red;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.RosyBrown"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush RosyBrown
+ {
+ get
+ {
+ Brush rosyBrown = (Brush)SafeNativeMethods.Gdip.ThreadData[s_rosyBrownKey];
+ if (rosyBrown == null)
+ {
+ rosyBrown = new SolidBrush(Color.RosyBrown);
+ SafeNativeMethods.Gdip.ThreadData[s_rosyBrownKey] = rosyBrown;
+ }
+ return rosyBrown;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.RoyalBlue"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush RoyalBlue
+ {
+ get
+ {
+ Brush royalBlue = (Brush)SafeNativeMethods.Gdip.ThreadData[s_royalBlueKey];
+ if (royalBlue == null)
+ {
+ royalBlue = new SolidBrush(Color.RoyalBlue);
+ SafeNativeMethods.Gdip.ThreadData[s_royalBlueKey] = royalBlue;
+ }
+ return royalBlue;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.SaddleBrown"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush SaddleBrown
+ {
+ get
+ {
+ Brush saddleBrown = (Brush)SafeNativeMethods.Gdip.ThreadData[s_saddleBrownKey];
+ if (saddleBrown == null)
+ {
+ saddleBrown = new SolidBrush(Color.SaddleBrown);
+ SafeNativeMethods.Gdip.ThreadData[s_saddleBrownKey] = saddleBrown;
+ }
+ return saddleBrown;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Salmon"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Salmon
+ {
+ get
+ {
+ Brush salmon = (Brush)SafeNativeMethods.Gdip.ThreadData[s_salmonKey];
+ if (salmon == null)
+ {
+ salmon = new SolidBrush(Color.Salmon);
+ SafeNativeMethods.Gdip.ThreadData[s_salmonKey] = salmon;
+ }
+ return salmon;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.SandyBrown"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush SandyBrown
+ {
+ get
+ {
+ Brush sandyBrown = (Brush)SafeNativeMethods.Gdip.ThreadData[s_sandyBrownKey];
+ if (sandyBrown == null)
+ {
+ sandyBrown = new SolidBrush(Color.SandyBrown);
+ SafeNativeMethods.Gdip.ThreadData[s_sandyBrownKey] = sandyBrown;
+ }
+ return sandyBrown;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.SeaGreen"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush SeaGreen
+ {
+ get
+ {
+ Brush seaGreen = (Brush)SafeNativeMethods.Gdip.ThreadData[s_seaGreenKey];
+ if (seaGreen == null)
+ {
+ seaGreen = new SolidBrush(Color.SeaGreen);
+ SafeNativeMethods.Gdip.ThreadData[s_seaGreenKey] = seaGreen;
+ }
+ return seaGreen;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.SeaShell"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush SeaShell
+ {
+ get
+ {
+ Brush seaShell = (Brush)SafeNativeMethods.Gdip.ThreadData[s_seaShellKey];
+ if (seaShell == null)
+ {
+ seaShell = new SolidBrush(Color.SeaShell);
+ SafeNativeMethods.Gdip.ThreadData[s_seaShellKey] = seaShell;
+ }
+ return seaShell;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Sienna"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Sienna
+ {
+ get
+ {
+ Brush sienna = (Brush)SafeNativeMethods.Gdip.ThreadData[s_siennaKey];
+ if (sienna == null)
+ {
+ sienna = new SolidBrush(Color.Sienna);
+ SafeNativeMethods.Gdip.ThreadData[s_siennaKey] = sienna;
+ }
+ return sienna;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Silver"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Silver
+ {
+ get
+ {
+ Brush silver = (Brush)SafeNativeMethods.Gdip.ThreadData[s_silverKey];
+ if (silver == null)
+ {
+ silver = new SolidBrush(Color.Silver);
+ SafeNativeMethods.Gdip.ThreadData[s_silverKey] = silver;
+ }
+ return silver;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.SkyBlue"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush SkyBlue
+ {
+ get
+ {
+ Brush skyBlue = (Brush)SafeNativeMethods.Gdip.ThreadData[s_skyBlueKey];
+ if (skyBlue == null)
+ {
+ skyBlue = new SolidBrush(Color.SkyBlue);
+ SafeNativeMethods.Gdip.ThreadData[s_skyBlueKey] = skyBlue;
+ }
+ return skyBlue;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.SlateBlue"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush SlateBlue
+ {
+ get
+ {
+ Brush slateBlue = (Brush)SafeNativeMethods.Gdip.ThreadData[s_slateBlueKey];
+ if (slateBlue == null)
+ {
+ slateBlue = new SolidBrush(Color.SlateBlue);
+ SafeNativeMethods.Gdip.ThreadData[s_slateBlueKey] = slateBlue;
+ }
+ return slateBlue;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.SlateGray"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush SlateGray
+ {
+ get
+ {
+ Brush slateGray = (Brush)SafeNativeMethods.Gdip.ThreadData[s_slateGrayKey];
+ if (slateGray == null)
+ {
+ slateGray = new SolidBrush(Color.SlateGray);
+ SafeNativeMethods.Gdip.ThreadData[s_slateGrayKey] = slateGray;
+ }
+ return slateGray;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Snow"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Snow
+ {
+ get
+ {
+ Brush snow = (Brush)SafeNativeMethods.Gdip.ThreadData[s_snowKey];
+ if (snow == null)
+ {
+ snow = new SolidBrush(Color.Snow);
+ SafeNativeMethods.Gdip.ThreadData[s_snowKey] = snow;
+ }
+ return snow;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.SpringGreen"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush SpringGreen
+ {
+ get
+ {
+ Brush springGreen = (Brush)SafeNativeMethods.Gdip.ThreadData[s_springGreenKey];
+ if (springGreen == null)
+ {
+ springGreen = new SolidBrush(Color.SpringGreen);
+ SafeNativeMethods.Gdip.ThreadData[s_springGreenKey] = springGreen;
+ }
+ return springGreen;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.SteelBlue"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush SteelBlue
+ {
+ get
+ {
+ Brush steelBlue = (Brush)SafeNativeMethods.Gdip.ThreadData[s_steelBlueKey];
+ if (steelBlue == null)
+ {
+ steelBlue = new SolidBrush(Color.SteelBlue);
+ SafeNativeMethods.Gdip.ThreadData[s_steelBlueKey] = steelBlue;
+ }
+ return steelBlue;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Tan"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Tan
+ {
+ get
+ {
+ Brush tan = (Brush)SafeNativeMethods.Gdip.ThreadData[s_tanKey];
+ if (tan == null)
+ {
+ tan = new SolidBrush(Color.Tan);
+ SafeNativeMethods.Gdip.ThreadData[s_tanKey] = tan;
+ }
+ return tan;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Teal"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Teal
+ {
+ get
+ {
+ Brush teal = (Brush)SafeNativeMethods.Gdip.ThreadData[s_tealKey];
+ if (teal == null)
+ {
+ teal = new SolidBrush(Color.Teal);
+ SafeNativeMethods.Gdip.ThreadData[s_tealKey] = teal;
+ }
+ return teal;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Thistle"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Thistle
+ {
+ get
+ {
+ Brush thistle = (Brush)SafeNativeMethods.Gdip.ThreadData[s_thistleKey];
+ if (thistle == null)
+ {
+ thistle = new SolidBrush(Color.Thistle);
+ SafeNativeMethods.Gdip.ThreadData[s_thistleKey] = thistle;
+ }
+ return thistle;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Tomato"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Tomato
+ {
+ get
+ {
+ Brush tomato = (Brush)SafeNativeMethods.Gdip.ThreadData[s_tomatoKey];
+ if (tomato == null)
+ {
+ tomato = new SolidBrush(Color.Tomato);
+ SafeNativeMethods.Gdip.ThreadData[s_tomatoKey] = tomato;
+ }
+ return tomato;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Turquoise"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Turquoise
+ {
+ get
+ {
+ Brush turquoise = (Brush)SafeNativeMethods.Gdip.ThreadData[s_turquoiseKey];
+ if (turquoise == null)
+ {
+ turquoise = new SolidBrush(Color.Turquoise);
+ SafeNativeMethods.Gdip.ThreadData[s_turquoiseKey] = turquoise;
+ }
+ return turquoise;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Violet"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Violet
+ {
+ get
+ {
+ Brush violet = (Brush)SafeNativeMethods.Gdip.ThreadData[s_violetKey];
+ if (violet == null)
+ {
+ violet = new SolidBrush(Color.Violet);
+ SafeNativeMethods.Gdip.ThreadData[s_violetKey] = violet;
+ }
+ return violet;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Wheat"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Wheat
+ {
+ get
+ {
+ Brush wheat = (Brush)SafeNativeMethods.Gdip.ThreadData[s_wheatKey];
+ if (wheat == null)
+ {
+ wheat = new SolidBrush(Color.Wheat);
+ SafeNativeMethods.Gdip.ThreadData[s_wheatKey] = wheat;
+ }
+ return wheat;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.White"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush White
+ {
+ get
+ {
+ Brush white = (Brush)SafeNativeMethods.Gdip.ThreadData[s_whiteKey];
+ if (white == null)
+ {
+ white = new SolidBrush(Color.White);
+ SafeNativeMethods.Gdip.ThreadData[s_whiteKey] = white;
+ }
+ return white;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.WhiteSmoke"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush WhiteSmoke
+ {
+ get
+ {
+ Brush whiteSmoke = (Brush)SafeNativeMethods.Gdip.ThreadData[s_whiteSmokeKey];
+ if (whiteSmoke == null)
+ {
+ whiteSmoke = new SolidBrush(Color.WhiteSmoke);
+ SafeNativeMethods.Gdip.ThreadData[s_whiteSmokeKey] = whiteSmoke;
+ }
+ return whiteSmoke;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.Yellow"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush Yellow
+ {
+ get
+ {
+ Brush yellow = (Brush)SafeNativeMethods.Gdip.ThreadData[s_yellowKey];
+ if (yellow == null)
+ {
+ yellow = new SolidBrush(Color.Yellow);
+ SafeNativeMethods.Gdip.ThreadData[s_yellowKey] = yellow;
+ }
+ return yellow;
+ }
+ }
+
+ /// <include file='doc\Brushes.uex' path='docs/doc[@for="Brushes.YellowGreen"]/*' />
+ /// <devdoc>
+ /// A brush of the given color.
+ /// </devdoc>
+ public static Brush YellowGreen
+ {
+ get
+ {
+ Brush yellowGreen = (Brush)SafeNativeMethods.Gdip.ThreadData[s_yellowGreenKey];
+ if (yellowGreen == null)
+ {
+ yellowGreen = new SolidBrush(Color.YellowGreen);
+ SafeNativeMethods.Gdip.ThreadData[s_yellowGreenKey] = yellowGreen;
+ }
+ return yellowGreen;
+ }
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/BufferedGraphics.cs b/src/System.Drawing.Common/src/System/Drawing/BufferedGraphics.cs
new file mode 100644
index 0000000000..7736762771
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/BufferedGraphics.cs
@@ -0,0 +1,174 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.Diagnostics;
+ using System.Runtime.InteropServices;
+
+ /// <include file='doc\BufferedGraphics.uex' path='docs/doc[@for="BufferedGraphics"]/*' />
+ /// <devdoc>
+ /// The BufferedGraphics class can be thought of as a "Token" or "Reference" to the
+ /// buffer that a BufferedGraphicsContext creates. While a BufferedGraphics is
+ /// outstanding, the memory associated with the buffer is locked. The general design
+ /// is such that under normal conditions a single BufferedGraphics will be in use at
+ /// one time for a given BufferedGraphicsContext.
+ /// </devdoc>
+ public sealed class BufferedGraphics : IDisposable
+ {
+ private Graphics _bufferedGraphicsSurface;
+ private Graphics _targetGraphics;
+ private BufferedGraphicsContext _context;
+ private IntPtr _targetDC;
+ private Point _targetLoc;
+ private Size _virtualSize;
+ private bool _disposeContext;
+ private static int s_rop = 0xcc0020; // RasterOp.SOURCE.GetRop();
+
+ /// <include file='doc\BufferedGraphics.uex' path='docs/doc[@for="BufferedGraphics.BufferedGraphics"]/*' />
+ /// <devdoc>
+ /// Internal constructor, this class is created by the BufferedGraphicsContext.
+ /// </devdoc>
+ internal BufferedGraphics(Graphics bufferedGraphicsSurface, BufferedGraphicsContext context, Graphics targetGraphics,
+ IntPtr targetDC, Point targetLoc, Size virtualSize)
+ {
+ _context = context;
+ _bufferedGraphicsSurface = bufferedGraphicsSurface;
+ _targetDC = targetDC;
+ _targetGraphics = targetGraphics;
+ _targetLoc = targetLoc;
+ _virtualSize = virtualSize;
+ }
+
+ ~BufferedGraphics()
+ {
+ Dispose(false);
+ }
+
+ /// <include file='doc\BufferedGraphics.uex' path='docs/doc[@for="BufferedGraphics.Dispose"]/*' />
+ /// <devdoc>
+ /// Disposes the object and releases the lock on the memory.
+ /// </devdoc>
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+
+ private void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ if (_context != null)
+ {
+ _context.ReleaseBuffer(this);
+
+ if (DisposeContext)
+ {
+ _context.Dispose();
+ _context = null;
+ }
+ }
+ if (_bufferedGraphicsSurface != null)
+ {
+ _bufferedGraphicsSurface.Dispose();
+ _bufferedGraphicsSurface = null;
+ }
+ }
+ }
+
+ /// <include file='doc\BufferedGraphics.uex' path='docs/doc[@for="BufferedGraphics.DisposeContext"]/*' />
+ /// <devdoc>
+ /// Internal property - determines if we need to dispose of the Context when this is disposed
+ /// </devdoc>
+ internal bool DisposeContext
+ {
+ get
+ {
+ return _disposeContext;
+ }
+ set
+ {
+ _disposeContext = value;
+ }
+ }
+
+ /// <include file='doc\BufferedGraphics.uex' path='docs/doc[@for="BufferedGraphics.Graphics"]/*' />
+ /// <devdoc>
+ /// Allows access to the Graphics wrapper for the buffer.
+ /// </devdoc>
+ public Graphics Graphics
+ {
+ get
+ {
+ Debug.Assert(_bufferedGraphicsSurface != null, "The BufferedGraphicsSurface is null!");
+ return _bufferedGraphicsSurface;
+ }
+ }
+
+ /// <include file='doc\BufferedGraphics.uex' path='docs/doc[@for="BufferedGraphics.Render"]/*' />
+ /// <devdoc>
+ /// Renders the buffer to the original graphics used to allocate the buffer.
+ /// </devdoc>
+ public void Render()
+ {
+ if (_targetGraphics != null)
+ {
+ Render(_targetGraphics);
+ }
+ else
+ {
+ RenderInternal(new HandleRef(Graphics, _targetDC), this);
+ }
+ }
+
+ /// <include file='doc\BufferedGraphics.uex' path='docs/doc[@for="BufferedGraphics.Render1"]/*' />
+ /// <devdoc>
+ /// Renders the buffer to the specified target graphics.
+ /// </devdoc>
+ public void Render(Graphics target)
+ {
+ if (target != null)
+ {
+ IntPtr targetDC = target.GetHdc();
+
+ try
+ {
+ RenderInternal(new HandleRef(target, targetDC), this);
+ }
+ finally
+ {
+ target.ReleaseHdcInternal(targetDC);
+ }
+ }
+ }
+
+ /// <include file='doc\BufferedGraphics.uex' path='docs/doc[@for="BufferedGraphics.Render2"]/*' />
+ /// <devdoc>
+ /// Renders the buffer to the specified target HDC.
+ /// </devdoc>
+ public void Render(IntPtr targetDC)
+ {
+ RenderInternal(new HandleRef(null, targetDC), this);
+ }
+
+ /// <include file='doc\BufferedGraphics.uex' path='docs/doc[@for="BufferedGraphics.RenderInternal"]/*' />
+ /// <devdoc>
+ /// Internal method that renders the specified buffer into the target.
+ /// </devdoc>
+ private void RenderInternal(HandleRef refTargetDC, BufferedGraphics buffer)
+ {
+ IntPtr sourceDC = buffer.Graphics.GetHdc();
+
+ try
+ {
+ SafeNativeMethods.BitBlt(refTargetDC, _targetLoc.X, _targetLoc.Y, _virtualSize.Width, _virtualSize.Height,
+ new HandleRef(buffer.Graphics, sourceDC), 0, 0, s_rop);
+ }
+ finally
+ {
+ buffer.Graphics.ReleaseHdcInternal(sourceDC);
+ }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/BufferedGraphicsContext.cs b/src/System.Drawing.Common/src/System/Drawing/BufferedGraphicsContext.cs
new file mode 100644
index 0000000000..873ba210ec
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/BufferedGraphicsContext.cs
@@ -0,0 +1,719 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.ComponentModel;
+ using System.Diagnostics;
+ using System.Runtime.InteropServices;
+ using System.Security.Permissions;
+ using System.Threading;
+
+ /// <include file='doc\BufferedGraphicsContext.uex' path='docs/doc[@for="BufferedGraphicsContext"]/*' />
+ /// <devdoc>
+ /// The BufferedGraphicsContext class can be used to perform standard double buffer
+ /// rendering techniques.
+ /// </devdoc>
+ public sealed class BufferedGraphicsContext : IDisposable
+ {
+ private Size _maximumBuffer;
+ private Size _bufferSize;
+ private Size _virtualSize;
+ private Point _targetLoc;
+ private IntPtr _compatDC;
+ private IntPtr _dib;
+ private IntPtr _oldBitmap;
+ private Graphics _compatGraphics;
+ private BufferedGraphics _buffer;
+ private int _busy;
+ private bool _invalidateWhenFree;
+
+ private const int BUFFER_FREE = 0; //the graphics buffer is free to use
+ private const int BUFFER_BUSY_PAINTING = 1; //graphics buffer is busy being created/painting
+ private const int BUFFER_BUSY_DISPOSING = 2; //graphics buffer is busy disposing
+
+ private static TraceSwitch s_doubleBuffering;
+
+#if DEBUG
+ private string _stackAtBusy;
+#endif
+
+ /// <include file='doc\BufferedGraphicsContext.uex' path='docs/doc[@for="BufferedGraphicsContext.BufferedGraphicsContext"]/*' />
+ /// <devdoc>
+ /// Basic constructor.
+ /// </devdoc>
+ public BufferedGraphicsContext()
+ {
+ //by defualt, the size of our maxbuffer will be 3 x standard button size
+ _maximumBuffer.Width = 75 * 3;
+ _maximumBuffer.Height = 32 * 3;
+
+ _bufferSize = Size.Empty;
+ }
+
+ /// <include file='doc\BufferedGraphicsContext.uex' path='docs/doc[@for="BufferedGraphicsContext.Finalizer"]/*' />
+ /// <devdoc>
+ /// Destructor.
+ /// </devdoc>
+ ~BufferedGraphicsContext()
+ {
+ Dispose(false);
+ }
+
+ //Internal trace switch for debugging
+ //
+ internal static TraceSwitch DoubleBuffering
+ {
+ get
+ {
+ if (s_doubleBuffering == null)
+ {
+ s_doubleBuffering = new TraceSwitch("DoubleBuffering", "Output information about double buffering");
+ }
+ return s_doubleBuffering;
+ }
+ }
+
+ /// <include file='doc\BufferedGraphicsContext.uex' path='docs/doc[@for="BufferedGraphicsContext.MaximumBuffer"]/*' />
+ /// <devdoc>
+ /// Allows you to set the maximum width and height of the buffer that will be retained in memory.
+ /// You can allocate a buffer of any size, however any request for a buffer that would have a total
+ /// memory footprint larger that the maximum size will be allocated temporarily and then discarded
+ /// with the BufferedGraphics is released.
+ /// </devdoc>
+ public Size MaximumBuffer
+ {
+ get
+ {
+ return _maximumBuffer;
+ }
+ [UIPermission(SecurityAction.Demand, Window = UIPermissionWindow.AllWindows)]
+ set
+ {
+ if (value.Width <= 0 || value.Height <= 0)
+ {
+ throw new ArgumentException(SR.Format(SR.InvalidArgument, "MaximumBuffer", value));
+ }
+
+ //if we've been asked to decrease the size of the maximum buffer,
+ //then invalidate the older & larger buffer
+ //
+ if (value.Width * value.Height < _maximumBuffer.Width * _maximumBuffer.Height)
+ {
+ Invalidate();
+ }
+
+ _maximumBuffer = value;
+ }
+ }
+
+ /// <include file='doc\BufferedGraphicsContext.uex' path='docs/doc[@for="BufferedGraphicsContext.Allocate"]/*' />
+ /// <devdoc>
+ /// Returns a BufferedGraphics that is matched for the specified target Graphics object.
+ /// </devdoc>
+ public BufferedGraphics Allocate(Graphics targetGraphics, Rectangle targetRectangle)
+ {
+ if (ShouldUseTempManager(targetRectangle))
+ {
+ Debug.WriteLineIf(DoubleBuffering.TraceWarning, "Too big of buffer requested (" + targetRectangle.Width + " x " + targetRectangle.Height + ") ... allocating temp buffer manager");
+ return AllocBufferInTempManager(targetGraphics, IntPtr.Zero, targetRectangle);
+ }
+ return AllocBuffer(targetGraphics, IntPtr.Zero, targetRectangle);
+ }
+
+ /// <include file='doc\BufferedGraphicsContext.uex' path='docs/doc[@for="BufferedGraphicsContext.Allocate1"]/*' />
+ /// <devdoc>
+ /// Returns a BufferedGraphics that is matched for the specified target HDC object.
+ /// </devdoc>
+ [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
+ public BufferedGraphics Allocate(IntPtr targetDC, Rectangle targetRectangle)
+ {
+ if (ShouldUseTempManager(targetRectangle))
+ {
+ Debug.WriteLineIf(DoubleBuffering.TraceWarning, "Too big of buffer requested (" + targetRectangle.Width + " x " + targetRectangle.Height + ") ... allocating temp buffer manager");
+ return AllocBufferInTempManager(null, targetDC, targetRectangle);
+ }
+ return AllocBuffer(null, targetDC, targetRectangle);
+ }
+
+ /// <include file='doc\BufferedGraphicsContext.uex' path='docs/doc[@for="BufferedGraphicsContext.AllocBuffer"]/*' />
+ /// <devdoc>
+ /// Returns a BufferedGraphics that is matched for the specified target HDC object.
+ /// </devdoc>
+ private BufferedGraphics AllocBuffer(Graphics targetGraphics, IntPtr targetDC, Rectangle targetRectangle)
+ {
+ int oldBusy = Interlocked.CompareExchange(ref _busy, BUFFER_BUSY_PAINTING, BUFFER_FREE);
+
+ // In the case were we have contention on the buffer - i.e. two threads
+ // trying to use the buffer at the same time, we just create a temp
+ // buffermanager and have the buffer dispose of it when it is done.
+ //
+ if (oldBusy != BUFFER_FREE)
+ {
+ Debug.WriteLineIf(DoubleBuffering.TraceWarning, "Attempt to have two buffers for a buffer manager... allocating temp buffer manager");
+ return AllocBufferInTempManager(targetGraphics, targetDC, targetRectangle);
+ }
+
+#if DEBUG
+ if (DoubleBuffering.TraceVerbose)
+ {
+ _stackAtBusy = new StackTrace().ToString();
+ }
+#endif
+
+ Graphics surface;
+ _targetLoc = new Point(targetRectangle.X, targetRectangle.Y);
+
+ try
+ {
+ if (targetGraphics != null)
+ {
+ IntPtr destDc = targetGraphics.GetHdc();
+ try
+ {
+ surface = CreateBuffer(destDc, -_targetLoc.X, -_targetLoc.Y, targetRectangle.Width, targetRectangle.Height);
+ }
+ finally
+ {
+ targetGraphics.ReleaseHdcInternal(destDc);
+ }
+ }
+ else
+ {
+ surface = CreateBuffer(targetDC, -_targetLoc.X, -_targetLoc.Y, targetRectangle.Width, targetRectangle.Height);
+ }
+
+ _buffer = new BufferedGraphics(surface, this, targetGraphics, targetDC, _targetLoc, _virtualSize);
+ }
+ catch
+ {
+ _busy = BUFFER_FREE; // free the buffer so it can be disposed.
+ throw;
+ }
+ return _buffer;
+ }
+
+ /// <include file='doc\BufferedGraphicsContext.uex' path='docs/doc[@for="BufferedGraphicsContext.AllocBufferInTempManager"]/*' />
+ /// <devdoc>
+ /// Returns a BufferedGraphics that is matched for the specified target HDC object.
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope")]
+ private BufferedGraphics AllocBufferInTempManager(Graphics targetGraphics, IntPtr targetDC, Rectangle targetRectangle)
+ {
+ BufferedGraphicsContext tempContext = null;
+ BufferedGraphics tempBuffer = null;
+
+ try
+ {
+ tempContext = new BufferedGraphicsContext();
+ if (tempContext != null)
+ {
+ tempBuffer = tempContext.AllocBuffer(targetGraphics, targetDC, targetRectangle);
+ tempBuffer.DisposeContext = true;
+ }
+ }
+ finally
+ {
+ if (tempContext != null && (tempBuffer == null || (tempBuffer != null && !tempBuffer.DisposeContext)))
+ {
+ tempContext.Dispose();
+ }
+ }
+
+ return tempBuffer;
+ }
+
+
+ /// <include file='doc\BufferedGraphicsContext.uex' path='docs/doc[@for="BufferedGraphicsContext.bFillBitmapInfo"]/*' />
+ /// <devdoc>
+ // bFillBitmapInfo
+ //
+ // Fills in the fields of a BITMAPINFO so that we can create a bitmap
+ // that matches the format of the display.
+ //
+ // This is done by creating a compatible bitmap and calling GetDIBits
+ // to return the color masks. This is done with two calls. The first
+ // call passes in biBitCount = 0 to GetDIBits which will fill in the
+ // base BITMAPINFOHEADER data. The second call to GetDIBits (passing
+ // in the BITMAPINFO filled in by the first call) will return the color
+ // table or bitmasks, as appropriate.
+ //
+ // Returns:
+ // TRUE if successful, FALSE otherwise.
+ //
+ // History:
+ // 07-Jun-1995 -by- Gilman Wong [Microsoft]
+ // Wrote it.
+ //
+ // 15-Nov-2000 -by- Chris Anderson [Microsoft]
+ // Ported it to C#
+ //
+ /// </devdoc>
+ private bool bFillBitmapInfo(IntPtr hdc, IntPtr hpal, ref NativeMethods.BITMAPINFO_FLAT pbmi)
+ {
+ IntPtr hbm = IntPtr.Zero;
+ bool bRet = false;
+ try
+ {
+ //
+ // Create a dummy bitmap from which we can query color format info
+ // about the device surface.
+ //
+ hbm = SafeNativeMethods.CreateCompatibleBitmap(new HandleRef(null, hdc), 1, 1);
+
+ if (hbm == IntPtr.Zero)
+ {
+ throw new OutOfMemoryException(SR.Format(SR.GraphicsBufferQueryFail));
+ }
+
+ pbmi.bmiHeader_biSize = Marshal.SizeOf(typeof(NativeMethods.BITMAPINFOHEADER));
+ pbmi.bmiColors = new byte[NativeMethods.BITMAPINFO_MAX_COLORSIZE * 4];
+
+ //
+ // Call first time to fill in BITMAPINFO header.
+ //
+ SafeNativeMethods.GetDIBits(new HandleRef(null, hdc),
+ new HandleRef(null, hbm),
+ 0,
+ 0,
+ IntPtr.Zero,
+ ref pbmi,
+ NativeMethods.DIB_RGB_COLORS);
+
+ if (pbmi.bmiHeader_biBitCount <= 8)
+ {
+ bRet = bFillColorTable(hdc, hpal, ref pbmi);
+ }
+ else
+ {
+ if (pbmi.bmiHeader_biCompression == NativeMethods.BI_BITFIELDS)
+ {
+ //
+ // Call a second time to get the color masks.
+ // It's a GetDIBits Win32 "feature".
+ //
+ SafeNativeMethods.GetDIBits(new HandleRef(null, hdc),
+ new HandleRef(null, hbm),
+ 0,
+ pbmi.bmiHeader_biHeight,
+ IntPtr.Zero,
+ ref pbmi,
+ NativeMethods.DIB_RGB_COLORS);
+ }
+ bRet = true;
+ }
+ }
+ finally
+ {
+ if (hbm != IntPtr.Zero)
+ {
+ SafeNativeMethods.DeleteObject(new HandleRef(null, hbm));
+ hbm = IntPtr.Zero;
+ }
+ }
+ return bRet;
+ }
+
+ /// <include file='doc\BufferedGraphicsContext.uex' path='docs/doc[@for="BufferedGraphicsContext.bFillColorTable"]/*' />
+ /// <devdoc>
+ // bFillColorTable
+ //
+ // Initialize the color table of the BITMAPINFO pointed to by pbmi. Colors
+ // are set to the current system palette.
+ //
+ // Note: call only valid for displays of 8bpp or less.
+ //
+ // Returns:
+ // TRUE if successful, FALSE otherwise.
+ //
+ // History:
+ // 23-Jan-1996 -by- Gilman Wong [Microsoft]
+ // Wrote it.
+ //
+ // 15-Nov-2000 -by- Chris Anderson [Microsoft]
+ // Ported it to C#
+ //
+ /// </devdoc>
+ private unsafe bool bFillColorTable(IntPtr hdc, IntPtr hpal, ref NativeMethods.BITMAPINFO_FLAT pbmi)
+ {
+ bool bRet = false;
+ byte[] aj = new byte[sizeof(NativeMethods.PALETTEENTRY) * 256];
+ int i, cColors;
+
+ fixed (byte* pcolors = pbmi.bmiColors)
+ {
+ fixed (byte* ppal = aj)
+ {
+ NativeMethods.RGBQUAD* prgb = (NativeMethods.RGBQUAD*)pcolors;
+ NativeMethods.PALETTEENTRY* lppe = (NativeMethods.PALETTEENTRY*)ppal;
+
+ cColors = 1 << pbmi.bmiHeader_biBitCount;
+ if (cColors <= 256)
+ {
+ Debug.WriteLineIf(DoubleBuffering.TraceVerbose, "8 bit or less...");
+
+ // NOTE : Didn't port "MyGetPaletteEntries" as it is only
+ // : for 4bpp displays, which we don't work on anyway.
+ uint palRet;
+ IntPtr palHalftone = IntPtr.Zero;
+ if (hpal == IntPtr.Zero)
+ {
+ Debug.WriteLineIf(DoubleBuffering.TraceVerbose, "using halftone palette...");
+ palHalftone = Graphics.GetHalftonePalette();
+ palRet = SafeNativeMethods.GetPaletteEntries(new HandleRef(null, palHalftone), 0, cColors, aj);
+ }
+ else
+ {
+ Debug.WriteLineIf(DoubleBuffering.TraceVerbose, "using custom palette...");
+ palRet = SafeNativeMethods.GetPaletteEntries(new HandleRef(null, hpal), 0, cColors, aj);
+ }
+ if (palRet != 0)
+ {
+ for (i = 0; i < cColors; i++)
+ {
+ prgb[i].rgbRed = lppe[i].peRed;
+ prgb[i].rgbGreen = lppe[i].peGreen;
+ prgb[i].rgbBlue = lppe[i].peBlue;
+ prgb[i].rgbReserved = 0;
+ }
+ bRet = true;
+ }
+ else
+ {
+ Debug.WriteLineIf(DoubleBuffering.TraceWarning, "bFillColorTable: MyGetSystemPaletteEntries failed\n");
+ }
+ }
+ }
+ }
+ return bRet;
+ }
+
+ /// <include file='doc\BufferedGraphicsContext.uex' path='docs/doc[@for="BufferedGraphicsContext.CreateBuffer"]/*' />
+ /// <devdoc>
+ /// Returns a Graphics object representing a buffer.
+ /// </devdoc>
+ private Graphics CreateBuffer(IntPtr src, int offsetX, int offsetY, int width, int height)
+ {
+ //create the compat DC
+ _busy = BUFFER_BUSY_DISPOSING;
+ DisposeDC();
+ _busy = BUFFER_BUSY_PAINTING;
+ _compatDC = UnsafeNativeMethods.CreateCompatibleDC(new HandleRef(null, src));
+
+ //recreate the bitmap if necessary
+ if (width > _bufferSize.Width || height > _bufferSize.Height)
+ {
+ Debug.WriteLineIf(DoubleBuffering.TraceInfo, "allocating new bitmap: " + width + " x " + height);
+ int optWidth = Math.Max(width, _bufferSize.Width);
+ int optHeight = Math.Max(height, _bufferSize.Height);
+
+ _busy = BUFFER_BUSY_DISPOSING;
+ DisposeBitmap();
+ _busy = BUFFER_BUSY_PAINTING;
+
+ Debug.WriteLineIf(DoubleBuffering.TraceInfo, " new size : " + optWidth + " x " + optHeight);
+ IntPtr pvbits = IntPtr.Zero;
+ _dib = CreateCompatibleDIB(src, IntPtr.Zero, optWidth, optHeight, ref pvbits);
+ _bufferSize = new Size(optWidth, optHeight);
+ }
+
+ //select the bitmap
+ _oldBitmap = SafeNativeMethods.SelectObject(new HandleRef(this, _compatDC), new HandleRef(this, _dib));
+
+ //create compat graphics
+ Debug.WriteLineIf(DoubleBuffering.TraceInfo, " Create compatGraphics");
+ _compatGraphics = Graphics.FromHdcInternal(_compatDC);
+ _compatGraphics.TranslateTransform(-_targetLoc.X, -_targetLoc.Y);
+ _virtualSize = new Size(width, height);
+
+ return _compatGraphics;
+ }
+
+ /// <include file='doc\BufferedGraphicsContext.uex' path='docs/doc[@for="BufferedGraphicsContext.CreateCompatibleDIB"]/*' />
+ /// <devdoc>
+ // CreateCompatibleDIB
+ //
+ // Create a DIB section with an optimal format w.r.t. the specified hdc.
+ //
+ // If DIB <= 8bpp, then the DIB color table is initialized based on the
+ // specified palette. If the palette handle is NULL, then the system
+ // palette is used.
+ //
+ // Note: The hdc must be a direct DC (not an info or memory DC).
+ //
+ // Note: On palettized displays, if the system palette changes the
+ // UpdateDIBColorTable function should be called to maintain
+ // the identity palette mapping between the DIB and the display.
+ //
+ // Returns:
+ // Valid bitmap handle if successful, NULL if error.
+ //
+ // History:
+ // 23-Jan-1996 -by- Gilman Wong [Microsoft]
+ // Wrote it.
+ //
+ // 15-Nov-2000 -by- Chris Anderson [Microsoft]
+ // Ported it to C#.
+ //
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Interoperability", "CA1404:CallGetLastErrorImmediatelyAfterPInvoke")]
+ private IntPtr CreateCompatibleDIB(IntPtr hdc, IntPtr hpal, int ulWidth, int ulHeight, ref IntPtr ppvBits)
+ {
+ if (hdc == IntPtr.Zero)
+ {
+ throw new ArgumentNullException("hdc");
+ }
+
+ IntPtr hbmRet = IntPtr.Zero;
+ NativeMethods.BITMAPINFO_FLAT pbmi = new NativeMethods.BITMAPINFO_FLAT();
+
+ //
+ // Validate hdc.
+ //
+ int objType = UnsafeNativeMethods.GetObjectType(new HandleRef(null, hdc));
+
+ switch (objType)
+ {
+ case NativeMethods.OBJ_DC:
+ case NativeMethods.OBJ_METADC:
+ case NativeMethods.OBJ_MEMDC:
+ case NativeMethods.OBJ_ENHMETADC:
+ break;
+ default:
+ throw new ArgumentException(SR.Format(SR.DCTypeInvalid));
+ }
+
+ if (bFillBitmapInfo(hdc, hpal, ref pbmi))
+ {
+ //
+ // Change bitmap size to match specified dimensions.
+ //
+
+ pbmi.bmiHeader_biWidth = ulWidth;
+ pbmi.bmiHeader_biHeight = ulHeight;
+ if (pbmi.bmiHeader_biCompression == NativeMethods.BI_RGB)
+ {
+ pbmi.bmiHeader_biSizeImage = 0;
+ }
+ else
+ {
+ if (pbmi.bmiHeader_biBitCount == 16)
+ pbmi.bmiHeader_biSizeImage = ulWidth * ulHeight * 2;
+ else if (pbmi.bmiHeader_biBitCount == 32)
+ pbmi.bmiHeader_biSizeImage = ulWidth * ulHeight * 4;
+ else
+ pbmi.bmiHeader_biSizeImage = 0;
+ }
+ pbmi.bmiHeader_biClrUsed = 0;
+ pbmi.bmiHeader_biClrImportant = 0;
+
+ //
+ // Create the DIB section. Let Win32 allocate the memory and return
+ // a pointer to the bitmap surface.
+ //
+
+ hbmRet = SafeNativeMethods.CreateDIBSection(new HandleRef(null, hdc), ref pbmi, NativeMethods.DIB_RGB_COLORS, ref ppvBits, IntPtr.Zero, 0);
+ Win32Exception ex = null;
+ if (hbmRet == IntPtr.Zero)
+ {
+ ex = new Win32Exception(Marshal.GetLastWin32Error());
+#if DEBUG
+ DumpBitmapInfo(ref pbmi);
+#endif
+ }
+
+#if DEBUG
+ if (DoubleBuffering.TraceVerbose)
+ {
+ DumpBitmapInfo(ref pbmi);
+ }
+#endif
+ if (ex != null)
+ {
+ throw ex;
+ }
+ }
+ return hbmRet;
+ }
+
+ /// <include file='doc\BufferedGraphicsContext.uex' path='docs/doc[@for="BufferedGraphicsContext.Dispose"]/*' />
+ /// <devdoc>
+ /// Disposes of native handles.
+ /// </devdoc>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <devdoc>
+ /// Disposes the DC, but leaves the bitmap alone.
+ /// </devdoc>
+ private void DisposeDC()
+ {
+ if (_oldBitmap != IntPtr.Zero && _compatDC != IntPtr.Zero)
+ {
+ Debug.WriteLineIf(DoubleBuffering.TraceVerbose, "restoring bitmap to DC");
+ SafeNativeMethods.SelectObject(new HandleRef(this, _compatDC), new HandleRef(this, _oldBitmap));
+ _oldBitmap = IntPtr.Zero;
+ }
+ if (_compatDC != IntPtr.Zero)
+ {
+ Debug.WriteLineIf(DoubleBuffering.TraceVerbose, "delete compat DC");
+ UnsafeNativeMethods.DeleteDC(new HandleRef(this, _compatDC));
+ _compatDC = IntPtr.Zero;
+ }
+ }
+
+ /// <devdoc>
+ /// Disposes the bitmap, will ASSERT if bitmap is being used (checks oldbitmap).
+ /// if ASSERTed, call DisposeDC() first.
+ /// </devdoc>
+ private void DisposeBitmap()
+ {
+ if (_dib != IntPtr.Zero)
+ {
+ Debug.Assert(_oldBitmap == IntPtr.Zero);
+ Debug.WriteLineIf(DoubleBuffering.TraceVerbose, "delete dib");
+
+ SafeNativeMethods.DeleteObject(new HandleRef(this, _dib));
+ _dib = IntPtr.Zero;
+ }
+ }
+
+ /// <include file='doc\BufferedGraphicsContext.uex' path='docs/doc[@for="BufferedGraphicsContext.Dispose1"]/*' />
+ /// <devdoc>
+ /// Disposes of the Graphics buffer.
+ /// </devdoc>
+ private void Dispose(bool disposing)
+ {
+ Debug.WriteLineIf(DoubleBuffering.TraceInfo, "Dispose(" + disposing + ") {");
+ Debug.Indent();
+ int oldBusy = Interlocked.CompareExchange(ref _busy, BUFFER_BUSY_DISPOSING, BUFFER_FREE);
+
+ if (disposing)
+ {
+ if (oldBusy == BUFFER_BUSY_PAINTING)
+ {
+#if DEBUG
+ Debug.WriteLineIf(DoubleBuffering.TraceInfo, "Stack at busy buffer: \n" + _stackAtBusy);
+#endif
+
+ throw new InvalidOperationException(SR.Format(SR.GraphicsBufferCurrentlyBusy));
+ }
+
+ if (_compatGraphics != null)
+ {
+ Debug.WriteLineIf(DoubleBuffering.TraceVerbose, "Disposing compatGraphics");
+ _compatGraphics.Dispose();
+ _compatGraphics = null;
+ }
+ }
+ else
+ {
+ Debug.Fail("Never let a graphics buffer finalize!");
+ }
+
+ DisposeDC();
+ DisposeBitmap();
+
+ if (_buffer != null)
+ {
+ Debug.WriteLineIf(DoubleBuffering.TraceVerbose, "Disposing buffer");
+ _buffer.Dispose();
+ _buffer = null;
+ }
+
+ _bufferSize = Size.Empty;
+ _virtualSize = Size.Empty;
+ Debug.Unindent();
+ Debug.WriteLineIf(DoubleBuffering.TraceInfo, "}");
+
+ _busy = BUFFER_FREE;
+ }
+
+#if DEBUG
+ private void DumpBitmapInfo(ref NativeMethods.BITMAPINFO_FLAT pbmi)
+ {
+ //Debug.WriteLine("biSize --> " + pbmi.bmiHeader_biSize);
+ Debug.WriteLine("biWidth --> " + pbmi.bmiHeader_biWidth);
+ Debug.WriteLine("biHeight --> " + pbmi.bmiHeader_biHeight);
+ Debug.WriteLine("biPlanes --> " + pbmi.bmiHeader_biPlanes);
+ Debug.WriteLine("biBitCount --> " + pbmi.bmiHeader_biBitCount);
+ //Debug.WriteLine("biCompression --> " + pbmi.bmiHeader_biCompression);
+ //Debug.WriteLine("biSizeImage --> " + pbmi.bmiHeader_biSizeImage);
+ //Debug.WriteLine("biXPelsPerMeter --> " + pbmi.bmiHeader_biXPelsPerMeter);
+ //Debug.WriteLine("biYPelsPerMeter --> " + pbmi.bmiHeader_biYPelsPerMeter);
+ //Debug.WriteLine("biClrUsed --> " + pbmi.bmiHeader_biClrUsed);
+ //Debug.WriteLine("biClrImportant --> " + pbmi.bmiHeader_biClrImportant);
+ //Debug.Write("bmiColors --> ");
+ //for (int i=0; i<pbmi.bmiColors.Length; i++) {
+ // Debug.Write(pbmi.bmiColors[i].ToString("X"));
+ //}
+ Debug.WriteLine("");
+ }
+#endif
+
+ /// <include file='doc\BufferedGraphicsContext.uex' path='docs/doc[@for="BufferedGraphicsContext.Invalidate"]/*' />
+ /// <devdoc>
+ /// Invalidates the cached graphics buffer.
+ /// </devdoc>
+ public void Invalidate()
+ {
+ int oldBusy = Interlocked.CompareExchange(ref _busy, BUFFER_BUSY_DISPOSING, BUFFER_FREE);
+
+ //if we're not busy with our buffer, lets
+ //clean it up now
+ //
+ if (oldBusy == BUFFER_FREE)
+ {
+ Dispose();
+ _busy = BUFFER_FREE;
+ }
+ else
+ {
+ //this will indicate to free the buffer
+ //as soon as it becomes non-busy
+ //
+ _invalidateWhenFree = true;
+ }
+ }
+
+ /// <include file='doc\BufferedGraphicsContext.uex' path='docs/doc[@for="BufferedGraphicsContext.ReleaseBuffer"]/*' />
+ /// <devdoc>
+ /// Returns a Graphics object representing a buffer.
+ /// </devdoc>
+ internal void ReleaseBuffer(BufferedGraphics buffer)
+ {
+ Debug.Assert(buffer == _buffer, "Tried to release a bogus buffer");
+
+ _buffer = null;
+ if (_invalidateWhenFree)
+ {
+ _busy = BUFFER_BUSY_DISPOSING;
+ Dispose(); //clears everything (incl bitmap)
+ }
+ else
+ { //otherwise, just dispose the DC. A new one will be created next time.
+ _busy = BUFFER_BUSY_DISPOSING;
+ DisposeDC(); //only clears out the DC
+ }
+
+ _busy = BUFFER_FREE;
+ }
+
+ /// <include file='doc\BufferedGraphicsContext.uex' path='docs/doc[@for="BufferedGraphicsContext.ShouldUseTempManager"]/*' />
+ /// <devdoc>
+ /// This routine allows us to control the point were we start using throw away
+ /// managers for painting. Since the buffer manager stays around (by default)
+ /// for the life of the app, we don't want to consume too much memory
+ /// in the buffer. However, re-allocating the buffer for small things (like
+ /// buttons, labels, etc) will hit us on runtime performance.
+ /// </devdoc>
+ private bool ShouldUseTempManager(Rectangle targetBounds)
+ {
+ return (targetBounds.Width * targetBounds.Height) > (MaximumBuffer.Width * MaximumBuffer.Height);
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/BufferedGraphicsManager.cs b/src/System.Drawing.Common/src/System/Drawing/BufferedGraphicsManager.cs
new file mode 100644
index 0000000000..a6088c655d
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/BufferedGraphicsManager.cs
@@ -0,0 +1,58 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.Runtime.ConstrainedExecution;
+
+ /// <include file='doc\BufferedGraphicsManager.uex' path='docs/doc[@for="BufferedGraphicsManager"]/*' />
+ /// <devdoc>
+ /// The BufferedGraphicsManager is used for accessing a BufferedGraphicsContext.
+ /// </devdoc>
+ public sealed class BufferedGraphicsManager
+ {
+ private static BufferedGraphicsContext s_bufferedGraphicsContext;
+
+ /// <include file='doc\BufferedGraphicsManager.uex' path='docs/doc[@for="BufferedGraphicsManager.BufferedGraphicsManager"]/*' />
+ /// <devdoc>
+ /// Private constructor.
+ /// </devdoc>
+ private BufferedGraphicsManager()
+ {
+ }
+
+ /// <include file='doc\BufferedGraphicsManager.uex' path='docs/doc[@for="BufferedGraphicsManager.BufferedGraphicsManager"]/*' />
+ /// <devdoc>
+ /// Static constructor. Here, we hook the exit & unload events so we can clean up our context buffer.
+ /// </devdoc>
+ static BufferedGraphicsManager()
+ {
+ AppDomain.CurrentDomain.ProcessExit += new EventHandler(BufferedGraphicsManager.OnShutdown);
+ AppDomain.CurrentDomain.DomainUnload += new EventHandler(BufferedGraphicsManager.OnShutdown);
+ s_bufferedGraphicsContext = new BufferedGraphicsContext();
+ }
+
+ /// <include file='doc\BufferedGraphicsManager.uex' path='docs/doc[@for="BufferedGraphicsManager.Current"]/*' />
+ /// <devdoc>
+ /// Retrieves the context associated with the app domain.
+ /// </devdoc>
+ public static BufferedGraphicsContext Current
+ {
+ get
+ {
+ return s_bufferedGraphicsContext;
+ }
+ }
+
+ /// <include file='doc\BufferedGraphicsManager.uex' path='docs/doc[@for="BufferedGraphicsManager.OnProcessExit"]/*' />
+ /// <devdoc>
+ /// Called on process exit
+ /// </devdoc>
+ [PrePrepareMethod]
+ private static void OnShutdown(object sender, EventArgs e)
+ {
+ BufferedGraphicsManager.Current.Invalidate();
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/ColorConverter.cs b/src/System.Drawing.Common/src/System/Drawing/ColorConverter.cs
new file mode 100644
index 0000000000..decb4ee064
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/ColorConverter.cs
@@ -0,0 +1,423 @@
+//------------------------------------------------------------------------------
+// <copyright file="ColorConverter.cs" company="Microsoft">
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// </copyright>
+//------------------------------------------------------------------------------
+
+/*
+ */
+namespace System.Drawing {
+ using System.Runtime.Serialization.Formatters;
+ using System.Runtime.InteropServices;
+ using System.Diagnostics;
+ using System.Diagnostics.CodeAnalysis;
+ using Microsoft.Win32;
+ using System.Collections;
+ using System.ComponentModel;
+ using System.ComponentModel.Design.Serialization;
+ using System.Globalization;
+ using System.Reflection;
+ using System.Threading;
+
+ /// <include file='doc\ColorConverter.uex' path='docs/doc[@for="ColorConverter"]/*' />
+ /// <devdoc>
+ /// ColorConverter is a class that can be used to convert
+ /// colors from one data type to another. Access this
+ /// class through the TypeDescriptor.
+ /// </devdoc>
+ public class ColorConverter : TypeConverter {
+ private static string ColorConstantsLock = "colorConstants";
+ private static Hashtable colorConstants;
+ private static string SystemColorConstantsLock = "systemColorConstants";
+ private static Hashtable systemColorConstants;
+ private static string ValuesLock = "values";
+ private static StandardValuesCollection values;
+
+ /// <include file='doc\ColorConverter.uex' path='docs/doc[@for="ColorConverter.ColorConverter"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public ColorConverter() {
+ }
+
+ /// <include file='doc\ColorConverter.uex' path='docs/doc[@for="ColorConverter.Colors"]/*' />
+ /// <devdoc>
+ /// Hashtable of color / value pairs (color name is key)
+ /// for standard colors.
+ /// </devdoc>
+ private static Hashtable Colors {
+ get {
+ if (colorConstants == null) {
+ lock(ColorConstantsLock) {
+ if (colorConstants == null) {
+ Hashtable tempHash = new Hashtable(StringComparer.OrdinalIgnoreCase);
+ FillConstants(tempHash, typeof(Color));
+ colorConstants = tempHash;
+ }
+ }
+ }
+
+ return colorConstants;
+ }
+ }
+
+ /// <include file='doc\ColorConverter.uex' path='docs/doc[@for="ColorConverter.SystemColors"]/*' />
+ /// <devdoc>
+ /// Hashtable of color / value pairs (color name is key)
+ /// for system colors.
+ /// </devdoc>
+ private static Hashtable SystemColors {
+ get {
+ if (systemColorConstants == null) {
+ lock (SystemColorConstantsLock) {
+ if (systemColorConstants == null) {
+ Hashtable tempHash = new Hashtable(StringComparer.OrdinalIgnoreCase);
+ FillConstants(tempHash, typeof(System.Drawing.SystemColors));
+ systemColorConstants = tempHash;
+ }
+ }
+ }
+
+ return systemColorConstants;
+ }
+ }
+
+ /// <include file='doc\ColorConverter.uex' path='docs/doc[@for="ColorConverter.CanConvertFrom"]/*' />
+ /// <devdoc>
+ /// Determines if this converter can convert an object in the given source
+ /// type to the native type of the converter.
+ /// </devdoc>
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) {
+ if (sourceType == typeof(string)) {
+ return true;
+ }
+ return base.CanConvertFrom(context, sourceType);
+ }
+
+ /// <include file='doc\ColorConverter.uex' path='docs/doc[@for="ColorConverter.CanConvertTo"]/*' />
+ /// <devdoc>
+ /// <para>Gets a value indicating whether this converter can
+ /// convert an object to the given destination type using the context.</para>
+ /// </devdoc>
+ public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {
+ if (destinationType == typeof(InstanceDescriptor)) {
+ return true;
+ }
+ return base.CanConvertTo(context, destinationType);
+ }
+
+ internal static object GetNamedColor(string name) {
+ object color = null;
+ // First, check to see if this is a standard name.
+ //
+ color = Colors[name];
+ if (color != null) {
+ return color;
+ }
+ // Ok, how about a system color?
+ //
+ color = SystemColors[name];
+ return color;
+ }
+
+ /// <include file='doc\ColorConverter.uex' path='docs/doc[@for="ColorConverter.ConvertFrom"]/*' />
+ /// <devdoc>
+ /// Converts the given object to the converter's native type.
+ /// </devdoc>
+ [SuppressMessage("Microsoft.Performance", "CA1808:AvoidCallsThatBoxValueTypes")]
+ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) {
+ string strValue = value as string;
+ if (strValue != null) {
+ object obj = null;
+ string text = strValue.Trim();
+
+ if (text.Length == 0) {
+ obj = Color.Empty;
+ }
+ else {
+ // First, check to see if this is a standard name.
+ //
+ obj = GetNamedColor(text);
+
+ if (obj == null) {
+ if (culture == null) {
+ culture = CultureInfo.CurrentCulture;
+ }
+
+ char sep = culture.TextInfo.ListSeparator[0];
+ bool tryMappingToKnownColor = true;
+
+ TypeConverter intConverter = TypeDescriptor.GetConverter(typeof(int));
+
+ // If the value is a 6 digit hex number only, then
+ // we want to treat the Alpha as 255, not 0
+ //
+ if (text.IndexOf(sep) == -1) {
+
+ // text can be '' (empty quoted string)
+ if (text.Length >= 2 && (text[0] == '\'' || text[0] == '"') && text[0] == text[text.Length -1]) {
+ // In quotes means a named value
+ string colorName = text.Substring(1, text.Length - 2);
+ obj = Color.FromName(colorName);
+ tryMappingToKnownColor = false;
+ }
+ else if ((text.Length == 7 && text[0] == '#') ||
+ (text.Length == 8 && (text.StartsWith("0x") || text.StartsWith("0X"))) ||
+ (text.Length == 8 && (text.StartsWith("&h") || text.StartsWith("&H")))) {
+ // Note: ConvertFromString will raise exception if value cannot be converted.
+ obj = Color.FromArgb(unchecked((int)(0xFF000000 | (uint)(int)intConverter.ConvertFromString(context, culture, text))));
+ }
+ }
+
+ // Nope. Parse the RGBA from the text.
+ //
+ if (obj == null) {
+ string[] tokens = text.Split(new char[] {sep});
+ int[] values = new int[tokens.Length];
+ for (int i = 0; i < values.Length; i++) {
+ values[i] = unchecked((int)intConverter.ConvertFromString(context, culture, tokens[i]));
+ }
+
+ // We should now have a number of parsed integer values.
+ // We support 1, 3, or 4 arguments:
+ //
+ // 1 -- full ARGB encoded
+ // 3 -- RGB
+ // 4 -- ARGB
+ //
+ switch (values.Length) {
+ case 1:
+ obj = Color.FromArgb(values[0]);
+ break;
+
+ case 3:
+ obj = Color.FromArgb(values[0], values[1], values[2]);
+ break;
+
+ case 4:
+ obj = Color.FromArgb(values[0], values[1], values[2], values[3]);
+ break;
+ }
+ tryMappingToKnownColor = true;
+ }
+
+ if ((obj != null) && tryMappingToKnownColor) {
+
+ // Now check to see if this color matches one of our known colors.
+ // If it does, then substitute it. We can only do this for "Colors"
+ // because system colors morph with user settings.
+ //
+ int targetARGB = ((Color)obj).ToArgb();
+
+ foreach (Color c in Colors.Values) {
+ if (c.ToArgb() == targetARGB) {
+ obj = c;
+ break;
+ }
+ }
+ }
+ }
+
+ if (obj == null) {
+ throw new ArgumentException(SR.Format(SR.InvalidColor, text));
+ }
+ }
+ return obj;
+ }
+ return base.ConvertFrom(context, culture, value);
+ }
+
+ /// <include file='doc\ColorConverter.uex' path='docs/doc[@for="ColorConverter.ConvertTo"]/*' />
+ /// <devdoc>
+ /// Converts the given object to another type. The most common types to convert
+ /// are to and from a string object. The default implementation will make a call
+ /// to ToString on the object if the object is valid and if the destination
+ /// type is string. If this cannot convert to the desitnation type, this will
+ /// throw a NotSupportedException.
+ /// </devdoc>
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) {
+ if (destinationType == null) {
+ throw new ArgumentNullException("destinationType");
+ }
+
+ if( value is Color ){
+ if (destinationType == typeof(string)) {
+ Color c = (Color)value;
+
+ if (c == Color.Empty) {
+ return string.Empty;
+ }
+ else {
+ // If this is a known color, then Color can provide its own
+ // name. Otherwise, we fabricate an ARGB value for it.
+ //
+ if (c.IsKnownColor) {
+ return c.Name;
+ }
+ else if (c.IsNamedColor) {
+ return "'" + c.Name + "'";
+ }
+ else {
+ if (culture == null) {
+ culture = CultureInfo.CurrentCulture;
+ }
+ string sep = culture.TextInfo.ListSeparator + " ";
+ TypeConverter intConverter = TypeDescriptor.GetConverter(typeof(int));
+ string[] args;
+ int nArg = 0;
+
+ if (c.A < 255) {
+ args = new string[4];
+ args[nArg++] = intConverter.ConvertToString(context, culture, (object)c.A);
+ }
+ else {
+ args = new string[3];
+ }
+
+ // Note: ConvertToString will raise exception if value cannot be converted.
+ args[nArg++] = intConverter.ConvertToString(context, culture, (object)c.R);
+ args[nArg++] = intConverter.ConvertToString(context, culture, (object)c.G);
+ args[nArg++] = intConverter.ConvertToString(context, culture, (object)c.B);
+
+ // Now slam all of these together with the fantastic Join
+ // method.
+ //
+ return string.Join(sep, args);
+ }
+ }
+ }
+ if (destinationType == typeof(InstanceDescriptor)) {
+ MemberInfo member = null;
+ object[] args = null;
+
+ Color c = (Color)value;
+
+ if (c.IsEmpty) {
+ member = typeof(Color).GetField("Empty");
+ }
+ else if (c.IsSystemColor) {
+ member = typeof(SystemColors).GetProperty(c.Name);
+ }
+ else if (c.IsKnownColor) {
+ member = typeof(Color).GetProperty(c.Name);
+ }
+ else if (c.A != 255) {
+ member = typeof(Color).GetMethod("FromArgb", new Type[] {typeof(int), typeof(int), typeof(int), typeof(int)});
+ args = new object[] {c.A, c.R, c.G, c.B};
+ }
+ else if (c.IsNamedColor) {
+ member = typeof(Color).GetMethod("FromName", new Type[] {typeof(string)});
+ args = new object[] {c.Name};
+ }
+ else {
+ member = typeof(Color).GetMethod("FromArgb", new Type[] {typeof(int), typeof(int), typeof(int)});
+ args = new object[] {c.R, c.G, c.B};
+ }
+
+ Debug.Assert(member != null, "Could not convert color to member. Did someone change method name / signature and not update Colorconverter?");
+ if (member != null) {
+ return new InstanceDescriptor(member, args);
+ }
+ else {
+ return null;
+ }
+ }
+ }
+
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+
+ /// <include file='doc\ColorConverter.uex' path='docs/doc[@for="ColorConverter.FillConstants"]/*' />
+ /// <devdoc>
+ /// Fills the given hashtable with field name / value pairs. It walks all public static
+ /// properties of enumType that have a property type of Color.
+ /// </devdoc>
+ private static void FillConstants(Hashtable hash, Type enumType) {
+ MethodAttributes attrs = MethodAttributes.Public | MethodAttributes.Static;
+ PropertyInfo[] props = enumType.GetProperties();
+
+ for (int i = 0; i < props.Length; i++) {
+ PropertyInfo prop = props[i];
+ if (prop.PropertyType == typeof(Color)) {
+ MethodInfo method = prop.GetGetMethod();
+ if (method != null && (method.Attributes & attrs) == attrs) {
+ object[] tempIndex = null;
+ hash[prop.Name] = prop.GetValue(null, tempIndex);
+ }
+ }
+ }
+ }
+
+ /// <include file='doc\ColorConverter.uex' path='docs/doc[@for="ColorConverter.GetStandardValues"]/*' />
+ /// <devdoc>
+ /// Retrieves a collection containing a set of standard values
+ /// for the data type this validator is designed for. This
+ /// will return null if the data type does not support a
+ /// standard set of values.
+ /// </devdoc>
+ public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) {
+ if (values == null) {
+ lock (ValuesLock) {
+ if (values == null) {
+
+ // We must take the value from each hashtable and combine them.
+ //
+ ArrayList arrayValues = new ArrayList();
+ arrayValues.AddRange(Colors.Values);
+ arrayValues.AddRange(SystemColors.Values);
+
+ // Now, we have a couple of colors that have the same names but
+ // are identical values. Look for these and remove them. Too
+ // bad this is n^2.
+ //
+ int count = arrayValues.Count;
+ for (int i = 0; i < count - 1; i++) {
+ for (int j = i + 1; j < count; j++) {
+ if (arrayValues[i].Equals(arrayValues[j])) {
+ // Remove this item!
+ //
+ arrayValues.RemoveAt(j);
+ count--;
+ j--;
+ }
+ }
+ }
+
+ // Sort the array.
+ //
+ arrayValues.Sort(0, arrayValues.Count, new ColorComparer());
+ values = new StandardValuesCollection(arrayValues.ToArray());
+ }
+ }
+ }
+
+ return values;
+ }
+
+ /// <include file='doc\ColorConverter.uex' path='docs/doc[@for="ColorConverter.GetStandardValuesSupported"]/*' />
+ /// <devdoc>
+ /// Determines if this object supports a standard set of values
+ /// that can be picked from a list.
+ /// </devdoc>
+ public override bool GetStandardValuesSupported(ITypeDescriptorContext context) {
+ return true;
+ }
+
+ /// <include file='doc\ColorConverter.uex' path='docs/doc[@for="ColorConverter.ColorComparer"]/*' />
+ /// <devdoc>
+ /// IComparer for color values. This takes color values but compares their
+ /// names.
+ /// </devdoc>
+ private class ColorComparer : IComparer {
+
+ public int Compare(object left, object right) {
+ Color cLeft = (Color)left;
+ Color cRight = (Color)right;
+ return string.Compare(cLeft.Name, cRight.Name, false, CultureInfo.InvariantCulture);
+ }
+ }
+ }
+}
+
+
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/ColorConverterCommon.cs b/src/System.Drawing.Common/src/System/Drawing/ColorConverterCommon.cs
new file mode 100644
index 0000000000..c4d624f86d
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/ColorConverterCommon.cs
@@ -0,0 +1,14 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.System.Drawing
+{
+ internal static class ColorConverterCommon
+ {
+ public static Color ConvertFromString(string colorString)
+ {
+
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Configuration/SystemDrawingSection.cs b/src/System.Drawing.Common/src/System/Drawing/Configuration/SystemDrawingSection.cs
new file mode 100644
index 0000000000..a529de79ad
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Configuration/SystemDrawingSection.cs
@@ -0,0 +1,40 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Configuration
+{
+ using System.Configuration;
+
+ /// <include file='doc\SystemDrawingSection.uex' path='docs/doc[@for="SystemDrawingSection"]/*' />
+ /// <devdoc>
+ /// A configuration section with a "bitmapSuffix" string value that specifies the suffix to be
+ /// appended to bitmaps that are loaded through ToolboxBitmapAttribute and similar attributes.
+ /// </devdoc>
+ public sealed class SystemDrawingSection : ConfigurationSection
+ {
+ private const string BitmapSuffixSectionName = "bitmapSuffix";
+
+ static SystemDrawingSection()
+ {
+ s_properties.Add(s_bitmapSuffix);
+ }
+
+ [ConfigurationProperty(BitmapSuffixSectionName)]
+ public string BitmapSuffix
+ {
+ get { return (string)this[s_bitmapSuffix]; }
+ set { this[s_bitmapSuffix] = value; }
+ }
+
+ protected override ConfigurationPropertyCollection Properties
+ {
+ get { return s_properties; }
+ }
+
+ private static readonly ConfigurationPropertyCollection s_properties = new ConfigurationPropertyCollection();
+
+ private static readonly ConfigurationProperty s_bitmapSuffix =
+ new ConfigurationProperty(BitmapSuffixSectionName, typeof(string), null, ConfigurationPropertyOptions.None);
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/ContentAlignment.cs b/src/System.Drawing.Common/src/System/Drawing/ContentAlignment.cs
new file mode 100644
index 0000000000..f1f770da46
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/ContentAlignment.cs
@@ -0,0 +1,86 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ /// <include file='doc\ContentAlignment.uex' path='docs/doc[@for="ContentAlignment"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies alignment of content on the drawing surface.
+ /// </para>
+ /// </devdoc>
+ public enum ContentAlignment
+ {
+ /// <include file='doc\ContentAlignment.uex' path='docs/doc[@for="ContentAlignment.TopLeft"]/*' />
+ /// <devdoc>
+ /// Content is vertically aligned at the top, and horizontally
+ /// aligned on the left.
+ /// </devdoc>
+ TopLeft = 0x001,
+ /// <include file='doc\ContentAlignment.uex' path='docs/doc[@for="ContentAlignment.TopCenter"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Content is vertically aligned at the top, and
+ /// horizontally aligned at the center.
+ /// </para>
+ /// </devdoc>
+ TopCenter = 0x002,
+ /// <include file='doc\ContentAlignment.uex' path='docs/doc[@for="ContentAlignment.TopRight"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Content is vertically aligned at the top, and
+ /// horizontally aligned on the right.
+ /// </para>
+ /// </devdoc>
+ TopRight = 0x004,
+ /// <include file='doc\ContentAlignment.uex' path='docs/doc[@for="ContentAlignment.MiddleLeft"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Content is vertically aligned in the middle, and
+ /// horizontally aligned on the left.
+ /// </para>
+ /// </devdoc>
+ MiddleLeft = 0x010,
+ /// <include file='doc\ContentAlignment.uex' path='docs/doc[@for="ContentAlignment.MiddleCenter"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Content is vertically aligned in the middle, and
+ /// horizontally aligned at the center.
+ /// </para>
+ /// </devdoc>
+ MiddleCenter = 0x020,
+ /// <include file='doc\ContentAlignment.uex' path='docs/doc[@for="ContentAlignment.MiddleRight"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Content is vertically aligned in the middle, and horizontally aligned on the
+ /// right.
+ /// </para>
+ /// </devdoc>
+ MiddleRight = 0x040,
+ /// <include file='doc\ContentAlignment.uex' path='docs/doc[@for="ContentAlignment.BottomLeft"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Content is vertically aligned at the bottom, and horizontally aligned on the
+ /// left.
+ /// </para>
+ /// </devdoc>
+ BottomLeft = 0x100,
+ /// <include file='doc\ContentAlignment.uex' path='docs/doc[@for="ContentAlignment.BottomCenter"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Content is vertically aligned at the bottom, and horizontally aligned at the
+ /// center.
+ /// </para>
+ /// </devdoc>
+ BottomCenter = 0x200,
+ /// <include file='doc\ContentAlignment.uex' path='docs/doc[@for="ContentAlignment.BottomRight"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Content is vertically aligned at the bottom, and horizontally aligned on the
+ /// right.
+ /// </para>
+ /// </devdoc>
+ BottomRight = 0x400,
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/CopyPixelOperation.cs b/src/System.Drawing.Common/src/System/Drawing/CopyPixelOperation.cs
new file mode 100644
index 0000000000..605e3c56e0
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/CopyPixelOperation.cs
@@ -0,0 +1,161 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ /// <include file='doc\CopyPixelOperation.uex' path='docs/doc[@for="CopyPixelOperation"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the
+ /// Copy Pixel (ROP) operation.
+ /// </para>
+ /// </devdoc>
+ [System.Runtime.InteropServices.ComVisible(true)]
+ public enum CopyPixelOperation
+ {
+ /// <include file='doc\CopyPixelOperation.uex' path='docs/doc[@for="CopyPixelOperation.Blackness"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Fills the Destination Rectangle using the color associated with the index 0 in the physical palette.
+ /// </para>
+ /// </devdoc>
+ Blackness = SafeNativeMethods.BLACKNESS,
+
+ /// <include file='doc\CopyPixelOperation.uex' path='docs/doc[@for="CopyPixelOperation.CaptureBlt"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Includes any windows that are Layered on Top.
+ /// </para>
+ /// </devdoc>
+ CaptureBlt = SafeNativeMethods.CAPTUREBLT,
+
+ /// <include file='doc\CopyPixelOperation.uex' path='docs/doc[@for="CopyPixelOperation.DestinationInvert"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// DestinationInvert.
+ /// </para>
+ /// </devdoc>
+ DestinationInvert = SafeNativeMethods.DSTINVERT,
+
+ /// <include file='doc\CopyPixelOperation.uex' path='docs/doc[@for="CopyPixelOperation.MergeCopy"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// MergeCopy.
+ /// </para>
+ /// </devdoc>
+ MergeCopy = SafeNativeMethods.MERGECOPY,
+
+ /// <include file='doc\CopyPixelOperation.uex' path='docs/doc[@for="CopyPixelOperation.MergePaint"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// MergePaint.
+ /// </para>
+ /// </devdoc>
+ MergePaint = SafeNativeMethods.MERGEPAINT,
+
+
+ /// <include file='doc\CopyPixelOperation.uex' path='docs/doc[@for="CopyPixelOperation.NoMirrorBitmap"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// NoMirrorBitmap.
+ /// </para>
+ /// </devdoc>
+ NoMirrorBitmap = SafeNativeMethods.NOMIRRORBITMAP,
+
+
+ /// <include file='doc\CopyPixelOperation.uex' path='docs/doc[@for="CopyPixelOperation.NotSourceCopy"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// NotSourceCopy.
+ /// </para>
+ /// </devdoc>
+ NotSourceCopy = SafeNativeMethods.NOTSRCCOPY,
+
+
+ /// <include file='doc\CopyPixelOperation.uex' path='docs/doc[@for="CopyPixelOperation.NotSourceErase"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// NotSourceErase.
+ /// </para>
+ /// </devdoc>
+ NotSourceErase = SafeNativeMethods.NOTSRCERASE,
+
+
+
+ /// <include file='doc\CopyPixelOperation.uex' path='docs/doc[@for="CopyPixelOperation.PatCopy"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PatCopy.
+ /// </para>
+ /// </devdoc>
+ PatCopy = SafeNativeMethods.PATCOPY,
+
+
+
+ /// <include file='doc\CopyPixelOperation.uex' path='docs/doc[@for="CopyPixelOperation.PatInvert"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PatInvert.
+ /// </para>
+ /// </devdoc>
+ PatInvert = SafeNativeMethods.PATINVERT,
+
+
+ /// <include file='doc\CopyPixelOperation.uex' path='docs/doc[@for="CopyPixelOperation.PatPaint"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PatPaint.
+ /// </para>
+ /// </devdoc>
+ PatPaint = SafeNativeMethods.PATPAINT,
+
+ /// <include file='doc\CopyPixelOperation.uex' path='docs/doc[@for="CopyPixelOperation.SourceAnd"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// SourceAnd.
+ /// </para>
+ /// </devdoc>
+ SourceAnd = SafeNativeMethods.SRCAND,
+
+ /// <include file='doc\CopyPixelOperation.uex' path='docs/doc[@for="CopyPixelOperation.SourceCopy"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// SourceCopy.
+ /// </para>
+ /// </devdoc>
+ SourceCopy = SafeNativeMethods.SRCCOPY,
+
+ /// <include file='doc\CopyPixelOperation.uex' path='docs/doc[@for="CopyPixelOperation.SourceErase"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// SourceErase.
+ /// </para>
+ /// </devdoc>
+ SourceErase = SafeNativeMethods.SRCERASE,
+
+ /// <include file='doc\CopyPixelOperation.uex' path='docs/doc[@for="CopyPixelOperation.SourceInvert"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// SourceInvert.
+ /// </para>
+ /// </devdoc>
+ SourceInvert = SafeNativeMethods.SRCINVERT,
+
+ /// <include file='doc\CopyPixelOperation.uex' path='docs/doc[@for="CopyPixelOperation.SourcePaint"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// SourcePaint.
+ /// </para>
+ /// </devdoc>
+ SourcePaint = SafeNativeMethods.SRCPAINT,
+
+ /// <include file='doc\CopyPixelOperation.uex' path='docs/doc[@for="CopyPixelOperation.Whiteness"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Whiteness.
+ /// </para>
+ /// </devdoc>
+ Whiteness = SafeNativeMethods.WHITENESS,
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/DashCap.cs b/src/System.Drawing.Common/src/System/Drawing/DashCap.cs
new file mode 100644
index 0000000000..c4bd49dd9f
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/DashCap.cs
@@ -0,0 +1,33 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Drawing2D
+{
+ /**
+ * Line cap constants
+ */
+ /// <include file='doc\DashCap.uex' path='docs/doc[@for="DashCap"]/*' />
+ /// <devdoc>
+ /// Specifies the available dash cap
+ /// styles with which a <see cref='System.Drawing.Pen'/> can end a line.
+ /// </devdoc>
+ public enum DashCap
+ {
+ /// <include file='doc\DashCap.uex' path='docs/doc[@for="DashCap.Flat"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Flat = 0,
+ /// <include file='doc\DashCap.uex' path='docs/doc[@for="DashCap.Round"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Round = 2,
+ /// <include file='doc\DashCap.uex' path='docs/doc[@for="DashCap.Triangle"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Triangle = 3
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Design/CategoryNameCollection.cs b/src/System.Drawing.Common/src/System/Drawing/Design/CategoryNameCollection.cs
new file mode 100644
index 0000000000..b34d5857e2
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Design/CategoryNameCollection.cs
@@ -0,0 +1,83 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Design
+{
+ using System.Collections;
+
+ /// <include file='doc\CategoryNameCollection.uex' path='docs/doc[@for="CategoryNameCollection"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A collection that stores <see cref='System.String'/> objects.
+ /// </para>
+ /// </devdoc>
+ [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name = "FullTrust")]
+ public sealed class CategoryNameCollection : ReadOnlyCollectionBase
+ {
+ /// <include file='doc\CategoryNameCollection.uex' path='docs/doc[@for="CategoryNameCollection.CategoryNameCollection"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of <see cref='System.Drawing.Design.CategoryNameCollection'/> based on another <see cref='System.Drawing.Design.CategoryNameCollection'/>.
+ /// </para>
+ /// </devdoc>
+ public CategoryNameCollection(CategoryNameCollection value)
+ {
+ InnerList.AddRange(value);
+ }
+
+ /// <include file='doc\CategoryNameCollection.uex' path='docs/doc[@for="CategoryNameCollection.CategoryNameCollection1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of <see cref='System.Drawing.Design.CategoryNameCollection'/> containing any array of <see cref='System.String'/> objects.
+ /// </para>
+ /// </devdoc>
+ public CategoryNameCollection(String[] value)
+ {
+ InnerList.AddRange(value);
+ }
+
+ /// <include file='doc\CategoryNameCollection.uex' path='docs/doc[@for="CategoryNameCollection.this"]/*' />
+ /// <devdoc>
+ /// <para>Represents the entry at the specified index of the <see cref='System.String'/>.</para>
+ /// </devdoc>
+ public string this[int index]
+ {
+ get
+ {
+ return ((string)(InnerList[index]));
+ }
+ }
+
+ /// <include file='doc\CategoryNameCollection.uex' path='docs/doc[@for="CategoryNameCollection.Contains"]/*' />
+ /// <devdoc>
+ /// <para>Gets a value indicating whether the
+ /// <see cref='System.Drawing.Design.CategoryNameCollection'/> contains the specified <see cref='System.String'/>.</para>
+ /// </devdoc>
+ public bool Contains(string value)
+ {
+ return InnerList.Contains(value);
+ }
+
+ /// <include file='doc\CategoryNameCollection.uex' path='docs/doc[@for="CategoryNameCollection.CopyTo"]/*' />
+ /// <devdoc>
+ /// <para>Copies the <see cref='System.Drawing.Design.CategoryNameCollection'/> values to a one-dimensional <see cref='System.Array'/> instance at the
+ /// specified index.</para>
+ /// </devdoc>
+ public void CopyTo(String[] array, int index)
+ {
+ InnerList.CopyTo(array, index);
+ }
+
+ /// <include file='doc\CategoryNameCollection.uex' path='docs/doc[@for="CategoryNameCollection.IndexOf"]/*' />
+ /// <devdoc>
+ /// <para>Returns the index of a <see cref='System.String'/> in
+ /// the <see cref='System.Drawing.Design.CategoryNameCollection'/> .</para>
+ /// </devdoc>
+ public int IndexOf(string value)
+ {
+ return InnerList.IndexOf(value);
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Design/IPropertyValueUIService.cs b/src/System.Drawing.Common/src/System/Drawing/Design/IPropertyValueUIService.cs
new file mode 100644
index 0000000000..062e900e5e
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Design/IPropertyValueUIService.cs
@@ -0,0 +1,68 @@
+//------------------------------------------------------------------------------
+// <copyright file="IPropertyValueUIService.cs" company="Microsoft">
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// </copyright>
+//------------------------------------------------------------------------------
+
+/*
+ */
+namespace System.Drawing.Design {
+
+ using System.Diagnostics;
+
+ using Microsoft.Win32;
+ using System.Drawing.Design;
+ using System.Collections;
+ using System.ComponentModel;
+
+ /// <include file='doc\IPropertyValueUIService.uex' path='docs/doc[@for="IPropertyValueUIService"]/*' />
+ /// <devdoc>
+ /// <para>Provides an interface to manage the property list of
+ /// the properties window. <see cref='System.Drawing.Design.IPropertyValueUIService'/> provides
+ /// methods that may
+ /// be used to add and remove UI components from the properties window, and to retrieve the UI components for a specific property listed in the property
+ /// browser.</para>
+ /// </devdoc>
+ public interface IPropertyValueUIService {
+
+ /// <include file='doc\IPropertyValueUIService.uex' path='docs/doc[@for="IPropertyValueUIService.PropertyUIValueItemsChanged"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds or removes an <see cref='System.EventHandler'/> that will be invoked
+ /// when the global list of PropertyValueUIItems is modified.
+ /// </para>
+ /// </devdoc>
+ event EventHandler PropertyUIValueItemsChanged;
+
+ /// <include file='doc\IPropertyValueUIService.uex' path='docs/doc[@for="IPropertyValueUIService.AddPropertyValueUIHandler"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a <see cref='System.Drawing.Design.PropertyValueUIHandler'/>
+ /// to this service.
+ /// </para>
+ /// </devdoc>
+ void AddPropertyValueUIHandler(PropertyValueUIHandler newHandler);
+
+ /// <include file='doc\IPropertyValueUIService.uex' path='docs/doc[@for="IPropertyValueUIService.GetPropertyUIValueItems"]/*' />
+ /// <devdoc>
+ /// <para>Gets all the <see cref='System.Drawing.Design.PropertyValueUIItem'/>
+ /// objects that should be displayed on the specified property.</para>
+ /// </devdoc>
+ PropertyValueUIItem[] GetPropertyUIValueItems(ITypeDescriptorContext context, PropertyDescriptor propDesc);
+
+ /// <include file='doc\IPropertyValueUIService.uex' path='docs/doc[@for="IPropertyValueUIService.NotifyPropertyValueUIItemsChanged"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Tell the IPropertyValueUIService implementation that the global list of PropertyValueUIItems has been modified.
+ /// </para>
+ /// </devdoc>
+ void NotifyPropertyValueUIItemsChanged();
+
+ /// <include file='doc\IPropertyValueUIService.uex' path='docs/doc[@for="IPropertyValueUIService.RemovePropertyValueUIHandler"]/*' />
+ /// <devdoc>
+ /// <para>Removes a <see cref='System.Drawing.Design.PropertyValueUIHandler'/>
+ /// from this service.</para>
+ /// </devdoc>
+ void RemovePropertyValueUIHandler(PropertyValueUIHandler newHandler);
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Design/IToolboxItemProvider.cs b/src/System.Drawing.Common/src/System/Drawing/Design/IToolboxItemProvider.cs
new file mode 100644
index 0000000000..15aa59a514
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Design/IToolboxItemProvider.cs
@@ -0,0 +1,21 @@
+//------------------------------------------------------------------------------
+// <copyright file="IToolboxItemProvider.cs" company="Microsoft">
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// </copyright>
+//------------------------------------------------------------------------------
+
+namespace System.Drawing.Design {
+
+ using System;
+
+ /// <include file='doc\IToolboxItemProvider.uex' path='docs/doc[@for="IToolboxItemProvider"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public interface IToolboxItemProvider {
+
+ /// <include file='doc\IToolboxItemProvider.uex' path='docs/doc[@for="IToolboxItemProvider.Items"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ ToolboxItemCollection Items { get; }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Design/IToolboxService.cs b/src/System.Drawing.Common/src/System/Drawing/Design/IToolboxService.cs
new file mode 100644
index 0000000000..b8ff1bdd2b
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Design/IToolboxService.cs
@@ -0,0 +1,212 @@
+//------------------------------------------------------------------------------
+// <copyright file="IToolboxService.cs" company="Microsoft">
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// </copyright>
+//------------------------------------------------------------------------------
+
+/*
+ */
+namespace System.Drawing.Design {
+
+ using System;
+ using System.Collections;
+ using System.ComponentModel.Design;
+ using System.Runtime.InteropServices;
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Provides access to the toolbox in the development environment.</para>
+ /// </devdoc>
+ [ComImport(), Guid("4BACD258-DE64-4048-BC4E-FEDBEF9ACB76"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface IToolboxService {
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.CategoryNames"]/*' />
+ /// <devdoc>
+ /// <para>Gets the names of all the tool categories currently on the toolbox.</para>
+ /// </devdoc>
+ CategoryNameCollection CategoryNames { get; }
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.SelectedCategory"]/*' />
+ /// <devdoc>
+ /// <para>Gets the name of the currently selected tool category from the toolbox.</para>
+ /// </devdoc>
+ string SelectedCategory { get; set; }
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.AddCreator"]/*' />
+ /// <devdoc>
+ /// <para>Adds a new toolbox item creator.</para>
+ /// </devdoc>
+ void AddCreator(ToolboxItemCreatorCallback creator, string format);
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.AddCreator1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a new toolbox
+ /// item creator.</para>
+ /// </devdoc>
+ void AddCreator(ToolboxItemCreatorCallback creator, string format, IDesignerHost host);
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.AddLinkedToolboxItem"]/*' />
+ /// <devdoc>
+ /// <para>Adds a new tool to the toolbox under the default category.</para>
+ /// </devdoc>
+ void AddLinkedToolboxItem(ToolboxItem toolboxItem, IDesignerHost host);
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.AddLinkedToolboxItem1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a
+ /// new tool to the toolbox under the specified category.</para>
+ /// </devdoc>
+ void AddLinkedToolboxItem(ToolboxItem toolboxItem, string category, IDesignerHost host);
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.AddToolboxItem"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds a new tool
+ /// to the toolbox under the default category.</para>
+ /// </devdoc>
+ void AddToolboxItem(ToolboxItem toolboxItem);
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.AddToolboxItem1"]/*' />
+ /// <devdoc>
+ /// <para>Adds a new tool to the toolbox under the specified category.</para>
+ /// </devdoc>
+ void AddToolboxItem(ToolboxItem toolboxItem, string category);
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.DeserializeToolboxItem"]/*' />
+ /// <devdoc>
+ /// <para>Gets a toolbox item from a previously serialized object.</para>
+ /// </devdoc>
+ ToolboxItem DeserializeToolboxItem(object serializedObject);
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.DeserializeToolboxItem1"]/*' />
+ /// <devdoc>
+ /// <para>Gets a toolbox item from a previously serialized object.</para>
+ /// </devdoc>
+ ToolboxItem DeserializeToolboxItem(object serializedObject, IDesignerHost host);
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.GetSelectedToolboxItem"]/*' />
+ /// <devdoc>
+ /// <para>Gets the currently selected tool.</para>
+ /// </devdoc>
+ ToolboxItem GetSelectedToolboxItem();
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.GetSelectedToolboxItem1"]/*' />
+ /// <devdoc>
+ /// <para>Gets the currently selected tool.</para>
+ /// </devdoc>
+ ToolboxItem GetSelectedToolboxItem(IDesignerHost host);
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.GetToolboxItems"]/*' />
+ /// <devdoc>
+ /// <para>Gets all .NET Framework tools on the toolbox.</para>
+ /// </devdoc>
+ ToolboxItemCollection GetToolboxItems();
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.GetToolboxItems1"]/*' />
+ /// <devdoc>
+ /// <para>Gets all .NET Framework tools on the toolbox.</para>
+ /// </devdoc>
+ ToolboxItemCollection GetToolboxItems(IDesignerHost host);
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.GetToolboxItems2"]/*' />
+ /// <devdoc>
+ /// <para>Gets all .NET Framework tools on the specified toolbox category.</para>
+ /// </devdoc>
+ ToolboxItemCollection GetToolboxItems(String category);
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.GetToolboxItems3"]/*' />
+ /// <devdoc>
+ /// <para>Gets all .NET Framework tools on the specified toolbox category.</para>
+ /// </devdoc>
+ ToolboxItemCollection GetToolboxItems(String category, IDesignerHost host);
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.IsSupported"]/*' />
+ /// <devdoc>
+ /// Determines if the given designer host contains a designer that supports the serialized
+ /// toolbox item. This will return false if the designer doesn't support the item, or if the
+ /// serializedObject parameter does not contain a toolbox item.
+ /// </devdoc>
+ bool IsSupported(object serializedObject, IDesignerHost host);
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.IsSupported1"]/*' />
+ /// <devdoc>
+ /// Determines if the serialized toolbox item contains a matching collection of filter attributes.
+ /// This will return false if the serializedObject parameter doesn't contain a toolbox item,
+ /// or if the collection of filter attributes does not match.
+ /// </devdoc>
+ bool IsSupported(object serializedObject, ICollection filterAttributes);
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.IsToolboxItem"]/*' />
+ /// <devdoc>
+ /// <para>Gets a value indicating whether the specified object contains a serialized toolbox item.</para>
+ /// </devdoc>
+ bool IsToolboxItem(object serializedObject);
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.IsToolboxItem1"]/*' />
+ /// <devdoc>
+ /// <para>Gets a value indicating whether the specified object contains a serialized toolbox item.</para>
+ /// </devdoc>
+ bool IsToolboxItem(object serializedObject, IDesignerHost host);
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.Refresh"]/*' />
+ /// <devdoc>
+ /// <para> Refreshes the state of the toolbox items.</para>
+ /// </devdoc>
+ void Refresh();
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.RemoveCreator"]/*' />
+ /// <devdoc>
+ /// <para>Removes a previously added toolbox creator.</para>
+ /// </devdoc>
+ void RemoveCreator(string format);
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.RemoveCreator1"]/*' />
+ /// <devdoc>
+ /// Removes a previously added toolbox creator.
+ /// </devdoc>
+ void RemoveCreator(string format, IDesignerHost host);
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.RemoveToolboxItem"]/*' />
+ /// <devdoc>
+ /// <para>Removes the specified tool from the toolbox.</para>
+ /// </devdoc>
+ void RemoveToolboxItem(ToolboxItem toolboxItem);
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.RemoveToolboxItem1"]/*' />
+ /// <devdoc>
+ /// <para>Removes the specified tool from the toolbox.</para>
+ /// </devdoc>
+ void RemoveToolboxItem(ToolboxItem toolboxItem, string category);
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.SelectedToolboxItemUsed"]/*' />
+ /// <devdoc>
+ /// <para>Notifies the toolbox that the selected tool has been used.</para>
+ /// </devdoc>
+ void SelectedToolboxItemUsed();
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.SerializeToolboxItem"]/*' />
+ /// <devdoc>
+ /// Takes the given toolbox item and serializes it to a persistent object. This object can then
+ /// be stored in a stream or passed around in a drag and drop or clipboard operation.
+ /// </devdoc>
+ object SerializeToolboxItem(ToolboxItem toolboxItem);
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.SetCursor"]/*' />
+ /// <devdoc>
+ /// <para>Sets the current application's cursor to a cursor that represents the
+ /// currently selected tool.</para>
+ /// </devdoc>
+ bool SetCursor();
+
+ /// <include file='doc\IToolboxService.uex' path='docs/doc[@for="IToolboxService.SetSelectedToolboxItem"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Sets the currently selected tool in the toolbox.</para>
+ /// </devdoc>
+ void SetSelectedToolboxItem(ToolboxItem toolboxItem);
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Design/IToolboxUser.cs b/src/System.Drawing.Common/src/System/Drawing/Design/IToolboxUser.cs
new file mode 100644
index 0000000000..7d2cb9de3b
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Design/IToolboxUser.cs
@@ -0,0 +1,38 @@
+//------------------------------------------------------------------------------
+// <copyright file="IToolboxUser.cs" company="Microsoft">
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// </copyright>
+//------------------------------------------------------------------------------
+
+/*
+ */
+namespace System.Drawing.Design {
+
+ using System.Diagnostics;
+
+ /// <include file='doc\IToolboxUser.uex' path='docs/doc[@for="IToolboxUser"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Provides notifications of toolbox actions
+ /// to designers which implement this interface.
+ /// </para>
+ /// </devdoc>
+ public interface IToolboxUser {
+ /// <include file='doc\IToolboxUser.uex' path='docs/doc[@for="IToolboxUser.GetToolSupported"]/*' />
+ /// <devdoc>
+ /// <para>Gets a value indicating whether the specified tool is supported by the current
+ /// designer.</para>
+ /// </devdoc>
+
+
+ //
+ bool GetToolSupported(ToolboxItem tool);
+
+ /// <include file='doc\IToolboxUser.uex' path='docs/doc[@for="IToolboxUser.ToolPicked"]/*' />
+ /// <devdoc>
+ /// <para>Selects the specified tool.</para>
+ /// </devdoc>
+ void ToolPicked(ToolboxItem tool);
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Design/PaintValueEventArgs.cs b/src/System.Drawing.Common/src/System/Drawing/Design/PaintValueEventArgs.cs
new file mode 100644
index 0000000000..1f445670db
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Design/PaintValueEventArgs.cs
@@ -0,0 +1,101 @@
+//------------------------------------------------------------------------------
+// <copyright file="PaintValueEventArgs.cs" company="Microsoft">
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// </copyright>
+//------------------------------------------------------------------------------
+
+/*
+ */
+namespace System.Drawing.Design {
+
+ using System;
+ using System.ComponentModel;
+ using System.Diagnostics;
+ using System.Drawing;
+
+ /// <include file='doc\PaintValueEventArgs.uex' path='docs/doc[@for="PaintValueEventArgs"]/*' />
+ /// <devdoc>
+ /// This object is passed to UITypeEditor.PaintValue.
+ /// It contains all the information needed for the editor to
+ /// paint the given value, including the Rectangle in which
+ /// the drawing should be done, and the Graphics object with which the drawing
+ /// should be done.
+ /// </devdoc>
+ [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Name="FullTrust")]
+ [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")]
+ public class PaintValueEventArgs : EventArgs {
+ private readonly ITypeDescriptorContext context;
+
+ private readonly object valueToPaint;
+
+ /// <include file='doc\PaintValueEventArgs.uex' path='docs/doc[@for="PaintValueEventArgs.graphics"]/*' />
+ /// <devdoc>
+ /// The graphics object with which the drawing should be done.
+ /// </devdoc>
+ private readonly Graphics graphics;
+
+ /// <include file='doc\PaintValueEventArgs.uex' path='docs/doc[@for="PaintValueEventArgs.bounds"]/*' />
+ /// <devdoc>
+ /// The rectangle outlining the area in which the painting should be
+ /// done.
+ /// </devdoc>
+ private readonly Rectangle bounds;
+
+ /// <include file='doc\PaintValueEventArgs.uex' path='docs/doc[@for="PaintValueEventArgs.PaintValueEventArgs"]/*' />
+ /// <devdoc>
+ /// Creates a new PaintValueEventArgs with the given parameters.
+ /// </devdoc>
+ public PaintValueEventArgs(ITypeDescriptorContext context, object value, Graphics graphics, Rectangle bounds) {
+ this.context = context;
+ this.valueToPaint = value;
+
+ this.graphics = graphics;
+ if (graphics == null)
+ throw new ArgumentNullException("graphics");
+
+ this.bounds = bounds;
+ }
+
+ /// <include file='doc\PaintValueEventArgs.uex' path='docs/doc[@for="PaintValueEventArgs.Bounds"]/*' />
+ /// <devdoc>
+ /// The rectangle outlining the area in which the painting should be
+ /// done.
+ /// </devdoc>
+ public Rectangle Bounds {
+ get {
+ return bounds;
+ }
+ }
+
+ /// <include file='doc\PaintValueEventArgs.uex' path='docs/doc[@for="PaintValueEventArgs.Context"]/*' />
+ /// <devdoc>
+ /// ITypeDescriptorContext object for additional information about the context this value appears in.
+ /// </devdoc>
+ public ITypeDescriptorContext Context {
+ get {
+ return context;
+ }
+ }
+
+ /// <include file='doc\PaintValueEventArgs.uex' path='docs/doc[@for="PaintValueEventArgs.Graphics"]/*' />
+ /// <devdoc>
+ /// Graphics object with which painting should be done.
+ /// </devdoc>
+ public Graphics Graphics {
+ get {
+ return graphics;
+ }
+ }
+
+ /// <include file='doc\PaintValueEventArgs.uex' path='docs/doc[@for="PaintValueEventArgs.Value"]/*' />
+ /// <devdoc>
+ /// The value to paint.
+ /// </devdoc>
+ public object Value {
+ get {
+ return valueToPaint;
+ }
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Design/PropertyValueUIHandler.cs b/src/System.Drawing.Common/src/System/Drawing/Design/PropertyValueUIHandler.cs
new file mode 100644
index 0000000000..a7c3621adf
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Design/PropertyValueUIHandler.cs
@@ -0,0 +1,24 @@
+//------------------------------------------------------------------------------
+// <copyright file="PropertyValueUIHandler.cs" company="Microsoft">
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// </copyright>
+//------------------------------------------------------------------------------
+
+/*
+ */
+namespace System.Drawing.Design {
+
+ using System.Diagnostics;
+
+ using Microsoft.Win32;
+ using System.ComponentModel;
+ using System.ComponentModel.Design;
+ using System.Collections;
+
+ /// <include file='doc\PropertyValueUIHandler.uex' path='docs/doc[@for="PropertyValueUIHandler"]/*' />
+ /// <devdoc>
+ /// <para>Represents a delegate to be added to <see cref='System.Drawing.Design.IPropertyValueUIService'/>.</para>
+ /// </devdoc>
+ public delegate void PropertyValueUIHandler(ITypeDescriptorContext context, PropertyDescriptor propDesc, ArrayList valueUIItemList);
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Design/PropertyValueUIItem.cs b/src/System.Drawing.Common/src/System/Drawing/Design/PropertyValueUIItem.cs
new file mode 100644
index 0000000000..67f78aef41
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Design/PropertyValueUIItem.cs
@@ -0,0 +1,103 @@
+//------------------------------------------------------------------------------
+// <copyright file="PropertyValueUIItem.cs" company="Microsoft">
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// </copyright>
+//------------------------------------------------------------------------------
+
+/*
+ */
+namespace System.Drawing.Design {
+
+ using System.Diagnostics;
+
+ using Microsoft.Win32;
+ using System.Collections;
+ using System.Drawing;
+
+ /// <include file='doc\PropertyValueUIItem.uex' path='docs/doc[@for="PropertyValueUIItem"]/*' />
+ /// <devdoc>
+ /// <para>Provides information about the property value UI including the invoke
+ /// handler, tool tip, and the glyph icon to be displayed on the property
+ /// browser.</para>
+ /// </devdoc>
+ [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Name="FullTrust")]
+ [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")]
+ public class PropertyValueUIItem {
+
+ /// <include file='doc\PropertyValueUIItem.uex' path='docs/doc[@for="PropertyValueUIItem.itemImage"]/*' />
+ /// <devdoc>
+ /// The image to display for this. Must be 8x8
+ /// </devdoc>
+ private Image itemImage;
+
+ /// <include file='doc\PropertyValueUIItem.uex' path='docs/doc[@for="PropertyValueUIItem.handler"]/*' />
+ /// <devdoc>
+ /// The handler to fire if this item is double clicked.
+ /// </devdoc>
+ private PropertyValueUIItemInvokeHandler handler;
+
+ /// <include file='doc\PropertyValueUIItem.uex' path='docs/doc[@for="PropertyValueUIItem.tooltip"]/*' />
+ /// <devdoc>
+ /// The tooltip for this item.
+ /// </devdoc>
+ private string tooltip;
+
+ /// <include file='doc\PropertyValueUIItem.uex' path='docs/doc[@for="PropertyValueUIItem.PropertyValueUIItem"]/*' />
+ /// <devdoc>
+ /// <para>Initiailzes a new instance of the <see cref='System.Drawing.Design.PropertyValueUIItem'/> class.</para>
+ /// </devdoc>
+ public PropertyValueUIItem(Image uiItemImage, PropertyValueUIItemInvokeHandler handler, string tooltip){
+ this.itemImage = uiItemImage;
+ this.handler = handler;
+ if (itemImage == null) {
+ throw new ArgumentNullException("uiItemImage");
+ }
+ if (handler == null) {
+ throw new ArgumentNullException("handler");
+ }
+ this.tooltip = tooltip;
+ }
+
+ /// <include file='doc\PropertyValueUIItem.uex' path='docs/doc[@for="PropertyValueUIItem.Image"]/*' />
+ /// <devdoc>
+ /// <para>Gets or sets
+ /// the 8x8 pixel image that will be drawn on the properties window.</para>
+ /// </devdoc>
+ public virtual Image Image {
+ get {
+ return itemImage;
+ }
+ }
+
+
+ /// <include file='doc\PropertyValueUIItem.uex' path='docs/doc[@for="PropertyValueUIItem.InvokeHandler"]/*' />
+ /// <devdoc>
+ /// <para>Gets or sets the handler that will be raised when this item is double clicked.</para>
+ /// </devdoc>
+ public virtual PropertyValueUIItemInvokeHandler InvokeHandler {
+ get {
+ return handler;
+ }
+ }
+
+ /// <include file='doc\PropertyValueUIItem.uex' path='docs/doc[@for="PropertyValueUIItem.ToolTip"]/*' />
+ /// <devdoc>
+ /// <para>Gets or sets the
+ /// tool tip to display for this item.</para>
+ /// </devdoc>
+ public virtual string ToolTip {
+ get {
+ return tooltip;
+ }
+ }
+
+ /// <include file='doc\PropertyValueUIItem.uex' path='docs/doc[@for="PropertyValueUIItem.Reset"]/*' />
+ /// <devdoc>
+ /// <para>Resets the UI item.</para>
+ /// </devdoc>
+ public virtual void Reset(){
+ }
+ }
+
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Design/PropertyValueUIItemInvokeHandler.cs b/src/System.Drawing.Common/src/System/Drawing/Design/PropertyValueUIItemInvokeHandler.cs
new file mode 100644
index 0000000000..62a44bd40a
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Design/PropertyValueUIItemInvokeHandler.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+// <copyright file="PropertyValueUIItemInvokeHandler.cs" company="Microsoft">
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// </copyright>
+//------------------------------------------------------------------------------
+
+/*
+ */
+namespace System.Drawing.Design {
+
+ using System.Diagnostics;
+
+ using Microsoft.Win32;
+ using System.Collections;
+ using System.ComponentModel.Design;
+ using System.ComponentModel;
+
+ /// <include file='doc\PropertyValueUIItemInvokeHandler.uex' path='docs/doc[@for="PropertyValueUIItemInvokeHandler"]/*' />
+ /// <devdoc>
+ /// <para>Represents the method that will handle the event
+ /// raised when an icon in the properties window associated with
+ /// a <see cref='System.Drawing.Design.PropertyValueUIItem'/> is
+ /// double-clicked.</para>
+ /// </devdoc>
+ public delegate void PropertyValueUIItemInvokeHandler(ITypeDescriptorContext context, PropertyDescriptor descriptor, PropertyValueUIItem invokedItem);
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxComponentsCreatedEventArgs.cs b/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxComponentsCreatedEventArgs.cs
new file mode 100644
index 0000000000..96595691b2
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxComponentsCreatedEventArgs.cs
@@ -0,0 +1,44 @@
+//------------------------------------------------------------------------------
+// <copyright file="ToolboxComponentsCreatedEventArgs.cs" company="Microsoft">
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// </copyright>
+//------------------------------------------------------------------------------
+
+namespace System.Drawing.Design {
+ using System;
+ using System.ComponentModel;
+
+
+ /// <include file='doc\ToolboxComponentsCreatedEventArgs.uex' path='docs/doc[@for="ToolboxComponentsCreatedEventArgs"]/*' />
+ /// <devdoc>
+ /// <para>Provides data for the 'ToolboxComponentsCreatedEventArgs' event that occurs
+ /// when components are added to the toolbox.</para>
+ /// </devdoc>
+ [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Name="FullTrust")]
+ [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")]
+ public class ToolboxComponentsCreatedEventArgs : EventArgs {
+ private readonly IComponent[] comps;
+
+ /// <include file='doc\ToolboxComponentsCreatedEventArgs.uex' path='docs/doc[@for="ToolboxComponentsCreatedEventArgs.ToolboxComponentsCreatedEventArgs"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Design.ToolboxComponentsCreatedEventArgs'/> object.
+ /// </para>
+ /// </devdoc>
+ public ToolboxComponentsCreatedEventArgs(IComponent[] components) {
+ this.comps = components;
+ }
+
+ /// <include file='doc\ToolboxComponentsCreatedEventArgs.uex' path='docs/doc[@for="ToolboxComponentsCreatedEventArgs.Components"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// An array storing the toolbox components.
+ /// </para>
+ /// </devdoc>
+ public IComponent[] Components {
+ get {
+ return (IComponent[])comps.Clone();
+ }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxComponentsCreatedEventHandler.cs b/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxComponentsCreatedEventHandler.cs
new file mode 100644
index 0000000000..fa34f68446
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxComponentsCreatedEventHandler.cs
@@ -0,0 +1,16 @@
+//------------------------------------------------------------------------------
+// <copyright file="ToolboxComponentsCreatedEventHandler.cs" company="Microsoft">
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// </copyright>
+//------------------------------------------------------------------------------
+
+namespace System.Drawing.Design {
+ using System;
+ using System.ComponentModel;
+
+ /// <include file='doc\ToolboxComponentsCreatedEventHandler.uex' path='docs/doc[@for="ToolboxComponentsCreatedEventHandler"]/*' />
+ /// <devdoc>
+ /// <para>Represents the method that will handle the <see cref='System.Drawing.Design.ToolboxItem.ComponentsCreated'/> event.</para>
+ /// </devdoc>
+ public delegate void ToolboxComponentsCreatedEventHandler(object sender, ToolboxComponentsCreatedEventArgs e);
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxComponentsCreatingEventArgs.cs b/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxComponentsCreatingEventArgs.cs
new file mode 100644
index 0000000000..14769ce443
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxComponentsCreatingEventArgs.cs
@@ -0,0 +1,45 @@
+//------------------------------------------------------------------------------
+// <copyright file="ToolboxComponentsCreatingEventArgs.cs" company="Microsoft">
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// </copyright>
+//------------------------------------------------------------------------------
+
+namespace System.Drawing.Design {
+ using System;
+ using System.ComponentModel.Design;
+
+
+ /// <include file='doc\ToolboxComponentsCreatingEventArgs.uex' path='docs/doc[@for="ToolboxComponentsCreatingEventArgs"]/*' />
+ /// <devdoc>
+ /// <para>Provides data for the 'ToolboxComponentsCreatingEventArgs' event that occurs
+ /// when components are added to the toolbox.</para>
+ /// </devdoc>
+ [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Name="FullTrust")]
+ [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")]
+ public class ToolboxComponentsCreatingEventArgs : EventArgs {
+ private readonly IDesignerHost host;
+
+ /// <include file='doc\ToolboxComponentsCreatingEventArgs.uex' path='docs/doc[@for="ToolboxComponentsCreatingEventArgs.ToolboxComponentsCreatingEventArgs"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Design.ToolboxComponentsCreatingEventArgs'/> object.
+ /// </para>
+ /// </devdoc>
+ public ToolboxComponentsCreatingEventArgs(IDesignerHost host) {
+ this.host = host;
+ }
+
+ /// <include file='doc\ToolboxComponentsCreatingEventArgs.uex' path='docs/doc[@for="ToolboxComponentsCreatingEventArgs.DesignerHost"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// An instance of IDesignerHost that has made the creat request. This can be null if no designer host
+ /// was provided to the toolbox item.
+ /// </para>
+ /// </devdoc>
+ public IDesignerHost DesignerHost {
+ get {
+ return host;
+ }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxComponentsCreatingEventHandler.cs b/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxComponentsCreatingEventHandler.cs
new file mode 100644
index 0000000000..6c5ddef5a6
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxComponentsCreatingEventHandler.cs
@@ -0,0 +1,16 @@
+//------------------------------------------------------------------------------
+// <copyright file="ToolboxComponentsCreatingEventHandler.cs" company="Microsoft">
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// </copyright>
+//------------------------------------------------------------------------------
+
+namespace System.Drawing.Design {
+ using System;
+ using System.ComponentModel;
+
+ /// <include file='doc\ToolboxComponentsCreatingEventHandler.uex' path='docs/doc[@for="ToolboxComponentsCreatingEventHandler"]/*' />
+ /// <devdoc>
+ /// <para>Represents the method that will handle the <see cref='System.Drawing.Design.ToolboxItem.ComponentsCreating'/> event.</para>
+ /// </devdoc>
+ public delegate void ToolboxComponentsCreatingEventHandler(object sender, ToolboxComponentsCreatingEventArgs e);
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxItem.cs b/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxItem.cs
new file mode 100644
index 0000000000..111eee72de
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxItem.cs
@@ -0,0 +1,1035 @@
+//------------------------------------------------------------------------------
+// <copyright file="ToolboxItem.cs" company="Microsoft">
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// </copyright>
+//------------------------------------------------------------------------------
+
+/*
+ */
+namespace System.Drawing.Design {
+ using System.Configuration.Assemblies;
+ using System.Runtime.InteropServices;
+ using System.Runtime.Serialization;
+ using System.ComponentModel;
+ using System.Diagnostics;
+ using System;
+ using System.Reflection;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.ComponentModel.Design;
+ using Microsoft.Win32;
+ using System.Drawing;
+ using System.IO;
+ using System.Text;
+ using System.Security;
+ using System.Security.Permissions;
+ using System.Diagnostics.CodeAnalysis;
+ using System.Runtime.Versioning;
+
+ using DpiHelper = System.Windows.Forms.DpiHelper;
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem"]/*' />
+ /// <devdoc>
+ /// <para> Provides a base implementation of a toolbox item.</para>
+ /// </devdoc>
+ [Serializable]
+ [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Name="FullTrust")]
+ [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")]
+ public class ToolboxItem : ISerializable {
+
+ private static TraceSwitch ToolboxItemPersist = new TraceSwitch("ToolboxPersisting", "ToolboxItem: write data");
+
+ private static object EventComponentsCreated = new object();
+ private static object EventComponentsCreating = new object();
+
+ private static bool isScalingInitialized = false;
+ private const int ICON_DIMENSION = 16;
+ private static int iconWidth = ICON_DIMENSION;
+ private static int iconHeight = ICON_DIMENSION;
+
+ private bool locked;
+ private LockableDictionary properties;
+ private ToolboxComponentsCreatedEventHandler componentsCreatedEvent;
+ private ToolboxComponentsCreatingEventHandler componentsCreatingEvent;
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.ToolboxItem"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the ToolboxItem class.
+ /// </devdoc>
+ public ToolboxItem() {
+ if (!isScalingInitialized) {
+ if (DpiHelper.IsScalingRequired) {
+ iconWidth = DpiHelper.LogicalToDeviceUnitsX(ICON_DIMENSION);
+ iconHeight = DpiHelper.LogicalToDeviceUnitsY(ICON_DIMENSION);
+ }
+ isScalingInitialized = true;
+ }
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.ToolboxItem1"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the ToolboxItem class using the specified type.
+ /// </devdoc>
+ [ResourceExposure(ResourceScope.Process)]
+ [ResourceConsumption(ResourceScope.Process)]
+ public ToolboxItem(Type toolType) : this() {
+ Initialize(toolType);
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.ToolboxItem2"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Design.ToolboxItem'/>
+ /// class using the specified serialization information.
+ /// </devdoc>
+#pragma warning disable CA2229 // We don't care about serialization constructors.
+ private ToolboxItem(SerializationInfo info, StreamingContext context) : this()
+#pragma warning restore CA2229
+ {
+ Deserialize(info, context);
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.AssemblyName"]/*' />
+ /// <devdoc>
+ /// The assembly name for this toolbox item. The assembly name describes the assembly
+ /// information needed to load the toolbox item's type.
+ /// </devdoc>
+ public AssemblyName AssemblyName {
+ get {
+ return (AssemblyName)Properties["AssemblyName"];
+ }
+ set {
+ Properties["AssemblyName"] = value;
+ }
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.AssemblyName"]/*' />
+ /// <devdoc>
+ /// The assembly name for this toolbox item. The assembly name describes the assembly
+ /// information needed to load the toolbox item's type.
+ /// </devdoc>
+ public AssemblyName[] DependentAssemblies {
+ get {
+ AssemblyName[] names = (AssemblyName[]) Properties["DependentAssemblies"];
+ if (names != null) {
+ return (AssemblyName[]) names.Clone();
+ }
+ return null;
+ }
+ set {
+ Properties["DependentAssemblies"] = value.Clone();
+ }
+ }
+
+
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.Bitmap"]/*' />
+ /// <devdoc>
+ /// Gets or sets the bitmap that will be used on the toolbox for this item.
+ /// Use this property on the design surface as this bitmap is scaled according to the current the DPI setting.
+ /// </devdoc>
+ public Bitmap Bitmap {
+ get {
+ return (Bitmap)Properties["Bitmap"];
+ }
+ set {
+ Properties["Bitmap"] = value;
+ }
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.OriginalBitmap"]/*' />
+ /// <devdoc>
+ /// Gets or sets the original bitmap that will be used on the toolbox for this item.
+ /// This bitmap should be 16x16 pixel and should be used in the Visual Studio toolbox, not on the design surface.
+ /// </devdoc>
+ public Bitmap OriginalBitmap {
+ get {
+ return (Bitmap)Properties["OriginalBitmap"];
+ }
+ set {
+ Properties["OriginalBitmap"] = value;
+ }
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.Company"]/*' />
+ /// <devdoc>
+ /// Gets or sets the company name for this <see cref='System.Drawing.Design.ToolboxItem'/>.
+ /// This defaults to the companyname attribute retrieved from type.Assembly, if set.
+ /// </devdoc>
+ public string Company {
+ get {
+ return (string)Properties["Company"];
+ }
+ set {
+ Properties["Company"] = value;
+ }
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.ComponentType"]/*' />
+ /// <devdoc>
+ /// The Component Type is ".Net Component" -- unless otherwise specified by a derived toolboxitem
+ /// </devdoc>
+ public virtual string ComponentType {
+ get {
+ return SR.Format(SR.DotNET_ComponentType);
+ }
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.Description"]/*' />
+ /// <devdoc>
+ /// Description is a free-form, multiline capable text description that will be displayed in the tooltip
+ /// for the toolboxItem. It defaults to the path of the assembly that contains the item, but can be overridden.
+ /// </devdoc>
+ public string Description {
+ get {
+ return (string)Properties["Description"];
+ }
+ set {
+ Properties["Description"] = value;
+ }
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.DisplayName"]/*' />
+ /// <devdoc>
+ /// Gets or sets the display name for this <see cref='System.Drawing.Design.ToolboxItem'/>.
+ /// </devdoc>
+ public string DisplayName {
+ get {
+ return (string)Properties["DisplayName"];
+ }
+ set {
+ Properties["DisplayName"] = value;
+ }
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.Filter"]/*' />
+ /// <devdoc>
+ /// Gets or sets the filter for this toolbox item. The filter is a collection of
+ /// ToolboxItemFilterAttribute objects.
+ /// </devdoc>
+ public ICollection Filter {
+ get {
+ return (ICollection)Properties["Filter"];
+ }
+ set {
+ Properties["Filter"] = value;
+ }
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.IsTransient"]/*' />
+ /// <devdoc>
+ /// If true, it indicates that this toolbox item should not be stored in
+ /// any toolbox database when an application that is providing a toolbox
+ /// closes down. This property defaults to false.
+ /// </devdoc>
+ public bool IsTransient {
+ [SuppressMessage("Microsoft.Performance", "CA1808:AvoidCallsThatBoxValueTypes")]
+ get {
+ return (bool)Properties["IsTransient"];
+ }
+ set {
+ Properties["IsTransient"] = value;
+ }
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.Locked"]/*' />
+ /// <devdoc>
+ /// Determines if this toolbox item is locked. Once locked, a toolbox item will
+ /// not accept any changes to its properties.
+ /// </devdoc>
+ public virtual bool Locked {
+ get {
+ return locked;
+ }
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.Properties"]/*' />
+ /// <devdoc>
+ /// The properties dictionary is a set of name/value pairs. The keys are property
+ /// names and the values are property values. This dictionary becomes read-only
+ /// after the toolbox item has been locked.
+ ///
+ /// Values in the properties dictionary are validated through ValidateProperty
+ /// and default values are obtained from GetDefalutProperty.
+ /// </devdoc>
+ public IDictionary Properties {
+ get {
+ if (properties == null) {
+ properties = new LockableDictionary(this, 8 /* # of properties we have */);
+ }
+
+ return properties;
+ }
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.TypeName"]/*' />
+ /// <devdoc>
+ /// Gets or sets the fully qualified name of the type this toolbox item will create.
+ /// </devdoc>
+ public string TypeName {
+ get {
+ return (string)Properties["TypeName"];
+ }
+ set {
+ Properties["TypeName"] = value;
+ }
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.DisplayName"]/*' />
+ /// <devdoc>
+ /// Gets the version for this toolboxitem. It defaults to AssemblyName.Version unless
+ /// overridden in a derived toolboxitem. This can be overridden to return an empty string
+ /// to suppress its display in the toolbox tooltip.
+ /// </devdoc>
+ public virtual string Version {
+ get {
+ if (this.AssemblyName != null) {
+ return this.AssemblyName.Version.ToString();
+ }
+ return String.Empty;
+ }
+ }
+
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.ComponentsCreated"]/*' />
+ /// <devdoc>
+ /// <para>Occurs when components are created.</para>
+ /// </devdoc>
+ public event ToolboxComponentsCreatedEventHandler ComponentsCreated {
+ add {
+ componentsCreatedEvent += value;
+ }
+ remove {
+ componentsCreatedEvent -= value;
+ }
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.ComponentsCreating"]/*' />
+ /// <devdoc>
+ /// <para>Occurs before components are created.</para>
+ /// </devdoc>
+ public event ToolboxComponentsCreatingEventHandler ComponentsCreating {
+ add {
+ componentsCreatingEvent += value;
+ }
+ remove {
+ componentsCreatingEvent -= value;
+ }
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.CheckUnlocked"]/*' />
+ /// <devdoc>
+ /// This method checks that the toolbox item is currently unlocked (read-write) and
+ /// throws an appropriate exception if it isn't.
+ /// </devdoc>
+ protected void CheckUnlocked() {
+ if (Locked) throw new InvalidOperationException(SR.Format(SR.ToolboxItemLocked));
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.CreateComponents"]/*' />
+ /// <devdoc>
+ /// Creates objects from the type contained in this toolbox item.
+ /// </devdoc>
+ public IComponent[] CreateComponents() {
+ return CreateComponents(null);
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.CreateComponents1"]/*' />
+ /// <devdoc>
+ /// Creates objects from the type contained in this toolbox item. If designerHost is non-null
+ /// this will also add them to the designer.
+ /// </devdoc>
+ public IComponent[] CreateComponents(IDesignerHost host) {
+ OnComponentsCreating(new ToolboxComponentsCreatingEventArgs(host));
+ IComponent[] comps = CreateComponentsCore(host, new Hashtable());
+ if (comps != null && comps.Length > 0) {
+ OnComponentsCreated(new ToolboxComponentsCreatedEventArgs(comps));
+ }
+ return comps;
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.CreateComponents2"]/*' />
+ /// <devdoc>
+ /// Creates objects from the type contained in this toolbox item. If designerHost is non-null
+ /// this will also add them to the designer.
+ /// </devdoc>
+ public IComponent[] CreateComponents(IDesignerHost host, IDictionary defaultValues) {
+ OnComponentsCreating(new ToolboxComponentsCreatingEventArgs(host));
+ IComponent[] comps = CreateComponentsCore(host, defaultValues);
+ if (comps != null && comps.Length > 0) {
+ OnComponentsCreated(new ToolboxComponentsCreatedEventArgs(comps));
+ }
+ return comps;
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.CreateComponentsCore"]/*' />
+ /// <devdoc>
+ /// Creates objects from the type contained in this toolbox item. If designerHost is non-null
+ /// this will also add them to the designer.
+ /// </devdoc>
+ protected virtual IComponent[] CreateComponentsCore(IDesignerHost host) {
+ ArrayList comps = new ArrayList();
+
+ Type createType = GetType(host, AssemblyName, TypeName, true);
+ if (createType != null) {
+ if (host != null) {
+ comps.Add(host.CreateComponent(createType));
+ }
+ else if (typeof(IComponent).IsAssignableFrom(createType)) {
+ comps.Add(TypeDescriptor.CreateInstance(null, createType, null, null));
+ }
+ }
+
+ IComponent[] temp = new IComponent[comps.Count];
+ comps.CopyTo(temp, 0);
+ return temp;
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.CreateComponentsCore1"]/*' />
+ /// <devdoc>
+ /// Creates objects from the type contained in this toolbox item. If designerHost is non-null
+ /// this will also add them to the designer.
+ /// </devdoc>
+ protected virtual IComponent[] CreateComponentsCore(IDesignerHost host, IDictionary defaultValues) {
+ IComponent[] components = CreateComponentsCore(host);
+
+ if (host != null) {
+ for (int i = 0; i < components.Length; i++) {
+ IComponentInitializer init = host.GetDesigner(components[i]) as IComponentInitializer;
+ if (init != null) {
+ bool removeComponent = true;
+
+ try {
+ init.InitializeNewComponent(defaultValues);
+ removeComponent = false;
+
+ }
+ finally
+ {
+ if (removeComponent) {
+ for (int index = 0; index < components.Length; index++) {
+ host.DestroyComponent(components[index]);
+ }
+ }
+ }
+
+ }
+ }
+ }
+
+ return components;
+ }
+
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.Deserialize"]/*' />
+ /// <devdoc>
+ /// <para>Loads the state of this <see cref='System.Drawing.Design.ToolboxItem'/>
+ /// from the stream.</para>
+ /// </devdoc>
+ protected virtual void Deserialize(SerializationInfo info, StreamingContext context) {
+
+ // Do this in a couple of passes -- first pass, try to pull
+ // out our dictionary of property names. We need to do this
+ // for backwards compatibilty because if we throw everything
+ // into the property dictionary we'll duplicate stuff people
+ // have serialized by hand.
+
+ string[] propertyNames = null;
+ foreach (SerializationEntry entry in info) {
+ if (entry.Name.Equals("PropertyNames")) {
+ propertyNames = entry.Value as string[];
+ break;
+ }
+ }
+
+ if (propertyNames == null) {
+ // For backwards compat, here are the default property
+ // names we use
+ propertyNames = new string[] {
+ "AssemblyName",
+ "Bitmap",
+ "DisplayName",
+ "Filter",
+ "IsTransient",
+ "TypeName"
+ };
+ }
+
+ foreach (SerializationEntry entry in info) {
+
+ // Check to see if this name is in our
+ // propertyNames array.
+ foreach(string validName in propertyNames) {
+ if (validName.Equals(entry.Name)) {
+ Properties[entry.Name] = entry.Value;
+ break;
+ }
+ }
+ }
+
+ // Always do "Locked" last (otherwise we can't do the others!)
+ bool isLocked = info.GetBoolean("Locked");
+ if (isLocked) {
+ Lock();
+ }
+ }
+
+ /// <devdoc>
+ /// Check if two AssemblyName instances are equivalent
+ /// </devdoc>
+ private static bool AreAssemblyNamesEqual(AssemblyName name1, AssemblyName name2) {
+ return name1 == name2 ||
+ (name1 != null && name2 != null && name1.FullName == name2.FullName);
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.Equals"]/*' />
+ /// <internalonly/>
+ public override bool Equals(object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ if (obj == null) {
+ return false;
+ }
+
+ if (!(obj.GetType() == this.GetType())) {
+ return false;
+ }
+
+ ToolboxItem otherItem = (ToolboxItem)obj;
+
+ return TypeName == otherItem.TypeName &&
+ AreAssemblyNamesEqual(AssemblyName, otherItem.AssemblyName) &&
+ DisplayName == otherItem.DisplayName;
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.GetHashCode"]/*' />
+ /// <internalonly/>
+ public override int GetHashCode() {
+
+ string typeName = TypeName;
+ int hash = (typeName != null) ? typeName.GetHashCode() : 0;
+
+ return unchecked(hash ^ DisplayName.GetHashCode());
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.FilterPropertyValue"]/*' />
+ /// <devdoc>
+ /// Filters a property value before returning it. This allows a property to always clone values,
+ /// or to provide a default value when none exists.
+ /// </devdoc>
+ protected virtual object FilterPropertyValue(string propertyName, object value) {
+ switch (propertyName) {
+ case "AssemblyName":
+ if (value != null) value = ((AssemblyName)value).Clone();
+
+ break;
+
+ case "DisplayName":
+ case "TypeName":
+ if (value == null) value = string.Empty;
+
+ break;
+
+ case "Filter":
+ if (value == null) value = new ToolboxItemFilterAttribute[0];
+
+ break;
+
+ case "IsTransient":
+ if (value == null) value = false;
+
+ break;
+ }
+ return value;
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.GetType1"]/*' />
+ /// <devdoc>
+ /// Allows access to the type associated with the toolbox item.
+ /// The designer host is used to access an implementation of ITypeResolutionService.
+ /// However, the loaded type is not added to the list of references in the designer host.
+ /// </devdoc>
+ public Type GetType(IDesignerHost host) {
+ return GetType(host, AssemblyName, TypeName, false);
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.GetType"]/*' />
+ /// <devdoc>
+ /// This utility function can be used to load a type given a name. AssemblyName and
+ /// designer host can be null, but if they are present they will be used to help
+ /// locate the type. If reference is true, the given assembly name will be added
+ /// to the designer host's set of references.
+ /// </devdoc>
+ [SuppressMessage("Microsoft.Reliability", "CA2001:AvoidCallingProblematicMethods")]
+ [ResourceExposure(ResourceScope.None)]
+ [ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
+ protected virtual Type GetType(IDesignerHost host, AssemblyName assemblyName, string typeName, bool reference) {
+ ITypeResolutionService ts = null;
+ Type type = null;
+
+ if (typeName == null) {
+ throw new ArgumentNullException("typeName");
+ }
+
+ if (host != null) {
+ ts = (ITypeResolutionService)host.GetService(typeof(ITypeResolutionService));
+ }
+
+ if (ts != null) {
+
+ if (reference) {
+ if (assemblyName != null) {
+ ts.ReferenceAssembly(assemblyName);
+ type = ts.GetType(typeName);
+ }
+ else {
+ // Just try loading the type. If we succeed, then use this as the
+ // reference.
+ type = ts.GetType(typeName);
+ if (type == null) {
+ type = Type.GetType(typeName);
+ }
+ if (type != null) {
+ ts.ReferenceAssembly(type.Assembly.GetName());
+ }
+ }
+ }
+ else {
+ if (assemblyName != null) {
+ Assembly a = ts.GetAssembly(assemblyName);
+ if (a != null) {
+ type = a.GetType(typeName);
+ }
+ }
+
+ if (type == null) {
+ type = ts.GetType(typeName);
+ }
+ }
+ }
+ else {
+ if (!String.IsNullOrEmpty(typeName)) {
+ if (assemblyName != null) {
+ Assembly a = null;
+ try {
+ a = Assembly.Load(assemblyName);
+ }
+ catch (FileNotFoundException) {
+ }
+ catch (BadImageFormatException) {
+ }
+ catch (IOException) {
+ }
+
+ if (a == null && assemblyName.CodeBase != null && assemblyName.CodeBase.Length > 0) {
+ try {
+ a = Assembly.LoadFrom(assemblyName.CodeBase);
+ }
+ catch (FileNotFoundException) {
+ }
+ catch (BadImageFormatException) {
+ }
+ catch (IOException) {
+ }
+ }
+
+ if (a != null) {
+ type = a.GetType(typeName);
+ }
+ }
+
+ if (type == null) {
+ type = Type.GetType(typeName, false);
+ }
+ }
+ }
+
+ return type;
+ }
+
+ /// <devdoc>
+ /// Given an assemblyname and type, this method searches referenced assemblies from t.Assembly
+ /// looking for a similar name.
+ /// </devdoc>
+ private AssemblyName GetNonRetargetedAssemblyName(Type type, AssemblyName policiedAssemblyName) {
+ if (type == null || policiedAssemblyName == null)
+ return null;
+
+ //if looking for myself, just return it. (not a reference)
+ if (type.Assembly.FullName == policiedAssemblyName.FullName) {
+ return policiedAssemblyName;
+ }
+
+ //first search for an exact match -- we prefer this over a partial match.
+ foreach (AssemblyName name in type.Assembly.GetReferencedAssemblies()) {
+ if (name.FullName == policiedAssemblyName.FullName)
+ return name;
+ }
+
+ //next search for a partial match -- we just compare the Name portions (ignore version and publickey)
+ foreach (AssemblyName name in type.Assembly.GetReferencedAssemblies()) {
+ if (name.Name == policiedAssemblyName.Name)
+ return name;
+ }
+
+ //finally, the most expensive -- its possible that retargeting policy is on an assembly whose name changes
+ // an example of this is the device System.Windows.Forms.Datagrid.dll
+ // in this case, we need to try to load each device assemblyname through policy to see if it results
+ // in assemblyname.
+ foreach (AssemblyName name in type.Assembly.GetReferencedAssemblies()) {
+ Assembly a = null;
+
+ try {
+ a = Assembly.Load(name);
+ if (a != null && a.FullName == policiedAssemblyName.FullName)
+ return name;
+ }
+ catch {
+ //ignore all exceptions and just fall through if it fails (it shouldn't, but who knows).
+ }
+ }
+
+ return null;
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.Initialize"]/*' />
+ /// <devdoc>
+ /// Initializes a toolbox item with a given type. A locked toolbox item cannot be initialized.
+ /// </devdoc>
+ [ResourceExposure(ResourceScope.Process | ResourceScope.Machine)]
+ [ResourceConsumption(ResourceScope.Process | ResourceScope.Machine)]
+ public virtual void Initialize(Type type) {
+ CheckUnlocked();
+
+ if (type != null) {
+ TypeName = type.FullName;
+ AssemblyName assemblyName = type.Assembly.GetName(true);
+ if (type.Assembly.GlobalAssemblyCache) {
+ assemblyName.CodeBase = null;
+ }
+
+ Dictionary<string, AssemblyName> parents = new Dictionary<string, AssemblyName>();
+ Type parentType = type;
+ while (parentType != null) {
+ AssemblyName policiedname = parentType.Assembly.GetName(true);
+
+ AssemblyName aname = GetNonRetargetedAssemblyName(type, policiedname);
+
+ if (aname != null && !parents.ContainsKey(aname.FullName)) {
+ parents[aname.FullName] = aname;
+ }
+ parentType = parentType.BaseType;
+ }
+
+ AssemblyName[] parentAssemblies = new AssemblyName[parents.Count];
+ int i = 0;
+ foreach(AssemblyName an in parents.Values) {
+ parentAssemblies[i++] = an;
+ }
+
+ this.DependentAssemblies = parentAssemblies;
+
+ AssemblyName = assemblyName;
+ DisplayName = type.Name;
+
+ //if the Type is a reflectonly type, these values must be set through a config object or manually
+ //after construction.
+ if (!type.Assembly.ReflectionOnly) {
+
+ object[] companyattrs = type.Assembly.GetCustomAttributes(typeof(AssemblyCompanyAttribute), true);
+ if (companyattrs != null && companyattrs.Length > 0) {
+ AssemblyCompanyAttribute company = companyattrs[0] as AssemblyCompanyAttribute;
+ if (company != null && company.Company != null) {
+ Company = company.Company;
+ }
+ }
+
+ //set the description based off the description attribute of the given type.
+ DescriptionAttribute descattr = (DescriptionAttribute)TypeDescriptor.GetAttributes(type)[typeof(DescriptionAttribute)];
+ if (descattr != null) {
+ this.Description = descattr.Description;
+ }
+
+ ToolboxBitmapAttribute attr = (ToolboxBitmapAttribute)TypeDescriptor.GetAttributes(type)[typeof(ToolboxBitmapAttribute)];
+ if (attr != null) {
+ Bitmap itemBitmap = attr.GetImage(type, false) as Bitmap;
+ if (itemBitmap != null) {
+ // Original bitmap is used when adding the item to the Visual Studio toolbox
+ // if running on a machine with HDPI scaling enabled.
+ OriginalBitmap = attr.GetOriginalBitmap();
+ if ((itemBitmap.Width != iconWidth || itemBitmap.Height != iconHeight)) {
+ itemBitmap = new Bitmap(itemBitmap, new Size(iconWidth, iconHeight));
+ }
+ }
+ Bitmap = itemBitmap;
+ }
+
+ bool filterContainsType = false;
+ ArrayList array = new ArrayList();
+ foreach (Attribute a in TypeDescriptor.GetAttributes(type)) {
+ ToolboxItemFilterAttribute ta = a as ToolboxItemFilterAttribute;
+ if (ta != null) {
+ if (ta.FilterString.Equals(TypeName)) {
+ filterContainsType = true;
+ }
+ array.Add(ta);
+ }
+ }
+
+ if (!filterContainsType) {
+ array.Add(new ToolboxItemFilterAttribute(TypeName));
+ }
+
+ Filter = (ToolboxItemFilterAttribute[])array.ToArray(typeof(ToolboxItemFilterAttribute));
+ }
+ }
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.Lock"]/*' />
+ /// <devdoc>
+ /// Locks this toolbox item. Locking a toolbox item makes it read-only and
+ /// prevents any changes to its properties.
+ /// </devdoc>
+ public virtual void Lock() {
+ locked = true;
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.OnComponentsCreated"]/*' />
+ /// <devdoc>
+ /// <para>Raises the OnComponentsCreated event. This
+ /// will be called when this <see cref='System.Drawing.Design.ToolboxItem'/> creates a component.</para>
+ /// </devdoc>
+ [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")] //full trust anyway
+ protected virtual void OnComponentsCreated(ToolboxComponentsCreatedEventArgs args) {
+ if (componentsCreatedEvent != null) {
+ componentsCreatedEvent(this, args);
+ }
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.OnComponentsCreating"]/*' />
+ /// <devdoc>
+ /// <para>Raises the OnCreateComponentsInvoked event. This
+ /// will be called before this <see cref='System.Drawing.Design.ToolboxItem'/> creates a component.</para>
+ /// </devdoc>
+ [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")] //full trust anyway
+ protected virtual void OnComponentsCreating(ToolboxComponentsCreatingEventArgs args) {
+ if (componentsCreatingEvent != null) {
+ componentsCreatingEvent(this, args);
+ }
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.Serialize"]/*' />
+ /// <devdoc>
+ /// <para>Saves the state of this <see cref='System.Drawing.Design.ToolboxItem'/> to
+ /// the specified serialization info.</para>
+ /// </devdoc>
+ [SuppressMessage("Microsoft.Performance", "CA1808:AvoidCallsThatBoxValueTypes")]
+ protected virtual void Serialize(SerializationInfo info, StreamingContext context) {
+
+ if (ToolboxItemPersist.TraceVerbose) {
+ Debug.WriteLine("Persisting: " + GetType().Name);
+ Debug.WriteLine("\tDisplay Name: " + DisplayName);
+ }
+
+ info.AddValue("Locked", Locked);
+ ArrayList propertyNames = new ArrayList(Properties.Count);
+ foreach (DictionaryEntry de in Properties) {
+ propertyNames.Add(de.Key);
+ info.AddValue((string)de.Key, de.Value);
+ }
+ info.AddValue("PropertyNames", (string[])propertyNames.ToArray(typeof(string)));
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.ToString"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public override string ToString() {
+ return this.DisplayName;
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.ValidatePropertyType"]/*' />
+ /// <devdoc>
+ /// Called as a helper to ValidatePropertyValue to validate that an object
+ /// is of a given type.
+ /// </devdoc>
+ protected void ValidatePropertyType(string propertyName, object value, Type expectedType, bool allowNull) {
+ if (value == null) {
+ if (!allowNull) {
+ throw new ArgumentNullException("value");
+ }
+ }
+ else {
+ if (!expectedType.IsInstanceOfType(value)) {
+ throw new ArgumentException(SR.Format(SR.ToolboxItemInvalidPropertyType, propertyName, expectedType.FullName), "value");
+ }
+ }
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.ValidatePropertyValue"]/*' />
+ /// <devdoc>
+ /// This is called whenever a value is set in the property dictionary. It gives you a chance
+ /// to change the value of an object before comitting it, our reject it by throwing an
+ /// exception.
+ /// </devdoc>
+ protected virtual object ValidatePropertyValue(string propertyName, object value) {
+ switch (propertyName) {
+ case "AssemblyName":
+ ValidatePropertyType(propertyName, value, typeof(AssemblyName), true);
+ break;
+
+ case "Bitmap":
+ ValidatePropertyType(propertyName, value, typeof(Bitmap), true);
+ break;
+
+ case "OriginalBitmap":
+ ValidatePropertyType(propertyName, value, typeof(Bitmap), true);
+ break;
+
+ case "Company":
+ case "Description":
+ case "DisplayName":
+ case "TypeName":
+ ValidatePropertyType(propertyName, value, typeof(string), true);
+ if (value == null) value = string.Empty;
+
+ break;
+
+ case "Filter":
+ ValidatePropertyType(propertyName, value, typeof(ICollection), true);
+
+ int filterCount = 0;
+ ICollection col = (ICollection)value;
+
+ if (col != null) {
+ foreach (object f in col) {
+ if (f is ToolboxItemFilterAttribute) {
+ filterCount++;
+ }
+ }
+ }
+
+ ToolboxItemFilterAttribute[] filter = new ToolboxItemFilterAttribute[filterCount];
+
+ if (col != null) {
+ filterCount = 0;
+ foreach (object f in col) {
+ ToolboxItemFilterAttribute tfa = f as ToolboxItemFilterAttribute;
+ if (tfa != null) {
+ filter[filterCount++] = tfa;
+ }
+ }
+ }
+
+ value = filter;
+ break;
+
+ case "IsTransient":
+ ValidatePropertyType(propertyName, value, typeof(bool), false);
+ break;
+ }
+ return value;
+ }
+
+ /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.ISerializable.GetObjectData"]/*' />
+ /// <internalonly/>
+ // SECREVIEW NOTE: we do not put the linkdemand that should be here, because the one on the type is a superset of this one
+ [SuppressMessage("Microsoft.Usage", "CA2240:ImplementISerializableCorrectly")]
+ void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) {
+ IntSecurity.UnmanagedCode.Demand();
+ Serialize(info, context);
+ }
+
+ /// <devdoc>
+ /// This is a simple IDictionary that supports locking so
+ /// changing values are not allowed after the toolbox
+ /// item has been locked.
+ /// </devdoc>
+ private class LockableDictionary : Hashtable
+ {
+ private ToolboxItem _item;
+ internal LockableDictionary(ToolboxItem item, int capacity) : base(capacity)
+ {
+ _item = item;
+ }
+
+ public override bool IsFixedSize
+ {
+ get
+ {
+ return _item.Locked;
+ }
+ }
+
+ public override bool IsReadOnly
+ {
+ get
+ {
+ return _item.Locked;
+ }
+ }
+
+ public override object this[object key]
+ {
+ get
+ {
+ string propertyName = GetPropertyName(key);
+ object value = base[propertyName];
+
+ return _item.FilterPropertyValue(propertyName, value);
+ }
+ set
+ {
+ string propertyName = GetPropertyName(key);
+ value = _item.ValidatePropertyValue(propertyName, value);
+ CheckSerializable(value);
+ _item.CheckUnlocked();
+ base[propertyName] = value;
+ }
+ }
+
+ public override void Add(object key, object value)
+ {
+ string propertyName = GetPropertyName(key);
+ value = _item.ValidatePropertyValue(propertyName, value);
+ CheckSerializable(value);
+ _item.CheckUnlocked();
+ base.Add(propertyName, value);
+ }
+
+ private void CheckSerializable(object value) {
+ if (value != null && !value.GetType().IsSerializable) {
+ throw new ArgumentException(SR.Format(SR.ToolboxItemValueNotSerializable, value.GetType().FullName));
+ }
+ }
+
+ public override void Clear()
+ {
+ _item.CheckUnlocked();
+ base.Clear();
+ }
+
+ private string GetPropertyName(object key) {
+ if (key == null) {
+ throw new ArgumentNullException("key");
+ }
+
+ string propertyName = key as string;
+
+ if (propertyName == null || propertyName.Length == 0) {
+ throw new ArgumentException(SR.Format(SR.ToolboxItemInvalidKey), "key");
+ }
+
+ return propertyName;
+ }
+
+ public override void Remove(object key)
+ {
+ _item.CheckUnlocked();
+ base.Remove(key);
+ }
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxItemCollection.cs b/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxItemCollection.cs
new file mode 100644
index 0000000000..3b4412ed1b
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxItemCollection.cs
@@ -0,0 +1,78 @@
+// ------------------------------------------------------------------------------
+// <copyright file="ToolboxItemCollection.cs" company="Microsoft">
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// </copyright>
+// ------------------------------------------------------------------------------
+//
+namespace System.Drawing.Design {
+
+ using System;
+ using System.Collections;
+
+ /// <include file='doc\ToolboxItemCollection.uex' path='docs/doc[@for="ToolboxItemCollection"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A collection that stores <see cref='System.Drawing.Design.ToolboxItem'/> objects.
+ /// </para>
+ /// </devdoc>
+ [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")]
+ public sealed class ToolboxItemCollection : ReadOnlyCollectionBase {
+
+ /// <include file='doc\ToolboxItemCollection.uex' path='docs/doc[@for="ToolboxItemCollection.ToolboxItemCollection"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of <see cref='System.Drawing.Design.ToolboxItemCollection'/> based on another <see cref='System.Drawing.Design.ToolboxItemCollection'/>.
+ /// </para>
+ /// </devdoc>
+ public ToolboxItemCollection(ToolboxItemCollection value) {
+ InnerList.AddRange(value);
+ }
+
+ /// <include file='doc\ToolboxItemCollection.uex' path='docs/doc[@for="ToolboxItemCollection.ToolboxItemCollection1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of <see cref='System.Drawing.Design.ToolboxItemCollection'/> containing any array of <see cref='System.Drawing.Design.ToolboxItem'/> objects.
+ /// </para>
+ /// </devdoc>
+ public ToolboxItemCollection(ToolboxItem[] value) {
+ InnerList.AddRange(value);
+ }
+
+ /// <include file='doc\ToolboxItemCollection.uex' path='docs/doc[@for="ToolboxItemCollection.this"]/*' />
+ /// <devdoc>
+ /// <para>Represents the entry at the specified index of the <see cref='System.Drawing.Design.ToolboxItem'/>.</para>
+ /// </devdoc>
+ public ToolboxItem this[int index] {
+ get {
+ return ((ToolboxItem)(InnerList[index]));
+ }
+ }
+
+ /// <include file='doc\ToolboxItemCollection.uex' path='docs/doc[@for="ToolboxItemCollection.Contains"]/*' />
+ /// <devdoc>
+ /// <para>Gets a value indicating whether the
+ /// <see cref='System.Drawing.Design.ToolboxItemCollection'/> contains the specified <see cref='System.Drawing.Design.ToolboxItem'/>.</para>
+ /// </devdoc>
+ public bool Contains(ToolboxItem value) {
+ return InnerList.Contains(value);
+ }
+
+ /// <include file='doc\ToolboxItemCollection.uex' path='docs/doc[@for="ToolboxItemCollection.CopyTo"]/*' />
+ /// <devdoc>
+ /// <para>Copies the <see cref='System.Drawing.Design.ToolboxItemCollection'/> values to a one-dimensional <see cref='System.Array'/> instance at the
+ /// specified index.</para>
+ /// </devdoc>
+ public void CopyTo(ToolboxItem[] array, int index) {
+ InnerList.CopyTo(array, index);
+ }
+
+ /// <include file='doc\ToolboxItemCollection.uex' path='docs/doc[@for="ToolboxItemCollection.IndexOf"]/*' />
+ /// <devdoc>
+ /// <para>Returns the index of a <see cref='System.Drawing.Design.ToolboxItem'/> in
+ /// the <see cref='System.Drawing.Design.ToolboxItemCollection'/> .</para>
+ /// </devdoc>
+ public int IndexOf(ToolboxItem value) {
+ return InnerList.IndexOf(value);
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxItemCreatorCallback.cs b/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxItemCreatorCallback.cs
new file mode 100644
index 0000000000..077759427e
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxItemCreatorCallback.cs
@@ -0,0 +1,17 @@
+//------------------------------------------------------------------------------
+// <copyright file="ToolboxItemCreatorCallback.cs" company="Microsoft">
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// </copyright>
+//------------------------------------------------------------------------------
+
+/*
+ */
+namespace System.Drawing.Design {
+
+ /// <include file='doc\ToolboxItemCreatorCallback.uex' path='docs/doc[@for="ToolboxItemCreatorCallback"]/*' />
+ /// <devdoc>
+ /// <para> Represents the
+ /// method that will handle the ToolboxItemCreatorCallback event.</para>
+ /// </devdoc>
+ public delegate ToolboxItem ToolboxItemCreatorCallback(object serializedObject, string format);
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Design/UITypeEditor.cs b/src/System.Drawing.Common/src/System/Drawing/Design/UITypeEditor.cs
new file mode 100644
index 0000000000..851291c8a1
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Design/UITypeEditor.cs
@@ -0,0 +1,152 @@
+//------------------------------------------------------------------------------
+// <copyright file="UITypeEditor.cs" company="Microsoft">
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// </copyright>
+//------------------------------------------------------------------------------
+
+/*
+ */
+namespace System.Drawing.Design {
+ using System.Runtime.InteropServices;
+ using System.ComponentModel;
+ using System.Diagnostics;
+ using System.Diagnostics.CodeAnalysis;
+ using System.Collections;
+ using Microsoft.Win32;
+ using System.ComponentModel.Design;
+ using System.Drawing;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+
+ /// <include file='doc\UITypeEditor.uex' path='docs/doc[@for="UITypeEditor"]/*' />
+ /// <devdoc>
+ /// <para>Provides a base class for editors
+ /// that may provide users with a user interface to visually edit
+ /// the values of the supported type or types.</para>
+ /// </devdoc>
+ [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Name="FullTrust")]
+ [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")]
+ public class UITypeEditor {
+
+ /// <include file='doc\UITypeEditor.uex' path='docs/doc[@for="UITypeEditor.UITypeEditor"]/*' />
+ /// <devdoc>
+ /// In this static constructor we provide default UITypeEditors to
+ /// the TypeDescriptor.
+ /// </devdoc>
+ static UITypeEditor() {
+ Hashtable intrinsicEditors = new Hashtable();
+
+ // Our set of intrinsic editors.
+ intrinsicEditors[typeof(DateTime)] = "System.ComponentModel.Design.DateTimeEditor, " + AssemblyRef.SystemDesign;
+ intrinsicEditors[typeof(Array)] = "System.ComponentModel.Design.ArrayEditor, " + AssemblyRef.SystemDesign;
+ intrinsicEditors[typeof(IList)] = "System.ComponentModel.Design.CollectionEditor, " + AssemblyRef.SystemDesign;
+ intrinsicEditors[typeof(ICollection)] = "System.ComponentModel.Design.CollectionEditor, " + AssemblyRef.SystemDesign;
+ intrinsicEditors[typeof(byte[])] = "System.ComponentModel.Design.BinaryEditor, " + AssemblyRef.SystemDesign;
+ intrinsicEditors[typeof(System.IO.Stream)] = "System.ComponentModel.Design.BinaryEditor, " + AssemblyRef.SystemDesign;
+ intrinsicEditors[typeof(string[])] = "System.Windows.Forms.Design.StringArrayEditor, " + AssemblyRef.SystemDesign;
+ intrinsicEditors[typeof(Collection<string>)] = "System.Windows.Forms.Design.StringCollectionEditor, " + AssemblyRef.SystemDesign;
+
+ // Add our intrinsic editors to TypeDescriptor.
+ //
+ TypeDescriptor.AddEditorTable(typeof(UITypeEditor), intrinsicEditors);
+ }
+
+ /// <include file='doc\UITypeEditor.uex' path='docs/doc[@for="UITypeEditor.UITypeEditor1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes
+ /// a new instance of the <see cref='System.Drawing.Design.UITypeEditor'/> class.
+ /// </para>
+ /// </devdoc>
+ public UITypeEditor() {
+ }
+
+ /// <include file='doc\UITypeEditor.uex' path='docs/doc[@for="UITypeEditor.IsDropDownResizable"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Determines if drop-down editors should be resizable by the user.
+ /// </para>
+ /// </devdoc>
+ public virtual bool IsDropDownResizable {
+ get {
+ return false;
+ }
+ }
+
+ /// <include file='doc\UITypeEditor.uex' path='docs/doc[@for="UITypeEditor.EditValue"]/*' />
+ /// <devdoc>
+ /// <para>Edits the specified value using the editor style
+ /// provided by <see cref='System.Drawing.Design.UITypeEditor.GetEditStyle'/>.</para>
+ /// </devdoc>
+ public object EditValue(IServiceProvider provider, object value) {
+ return EditValue(null, provider, value);
+ }
+
+ /// <include file='doc\UITypeEditor.uex' path='docs/doc[@for="UITypeEditor.EditValue1"]/*' />
+ /// <devdoc>
+ /// <para>Edits the specified object's value using the editor style
+ /// provided by <see cref='System.Drawing.Design.UITypeEditor.GetEditStyle'/>.</para>
+ /// </devdoc>
+ public virtual object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) {
+ return value;
+ }
+
+ /// <include file='doc\UITypeEditor.uex' path='docs/doc[@for="UITypeEditor.GetEditStyle"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the <see cref='System.Drawing.Design.UITypeEditorEditStyle'/>
+ /// of the Edit method.
+ /// </para>
+ /// </devdoc>
+ public UITypeEditorEditStyle GetEditStyle() {
+ return GetEditStyle(null);
+ }
+
+ /// <include file='doc\UITypeEditor.uex' path='docs/doc[@for="UITypeEditor.GetPaintValueSupported"]/*' />
+ /// <devdoc>
+ /// <para> Gets a value indicating whether this editor supports painting a representation
+ /// of an object's value.</para>
+ /// </devdoc>
+ public bool GetPaintValueSupported() {
+ return GetPaintValueSupported(null);
+ }
+
+ /// <include file='doc\UITypeEditor.uex' path='docs/doc[@for="UITypeEditor.GetPaintValueSupported1"]/*' />
+ /// <devdoc>
+ /// <para> Gets a value indicating whether the specified context supports painting a representation
+ /// of an object's value.</para>
+ /// </devdoc>
+ public virtual bool GetPaintValueSupported(ITypeDescriptorContext context) {
+ return false;
+ }
+
+ /// <include file='doc\UITypeEditor.uex' path='docs/doc[@for="UITypeEditor.GetEditStyle1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the editing style of the Edit method.
+ /// </para>
+ /// </devdoc>
+ public virtual UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) {
+ return UITypeEditorEditStyle.None;
+ }
+
+ /// <include file='doc\UITypeEditor.uex' path='docs/doc[@for="UITypeEditor.PaintValue"]/*' />
+ /// <devdoc>
+ /// <para>Paints a representative value of the specified object to the
+ /// specified canvas.</para>
+ /// </devdoc>
+ public void PaintValue(object value, Graphics canvas, Rectangle rectangle) {
+ PaintValue(new PaintValueEventArgs(null, value, canvas, rectangle));
+ }
+
+ /// <include file='doc\UITypeEditor.uex' path='docs/doc[@for="UITypeEditor.PaintValue1"]/*' />
+ /// <devdoc>
+ /// <para>Paints a representative value of the specified object to the
+ /// provided canvas.</para>
+ /// </devdoc>
+ [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")]
+ public virtual void PaintValue(PaintValueEventArgs e) {
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Design/UITypeEditorEditStyle.cs b/src/System.Drawing.Common/src/System/Drawing/Design/UITypeEditorEditStyle.cs
new file mode 100644
index 0000000000..49a3f6cd80
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Design/UITypeEditorEditStyle.cs
@@ -0,0 +1,42 @@
+//------------------------------------------------------------------------------
+// <copyright file="UITypeEditorEditStyle.cs" company="Microsoft">
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// </copyright>
+//------------------------------------------------------------------------------
+
+/*
+ */
+namespace System.Drawing.Design {
+
+ using System.Diagnostics;
+ using System.Diagnostics.CodeAnalysis;
+
+ /// <include file='doc\UITypeEditorEditStyle.uex' path='docs/doc[@for="UITypeEditorEditStyle"]/*' />
+ /// <devdoc>
+ /// <para>Specifies identifiers to indicate the style of
+ /// a <see cref='System.Drawing.Design.UITypeEditor'/>.</para>
+ /// </devdoc>
+ [SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue")]
+ public enum UITypeEditorEditStyle {
+ /// <include file='doc\UITypeEditorEditStyle.uex' path='docs/doc[@for="UITypeEditorEditStyle.None"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Indicates no editor style.
+ /// </para>
+ /// </devdoc>
+ None = 1,
+ /// <include file='doc\UITypeEditorEditStyle.uex' path='docs/doc[@for="UITypeEditorEditStyle.Modal"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Indicates a modal editor style.
+ /// </para>
+ /// </devdoc>
+ Modal = 2,
+ /// <include file='doc\UITypeEditorEditStyle.uex' path='docs/doc[@for="UITypeEditorEditStyle.DropDown"]/*' />
+ /// <devdoc>
+ /// <para> Indicates a drop-down editor style.</para>
+ /// </devdoc>
+ DropDown = 3
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Graphics.cs b/src/System.Drawing.Common/src/System/Drawing/Graphics.cs
new file mode 100644
index 0000000000..ea452e132a
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Graphics.cs
@@ -0,0 +1,4915 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.ComponentModel;
+ using System.Diagnostics;
+ using System.Diagnostics.Contracts;
+ using System.Drawing.Drawing2D;
+ using System.Drawing.Imaging;
+ using System.Drawing.Internal;
+ using System.Drawing.Text;
+ using System.Globalization;
+ using System.Runtime.ConstrainedExecution;
+ using System.Runtime.InteropServices;
+ using System.Security.Permissions;
+
+ /**
+ * Represent a graphics drawing context
+ */
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics"]/*' />
+ /// <devdoc>
+ /// Encapsulates a GDI+ drawing surface.
+ /// </devdoc>
+ public sealed class Graphics : MarshalByRefObject, IDisposable, IDeviceContext
+ {
+#if FINALIZATION_WATCH
+ static readonly TraceSwitch GraphicsFinalization = new TraceSwitch("GraphicsFinalization", "Tracks the creation and destruction of finalization");
+ internal static string GetAllocationStack() {
+ if (GraphicsFinalization.TraceVerbose) {
+ return Environment.StackTrace;
+ }
+ else {
+ return "Enabled 'GraphicsFinalization' switch to see stack of allocation";
+ }
+ }
+ private string allocationSite = Graphics.GetAllocationStack();
+#endif
+
+ /// <devdoc>
+ /// The context state previous to the current Graphics context (the head of the stack).
+ /// We don't keep a GraphicsContext for the current context since it is available at any time from GDI+ and
+ /// we don't want to keep track of changes in it.
+ /// </devdoc>
+ private GraphicsContext _previousContext;
+
+ /// <devdoc>
+ /// Object to lock on for static methods.
+
+ private static readonly object s_syncObject = new Object();
+
+ /// <devdoc>
+ /// Handle to native GDI+ graphics object. This object is created on demand.
+ /// </devdoc>
+ private IntPtr _nativeGraphics;
+
+ /// <devdoc>
+ /// Handle to native DC - obtained from the GDI+ graphics object.
+ /// We need to cache it to implement IDeviceContext interface.
+ /// </devdoc>
+ private IntPtr _nativeHdc;
+
+ // Object reference used for printing; it could point to a PrintPreviewGraphics to obtain the VisibleClipBounds, or
+ // a DeviceContext holding a printer DC.
+ private object _printingHelper;
+
+ // GDI+'s preferred HPALETTE.
+ private static IntPtr s_halftonePalette;
+
+ // pointer back to the Image backing a specific graphic object
+ private Image _backingImage;
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImageAbort"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public delegate bool DrawImageAbort(IntPtr callbackdata);
+
+ // Callback for EnumerateMetafile methods. The parameters are:
+
+ // recordType (if >= MinRecordType, it's an EMF+ record)
+ // flags (always 0 for EMF records)
+ // dataSize size of the data, or 0 if no data
+ // data pointer to the data, or NULL if no data (UINT32 aligned)
+ // callbackData pointer to callbackData, if any
+
+ // This method can then call Metafile.PlayRecord to play the
+ // record that was just enumerated. If this method returns
+ // FALSE, the enumeration process is aborted. Otherwise, it continues.
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafileProc"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public delegate bool EnumerateMetafileProc(EmfPlusRecordType recordType,
+ int flags,
+ int dataSize,
+ IntPtr data,
+ PlayRecordCallback callbackData);
+
+
+ /// <devdoc>
+ /// Constructor to initialize this object from a native GDI+ Graphics pointer.
+ /// </devdoc>
+ private Graphics(IntPtr gdipNativeGraphics)
+ {
+ if (gdipNativeGraphics == IntPtr.Zero)
+ {
+ throw new ArgumentNullException("gdipNativeGraphics");
+ }
+ _nativeGraphics = gdipNativeGraphics;
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FromHdc"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Creates a new instance of the <see cref='System.Drawing.Graphics'/> class from the specified
+ /// handle to a device context.
+ /// </para>
+ /// </devdoc>
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public static Graphics FromHdc(IntPtr hdc)
+ {
+ if (hdc == IntPtr.Zero)
+ {
+ throw new ArgumentNullException("hdc");
+ }
+
+ return FromHdcInternal(hdc);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FromHdcInternal"]/*' />
+ [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public static Graphics FromHdcInternal(IntPtr hdc)
+ {
+ Debug.Assert(hdc != IntPtr.Zero, "Must pass in a valid DC");
+ IntPtr nativeGraphics = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateFromHDC(new HandleRef(null, hdc), out nativeGraphics);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return new Graphics(nativeGraphics);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FromHdc1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Creates a new instance of the Graphics class from the specified handle to
+ /// a device context and handle to a device.
+ /// </para>
+ /// </devdoc>
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public static Graphics FromHdc(IntPtr hdc, IntPtr hdevice)
+ {
+ Debug.Assert(hdc != IntPtr.Zero, "Must pass in a valid DC");
+ Debug.Assert(hdevice != IntPtr.Zero, "Must pass in a valid device");
+
+ IntPtr gdipNativeGraphics = IntPtr.Zero;
+ int status = SafeNativeMethods.Gdip.GdipCreateFromHDC2(new HandleRef(null, hdc), new HandleRef(null, hdevice), out gdipNativeGraphics);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return new Graphics(gdipNativeGraphics);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FromHwnd"]/*' />
+ /// <devdoc>
+ /// Creates a new instance of the <see cref='System.Drawing.Graphics'/> class
+ /// from a window handle.
+ /// </devdoc>
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public static Graphics FromHwnd(IntPtr hwnd)
+ {
+ return FromHwndInternal(hwnd);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FromHwndInternal"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public static Graphics FromHwndInternal(IntPtr hwnd)
+ {
+ IntPtr nativeGraphics = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateFromHWND(new HandleRef(null, hwnd), out nativeGraphics);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return new Graphics(nativeGraphics);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FromImage"]/*' />
+ /// <devdoc>
+ /// Creates an instance of the <see cref='System.Drawing.Graphics'/> class
+ /// from an existing <see cref='System.Drawing.Image'/>.
+ /// </devdoc>
+ public static Graphics FromImage(Image image)
+ {
+ if (image == null)
+ throw new ArgumentNullException("image");
+
+ if ((image.PixelFormat & PixelFormat.Indexed) != 0)
+ {
+ throw new Exception(SR.Format(SR.GdiplusCannotCreateGraphicsFromIndexedPixelFormat));
+ }
+ Contract.Ensures(Contract.Result<Graphics>() != null);
+
+ IntPtr gdipNativeGraphics = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipGetImageGraphicsContext(new HandleRef(image, image.nativeImage),
+ out gdipNativeGraphics);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ Graphics result = new Graphics(gdipNativeGraphics);
+ result._backingImage = image;
+ return result;
+ }
+
+
+ /// <devdoc>
+ /// Gets the GDI+ native graphics pointer.
+ /// </devdoc>
+ internal IntPtr NativeGraphics
+ {
+ get
+ {
+ Debug.Assert(_nativeGraphics != IntPtr.Zero, "NativeGraphics == IntPtr.Zero.");
+ return _nativeGraphics;
+ }
+ }
+
+ /// <devdoc>
+ /// Implementation of IDeviceContext.GetHdc().
+ /// </devdoc>
+ [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
+ public IntPtr GetHdc()
+ {
+ IntPtr hdc = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipGetDC(new HandleRef(this, NativeGraphics), out hdc);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ _nativeHdc = hdc; // need to cache the hdc to be able to release with a call to IDeviceContext.ReleaseHdc().
+
+ return _nativeHdc;
+ }
+
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.ReleaseHdc"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Releases the memory allocated for the handle to a device context.
+ /// </para>
+ /// </devdoc>
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public void ReleaseHdc(IntPtr hdc)
+ {
+ ReleaseHdcInternal(hdc);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.ReleaseHdc1"]/*' />
+ /// <devdoc>
+ /// Implementation of IDeviceContext.ReleaseHdc().
+ /// </devdoc>
+ [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
+ public void ReleaseHdc()
+ {
+ ReleaseHdcInternal(_nativeHdc);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.ReleaseHdcInternal"]/*' />
+ /// <devdoc>
+ /// This method is public but is meant to be used by the .Net Framework only.
+ /// From MSDN: Internal method. Do not use.
+ /// </devdoc>
+ [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void ReleaseHdcInternal(IntPtr hdc)
+ {
+ Debug.Assert(hdc == _nativeHdc, "Invalid hdc.");
+
+
+ int status = SafeNativeMethods.Gdip.GdipReleaseDC(new HandleRef(this, NativeGraphics), new HandleRef(null, hdc));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ _nativeHdc = IntPtr.Zero;
+ }
+
+ /**
+ * Dispose of resources associated with the graphics context
+ *
+ * @notes How do we set up delegates to notice others
+ * when a Graphics object is disposed.
+ */
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.Dispose"]/*' />
+ /// <devdoc>
+ /// Deletes this <see cref='System.Drawing.Graphics'/>, and
+ /// frees the memory allocated for it.
+ /// </devdoc>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.Dispose2"]/*' />
+ private void Dispose(bool disposing)
+ {
+#if DEBUG
+ if (!disposing && _nativeGraphics != IntPtr.Zero)
+ {
+ // Recompile commonUI\\system\\Drawing\\Graphics.cs with FINALIZATION_WATCH on to find who allocated it.
+#if FINALIZATION_WATCH
+ //Debug.Fail("Graphics object Disposed through finalization:\n" + allocationSite);
+ Debug.WriteLine("System.Drawing.Graphics: ***************************************************");
+ Debug.WriteLine("System.Drawing.Graphics: Object Disposed through finalization:\n" + allocationSite);
+#else
+ //Debug.Fail("A Graphics object was not Dispose()'d. Please make sure it's not your code that should be calling Dispose().");
+#endif
+ }
+#endif
+ while (_previousContext != null)
+ {
+ // Dispose entire stack.
+ GraphicsContext context = _previousContext.Previous;
+ _previousContext.Dispose();
+ _previousContext = context;
+ }
+
+ if (_nativeGraphics != IntPtr.Zero)
+ {
+ try
+ {
+ if (_nativeHdc != IntPtr.Zero) // avoid a handle leak.
+ {
+ ReleaseHdc();
+ }
+
+ if (PrintingHelper != null)
+ {
+ DeviceContext printerDC = PrintingHelper as DeviceContext;
+
+ if (printerDC != null)
+ {
+ printerDC.Dispose();
+ _printingHelper = null;
+ }
+ }
+
+#if DEBUG
+ int status =
+#endif
+ SafeNativeMethods.Gdip.GdipDeleteGraphics(new HandleRef(this, _nativeGraphics));
+
+#if DEBUG
+ Debug.Assert(status == SafeNativeMethods.Gdip.Ok, "GDI+ returned an error status: " + status.ToString(CultureInfo.InvariantCulture));
+#endif
+ }
+ catch (Exception ex) // do not allow exceptions to propagate during disposing.
+ {
+ if (ClientUtils.IsSecurityOrCriticalException(ex))
+ {
+ throw;
+ }
+ Debug.Fail("Exception thrown during disposing: \r\n" + ex.ToString());
+ }
+ finally
+ {
+ _nativeGraphics = IntPtr.Zero;
+ }
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.Finalize"]/*' />
+ /// <devdoc>
+ /// Deletes this <see cref='System.Drawing.Graphics'/>, and
+ /// frees the memory allocated for it.
+ /// </devdoc>
+ ~Graphics()
+ {
+ Dispose(false);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.Flush"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Forces immediate execution of all operations currently on the stack.
+ /// </para>
+ /// </devdoc>
+ public void Flush()
+ {
+ Flush(FlushIntention.Flush);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.Flush1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Forces execution of all operations currently on the stack.
+ /// </para>
+ /// </devdoc>
+ public void Flush(FlushIntention intention)
+ {
+ int status = SafeNativeMethods.Gdip.GdipFlush(new HandleRef(this, NativeGraphics), intention);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+
+ /*
+ * Methods for setting/getting:
+ * compositing mode
+ * rendering quality hint
+ *
+ * @notes We should probably separate rendering hints
+ * into several categories, e.g. antialiasing, image
+ * filtering, etc.
+ */
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.CompositingMode"]/*' />
+ /// <devdoc>
+ /// Gets or sets the <see cref='System.Drawing.Drawing2D.CompositingMode'/> associated with this <see cref='System.Drawing.Graphics'/>.
+ /// </devdoc>
+ public CompositingMode CompositingMode
+ {
+ get
+ {
+ int mode = 0;
+
+ int status = SafeNativeMethods.Gdip.GdipGetCompositingMode(new HandleRef(this, NativeGraphics), out mode);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return (CompositingMode)mode;
+ }
+ set
+ {
+ //validate the enum value
+ //valid values are 0x0 to 0x1
+ if (!ClientUtils.IsEnumValid(value, unchecked((int)value), (int)CompositingMode.SourceOver, (int)CompositingMode.SourceCopy))
+ {
+ throw new InvalidEnumArgumentException("value", unchecked((int)value), typeof(CompositingMode));
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipSetCompositingMode(new HandleRef(this, NativeGraphics), unchecked((int)value));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.RenderingOrigin"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public Point RenderingOrigin
+ {
+ get
+ {
+ int x, y;
+
+ int status = SafeNativeMethods.Gdip.GdipGetRenderingOrigin(new HandleRef(this, NativeGraphics), out x, out y);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return new Point(x, y);
+ }
+ set
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetRenderingOrigin(new HandleRef(this, NativeGraphics), value.X, value.Y);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.CompositingQuality"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public CompositingQuality CompositingQuality
+ {
+ get
+ {
+ CompositingQuality cq;
+
+ int status = SafeNativeMethods.Gdip.GdipGetCompositingQuality(new HandleRef(this, NativeGraphics), out cq);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return cq;
+ }
+ set
+ {
+ //valid values are 0xffffffff to 0x4
+ if (!ClientUtils.IsEnumValid(value, unchecked((int)value), unchecked((int)CompositingQuality.Invalid), unchecked((int)CompositingQuality.AssumeLinear)))
+ {
+ throw new InvalidEnumArgumentException("value", unchecked((int)value), typeof(CompositingQuality));
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipSetCompositingQuality(new HandleRef(this, NativeGraphics),
+ value);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.TextRenderingHint"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets the rendering mode for text associated with
+ /// this <see cref='System.Drawing.Graphics'/>
+ /// .
+ /// </para>
+ /// </devdoc>
+ public TextRenderingHint TextRenderingHint
+ {
+ get
+ {
+ TextRenderingHint hint = 0;
+
+ int status = SafeNativeMethods.Gdip.GdipGetTextRenderingHint(new HandleRef(this, NativeGraphics), out hint);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return hint;
+ }
+ set
+ {
+ //valid values are 0x0 to 0x5
+ if (!ClientUtils.IsEnumValid(value, unchecked((int)value), (int)TextRenderingHint.SystemDefault, unchecked((int)TextRenderingHint.ClearTypeGridFit)))
+ {
+ throw new InvalidEnumArgumentException("value", unchecked((int)value), typeof(TextRenderingHint));
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipSetTextRenderingHint(new HandleRef(this, NativeGraphics), value);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.TextContrast"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public int TextContrast
+ {
+ get
+ {
+ int tgv = 0;
+
+ int status = SafeNativeMethods.Gdip.GdipGetTextContrast(new HandleRef(this, NativeGraphics), out tgv);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return tgv;
+ }
+ set
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetTextContrast(new HandleRef(this, NativeGraphics), value);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.SmoothingMode"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public SmoothingMode SmoothingMode
+ {
+ get
+ {
+ SmoothingMode mode = 0;
+
+ int status = SafeNativeMethods.Gdip.GdipGetSmoothingMode(new HandleRef(this, NativeGraphics), out mode);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return mode;
+ }
+ set
+ {
+ //valid values are 0xffffffff to 0x4
+ if (!ClientUtils.IsEnumValid(value, unchecked((int)value), unchecked((int)SmoothingMode.Invalid), unchecked((int)SmoothingMode.AntiAlias)))
+ {
+ throw new InvalidEnumArgumentException("value", unchecked((int)value), typeof(SmoothingMode));
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipSetSmoothingMode(new HandleRef(this, NativeGraphics), value);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.PixelOffsetMode"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public PixelOffsetMode PixelOffsetMode
+ {
+ get
+ {
+ PixelOffsetMode mode = 0;
+
+ int status = SafeNativeMethods.Gdip.GdipGetPixelOffsetMode(new HandleRef(this, NativeGraphics), out mode);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return mode;
+ }
+ set
+ {
+ //valid values are 0xffffffff to 0x4
+ if (!ClientUtils.IsEnumValid(value, unchecked((int)value), unchecked((int)PixelOffsetMode.Invalid), unchecked((int)PixelOffsetMode.Half)))
+ {
+ throw new InvalidEnumArgumentException("value", unchecked((int)value), typeof(PixelOffsetMode));
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipSetPixelOffsetMode(new HandleRef(this, NativeGraphics), value);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+ }
+
+ /// <devdoc>
+ /// Represents an object used in conection with the printing API, it is used to hold a reference to a PrintPreviewGraphics (fake graphics)
+ /// or a printer DeviceContext (and maybe more in the future).
+ /// </devdoc>
+ internal object PrintingHelper
+ {
+ get
+ {
+ return _printingHelper;
+ }
+ set
+ {
+ Debug.Assert(_printingHelper == null, "WARNING: Overwritting the printing helper reference!");
+ _printingHelper = value;
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.InterpolationMode"]/*' />
+ /// <devdoc>
+ /// Gets or sets the interpolation mode
+ /// associated with this Graphics.
+ /// </devdoc>
+ public InterpolationMode InterpolationMode
+ {
+ get
+ {
+ int mode = 0;
+
+ int status = SafeNativeMethods.Gdip.GdipGetInterpolationMode(new HandleRef(this, NativeGraphics), out mode);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return (InterpolationMode)mode;
+ }
+ set
+ {
+ //validate the enum value
+ //valid values are 0xffffffff to 0x7
+ if (!ClientUtils.IsEnumValid(value, unchecked((int)value), unchecked((int)InterpolationMode.Invalid), unchecked((int)InterpolationMode.HighQualityBicubic)))
+ {
+ throw new InvalidEnumArgumentException("value", unchecked((int)value), typeof(InterpolationMode));
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipSetInterpolationMode(new HandleRef(this, NativeGraphics), unchecked((int)value));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+ }
+
+ /**
+ * Return the current world transform
+ */
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.Transform"]/*' />
+ /// <devdoc>
+ /// Gets or sets the world transform
+ /// for this <see cref='System.Drawing.Graphics'/>.
+ /// </devdoc>
+ public Matrix Transform
+ {
+ get
+ {
+ Matrix matrix = new Matrix();
+
+ int status = SafeNativeMethods.Gdip.GdipGetWorldTransform(new HandleRef(this, NativeGraphics),
+ new HandleRef(matrix, matrix.nativeMatrix));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return matrix;
+ }
+ set
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetWorldTransform(new HandleRef(this, NativeGraphics),
+ new HandleRef(value, value.nativeMatrix));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+ }
+
+
+ /**
+ * Retrieve the current page transform information
+ * notes @ these are atomic
+ */
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.PageUnit"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public GraphicsUnit PageUnit
+ {
+ get
+ {
+ int unit = 0;
+
+ int status = SafeNativeMethods.Gdip.GdipGetPageUnit(new HandleRef(this, NativeGraphics), out unit);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return (GraphicsUnit)unit;
+ }
+ set
+ {
+ //valid values are 0x0 to 0x6
+ if (!ClientUtils.IsEnumValid(value, unchecked((int)value), (int)GraphicsUnit.World, (int)GraphicsUnit.Millimeter))
+ {
+ throw new InvalidEnumArgumentException("value", unchecked((int)value), typeof(GraphicsUnit));
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipSetPageUnit(new HandleRef(this, NativeGraphics), unchecked((int)value));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.PageScale"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public float PageScale
+ {
+ get
+ {
+ float[] scale = new float[] { 0.0f };
+
+ int status = SafeNativeMethods.Gdip.GdipGetPageScale(new HandleRef(this, NativeGraphics), scale);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return scale[0];
+ }
+
+ set
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetPageScale(new HandleRef(this, NativeGraphics), value);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DpiX"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public float DpiX
+ {
+ get
+ {
+ float[] dpi = new float[] { 0.0f };
+
+ int status = SafeNativeMethods.Gdip.GdipGetDpiX(new HandleRef(this, NativeGraphics), dpi);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return dpi[0];
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DpiY"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public float DpiY
+ {
+ get
+ {
+ float[] dpi = new float[] { 0.0f };
+
+ int status = SafeNativeMethods.Gdip.GdipGetDpiY(new HandleRef(this, NativeGraphics), dpi);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return dpi[0];
+ }
+ }
+
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.CopyFromScreen"]/*' />
+ /// <devdoc>
+ /// CopyPixels will perform a gdi "bitblt" operation to the source from the destination
+ /// with the given size.
+ /// </devdoc>
+ public void CopyFromScreen(Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize)
+ {
+ CopyFromScreen(upperLeftSource.X, upperLeftSource.Y, upperLeftDestination.X, upperLeftDestination.Y, blockRegionSize);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.CopyFromScreen1"]/*' />
+ /// <devdoc>
+ /// CopyPixels will perform a gdi "bitblt" operation to the source from the destination
+ /// with the given size.
+ /// </devdoc>
+ public void CopyFromScreen(int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize)
+ {
+ CopyFromScreen(sourceX, sourceY, destinationX, destinationY, blockRegionSize, CopyPixelOperation.SourceCopy);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.CopyFromScreen2"]/*' />
+ /// <devdoc>
+ /// CopyPixels will perform a gdi "bitblt" operation to the source from the destination
+ /// with the given size and specified raster operation.
+ /// </devdoc>
+ public void CopyFromScreen(Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
+ {
+ CopyFromScreen(upperLeftSource.X, upperLeftSource.Y, upperLeftDestination.X, upperLeftDestination.Y, blockRegionSize, copyPixelOperation);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.CopyFromScreen3"]/*' />
+ /// <devdoc>
+ /// CopyPixels will perform a gdi "bitblt" operation to the source from the destination
+ /// with the given size and specified raster operation.
+ /// </devdoc>
+ public void CopyFromScreen(int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
+ {
+ switch (copyPixelOperation)
+ {
+ case CopyPixelOperation.Blackness:
+ case CopyPixelOperation.NotSourceErase:
+ case CopyPixelOperation.NotSourceCopy:
+ case CopyPixelOperation.SourceErase:
+ case CopyPixelOperation.DestinationInvert:
+ case CopyPixelOperation.PatInvert:
+ case CopyPixelOperation.SourceInvert:
+ case CopyPixelOperation.SourceAnd:
+ case CopyPixelOperation.MergePaint:
+ case CopyPixelOperation.MergeCopy:
+ case CopyPixelOperation.SourceCopy:
+ case CopyPixelOperation.SourcePaint:
+ case CopyPixelOperation.PatCopy:
+ case CopyPixelOperation.PatPaint:
+ case CopyPixelOperation.Whiteness:
+ case CopyPixelOperation.CaptureBlt:
+ case CopyPixelOperation.NoMirrorBitmap:
+ break;
+ default:
+ throw new InvalidEnumArgumentException("value", unchecked((int)copyPixelOperation), typeof(CopyPixelOperation));
+ }
+
+ int destWidth = blockRegionSize.Width;
+ int destHeight = blockRegionSize.Height;
+
+ using (DeviceContext dc = DeviceContext.FromHwnd(IntPtr.Zero))
+ { // screen DC
+ HandleRef screenDC = new HandleRef(null, dc.Hdc);
+ HandleRef targetDC = new HandleRef(null, GetHdc()); // this DC
+
+ try
+ {
+ int result = SafeNativeMethods.BitBlt(targetDC, destinationX, destinationY, destWidth, destHeight,
+ screenDC, sourceX, sourceY, unchecked((int)copyPixelOperation));
+
+ //a zero result indicates a win32 exception has been thrown
+ if (result == 0)
+ {
+ throw new Win32Exception();
+ }
+ }
+ finally
+ {
+ ReleaseHdc();
+ }
+ }
+ }
+
+ /*
+ * Manipulate the current transform
+ *
+ * @notes For get methods, we return copies of our internal objects.
+ * For set methods, we make copies of the objects passed in.
+ */
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.ResetTransform"]/*' />
+ /// <devdoc>
+ /// Resets the world transform to identity.
+ /// </devdoc>
+ public void ResetTransform()
+ {
+ int status = SafeNativeMethods.Gdip.GdipResetWorldTransform(new HandleRef(this, NativeGraphics));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.MultiplyTransform"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Multiplies the <see cref='System.Drawing.Drawing2D.Matrix'/> that
+ /// represents the world transform and <paramref term="matrix"/>.
+ /// </para>
+ /// </devdoc>
+ public void MultiplyTransform(Matrix matrix)
+ {
+ MultiplyTransform(matrix, MatrixOrder.Prepend);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.MultiplyTransform1"]/*' />
+ /// <devdoc>
+ /// Multiplies the <see cref='System.Drawing.Drawing2D.Matrix'/> that
+ /// represents the world transform and <paramref term="matrix"/>.
+ /// </devdoc>
+ public void MultiplyTransform(Matrix matrix, MatrixOrder order)
+ {
+ if (matrix == null)
+ {
+ throw new ArgumentNullException("matrix");
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipMultiplyWorldTransform(new HandleRef(this, NativeGraphics),
+ new HandleRef(matrix, matrix.nativeMatrix),
+ order);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.TranslateTransform"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void TranslateTransform(float dx, float dy)
+ {
+ TranslateTransform(dx, dy, MatrixOrder.Prepend);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.TranslateTransform1"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void TranslateTransform(float dx, float dy, MatrixOrder order)
+ {
+ int status = SafeNativeMethods.Gdip.GdipTranslateWorldTransform(new HandleRef(this, NativeGraphics), dx, dy, order);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ // can be called during the creation of NativeGraphics
+ /*private void TranslateTransform(float dx, float dy, MatrixOrder order, IntPtr nativeGraphics) {
+ int status = SafeNativeMethods.Gdip.GdipTranslateWorldTransform(new HandleRef(this, nativeGraphics), dx, dy, order);
+
+ if (status != SafeNativeMethods.Gdip.Ok) {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }*/
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.ScaleTransform"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void ScaleTransform(float sx, float sy)
+ {
+ ScaleTransform(sx, sy, MatrixOrder.Prepend);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.ScaleTransform1"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void ScaleTransform(float sx, float sy, MatrixOrder order)
+ {
+ int status = SafeNativeMethods.Gdip.GdipScaleWorldTransform(new HandleRef(this, NativeGraphics), sx, sy, order);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.RotateTransform"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void RotateTransform(float angle)
+ {
+ RotateTransform(angle, MatrixOrder.Prepend);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.RotateTransform1"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void RotateTransform(float angle, MatrixOrder order)
+ {
+ int status = SafeNativeMethods.Gdip.GdipRotateWorldTransform(new HandleRef(this, NativeGraphics), angle, order);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /*
+ * Transform points in the current graphics context
+ */
+ // float version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.TransformPoints"]/*' />
+ /// <devdoc>
+ /// </devdoc
+ public void TransformPoints(CoordinateSpace destSpace,
+ CoordinateSpace srcSpace,
+ PointF[] pts)
+ {
+ if (pts == null)
+ {
+ throw new ArgumentNullException("pts");
+ }
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(pts);
+ int status = SafeNativeMethods.Gdip.GdipTransformPoints(new HandleRef(this, NativeGraphics), unchecked((int)destSpace),
+ unchecked((int)srcSpace), buf, pts.Length);
+
+ try
+ {
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ // must do an in-place copy because we only have a reference
+ PointF[] newPts = SafeNativeMethods.Gdip.ConvertGPPOINTFArrayF(buf, pts.Length);
+
+ for (int i = 0; i < pts.Length; i++)
+ {
+ pts[i] = newPts[i];
+ }
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ // int version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.TransformPoints1"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void TransformPoints(CoordinateSpace destSpace,
+ CoordinateSpace srcSpace,
+ Point[] pts)
+ {
+ if (pts == null)
+ {
+ throw new ArgumentNullException("pts");
+ }
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(pts);
+ int status = SafeNativeMethods.Gdip.GdipTransformPointsI(new HandleRef(this, NativeGraphics), unchecked((int)destSpace),
+ unchecked((int)srcSpace), buf, pts.Length);
+
+ try
+ {
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ Point[] newPts = SafeNativeMethods.Gdip.ConvertGPPOINTArray(buf, pts.Length);
+
+ for (int i = 0; i < pts.Length; i++)
+ {
+ pts[i] = newPts[i];
+ }
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.GetNearestColor"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public Color GetNearestColor(Color color)
+ {
+ int nearest = color.ToArgb();
+
+ int status = SafeNativeMethods.Gdip.GdipGetNearestColor(new HandleRef(this, NativeGraphics), ref nearest);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return Color.FromArgb(nearest);
+ }
+
+ /*
+ * Vector drawing methods
+ *
+ * @notes Do we need a set of methods that take
+ * integer coordinate parameters?
+ */
+
+ // float version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawLine"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws a line connecting the two
+ /// specified points.
+ /// </para>
+ /// </devdoc>
+ public void DrawLine(Pen pen, float x1, float y1, float x2, float y2)
+ {
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+
+ int status = SafeNativeMethods.Gdip.GdipDrawLine(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen), x1, y1, x2, y2);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawLine1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws a line connecting the two
+ /// specified points.
+ /// </para>
+ /// </devdoc>
+ public void DrawLine(Pen pen, PointF pt1, PointF pt2)
+ {
+ DrawLine(pen, pt1.X, pt1.Y, pt2.X, pt2.Y);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawLines"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws a series of line segments that
+ /// connect an array of points.
+ /// </para>
+ /// </devdoc>
+ public void DrawLines(Pen pen, PointF[] points)
+ {
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ int status = SafeNativeMethods.Gdip.GdipDrawLines(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen),
+ new HandleRef(this, buf), points.Length);
+
+ Marshal.FreeHGlobal(buf);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+
+ // int version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawLine2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws a line connecting the two
+ /// specified points.
+ /// </para>
+ /// </devdoc>
+ public void DrawLine(Pen pen, int x1, int y1, int x2, int y2)
+ {
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+
+ int status = SafeNativeMethods.Gdip.GdipDrawLineI(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen), x1, y1, x2, y2);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawLine3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws a line connecting the two
+ /// specified points.
+ /// </para>
+ /// </devdoc>
+ public void DrawLine(Pen pen, Point pt1, Point pt2)
+ {
+ DrawLine(pen, pt1.X, pt1.Y, pt2.X, pt2.Y);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawLines1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws a series of line segments that connect an array of
+ /// points.
+ /// </para>
+ /// </devdoc>
+ public void DrawLines(Pen pen, Point[] points)
+ {
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ int status = SafeNativeMethods.Gdip.GdipDrawLinesI(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen),
+ new HandleRef(this, buf), points.Length);
+
+ Marshal.FreeHGlobal(buf);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // float version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawArc"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws an arc from the specified ellipse.
+ /// </para>
+ /// </devdoc>
+ public void DrawArc(Pen pen, float x, float y, float width, float height,
+ float startAngle, float sweepAngle)
+ {
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+
+ int status = SafeNativeMethods.Gdip.GdipDrawArc(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen), x, y,
+ width, height, startAngle, sweepAngle);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawArc1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws an arc from the specified
+ /// ellipse.
+ /// </para>
+ /// </devdoc>
+ public void DrawArc(Pen pen, RectangleF rect, float startAngle, float sweepAngle)
+ {
+ DrawArc(pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
+ }
+
+ // int version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawArc2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws an arc from the specified ellipse.
+ /// </para>
+ /// </devdoc>
+ public void DrawArc(Pen pen, int x, int y, int width, int height,
+ int startAngle, int sweepAngle)
+ {
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+
+ int status = SafeNativeMethods.Gdip.GdipDrawArcI(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen), x, y,
+ width, height, startAngle, sweepAngle);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawArc3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws an arc from the specified ellipse.
+ /// </para>
+ /// </devdoc>
+ public void DrawArc(Pen pen, Rectangle rect, float startAngle, float sweepAngle)
+ {
+ DrawArc(pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawBezier"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws a cubic bezier curve defined by
+ /// four ordered pairs that represent points.
+ /// </para>
+ /// </devdoc>
+ public void DrawBezier(Pen pen, float x1, float y1, float x2, float y2,
+ float x3, float y3, float x4, float y4)
+ {
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+
+ int status = SafeNativeMethods.Gdip.GdipDrawBezier(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen), x1, y1,
+ x2, y2, x3, y3, x4, y4);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // float version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawBezier1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws a cubic bezier curve defined by
+ /// four points.
+ /// </para>
+ /// </devdoc>
+ public void DrawBezier(Pen pen, PointF pt1, PointF pt2, PointF pt3, PointF pt4)
+ {
+ DrawBezier(pen, pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawBeziers"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws a series of cubic Bezier curves
+ /// from an array of points.
+ /// </para>
+ /// </devdoc>
+ public void DrawBeziers(Pen pen, PointF[] points)
+ {
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ int status = SafeNativeMethods.Gdip.GdipDrawBeziers(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen),
+ new HandleRef(this, buf), points.Length);
+
+ Marshal.FreeHGlobal(buf);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // int version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawBezier2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws a cubic bezier curve defined by four points.
+ /// </para>
+ /// </devdoc>
+ public void DrawBezier(Pen pen, Point pt1, Point pt2, Point pt3, Point pt4)
+ {
+ DrawBezier(pen, pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawBeziers1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws a series of cubic Bezier curves from an array of
+ /// points.
+ /// </para>
+ /// </devdoc>
+ public void DrawBeziers(Pen pen, Point[] points)
+ {
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ int status = SafeNativeMethods.Gdip.GdipDrawBeziersI(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen),
+ new HandleRef(this, buf), points.Length);
+ Marshal.FreeHGlobal(buf);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawRectangle"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws the outline of a rectangle specified by
+ /// <paramref term="rect"/>.
+ /// </para>
+ /// </devdoc>
+ public void DrawRectangle(Pen pen, Rectangle rect)
+ {
+ DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height);
+ }
+
+ // float version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawRectangle1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws the outline of the specified
+ /// rectangle.
+ /// </para>
+ /// </devdoc>
+ public void DrawRectangle(Pen pen, float x, float y, float width, float height)
+ {
+ if (pen == null)
+ {
+ throw new ArgumentNullException("pen");
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipDrawRectangle(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen), x, y,
+ width, height);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // int version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawRectangle2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws the outline of the specified rectangle.
+ /// </para>
+ /// </devdoc>
+ public void DrawRectangle(Pen pen, int x, int y, int width, int height)
+ {
+ if (pen == null)
+ {
+ throw new ArgumentNullException("pen");
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipDrawRectangleI(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen), x, y, width, height);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawRectangles"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws the outlines of a series of
+ /// rectangles.
+ /// </para>
+ /// </devdoc>
+ public void DrawRectangles(Pen pen, RectangleF[] rects)
+ {
+ if (pen == null)
+ {
+ throw new ArgumentNullException("pen");
+ }
+ if (rects == null)
+ {
+ throw new ArgumentNullException("rects");
+ }
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertRectangleToMemory(rects);
+ int status = SafeNativeMethods.Gdip.GdipDrawRectangles(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen),
+ new HandleRef(this, buf), rects.Length);
+
+ Marshal.FreeHGlobal(buf);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawRectangles1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws the outlines of a series of rectangles.
+ /// </para>
+ /// </devdoc>
+ public void DrawRectangles(Pen pen, Rectangle[] rects)
+ {
+ if (pen == null)
+ {
+ throw new ArgumentNullException("pen");
+ }
+ if (rects == null)
+ {
+ throw new ArgumentNullException("rects");
+ }
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertRectangleToMemory(rects);
+ int status = SafeNativeMethods.Gdip.GdipDrawRectanglesI(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen),
+ new HandleRef(this, buf), rects.Length);
+
+ Marshal.FreeHGlobal(buf);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // float version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawEllipse"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws the outline of an
+ /// ellipse defined by a bounding rectangle.
+ /// </para>
+ /// </devdoc>
+ public void DrawEllipse(Pen pen, RectangleF rect)
+ {
+ DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawEllipse1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws the outline of an
+ /// ellipse defined by a bounding rectangle.
+ /// </para>
+ /// </devdoc>
+ public void DrawEllipse(Pen pen, float x, float y, float width, float height)
+ {
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+
+ int status = SafeNativeMethods.Gdip.GdipDrawEllipse(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen), x, y,
+ width, height);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // int version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawEllipse2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws the outline of an ellipse specified by a bounding
+ /// rectangle.
+ /// </para>
+ /// </devdoc>
+ public void DrawEllipse(Pen pen, Rectangle rect)
+ {
+ DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawEllipse3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws the outline of an ellipse defined by a bounding rectangle.
+ /// </para>
+ /// </devdoc>
+ public void DrawEllipse(Pen pen, int x, int y, int width, int height)
+ {
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+
+ int status = SafeNativeMethods.Gdip.GdipDrawEllipseI(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen), x, y,
+ width, height);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // float version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawPie"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws the outline of a pie section
+ /// defined by an ellipse and two radial lines.
+ /// </para>
+ /// </devdoc>
+ public void DrawPie(Pen pen, RectangleF rect, float startAngle, float sweepAngle)
+ {
+ DrawPie(pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle,
+ sweepAngle);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawPie1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws the outline of a pie section
+ /// defined by an ellipse and two radial lines.
+ /// </para>
+ /// </devdoc>
+ public void DrawPie(Pen pen, float x, float y, float width,
+ float height, float startAngle, float sweepAngle)
+ {
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+
+ int status = SafeNativeMethods.Gdip.GdipDrawPie(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen), x, y, width,
+ height, startAngle, sweepAngle);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // int version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawPie2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws the outline of a pie section defined by an ellipse
+ /// and two radial lines.
+ /// </para>
+ /// </devdoc>
+ public void DrawPie(Pen pen, Rectangle rect, float startAngle, float sweepAngle)
+ {
+ DrawPie(pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle,
+ sweepAngle);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawPie3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws the outline of a pie section defined by an ellipse and two radial
+ /// lines.
+ /// </para>
+ /// </devdoc>
+ public void DrawPie(Pen pen, int x, int y, int width, int height,
+ int startAngle, int sweepAngle)
+ {
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+
+ int status = SafeNativeMethods.Gdip.GdipDrawPieI(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen), x, y, width,
+ height, startAngle, sweepAngle);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // float version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawPolygon"]/*' />
+ /// <devdoc>
+ /// Draws the outline of a polygon defined
+ /// by an array of points.
+ /// </devdoc>
+ public void DrawPolygon(Pen pen, PointF[] points)
+ {
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ int status = SafeNativeMethods.Gdip.GdipDrawPolygon(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen),
+ new HandleRef(this, buf), points.Length);
+
+ Marshal.FreeHGlobal(buf);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // int version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawPolygon1"]/*' />
+ /// <devdoc>
+ /// Draws the outline of a polygon defined
+ /// by an array of points.
+ /// </devdoc>
+ public void DrawPolygon(Pen pen, Point[] points)
+ {
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ int status = SafeNativeMethods.Gdip.GdipDrawPolygonI(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen),
+ new HandleRef(this, buf), points.Length);
+
+ Marshal.FreeHGlobal(buf);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawPath"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws the lines and curves defined by a
+ /// <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </para>
+ /// </devdoc>
+ public void DrawPath(Pen pen, GraphicsPath path)
+ {
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+ if (path == null)
+ throw new ArgumentNullException("path");
+
+ int status = SafeNativeMethods.Gdip.GdipDrawPath(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen),
+ new HandleRef(path, path.nativePath));
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // float version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawCurve"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws a curve defined by an array of
+ /// points.
+ /// </para>
+ /// </devdoc>
+ public void DrawCurve(Pen pen, PointF[] points)
+ {
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ int status = SafeNativeMethods.Gdip.GdipDrawCurve(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen), new HandleRef(this, buf),
+ points.Length);
+
+ Marshal.FreeHGlobal(buf);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawCurve1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws a curve defined by an array of
+ /// points.
+ /// </para>
+ /// </devdoc>
+ public void DrawCurve(Pen pen, PointF[] points, float tension)
+ {
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ int status = SafeNativeMethods.Gdip.GdipDrawCurve2(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen), new HandleRef(this, buf),
+ points.Length, tension);
+
+ Marshal.FreeHGlobal(buf);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawCurve2"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void DrawCurve(Pen pen, PointF[] points, int offset, int numberOfSegments)
+ {
+ DrawCurve(pen, points, offset, numberOfSegments, 0.5f);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawCurve3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws a curve defined by an array of
+ /// points.
+ /// </para>
+ /// </devdoc>
+ public void DrawCurve(Pen pen, PointF[] points, int offset, int numberOfSegments,
+ float tension)
+ {
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ int status = SafeNativeMethods.Gdip.GdipDrawCurve3(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen), new HandleRef(this, buf),
+ points.Length, offset, numberOfSegments,
+ tension);
+
+ Marshal.FreeHGlobal(buf);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // int version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawCurve4"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws a curve defined by an array of points.
+ /// </para>
+ /// </devdoc>
+ public void DrawCurve(Pen pen, Point[] points)
+ {
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ int status = SafeNativeMethods.Gdip.GdipDrawCurveI(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen), new HandleRef(this, buf),
+ points.Length);
+
+ Marshal.FreeHGlobal(buf);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawCurve5"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws a curve defined by an array of points.
+ /// </para>
+ /// </devdoc>
+ public void DrawCurve(Pen pen, Point[] points, float tension)
+ {
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ int status = SafeNativeMethods.Gdip.GdipDrawCurve2I(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen), new HandleRef(this, buf),
+ points.Length, tension);
+
+ Marshal.FreeHGlobal(buf);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawCurve6"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws a curve defined by an array of points.
+ /// </para>
+ /// </devdoc>
+ public void DrawCurve(Pen pen, Point[] points, int offset, int numberOfSegments,
+ float tension)
+ {
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ int status = SafeNativeMethods.Gdip.GdipDrawCurve3I(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen), new HandleRef(this, buf),
+ points.Length, offset, numberOfSegments,
+ tension);
+
+ Marshal.FreeHGlobal(buf);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // float version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawClosedCurve"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws a closed curve defined by an
+ /// array of points.
+ /// </para>
+ /// </devdoc>
+ public void DrawClosedCurve(Pen pen, PointF[] points)
+ {
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ int status = SafeNativeMethods.Gdip.GdipDrawClosedCurve(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen), new HandleRef(this, buf),
+ points.Length);
+
+ Marshal.FreeHGlobal(buf);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawClosedCurve1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws a closed curve defined by an
+ /// array of points.
+ /// </para>
+ /// </devdoc>
+ public void DrawClosedCurve(Pen pen, PointF[] points, float tension, FillMode fillmode)
+ {
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ int status = SafeNativeMethods.Gdip.GdipDrawClosedCurve2(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen), new HandleRef(this, buf),
+ points.Length, tension);
+
+ Marshal.FreeHGlobal(buf);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // int version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawClosedCurve2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws a closed curve defined by an array of points.
+ /// </para>
+ /// </devdoc>
+ public void DrawClosedCurve(Pen pen, Point[] points)
+ {
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ int status = SafeNativeMethods.Gdip.GdipDrawClosedCurveI(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen), new HandleRef(this, buf),
+ points.Length);
+
+ Marshal.FreeHGlobal(buf);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawClosedCurve3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws a closed curve defined by an array of points.
+ /// </para>
+ /// </devdoc>
+ public void DrawClosedCurve(Pen pen, Point[] points, float tension, FillMode fillmode)
+ {
+ if (pen == null)
+ throw new ArgumentNullException("pen");
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ int status = SafeNativeMethods.Gdip.GdipDrawClosedCurve2I(new HandleRef(this, NativeGraphics), new HandleRef(pen, pen.NativePen), new HandleRef(this, buf),
+ points.Length, tension);
+
+ Marshal.FreeHGlobal(buf);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.Clear"]/*' />
+ /// <devdoc>
+ /// Fills the entire drawing surface with the
+ /// specified color.
+ /// </devdoc>
+ public void Clear(Color color)
+ {
+ int status = SafeNativeMethods.Gdip.GdipGraphicsClear(new HandleRef(this, NativeGraphics), color.ToArgb());
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ // float version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FillRectangle"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Fills the interior of a rectangle with a <see cref='System.Drawing.Brush'/>.
+ /// </para>
+ /// </devdoc>
+ public void FillRectangle(Brush brush, RectangleF rect)
+ {
+ FillRectangle(brush, rect.X, rect.Y, rect.Width, rect.Height);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FillRectangle1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Fills the interior of a rectangle with a
+ /// <see cref='System.Drawing.Brush'/>.
+ /// </para>
+ /// </devdoc>
+ public void FillRectangle(Brush brush, float x, float y, float width, float height)
+ {
+ if (brush == null)
+ {
+ throw new ArgumentNullException("brush");
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipFillRectangle(new HandleRef(this, NativeGraphics), new HandleRef(brush, brush.NativeBrush), x, y,
+ width, height);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // int version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FillRectangle2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Fills the interior of a rectangle with a <see cref='System.Drawing.Brush'/>.
+ /// </para>
+ /// </devdoc>
+ public void FillRectangle(Brush brush, Rectangle rect)
+ {
+ FillRectangle(brush, rect.X, rect.Y, rect.Width, rect.Height);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FillRectangle3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Fills the interior of a rectangle with a <see cref='System.Drawing.Brush'/>.
+ /// </para>
+ /// </devdoc>
+ public void FillRectangle(Brush brush, int x, int y, int width, int height)
+ {
+ if (brush == null)
+ {
+ throw new ArgumentNullException("brush");
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipFillRectangleI(new HandleRef(this, NativeGraphics), new HandleRef(brush, brush.NativeBrush), x, y, width, height);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FillRectangles"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Fills the interiors of a series of
+ /// rectangles with a <see cref='System.Drawing.Brush'/>.
+ /// </para>
+ /// </devdoc>
+ public void FillRectangles(Brush brush, RectangleF[] rects)
+ {
+ if (brush == null)
+ {
+ throw new ArgumentNullException("brush");
+ }
+ if (rects == null)
+ {
+ throw new ArgumentNullException("rects");
+ }
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertRectangleToMemory(rects);
+ int status = SafeNativeMethods.Gdip.GdipFillRectangles(new HandleRef(this, NativeGraphics), new HandleRef(brush, brush.NativeBrush),
+ new HandleRef(this, buf), rects.Length);
+
+ Marshal.FreeHGlobal(buf);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FillRectangles1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Fills the interiors of a series of rectangles with a <see cref='System.Drawing.Brush'/>.
+ /// </para>
+ /// </devdoc>
+ public void FillRectangles(Brush brush, Rectangle[] rects)
+ {
+ if (brush == null)
+ {
+ throw new ArgumentNullException("brush");
+ }
+ if (rects == null)
+ {
+ throw new ArgumentNullException("rects");
+ }
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertRectangleToMemory(rects);
+ int status = SafeNativeMethods.Gdip.GdipFillRectanglesI(new HandleRef(this, NativeGraphics), new HandleRef(brush, brush.NativeBrush),
+ new HandleRef(this, buf), rects.Length);
+
+ Marshal.FreeHGlobal(buf);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // float version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FillPolygon"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Fills the interior of a polygon defined
+ /// by an array of points.
+ /// </para>
+ /// </devdoc>
+ public void FillPolygon(Brush brush, PointF[] points)
+ {
+ FillPolygon(brush, points, FillMode.Alternate);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FillPolygon1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Fills the interior of a polygon defined by an array of points.
+ /// </para>
+ /// </devdoc>
+ public void FillPolygon(Brush brush, PointF[] points, FillMode fillMode)
+ {
+ if (brush == null)
+ throw new ArgumentNullException("brush");
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ int status = SafeNativeMethods.Gdip.GdipFillPolygon(new HandleRef(this, NativeGraphics), new HandleRef(brush, brush.NativeBrush),
+ new HandleRef(this, buf), points.Length, unchecked((int)fillMode));
+
+ Marshal.FreeHGlobal(buf);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // int version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FillPolygon2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Fills the interior of a polygon defined by an array of points.
+ /// </para>
+ /// </devdoc>
+ public void FillPolygon(Brush brush, Point[] points)
+ {
+ FillPolygon(brush, points, FillMode.Alternate);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FillPolygon3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Fills the interior of a polygon defined by an array of points.
+ /// </para>
+ /// </devdoc>
+ public void FillPolygon(Brush brush, Point[] points, FillMode fillMode)
+ {
+ if (brush == null)
+ throw new ArgumentNullException("brush");
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ int status = SafeNativeMethods.Gdip.GdipFillPolygonI(new HandleRef(this, NativeGraphics), new HandleRef(brush, brush.NativeBrush),
+ new HandleRef(this, buf), points.Length, unchecked((int)fillMode));
+
+ Marshal.FreeHGlobal(buf);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // float version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FillEllipse"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Fills the interior of an ellipse
+ /// defined by a bounding rectangle.
+ /// </para>
+ /// </devdoc>
+ public void FillEllipse(Brush brush, RectangleF rect)
+ {
+ FillEllipse(brush, rect.X, rect.Y, rect.Width, rect.Height);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FillEllipse1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Fills the interior of an ellipse defined by a bounding rectangle.
+ /// </para>
+ /// </devdoc>
+ public void FillEllipse(Brush brush, float x, float y, float width,
+ float height)
+ {
+ if (brush == null)
+ throw new ArgumentNullException("brush");
+
+ int status = SafeNativeMethods.Gdip.GdipFillEllipse(new HandleRef(this, NativeGraphics), new HandleRef(brush, brush.NativeBrush), x, y,
+ width, height);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // int version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FillEllipse2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Fills the interior of an ellipse defined by a bounding rectangle.
+ /// </para>
+ /// </devdoc>
+ public void FillEllipse(Brush brush, Rectangle rect)
+ {
+ FillEllipse(brush, rect.X, rect.Y, rect.Width, rect.Height);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FillEllipse3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Fills the interior of an ellipse defined by a bounding
+ /// rectangle.
+ /// </para>
+ /// </devdoc>
+ public void FillEllipse(Brush brush, int x, int y, int width, int height)
+ {
+ if (brush == null)
+ throw new ArgumentNullException("brush");
+
+ int status = SafeNativeMethods.Gdip.GdipFillEllipseI(new HandleRef(this, NativeGraphics), new HandleRef(brush, brush.NativeBrush), x, y,
+ width, height);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FillPie"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Fills the interior of a pie section defined by an ellipse and two radial
+ /// lines.
+ /// </para>
+ /// </devdoc>
+ public void FillPie(Brush brush, Rectangle rect, float startAngle,
+ float sweepAngle)
+ {
+ FillPie(brush, rect.X, rect.Y, rect.Width, rect.Height, startAngle,
+ sweepAngle);
+ }
+
+ // float verison
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FillPie1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Fills the interior of a pie section defined by an ellipse and two radial
+ /// lines.
+ /// </para>
+ /// </devdoc>
+ public void FillPie(Brush brush, float x, float y, float width,
+ float height, float startAngle, float sweepAngle)
+ {
+ if (brush == null)
+ throw new ArgumentNullException("brush");
+
+ int status = SafeNativeMethods.Gdip.GdipFillPie(new HandleRef(this, NativeGraphics), new HandleRef(brush, brush.NativeBrush), x, y,
+ width, height, startAngle, sweepAngle);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // int verison
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FillPie2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Fills the interior of a pie section defined by an ellipse
+ /// and two radial lines.
+ /// </para>
+ /// </devdoc>
+ public void FillPie(Brush brush, int x, int y, int width,
+ int height, int startAngle, int sweepAngle)
+ {
+ if (brush == null)
+ throw new ArgumentNullException("brush");
+
+ int status = SafeNativeMethods.Gdip.GdipFillPieI(new HandleRef(this, NativeGraphics), new HandleRef(brush, brush.NativeBrush), x, y,
+ width, height, startAngle, sweepAngle);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FillPath"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Fills the interior of a path.
+ /// </para>
+ /// </devdoc>
+ public void FillPath(Brush brush, GraphicsPath path)
+ {
+ if (brush == null)
+ throw new ArgumentNullException("brush");
+ if (path == null)
+ throw new ArgumentNullException("path");
+
+ int status = SafeNativeMethods.Gdip.GdipFillPath(new HandleRef(this, NativeGraphics), new HandleRef(brush, brush.NativeBrush),
+ new HandleRef(path, path.nativePath));
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // float version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FillClosedCurve"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Fills the interior a closed
+ /// curve defined by an
+ /// array of points.
+ /// </para>
+ /// </devdoc>
+ public void FillClosedCurve(Brush brush, PointF[] points)
+ {
+ if (brush == null)
+ throw new ArgumentNullException("brush");
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ int status = SafeNativeMethods.Gdip.GdipFillClosedCurve(new HandleRef(this, NativeGraphics), new HandleRef(brush, brush.NativeBrush),
+ new HandleRef(this, buf), points.Length);
+
+ Marshal.FreeHGlobal(buf);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FillClosedCurve1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Fills the
+ /// interior of a closed curve defined by an array of points.
+ /// </para>
+ /// </devdoc>
+ public void FillClosedCurve(Brush brush, PointF[] points, FillMode fillmode)
+ {
+ FillClosedCurve(brush, points, fillmode, 0.5f);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FillClosedCurve2"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void FillClosedCurve(Brush brush, PointF[] points, FillMode fillmode, float tension)
+ {
+ if (brush == null)
+ throw new ArgumentNullException("brush");
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ int status = SafeNativeMethods.Gdip.GdipFillClosedCurve2(new HandleRef(this, NativeGraphics), new HandleRef(brush, brush.NativeBrush),
+ new HandleRef(this, buf), points.Length,
+ tension, unchecked((int)fillmode));
+
+ Marshal.FreeHGlobal(buf);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // int version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FillClosedCurve3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Fills the interior a closed curve defined by an array of points.
+ /// </para>
+ /// </devdoc>
+ public void FillClosedCurve(Brush brush, Point[] points)
+ {
+ if (brush == null)
+ throw new ArgumentNullException("brush");
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ int status = SafeNativeMethods.Gdip.GdipFillClosedCurveI(new HandleRef(this, NativeGraphics), new HandleRef(brush, brush.NativeBrush),
+ new HandleRef(this, buf), points.Length);
+
+ Marshal.FreeHGlobal(buf);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FillClosedCurve4"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void FillClosedCurve(Brush brush, Point[] points, FillMode fillmode)
+ {
+ FillClosedCurve(brush, points, fillmode, 0.5f);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FillClosedCurve5"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public void FillClosedCurve(Brush brush, Point[] points, FillMode fillmode, float tension)
+ {
+ if (brush == null)
+ throw new ArgumentNullException("brush");
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(points);
+ int status = SafeNativeMethods.Gdip.GdipFillClosedCurve2I(new HandleRef(this, NativeGraphics), new HandleRef(brush, brush.NativeBrush),
+ new HandleRef(this, buf), points.Length,
+ tension, unchecked((int)fillmode));
+
+ Marshal.FreeHGlobal(buf);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.FillRegion"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Fills the interior of a <see cref='System.Drawing.Region'/>.
+ /// </para>
+ /// </devdoc>
+ public void FillRegion(Brush brush, Region region)
+ {
+ if (brush == null)
+ throw new ArgumentNullException("brush");
+
+ if (region == null)
+ throw new ArgumentNullException("region");
+
+ int status = SafeNativeMethods.Gdip.GdipFillRegion(new HandleRef(this, NativeGraphics), new HandleRef(brush, brush.NativeBrush),
+ new HandleRef(region, region.nativeRegion));
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /*
+ * Text drawing methods
+ *
+ * @notes Should there be integer versions, also?
+ */
+
+ // Without clipping rectangle
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawString"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws a string with the specified font.
+ /// </para>
+ /// </devdoc>
+ public void DrawString(String s, Font font, Brush brush, float x, float y)
+ {
+ DrawString(s, font, brush, new RectangleF(x, y, 0, 0), null);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawString1"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void DrawString(String s, Font font, Brush brush, PointF point)
+ {
+ DrawString(s, font, brush, new RectangleF(point.X, point.Y, 0, 0), null);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawString2"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void DrawString(String s, Font font, Brush brush, float x, float y, StringFormat format)
+ {
+ DrawString(s, font, brush, new RectangleF(x, y, 0, 0), format);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawString3"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void DrawString(String s, Font font, Brush brush, PointF point, StringFormat format)
+ {
+ DrawString(s, font, brush, new RectangleF(point.X, point.Y, 0, 0), format);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawString4"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void DrawString(String s, Font font, Brush brush, RectangleF layoutRectangle)
+ {
+ DrawString(s, font, brush, layoutRectangle, null);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawString5"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void DrawString(String s, Font font, Brush brush,
+ RectangleF layoutRectangle, StringFormat format)
+ {
+ if (brush == null)
+ throw new ArgumentNullException("brush");
+
+ if (s == null || s.Length == 0) return;
+ if (font == null)
+ throw new ArgumentNullException("font");
+
+ GPRECTF grf = new GPRECTF(layoutRectangle);
+ IntPtr nativeStringFormat = (format == null) ? IntPtr.Zero : format.nativeFormat;
+ int status = SafeNativeMethods.Gdip.GdipDrawString(new HandleRef(this, NativeGraphics), s, s.Length, new HandleRef(font, font.NativeFont), ref grf, new HandleRef(format, nativeStringFormat), new HandleRef(brush, brush.NativeBrush));
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // MeasureString
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.MeasureString"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public SizeF MeasureString(String text, Font font, SizeF layoutArea, StringFormat stringFormat,
+ out int charactersFitted, out int linesFilled)
+ {
+ if (text == null || text.Length == 0)
+ {
+ charactersFitted = 0;
+ linesFilled = 0;
+ return new SizeF(0, 0);
+ }
+ if (font == null)
+ {
+ throw new ArgumentNullException("font");
+ }
+
+ GPRECTF grfLayout = new GPRECTF(0, 0, layoutArea.Width, layoutArea.Height);
+ GPRECTF grfboundingBox = new GPRECTF();
+ int status = SafeNativeMethods.Gdip.GdipMeasureString(new HandleRef(this, NativeGraphics), text, text.Length, new HandleRef(font, font.NativeFont), ref grfLayout,
+ new HandleRef(stringFormat, (stringFormat == null) ? IntPtr.Zero : stringFormat.nativeFormat),
+ ref grfboundingBox,
+ out charactersFitted, out linesFilled);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return grfboundingBox.SizeF;
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.MeasureString1"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public SizeF MeasureString(String text, Font font, PointF origin, StringFormat stringFormat)
+ {
+ if (text == null || text.Length == 0)
+ return new SizeF(0, 0);
+ if (font == null)
+ throw new ArgumentNullException("font");
+
+ GPRECTF grf = new GPRECTF();
+ GPRECTF grfboundingBox = new GPRECTF();
+
+ grf.X = origin.X;
+ grf.Y = origin.Y;
+ grf.Width = 0;
+ grf.Height = 0;
+
+ int a, b;
+ int status = SafeNativeMethods.Gdip.GdipMeasureString(new HandleRef(this, NativeGraphics), text, text.Length, new HandleRef(font, font.NativeFont),
+ ref grf,
+ new HandleRef(stringFormat, (stringFormat == null) ? IntPtr.Zero : stringFormat.nativeFormat),
+ ref grfboundingBox, out a, out b);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return grfboundingBox.SizeF;
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.MeasureString2"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public SizeF MeasureString(String text, Font font, SizeF layoutArea)
+ {
+ return MeasureString(text, font, layoutArea, null);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.MeasureString3"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public SizeF MeasureString(String text, Font font, SizeF layoutArea, StringFormat stringFormat)
+ {
+ if (text == null || text.Length == 0)
+ {
+ return new SizeF(0, 0);
+ }
+
+ if (font == null)
+ {
+ throw new ArgumentNullException("font");
+ }
+
+ GPRECTF grfLayout = new GPRECTF(0, 0, layoutArea.Width, layoutArea.Height);
+ GPRECTF grfboundingBox = new GPRECTF();
+
+ int a, b;
+ int status = SafeNativeMethods.Gdip.GdipMeasureString(new HandleRef(this, NativeGraphics), text, text.Length, new HandleRef(font, font.NativeFont),
+ ref grfLayout,
+ new HandleRef(stringFormat, (stringFormat == null) ? IntPtr.Zero : stringFormat.nativeFormat),
+ ref grfboundingBox, out a, out b);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return grfboundingBox.SizeF;
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.MeasureString4"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public SizeF MeasureString(String text, Font font)
+ {
+ return MeasureString(text, font, new SizeF(0, 0));
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.MeasureString5"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public SizeF MeasureString(String text, Font font, int width)
+ {
+ return MeasureString(text, font, new SizeF(width, 999999));
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.MeasureString6"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public SizeF MeasureString(String text, Font font, int width, StringFormat format)
+ {
+ return MeasureString(text, font, new SizeF(width, 999999), format);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.MeasureCharacterRanges"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public Region[] MeasureCharacterRanges(String text, Font font, RectangleF layoutRect,
+ StringFormat stringFormat)
+ {
+ if (text == null || text.Length == 0)
+ {
+ return new Region[] { };
+ }
+ if (font == null)
+ {
+ throw new ArgumentNullException("font");
+ }
+
+ int count;
+ int status = SafeNativeMethods.Gdip.GdipGetStringFormatMeasurableCharacterRangeCount(new HandleRef(stringFormat, (stringFormat == null) ? IntPtr.Zero : stringFormat.nativeFormat)
+ , out count);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ IntPtr[] gpRegions = new IntPtr[count];
+
+ GPRECTF grf = new GPRECTF(layoutRect);
+
+ Region[] regions = new Region[count];
+
+ for (int f = 0; f < count; f++)
+ {
+ regions[f] = new Region();
+ gpRegions[f] = (IntPtr)regions[f].nativeRegion;
+ }
+
+ status = SafeNativeMethods.Gdip.GdipMeasureCharacterRanges(new HandleRef(this, NativeGraphics), text, text.Length, new HandleRef(font, font.NativeFont), ref grf,
+ new HandleRef(stringFormat, (stringFormat == null) ? IntPtr.Zero : stringFormat.nativeFormat),
+ count, gpRegions);
+
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return regions;
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawIcon"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void DrawIcon(Icon icon, int x, int y)
+ {
+ if (icon == null)
+ {
+ throw new ArgumentNullException("icon");
+ }
+
+ if (_backingImage != null)
+ {
+ // we don't call the icon directly because we want to stay in GDI+ all the time
+ // to avoid alpha channel interop issues between gdi and gdi+
+ // so we do icon.ToBitmap() and then we call DrawImage. this is probably slower...
+ DrawImage(icon.ToBitmap(), x, y);
+ }
+ else
+ {
+ icon.Draw(this, x, y);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawIcon1"]/*' />
+ /// <devdoc>
+ /// Draws this image to a graphics object. The drawing command originates on the graphics
+ /// object, but a graphics object generally has no idea how to render a given image. So,
+ /// it passes the call to the actual image. This version crops the image to the given
+ /// dimensions and allows the user to specify a rectangle within the image to draw.
+ /// </devdoc>
+ public void DrawIcon(Icon icon, Rectangle targetRect)
+ {
+ if (icon == null)
+ {
+ throw new ArgumentNullException("icon");
+ }
+
+ if (_backingImage != null)
+ {
+ // we don't call the icon directly because we want to stay in GDI+ all the time
+ // to avoid alpha channel interop issues between gdi and gdi+
+ // so we do icon.ToBitmap() and then we call DrawImage. this is probably slower...
+ DrawImage(icon.ToBitmap(), targetRect);
+ }
+ else
+ {
+ icon.Draw(this, targetRect);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawIconUnstretched"]/*' />
+ /// <devdoc>
+ /// Draws this image to a graphics object. The drawing command originates on the graphics
+ /// object, but a graphics object generally has no idea how to render a given image. So,
+ /// it passes the call to the actual image. This version stretches the image to the given
+ /// dimensions and allows the user to specify a rectangle within the image to draw.
+ /// </devdoc>
+ public void DrawIconUnstretched(Icon icon, Rectangle targetRect)
+ {
+ if (icon == null)
+ {
+ throw new ArgumentNullException("icon");
+ }
+
+ if (_backingImage != null)
+ {
+ DrawImageUnscaled(icon.ToBitmap(), targetRect);
+ }
+ else
+ {
+ icon.DrawUnstretched(this, targetRect);
+ }
+ }
+
+ /**
+ * Draw images (both bitmap and vector)
+ */
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draws the specified image at the
+ /// specified location.
+ /// </para>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, PointF point)
+ {
+ DrawImage(image, point.X, point.Y);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage1"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, float x, float y)
+ {
+ if (image == null)
+ throw new ArgumentNullException("image");
+
+ int status = SafeNativeMethods.Gdip.GdipDrawImage(new HandleRef(this, NativeGraphics), new HandleRef(image, image.nativeImage),
+ x, y);
+
+ //ignore emf metafile error
+ IgnoreMetafileErrors(image, ref status);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage2"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, RectangleF rect)
+ {
+ DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage3"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, float x, float y, float width,
+ float height)
+ {
+ if (image == null)
+ throw new ArgumentNullException("image");
+
+ int status = SafeNativeMethods.Gdip.GdipDrawImageRect(new HandleRef(this, NativeGraphics),
+ new HandleRef(image, image.nativeImage),
+ x, y,
+ width, height);
+
+ //ignore emf metafile error
+ IgnoreMetafileErrors(image, ref status);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // int version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage4"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, Point point)
+ {
+ DrawImage(image, point.X, point.Y);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage5"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, int x, int y)
+ {
+ if (image == null)
+ throw new ArgumentNullException("image");
+
+ int status = SafeNativeMethods.Gdip.GdipDrawImageI(new HandleRef(this, NativeGraphics), new HandleRef(image, image.nativeImage),
+ x, y);
+
+ //ignore emf metafile error
+ IgnoreMetafileErrors(image, ref status);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage6"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, Rectangle rect)
+ {
+ DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage7"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, int x, int y, int width, int height)
+ {
+ if (image == null)
+ {
+ throw new ArgumentNullException("image");
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipDrawImageRectI(new HandleRef(this, NativeGraphics),
+ new HandleRef(image, image.nativeImage),
+ x, y,
+ width, height);
+
+ //ignore emf metafile error
+ IgnoreMetafileErrors(image, ref status);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+
+
+ // unscaled versions
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImageUnscaled"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void DrawImageUnscaled(Image image, Point point)
+ {
+ DrawImage(image, point.X, point.Y);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImageUnscaled1"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void DrawImageUnscaled(Image image, int x, int y)
+ {
+ DrawImage(image, x, y);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImageUnscaled2"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void DrawImageUnscaled(Image image, Rectangle rect)
+ {
+ DrawImage(image, rect.X, rect.Y);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImageUnscaled3"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void DrawImageUnscaled(Image image, int x, int y, int width, int height)
+ {
+ DrawImage(image, x, y);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImageUnscaledAndClipped"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void DrawImageUnscaledAndClipped(Image image, Rectangle rect)
+ {
+ if (image == null)
+ {
+ throw new ArgumentNullException("image");
+ }
+
+ int width = Math.Min(rect.Width, image.Width);
+ int height = Math.Min(rect.Height, image.Height);
+
+ //We could put centering logic here too for the case when the image is smaller than the rect
+ DrawImage(image, rect, 0, 0, width, height, GraphicsUnit.Pixel);
+ }
+
+ /*
+ * Affine or perspective blt
+ * destPoints.Length = 3: rect => parallelogram
+ * destPoints[0] <=> top-left corner of the source rectangle
+ * destPoints[1] <=> top-right corner
+ * destPoints[2] <=> bottom-left corner
+ * destPoints.Length = 4: rect => quad
+ * destPoints[3] <=> bottom-right corner
+ *
+ * @notes Perspective blt only works for bitmap images.
+ */
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage8"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, PointF[] destPoints)
+ {
+ if (destPoints == null)
+ throw new ArgumentNullException("destPoints");
+ if (image == null)
+ throw new ArgumentNullException("image");
+
+ int count = destPoints.Length;
+
+ if (count != 3 && count != 4)
+ throw new ArgumentException(SR.Format(SR.GdiplusDestPointsInvalidLength));
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(destPoints);
+ int status = SafeNativeMethods.Gdip.GdipDrawImagePoints(new HandleRef(this, NativeGraphics),
+ new HandleRef(image, image.nativeImage),
+ new HandleRef(this, buf), count);
+
+ Marshal.FreeHGlobal(buf);
+
+ //ignore emf metafile error
+ IgnoreMetafileErrors(image, ref status);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // int version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage9"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, Point[] destPoints)
+ {
+ if (destPoints == null)
+ throw new ArgumentNullException("destPoints");
+ if (image == null)
+ throw new ArgumentNullException("image");
+
+ int count = destPoints.Length;
+
+ if (count != 3 && count != 4)
+ throw new ArgumentException(SR.Format(SR.GdiplusDestPointsInvalidLength));
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(destPoints);
+ int status = SafeNativeMethods.Gdip.GdipDrawImagePointsI(new HandleRef(this, NativeGraphics),
+ new HandleRef(image, image.nativeImage),
+ new HandleRef(this, buf), count);
+
+ Marshal.FreeHGlobal(buf);
+
+ //ignore emf metafile error
+ IgnoreMetafileErrors(image, ref status);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /*
+ * We need another set of methods similar to the ones above
+ * that take an additional Rectangle parameter to specify the
+ * portion of the source image to be drawn.
+ */
+ // float version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage10"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, float x, float y, RectangleF srcRect,
+ GraphicsUnit srcUnit)
+ {
+ if (image == null)
+ throw new ArgumentNullException("image");
+
+ int status = SafeNativeMethods.Gdip.GdipDrawImagePointRect(
+ new HandleRef(this, NativeGraphics),
+ new HandleRef(image, image.nativeImage),
+ x,
+ y,
+ srcRect.X,
+ srcRect.Y,
+ srcRect.Width,
+ srcRect.Height,
+ unchecked((int)srcUnit));
+
+ //ignore emf metafile error
+ IgnoreMetafileErrors(image, ref status);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // int version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage11"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, int x, int y, Rectangle srcRect,
+ GraphicsUnit srcUnit)
+ {
+ if (image == null)
+ throw new ArgumentNullException("image");
+
+ int status = SafeNativeMethods.Gdip.GdipDrawImagePointRectI(
+ new HandleRef(this, NativeGraphics),
+ new HandleRef(image, image.nativeImage),
+ x,
+ y,
+ srcRect.X,
+ srcRect.Y,
+ srcRect.Width,
+ srcRect.Height,
+ unchecked((int)srcUnit));
+
+ //ignore emf metafile error
+ IgnoreMetafileErrors(image, ref status);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // float version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage12"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, RectangleF destRect, RectangleF srcRect,
+ GraphicsUnit srcUnit)
+ {
+ if (image == null)
+ throw new ArgumentNullException("image");
+
+ int status = SafeNativeMethods.Gdip.GdipDrawImageRectRect(
+ new HandleRef(this, NativeGraphics),
+ new HandleRef(image, image.nativeImage),
+ destRect.X,
+ destRect.Y,
+ destRect.Width,
+ destRect.Height,
+ srcRect.X,
+ srcRect.Y,
+ srcRect.Width,
+ srcRect.Height,
+ unchecked((int)srcUnit),
+ NativeMethods.NullHandleRef,
+ null,
+ NativeMethods.NullHandleRef
+ );
+
+ //ignore emf metafile error
+ IgnoreMetafileErrors(image, ref status);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // int version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage13"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, Rectangle destRect, Rectangle srcRect,
+ GraphicsUnit srcUnit)
+ {
+ if (image == null)
+ throw new ArgumentNullException("image");
+
+ int status = SafeNativeMethods.Gdip.GdipDrawImageRectRectI(
+ new HandleRef(this, NativeGraphics),
+ new HandleRef(image, image.nativeImage),
+ destRect.X,
+ destRect.Y,
+ destRect.Width,
+ destRect.Height,
+ srcRect.X,
+ srcRect.Y,
+ srcRect.Width,
+ srcRect.Height,
+ unchecked((int)srcUnit),
+ NativeMethods.NullHandleRef,
+ null,
+ NativeMethods.NullHandleRef);
+
+ //ignore emf metafile error
+ IgnoreMetafileErrors(image, ref status);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // float version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage14"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, PointF[] destPoints, RectangleF srcRect,
+ GraphicsUnit srcUnit)
+ {
+ if (destPoints == null)
+ throw new ArgumentNullException("destPoints");
+ if (image == null)
+ throw new ArgumentNullException("image");
+
+ int count = destPoints.Length;
+
+ if (count != 3 && count != 4)
+ throw new ArgumentException(SR.Format(SR.GdiplusDestPointsInvalidLength));
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(destPoints);
+
+ int status = SafeNativeMethods.Gdip.GdipDrawImagePointsRect(
+ new HandleRef(this, NativeGraphics),
+ new HandleRef(image, image.nativeImage),
+ new HandleRef(this, buf),
+ destPoints.Length,
+ srcRect.X,
+ srcRect.Y,
+ srcRect.Width,
+ srcRect.Height,
+ unchecked((int)srcUnit),
+ NativeMethods.NullHandleRef,
+ null,
+ NativeMethods.NullHandleRef);
+
+ Marshal.FreeHGlobal(buf);
+
+ //ignore emf metafile error
+ IgnoreMetafileErrors(image, ref status);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage15"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, PointF[] destPoints, RectangleF srcRect,
+ GraphicsUnit srcUnit, ImageAttributes imageAttr)
+ {
+ DrawImage(image, destPoints, srcRect, srcUnit, imageAttr, null, 0);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage16"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, PointF[] destPoints, RectangleF srcRect,
+ GraphicsUnit srcUnit, ImageAttributes imageAttr,
+ DrawImageAbort callback)
+ {
+ DrawImage(image, destPoints, srcRect, srcUnit, imageAttr, callback, 0);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage17"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, PointF[] destPoints, RectangleF srcRect,
+ GraphicsUnit srcUnit, ImageAttributes imageAttr,
+ DrawImageAbort callback, int callbackData)
+ {
+ if (destPoints == null)
+ throw new ArgumentNullException("destPoints");
+ if (image == null)
+ throw new ArgumentNullException("image");
+
+ int count = destPoints.Length;
+
+ if (count != 3 && count != 4)
+ throw new ArgumentException(SR.Format(SR.GdiplusDestPointsInvalidLength));
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(destPoints);
+
+ int status = SafeNativeMethods.Gdip.GdipDrawImagePointsRect(
+ new HandleRef(this, NativeGraphics),
+ new HandleRef(image, image.nativeImage),
+ new HandleRef(this, buf),
+ destPoints.Length,
+ srcRect.X,
+ srcRect.Y,
+ srcRect.Width,
+ srcRect.Height,
+ unchecked((int)srcUnit),
+ new HandleRef(imageAttr, (imageAttr != null ? imageAttr.nativeImageAttributes : IntPtr.Zero)),
+ callback,
+ new HandleRef(null, (IntPtr)callbackData));
+
+ Marshal.FreeHGlobal(buf);
+
+ //ignore emf metafile error
+ IgnoreMetafileErrors(image, ref status);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // int version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage18"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, Point[] destPoints, Rectangle srcRect, GraphicsUnit srcUnit)
+ {
+ DrawImage(image, destPoints, srcRect, srcUnit, null, null, 0);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage19"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, Point[] destPoints, Rectangle srcRect,
+ GraphicsUnit srcUnit, ImageAttributes imageAttr)
+ {
+ DrawImage(image, destPoints, srcRect, srcUnit, imageAttr, null, 0);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage20"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, Point[] destPoints, Rectangle srcRect,
+ GraphicsUnit srcUnit, ImageAttributes imageAttr,
+ DrawImageAbort callback)
+ {
+ DrawImage(image, destPoints, srcRect, srcUnit, imageAttr, callback, 0);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage21"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, Point[] destPoints, Rectangle srcRect,
+ GraphicsUnit srcUnit, ImageAttributes imageAttr,
+ DrawImageAbort callback, int callbackData)
+ {
+ if (destPoints == null)
+ throw new ArgumentNullException("destPoints");
+ if (image == null)
+ throw new ArgumentNullException("image");
+
+ int count = destPoints.Length;
+
+ if (count != 3 && count != 4)
+ throw new ArgumentException(SR.Format(SR.GdiplusDestPointsInvalidLength));
+
+ IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(destPoints);
+
+ int status = SafeNativeMethods.Gdip.GdipDrawImagePointsRectI(
+ new HandleRef(this, NativeGraphics),
+ new HandleRef(image, image.nativeImage),
+ new HandleRef(this, buf),
+ destPoints.Length,
+ srcRect.X,
+ srcRect.Y,
+ srcRect.Width,
+ srcRect.Height,
+ unchecked((int)srcUnit),
+ new HandleRef(imageAttr, (imageAttr != null ? imageAttr.nativeImageAttributes : IntPtr.Zero)),
+ callback,
+ new HandleRef(null, (IntPtr)callbackData));
+
+ Marshal.FreeHGlobal(buf);
+
+ //ignore emf metafile error
+ IgnoreMetafileErrors(image, ref status);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // float version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage22"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, Rectangle destRect, float srcX, float srcY,
+ float srcWidth, float srcHeight, GraphicsUnit srcUnit)
+ {
+ DrawImage(image, destRect, srcX, srcY, srcWidth, srcHeight, srcUnit, null);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage23"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, Rectangle destRect, float srcX, float srcY,
+ float srcWidth, float srcHeight, GraphicsUnit srcUnit,
+ ImageAttributes imageAttrs)
+ {
+ DrawImage(image, destRect, srcX, srcY, srcWidth, srcHeight, srcUnit, imageAttrs, null);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage24"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, Rectangle destRect, float srcX, float srcY,
+ float srcWidth, float srcHeight, GraphicsUnit srcUnit,
+ ImageAttributes imageAttrs, DrawImageAbort callback)
+ {
+ DrawImage(image, destRect, srcX, srcY, srcWidth, srcHeight, srcUnit, imageAttrs, callback, IntPtr.Zero);
+ }
+
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage25"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, Rectangle destRect, float srcX, float srcY,
+ float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs,
+ DrawImageAbort callback, IntPtr callbackData)
+ {
+ if (image == null)
+ throw new ArgumentNullException("image");
+
+ int status = SafeNativeMethods.Gdip.GdipDrawImageRectRect(
+ new HandleRef(this, NativeGraphics),
+ new HandleRef(image, image.nativeImage),
+ destRect.X,
+ destRect.Y,
+ destRect.Width,
+ destRect.Height,
+ srcX,
+ srcY,
+ srcWidth,
+ srcHeight,
+ unchecked((int)srcUnit),
+ new HandleRef(imageAttrs, (imageAttrs != null ? imageAttrs.nativeImageAttributes : IntPtr.Zero)),
+ callback,
+ new HandleRef(null, callbackData));
+
+ //ignore emf metafile error
+ IgnoreMetafileErrors(image, ref status);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ // int version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage26"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, Rectangle destRect, int srcX, int srcY,
+ int srcWidth, int srcHeight, GraphicsUnit srcUnit)
+ {
+ DrawImage(image, destRect, srcX, srcY, srcWidth, srcHeight, srcUnit, null);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage27"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, Rectangle destRect, int srcX, int srcY,
+ int srcWidth, int srcHeight, GraphicsUnit srcUnit,
+ ImageAttributes imageAttr)
+ {
+ DrawImage(image, destRect, srcX, srcY, srcWidth, srcHeight, srcUnit, imageAttr, null);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage28"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, Rectangle destRect, int srcX, int srcY,
+ int srcWidth, int srcHeight, GraphicsUnit srcUnit,
+ ImageAttributes imageAttr, DrawImageAbort callback)
+ {
+ DrawImage(image, destRect, srcX, srcY, srcWidth, srcHeight, srcUnit, imageAttr, callback, IntPtr.Zero);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawImage29"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void DrawImage(Image image, Rectangle destRect, int srcX, int srcY,
+ int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs,
+ DrawImageAbort callback, IntPtr callbackData)
+ {
+ if (image == null)
+ throw new ArgumentNullException("image");
+
+ int status = SafeNativeMethods.Gdip.GdipDrawImageRectRectI(
+ new HandleRef(this, NativeGraphics),
+ new HandleRef(image, image.nativeImage),
+ destRect.X,
+ destRect.Y,
+ destRect.Width,
+ destRect.Height,
+ srcX,
+ srcY,
+ srcWidth,
+ srcHeight,
+ unchecked((int)srcUnit),
+ new HandleRef(imageAttrs, (imageAttrs != null ? imageAttrs.nativeImageAttributes : IntPtr.Zero)),
+ callback,
+ new HandleRef(null, callbackData));
+
+ //ignore emf metafile error
+ IgnoreMetafileErrors(image, ref status);
+
+ //check error status sensitive to TS problems
+ CheckErrorStatus(status);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, PointF destPoint,
+ EnumerateMetafileProc callback)
+ {
+ EnumerateMetafile(metafile, destPoint, callback, IntPtr.Zero);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile1"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, PointF destPoint,
+ EnumerateMetafileProc callback, IntPtr callbackData)
+ {
+ EnumerateMetafile(metafile, destPoint, callback, callbackData, null);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile2"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
+ public void EnumerateMetafile(Metafile metafile, PointF destPoint,
+ EnumerateMetafileProc callback, IntPtr callbackData,
+ ImageAttributes imageAttr)
+ {
+ IntPtr mf = (metafile == null ? IntPtr.Zero : metafile.nativeImage);
+ IntPtr ia = (imageAttr == null ? IntPtr.Zero : imageAttr.nativeImageAttributes);
+
+ int status = SafeNativeMethods.Gdip.GdipEnumerateMetafileDestPoint(new HandleRef(this, NativeGraphics),
+ new HandleRef(metafile, mf),
+ new GPPOINTF(destPoint),
+ callback,
+ new HandleRef(null, callbackData),
+ new HandleRef(imageAttr, ia));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile3"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, Point destPoint,
+ EnumerateMetafileProc callback)
+ {
+ EnumerateMetafile(metafile, destPoint, callback, IntPtr.Zero);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile4"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, Point destPoint,
+ EnumerateMetafileProc callback, IntPtr callbackData)
+ {
+ EnumerateMetafile(metafile, destPoint, callback, callbackData, null);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile5"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
+ public void EnumerateMetafile(Metafile metafile, Point destPoint,
+ EnumerateMetafileProc callback, IntPtr callbackData,
+ ImageAttributes imageAttr)
+ {
+ IntPtr mf = (metafile == null ? IntPtr.Zero : metafile.nativeImage);
+ IntPtr ia = (imageAttr == null ? IntPtr.Zero : imageAttr.nativeImageAttributes);
+
+ int status = SafeNativeMethods.Gdip.GdipEnumerateMetafileDestPointI(new HandleRef(this, NativeGraphics),
+ new HandleRef(metafile, mf),
+ new GPPOINT(destPoint),
+ callback,
+ new HandleRef(null, callbackData),
+ new HandleRef(imageAttr, ia));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile6"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, RectangleF destRect,
+ EnumerateMetafileProc callback)
+ {
+ EnumerateMetafile(metafile, destRect, callback, IntPtr.Zero);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile7"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, RectangleF destRect,
+ EnumerateMetafileProc callback, IntPtr callbackData)
+ {
+ EnumerateMetafile(metafile, destRect, callback, callbackData, null);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile8"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
+ public void EnumerateMetafile(Metafile metafile, RectangleF destRect,
+ EnumerateMetafileProc callback, IntPtr callbackData,
+ ImageAttributes imageAttr)
+ {
+ IntPtr mf = (metafile == null ? IntPtr.Zero : metafile.nativeImage);
+ IntPtr ia = (imageAttr == null ? IntPtr.Zero : imageAttr.nativeImageAttributes);
+
+ GPRECTF grf = new GPRECTF(destRect);
+
+ int status = SafeNativeMethods.Gdip.GdipEnumerateMetafileDestRect(
+ new HandleRef(this, NativeGraphics),
+ new HandleRef(metafile, mf),
+ ref grf,
+ callback,
+ new HandleRef(null, callbackData),
+ new HandleRef(imageAttr, ia));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile9"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, Rectangle destRect,
+ EnumerateMetafileProc callback)
+ {
+ EnumerateMetafile(metafile, destRect, callback, IntPtr.Zero);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile10"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, Rectangle destRect,
+ EnumerateMetafileProc callback, IntPtr callbackData)
+ {
+ EnumerateMetafile(metafile, destRect, callback, callbackData, null);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile11"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
+ public void EnumerateMetafile(Metafile metafile, Rectangle destRect,
+ EnumerateMetafileProc callback, IntPtr callbackData,
+ ImageAttributes imageAttr)
+ {
+ IntPtr mf = (metafile == null ? IntPtr.Zero : metafile.nativeImage);
+ IntPtr ia = (imageAttr == null ? IntPtr.Zero : imageAttr.nativeImageAttributes);
+
+ GPRECT gprect = new GPRECT(destRect);
+ int status = SafeNativeMethods.Gdip.GdipEnumerateMetafileDestRectI(new HandleRef(this, NativeGraphics),
+ new HandleRef(metafile, mf),
+ ref gprect,
+ callback,
+ new HandleRef(null, callbackData),
+ new HandleRef(imageAttr, ia));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile12"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, PointF[] destPoints,
+ EnumerateMetafileProc callback)
+ {
+ EnumerateMetafile(metafile, destPoints, callback, IntPtr.Zero);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile13"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, PointF[] destPoints,
+ EnumerateMetafileProc callback, IntPtr callbackData)
+ {
+ EnumerateMetafile(metafile, destPoints, callback, IntPtr.Zero, null);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile14"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
+ public void EnumerateMetafile(Metafile metafile, PointF[] destPoints,
+ EnumerateMetafileProc callback, IntPtr callbackData,
+ ImageAttributes imageAttr)
+ {
+ if (destPoints == null)
+ throw new ArgumentNullException("destPoints");
+ if (destPoints.Length != 3)
+ {
+ throw new ArgumentException(SR.Format(SR.GdiplusDestPointsInvalidParallelogram));
+ }
+
+ IntPtr mf = (metafile == null ? IntPtr.Zero : metafile.nativeImage);
+ IntPtr ia = (imageAttr == null ? IntPtr.Zero : imageAttr.nativeImageAttributes);
+
+ IntPtr points = SafeNativeMethods.Gdip.ConvertPointToMemory(destPoints);
+
+ int status = SafeNativeMethods.Gdip.GdipEnumerateMetafileDestPoints(new HandleRef(this, NativeGraphics),
+ new HandleRef(metafile, mf),
+ points,
+ destPoints.Length,
+ callback,
+ new HandleRef(null, callbackData),
+ new HandleRef(imageAttr, ia));
+ Marshal.FreeHGlobal(points);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile15"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, Point[] destPoints,
+ EnumerateMetafileProc callback)
+ {
+ EnumerateMetafile(metafile, destPoints, callback, IntPtr.Zero);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile16"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, Point[] destPoints,
+ EnumerateMetafileProc callback, IntPtr callbackData)
+ {
+ EnumerateMetafile(metafile, destPoints, callback, callbackData, null);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile17"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
+ public void EnumerateMetafile(Metafile metafile, Point[] destPoints,
+ EnumerateMetafileProc callback, IntPtr callbackData,
+ ImageAttributes imageAttr)
+ {
+ if (destPoints == null)
+ throw new ArgumentNullException("destPoints");
+ if (destPoints.Length != 3)
+ {
+ throw new ArgumentException(SR.Format(SR.GdiplusDestPointsInvalidParallelogram));
+ }
+
+ IntPtr mf = (metafile == null ? IntPtr.Zero : metafile.nativeImage);
+ IntPtr ia = (imageAttr == null ? IntPtr.Zero : imageAttr.nativeImageAttributes);
+
+ IntPtr points = SafeNativeMethods.Gdip.ConvertPointToMemory(destPoints);
+
+ int status = SafeNativeMethods.Gdip.GdipEnumerateMetafileDestPointsI(new HandleRef(this, NativeGraphics),
+ new HandleRef(metafile, mf),
+ points,
+ destPoints.Length,
+ callback,
+ new HandleRef(null, callbackData),
+ new HandleRef(imageAttr, ia));
+ Marshal.FreeHGlobal(points);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile18"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, PointF destPoint,
+ RectangleF srcRect, GraphicsUnit srcUnit,
+ EnumerateMetafileProc callback)
+ {
+ EnumerateMetafile(metafile, destPoint, srcRect, srcUnit, callback, IntPtr.Zero);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile19"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, PointF destPoint,
+ RectangleF srcRect, GraphicsUnit srcUnit,
+ EnumerateMetafileProc callback, IntPtr callbackData)
+ {
+ EnumerateMetafile(metafile, destPoint, srcRect, srcUnit, callback, callbackData, null);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile20"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
+ public void EnumerateMetafile(Metafile metafile, PointF destPoint,
+ RectangleF srcRect, GraphicsUnit unit,
+ EnumerateMetafileProc callback, IntPtr callbackData,
+ ImageAttributes imageAttr)
+ {
+ IntPtr mf = (metafile == null ? IntPtr.Zero : metafile.nativeImage);
+ IntPtr ia = (imageAttr == null ? IntPtr.Zero : imageAttr.nativeImageAttributes);
+
+ GPRECTF grf = new GPRECTF(srcRect);
+
+ int status = SafeNativeMethods.Gdip.GdipEnumerateMetafileSrcRectDestPoint(new HandleRef(this, NativeGraphics),
+ new HandleRef(metafile, mf),
+ new GPPOINTF(destPoint),
+ ref grf,
+ unchecked((int)unit),
+ callback,
+ new HandleRef(null, callbackData),
+ new HandleRef(imageAttr, ia));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile21"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, Point destPoint,
+ Rectangle srcRect, GraphicsUnit srcUnit,
+ EnumerateMetafileProc callback)
+ {
+ EnumerateMetafile(metafile, destPoint, srcRect, srcUnit, callback, IntPtr.Zero);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile22"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, Point destPoint,
+ Rectangle srcRect, GraphicsUnit srcUnit,
+ EnumerateMetafileProc callback, IntPtr callbackData)
+ {
+ EnumerateMetafile(metafile, destPoint, srcRect, srcUnit, callback, callbackData, null);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile23"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
+ public void EnumerateMetafile(Metafile metafile, Point destPoint,
+ Rectangle srcRect, GraphicsUnit unit,
+ EnumerateMetafileProc callback, IntPtr callbackData,
+ ImageAttributes imageAttr)
+ {
+ IntPtr mf = (metafile == null ? IntPtr.Zero : metafile.nativeImage);
+ IntPtr ia = (imageAttr == null ? IntPtr.Zero : imageAttr.nativeImageAttributes);
+
+ GPPOINT gppoint = new GPPOINT(destPoint);
+ GPRECT gprect = new GPRECT(srcRect);
+
+ int status = SafeNativeMethods.Gdip.GdipEnumerateMetafileSrcRectDestPointI(new HandleRef(this, NativeGraphics),
+ new HandleRef(metafile, mf),
+ gppoint,
+ ref gprect,
+ unchecked((int)unit),
+ callback,
+ new HandleRef(null, callbackData),
+ new HandleRef(imageAttr, ia));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile24"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, RectangleF destRect,
+ RectangleF srcRect, GraphicsUnit srcUnit,
+ EnumerateMetafileProc callback)
+ {
+ EnumerateMetafile(metafile, destRect, srcRect, srcUnit, callback, IntPtr.Zero);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile25"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, RectangleF destRect,
+ RectangleF srcRect, GraphicsUnit srcUnit,
+ EnumerateMetafileProc callback, IntPtr callbackData)
+ {
+ EnumerateMetafile(metafile, destRect, srcRect, srcUnit, callback, callbackData, null);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile26"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
+ public void EnumerateMetafile(Metafile metafile, RectangleF destRect,
+ RectangleF srcRect, GraphicsUnit unit,
+ EnumerateMetafileProc callback, IntPtr callbackData,
+ ImageAttributes imageAttr)
+ {
+ IntPtr mf = (metafile == null ? IntPtr.Zero : metafile.nativeImage);
+ IntPtr ia = (imageAttr == null ? IntPtr.Zero : imageAttr.nativeImageAttributes);
+
+ GPRECTF grfdest = new GPRECTF(destRect);
+ GPRECTF grfsrc = new GPRECTF(srcRect);
+
+ int status = SafeNativeMethods.Gdip.GdipEnumerateMetafileSrcRectDestRect(
+ new HandleRef(this, NativeGraphics),
+ new HandleRef(metafile, mf),
+ ref grfdest,
+ ref grfsrc,
+ unchecked((int)unit),
+ callback,
+ new HandleRef(null, callbackData),
+ new HandleRef(imageAttr, ia));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile27"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, Rectangle destRect,
+ Rectangle srcRect, GraphicsUnit srcUnit,
+ EnumerateMetafileProc callback)
+ {
+ EnumerateMetafile(metafile, destRect, srcRect, srcUnit, callback, IntPtr.Zero);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile28"]/*' />
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, Rectangle destRect,
+ Rectangle srcRect, GraphicsUnit srcUnit,
+ EnumerateMetafileProc callback, IntPtr callbackData)
+ {
+ EnumerateMetafile(metafile, destRect, srcRect, srcUnit, callback, callbackData, null);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile29"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, Rectangle destRect,
+ Rectangle srcRect, GraphicsUnit unit,
+ EnumerateMetafileProc callback, IntPtr callbackData,
+ ImageAttributes imageAttr)
+ {
+ IntPtr mf = (metafile == null ? IntPtr.Zero : metafile.nativeImage);
+ IntPtr ia = (imageAttr == null ? IntPtr.Zero : imageAttr.nativeImageAttributes);
+
+ GPRECT gpDest = new GPRECT(destRect);
+ GPRECT gpSrc = new GPRECT(srcRect);
+
+ int status = SafeNativeMethods.Gdip.GdipEnumerateMetafileSrcRectDestRectI(new HandleRef(this, NativeGraphics),
+ new HandleRef(metafile, mf),
+ ref gpDest,
+ ref gpSrc,
+ unchecked((int)unit),
+ callback,
+ new HandleRef(null, callbackData),
+ new HandleRef(imageAttr, ia));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile30"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, PointF[] destPoints,
+ RectangleF srcRect, GraphicsUnit srcUnit,
+ EnumerateMetafileProc callback)
+ {
+ EnumerateMetafile(metafile, destPoints, srcRect, srcUnit, callback, IntPtr.Zero);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile31"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, PointF[] destPoints,
+ RectangleF srcRect, GraphicsUnit srcUnit,
+ EnumerateMetafileProc callback, IntPtr callbackData)
+ {
+ EnumerateMetafile(metafile, destPoints, srcRect, srcUnit, callback, callbackData, null);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile32"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, PointF[] destPoints,
+ RectangleF srcRect, GraphicsUnit unit,
+ EnumerateMetafileProc callback, IntPtr callbackData,
+ ImageAttributes imageAttr)
+ {
+ if (destPoints == null)
+ throw new ArgumentNullException("destPoints");
+ if (destPoints.Length != 3)
+ {
+ throw new ArgumentException(SR.Format(SR.GdiplusDestPointsInvalidParallelogram));
+ }
+
+ IntPtr mf = (metafile == null ? IntPtr.Zero : metafile.nativeImage);
+ IntPtr ia = (imageAttr == null ? IntPtr.Zero : imageAttr.nativeImageAttributes);
+
+ IntPtr buffer = SafeNativeMethods.Gdip.ConvertPointToMemory(destPoints);
+
+ GPRECTF grf = new GPRECTF(srcRect);
+
+ int status = SafeNativeMethods.Gdip.GdipEnumerateMetafileSrcRectDestPoints(new HandleRef(this, NativeGraphics),
+ new HandleRef(metafile, mf),
+ buffer,
+ destPoints.Length,
+ ref grf,
+ unchecked((int)unit),
+ callback,
+ new HandleRef(null, callbackData),
+ new HandleRef(imageAttr, ia));
+ Marshal.FreeHGlobal(buffer);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile33"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, Point[] destPoints,
+ Rectangle srcRect, GraphicsUnit srcUnit,
+ EnumerateMetafileProc callback)
+ {
+ EnumerateMetafile(metafile, destPoints, srcRect, srcUnit, callback, IntPtr.Zero);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile34"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, Point[] destPoints,
+ Rectangle srcRect, GraphicsUnit srcUnit,
+ EnumerateMetafileProc callback, IntPtr callbackData)
+ {
+ EnumerateMetafile(metafile, destPoints, srcRect, srcUnit, callback, callbackData, null);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EnumerateMetafile35"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void EnumerateMetafile(Metafile metafile, Point[] destPoints,
+ Rectangle srcRect, GraphicsUnit unit,
+ EnumerateMetafileProc callback, IntPtr callbackData,
+ ImageAttributes imageAttr)
+ {
+ if (destPoints == null)
+ throw new ArgumentNullException("destPoints");
+ if (destPoints.Length != 3)
+ {
+ throw new ArgumentException(SR.Format(SR.GdiplusDestPointsInvalidParallelogram));
+ }
+
+ IntPtr mf = (metafile == null ? IntPtr.Zero : metafile.nativeImage);
+ IntPtr ia = (imageAttr == null ? IntPtr.Zero : imageAttr.nativeImageAttributes);
+
+ IntPtr buffer = SafeNativeMethods.Gdip.ConvertPointToMemory(destPoints);
+
+ GPRECT gpSrc = new GPRECT(srcRect);
+
+ int status = SafeNativeMethods.Gdip.GdipEnumerateMetafileSrcRectDestPointsI(new HandleRef(this, NativeGraphics),
+ new HandleRef(metafile, mf),
+ buffer,
+ destPoints.Length,
+ ref gpSrc,
+ unchecked((int)unit),
+ callback,
+ new HandleRef(null, callbackData),
+ new HandleRef(imageAttr, ia));
+ Marshal.FreeHGlobal(buffer);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+
+ /*
+ * Clipping region operations
+ *
+ * @notes Simply incredible redundancy here.
+ */
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.SetClip"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void SetClip(Graphics g)
+ {
+ SetClip(g, CombineMode.Replace);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.SetClip1"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void SetClip(Graphics g, CombineMode combineMode)
+ {
+ if (g == null)
+ {
+ throw new ArgumentNullException("g");
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipSetClipGraphics(new HandleRef(this, NativeGraphics), new HandleRef(g, g.NativeGraphics), combineMode);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.SetClip2"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void SetClip(Rectangle rect)
+ {
+ SetClip(rect, CombineMode.Replace);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.SetClip3"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void SetClip(Rectangle rect, CombineMode combineMode)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetClipRectI(new HandleRef(this, NativeGraphics), rect.X, rect.Y,
+ rect.Width, rect.Height, combineMode);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.SetClip4"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void SetClip(RectangleF rect)
+ {
+ SetClip(rect, CombineMode.Replace);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.SetClip5"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void SetClip(RectangleF rect, CombineMode combineMode)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetClipRect(new HandleRef(this, NativeGraphics), rect.X, rect.Y,
+ rect.Width, rect.Height, combineMode);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.SetClip6"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void SetClip(GraphicsPath path)
+ {
+ SetClip(path, CombineMode.Replace);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.SetClip7"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void SetClip(GraphicsPath path, CombineMode combineMode)
+ {
+ if (path == null)
+ {
+ throw new ArgumentNullException("path");
+ }
+ int status = SafeNativeMethods.Gdip.GdipSetClipPath(new HandleRef(this, NativeGraphics), new HandleRef(path, path.nativePath), combineMode);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.SetClip8"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void SetClip(Region region, CombineMode combineMode)
+ {
+ if (region == null)
+ {
+ throw new ArgumentNullException("region");
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipSetClipRegion(new HandleRef(this, NativeGraphics), new HandleRef(region, region.nativeRegion), combineMode);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.IntersectClip"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void IntersectClip(Rectangle rect)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetClipRectI(new HandleRef(this, NativeGraphics), rect.X, rect.Y,
+ rect.Width, rect.Height, CombineMode.Intersect);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.IntersectClip1"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void IntersectClip(RectangleF rect)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetClipRect(new HandleRef(this, NativeGraphics), rect.X, rect.Y,
+ rect.Width, rect.Height, CombineMode.Intersect);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.IntersectClip2"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void IntersectClip(Region region)
+ {
+ if (region == null)
+ throw new ArgumentNullException("region");
+
+ int status = SafeNativeMethods.Gdip.GdipSetClipRegion(new HandleRef(this, NativeGraphics), new HandleRef(region, region.nativeRegion),
+ CombineMode.Intersect);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.ExcludeClip"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void ExcludeClip(Rectangle rect)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetClipRectI(new HandleRef(this, NativeGraphics), rect.X, rect.Y,
+ rect.Width, rect.Height, CombineMode.Exclude);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.ExcludeClip1"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void ExcludeClip(Region region)
+ {
+ if (region == null)
+ throw new ArgumentNullException("region");
+
+ int status = SafeNativeMethods.Gdip.GdipSetClipRegion(new HandleRef(this, NativeGraphics),
+ new HandleRef(region, region.nativeRegion),
+ CombineMode.Exclude);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.ResetClip"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void ResetClip()
+ {
+ int status = SafeNativeMethods.Gdip.GdipResetClip(new HandleRef(this, NativeGraphics));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.TranslateClip"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void TranslateClip(float dx, float dy)
+ {
+ int status = SafeNativeMethods.Gdip.GdipTranslateClip(new HandleRef(this, NativeGraphics), dx, dy);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.TranslateClip1"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void TranslateClip(int dx, int dy)
+ {
+ int status = SafeNativeMethods.Gdip.GdipTranslateClip(new HandleRef(this, NativeGraphics), dx, dy);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <devdoc>
+ /// Combines current Graphics context with all previous contexts.
+ /// When BeginContainer() is called, a copy of the current context is pushed into the GDI+ context stack, it keeps track of the
+ /// absolute clipping and transform but reset the public properties so it looks like a brand new context.
+ /// When Save() is called, a copy of the current context is also pushed in the GDI+ stack but the public clipping and transform
+ /// properties are not reset (cumulative). Consecutive Save context are ignored with the exception of the top one which contains
+ /// all previous information.
+ /// The return value is an object array where the first element contains the cumulative clip region and the second the cumulative
+ /// translate transform matrix.
+ /// WARNING: This method is for internal FX support only.
+ /// </devdoc>
+ [StrongNameIdentityPermissionAttribute(SecurityAction.LinkDemand, Name = "System.Windows.Forms", PublicKey = "0x00000000000000000400000000000000")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object GetContextInfo()
+ {
+ Region cumulClip = Clip; // current context clip.
+ Matrix cumulTransform = Transform; // current context transform.
+ PointF currentOffset = PointF.Empty; // offset of current context.
+ PointF totalOffset = PointF.Empty; // absolute coord offset of top context.
+
+ if (!cumulTransform.IsIdentity)
+ {
+ float[] elements = cumulTransform.Elements;
+ currentOffset.X = elements[4];
+ currentOffset.Y = elements[5];
+ }
+
+ GraphicsContext context = _previousContext;
+
+ while (context != null)
+ {
+ if (!context.TransformOffset.IsEmpty)
+ {
+ cumulTransform.Translate(context.TransformOffset.X, context.TransformOffset.Y);
+ }
+
+ if (!currentOffset.IsEmpty)
+ {
+ // The location of the GDI+ clip region is relative to the coordinate origin after any translate transform
+ // has been applied. We need to intersect regions using the same coordinate origin relative to the previous
+ // context.
+ cumulClip.Translate(currentOffset.X, currentOffset.Y);
+ totalOffset.X += currentOffset.X;
+ totalOffset.Y += currentOffset.Y;
+ }
+
+ if (context.Clip != null)
+ {
+ cumulClip.Intersect(context.Clip);
+ }
+
+ currentOffset = context.TransformOffset;
+
+ // Ignore subsequent cumulative contexts.
+ do
+ {
+ context = context.Previous;
+
+ if (context == null || !context.Next.IsCumulative)
+ {
+ break;
+ }
+ } while (context.IsCumulative);
+ }
+
+ if (!totalOffset.IsEmpty)
+ {
+ // We need now to reset the total transform in the region so when calling Region.GetHRgn(Graphics)
+ // the HRegion is properly offset by GDI+ based on the total offset of the graphics object.
+ cumulClip.Translate(-totalOffset.X, -totalOffset.Y);
+ }
+
+ return new object[] { cumulClip, cumulTransform };
+ }
+
+
+ /**
+ * GetClip region from graphics context
+ */
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.Clip"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public Region Clip
+ {
+ get
+ {
+ Region region = new Region();
+
+ int status = SafeNativeMethods.Gdip.GdipGetClip(new HandleRef(this, NativeGraphics), new HandleRef(region, region.nativeRegion));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return region;
+ }
+ set
+ {
+ SetClip(value, CombineMode.Replace);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.ClipBounds"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public RectangleF ClipBounds
+ {
+ get
+ {
+ GPRECTF rect = new GPRECTF();
+
+ int status = SafeNativeMethods.Gdip.GdipGetClipBounds(new HandleRef(this, NativeGraphics), ref rect);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return rect.ToRectangleF();
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.IsClipEmpty"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public bool IsClipEmpty
+ {
+ get
+ {
+ int isEmpty;
+
+ int status = SafeNativeMethods.Gdip.GdipIsClipEmpty(new HandleRef(this, NativeGraphics), out isEmpty);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return isEmpty != 0;
+ }
+ }
+
+ /**
+ * Hit testing operations
+ */
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.VisibleClipBounds"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public RectangleF VisibleClipBounds
+ {
+ get
+ {
+ if (PrintingHelper != null)
+ {
+ PrintPreviewGraphics ppGraphics = PrintingHelper as PrintPreviewGraphics;
+ if (ppGraphics != null)
+ {
+ return ppGraphics.VisibleClipBounds;
+ }
+ }
+
+ GPRECTF rect = new GPRECTF();
+
+ int status = SafeNativeMethods.Gdip.GdipGetVisibleClipBounds(new HandleRef(this, NativeGraphics), ref rect);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return rect.ToRectangleF();
+ }
+ }
+
+ /**
+ * @notes atomic operation? status needed?
+ */
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.IsVisibleClipEmpty"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public bool IsVisibleClipEmpty
+ {
+ get
+ {
+ int isEmpty;
+
+ int status = SafeNativeMethods.Gdip.GdipIsVisibleClipEmpty(new HandleRef(this, NativeGraphics), out isEmpty);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return isEmpty != 0;
+ }
+ }
+
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.IsVisible"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public bool IsVisible(int x, int y)
+ {
+ return IsVisible(new Point(x, y));
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.IsVisible1"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public bool IsVisible(Point point)
+ {
+ int isVisible;
+
+ int status = SafeNativeMethods.Gdip.GdipIsVisiblePointI(new HandleRef(this, NativeGraphics), point.X, point.Y, out isVisible);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return isVisible != 0;
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.IsVisible2"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public bool IsVisible(float x, float y)
+ {
+ return IsVisible(new PointF(x, y));
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.IsVisible3"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public bool IsVisible(PointF point)
+ {
+ int isVisible;
+
+ int status = SafeNativeMethods.Gdip.GdipIsVisiblePoint(new HandleRef(this, NativeGraphics), point.X, point.Y, out isVisible);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return isVisible != 0;
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.IsVisible4"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public bool IsVisible(int x, int y, int width, int height)
+ {
+ return IsVisible(new Rectangle(x, y, width, height));
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.IsVisible5"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public bool IsVisible(Rectangle rect)
+ {
+ int isVisible;
+
+ int status = SafeNativeMethods.Gdip.GdipIsVisibleRectI(new HandleRef(this, NativeGraphics), rect.X, rect.Y,
+ rect.Width, rect.Height, out isVisible);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return isVisible != 0;
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.IsVisible6"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public bool IsVisible(float x, float y, float width, float height)
+ {
+ return IsVisible(new RectangleF(x, y, width, height));
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.IsVisible7"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public bool IsVisible(RectangleF rect)
+ {
+ int isVisible;
+
+ int status = SafeNativeMethods.Gdip.GdipIsVisibleRect(new HandleRef(this, NativeGraphics), rect.X, rect.Y,
+ rect.Width, rect.Height, out isVisible);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return isVisible != 0;
+ }
+
+ /// <devdoc>
+ /// Saves the current context into the context stack.
+ /// </devdoc>
+ private void PushContext(GraphicsContext context)
+ {
+ Debug.Assert(context != null && context.State != 0, "GraphicsContext object is null or not valid.");
+
+ if (_previousContext != null)
+ {
+ // Push context.
+ context.Previous = _previousContext;
+ _previousContext.Next = context;
+ }
+ _previousContext = context;
+ }
+
+ /// <devdoc>
+ /// Pops all contexts from the specified one included. The specified context is becoming the current context.
+ /// </devdoc>
+ private void PopContext(int currentContextState)
+ {
+ Debug.Assert(_previousContext != null, "Trying to restore a context when the stack is empty");
+ GraphicsContext context = _previousContext;
+
+ while (context != null)
+ {
+ if (context.State == currentContextState)
+ {
+ _previousContext = context.Previous;
+ // Pop all contexts up the stack.
+ context.Dispose(); // This will dipose all context object up the stack.
+ return;
+ }
+ context = context.Previous;
+ }
+ Debug.Fail("Warning: context state not found!");
+ }
+
+ /**
+ * Save/restore graphics state
+ */
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.Save"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public GraphicsState Save()
+ {
+ GraphicsContext context = new GraphicsContext(this);
+ int state = 0;
+
+ int status = SafeNativeMethods.Gdip.GdipSaveGraphics(new HandleRef(this, NativeGraphics), out state);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ context.Dispose();
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ context.State = state;
+ context.IsCumulative = true;
+ PushContext(context);
+
+ return new GraphicsState(state);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.Restore"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void Restore(GraphicsState gstate)
+ {
+ int status = SafeNativeMethods.Gdip.GdipRestoreGraphics(new HandleRef(this, NativeGraphics), gstate.nativeState);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ PopContext(gstate.nativeState);
+ }
+
+ /*
+ * Begin and end container drawing
+ */
+ // float version
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.BeginContainer"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public GraphicsContainer BeginContainer(RectangleF dstrect, RectangleF srcrect, GraphicsUnit unit)
+ {
+ GraphicsContext context = new GraphicsContext(this);
+ int state = 0;
+
+ GPRECTF dstf = dstrect.ToGPRECTF();
+ GPRECTF srcf = srcrect.ToGPRECTF();
+
+ int status = SafeNativeMethods.Gdip.GdipBeginContainer(new HandleRef(this, NativeGraphics), ref dstf,
+ ref srcf, unchecked((int)unit), out state);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ context.Dispose();
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ context.State = state;
+ PushContext(context);
+
+ return new GraphicsContainer(state);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.BeginContainer1"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public GraphicsContainer BeginContainer()
+ {
+ GraphicsContext context = new GraphicsContext(this);
+ int state = 0;
+
+ int status = SafeNativeMethods.Gdip.GdipBeginContainer2(new HandleRef(this, NativeGraphics), out state);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ context.Dispose();
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ context.State = state;
+ PushContext(context);
+
+ return new GraphicsContainer(state);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.EndContainer"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void EndContainer(GraphicsContainer container)
+ {
+ if (container == null)
+ {
+ throw new ArgumentNullException("container");
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipEndContainer(new HandleRef(this, NativeGraphics), container.nativeGraphicsContainer);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ PopContext(container.nativeGraphicsContainer);
+ }
+
+ // int version
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.BeginContainer2"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public GraphicsContainer BeginContainer(Rectangle dstrect, Rectangle srcrect, GraphicsUnit unit)
+ {
+ GraphicsContext context = new GraphicsContext(this);
+ int state = 0;
+
+ GPRECT gpDest = new GPRECT(dstrect);
+ GPRECT gpSrc = new GPRECT(srcrect);
+
+ int status = SafeNativeMethods.Gdip.GdipBeginContainerI(new HandleRef(this, NativeGraphics), ref gpDest,
+ ref gpSrc, unchecked((int)unit), out state);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ context.Dispose();
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ context.State = state;
+ PushContext(context);
+
+ return new GraphicsContainer(state);
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.AddMetafileComment"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public void AddMetafileComment(byte[] data)
+ {
+ if (data == null)
+ {
+ throw new ArgumentNullException("data");
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipComment(new HandleRef(this, NativeGraphics), data.Length, data);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.GetHalftonePalette"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public static IntPtr GetHalftonePalette()
+ {
+ if (s_halftonePalette == IntPtr.Zero)
+ {
+ lock (s_syncObject)
+ {
+ if (s_halftonePalette == IntPtr.Zero)
+ {
+ if (!(Environment.OSVersion.Platform == System.PlatformID.Win32Windows))
+ {
+ AppDomain.CurrentDomain.DomainUnload += new EventHandler(OnDomainUnload);
+ }
+ AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnDomainUnload);
+
+ s_halftonePalette = SafeNativeMethods.Gdip.GdipCreateHalftonePalette();
+ }
+ }
+ }
+ return s_halftonePalette;
+ }
+
+ //This will get called for ProcessExit in case for WinNT..
+ //This will get called for ProcessExit AND DomainUnLoad for Win9X...
+ //
+ [PrePrepareMethod]
+ private static void OnDomainUnload(object sender, EventArgs e)
+ {
+ if (s_halftonePalette != IntPtr.Zero)
+ {
+ SafeNativeMethods.IntDeleteObject(new HandleRef(null, s_halftonePalette));
+ s_halftonePalette = IntPtr.Zero;
+ }
+ }
+
+
+ /// <devdoc>
+ /// GDI+ will return a 'generic error' with specific win32 last error codes when
+ /// a terminal server session has been closed, minimized, etc... We don't want
+ /// to throw when this happens, so we'll guard against this by looking at the
+ /// 'last win32 error code' and checking to see if it is either 1) access denied
+ /// or 2) proc not found and then ignore it.
+ ///
+ /// The problem is that when you lock the machine, the secure desktop is enabled and
+ /// rendering fails which is expected (since the app doesn't have permission to draw
+ /// on the secure desktop). Not sure if there's anything you can do, short of catching
+ /// the desktop switch message and absorbing all the exceptions that get thrown while
+ /// it's the secure desktop.
+ /// </devdoc>
+ private void CheckErrorStatus(int status)
+ {
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ // Generic error from GDI+ can be GenericError or Win32Error.
+ if (status == SafeNativeMethods.Gdip.GenericError || status == SafeNativeMethods.Gdip.Win32Error)
+ {
+ int error = Marshal.GetLastWin32Error();
+ if (error == SafeNativeMethods.ERROR_ACCESS_DENIED || error == SafeNativeMethods.ERROR_PROC_NOT_FOUND ||
+ //here, we'll check to see if we are in a term. session...
+ (((UnsafeNativeMethods.GetSystemMetrics(NativeMethods.SM_REMOTESESSION) & 0x00000001) != 0) && (error == 0)))
+ {
+ return;
+ }
+ }
+
+ //legitimate error, throw our status exception
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <devdoc>
+ /// GDI+ will return a 'generic error' when we attempt to draw an Emf
+ /// image with width/height == 1. Here, we will hack around this by
+ /// resetting the errorstatus. Note that we don't do simple arg checking
+ /// for height || width == 1 here because transforms can be applied to
+ /// the Graphics object making it difficult to identify this scenario.
+ /// </devdoc>
+ private void IgnoreMetafileErrors(Image image, ref int errorStatus)
+ {
+ if (errorStatus != SafeNativeMethods.Gdip.Ok)
+ {
+ if (image.RawFormat.Equals(ImageFormat.Emf))
+ {
+ errorStatus = SafeNativeMethods.Gdip.Ok;
+ }
+ }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/GraphicsContext.cs b/src/System.Drawing.Common/src/System/Drawing/GraphicsContext.cs
new file mode 100644
index 0000000000..7728f43160
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/GraphicsContext.cs
@@ -0,0 +1,187 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.Drawing.Drawing2D;
+
+ /// <devdoc>
+ /// Contains information about the context of a Graphics object.
+ /// </devdoc>
+ internal class GraphicsContext : IDisposable
+ {
+ /// <devdoc>
+ /// The state that identifies the context.
+ /// </devdoc>
+ private int _contextState;
+
+ /// <devdoc>
+ /// The context's translate transform.
+ /// </devdoc>
+ private PointF _transformOffset;
+
+ /// <devdoc>
+ /// The context's clip region.
+ /// </devdoc>
+ private Region _clipRegion;
+
+ /// <devdoc>
+ /// The next context up the stack.
+ /// </devdoc>
+ private GraphicsContext _nextContext;
+
+ /// <devdoc>
+ /// The previous context down the stack.
+ /// </devdoc>
+ private GraphicsContext _prevContext;
+
+ /// <devdoc>
+ /// Flags that determines whether the context was created for a Graphics.Save() operation.
+ /// This kind of contexts are cumulative across subsequent Save() calls so the top context
+ /// info is cumulative. This is not the same for contexts created for a Graphics.BeginContainer()
+ /// operation, in this case the new context information is reset. See Graphics.BeginContainer()
+ /// and Graphics.Save() for more information.
+ /// </devdoc>
+ private bool _isCumulative;
+
+ /// <devdoc>
+ /// Private constructor disallowed.
+ /// </devdoc>
+ private GraphicsContext()
+ {
+ }
+
+ public GraphicsContext(Graphics g)
+ {
+ Matrix transform = g.Transform;
+ if (!transform.IsIdentity)
+ {
+ float[] elements = transform.Elements;
+ _transformOffset.X = elements[4];
+ _transformOffset.Y = elements[5];
+ }
+ transform.Dispose();
+
+ Region clip = g.Clip;
+ if (clip.IsInfinite(g))
+ {
+ clip.Dispose();
+ }
+ else
+ {
+ _clipRegion = clip;
+ }
+ }
+
+ /// <devdoc>
+ /// Disposes this and all contexts up the stack.
+ /// </devdoc>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <devdoc>
+ /// Disposes this and all contexts up the stack.
+ /// </devdoc>
+ public void Dispose(bool disposing)
+ {
+ if (_nextContext != null)
+ {
+ // Dispose all contexts up the stack since they are relative to this one and its state will be invalid.
+ _nextContext.Dispose();
+ _nextContext = null;
+ }
+
+ if (_clipRegion != null)
+ {
+ _clipRegion.Dispose();
+ _clipRegion = null;
+ }
+ }
+
+ /// <devdoc>
+ /// The state id representing the GraphicsContext.
+ /// </devdoc>
+ public int State
+ {
+ get
+ {
+ return _contextState;
+ }
+ set
+ {
+ _contextState = value;
+ }
+ }
+
+ /// <devdoc>
+ /// The translate transform in the GraphicsContext.
+ /// </devdoc>
+ public PointF TransformOffset
+ {
+ get
+ {
+ return _transformOffset;
+ }
+ }
+
+ /// <devdoc>
+ /// The clipping region the GraphicsContext.
+ /// </devdoc>
+ public Region Clip
+ {
+ get
+ {
+ return _clipRegion;
+ }
+ }
+
+ /// <devdoc>
+ /// The next GraphicsContext object in the stack.
+ /// </devdoc>
+ public GraphicsContext Next
+ {
+ get
+ {
+ return _nextContext;
+ }
+ set
+ {
+ _nextContext = value;
+ }
+ }
+
+ /// <devdoc>
+ /// The previous GraphicsContext object in the stack.
+ /// </devdoc>
+ public GraphicsContext Previous
+ {
+ get
+ {
+ return _prevContext;
+ }
+ set
+ {
+ _prevContext = value;
+ }
+ }
+
+ /// <devdoc>
+ /// Determines whether this context is cumulative or not. See filed for more info.
+ /// </devdoc>
+ public bool IsCumulative
+ {
+ get
+ {
+ return _isCumulative;
+ }
+ set
+ {
+ _isCumulative = value;
+ }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/IDeviceContext.cs b/src/System.Drawing.Common/src/System/Drawing/IDeviceContext.cs
new file mode 100644
index 0000000000..0209554e72
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/IDeviceContext.cs
@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ /// <include file='doc\IDeviceContext.uex' path='docs/doc[@for="IDeviceContext"]/*' />
+ /// <devdoc>
+ /// This interface defines methods for obtaining a display/window device context handle (Win32 hdc).
+ /// Note: Display and window dc handles are obtained and released using BeginPaint/EndPaint and
+ /// GetDC/ReleaseDC; this interface is intended to be used with the last method only.
+ ///
+ /// Warning to implementors: Creating and releasing non-display dc handles using this interface needs
+ /// special care, for instance using other Win32 functions like CreateDC or CreateCompatibleDC require
+ /// DeleteDC instead of ReleaseDC to properly free the dc handle.
+ ///
+ /// See the DeviceContext class for an implemenation of this interface, it uses the Dispose method
+ /// for freeing non-display dc handles.
+ ///
+ /// This is a low-level API that is expected to be used with TextRenderer or PInvoke calls.
+ /// </devdoc>
+ public interface IDeviceContext : IDisposable
+ {
+ IntPtr GetHdc();
+
+ void ReleaseHdc();
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Icon.cs b/src/System.Drawing.Common/src/System/Drawing/Icon.cs
new file mode 100644
index 0000000000..1bb3a28614
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Icon.cs
@@ -0,0 +1,1117 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.ComponentModel;
+ using System.Diagnostics;
+ using System.Drawing.Imaging;
+ using System.Drawing.Internal;
+ using System.IO;
+ using System.Runtime.InteropServices;
+ using System.Runtime.Serialization;
+ using System.Security.Permissions;
+ using System.Text;
+
+ /// <include file='doc\Icon.uex' path='docs/doc[@for="Icon"]/*' />
+ /// <devdoc>
+ /// This class represents a Windows icon, which is a small bitmap image used to
+ /// represent an object. Icons can be thought of as transparent bitmaps, although
+ /// their size is determined by the system.
+ /// </devdoc>
+ [Serializable]
+ public sealed class Icon : MarshalByRefObject, ISerializable, ICloneable, IDisposable
+ {
+#if FINALIZATION_WATCH
+ private string allocationSite = Graphics.GetAllocationStack();
+#endif
+
+ private static int s_bitDepth;
+
+ // The PNG signature is specified at:
+ // http://www.w3.org/TR/PNG/#5PNG-file-signature
+ private const int PNGSignature1 = 137 + ('P' << 8) + ('N' << 16) + ('G' << 24);
+ private const int PNGSignature2 = 13 + (10 << 8) + (26 << 16) + (10 << 24);
+
+ // Icon data
+ //
+ private byte[] _iconData;
+ private int _bestImageOffset;
+ private int _bestBitDepth;
+ private int _bestBytesInRes;
+ private bool? _isBestImagePng = null;
+ private Size _iconSize = System.Drawing.Size.Empty;
+ private IntPtr _handle = IntPtr.Zero;
+ private bool _ownHandle = true;
+
+ private Icon()
+ {
+ }
+
+ internal Icon(IntPtr handle) : this(handle, false)
+ {
+ }
+
+ internal Icon(IntPtr handle, bool takeOwnership)
+ {
+ if (handle == IntPtr.Zero)
+ {
+ throw new ArgumentException(SR.Format(SR.InvalidGDIHandle, (typeof(Icon)).Name));
+ }
+ _handle = handle;
+ _ownHandle = takeOwnership;
+ }
+
+
+
+ /// <include file='doc\Icon.uex' path='docs/doc[@for="Icon.Icon"]/*' />
+ /// <devdoc>
+ /// Loads an icon object from the given filename.
+ /// </devdoc>
+ public Icon(string fileName) : this(fileName, 0, 0)
+ {
+ }
+
+ public Icon(string fileName, Size size) : this(fileName, size.Width, size.Height)
+ {
+ }
+
+ public Icon(string fileName, int width, int height) : this()
+ {
+ using (FileStream f = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read))
+ {
+ Debug.Assert(f != null, "File.OpenRead returned null instead of throwing an exception");
+ _iconData = new byte[(int)f.Length];
+ f.Read(_iconData, 0, _iconData.Length);
+ }
+
+ Initialize(width, height);
+ }
+
+ /// <include file='doc\Icon.uex' path='docs/doc[@for="Icon.Icon1"]/*' />
+ /// <devdoc>
+ /// Duplicates the given icon, attempting to find a version of the icon
+ /// that matches the requested size. If a version cannot be found that
+ /// exactally matches the size, the closest match will be used. Note
+ /// that if original is an icon with a single size, this will
+ /// merely create a dupicate icon. You can use the stretching modes
+ /// of drawImage to force the icon to the size you want.
+ /// </devdoc>
+ public Icon(Icon original, Size size) : this(original, size.Width, size.Height)
+ {
+ }
+
+ /// <include file='doc\Icon.uex' path='docs/doc[@for="Icon.Icon2"]/*' />
+ /// <devdoc>
+ /// Duplicates the given icon, attempting to find a version of the icon
+ /// that matches the requested size. If a version cannot be found that
+ /// exactally matches the size, the closest match will be used. Note
+ /// that if original is an icon with a single size, this will
+ /// merely create a dupicate icon. You can use the stretching modes
+ /// of drawImage to force the icon to the size you want.
+ /// </devdoc>
+ public Icon(Icon original, int width, int height) : this()
+ {
+ if (original == null)
+ {
+ throw new ArgumentException(SR.Format(SR.InvalidArgument, "original", "null"));
+ }
+
+ _iconData = original._iconData;
+
+ if (_iconData == null)
+ {
+ _iconSize = original.Size;
+ _handle = SafeNativeMethods.CopyImage(new HandleRef(original, original.Handle), SafeNativeMethods.IMAGE_ICON, _iconSize.Width, _iconSize.Height, 0);
+ }
+ else
+ {
+ Initialize(width, height);
+ }
+ }
+
+ /// <include file='doc\Icon.uex' path='docs/doc[@for="Icon.Icon3"]/*' />
+ /// <devdoc>
+ /// Loads an icon object from the given resource.
+ /// </devdoc>
+ public Icon(Type type, string resource) : this()
+ {
+ Stream stream = type.Module.Assembly.GetManifestResourceStream(type, resource);
+ if (stream == null)
+ {
+ throw new ArgumentException(SR.Format(SR.ResourceNotFound, type, resource));
+ }
+
+ _iconData = new byte[(int)stream.Length];
+ stream.Read(_iconData, 0, _iconData.Length);
+ Initialize(0, 0);
+ }
+
+ /// <include file='doc\Icon.uex' path='docs/doc[@for="Icon.Icon4"]/*' />
+ /// <devdoc>
+ /// Loads an icon object from the given data stream.
+ /// </devdoc>
+ public Icon(Stream stream) : this(stream, 0, 0)
+ {
+ }
+ public Icon(Stream stream, Size size) : this(stream, size.Width, size.Height)
+ {
+ }
+
+ /// <include file='doc\Icon.uex' path='docs/doc[@for="Icon.Icon5"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public Icon(Stream stream, int width, int height) : this()
+ {
+ if (stream == null)
+ {
+ throw new ArgumentException(SR.Format(SR.InvalidArgument, "stream", "null"));
+ }
+
+ _iconData = new byte[(int)stream.Length];
+ stream.Read(_iconData, 0, _iconData.Length);
+ Initialize(width, height);
+ }
+
+
+
+ /// <include file='doc\Icon.uex' path='docs/doc[@for="Icon.Icon6"]/*' />
+ /// <devdoc>
+ /// Constructor used in deserialization
+ /// </devdoc>
+ /// <internalonly/>
+ private Icon(SerializationInfo info, StreamingContext context)
+ {
+ _iconData = (byte[])info.GetValue("IconData", typeof(byte[]));
+ _iconSize = (Size)info.GetValue("IconSize", typeof(Size));
+
+ if (_iconSize.IsEmpty)
+ {
+ Initialize(0, 0);
+ }
+ else
+ {
+ Initialize(_iconSize.Width, _iconSize.Height);
+ }
+ }
+
+ /// <include file='doc\Icon.uex' path='docs/doc[@for="Icon.ExtractAssociatedIcon"]/*' />
+ /// <devdoc>
+ /// Extracts an icon object from the given filename.
+ /// </devdoc>
+ public static Icon ExtractAssociatedIcon(string filePath)
+ {
+ return ExtractAssociatedIcon(filePath, 0);
+ }
+
+ /// <include file='doc\Icon.uex' path='docs/doc[@for="Icon.ExtractAssociatedIcon"]/*' />
+ /// <devdoc>
+ /// Extracts an icon object from the given filename.
+ /// </devdoc>
+ private static Icon ExtractAssociatedIcon(string filePath, int index)
+ {
+ if (filePath == null)
+ {
+ throw new ArgumentException(SR.Format(SR.InvalidArgument, "filePath", "null"));
+ }
+
+ Uri uri;
+ try
+ {
+ uri = new Uri(filePath);
+ }
+ catch (UriFormatException)
+ {
+ // It's a relative pathname, get its full path as a file.
+ filePath = Path.GetFullPath(filePath);
+ uri = new Uri(filePath);
+ }
+ if (uri.IsUnc)
+ {
+ throw new ArgumentException(SR.Format(SR.InvalidArgument, "filePath", filePath));
+ }
+ if (uri.IsFile)
+ {
+ if (!File.Exists(filePath))
+ {
+ throw new FileNotFoundException(filePath);
+ }
+
+ Icon icon = new Icon();
+
+ StringBuilder sb = new StringBuilder(NativeMethods.MAX_PATH);
+ sb.Append(filePath);
+
+ IntPtr hIcon = SafeNativeMethods.ExtractAssociatedIcon(NativeMethods.NullHandleRef, sb, ref index);
+
+ if (hIcon != IntPtr.Zero)
+ {
+ icon = new Icon(hIcon, true);
+ return icon;
+ }
+ }
+ return null;
+ }
+
+ /// <include file='doc\Icon.uex' path='docs/doc[@for="Icon.Handle"]/*' />
+ /// <devdoc>
+ /// The Win32 handle for this object. This is not a copy of the handle; do
+ /// not free it.
+ /// </devdoc>
+ [Browsable(false)]
+ public IntPtr Handle
+ {
+ get
+ {
+ if (_handle == IntPtr.Zero)
+ {
+ throw new ObjectDisposedException(GetType().Name);
+ }
+ return _handle;
+ }
+ }
+
+ /// <include file='doc\Icon.uex' path='docs/doc[@for="Icon.Height"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ [Browsable(false)]
+ public int Height
+ {
+ get { return Size.Height; }
+ }
+
+ /// <include file='doc\Icon.uex' path='docs/doc[@for="Icon.Size"]/*' />
+ /// <devdoc>
+ /// The size of this icon object.
+ /// </devdoc>
+ public Size Size
+ {
+ get
+ {
+ if (_iconSize.IsEmpty)
+ {
+ SafeNativeMethods.ICONINFO info = new SafeNativeMethods.ICONINFO();
+ SafeNativeMethods.GetIconInfo(new HandleRef(this, Handle), info);
+ SafeNativeMethods.BITMAP bmp = new SafeNativeMethods.BITMAP();
+
+ if (info.hbmColor != IntPtr.Zero)
+ {
+ SafeNativeMethods.GetObject(new HandleRef(null, info.hbmColor), Marshal.SizeOf(typeof(SafeNativeMethods.BITMAP)), bmp);
+ SafeNativeMethods.IntDeleteObject(new HandleRef(null, info.hbmColor));
+ _iconSize = new Size(bmp.bmWidth, bmp.bmHeight);
+ }
+ else if (info.hbmMask != IntPtr.Zero)
+ {
+ SafeNativeMethods.GetObject(new HandleRef(null, info.hbmMask), Marshal.SizeOf(typeof(SafeNativeMethods.BITMAP)), bmp);
+ _iconSize = new Size(bmp.bmWidth, bmp.bmHeight / 2);
+ }
+
+ if (info.hbmMask != IntPtr.Zero)
+ {
+ SafeNativeMethods.IntDeleteObject(new HandleRef(null, info.hbmMask));
+ }
+ }
+
+ return _iconSize;
+ }
+ }
+
+ /// <include file='doc\Icon.uex' path='docs/doc[@for="Icon.Width"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ [Browsable(false)]
+ public int Width
+ {
+ get { return Size.Width; }
+ }
+
+ /// <include file='doc\Icon.uex' path='docs/doc[@for="Icon.Clone"]/*' />
+ /// <devdoc>
+ /// Clones the icon object, creating a duplicate image.
+ /// </devdoc>
+ public object Clone()
+ {
+ return new Icon(this, Size.Width, Size.Height);
+ }
+
+ /// <include file='doc\Icon.uex' path='docs/doc[@for="Icon.DestroyHandle"]/*' />
+ /// <devdoc>
+ /// Called when this object is going to destroy it's Win32 handle. You
+ /// may override this if there is something special you need to do to
+ /// destroy the handle. This will be called even if the handle is not
+ /// owned by this object, which is handy if you want to create a
+ /// derived class that has it's own create/destroy semantics.
+ ///
+ /// The default implementation will call the appropriate Win32
+ /// call to destroy the handle if this object currently owns the
+ /// handle. It will do nothing if the object does not currently
+ /// own the handle.
+ /// </devdoc>
+ internal void DestroyHandle()
+ {
+ if (_ownHandle)
+ {
+ SafeNativeMethods.DestroyIcon(new HandleRef(this, _handle));
+ _handle = IntPtr.Zero;
+ }
+ }
+
+ /// <include file='doc\Icon.uex' path='docs/doc[@for="Icon.Dispose"]/*' />
+ /// <devdoc>
+ /// Cleans up the resources allocated by this object. Once called, the cursor
+ /// object is no longer useful.
+ /// </devdoc>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ private void Dispose(bool disposing)
+ {
+ if (_handle != IntPtr.Zero)
+ {
+#if FINALIZATION_WATCH
+ if (!disposing) {
+ Debug.WriteLine("**********************\nDisposed through finalization:\n" + allocationSite);
+ }
+#endif
+ DestroyHandle();
+ }
+ }
+
+ /// <include file='doc\Icon.uex' path='docs/doc[@for="Icon.DrawIcon"]/*' />
+ /// <devdoc>
+ /// Draws this image to a graphics object. The drawing command originates on the graphics
+ /// object, but a graphics object generally has no idea how to render a given image. So,
+ /// it passes the call to the actual image. This version crops the image to the given
+ /// dimensions and allows the user to specify a rectangle within the image to draw.
+ /// </devdoc>
+ // This method is way more powerful than what we expose, but I'll leave it in place.
+ private void DrawIcon(IntPtr dc, Rectangle imageRect, Rectangle targetRect, bool stretch)
+ {
+ int imageX = 0;
+ int imageY = 0;
+ int imageWidth;
+ int imageHeight;
+ int targetX = 0;
+ int targetY = 0;
+ int targetWidth = 0;
+ int targetHeight = 0;
+
+ Size cursorSize = Size;
+
+ // compute the dimensions of the icon, if needed
+ //
+ if (!imageRect.IsEmpty)
+ {
+ imageX = imageRect.X;
+ imageY = imageRect.Y;
+ imageWidth = imageRect.Width;
+ imageHeight = imageRect.Height;
+ }
+ else
+ {
+ imageWidth = cursorSize.Width;
+ imageHeight = cursorSize.Height;
+ }
+
+ if (!targetRect.IsEmpty)
+ {
+ targetX = targetRect.X;
+ targetY = targetRect.Y;
+ targetWidth = targetRect.Width;
+ targetHeight = targetRect.Height;
+ }
+ else
+ {
+ targetWidth = cursorSize.Width;
+ targetHeight = cursorSize.Height;
+ }
+
+ int drawWidth, drawHeight;
+ int clipWidth, clipHeight;
+
+ if (stretch)
+ {
+ drawWidth = cursorSize.Width * targetWidth / imageWidth;
+ drawHeight = cursorSize.Height * targetHeight / imageHeight;
+ clipWidth = targetWidth;
+ clipHeight = targetHeight;
+ }
+ else
+ {
+ drawWidth = cursorSize.Width;
+ drawHeight = cursorSize.Height;
+ clipWidth = targetWidth < imageWidth ? targetWidth : imageWidth;
+ clipHeight = targetHeight < imageHeight ? targetHeight : imageHeight;
+ }
+
+ // The ROP is SRCCOPY, so we can be simple here and take
+ // advantage of clipping regions. Drawing the cursor
+ // is merely a matter of offsetting and clipping.
+ //
+ IntPtr hSaveRgn = SafeNativeMethods.SaveClipRgn(dc);
+ try
+ {
+ SafeNativeMethods.IntersectClipRect(new HandleRef(this, dc), targetX, targetY, targetX + clipWidth, targetY + clipHeight);
+ SafeNativeMethods.DrawIconEx(new HandleRef(null, dc),
+ targetX - imageX,
+ targetY - imageY,
+ new HandleRef(this, _handle),
+ drawWidth,
+ drawHeight,
+ 0,
+ NativeMethods.NullHandleRef,
+ SafeNativeMethods.DI_NORMAL);
+ }
+ finally
+ {
+ SafeNativeMethods.RestoreClipRgn(dc, hSaveRgn);
+ }
+ }
+
+ internal void Draw(Graphics graphics, int x, int y)
+ {
+ Size size = Size;
+ Draw(graphics, new Rectangle(x, y, size.Width, size.Height));
+ }
+
+ /// <include file='doc\Icon.uex' path='docs/doc[@for="Icon.Draw"]/*' />
+ /// <devdoc>
+ /// Draws this image to a graphics object. The drawing command originates on the graphics
+ /// object, but a graphics object generally has no idea how to render a given image. So,
+ /// it passes the call to the actual image. This version stretches the image to the given
+ /// dimensions and allows the user to specify a rectangle within the image to draw.
+ /// </devdoc>
+ internal void Draw(Graphics graphics, Rectangle targetRect)
+ {
+ Rectangle copy = targetRect;
+ copy.X += (int)graphics.Transform.OffsetX;
+ copy.Y += (int)graphics.Transform.OffsetY;
+
+ WindowsGraphics wg = WindowsGraphics.FromGraphics(graphics, ApplyGraphicsProperties.Clipping);
+ IntPtr dc = wg.GetHdc();
+
+ try
+ {
+ DrawIcon(dc, Rectangle.Empty, copy, true);
+ }
+ finally
+ {
+ wg.Dispose();
+ }
+ }
+
+ /// <include file='doc\Icon.uex' path='docs/doc[@for="Icon.DrawUnstretched"]/*' />
+ /// <devdoc>
+ /// Draws this image to a graphics object. The drawing command originates on the graphics
+ /// object, but a graphics object generally has no idea how to render a given image. So,
+ /// it passes the call to the actual image. This version crops the image to the given
+ /// dimensions and allows the user to specify a rectangle within the image to draw.
+ /// </devdoc>
+ internal void DrawUnstretched(Graphics graphics, Rectangle targetRect)
+ {
+ Rectangle copy = targetRect;
+ copy.X += (int)graphics.Transform.OffsetX;
+ copy.Y += (int)graphics.Transform.OffsetY;
+
+ WindowsGraphics wg = WindowsGraphics.FromGraphics(graphics, ApplyGraphicsProperties.Clipping);
+ IntPtr dc = wg.GetHdc();
+ try
+ {
+ DrawIcon(dc, Rectangle.Empty, copy, false);
+ }
+ finally
+ {
+ wg.Dispose();
+ }
+ }
+
+ /// <include file='doc\Icon.uex' path='docs/doc[@for="Icon.Finalize"]/*' />
+ /// <devdoc>
+ /// Cleans up Windows resources for this object.
+ /// </devdoc>
+ ~Icon()
+ {
+ Dispose(false);
+ }
+
+ /// <include file='doc\Icon.uex' path='docs/doc[@for="Icon.FromHandle"]/*' />
+ /// <devdoc>
+ /// Creates an icon object from a given Win32 icon handle. The Icon object
+ /// does not claim ownership of the icon handle; you must free it when you are
+ /// done.
+ /// </devdoc>
+ public static Icon FromHandle(IntPtr handle)
+ {
+ return new Icon(handle);
+ }
+
+ private unsafe short GetShort(byte* pb)
+ {
+ int retval = 0;
+ if (0 != (unchecked((byte)pb) & 1))
+ {
+ retval = *pb;
+ pb++;
+ retval = unchecked(retval | (*pb << 8));
+ }
+ else
+ {
+ retval = unchecked((int)(*(short*)pb));
+ }
+ return unchecked((short)retval);
+ }
+
+ private unsafe int GetInt(byte* pb)
+ {
+ int retval = 0;
+ if (0 != (unchecked((byte)pb) & 3))
+ {
+ retval = *pb; pb++;
+ retval = retval | (*pb << 8); pb++;
+ retval = retval | (*pb << 16); pb++;
+ retval = unchecked(retval | (*pb << 24));
+ }
+ else
+ {
+ retval = *(int*)pb;
+ }
+ return retval;
+ }
+
+
+ /// <include file='doc\Icon.uex' path='docs/doc[@for="Icon.Initialize"]/*' />
+ /// <devdoc>
+ /// Initializes this Image object. This is identical to calling the image's
+ /// constructor with picture, but this allows non-constructor initialization,
+ /// which may be necessary in some instances.
+ /// </devdoc>
+ private unsafe void Initialize(int width, int height)
+ {
+ if (_iconData == null || _handle != IntPtr.Zero)
+ {
+ throw new InvalidOperationException(SR.Format(SR.IllegalState, GetType().Name));
+ }
+
+ int icondirSize = Marshal.SizeOf(typeof(SafeNativeMethods.ICONDIR));
+ if (_iconData.Length < icondirSize)
+ {
+ throw new ArgumentException(SR.Format(SR.InvalidPictureType, "picture", "Icon"));
+ }
+
+ // Get the correct width / height
+ //
+ if (width == 0)
+ {
+ width = UnsafeNativeMethods.GetSystemMetrics(SafeNativeMethods.SM_CXICON);
+ }
+
+ if (height == 0)
+ {
+ height = UnsafeNativeMethods.GetSystemMetrics(SafeNativeMethods.SM_CYICON);
+ }
+
+
+ if (s_bitDepth == 0)
+ {
+ IntPtr dc = UnsafeNativeMethods.GetDC(NativeMethods.NullHandleRef);
+ s_bitDepth = UnsafeNativeMethods.GetDeviceCaps(new HandleRef(null, dc), SafeNativeMethods.BITSPIXEL);
+ s_bitDepth *= UnsafeNativeMethods.GetDeviceCaps(new HandleRef(null, dc), SafeNativeMethods.PLANES);
+ UnsafeNativeMethods.ReleaseDC(NativeMethods.NullHandleRef, new HandleRef(null, dc));
+
+ // If the bitdepth is 8, make it 4. Why? Because windows does not
+ // choose a 256 color icon if the display is running in 256 color mode
+ // because of palette flicker.
+ //
+ if (s_bitDepth == 8) s_bitDepth = 4;
+ }
+
+ fixed (byte* pbIconData = _iconData)
+ {
+ short idReserved = GetShort(pbIconData);
+ short idType = GetShort(pbIconData + 2);
+ short idCount = GetShort(pbIconData + 4);
+
+ if (idReserved != 0 || idType != 1 || idCount == 0)
+ {
+ throw new ArgumentException(SR.Format(SR.InvalidPictureType, "picture", "Icon"));
+ }
+
+ SafeNativeMethods.ICONDIRENTRY EntryTemp;
+
+ byte bestWidth = 0;
+ byte bestHeight = 0;
+ //int bestBitDepth = 0;
+
+ byte* pbIconDirEntry = unchecked(pbIconData + 6);
+ int icondirEntrySize = Marshal.SizeOf(typeof(SafeNativeMethods.ICONDIRENTRY));
+
+ Debug.Assert((icondirEntrySize * (idCount - 1) + icondirSize) <= _iconData.Length, "Illegal number of ICONDIRENTRIES");
+
+ if ((icondirEntrySize * (idCount - 1) + icondirSize) > _iconData.Length)
+ {
+ throw new ArgumentException(SR.Format(SR.InvalidPictureType, "picture", "Icon"));
+ }
+
+
+ for (int i = 0; i < idCount; i++)
+ {
+ //
+ // Fill in EntryTemp
+ //
+ EntryTemp.bWidth = pbIconDirEntry[0];
+ EntryTemp.bHeight = pbIconDirEntry[1];
+ EntryTemp.bColorCount = pbIconDirEntry[2];
+ EntryTemp.bReserved = pbIconDirEntry[3];
+ EntryTemp.wPlanes = GetShort(pbIconDirEntry + 4);
+ EntryTemp.wBitCount = GetShort(pbIconDirEntry + 6);
+ EntryTemp.dwBytesInRes = GetInt(pbIconDirEntry + 8);
+ EntryTemp.dwImageOffset = GetInt(pbIconDirEntry + 12);
+ //
+ //
+ //
+ bool fUpdateBestFit = false;
+ int iconBitDepth = 0;
+ if (EntryTemp.bColorCount != 0)
+ {
+ iconBitDepth = 4;
+ if (EntryTemp.bColorCount < 0x10) iconBitDepth = 1;
+ }
+ else
+ {
+ iconBitDepth = EntryTemp.wBitCount;
+ }
+
+ // it looks like if nothing is specified at this point, bpp is 8...
+ if (iconBitDepth == 0)
+ iconBitDepth = 8;
+
+ // Windows rules for specifing an icon:
+ //
+ // 1. The icon with the closest size match.
+ // 2. For matching sizes, the image with the closest bit depth.
+ // 3. If there is no color depth match, the icon with the closest color depth that does not exceed the display.
+ // 4. If all icon color depth > display, lowest color depth is chosen.
+ // 5. color depth of > 8bpp are all equal.
+ // 6. Never choose an 8bpp icon on an 8bpp system.
+ //
+
+ if (0 == _bestBytesInRes)
+ {
+ fUpdateBestFit = true;
+ }
+ else
+ {
+ int bestDelta = Math.Abs(bestWidth - width) + Math.Abs(bestHeight - height);
+ int thisDelta = Math.Abs(EntryTemp.bWidth - width) + Math.Abs(EntryTemp.bHeight - height);
+
+ if ((thisDelta < bestDelta) ||
+ (thisDelta == bestDelta && (iconBitDepth <= s_bitDepth && iconBitDepth > _bestBitDepth || _bestBitDepth > s_bitDepth && iconBitDepth < _bestBitDepth)))
+ {
+ fUpdateBestFit = true;
+ }
+ }
+
+ if (fUpdateBestFit)
+ {
+ bestWidth = EntryTemp.bWidth;
+ bestHeight = EntryTemp.bHeight;
+ _bestImageOffset = EntryTemp.dwImageOffset;
+ _bestBytesInRes = EntryTemp.dwBytesInRes;
+ _bestBitDepth = iconBitDepth;
+ }
+
+ pbIconDirEntry += icondirEntrySize;
+ }
+
+ Debug.Assert(_bestImageOffset >= 0 && _bestBytesInRes >= 0 && (_bestImageOffset + _bestBytesInRes) <= _iconData.Length, "Illegal offset/length for the Icon data");
+
+ if (_bestImageOffset < 0)
+ {
+ throw new ArgumentException(SR.Format(SR.InvalidPictureType, "picture", "Icon"));
+ }
+
+ if (_bestBytesInRes < 0)
+ {
+ throw new Win32Exception(SafeNativeMethods.ERROR_INVALID_PARAMETER);
+ }
+
+ int endOffset;
+ try
+ {
+ endOffset = checked(_bestImageOffset + _bestBytesInRes);
+ }
+ catch (OverflowException)
+ {
+ throw new Win32Exception(SafeNativeMethods.ERROR_INVALID_PARAMETER);
+ }
+
+ if (endOffset > _iconData.Length)
+ {
+ throw new ArgumentException(SR.Format(SR.InvalidPictureType, "picture", "Icon"));
+ }
+
+ // See DevDivBugs 17509. Copying bytes into an aligned buffer if needed
+ if ((_bestImageOffset % IntPtr.Size) != 0)
+ {
+ // Beginning of icon's content is misaligned
+ byte[] alignedBuffer = new byte[_bestBytesInRes];
+ Array.Copy(_iconData, _bestImageOffset, alignedBuffer, 0, _bestBytesInRes);
+
+ fixed (byte* pbAlignedBuffer = alignedBuffer)
+ {
+ _handle = SafeNativeMethods.CreateIconFromResourceEx(pbAlignedBuffer, _bestBytesInRes, true, 0x00030000, 0, 0, 0);
+ }
+ }
+ else
+ {
+ try
+ {
+ _handle = SafeNativeMethods.CreateIconFromResourceEx(checked(pbIconData + _bestImageOffset), _bestBytesInRes, true, 0x00030000, 0, 0, 0);
+ }
+ catch (OverflowException)
+ {
+ throw new Win32Exception(SafeNativeMethods.ERROR_INVALID_PARAMETER);
+ }
+ }
+ if (_handle == IntPtr.Zero)
+ {
+ throw new Win32Exception();
+ }
+ }
+ }
+
+ /// <include file='doc\Icon.uex' path='docs/doc[@for="Icon.Save"]/*' />
+ /// <devdoc>
+ /// Saves this image to the given output stream.
+ /// </devdoc>
+ public void Save(Stream outputStream)
+ {
+ if (_iconData != null)
+ {
+ outputStream.Write(_iconData, 0, _iconData.Length);
+ }
+ else
+ {
+ // Ideally, we would pick apart the icon using
+ // GetIconInfo, and then pull the individual bitmaps out,
+ // converting them to DIBS and saving them into the file.
+ // But, in the interest of simplicity, we just call to
+ // OLE to do it for us.
+ //
+ SafeNativeMethods.IPicture picture;
+ SafeNativeMethods.PICTDESC pictdesc = SafeNativeMethods.PICTDESC.CreateIconPICTDESC(Handle);
+ Guid g = typeof(SafeNativeMethods.IPicture).GUID;
+ picture = SafeNativeMethods.OleCreatePictureIndirect(pictdesc, ref g, false);
+
+ if (picture != null)
+ {
+ int temp;
+ try
+ {
+ picture.SaveAsFile(new UnsafeNativeMethods.ComStreamFromDataStream(outputStream), -1, out temp);
+ }
+ finally
+ {
+ Marshal.ReleaseComObject(picture);
+ }
+ }
+ }
+ }
+
+ // SAME CODE OR SIMILAR IN ImageList.cs
+ private void CopyBitmapData(BitmapData sourceData, BitmapData targetData)
+ {
+ // do the actual copy
+ int offsetSrc = 0;
+ int offsetDest = 0;
+
+ Debug.Assert(sourceData.Height == targetData.Height, "Unexpected height. How did this happen?");
+
+ for (int i = 0; i < Math.Min(sourceData.Height, targetData.Height); i++)
+ {
+ IntPtr srcPtr, destPtr;
+ if (IntPtr.Size == 4)
+ {
+ srcPtr = new IntPtr(sourceData.Scan0.ToInt32() + offsetSrc);
+ destPtr = new IntPtr(targetData.Scan0.ToInt32() + offsetDest);
+ }
+ else
+ {
+ srcPtr = new IntPtr(sourceData.Scan0.ToInt64() + offsetSrc);
+ destPtr = new IntPtr(targetData.Scan0.ToInt64() + offsetDest);
+ }
+
+ UnsafeNativeMethods.CopyMemory(new HandleRef(this, destPtr), new HandleRef(this, srcPtr), Math.Abs(targetData.Stride));
+
+ offsetSrc += sourceData.Stride;
+ offsetDest += targetData.Stride;
+ }
+ }
+
+ private static bool BitmapHasAlpha(BitmapData bmpData)
+ {
+ bool hasAlpha = false;
+ for (int i = 0; i < bmpData.Height; i++)
+ {
+ for (int j = 3; j < Math.Abs(bmpData.Stride); j += 4)
+ { // stride here is fine since we know we're doing this on the whole image
+ unsafe
+ {
+ byte* candidate = unchecked(((byte*)bmpData.Scan0.ToPointer()) + (i * bmpData.Stride) + j);
+ if (*candidate != 0)
+ {
+ hasAlpha = true;
+ goto Found;
+ }
+ }
+ }
+ }
+ Found:
+ return hasAlpha;
+ }
+
+ // If you're concerned about performance, you probably shouldn't call this method,
+ // since you will probably turn it into an HBITMAP sooner or later anyway.
+
+
+
+
+ // supressing here since the call within the assert is safe
+ public Bitmap ToBitmap()
+ {
+ // DontSupportPngFramesInIcons is true when the application is targeting framework version below 4.6
+ // and false when the application is targeting 4.6 and above. Downlevel application can also set the following switch
+ // to false in the .config file's runtime section in order to opt-in into the new behavior:
+ // <AppContextSwitchOverrides value="Switch.System.Drawing.DontSupportPngFramesInIcons=false" />
+ if (HasPngSignature() && !LocalAppContextSwitches.DontSupportPngFramesInIcons)
+ {
+ return PngFrame();
+ }
+ else
+ {
+ return BmpFrame();
+ }
+ }
+
+ private Bitmap BmpFrame()
+ {
+ Bitmap bitmap = null;
+ if (_iconData != null && _bestBitDepth == 32)
+ {
+ // GDI+ doesnt handle 32 bpp icons with alpha properly
+ // we load the icon ourself from the byte table
+ bitmap = new Bitmap(Size.Width, Size.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
+ Debug.Assert(_bestImageOffset >= 0 && (_bestImageOffset + _bestBytesInRes) <= _iconData.Length, "Illegal offset/length for the Icon data");
+
+ unsafe
+ {
+ System.Drawing.Imaging.BitmapData bmpdata = bitmap.LockBits(new Rectangle(0, 0, Size.Width, Size.Height),
+ System.Drawing.Imaging.ImageLockMode.WriteOnly,
+ System.Drawing.Imaging.PixelFormat.Format32bppArgb);
+ try
+ {
+ uint* pixelPtr = (uint*)bmpdata.Scan0.ToPointer();
+
+ // jumping the image header
+ int newOffset = _bestImageOffset + Marshal.SizeOf(typeof(SafeNativeMethods.BITMAPINFOHEADER));
+ // there is no color table that we need to skip since we're 32bpp
+
+ int lineLength = Size.Width * 4;
+ int width = Size.Width;
+ for (int j = (Size.Height - 1) * 4; j >= 0; j -= 4)
+ {
+ Marshal.Copy(_iconData, newOffset + j * width, (IntPtr)pixelPtr, lineLength);
+ pixelPtr += width;
+ }
+
+ // note: we ignore the mask that's available after the pixel table
+ }
+ finally
+ {
+ bitmap.UnlockBits(bmpdata);
+ }
+ }
+ }
+ else if (_bestBitDepth == 0 || _bestBitDepth == 32)
+ { // we don't know or we are 32bpp for sure
+ //we don't have any icon data, let's fish out the data from the handle that we got...
+ // we have to fish out the data for this icon if the icon is a 32bpp icon
+ SafeNativeMethods.ICONINFO info = new SafeNativeMethods.ICONINFO();
+ SafeNativeMethods.GetIconInfo(new HandleRef(this, _handle), info);
+ SafeNativeMethods.BITMAP bmp = new SafeNativeMethods.BITMAP();
+ try
+ {
+ if (info.hbmColor != IntPtr.Zero)
+ {
+ SafeNativeMethods.GetObject(new HandleRef(null, info.hbmColor), Marshal.SizeOf(typeof(SafeNativeMethods.BITMAP)), bmp);
+ if (bmp.bmBitsPixel == 32)
+ {
+ Bitmap tmpBitmap = null;
+ BitmapData bmpData = null;
+ BitmapData targetData = null;
+ try
+ {
+ tmpBitmap = Bitmap.FromHbitmap(info.hbmColor);
+
+ // In GDI+ the bits are there but the bitmap was created with no alpha channel
+ // so copy the bits by hand to a new bitmap
+ // we also need to go around a limitation in the way the ICON is stored (ie if it's another bpp
+ // but stored in 32bpp all pixels are transparent and not opaque)
+ // (Here you mostly need to remain calm....)
+ bmpData = tmpBitmap.LockBits(new Rectangle(0, 0, tmpBitmap.Width, tmpBitmap.Height), ImageLockMode.ReadOnly, tmpBitmap.PixelFormat);
+
+ // we need do the following if the image has alpha because otherwise the image is fully transparent even though it has data
+ if (BitmapHasAlpha(bmpData))
+ {
+ bitmap = new Bitmap(bmpData.Width, bmpData.Height, PixelFormat.Format32bppArgb);
+ targetData = bitmap.LockBits(new Rectangle(0, 0, bmpData.Width, bmpData.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
+
+ CopyBitmapData(bmpData, targetData);
+ }
+ }
+ finally
+ {
+ if (tmpBitmap != null && bmpData != null)
+ {
+ tmpBitmap.UnlockBits(bmpData);
+ }
+ if (bitmap != null && targetData != null)
+ {
+ bitmap.UnlockBits(targetData);
+ }
+ }
+ tmpBitmap.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (info.hbmColor != IntPtr.Zero)
+ SafeNativeMethods.IntDeleteObject(new HandleRef(null, info.hbmColor));
+ if (info.hbmMask != IntPtr.Zero)
+ SafeNativeMethods.IntDeleteObject(new HandleRef(null, info.hbmMask));
+ }
+ }
+
+
+ if (bitmap == null)
+ {
+ // last chance... all the other cases (ie non 32 bpp icons coming from a handle or from the bitmapData)
+
+ // we have to do this rather than just return Bitmap.FromHIcon because
+ // the bitmap returned from that, even though it's 32bpp, just paints where the mask allows it
+ // seems like another GDI+ weirdness. might be interesting to investigate further. In the meantime
+ // this looks like the right thing to do and is not more expansive that what was present before.
+
+ Size size = Size;
+ bitmap = new Bitmap(size.Width, size.Height); // initialized to transparent
+ Graphics graphics = null;
+ try
+ {
+ graphics = Graphics.FromImage(bitmap);
+ try
+ {
+ using (Bitmap tmpBitmap = Bitmap.FromHicon(Handle))
+ {
+ graphics.DrawImage(tmpBitmap, new Rectangle(0, 0, size.Width, size.Height));
+ }
+ }
+ catch (ArgumentException)
+ { // GDI+ weirdness episode MMMCLXXXXIVI, sometime FromHicon crash with no real reason,
+ // backup plan is to just draw the image like we used to.
+ // NOTE: FromHIcon is also where we have the buffer overrun
+ // if width and height are mismatched
+ Draw(graphics, new Rectangle(0, 0, size.Width, size.Height));
+ }
+ }
+ finally
+ {
+ if (graphics != null)
+ {
+ graphics.Dispose();
+ }
+ }
+
+
+ // gpr: GDI+ is filling the surface with a sentinel color for GetDC,
+ // but is not correctly cleaning it up again, so we have to for it.
+ Color fakeTransparencyColor = Color.FromArgb(0x0d, 0x0b, 0x0c);
+ bitmap.MakeTransparent(fakeTransparencyColor);
+ }
+
+ Debug.Assert(bitmap != null, "Bitmap cannot be null");
+ return bitmap;
+ }
+
+ private Bitmap PngFrame()
+ {
+ Bitmap bitmap = null;
+ if (_iconData != null)
+ {
+ using (MemoryStream stream = new MemoryStream())
+ {
+ stream.Write(_iconData, _bestImageOffset, _bestBytesInRes);
+ bitmap = new Bitmap(stream);
+ }
+ }
+ return bitmap;
+ }
+
+ private bool HasPngSignature()
+ {
+ if (!_isBestImagePng.HasValue)
+ {
+ if (_iconData != null && _iconData.Length >= _bestImageOffset + 8)
+ {
+ int iconSignature1 = BitConverter.ToInt32(_iconData, _bestImageOffset);
+ int iconSignature2 = BitConverter.ToInt32(_iconData, _bestImageOffset + 4);
+ _isBestImagePng = (iconSignature1 == PNGSignature1) && (iconSignature2 == PNGSignature2);
+ }
+ else
+ {
+ _isBestImagePng = false;
+ }
+ }
+
+ return _isBestImagePng.Value;
+ }
+
+ /// <include file='doc\Icon.uex' path='docs/doc[@for="Icon.ToString"]/*' />
+ /// <devdoc>
+ /// Retrieves a human readable string representing the cursor.
+ /// </devdoc>
+ public override string ToString()
+ {
+ return SR.Format(SR.toStringIcon);
+ }
+
+ /// <include file='doc\Icon.uex' path='docs/doc[@for="Icon.ISerializable.GetObjectData"]/*' />
+ /// <devdoc>
+ /// ISerializable private implementation
+ /// </devdoc>
+ /// <internalonly/>
+ [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
+ void ISerializable.GetObjectData(SerializationInfo si, StreamingContext context)
+ {
+ if (_iconData != null)
+ {
+ si.AddValue("IconData", _iconData, typeof(byte[]));
+ }
+ else
+ {
+ MemoryStream stream = new MemoryStream();
+ Save(stream);
+ si.AddValue("IconData", stream.ToArray(), typeof(byte[]));
+ }
+ si.AddValue("IconSize", _iconSize, typeof(Size));
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Image.cs b/src/System.Drawing.Common/src/System/Drawing/Image.cs
new file mode 100644
index 0000000000..c6bcce906f
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Image.cs
@@ -0,0 +1,1500 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.ComponentModel;
+ using System.Diagnostics;
+ using System.Drawing.Imaging;
+ using System.Drawing.Internal;
+ using System.Globalization;
+ using System.IO;
+ using System.Runtime.InteropServices;
+ using System.Runtime.Serialization;
+ using System.Security.Permissions;
+
+ /**
+ * Represent an image object (could be bitmap or vector)
+ */
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image"]/*' />
+ /// <devdoc>
+ /// An abstract base class that provides
+ /// functionality for 'Bitmap', 'Icon', 'Cursor', and 'Metafile' descended classes.
+ /// </devdoc>
+ [ImmutableObject(true)]
+ [Serializable]
+ [ComVisible(true)]
+ public abstract class Image : MarshalByRefObject, ISerializable, ICloneable, IDisposable
+ {
+#if FINALIZATION_WATCH
+ private string allocationSite = Graphics.GetAllocationStack();
+#endif
+
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.GetThumbnailImageAbort"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ // The signature of this delegate is incorrect. The signature of the corresponding
+ // native callback function is:
+ // extern "C" {
+ // typedef BOOL (CALLBACK * ImageAbort)(VOID *);
+ // typedef ImageAbort DrawImageAbort;
+ // typedef ImageAbort GetThumbnailImageAbort;
+ // }
+ // However, as this delegate is not used in both GDI 1.0 and 1.1, we choose not
+ // to modify it in Dev10, in order not to break exsiting code
+ public delegate bool GetThumbnailImageAbort();
+
+ /*
+ * Handle to native image object
+ */
+ internal IntPtr nativeImage;
+
+ // used to work around lack of animated gif encoder... rarely set...
+ //
+ private byte[] _rawData;
+
+ //userData : so that user can use TAGS with IMAGES..
+ private object _userData;
+
+ /**
+ * Constructor can't be invoked directly
+ */
+ internal Image()
+ {
+ }
+
+ /**
+ * Constructor used in deserialization
+ */
+ // We don't care about serialiation constructors.
+#pragma warning disable CA2229
+ internal Image(SerializationInfo info, StreamingContext context)
+ {
+#pragma warning restore CA2229
+ SerializationInfoEnumerator sie = info.GetEnumerator();
+ if (sie == null)
+ {
+ return;
+ }
+ for (; sie.MoveNext();)
+ {
+ if (String.Equals(sie.Name, "Data", StringComparison.OrdinalIgnoreCase))
+ {
+ try
+ {
+ byte[] dat = (byte[])sie.Value;
+ if (dat != null)
+ {
+ InitializeFromStream(new MemoryStream(dat));
+ }
+ }
+ catch (ExternalException e)
+ {
+ Debug.Fail("failure: " + e.ToString());
+ }
+ catch (ArgumentException e)
+ {
+ Debug.Fail("failure: " + e.ToString());
+ }
+ catch (OutOfMemoryException e)
+ {
+ Debug.Fail("failure: " + e.ToString());
+ }
+ catch (InvalidOperationException e)
+ {
+ Debug.Fail("failure: " + e.ToString());
+ }
+ catch (NotImplementedException e)
+ {
+ Debug.Fail("failure: " + e.ToString());
+ }
+ catch (FileNotFoundException e)
+ {
+ Debug.Fail("failure: " + e.ToString());
+ }
+ }
+ }
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.Tag"]/*' />
+ [
+ Localizable(false),
+ DefaultValue(null),
+ ]
+ public object Tag
+ {
+ get
+ {
+ return _userData;
+ }
+ set
+ {
+ _userData = value;
+ }
+ }
+
+ /**
+ * Create an image object from a URL
+ */
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.FromFile"]/*' />
+ /// <devdoc>
+ /// Creates an <see cref='System.Drawing.Image'/> from the specified file.
+ /// </devdoc>
+ // [Obsolete("Use Image.FromFile(string, useEmbeddedColorManagement)")]
+ public static Image FromFile(String filename)
+ {
+ return Image.FromFile(filename, false);
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.FromFile1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Image FromFile(String filename,
+ bool useEmbeddedColorManagement)
+ {
+ if (!File.Exists(filename))
+ {
+ throw new FileNotFoundException(filename);
+ }
+
+ // GDI+ will read this file multiple times. Get the fully qualified path
+ // so if our app changes default directory we won't get an error
+ filename = Path.GetFullPath(filename);
+
+ IntPtr image = IntPtr.Zero;
+ int status;
+
+ if (useEmbeddedColorManagement)
+ {
+ status = SafeNativeMethods.Gdip.GdipLoadImageFromFileICM(filename, out image);
+ }
+ else
+ {
+ status = SafeNativeMethods.Gdip.GdipLoadImageFromFile(filename, out image);
+ }
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ status = SafeNativeMethods.Gdip.GdipImageForceValidation(new HandleRef(null, image));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ SafeNativeMethods.Gdip.GdipDisposeImage(new HandleRef(null, image));
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ Image img = CreateImageObject(image);
+
+ EnsureSave(img, filename, null);
+
+ return img;
+ }
+
+
+ /**
+ * Create an image object from a data stream
+ */
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.FromStream"]/*' />
+ /// <devdoc>
+ /// Creates an <see cref='System.Drawing.Image'/> from the specified data
+ /// stream.
+ /// </devdoc>
+ // [Obsolete("Use Image.FromStream(stream, useEmbeddedColorManagement)")]
+ public static Image FromStream(Stream stream)
+ {
+ return Image.FromStream(stream, false);
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.FromStream1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Image FromStream(Stream stream,
+ bool useEmbeddedColorManagement)
+ {
+ return FromStream(stream, useEmbeddedColorManagement, true);
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.FromStream2"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Image FromStream(Stream stream, bool useEmbeddedColorManagement, bool validateImageData)
+ {
+ if (stream == null)
+ {
+ throw new ArgumentException(SR.Format(SR.InvalidArgument, "stream", "null"));
+ }
+
+ IntPtr image = IntPtr.Zero;
+ int status;
+
+ if (useEmbeddedColorManagement)
+ {
+ status = SafeNativeMethods.Gdip.GdipLoadImageFromStreamICM(new GPStream(stream), out image);
+ }
+ else
+ {
+ status = SafeNativeMethods.Gdip.GdipLoadImageFromStream(new GPStream(stream), out image);
+ }
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ if (validateImageData)
+ {
+ status = SafeNativeMethods.Gdip.GdipImageForceValidation(new HandleRef(null, image));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ SafeNativeMethods.Gdip.GdipDisposeImage(new HandleRef(null, image));
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ Image img = CreateImageObject(image);
+
+ EnsureSave(img, null, stream);
+
+ return img;
+ }
+
+ // Used for serialization
+ private void InitializeFromStream(Stream stream)
+ {
+ IntPtr image = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipLoadImageFromStream(new GPStream(stream), out image);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ status = SafeNativeMethods.Gdip.GdipImageForceValidation(new HandleRef(null, image));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ SafeNativeMethods.Gdip.GdipDisposeImage(new HandleRef(null, image));
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ nativeImage = image;
+
+ int type = -1;
+
+ status = SafeNativeMethods.Gdip.GdipGetImageType(new HandleRef(this, nativeImage), out type);
+
+ EnsureSave(this, null, stream);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ internal Image(IntPtr nativeImage)
+ {
+ SetNativeImage(nativeImage);
+ }
+
+ /**
+ * Make a copy of the image object
+ */
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.Clone"]/*' />
+ /// <devdoc>
+ /// Creates an exact copy of this <see cref='System.Drawing.Image'/>.
+ /// </devdoc>
+ public object Clone()
+ {
+ IntPtr cloneImage = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCloneImage(new HandleRef(this, nativeImage), out cloneImage);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ status = SafeNativeMethods.Gdip.GdipImageForceValidation(new HandleRef(null, cloneImage));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ SafeNativeMethods.Gdip.GdipDisposeImage(new HandleRef(null, cloneImage));
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return CreateImageObject(cloneImage);
+ }
+
+ /**
+ * Dispose of resources associated with the Image object
+ */
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.Dispose"]/*' />
+ /// <devdoc>
+ /// Cleans up Windows resources for this
+ /// <see cref='System.Drawing.Image'/>.
+ /// </devdoc>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.Dispose2"]/*' />
+ protected virtual void Dispose(bool disposing)
+ {
+#if FINALIZATION_WATCH
+ if (!disposing && nativeImage != IntPtr.Zero)
+ Debug.WriteLine("**********************\nDisposed through finalization:\n" + allocationSite);
+#endif
+ if (nativeImage != IntPtr.Zero)
+ {
+ try
+ {
+#if DEBUG
+ int status =
+#endif
+ SafeNativeMethods.Gdip.GdipDisposeImage(new HandleRef(this, nativeImage));
+#if DEBUG
+ Debug.Assert(status == SafeNativeMethods.Gdip.Ok, "GDI+ returned an error status: " + status.ToString(CultureInfo.InvariantCulture));
+#endif
+ }
+ catch (Exception ex)
+ {
+ if (ClientUtils.IsSecurityOrCriticalException(ex))
+ {
+ throw;
+ }
+
+ Debug.Fail("Exception thrown during Dispose: " + ex.ToString());
+ }
+ finally
+ {
+ nativeImage = IntPtr.Zero;
+ }
+ }
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.Finalize"]/*' />
+ /// <devdoc>
+ /// Cleans up Windows resources for this
+ /// <see cref='System.Drawing.Image'/>.
+ /// </devdoc>
+ ~Image()
+ {
+ Dispose(false);
+ }
+
+ internal static void EnsureSave(Image image, string filename, Stream dataStream)
+ {
+ if (image.RawFormat.Equals(ImageFormat.Gif))
+ {
+ bool animatedGif = false;
+
+ Guid[] dimensions = image.FrameDimensionsList;
+ foreach (Guid guid in dimensions)
+ {
+ FrameDimension dimension = new FrameDimension(guid);
+ if (dimension.Equals(FrameDimension.Time))
+ {
+ animatedGif = image.GetFrameCount(FrameDimension.Time) > 1;
+ break;
+ }
+ }
+
+
+ if (animatedGif)
+ {
+ try
+ {
+ Stream created = null;
+ long lastPos = 0;
+ if (dataStream != null)
+ {
+ lastPos = dataStream.Position;
+ dataStream.Position = 0;
+ }
+
+ try
+ {
+ if (dataStream == null)
+ {
+ created = dataStream = File.OpenRead(filename);
+ }
+
+ image._rawData = new byte[(int)dataStream.Length];
+ dataStream.Read(image._rawData, 0, (int)dataStream.Length);
+ }
+ finally
+ {
+ if (created != null)
+ {
+ created.Close();
+ }
+ else
+ {
+ dataStream.Position = lastPos;
+ }
+ }
+ }
+ // possible exceptions for reading the filename
+ catch (UnauthorizedAccessException)
+ {
+ }
+ catch (DirectoryNotFoundException)
+ {
+ }
+ catch (IOException)
+ {
+ }
+ // possible exceptions for setting/getting the position inside dataStream
+ catch (NotSupportedException)
+ {
+ }
+ catch (ObjectDisposedException)
+ {
+ }
+ // possible exception when reading stuff into dataStream
+ catch (ArgumentException)
+ {
+ }
+ }
+ }
+ }
+
+ private enum ImageTypeEnum
+ {
+ Bitmap = 1,
+ Metafile = 2,
+ }
+
+ /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future.
+ private ImageTypeEnum ImageType
+ {
+ get {
+ int type = -1;
+
+ int status = SafeNativeMethods.Gdip.GdipGetImageType(new HandleRef(this, nativeImage), out type);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return(ImageTypeEnum) type;
+ }
+ }
+ */
+
+ internal static Image CreateImageObject(IntPtr nativeImage)
+ {
+ Image image;
+
+ int type = -1;
+
+ int status = SafeNativeMethods.Gdip.GdipGetImageType(new HandleRef(null, nativeImage), out type);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ switch ((ImageTypeEnum)type)
+ {
+ case ImageTypeEnum.Bitmap:
+ image = Bitmap.FromGDIplus(nativeImage);
+ break;
+
+ case ImageTypeEnum.Metafile:
+ image = Metafile.FromGDIplus(nativeImage);
+ break;
+
+ default:
+ throw new ArgumentException(SR.Format(SR.InvalidImage));
+ }
+
+ return image;
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.ISerializable.GetObjectData"]/*' />
+ /// <devdoc>
+ /// ISerializable private implementation
+ /// </devdoc>
+ /// <internalonly/>
+ [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
+ void ISerializable.GetObjectData(SerializationInfo si, StreamingContext context)
+ {
+ using (MemoryStream stream = new MemoryStream())
+ {
+ Save(stream);
+ si.AddValue("Data", stream.ToArray(), typeof(byte[]));
+ }
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.GetEncoderParameterList"]/*' />
+ /// <devdoc>
+ /// Returns information about the codecs used
+ /// for this <see cref='System.Drawing.Image'/>.
+ /// </devdoc>
+ public EncoderParameters GetEncoderParameterList(Guid encoder)
+ {
+ EncoderParameters p;
+ int size;
+
+ int status = SafeNativeMethods.Gdip.GdipGetEncoderParameterListSize(new HandleRef(this, nativeImage),
+ ref encoder,
+ out size);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ if (size <= 0)
+ return null;
+
+ IntPtr buffer = Marshal.AllocHGlobal(size);
+
+ status = SafeNativeMethods.Gdip.GdipGetEncoderParameterList(new HandleRef(this, nativeImage),
+ ref encoder,
+ size,
+ buffer);
+
+ try
+ {
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ p = EncoderParameters.ConvertFromMemory(buffer);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buffer);
+ }
+
+ return p;
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.Save"]/*' />
+ /// <devdoc>
+ /// Saves this <see cref='System.Drawing.Image'/> to the specified file.
+ /// </devdoc>
+ public void Save(string filename)
+ {
+ Save(filename, RawFormat);
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.Save1"]/*' />
+ /// <devdoc>
+ /// Saves this <see cref='System.Drawing.Image'/> to the specified file in the
+ /// specified format.
+ /// </devdoc>
+ public void Save(string filename, ImageFormat format)
+ {
+ if (format == null)
+ throw new ArgumentNullException("format");
+
+ ImageCodecInfo codec = format.FindEncoder();
+
+ if (codec == null)
+ codec = ImageFormat.Png.FindEncoder();
+
+ Save(filename, codec, null);
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.Save2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Saves this <see cref='System.Drawing.Image'/> to the specified file in the specified format
+ /// and with the specified encoder parameters.
+ /// </para>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void Save(string filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
+ {
+ if (filename == null)
+ throw new ArgumentNullException("filename");
+ if (encoder == null)
+ throw new ArgumentNullException("encoder");
+
+ IntPtr encoderParamsMemory = IntPtr.Zero;
+
+ if (encoderParams != null)
+ {
+ _rawData = null;
+ encoderParamsMemory = encoderParams.ConvertToMemory();
+ }
+ int status = SafeNativeMethods.Gdip.Ok;
+
+ try
+ {
+ Guid g = encoder.Clsid;
+ bool saved = false;
+
+ if (_rawData != null)
+ {
+ ImageCodecInfo rawEncoder = RawFormat.FindEncoder();
+ if (rawEncoder != null && rawEncoder.Clsid == g)
+ {
+ using (FileStream fs = File.OpenWrite(filename))
+ {
+ fs.Write(_rawData, 0, _rawData.Length);
+ saved = true;
+ }
+ }
+ }
+
+ if (!saved)
+ {
+ status = SafeNativeMethods.Gdip.GdipSaveImageToFile(new HandleRef(this, nativeImage),
+ filename,
+ ref g,
+ new HandleRef(encoderParams, encoderParamsMemory));
+ }
+ }
+ finally
+ {
+ if (encoderParamsMemory != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(encoderParamsMemory);
+ }
+ }
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ internal void Save(MemoryStream stream)
+ {
+ // Jpeg loses data, so we don't want to use it to serialize...
+ //
+ ImageFormat dest = RawFormat;
+ if (dest == ImageFormat.Jpeg)
+ {
+ dest = ImageFormat.Png;
+ }
+ ImageCodecInfo codec = dest.FindEncoder();
+
+ // If we don't find an Encoder (for things like Icon), we
+ // just switch back to PNG...
+ //
+ if (codec == null)
+ {
+ codec = ImageFormat.Png.FindEncoder();
+ }
+ Save(stream, codec, null);
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.Save3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Saves this <see cref='System.Drawing.Image'/> to the specified stream in the specified
+ /// format.
+ /// </para>
+ /// </devdoc>
+ public void Save(Stream stream, ImageFormat format)
+ {
+ if (format == null)
+ throw new ArgumentNullException("format");
+
+ ImageCodecInfo codec = format.FindEncoder();
+ Save(stream, codec, null);
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.Save4"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Saves this <see cref='System.Drawing.Image'/> to the specified stream in the specified
+ /// format.
+ /// </para>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
+ {
+ if (stream == null)
+ {
+ throw new ArgumentNullException("stream");
+ }
+ if (encoder == null)
+ {
+ throw new ArgumentNullException("encoder");
+ }
+
+ IntPtr encoderParamsMemory = IntPtr.Zero;
+
+ if (encoderParams != null)
+ {
+ _rawData = null;
+ encoderParamsMemory = encoderParams.ConvertToMemory();
+ }
+
+ int status = SafeNativeMethods.Gdip.Ok;
+
+ try
+ {
+ Guid g = encoder.Clsid;
+ bool saved = false;
+
+ if (_rawData != null)
+ {
+ ImageCodecInfo rawEncoder = RawFormat.FindEncoder();
+ if (rawEncoder != null && rawEncoder.Clsid == g)
+ {
+ stream.Write(_rawData, 0, _rawData.Length);
+ saved = true;
+ }
+ }
+
+ if (!saved)
+ {
+ status = SafeNativeMethods.Gdip.GdipSaveImageToStream(new HandleRef(this, nativeImage),
+ new UnsafeNativeMethods.ComStreamFromDataStream(stream),
+ ref g,
+ new HandleRef(encoderParams, encoderParamsMemory));
+ }
+ }
+ finally
+ {
+ if (encoderParamsMemory != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(encoderParamsMemory);
+ }
+ }
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.SaveAdd"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds an <see cref='System.Drawing.Imaging.EncoderParameters'/> to this
+ /// <see cref='System.Drawing.Image'/>.
+ /// </para>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void SaveAdd(EncoderParameters encoderParams)
+ {
+ IntPtr encoder = IntPtr.Zero;
+ if (encoderParams != null)
+ {
+ encoder = encoderParams.ConvertToMemory();
+ }
+
+ _rawData = null;
+ int status = SafeNativeMethods.Gdip.GdipSaveAdd(new HandleRef(this, nativeImage), new HandleRef(encoderParams, encoder));
+
+ if (encoder != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(encoder);
+ }
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.SaveAdd1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Adds an <see cref='System.Drawing.Imaging.EncoderParameters'/> to the
+ /// specified <see cref='System.Drawing.Image'/>.
+ /// </para>
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void SaveAdd(Image image, EncoderParameters encoderParams)
+ {
+ IntPtr encoder = IntPtr.Zero;
+
+ if (image == null)
+ {
+ throw new ArgumentNullException("image");
+ }
+ if (encoderParams != null)
+ {
+ encoder = encoderParams.ConvertToMemory();
+ }
+
+ _rawData = null;
+ int status = SafeNativeMethods.Gdip.GdipSaveAddImage(new HandleRef(this, nativeImage), new HandleRef(image, image.nativeImage), new HandleRef(encoderParams, encoder));
+
+ if (encoder != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(encoder);
+ }
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /**
+ * Return; image size information
+ */
+ private SizeF _GetPhysicalDimension()
+ {
+ float width;
+ float height;
+
+ int status = SafeNativeMethods.Gdip.GdipGetImageDimension(new HandleRef(this, nativeImage), out width, out height);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return new SizeF(width, height);
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.PhysicalDimension"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the width and height of this
+ /// <see cref='System.Drawing.Image'/>.
+ /// </para>
+ /// </devdoc>
+ public SizeF PhysicalDimension
+ {
+ get { return _GetPhysicalDimension(); }
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.Size"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the width and height of this <see cref='System.Drawing.Image'/>.
+ /// </para>
+ /// </devdoc>
+ public Size Size
+ {
+ get
+ {
+ return new Size(Width, Height);
+ }
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.Width"]/*' />
+ /// <devdoc>
+ /// Gets the width of this <see cref='System.Drawing.Image'/>.
+ /// </devdoc>
+ [
+ DefaultValue(false),
+ Browsable(false),
+ DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)
+ ]
+ public int Width
+ {
+ get
+ {
+ int width;
+
+ int status = SafeNativeMethods.Gdip.GdipGetImageWidth(new HandleRef(this, nativeImage), out width);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return width;
+ }
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.Height"]/*' />
+ /// <devdoc>
+ /// Gets the height of this <see cref='System.Drawing.Image'/>.
+ /// </devdoc>
+ [
+ DefaultValue(false),
+ Browsable(false),
+ DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)
+ ]
+ public int Height
+ {
+ get
+ {
+ int height;
+
+ int status = SafeNativeMethods.Gdip.GdipGetImageHeight(new HandleRef(this, nativeImage), out height);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return height;
+ }
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.HorizontalResolution"]/*' />
+ /// <devdoc>
+ /// Gets the horizontal resolution, in
+ /// pixels-per-inch, of this <see cref='System.Drawing.Image'/>.
+ /// </devdoc>
+ public float HorizontalResolution
+ {
+ get
+ {
+ float horzRes;
+
+ int status = SafeNativeMethods.Gdip.GdipGetImageHorizontalResolution(new HandleRef(this, nativeImage), out horzRes);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return horzRes;
+ }
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.VerticalResolution"]/*' />
+ /// <devdoc>
+ /// Gets the vertical resolution, in
+ /// pixels-per-inch, of this <see cref='System.Drawing.Image'/>.
+ /// </devdoc>
+ public float VerticalResolution
+ {
+ get
+ {
+ float vertRes;
+
+ int status = SafeNativeMethods.Gdip.GdipGetImageVerticalResolution(new HandleRef(this, nativeImage), out vertRes);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return vertRes;
+ }
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.Flags"]/*' />
+ /// <devdoc>
+ /// Gets attribute flags for this <see cref='System.Drawing.Image'/>.
+ /// </devdoc>
+ [Browsable(false)]
+ public int Flags
+ {
+ get
+ {
+ int flags;
+
+ int status = SafeNativeMethods.Gdip.GdipGetImageFlags(new HandleRef(this, nativeImage), out flags);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return flags;
+ }
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.RawFormat"]/*' />
+ /// <devdoc>
+ /// Gets the format of this <see cref='System.Drawing.Image'/>.
+ /// </devdoc>
+ public ImageFormat RawFormat
+ {
+ get
+ {
+ Guid guid = new Guid();
+
+ int status = SafeNativeMethods.Gdip.GdipGetImageRawFormat(new HandleRef(this, nativeImage), ref guid);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+
+ return new ImageFormat(guid);
+ }
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.PixelFormat"]/*' />
+ /// <devdoc>
+ /// Gets the pixel format for this <see cref='System.Drawing.Image'/>.
+ /// </devdoc>
+ public PixelFormat PixelFormat
+ {
+ get
+ {
+ int format;
+
+ int status = SafeNativeMethods.Gdip.GdipGetImagePixelFormat(new HandleRef(this, nativeImage), out format);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ return PixelFormat.Undefined;
+ else
+ return (PixelFormat)format;
+ }
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.GetBounds"]/*' />
+ /// <devdoc>
+ /// Gets a bounding rectangle in
+ /// the specified units for this <see cref='System.Drawing.Image'/>.
+ /// </devdoc>
+ public RectangleF GetBounds(ref GraphicsUnit pageUnit)
+ {
+ GPRECTF gprectf = new GPRECTF();
+
+ int status = SafeNativeMethods.Gdip.GdipGetImageBounds(new HandleRef(this, nativeImage), ref gprectf, out pageUnit);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return gprectf.ToRectangleF();
+ }
+
+ private ColorPalette _GetColorPalette()
+ {
+ int size = -1;
+
+ int status = SafeNativeMethods.Gdip.GdipGetImagePaletteSize(new HandleRef(this, nativeImage), out size);
+ // "size" is total byte size:
+ // sizeof(ColorPalette) + (pal->Count-1)*sizeof(ARGB)
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ ColorPalette palette = new ColorPalette(size);
+
+ // Memory layout is:
+ // UINT Flags
+ // UINT Count
+ // ARGB Entries[size]
+
+ IntPtr memory = Marshal.AllocHGlobal(size);
+
+ status = SafeNativeMethods.Gdip.GdipGetImagePalette(new HandleRef(this, nativeImage), memory, size);
+
+ try
+ {
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ palette.ConvertFromMemory(memory);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(memory);
+ }
+
+ return palette;
+ }
+
+ private void _SetColorPalette(ColorPalette palette)
+ {
+ IntPtr memory = palette.ConvertToMemory();
+
+ int status = SafeNativeMethods.Gdip.GdipSetImagePalette(new HandleRef(this, nativeImage), memory);
+
+ if (memory != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(memory);
+ }
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.Palette"]/*' />
+ /// <devdoc>
+ /// Gets or sets the color
+ /// palette used for this <see cref='System.Drawing.Image'/>.
+ /// </devdoc>
+ [Browsable(false)]
+ public ColorPalette Palette
+ {
+ get
+ {
+ return _GetColorPalette();
+ }
+ set
+ {
+ _SetColorPalette(value);
+ }
+ }
+
+ // Thumbnail support
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.GetThumbnailImage"]/*' />
+ /// <devdoc>
+ /// Returns the thumbnail for this <see cref='System.Drawing.Image'/>.
+ /// </devdoc>
+ public Image GetThumbnailImage(int thumbWidth, int thumbHeight,
+ GetThumbnailImageAbort callback, IntPtr callbackData)
+ {
+ IntPtr thumbImage = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipGetImageThumbnail(new HandleRef(this, nativeImage), thumbWidth, thumbHeight, out thumbImage,
+ callback, callbackData);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return CreateImageObject(thumbImage);
+ }
+
+ // Multi-frame support
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.FrameDimensionsList"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets an array of GUIDs that represent the
+ /// dimensions of frames within this <see cref='System.Drawing.Image'/>.
+ /// </para>
+ /// </devdoc>
+ [Browsable(false)]
+ public Guid[] FrameDimensionsList
+ {
+ get
+ {
+ int count;
+
+ int status = SafeNativeMethods.Gdip.GdipImageGetFrameDimensionsCount(new HandleRef(this, nativeImage), out count);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ Debug.Assert(count >= 0, "FrameDimensionsList returns bad count");
+ if (count <= 0)
+ {
+ return new Guid[0];
+ }
+
+ int size = (int)Marshal.SizeOf(typeof(Guid));
+
+ IntPtr buffer = Marshal.AllocHGlobal(checked(size * count));
+ if (buffer == IntPtr.Zero)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.OutOfMemory);
+ }
+
+ status = SafeNativeMethods.Gdip.GdipImageGetFrameDimensionsList(new HandleRef(this, nativeImage), buffer, count);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ Marshal.FreeHGlobal(buffer);
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ Guid[] guids = new Guid[count];
+
+ try
+ {
+ for (int i = 0; i < count; i++)
+ {
+ guids[i] = (Guid)UnsafeNativeMethods.PtrToStructure((IntPtr)((long)buffer + size * i), typeof(Guid));
+ }
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buffer);
+ }
+
+ return guids;
+ }
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.GetFrameCount"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Returns the number of frames of the given
+ /// dimension.
+ /// </para>
+ /// </devdoc>
+ public int GetFrameCount(FrameDimension dimension)
+ {
+ int[] count = new int[] { 0 };
+
+ Guid dimensionID = dimension.Guid;
+ int status = SafeNativeMethods.Gdip.GdipImageGetFrameCount(new HandleRef(this, nativeImage), ref dimensionID, count);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return count[0];
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.SelectActiveFrame"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Selects the frame specified by the given
+ /// dimension and index.
+ /// </para>
+ /// </devdoc>
+ public int SelectActiveFrame(FrameDimension dimension, int frameIndex)
+ {
+ int[] count = new int[] { 0 };
+
+ Guid dimensionID = dimension.Guid;
+ int status = SafeNativeMethods.Gdip.GdipImageSelectActiveFrame(new HandleRef(this, nativeImage), ref dimensionID, frameIndex);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return count[0];
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.RotateFlip"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// </para>
+ /// </devdoc>
+ public void RotateFlip(RotateFlipType rotateFlipType)
+ {
+ int status = SafeNativeMethods.Gdip.GdipImageRotateFlip(new HandleRef(this, nativeImage), unchecked((int)rotateFlipType));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.PropertyIdList"]/*' />
+ /// <devdoc>
+ /// Gets an array of the property IDs stored in
+ /// this <see cref='System.Drawing.Image'/>.
+ /// </devdoc>
+ [Browsable(false)]
+ public int[] PropertyIdList
+ {
+ get
+ {
+ int count;
+
+ int status = SafeNativeMethods.Gdip.GdipGetPropertyCount(new HandleRef(this, nativeImage), out count);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ int[] propid = new int[count];
+
+ //if we have a 0 count, just return our empty array
+ if (count == 0)
+ return propid;
+
+ status = SafeNativeMethods.Gdip.GdipGetPropertyIdList(new HandleRef(this, nativeImage), count, propid);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return propid;
+ }
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.GetPropertyItem"]/*' />
+ /// <devdoc>
+ /// Gets the specified property item from this
+ /// <see cref='System.Drawing.Image'/>.
+ /// </devdoc>
+ public PropertyItem GetPropertyItem(int propid)
+ {
+ PropertyItem propitem;
+ int size;
+
+ int status = SafeNativeMethods.Gdip.GdipGetPropertyItemSize(new HandleRef(this, nativeImage), propid, out size);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ if (size == 0)
+ return null;
+
+ IntPtr propdata = Marshal.AllocHGlobal(size);
+
+ if (propdata == IntPtr.Zero)
+ throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.OutOfMemory);
+
+ status = SafeNativeMethods.Gdip.GdipGetPropertyItem(new HandleRef(this, nativeImage), propid, size, propdata);
+
+ try
+ {
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ propitem = PropertyItemInternal.ConvertFromMemory(propdata, 1)[0];
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(propdata);
+ }
+
+ return propitem;
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.RemovePropertyItem"]/*' />
+ /// <devdoc>
+ /// Removes the specified property item from
+ /// this <see cref='System.Drawing.Image'/>.
+ /// </devdoc>
+ public void RemovePropertyItem(int propid)
+ {
+ int status = SafeNativeMethods.Gdip.GdipRemovePropertyItem(new HandleRef(this, nativeImage), propid);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.SetPropertyItem"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Sets the specified property item to the
+ /// specified value.
+ /// </para>
+ /// </devdoc>
+ public void SetPropertyItem(PropertyItem propitem)
+ {
+ PropertyItemInternal propItemInternal = PropertyItemInternal.ConvertFromPropertyItem(propitem);
+
+ using (propItemInternal)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetPropertyItem(new HandleRef(this, nativeImage), propItemInternal);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.PropertyItems"]/*' />
+ /// <devdoc>
+ /// Gets an array of <see cref='System.Drawing.Imaging.PropertyItem'/> objects that describe this <see cref='System.Drawing.Image'/>.
+ /// </devdoc>
+ [Browsable(false)]
+ public PropertyItem[] PropertyItems
+ {
+ get
+ {
+ int size;
+ int count;
+
+ int status = SafeNativeMethods.Gdip.GdipGetPropertyCount(new HandleRef(this, nativeImage), out count);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ status = SafeNativeMethods.Gdip.GdipGetPropertySize(new HandleRef(this, nativeImage), out size, ref count);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ if (size == 0 || count == 0)
+ return new PropertyItem[0];
+
+ IntPtr propdata = Marshal.AllocHGlobal(size);
+
+ status = SafeNativeMethods.Gdip.GdipGetAllPropertyItems(new HandleRef(this, nativeImage), size, count, propdata);
+
+ PropertyItem[] props = null;
+
+ try
+ {
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ props = PropertyItemInternal.ConvertFromMemory(propdata, count);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(propdata);
+ }
+
+ return props;
+ }
+ }
+
+ internal void SetNativeImage(IntPtr handle)
+ {
+ if (handle == IntPtr.Zero)
+ throw new ArgumentException(SR.Format(SR.NativeHandle0), "handle");
+
+ nativeImage = handle;
+ }
+
+ // !! Ambiguous to offer constructor for 'FromHbitmap'
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.FromHbitmap"]/*' />
+ /// <devdoc>
+ /// Creates a <see cref='System.Drawing.Bitmap'/> from a Windows handle.
+ /// </devdoc>
+ public static Bitmap FromHbitmap(IntPtr hbitmap)
+ {
+ return FromHbitmap(hbitmap, IntPtr.Zero);
+ }
+
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.FromHbitmap1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Creates a <see cref='System.Drawing.Bitmap'/> from the specified Windows
+ /// handle with the specified color palette.
+ /// </para>
+ /// </devdoc>
+ public static Bitmap FromHbitmap(IntPtr hbitmap, IntPtr hpalette)
+ {
+ IntPtr bitmap = IntPtr.Zero;
+ int status = SafeNativeMethods.Gdip.GdipCreateBitmapFromHBITMAP(new HandleRef(null, hbitmap), new HandleRef(null, hpalette), out bitmap);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return Bitmap.FromGDIplus(bitmap);
+ }
+
+ /*
+ * Return the pixel size for the specified format (in bits)
+ */
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.GetPixelFormatSize"]/*' />
+ /// <devdoc>
+ /// Returns the size of the specified pixel
+ /// format.
+ /// </devdoc>
+ public static int GetPixelFormatSize(PixelFormat pixfmt)
+ {
+ return (unchecked((int)pixfmt) >> 8) & 0xFF;
+ }
+
+ /*
+ * Determine if the pixel format can have alpha channel
+ */
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.IsAlphaPixelFormat"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Returns a value indicating whether the
+ /// pixel format contains alpha information.
+ /// </para>
+ /// </devdoc>
+ public static bool IsAlphaPixelFormat(PixelFormat pixfmt)
+ {
+ return (pixfmt & PixelFormat.Alpha) != 0;
+ }
+
+ /*
+ * Determine if the pixel format is an extended format,
+ * i.e. supports 16-bit per channel
+ */
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.IsExtendedPixelFormat"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Returns a value indicating whether the pixel format is extended.
+ /// </para>
+ /// </devdoc>
+ public static bool IsExtendedPixelFormat(PixelFormat pixfmt)
+ {
+ return (pixfmt & PixelFormat.Extended) != 0;
+ }
+
+ /*
+ * Determine if the pixel format is canonical format:
+ * PixelFormat32bppARGB
+ * PixelFormat32bppPARGB
+ * PixelFormat64bppARGB
+ * PixelFormat64bppPARGB
+ */
+ /// <include file='doc\Image.uex' path='docs/doc[@for="Image.IsCanonicalPixelFormat"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Returns a value indicating whether the pixel format is canonical.
+ /// </para>
+ /// </devdoc>
+ public static bool IsCanonicalPixelFormat(PixelFormat pixfmt)
+ {
+ return (pixfmt & PixelFormat.Canonical) != 0;
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/ImageAnimator.cs b/src/System.Drawing.Common/src/System/Drawing/ImageAnimator.cs
new file mode 100644
index 0000000000..127578e0ec
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/ImageAnimator.cs
@@ -0,0 +1,440 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.Collections.Generic;
+ using System.Diagnostics;
+ using System.Drawing.Imaging;
+ using System.Threading;
+
+ /// <devdoc>
+ /// Animates one or more images that have time-based frames.
+ /// See the ImageInfo.cs file for the helper nested ImageInfo class.
+ ///
+ /// A common pattern for using this class is as follows (See PictureBox control):
+ /// 1. The winform app (user's code) calls ImageAnimator.Animate() from the main thread.
+ /// 2. Animate() spawns the animating (worker) thread in the background, which will update the image
+ /// frames and raise the OnFrameChanged event, which handler will be executed in the main thred.
+ /// 3. The main thread triggers a paint event (Invalidate()) from the OnFrameChanged handler.
+ /// 4. From the OnPaint event, the main thread calls ImageAnimator.UpdateFrames() and then paints the
+ /// image (updated frame).
+ /// 5. The main thread calls ImageAnimator.StopAnimate() when needed. This does not kill the worker thread.
+ ///
+ /// Comment on locking the image ref:
+ /// We need to synchronize access to sections of code that modify the image(s), but we don't want to block
+ /// animation of one image when modifying a different one; for this, we use the image ref for locking the
+ /// critical section (lock(image)).
+ ///
+ /// This class is safe for multi-threading but Image is not; multithreaded applications must use a critical
+ /// section lock using the image ref the image access is not from the same thread that executes ImageAnimator
+ /// code. If the user code locks on the image ref forever a deadlock will happen preventing the animiation
+ /// from occurring.
+ /// </devdoc>
+ public sealed partial class ImageAnimator
+ {
+ /// <devdoc>
+ /// A list of images to be animated.
+ /// </devdoc>
+ private static List<ImageInfo> s_imageInfoList;
+
+ /// <devdoc>
+ /// A variable to flag when an image or images need to be updated due to the selection of a new frame
+ /// in an image. We don't need to synchronize access to this variable, in the case it is true we don't
+ /// do anything, otherwise the worse case is where a thread attempts to update the image's frame after
+ /// another one did which is harmless.
+ /// </devdoc>
+ private static bool s_anyFrameDirty;
+
+ /// <devdoc>
+ /// The thread used for animating the images.
+ /// </devdoc>
+ private static Thread s_animationThread;
+
+ /// <devdoc>
+ /// Lock that allows either concurrent read-access to the images list for multiple threads, or write-
+ /// access to it for a single thread. Observe that synchronization access to image objects are done
+ /// with critical sections (lock).
+ /// </devdoc>
+ private static ReaderWriterLock s_rwImgListLock = new ReaderWriterLock();
+
+ /// <devdoc>
+ /// Flag to avoid a deadlock when waiting on a write-lock and a an attemp to acquire a read-lock is
+ /// made in the same thread. If RWLock is currently owned by another thread, the current thread is going to wait on an
+ /// event using CoWaitForMultipleHandles while pumps message.
+ /// The comment above refers to the COM STA message pump, not to be confused with the UI message pump.
+ /// However, the effect is the same, the COM message pump will pump messages and dispatch them to the
+ /// window while waiting on the writer lock; this has the potential of creating a re-entrancy situation
+ // that if during the message processing a wait on a reader lock is originated the thread will be block
+ // on itself.
+ /// While processing STA message, the thread may call back into managed code. We do this because
+ /// we can not block finalizer thread. Finalizer thread may need to release STA objects on this thread. If
+ /// the current thread does not pump message, finalizer thread is blocked, and AD unload is blocked while
+ /// waiting for finalizer thread. RWLock is a fair lock. If a thread waits for a writer lock, then it needs
+ /// a reader lock while pumping message, the thread is blocked forever.
+ /// This TLS variable is used to flag the above situation and avoid the deadlock, it is ThreadStatic so each
+ /// thread calling into ImageAnimator is garded against this problem.
+ /// </devdoc>
+
+
+
+
+ [ThreadStatic]
+ private static int t_threadWriterLockWaitCount;
+
+ /// <devdoc>
+ /// Prevent instantiation of this class.
+ /// </devdoc>
+ private ImageAnimator()
+ {
+ }
+
+ /// <devdoc>
+ /// Advances the frame in the specified image. The new frame is drawn the next time the image is rendered.
+ /// </devdoc>
+ public static void UpdateFrames(Image image)
+ {
+ if (!s_anyFrameDirty || image == null || s_imageInfoList == null)
+ {
+ return;
+ }
+
+ if (t_threadWriterLockWaitCount > 0)
+ {
+ // Cannot acquire reader lock - frame update will be missed.
+ return;
+ }
+
+ // If the current thread already has the writer lock, no reader lock is acquired. Instead, the lock count on
+ // the writer lock is incremented. It it already has a reader lock, the locks ref count will be incremented
+ // w/o placing the request at the end of the reader queue.
+
+ s_rwImgListLock.AcquireReaderLock(Timeout.Infinite);
+
+ try
+ {
+ bool foundDirty = false;
+ bool foundImage = false;
+
+ foreach (ImageInfo imageInfo in s_imageInfoList)
+ {
+ if (imageInfo.Image == image)
+ {
+ if (imageInfo.FrameDirty)
+ {
+ // See comment in the class header about locking the image ref.
+#pragma warning disable CA2002
+ lock (imageInfo.Image)
+ {
+#pragma warning restore CA2002
+ imageInfo.UpdateFrame();
+ }
+ }
+ foundImage = true;
+ }
+
+ if (imageInfo.FrameDirty)
+ {
+ foundDirty = true;
+ }
+
+ if (foundDirty && foundImage)
+ {
+ break;
+ }
+ }
+
+ s_anyFrameDirty = foundDirty;
+ }
+ finally
+ {
+ s_rwImgListLock.ReleaseReaderLock();
+ }
+ }
+
+ /// <devdoc>
+ /// Advances the frame in all images currently being animated. The new frame is drawn the next time the image is rendered.
+ /// </devdoc>
+ public static void UpdateFrames()
+ {
+ if (!s_anyFrameDirty || s_imageInfoList == null)
+ {
+ return;
+ }
+ if (t_threadWriterLockWaitCount > 0)
+ {
+ // Cannot acquire reader lock at this time, frames update will be missed.
+ return;
+ }
+
+ s_rwImgListLock.AcquireReaderLock(Timeout.Infinite);
+
+ try
+ {
+ foreach (ImageInfo imageInfo in s_imageInfoList)
+ {
+ // See comment in the class header about locking the image ref.
+#pragma warning disable CA2002
+ lock (imageInfo.Image)
+ {
+#pragma warning restore CA2002
+ imageInfo.UpdateFrame();
+ }
+ }
+ s_anyFrameDirty = false;
+ }
+ finally
+ {
+ s_rwImgListLock.ReleaseReaderLock();
+ }
+ }
+
+ /// <devdoc>
+ /// Adds an image to the image manager. If the image does not support animation this method does nothing.
+ /// This method creates the image list and spawns the animation thread the first time it is called.
+ /// </devdoc>
+ public static void Animate(Image image, EventHandler onFrameChangedHandler)
+ {
+ if (image == null)
+ {
+ return;
+ }
+
+ ImageInfo imageInfo = null;
+
+ // See comment in the class header about locking the image ref.
+#pragma warning disable CA2002
+ lock (image)
+ {
+#pragma warning restore CA2002
+ // could we avoid creating an ImageInfo object if FrameCount == 1 ?
+ imageInfo = new ImageInfo(image);
+ }
+
+ // If the image is already animating, stop animating it
+ StopAnimate(image, onFrameChangedHandler);
+
+ // Acquire a writer lock to modify the image info list. If the thread has a reader lock we need to upgrade
+ // it to a writer lock; acquiring a reader lock in this case would block the thread on itself.
+ // If the thread already has a writer lock its ref count will be incremented w/o placing the request in the
+ // writer queue. See ReaderWriterLock.AcquireWriterLock method in the MSDN.
+
+ bool readerLockHeld = s_rwImgListLock.IsReaderLockHeld;
+ LockCookie lockDowngradeCookie = new LockCookie();
+
+ t_threadWriterLockWaitCount++;
+
+ try
+ {
+ if (readerLockHeld)
+ {
+ lockDowngradeCookie = s_rwImgListLock.UpgradeToWriterLock(Timeout.Infinite);
+ }
+ else
+ {
+ s_rwImgListLock.AcquireWriterLock(Timeout.Infinite);
+ }
+ }
+ finally
+ {
+ t_threadWriterLockWaitCount--;
+ Debug.Assert(t_threadWriterLockWaitCount >= 0, "threadWriterLockWaitCount less than zero.");
+ }
+
+ try
+ {
+ if (imageInfo.Animated)
+ {
+ // Construct the image array
+ //
+ if (s_imageInfoList == null)
+ {
+ s_imageInfoList = new List<ImageInfo>();
+ }
+
+ // Add the new image
+ //
+ imageInfo.FrameChangedHandler = onFrameChangedHandler;
+ s_imageInfoList.Add(imageInfo);
+
+ // Construct a new timer thread if we haven't already
+ //
+ if (s_animationThread == null)
+ {
+ s_animationThread = new Thread(new ThreadStart(AnimateImages50ms));
+ s_animationThread.Name = typeof(ImageAnimator).Name;
+ s_animationThread.IsBackground = true;
+ s_animationThread.Start();
+ }
+ }
+ }
+ finally
+ {
+ if (readerLockHeld)
+ {
+ s_rwImgListLock.DowngradeFromWriterLock(ref lockDowngradeCookie);
+ }
+ else
+ {
+ s_rwImgListLock.ReleaseWriterLock();
+ }
+ }
+ }
+
+ /// <devdoc>
+ /// Whether or not the image has multiple time-based frames.
+ /// </devdoc>
+ public static bool CanAnimate(Image image)
+ {
+ if (image == null)
+ {
+ return false;
+ }
+
+ // See comment in the class header about locking the image ref.
+#pragma warning disable CA2002
+ lock (image)
+ {
+#pragma warning restore CA2002
+ Guid[] dimensions = image.FrameDimensionsList;
+
+ foreach (Guid guid in dimensions)
+ {
+ FrameDimension dimension = new FrameDimension(guid);
+ if (dimension.Equals(FrameDimension.Time))
+ {
+ return image.GetFrameCount(FrameDimension.Time) > 1;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /// <devdoc>
+ /// Removes an image from the image manager so it is no longer animated.
+ /// </devdoc>
+ public static void StopAnimate(Image image, EventHandler onFrameChangedHandler)
+ {
+ // Make sure we have a list of images
+ if (image == null || s_imageInfoList == null)
+ {
+ return;
+ }
+
+ // Acquire a writer lock to modify the image info list - See comments on Animate() about this locking.
+
+ bool readerLockHeld = s_rwImgListLock.IsReaderLockHeld;
+ LockCookie lockDowngradeCookie = new LockCookie();
+
+ t_threadWriterLockWaitCount++;
+
+ try
+ {
+ if (readerLockHeld)
+ {
+ lockDowngradeCookie = s_rwImgListLock.UpgradeToWriterLock(Timeout.Infinite);
+ }
+ else
+ {
+ s_rwImgListLock.AcquireWriterLock(Timeout.Infinite);
+ }
+ }
+ finally
+ {
+ t_threadWriterLockWaitCount--;
+ Debug.Assert(t_threadWriterLockWaitCount >= 0, "threadWriterLockWaitCount less than zero.");
+ }
+
+ try
+ {
+ // Find the corresponding reference and remove it
+ for (int i = 0; i < s_imageInfoList.Count; i++)
+ {
+ ImageInfo imageInfo = s_imageInfoList[i];
+
+ if (image == imageInfo.Image)
+ {
+ if ((onFrameChangedHandler == imageInfo.FrameChangedHandler) || (onFrameChangedHandler != null && onFrameChangedHandler.Equals(imageInfo.FrameChangedHandler)))
+ {
+ s_imageInfoList.Remove(imageInfo);
+ }
+ break;
+ }
+ }
+ }
+ finally
+ {
+ if (readerLockHeld)
+ {
+ s_rwImgListLock.DowngradeFromWriterLock(ref lockDowngradeCookie);
+ }
+ else
+ {
+ s_rwImgListLock.ReleaseWriterLock();
+ }
+ }
+ }
+
+
+ /// <devdoc>
+ /// Worker thread procedure which implements the main animation loop.
+ /// NOTE: This is the ONLY code the worker thread executes, keeping it in one method helps better understand
+ /// any synchronization issues.
+ /// WARNING: Also, this is the only place where ImageInfo objects (not the contained image object) are modified,
+ /// so no access synchronization is required to modify them.
+ /// </devdoc>
+ private static void AnimateImages50ms()
+ {
+ Debug.Assert(s_imageInfoList != null, "Null images list");
+
+ while (true)
+ {
+ // Acquire reader-lock to access imageInfoList, elemens in the list can be modified w/o needing a writer-lock.
+ // Observe that we don't need to check if the thread is waiting or a writer lock here since the thread this
+ // method runs in never acquires a writer lock.
+ s_rwImgListLock.AcquireReaderLock(Timeout.Infinite);
+ try
+ {
+ for (int i = 0; i < s_imageInfoList.Count; i++)
+ {
+ ImageInfo imageInfo = s_imageInfoList[i];
+
+ // Frame delay is measured in 1/100ths of a second. This thread
+ // sleeps for 50 ms = 5/100ths of a second between frame updates,
+ // so we increase the frame delay count 5/100ths of a second
+ // at a time.
+ //
+ imageInfo.FrameTimer += 5;
+ if (imageInfo.FrameTimer >= imageInfo.FrameDelay(imageInfo.Frame))
+ {
+ imageInfo.FrameTimer = 0;
+
+ if (imageInfo.Frame + 1 < imageInfo.FrameCount)
+ {
+ imageInfo.Frame++;
+ }
+ else
+ {
+ imageInfo.Frame = 0;
+ }
+
+ if (imageInfo.FrameDirty)
+ {
+ s_anyFrameDirty = true;
+ }
+ }
+ }
+ }
+ finally
+ {
+ s_rwImgListLock.ReleaseReaderLock();
+ }
+
+ Thread.Sleep(50);
+ }
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/ImageInfo.cs b/src/System.Drawing.Common/src/System/Drawing/ImageInfo.cs
new file mode 100644
index 0000000000..07d93e804c
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/ImageInfo.cs
@@ -0,0 +1,203 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.Diagnostics;
+ using System.Drawing.Imaging;
+
+ /// <devdoc>
+ /// Animates one or more images that have time-based frames.
+ /// This file contains the nested ImageInfo class - See ImageAnimator.cs for the definition of the outer class.
+ /// </devdoc>
+ public sealed partial class ImageAnimator
+ {
+ /// <devdoc>
+ /// ImageAnimator nested helper class used to store extra image state info.
+ /// </devdoc>
+ private class ImageInfo
+ {
+ private const int PropertyTagFrameDelay = 0x5100;
+
+ private Image _image;
+ private int _frame;
+ private int _frameCount;
+ private bool _frameDirty;
+ private bool _animated;
+ private EventHandler _onFrameChangedHandler;
+ private int[] _frameDelay;
+ private int _frameTimer;
+
+ /// <devdoc>
+ /// </devdoc>
+ public ImageInfo(Image image)
+ {
+ _image = image;
+ _animated = ImageAnimator.CanAnimate(image);
+
+ if (_animated)
+ {
+ _frameCount = image.GetFrameCount(FrameDimension.Time);
+
+ PropertyItem frameDelayItem = image.GetPropertyItem(PropertyTagFrameDelay);
+
+ // If the image does not have a frame delay, we just return 0.
+ //
+ if (frameDelayItem != null)
+ {
+ // Convert the frame delay from byte[] to int
+ //
+ byte[] values = frameDelayItem.Value;
+ Debug.Assert(values.Length == 4 * FrameCount, "PropertyItem has invalid value byte array");
+ _frameDelay = new int[FrameCount];
+ for (int i = 0; i < FrameCount; ++i)
+ {
+ _frameDelay[i] = values[i * 4] + 256 * values[i * 4 + 1] + 256 * 256 * values[i * 4 + 2] + 256 * 256 * 256 * values[i * 4 + 3];
+ }
+ }
+ }
+ else
+ {
+ _frameCount = 1;
+ }
+ if (_frameDelay == null)
+ {
+ _frameDelay = new int[FrameCount];
+ }
+ }
+
+ /// <devdoc>
+ /// Whether the image supports animation.
+ /// </devdoc>
+ public bool Animated
+ {
+ get
+ {
+ return _animated;
+ }
+ }
+
+ /// <devdoc>
+ /// The current frame.
+ /// </devdoc>
+ public int Frame
+ {
+ get
+ {
+ return _frame;
+ }
+ set
+ {
+ if (_frame != value)
+ {
+ if (value < 0 || value >= FrameCount)
+ {
+ throw new ArgumentException(SR.Format(SR.InvalidFrame), "value");
+ }
+
+ if (Animated)
+ {
+ _frame = value;
+ _frameDirty = true;
+
+ OnFrameChanged(EventArgs.Empty);
+ }
+ }
+ }
+ }
+
+ /// <devdoc>
+ /// The current frame has not been updated.
+ /// </devdoc>
+ public bool FrameDirty
+ {
+ get
+ {
+ return _frameDirty;
+ }
+ }
+
+ /// <devdoc>
+ /// </devdoc>
+ public EventHandler FrameChangedHandler
+ {
+ get
+ {
+ return _onFrameChangedHandler;
+ }
+ set
+ {
+ _onFrameChangedHandler = value;
+ }
+ }
+
+ /// <devdoc>
+ /// The number of frames in the image.
+ /// </devdoc>
+ public int FrameCount
+ {
+ get
+ {
+ return _frameCount;
+ }
+ }
+
+ /// <devdoc>
+ /// The delay associated with the frame at the specified index.
+ /// </devdoc>
+ public int FrameDelay(int frame)
+ {
+ return _frameDelay[frame];
+ }
+
+ /// <devdoc>
+ /// </devdoc>
+ internal int FrameTimer
+ {
+ get
+ {
+ return _frameTimer;
+ }
+ set
+ {
+ _frameTimer = value;
+ }
+ }
+
+ /// <devdoc>
+ /// The image this object wraps.
+ /// </devdoc>
+ internal Image Image
+ {
+ get
+ {
+ return _image;
+ }
+ }
+
+ /// <devdoc>
+ /// Selects the current frame as the active frame in the image.
+ /// </devdoc>
+ internal void UpdateFrame()
+ {
+ if (_frameDirty)
+ {
+ _image.SelectActiveFrame(FrameDimension.Time, Frame);
+ _frameDirty = false;
+ }
+ }
+
+ /// <devdoc>
+ /// Raises the FrameChanged event.
+ /// </devdoc>
+ protected void OnFrameChanged(EventArgs e)
+ {
+ if (_onFrameChangedHandler != null)
+ {
+ _onFrameChangedHandler(_image, e);
+ }
+ }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/KnownColorTable.cs b/src/System.Drawing.Common/src/System/Drawing/KnownColorTable.cs
new file mode 100644
index 0000000000..a7009e3239
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/KnownColorTable.cs
@@ -0,0 +1,495 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+#if FEATURE_SYSTEM_EVENTS
+ using System.Drawing.Internal;
+#endif
+
+ static internal class KnownColorTable
+ {
+ private static int[] s_colorTable;
+ private static string[] s_colorNameTable;
+
+ /**
+ * Shift count and bit mask for A, R, G, B components
+ */
+ private const int AlphaShift = 24;
+ private const int RedShift = 16;
+ private const int GreenShift = 8;
+ private const int BlueShift = 0;
+
+ private const int Win32RedShift = 0;
+ private const int Win32GreenShift = 8;
+ private const int Win32BlueShift = 16;
+
+ public static Color ArgbToKnownColor(int targetARGB)
+ {
+ EnsureColorTable();
+ for (int index = 0; index < s_colorTable.Length; ++index)
+ {
+ int argb = s_colorTable[index];
+ if (argb == targetARGB)
+ {
+ Color color = Color.FromKnownColor((KnownColor)index);
+ if (!color.IsSystemColor)
+ return color;
+ }
+ }
+
+ return Color.FromArgb(targetARGB);
+ }
+
+ private static void EnsureColorTable()
+ {
+ // no need to lock... worse case is a double create of the table...
+ //
+ if (s_colorTable == null)
+ {
+ InitColorTable();
+ }
+ }
+
+ private static void InitColorTable()
+ {
+ int[] values = new int[(unchecked((int)KnownColor.MenuHighlight)) + 1];
+
+#if FEATURE_SYSTEM_EVENTS
+ SystemEvents.UserPreferenceChanging += new UserPreferenceChangingEventHandler(OnUserPreferenceChanging);
+#endif
+ UpdateSystemColors(values);
+
+ // just consts...
+ //
+ values[(int)KnownColor.Transparent] = 0x00FFFFFF;
+ values[(int)KnownColor.AliceBlue] = unchecked((int)0xFFF0F8FF);
+ values[(int)KnownColor.AntiqueWhite] = unchecked((int)0xFFFAEBD7);
+ values[(int)KnownColor.Aqua] = unchecked((int)0xFF00FFFF);
+ values[(int)KnownColor.Aquamarine] = unchecked((int)0xFF7FFFD4);
+ values[(int)KnownColor.Azure] = unchecked((int)0xFFF0FFFF);
+ values[(int)KnownColor.Beige] = unchecked((int)0xFFF5F5DC);
+ values[(int)KnownColor.Bisque] = unchecked(unchecked((int)0xFFFFE4C4));
+ values[(int)KnownColor.Black] = unchecked((int)0xFF000000);
+ values[(int)KnownColor.BlanchedAlmond] = unchecked((int)0xFFFFEBCD);
+ values[(int)KnownColor.Blue] = unchecked((int)0xFF0000FF);
+ values[(int)KnownColor.BlueViolet] = unchecked((int)0xFF8A2BE2);
+ values[(int)KnownColor.Brown] = unchecked((int)0xFFA52A2A);
+ values[(int)KnownColor.BurlyWood] = unchecked((int)0xFFDEB887);
+ values[(int)KnownColor.CadetBlue] = unchecked((int)0xFF5F9EA0);
+ values[(int)KnownColor.Chartreuse] = unchecked((int)0xFF7FFF00);
+ values[(int)KnownColor.Chocolate] = unchecked((int)0xFFD2691E);
+ values[(int)KnownColor.Coral] = unchecked((int)0xFFFF7F50);
+ values[(int)KnownColor.CornflowerBlue] = unchecked((int)0xFF6495ED);
+ values[(int)KnownColor.Cornsilk] = unchecked((int)0xFFFFF8DC);
+ values[(int)KnownColor.Crimson] = unchecked((int)0xFFDC143C);
+ values[(int)KnownColor.Cyan] = unchecked((int)0xFF00FFFF);
+ values[(int)KnownColor.DarkBlue] = unchecked((int)0xFF00008B);
+ values[(int)KnownColor.DarkCyan] = unchecked((int)0xFF008B8B);
+ values[(int)KnownColor.DarkGoldenrod] = unchecked((int)0xFFB8860B);
+ values[(int)KnownColor.DarkGray] = unchecked((int)0xFFA9A9A9);
+ values[(int)KnownColor.DarkGreen] = unchecked((int)0xFF006400);
+ values[(int)KnownColor.DarkKhaki] = unchecked((int)0xFFBDB76B);
+ values[(int)KnownColor.DarkMagenta] = unchecked((int)0xFF8B008B);
+ values[(int)KnownColor.DarkOliveGreen] = unchecked((int)0xFF556B2F);
+ values[(int)KnownColor.DarkOrange] = unchecked((int)0xFFFF8C00);
+ values[(int)KnownColor.DarkOrchid] = unchecked((int)0xFF9932CC);
+ values[(int)KnownColor.DarkRed] = unchecked((int)0xFF8B0000);
+ values[(int)KnownColor.DarkSalmon] = unchecked((int)0xFFE9967A);
+ values[(int)KnownColor.DarkSeaGreen] = unchecked((int)0xFF8FBC8B);
+ values[(int)KnownColor.DarkSlateBlue] = unchecked((int)0xFF483D8B);
+ values[(int)KnownColor.DarkSlateGray] = unchecked((int)0xFF2F4F4F);
+ values[(int)KnownColor.DarkTurquoise] = unchecked((int)0xFF00CED1);
+ values[(int)KnownColor.DarkViolet] = unchecked((int)0xFF9400D3);
+ values[(int)KnownColor.DeepPink] = unchecked((int)0xFFFF1493);
+ values[(int)KnownColor.DeepSkyBlue] = unchecked((int)0xFF00BFFF);
+ values[(int)KnownColor.DimGray] = unchecked((int)0xFF696969);
+ values[(int)KnownColor.DodgerBlue] = unchecked((int)0xFF1E90FF);
+ values[(int)KnownColor.Firebrick] = unchecked((int)0xFFB22222);
+ values[(int)KnownColor.FloralWhite] = unchecked((int)0xFFFFFAF0);
+ values[(int)KnownColor.ForestGreen] = unchecked((int)0xFF228B22);
+ values[(int)KnownColor.Fuchsia] = unchecked((int)0xFFFF00FF);
+ values[(int)KnownColor.Gainsboro] = unchecked((int)0xFFDCDCDC);
+ values[(int)KnownColor.GhostWhite] = unchecked((int)0xFFF8F8FF);
+ values[(int)KnownColor.Gold] = unchecked((int)0xFFFFD700);
+ values[(int)KnownColor.Goldenrod] = unchecked((int)0xFFDAA520);
+ values[(int)KnownColor.Gray] = unchecked((int)0xFF808080);
+ values[(int)KnownColor.Green] = unchecked((int)0xFF008000);
+ values[(int)KnownColor.GreenYellow] = unchecked((int)0xFFADFF2F);
+ values[(int)KnownColor.Honeydew] = unchecked((int)0xFFF0FFF0);
+ values[(int)KnownColor.HotPink] = unchecked((int)0xFFFF69B4);
+ values[(int)KnownColor.IndianRed] = unchecked((int)0xFFCD5C5C);
+ values[(int)KnownColor.Indigo] = unchecked((int)0xFF4B0082);
+ values[(int)KnownColor.Ivory] = unchecked((int)0xFFFFFFF0);
+ values[(int)KnownColor.Khaki] = unchecked((int)0xFFF0E68C);
+ values[(int)KnownColor.Lavender] = unchecked((int)0xFFE6E6FA);
+ values[(int)KnownColor.LavenderBlush] = unchecked((int)0xFFFFF0F5);
+ values[(int)KnownColor.LawnGreen] = unchecked((int)0xFF7CFC00);
+ values[(int)KnownColor.LemonChiffon] = unchecked((int)0xFFFFFACD);
+ values[(int)KnownColor.LightBlue] = unchecked((int)0xFFADD8E6);
+ values[(int)KnownColor.LightCoral] = unchecked((int)0xFFF08080);
+ values[(int)KnownColor.LightCyan] = unchecked((int)0xFFE0FFFF);
+ values[(int)KnownColor.LightGoldenrodYellow] = unchecked((int)0xFFFAFAD2);
+ values[(int)KnownColor.LightGray] = unchecked((int)0xFFD3D3D3);
+ values[(int)KnownColor.LightGreen] = unchecked((int)0xFF90EE90);
+ values[(int)KnownColor.LightPink] = unchecked((int)0xFFFFB6C1);
+ values[(int)KnownColor.LightSalmon] = unchecked((int)0xFFFFA07A);
+ values[(int)KnownColor.LightSeaGreen] = unchecked((int)0xFF20B2AA);
+ values[(int)KnownColor.LightSkyBlue] = unchecked((int)0xFF87CEFA);
+ values[(int)KnownColor.LightSlateGray] = unchecked((int)0xFF778899);
+ values[(int)KnownColor.LightSteelBlue] = unchecked((int)0xFFB0C4DE);
+ values[(int)KnownColor.LightYellow] = unchecked((int)0xFFFFFFE0);
+ values[(int)KnownColor.Lime] = unchecked((int)0xFF00FF00);
+ values[(int)KnownColor.LimeGreen] = unchecked((int)0xFF32CD32);
+ values[(int)KnownColor.Linen] = unchecked((int)0xFFFAF0E6);
+ values[(int)KnownColor.Magenta] = unchecked((int)0xFFFF00FF);
+ values[(int)KnownColor.Maroon] = unchecked((int)0xFF800000);
+ values[(int)KnownColor.MediumAquamarine] = unchecked((int)0xFF66CDAA);
+ values[(int)KnownColor.MediumBlue] = unchecked((int)0xFF0000CD);
+ values[(int)KnownColor.MediumOrchid] = unchecked((int)0xFFBA55D3);
+ values[(int)KnownColor.MediumPurple] = unchecked((int)0xFF9370DB);
+ values[(int)KnownColor.MediumSeaGreen] = unchecked((int)0xFF3CB371);
+ values[(int)KnownColor.MediumSlateBlue] = unchecked((int)0xFF7B68EE);
+ values[(int)KnownColor.MediumSpringGreen] = unchecked((int)0xFF00FA9A);
+ values[(int)KnownColor.MediumTurquoise] = unchecked((int)0xFF48D1CC);
+ values[(int)KnownColor.MediumVioletRed] = unchecked((int)0xFFC71585);
+ values[(int)KnownColor.MidnightBlue] = unchecked((int)0xFF191970);
+ values[(int)KnownColor.MintCream] = unchecked((int)0xFFF5FFFA);
+ values[(int)KnownColor.MistyRose] = unchecked((int)0xFFFFE4E1);
+ values[(int)KnownColor.Moccasin] = unchecked((int)0xFFFFE4B5);
+ values[(int)KnownColor.NavajoWhite] = unchecked((int)0xFFFFDEAD);
+ values[(int)KnownColor.Navy] = unchecked((int)0xFF000080);
+ values[(int)KnownColor.OldLace] = unchecked((int)0xFFFDF5E6);
+ values[(int)KnownColor.Olive] = unchecked((int)0xFF808000);
+ values[(int)KnownColor.OliveDrab] = unchecked((int)0xFF6B8E23);
+ values[(int)KnownColor.Orange] = unchecked((int)0xFFFFA500);
+ values[(int)KnownColor.OrangeRed] = unchecked((int)0xFFFF4500);
+ values[(int)KnownColor.Orchid] = unchecked((int)0xFFDA70D6);
+ values[(int)KnownColor.PaleGoldenrod] = unchecked((int)0xFFEEE8AA);
+ values[(int)KnownColor.PaleGreen] = unchecked((int)0xFF98FB98);
+ values[(int)KnownColor.PaleTurquoise] = unchecked((int)0xFFAFEEEE);
+ values[(int)KnownColor.PaleVioletRed] = unchecked((int)0xFFDB7093);
+ values[(int)KnownColor.PapayaWhip] = unchecked((int)0xFFFFEFD5);
+ values[(int)KnownColor.PeachPuff] = unchecked((int)0xFFFFDAB9);
+ values[(int)KnownColor.Peru] = unchecked((int)0xFFCD853F);
+ values[(int)KnownColor.Pink] = unchecked((int)0xFFFFC0CB);
+ values[(int)KnownColor.Plum] = unchecked((int)0xFFDDA0DD);
+ values[(int)KnownColor.PowderBlue] = unchecked((int)0xFFB0E0E6);
+ values[(int)KnownColor.Purple] = unchecked((int)0xFF800080);
+ values[(int)KnownColor.Red] = unchecked((int)0xFFFF0000);
+ values[(int)KnownColor.RosyBrown] = unchecked((int)0xFFBC8F8F);
+ values[(int)KnownColor.RoyalBlue] = unchecked((int)0xFF4169E1);
+ values[(int)KnownColor.SaddleBrown] = unchecked((int)0xFF8B4513);
+ values[(int)KnownColor.Salmon] = unchecked((int)0xFFFA8072);
+ values[(int)KnownColor.SandyBrown] = unchecked((int)0xFFF4A460);
+ values[(int)KnownColor.SeaGreen] = unchecked((int)0xFF2E8B57);
+ values[(int)KnownColor.SeaShell] = unchecked((int)0xFFFFF5EE);
+ values[(int)KnownColor.Sienna] = unchecked((int)0xFFA0522D);
+ values[(int)KnownColor.Silver] = unchecked((int)0xFFC0C0C0);
+ values[(int)KnownColor.SkyBlue] = unchecked((int)0xFF87CEEB);
+ values[(int)KnownColor.SlateBlue] = unchecked((int)0xFF6A5ACD);
+ values[(int)KnownColor.SlateGray] = unchecked((int)0xFF708090);
+ values[(int)KnownColor.Snow] = unchecked((int)0xFFFFFAFA);
+ values[(int)KnownColor.SpringGreen] = unchecked((int)0xFF00FF7F);
+ values[(int)KnownColor.SteelBlue] = unchecked((int)0xFF4682B4);
+ values[(int)KnownColor.Tan] = unchecked((int)0xFFD2B48C);
+ values[(int)KnownColor.Teal] = unchecked((int)0xFF008080);
+ values[(int)KnownColor.Thistle] = unchecked((int)0xFFD8BFD8);
+ values[(int)KnownColor.Tomato] = unchecked((int)0xFFFF6347);
+ values[(int)KnownColor.Turquoise] = unchecked((int)0xFF40E0D0);
+ values[(int)KnownColor.Violet] = unchecked((int)0xFFEE82EE);
+ values[(int)KnownColor.Wheat] = unchecked((int)0xFFF5DEB3);
+ values[(int)KnownColor.White] = unchecked((int)0xFFFFFFFF);
+ values[(int)KnownColor.WhiteSmoke] = unchecked((int)0xFFF5F5F5);
+ values[(int)KnownColor.Yellow] = unchecked((int)0xFFFFFF00);
+ values[(int)KnownColor.YellowGreen] = unchecked((int)0xFF9ACD32);
+ s_colorTable = values;
+ }
+
+ private static void EnsureColorNameTable()
+ {
+ // no need to lock... worse case is a double create of the table...
+ //
+ if (s_colorNameTable == null)
+ {
+ InitColorNameTable();
+ }
+ }
+
+ private static void InitColorNameTable()
+ {
+ string[] values = new string[((int)KnownColor.MenuHighlight) + 1];
+
+ // just consts...
+ //
+ values[(int)KnownColor.ActiveBorder] = "ActiveBorder";
+ values[(int)KnownColor.ActiveCaption] = "ActiveCaption";
+ values[(int)KnownColor.ActiveCaptionText] = "ActiveCaptionText";
+ values[(int)KnownColor.AppWorkspace] = "AppWorkspace";
+ values[(int)KnownColor.ButtonFace] = "ButtonFace";
+ values[(int)KnownColor.ButtonHighlight] = "ButtonHighlight";
+ values[(int)KnownColor.ButtonShadow] = "ButtonShadow";
+ values[(int)KnownColor.Control] = "Control";
+ values[(int)KnownColor.ControlDark] = "ControlDark";
+ values[(int)KnownColor.ControlDarkDark] = "ControlDarkDark";
+ values[(int)KnownColor.ControlLight] = "ControlLight";
+ values[(int)KnownColor.ControlLightLight] = "ControlLightLight";
+ values[(int)KnownColor.ControlText] = "ControlText";
+ values[(int)KnownColor.Desktop] = "Desktop";
+ values[(int)KnownColor.GradientActiveCaption] = "GradientActiveCaption";
+ values[(int)KnownColor.GradientInactiveCaption] = "GradientInactiveCaption";
+ values[(int)KnownColor.GrayText] = "GrayText";
+ values[(int)KnownColor.Highlight] = "Highlight";
+ values[(int)KnownColor.HighlightText] = "HighlightText";
+ values[(int)KnownColor.HotTrack] = "HotTrack";
+ values[(int)KnownColor.InactiveBorder] = "InactiveBorder";
+ values[(int)KnownColor.InactiveCaption] = "InactiveCaption";
+ values[(int)KnownColor.InactiveCaptionText] = "InactiveCaptionText";
+ values[(int)KnownColor.Info] = "Info";
+ values[(int)KnownColor.InfoText] = "InfoText";
+ values[(int)KnownColor.Menu] = "Menu";
+ values[(int)KnownColor.MenuBar] = "MenuBar";
+ values[(int)KnownColor.MenuHighlight] = "MenuHighlight";
+ values[(int)KnownColor.MenuText] = "MenuText";
+ values[(int)KnownColor.ScrollBar] = "ScrollBar";
+ values[(int)KnownColor.Window] = "Window";
+ values[(int)KnownColor.WindowFrame] = "WindowFrame";
+ values[(int)KnownColor.WindowText] = "WindowText";
+
+ values[(int)KnownColor.Transparent] = "Transparent";
+ values[(int)KnownColor.AliceBlue] = "AliceBlue";
+ values[(int)KnownColor.AntiqueWhite] = "AntiqueWhite";
+ values[(int)KnownColor.Aqua] = "Aqua";
+ values[(int)KnownColor.Aquamarine] = "Aquamarine";
+ values[(int)KnownColor.Azure] = "Azure";
+ values[(int)KnownColor.Beige] = "Beige";
+ values[(int)KnownColor.Bisque] = "Bisque";
+ values[(int)KnownColor.Black] = "Black";
+ values[(int)KnownColor.BlanchedAlmond] = "BlanchedAlmond";
+ values[(int)KnownColor.Blue] = "Blue";
+ values[(int)KnownColor.BlueViolet] = "BlueViolet";
+ values[(int)KnownColor.Brown] = "Brown";
+ values[(int)KnownColor.BurlyWood] = "BurlyWood";
+ values[(int)KnownColor.CadetBlue] = "CadetBlue";
+ values[(int)KnownColor.Chartreuse] = "Chartreuse";
+ values[(int)KnownColor.Chocolate] = "Chocolate";
+ values[(int)KnownColor.Coral] = "Coral";
+ values[(int)KnownColor.CornflowerBlue] = "CornflowerBlue";
+ values[(int)KnownColor.Cornsilk] = "Cornsilk";
+ values[(int)KnownColor.Crimson] = "Crimson";
+ values[(int)KnownColor.Cyan] = "Cyan";
+ values[(int)KnownColor.DarkBlue] = "DarkBlue";
+ values[(int)KnownColor.DarkCyan] = "DarkCyan";
+ values[(int)KnownColor.DarkGoldenrod] = "DarkGoldenrod";
+ values[(int)KnownColor.DarkGray] = "DarkGray";
+ values[(int)KnownColor.DarkGreen] = "DarkGreen";
+ values[(int)KnownColor.DarkKhaki] = "DarkKhaki";
+ values[(int)KnownColor.DarkMagenta] = "DarkMagenta";
+ values[(int)KnownColor.DarkOliveGreen] = "DarkOliveGreen";
+ values[(int)KnownColor.DarkOrange] = "DarkOrange";
+ values[(int)KnownColor.DarkOrchid] = "DarkOrchid";
+ values[(int)KnownColor.DarkRed] = "DarkRed";
+ values[(int)KnownColor.DarkSalmon] = "DarkSalmon";
+ values[(int)KnownColor.DarkSeaGreen] = "DarkSeaGreen";
+ values[(int)KnownColor.DarkSlateBlue] = "DarkSlateBlue";
+ values[(int)KnownColor.DarkSlateGray] = "DarkSlateGray";
+ values[(int)KnownColor.DarkTurquoise] = "DarkTurquoise";
+ values[(int)KnownColor.DarkViolet] = "DarkViolet";
+ values[(int)KnownColor.DeepPink] = "DeepPink";
+ values[(int)KnownColor.DeepSkyBlue] = "DeepSkyBlue";
+ values[(int)KnownColor.DimGray] = "DimGray";
+ values[(int)KnownColor.DodgerBlue] = "DodgerBlue";
+ values[(int)KnownColor.Firebrick] = "Firebrick";
+ values[(int)KnownColor.FloralWhite] = "FloralWhite";
+ values[(int)KnownColor.ForestGreen] = "ForestGreen";
+ values[(int)KnownColor.Fuchsia] = "Fuchsia";
+ values[(int)KnownColor.Gainsboro] = "Gainsboro";
+ values[(int)KnownColor.GhostWhite] = "GhostWhite";
+ values[(int)KnownColor.Gold] = "Gold";
+ values[(int)KnownColor.Goldenrod] = "Goldenrod";
+ values[(int)KnownColor.Gray] = "Gray";
+ values[(int)KnownColor.Green] = "Green";
+ values[(int)KnownColor.GreenYellow] = "GreenYellow";
+ values[(int)KnownColor.Honeydew] = "Honeydew";
+ values[(int)KnownColor.HotPink] = "HotPink";
+ values[(int)KnownColor.IndianRed] = "IndianRed";
+ values[(int)KnownColor.Indigo] = "Indigo";
+ values[(int)KnownColor.Ivory] = "Ivory";
+ values[(int)KnownColor.Khaki] = "Khaki";
+ values[(int)KnownColor.Lavender] = "Lavender";
+ values[(int)KnownColor.LavenderBlush] = "LavenderBlush";
+ values[(int)KnownColor.LawnGreen] = "LawnGreen";
+ values[(int)KnownColor.LemonChiffon] = "LemonChiffon";
+ values[(int)KnownColor.LightBlue] = "LightBlue";
+ values[(int)KnownColor.LightCoral] = "LightCoral";
+ values[(int)KnownColor.LightCyan] = "LightCyan";
+ values[(int)KnownColor.LightGoldenrodYellow] = "LightGoldenrodYellow";
+ values[(int)KnownColor.LightGray] = "LightGray";
+ values[(int)KnownColor.LightGreen] = "LightGreen";
+ values[(int)KnownColor.LightPink] = "LightPink";
+ values[(int)KnownColor.LightSalmon] = "LightSalmon";
+ values[(int)KnownColor.LightSeaGreen] = "LightSeaGreen";
+ values[(int)KnownColor.LightSkyBlue] = "LightSkyBlue";
+ values[(int)KnownColor.LightSlateGray] = "LightSlateGray";
+ values[(int)KnownColor.LightSteelBlue] = "LightSteelBlue";
+ values[(int)KnownColor.LightYellow] = "LightYellow";
+ values[(int)KnownColor.Lime] = "Lime";
+ values[(int)KnownColor.LimeGreen] = "LimeGreen";
+ values[(int)KnownColor.Linen] = "Linen";
+ values[(int)KnownColor.Magenta] = "Magenta";
+ values[(int)KnownColor.Maroon] = "Maroon";
+ values[(int)KnownColor.MediumAquamarine] = "MediumAquamarine";
+ values[(int)KnownColor.MediumBlue] = "MediumBlue";
+ values[(int)KnownColor.MediumOrchid] = "MediumOrchid";
+ values[(int)KnownColor.MediumPurple] = "MediumPurple";
+ values[(int)KnownColor.MediumSeaGreen] = "MediumSeaGreen";
+ values[(int)KnownColor.MediumSlateBlue] = "MediumSlateBlue";
+ values[(int)KnownColor.MediumSpringGreen] = "MediumSpringGreen";
+ values[(int)KnownColor.MediumTurquoise] = "MediumTurquoise";
+ values[(int)KnownColor.MediumVioletRed] = "MediumVioletRed";
+ values[(int)KnownColor.MidnightBlue] = "MidnightBlue";
+ values[(int)KnownColor.MintCream] = "MintCream";
+ values[(int)KnownColor.MistyRose] = "MistyRose";
+ values[(int)KnownColor.Moccasin] = "Moccasin";
+ values[(int)KnownColor.NavajoWhite] = "NavajoWhite";
+ values[(int)KnownColor.Navy] = "Navy";
+ values[(int)KnownColor.OldLace] = "OldLace";
+ values[(int)KnownColor.Olive] = "Olive";
+ values[(int)KnownColor.OliveDrab] = "OliveDrab";
+ values[(int)KnownColor.Orange] = "Orange";
+ values[(int)KnownColor.OrangeRed] = "OrangeRed";
+ values[(int)KnownColor.Orchid] = "Orchid";
+ values[(int)KnownColor.PaleGoldenrod] = "PaleGoldenrod";
+ values[(int)KnownColor.PaleGreen] = "PaleGreen";
+ values[(int)KnownColor.PaleTurquoise] = "PaleTurquoise";
+ values[(int)KnownColor.PaleVioletRed] = "PaleVioletRed";
+ values[(int)KnownColor.PapayaWhip] = "PapayaWhip";
+ values[(int)KnownColor.PeachPuff] = "PeachPuff";
+ values[(int)KnownColor.Peru] = "Peru";
+ values[(int)KnownColor.Pink] = "Pink";
+ values[(int)KnownColor.Plum] = "Plum";
+ values[(int)KnownColor.PowderBlue] = "PowderBlue";
+ values[(int)KnownColor.Purple] = "Purple";
+ values[(int)KnownColor.Red] = "Red";
+ values[(int)KnownColor.RosyBrown] = "RosyBrown";
+ values[(int)KnownColor.RoyalBlue] = "RoyalBlue";
+ values[(int)KnownColor.SaddleBrown] = "SaddleBrown";
+ values[(int)KnownColor.Salmon] = "Salmon";
+ values[(int)KnownColor.SandyBrown] = "SandyBrown";
+ values[(int)KnownColor.SeaGreen] = "SeaGreen";
+ values[(int)KnownColor.SeaShell] = "SeaShell";
+ values[(int)KnownColor.Sienna] = "Sienna";
+ values[(int)KnownColor.Silver] = "Silver";
+ values[(int)KnownColor.SkyBlue] = "SkyBlue";
+ values[(int)KnownColor.SlateBlue] = "SlateBlue";
+ values[(int)KnownColor.SlateGray] = "SlateGray";
+ values[(int)KnownColor.Snow] = "Snow";
+ values[(int)KnownColor.SpringGreen] = "SpringGreen";
+ values[(int)KnownColor.SteelBlue] = "SteelBlue";
+ values[(int)KnownColor.Tan] = "Tan";
+ values[(int)KnownColor.Teal] = "Teal";
+ values[(int)KnownColor.Thistle] = "Thistle";
+ values[(int)KnownColor.Tomato] = "Tomato";
+ values[(int)KnownColor.Turquoise] = "Turquoise";
+ values[(int)KnownColor.Violet] = "Violet";
+ values[(int)KnownColor.Wheat] = "Wheat";
+ values[(int)KnownColor.White] = "White";
+ values[(int)KnownColor.WhiteSmoke] = "WhiteSmoke";
+ values[(int)KnownColor.Yellow] = "Yellow";
+ values[(int)KnownColor.YellowGreen] = "YellowGreen";
+ s_colorNameTable = values;
+ }
+
+ public static int KnownColorToArgb(KnownColor color)
+ {
+ EnsureColorTable();
+ if (color <= KnownColor.MenuHighlight)
+ {
+ return s_colorTable[unchecked((int)color)];
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ public static string KnownColorToName(KnownColor color)
+ {
+ EnsureColorNameTable();
+ if (color <= KnownColor.MenuHighlight)
+ {
+ return s_colorNameTable[unchecked((int)color)];
+ }
+ else
+ {
+ return null;
+ }
+ }
+ private static int SystemColorToArgb(int index)
+ {
+ return FromWin32Value(SafeNativeMethods.GetSysColor(index));
+ }
+
+ private static int Encode(int alpha, int red, int green, int blue)
+ {
+ return red << RedShift | green << GreenShift | blue << BlueShift | alpha << AlphaShift;
+ }
+
+ private static int FromWin32Value(int value)
+ {
+ return Encode(255,
+ (value >> Win32RedShift) & 0xFF,
+ (value >> Win32GreenShift) & 0xFF,
+ (value >> Win32BlueShift) & 0xFF);
+ }
+
+#if FEATURE_SYSTEM_EVENTS
+ private static void OnUserPreferenceChanging(object sender, UserPreferenceChangingEventArgs e)
+ {
+ if (e.Category == UserPreferenceCategory.Color && colorTable != null)
+ {
+ UpdateSystemColors(colorTable);
+ }
+ }
+#endif
+
+ private static void UpdateSystemColors(int[] colorTable)
+ {
+ colorTable[(int)KnownColor.ActiveBorder] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.ActiveBorder);
+ colorTable[(int)KnownColor.ActiveCaption] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.ActiveCaption);
+ colorTable[(int)KnownColor.ActiveCaptionText] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.ActiveCaptionText);
+ colorTable[(int)KnownColor.AppWorkspace] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.AppWorkspace);
+ colorTable[(int)KnownColor.ButtonFace] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.ButtonFace);
+ colorTable[(int)KnownColor.ButtonHighlight] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.ButtonHighlight);
+ colorTable[(int)KnownColor.ButtonShadow] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.ButtonShadow);
+ colorTable[(int)KnownColor.Control] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.Control);
+ colorTable[(int)KnownColor.ControlDark] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.ControlDark);
+ colorTable[(int)KnownColor.ControlDarkDark] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.ControlDarkDark);
+ colorTable[(int)KnownColor.ControlLight] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.ControlLight);
+ colorTable[(int)KnownColor.ControlLightLight] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.ControlLightLight);
+ colorTable[(int)KnownColor.ControlText] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.ControlText);
+ colorTable[(int)KnownColor.Desktop] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.Desktop);
+ colorTable[(int)KnownColor.GradientActiveCaption] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.GradientActiveCaption);
+ colorTable[(int)KnownColor.GradientInactiveCaption] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.GradientInactiveCaption);
+ colorTable[(int)KnownColor.GrayText] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.GrayText);
+ colorTable[(int)KnownColor.Highlight] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.Highlight);
+ colorTable[(int)KnownColor.HighlightText] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.HighlightText);
+ colorTable[(int)KnownColor.HotTrack] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.HotTrack);
+ colorTable[(int)KnownColor.InactiveBorder] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.InactiveBorder);
+ colorTable[(int)KnownColor.InactiveCaption] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.InactiveCaption);
+ colorTable[(int)KnownColor.InactiveCaptionText] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.InactiveCaptionText);
+ colorTable[(int)KnownColor.Info] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.Info);
+ colorTable[(int)KnownColor.InfoText] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.InfoText);
+ colorTable[(int)KnownColor.Menu] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.Menu);
+ colorTable[(int)KnownColor.MenuBar] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.MenuBar);
+ colorTable[(int)KnownColor.MenuHighlight] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.MenuHighlight);
+ colorTable[(int)KnownColor.MenuText] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.MenuText);
+ colorTable[(int)KnownColor.ScrollBar] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.ScrollBar);
+ colorTable[(int)KnownColor.Window] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.Window);
+ colorTable[(int)KnownColor.WindowFrame] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.WindowFrame);
+ colorTable[(int)KnownColor.WindowText] = SystemColorToArgb((int)SafeNativeMethods.Win32SystemColors.WindowText);
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/LocalAppContextSwitches.cs b/src/System.Drawing.Common/src/System/Drawing/LocalAppContextSwitches.cs
new file mode 100644
index 0000000000..b05162c11d
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/LocalAppContextSwitches.cs
@@ -0,0 +1,32 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.Runtime.CompilerServices;
+
+ internal static class LocalAppContextSwitches
+ {
+ private static int s_dontSupportPngFramesInIcons;
+ private static int s_optimizePrintPreview;
+
+ public static bool DontSupportPngFramesInIcons
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ return LocalAppContext.GetCachedSwitchValue(@"Switch.System.Drawing.DontSupportPngFramesInIcons", ref LocalAppContextSwitches.s_dontSupportPngFramesInIcons);
+ }
+ }
+
+ public static bool OptimizePrintPreview
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ return LocalAppContext.GetCachedSwitchValue(@"Switch.System.Drawing.Printing.OptimizePrintPreview", ref LocalAppContextSwitches.s_optimizePrintPreview);
+ }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/NativeMethods.cs b/src/System.Drawing.Common/src/System/Drawing/NativeMethods.cs
new file mode 100644
index 0000000000..ac7a5a67b8
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/NativeMethods.cs
@@ -0,0 +1,418 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.Drawing.NativeMethods..ctor()")]
+
+namespace System.Drawing
+{
+ using System.Runtime.InteropServices;
+
+ internal class NativeMethods
+ {
+ internal static HandleRef NullHandleRef = new HandleRef(null, IntPtr.Zero);
+
+ public enum RegionFlags
+ {
+ ERROR = 0,
+ NULLREGION = 1,
+ SIMPLEREGION = 2,
+ COMPLEXREGION = 3,
+ }
+
+ public const byte PC_NOCOLLAPSE = 0x04;
+
+
+ public const int MAX_PATH = 260;
+ internal const int SM_REMOTESESSION = 0x1000;
+
+ internal const int OBJ_DC = 3,
+ OBJ_METADC = 4,
+ OBJ_MEMDC = 10,
+ OBJ_ENHMETADC = 12,
+ DIB_RGB_COLORS = 0,
+ BI_BITFIELDS = 3,
+ BI_RGB = 0,
+ BITMAPINFO_MAX_COLORSIZE = 256,
+ SPI_GETICONTITLELOGFONT = 0x001F,
+ SPI_GETNONCLIENTMETRICS = 41,
+ DEFAULT_GUI_FONT = 17;
+
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct BITMAPINFO_FLAT
+ {
+ public int bmiHeader_biSize;// = Marshal.SizeOf(typeof(BITMAPINFOHEADER));
+ public int bmiHeader_biWidth;
+ public int bmiHeader_biHeight;
+ public short bmiHeader_biPlanes;
+ public short bmiHeader_biBitCount;
+ public int bmiHeader_biCompression;
+ public int bmiHeader_biSizeImage;
+ public int bmiHeader_biXPelsPerMeter;
+ public int bmiHeader_biYPelsPerMeter;
+ public int bmiHeader_biClrUsed;
+ public int bmiHeader_biClrImportant;
+
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = BITMAPINFO_MAX_COLORSIZE * 4)]
+ public byte[] bmiColors; // RGBQUAD structs... Blue-Green-Red-Reserved, repeat...
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal class BITMAPINFOHEADER
+ {
+ public int biSize = 40; // ndirect.DllLib.sizeOf( this );
+ public int biWidth;
+ public int biHeight;
+ public short biPlanes;
+ public short biBitCount;
+ public int biCompression;
+ public int biSizeImage;
+ public int biXPelsPerMeter;
+ public int biYPelsPerMeter;
+ public int biClrUsed;
+ public int biClrImportant;
+ }
+
+
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct PALETTEENTRY
+ {
+ public byte peRed;
+ public byte peGreen;
+ public byte peBlue;
+ public byte peFlags;
+ }
+
+ internal struct RGBQUAD
+ {
+ public byte rgbBlue;
+ public byte rgbGreen;
+ public byte rgbRed;
+ // disable csharp compiler warning #0414: field assigned unused value
+#pragma warning disable 0414
+ public byte rgbReserved;
+#pragma warning restore 0414
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal class NONCLIENTMETRICS
+ {
+ public int cbSize = Marshal.SizeOf(typeof(NONCLIENTMETRICS));
+ public int iBorderWidth;
+ public int iScrollWidth;
+ public int iScrollHeight;
+ public int iCaptionWidth;
+ public int iCaptionHeight;
+#pragma warning disable CS0618 // Legacy code: We don't care about using obsolete API's.
+ [MarshalAs(UnmanagedType.Struct)]
+#pragma warning restore CS0618
+ public SafeNativeMethods.LOGFONT lfCaptionFont;
+ public int iSmCaptionWidth;
+ public int iSmCaptionHeight;
+#pragma warning disable CS0618 // Legacy code: We don't care about using obsolete API's.
+ [MarshalAs(UnmanagedType.Struct)]
+#pragma warning restore CS0618
+ public SafeNativeMethods.LOGFONT lfSmCaptionFont;
+ public int iMenuWidth;
+ public int iMenuHeight;
+#pragma warning disable CS0618 // Legacy code: We don't care about using obsolete API's.
+ [MarshalAs(UnmanagedType.Struct)]
+#pragma warning restore CS0618
+ public SafeNativeMethods.LOGFONT lfMenuFont;
+#pragma warning disable CS0618 // Legacy code: We don't care about using obsolete API's.
+ [MarshalAs(UnmanagedType.Struct)]
+#pragma warning restore CS0618
+ public SafeNativeMethods.LOGFONT lfStatusFont;
+#pragma warning disable CS0618 // Legacy code: We don't care about using obsolete API's.
+ [MarshalAs(UnmanagedType.Struct)]
+#pragma warning restore CS0618
+ public SafeNativeMethods.LOGFONT lfMessageFont;
+ }
+
+ /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future.
+ public static byte[] Win9xHalfTonePalette {
+ get {
+
+
+ return new byte[] {
+ // The first 10 system colors
+ 0x00, 0x00, 0x00, 0x00, // 0 Sys Black, gray 0
+ 0x80, 0x00, 0x00, 0x00, // 1 Sys Dk Red
+ 0x00, 0x80, 0x00, 0x00, // 2 Sys Dk Green
+ 0x80, 0x80, 0x00, 0x00, // 3 Sys Dk Yellow
+ 0x00, 0x00, 0x80, 0x00, // 4 Sys Dk Blue
+ 0x80, 0x00, 0x80, 0x00, // 5 Sys Dk Violet
+ 0x00, 0x80, 0x80, 0x00, // 6 Sys Dk Cyan
+ 0xC0, 0xC0, 0xC0, 0x00, // 7 Sys Lt Gray, gray 192
+
+ // The following two system entries are modified for the desktop.
+ 0xC0, 0xDC, 0xC0, 0x00, // 8 Sys 8 - VARIABLE
+ 0xA6, 0xCA, 0xF0, 0x00, // 9 Sys 9 - VARIABLE
+
+ // Gray scale entries (dark)
+ 0x04, 0x04, 0x04, PC_NOCOLLAPSE, // 10 Gray 4
+ 0x08, 0x08, 0x08, PC_NOCOLLAPSE, // 11 Gray 8
+ 0x0C, 0x0C, 0x0C, PC_NOCOLLAPSE, // 12 Gray 12
+ 0x11, 0x11, 0x11, PC_NOCOLLAPSE, // 13 Gray 17
+ 0x16, 0x16, 0x16, PC_NOCOLLAPSE, // 14 Gray 22
+ 0x1C, 0x1C, 0x1C, PC_NOCOLLAPSE, // 15 Gray 28
+ 0x22, 0x22, 0x22, PC_NOCOLLAPSE, // 16 Gray 34
+ 0x29, 0x29, 0x29, PC_NOCOLLAPSE, // 17 Gray 41
+ 0x55, 0x55, 0x55, PC_NOCOLLAPSE, // 18 Gray 85
+ 0x4D, 0x4D, 0x4D, PC_NOCOLLAPSE, // 19 Gray 77
+ 0x42, 0x42, 0x42, PC_NOCOLLAPSE, // 20 Gray 66
+ 0x39, 0x39, 0x39, PC_NOCOLLAPSE, // 21 Gray 57
+
+ // Custom app/OS entries
+ 0xFF, 0x7C, 0x80, PC_NOCOLLAPSE, // 22 Salmon
+ 0xFF, 0x50, 0x50, PC_NOCOLLAPSE, // 23 Red
+ 0xD6, 0x00, 0x93, PC_NOCOLLAPSE, // 24 Purple
+ 0xCC, 0xEC, 0xFF, PC_NOCOLLAPSE, // 25 Lt Blue
+ 0xEF, 0xD6, 0xC6, PC_NOCOLLAPSE, // 26 Win95 Tan
+ 0xE7, 0xE7, 0xD6, PC_NOCOLLAPSE, // 27 Win95 Tan
+ 0xAD, 0xA9, 0x90, PC_NOCOLLAPSE, // 28 Win95 Grayish
+
+ // Halftone palette entries
+ 0x33, 0x00, 0x00, PC_NOCOLLAPSE, // 29
+ 0x66, 0x00, 0x00, PC_NOCOLLAPSE, // 30
+ 0x99, 0x00, 0x00, PC_NOCOLLAPSE, // 31
+ 0xCC, 0x00, 0x00, PC_NOCOLLAPSE, // 32
+ 0x00, 0x33, 0x00, PC_NOCOLLAPSE, // 33
+ 0x33, 0x33, 0x00, PC_NOCOLLAPSE, // 34
+ 0x66, 0x33, 0x00, PC_NOCOLLAPSE, // 35
+ 0x99, 0x33, 0x00, PC_NOCOLLAPSE, // 36
+ 0xCC, 0x33, 0x00, PC_NOCOLLAPSE, // 37
+ 0xFF, 0x33, 0x00, PC_NOCOLLAPSE, // 38
+ 0x00, 0x66, 0x00, PC_NOCOLLAPSE, // 39
+ 0x33, 0x66, 0x00, PC_NOCOLLAPSE, // 40
+ 0x66, 0x66, 0x00, PC_NOCOLLAPSE, // 41
+ 0x99, 0x66, 0x00, PC_NOCOLLAPSE, // 42
+ 0xCC, 0x66, 0x00, PC_NOCOLLAPSE, // 43
+ 0xFF, 0x66, 0x00, PC_NOCOLLAPSE, // 44
+ 0x00, 0x99, 0x00, PC_NOCOLLAPSE, // 45
+ 0x33, 0x99, 0x00, PC_NOCOLLAPSE, // 46
+ 0x66, 0x99, 0x00, PC_NOCOLLAPSE, // 47
+ 0x99, 0x99, 0x00, PC_NOCOLLAPSE, // 48
+ 0xCC, 0x99, 0x00, PC_NOCOLLAPSE, // 49
+ 0xFF, 0x99, 0x00, PC_NOCOLLAPSE, // 50
+ 0x00, 0xCC, 0x00, PC_NOCOLLAPSE, // 51
+ 0x33, 0xCC, 0x00, PC_NOCOLLAPSE, // 52
+ 0x66, 0xCC, 0x00, PC_NOCOLLAPSE, // 53
+ 0x99, 0xCC, 0x00, PC_NOCOLLAPSE, // 54
+ 0xCC, 0xCC, 0x00, PC_NOCOLLAPSE, // 55
+ 0xFF, 0xCC, 0x00, PC_NOCOLLAPSE, // 56
+ 0x66, 0xFF, 0x00, PC_NOCOLLAPSE, // 57
+ 0x99, 0xFF, 0x00, PC_NOCOLLAPSE, // 58
+ 0xCC, 0xFF, 0x00, PC_NOCOLLAPSE, // 59
+ 0x00, 0x00, 0x33, PC_NOCOLLAPSE, // 60
+ 0x33, 0x00, 0x33, PC_NOCOLLAPSE, // 61
+ 0x66, 0x00, 0x33, PC_NOCOLLAPSE, // 62
+ 0x99, 0x00, 0x33, PC_NOCOLLAPSE, // 63
+ 0xCC, 0x00, 0x33, PC_NOCOLLAPSE, // 64
+ 0xFF, 0x00, 0x33, PC_NOCOLLAPSE, // 65
+ 0x00, 0x33, 0x33, PC_NOCOLLAPSE, // 66
+ 0x33, 0x33, 0x33, PC_NOCOLLAPSE, // 67 Gray 51
+ 0x66, 0x33, 0x33, PC_NOCOLLAPSE, // 68
+ 0x99, 0x33, 0x33, PC_NOCOLLAPSE, // 69
+ 0xCC, 0x33, 0x33, PC_NOCOLLAPSE, // 70
+ 0xFF, 0x33, 0x33, PC_NOCOLLAPSE, // 71
+ 0x00, 0x66, 0x33, PC_NOCOLLAPSE, // 72
+ 0x33, 0x66, 0x33, PC_NOCOLLAPSE, // 73
+ 0x66, 0x66, 0x33, PC_NOCOLLAPSE, // 74
+ 0x99, 0x66, 0x33, PC_NOCOLLAPSE, // 75
+ 0xCC, 0x66, 0x33, PC_NOCOLLAPSE, // 76
+ 0xFF, 0x66, 0x33, PC_NOCOLLAPSE, // 77
+ 0x00, 0x99, 0x33, PC_NOCOLLAPSE, // 78
+ 0x33, 0x99, 0x33, PC_NOCOLLAPSE, // 79
+ 0x66, 0x99, 0x33, PC_NOCOLLAPSE, // 80
+ 0x99, 0x99, 0x33, PC_NOCOLLAPSE, // 81
+ 0xCC, 0x99, 0x33, PC_NOCOLLAPSE, // 82
+ 0xFF, 0x99, 0x33, PC_NOCOLLAPSE, // 83
+ 0x00, 0xCC, 0x33, PC_NOCOLLAPSE, // 84
+ 0x33, 0xCC, 0x33, PC_NOCOLLAPSE, // 85
+ 0x66, 0xCC, 0x33, PC_NOCOLLAPSE, // 86
+ 0x99, 0xCC, 0x33, PC_NOCOLLAPSE, // 87
+ 0xCC, 0xCC, 0x33, PC_NOCOLLAPSE, // 88
+ 0xFF, 0xCC, 0x33, PC_NOCOLLAPSE, // 89
+ 0x33, 0xFF, 0x33, PC_NOCOLLAPSE, // 90
+ 0x66, 0xFF, 0x33, PC_NOCOLLAPSE, // 91
+ 0x99, 0xFF, 0x33, PC_NOCOLLAPSE, // 92
+ 0xCC, 0xFF, 0x33, PC_NOCOLLAPSE, // 93
+ 0xFF, 0xFF, 0x33, PC_NOCOLLAPSE, // 94
+ 0x00, 0x00, 0x66, PC_NOCOLLAPSE, // 95
+ 0x33, 0x00, 0x66, PC_NOCOLLAPSE, // 96
+ 0x66, 0x00, 0x66, PC_NOCOLLAPSE, // 97
+ 0x99, 0x00, 0x66, PC_NOCOLLAPSE, // 98
+ 0xCC, 0x00, 0x66, PC_NOCOLLAPSE, // 99
+ 0xFF, 0x00, 0x66, PC_NOCOLLAPSE, // 100
+ 0x00, 0x33, 0x66, PC_NOCOLLAPSE, // 101
+ 0x33, 0x33, 0x66, PC_NOCOLLAPSE, // 102
+ 0x66, 0x33, 0x66, PC_NOCOLLAPSE, // 103
+ 0x99, 0x33, 0x66, PC_NOCOLLAPSE, // 104
+ 0xCC, 0x33, 0x66, PC_NOCOLLAPSE, // 105
+ 0xFF, 0x33, 0x66, PC_NOCOLLAPSE, // 106
+ 0x00, 0x66, 0x66, PC_NOCOLLAPSE, // 107
+ 0x33, 0x66, 0x66, PC_NOCOLLAPSE, // 108
+ 0x66, 0x66, 0x66, PC_NOCOLLAPSE, // 109 Gray 102
+ 0x99, 0x66, 0x66, PC_NOCOLLAPSE, // 110
+ 0xCC, 0x66, 0x66, PC_NOCOLLAPSE, // 111
+ 0x00, 0x99, 0x66, PC_NOCOLLAPSE, // 112
+ 0x33, 0x99, 0x66, PC_NOCOLLAPSE, // 113
+ 0x66, 0x99, 0x66, PC_NOCOLLAPSE, // 114
+ 0x99, 0x99, 0x66, PC_NOCOLLAPSE, // 115
+ 0xCC, 0x99, 0x66, PC_NOCOLLAPSE, // 116
+ 0xFF, 0x99, 0x66, PC_NOCOLLAPSE, // 117
+ 0x00, 0xCC, 0x66, PC_NOCOLLAPSE, // 118
+ 0x33, 0xCC, 0x66, PC_NOCOLLAPSE, // 119
+ 0x99, 0xCC, 0x66, PC_NOCOLLAPSE, // 120
+ 0xCC, 0xCC, 0x66, PC_NOCOLLAPSE, // 121
+ 0xFF, 0xCC, 0x66, PC_NOCOLLAPSE, // 122
+ 0x00, 0xFF, 0x66, PC_NOCOLLAPSE, // 123
+ 0x33, 0xFF, 0x66, PC_NOCOLLAPSE, // 124
+ 0x99, 0xFF, 0x66, PC_NOCOLLAPSE, // 125
+ 0xCC, 0xFF, 0x66, PC_NOCOLLAPSE, // 126
+ 0xFF, 0x00, 0xCC, PC_NOCOLLAPSE, // 127
+ 0xCC, 0x00, 0xFF, PC_NOCOLLAPSE, // 128
+ 0x00, 0x99, 0x99, PC_NOCOLLAPSE, // 129
+ 0x99, 0x33, 0x99, PC_NOCOLLAPSE, // 130
+ 0x99, 0x00, 0x99, PC_NOCOLLAPSE, // 131
+ 0xCC, 0x00, 0x99, PC_NOCOLLAPSE, // 132
+ 0x00, 0x00, 0x99, PC_NOCOLLAPSE, // 133
+ 0x33, 0x33, 0x99, PC_NOCOLLAPSE, // 134
+ 0x66, 0x00, 0x99, PC_NOCOLLAPSE, // 135
+ 0xCC, 0x33, 0x99, PC_NOCOLLAPSE, // 136
+ 0xFF, 0x00, 0x99, PC_NOCOLLAPSE, // 137
+ 0x00, 0x66, 0x99, PC_NOCOLLAPSE, // 138
+ 0x33, 0x66, 0x99, PC_NOCOLLAPSE, // 139
+ 0x66, 0x33, 0x99, PC_NOCOLLAPSE, // 140
+ 0x99, 0x66, 0x99, PC_NOCOLLAPSE, // 141
+ 0xCC, 0x66, 0x99, PC_NOCOLLAPSE, // 142
+ 0xFF, 0x33, 0x99, PC_NOCOLLAPSE, // 143
+ 0x33, 0x99, 0x99, PC_NOCOLLAPSE, // 144
+ 0x66, 0x99, 0x99, PC_NOCOLLAPSE, // 145
+ 0x99, 0x99, 0x99, PC_NOCOLLAPSE, // 146 Gray 153
+ 0xCC, 0x99, 0x99, PC_NOCOLLAPSE, // 147
+ 0xFF, 0x99, 0x99, PC_NOCOLLAPSE, // 148
+ 0x00, 0xCC, 0x99, PC_NOCOLLAPSE, // 149
+ 0x33, 0xCC, 0x99, PC_NOCOLLAPSE, // 150
+ 0x66, 0xCC, 0x66, PC_NOCOLLAPSE, // 151
+ 0x99, 0xCC, 0x99, PC_NOCOLLAPSE, // 152
+ 0xCC, 0xCC, 0x99, PC_NOCOLLAPSE, // 153
+ 0xFF, 0xCC, 0x99, PC_NOCOLLAPSE, // 154
+ 0x00, 0xFF, 0x99, PC_NOCOLLAPSE, // 155
+ 0x33, 0xFF, 0x99, PC_NOCOLLAPSE, // 156
+ 0x66, 0xCC, 0x99, PC_NOCOLLAPSE, // 157
+ 0x99, 0xFF, 0x99, PC_NOCOLLAPSE, // 158
+ 0xCC, 0xFF, 0x99, PC_NOCOLLAPSE, // 159
+ 0xFF, 0xFF, 0x99, PC_NOCOLLAPSE, // 160
+ 0x00, 0x00, 0xCC, PC_NOCOLLAPSE, // 161
+ 0x33, 0x00, 0x99, PC_NOCOLLAPSE, // 162
+ 0x66, 0x00, 0xCC, PC_NOCOLLAPSE, // 163
+ 0x99, 0x00, 0xCC, PC_NOCOLLAPSE, // 164
+ 0xCC, 0x00, 0xCC, PC_NOCOLLAPSE, // 165
+ 0x00, 0x33, 0x99, PC_NOCOLLAPSE, // 166
+ 0x33, 0x33, 0xCC, PC_NOCOLLAPSE, // 167
+ 0x66, 0x33, 0xCC, PC_NOCOLLAPSE, // 168
+ 0x99, 0x33, 0xCC, PC_NOCOLLAPSE, // 169
+ 0xCC, 0x33, 0xCC, PC_NOCOLLAPSE, // 170
+ 0xFF, 0x33, 0xCC, PC_NOCOLLAPSE, // 171
+ 0x00, 0x66, 0xCC, PC_NOCOLLAPSE, // 172
+ 0x33, 0x66, 0xCC, PC_NOCOLLAPSE, // 173
+ 0x66, 0x66, 0x99, PC_NOCOLLAPSE, // 174
+ 0x99, 0x66, 0xCC, PC_NOCOLLAPSE, // 175
+ 0xCC, 0x66, 0xCC, PC_NOCOLLAPSE, // 176
+ 0xFF, 0x66, 0x99, PC_NOCOLLAPSE, // 177
+ 0x00, 0x99, 0xCC, PC_NOCOLLAPSE, // 178
+ 0x33, 0x99, 0xCC, PC_NOCOLLAPSE, // 179
+ 0x66, 0x99, 0xCC, PC_NOCOLLAPSE, // 180
+ 0x99, 0x99, 0xCC, PC_NOCOLLAPSE, // 181
+ 0xCC, 0x99, 0xCC, PC_NOCOLLAPSE, // 182
+ 0xFF, 0x99, 0xCC, PC_NOCOLLAPSE, // 183
+ 0x00, 0xCC, 0xCC, PC_NOCOLLAPSE, // 184
+ 0x33, 0xCC, 0xCC, PC_NOCOLLAPSE, // 185
+ 0x66, 0xCC, 0xCC, PC_NOCOLLAPSE, // 186
+ 0x99, 0xCC, 0xCC, PC_NOCOLLAPSE, // 187
+ 0xCC, 0xCC, 0xCC, PC_NOCOLLAPSE, // 188 Gray 204
+ 0xFF, 0xCC, 0xCC, PC_NOCOLLAPSE, // 189
+ 0x00, 0xFF, 0xCC, PC_NOCOLLAPSE, // 190
+ 0x33, 0xFF, 0xCC, PC_NOCOLLAPSE, // 191
+ 0x66, 0xFF, 0x99, PC_NOCOLLAPSE, // 192
+ 0x99, 0xFF, 0xCC, PC_NOCOLLAPSE, // 193
+ 0xCC, 0xFF, 0xCC, PC_NOCOLLAPSE, // 194
+ 0xFF, 0xFF, 0xCC, PC_NOCOLLAPSE, // 195
+ 0x33, 0x00, 0xCC, PC_NOCOLLAPSE, // 196
+ 0x66, 0x00, 0xFF, PC_NOCOLLAPSE, // 197
+ 0x99, 0x00, 0xFF, PC_NOCOLLAPSE, // 198
+ 0x00, 0x33, 0xCC, PC_NOCOLLAPSE, // 199
+ 0x33, 0x33, 0xFF, PC_NOCOLLAPSE, // 200
+ 0x66, 0x33, 0xFF, PC_NOCOLLAPSE, // 201
+ 0x99, 0x33, 0xFF, PC_NOCOLLAPSE, // 202
+ 0xCC, 0x33, 0xFF, PC_NOCOLLAPSE, // 203
+ 0xFF, 0x33, 0xFF, PC_NOCOLLAPSE, // 204
+ 0x00, 0x66, 0xFF, PC_NOCOLLAPSE, // 205
+ 0x33, 0x66, 0xFF, PC_NOCOLLAPSE, // 206
+ 0x66, 0x66, 0xCC, PC_NOCOLLAPSE, // 207
+ 0x99, 0x66, 0xFF, PC_NOCOLLAPSE, // 208
+ 0xCC, 0x66, 0xFF, PC_NOCOLLAPSE, // 209
+ 0xFF, 0x66, 0xCC, PC_NOCOLLAPSE, // 210
+ 0x00, 0x99, 0xFF, PC_NOCOLLAPSE, // 211
+ 0x33, 0x99, 0xFF, PC_NOCOLLAPSE, // 212
+ 0x66, 0x99, 0xFF, PC_NOCOLLAPSE, // 213
+ 0x99, 0x99, 0xFF, PC_NOCOLLAPSE, // 214
+ 0xCC, 0x99, 0xFF, PC_NOCOLLAPSE, // 215
+ 0xFF, 0x99, 0xFF, PC_NOCOLLAPSE, // 216
+ 0x00, 0xCC, 0xFF, PC_NOCOLLAPSE, // 217
+ 0x33, 0xCC, 0xFF, PC_NOCOLLAPSE, // 218
+ 0x66, 0xCC, 0xFF, PC_NOCOLLAPSE, // 219
+ 0x99, 0xCC, 0xFF, PC_NOCOLLAPSE, // 220
+ 0xCC, 0xCC, 0xFF, PC_NOCOLLAPSE, // 221
+ 0xFF, 0xCC, 0xFF, PC_NOCOLLAPSE, // 222
+ 0x33, 0xFF, 0xFF, PC_NOCOLLAPSE, // 223
+ 0x66, 0xFF, 0xCC, PC_NOCOLLAPSE, // 224
+ 0x99, 0xFF, 0xFF, PC_NOCOLLAPSE, // 225
+ 0xCC, 0xFF, 0xFF, PC_NOCOLLAPSE, // 226
+ 0xFF, 0x66, 0x66, PC_NOCOLLAPSE, // 227
+ 0x66, 0xFF, 0x66, PC_NOCOLLAPSE, // 228
+ 0xFF, 0xFF, 0x66, PC_NOCOLLAPSE, // 229
+ 0x66, 0x66, 0xFF, PC_NOCOLLAPSE, // 230
+ 0xFF, 0x66, 0xFF, PC_NOCOLLAPSE, // 231
+ 0x66, 0xFF, 0xFF, PC_NOCOLLAPSE, // 232
+
+ // App custom colors
+ 0xA5, 0x00, 0x21, PC_NOCOLLAPSE, // 233 Brick red
+
+ // Gray palette
+ 0x5F, 0x5F, 0x5F, PC_NOCOLLAPSE, // 234 Gray 95
+ 0x77, 0x77, 0x77, PC_NOCOLLAPSE, // 235 Gray 119
+ 0x86, 0x86, 0x86, PC_NOCOLLAPSE, // 236 Gray 134
+ 0x96, 0x96, 0x96, PC_NOCOLLAPSE, // 237 Gray 150
+ 0xCB, 0xCB, 0xCB, PC_NOCOLLAPSE, // 238 Gray 203
+ 0xB2, 0xB2, 0xB2, PC_NOCOLLAPSE, // 239 Gray 178
+ 0xD7, 0xD7, 0xD7, PC_NOCOLLAPSE, // 240 Gray 215
+ 0xDD, 0xDD, 0xDD, PC_NOCOLLAPSE, // 241 Gray 221
+ 0xE3, 0xE3, 0xE3, PC_NOCOLLAPSE, // 242 Gray 227
+ 0xEA, 0xEA, 0xEA, PC_NOCOLLAPSE, // 243 Gray 234
+ 0xF1, 0xF1, 0xF1, PC_NOCOLLAPSE, // 244 Gray 241
+ 0xF8, 0xF8, 0xF8, PC_NOCOLLAPSE, // 245 Gray 248
+
+ // The last 10 system colors
+
+ // The following two system entries are modified for the desktop.
+ 0xFF, 0xFB, 0xF0, 0x00, // 246 Sys 246 - VARIABLE
+ 0xA0, 0xA0, 0xA4, 0x00, // 247 Sys 247 - VARIABLE
+
+ 0x80, 0x80, 0x80, 0x00, // 248 Sys Lt Gray, gray 128
+ 0xFF, 0x00, 0x00, 0x00, // 249 Sys Red
+ 0x00, 0xFF, 0x00, 0x00, // 250 Sys Green
+ 0xFF, 0xFF, 0x00, 0x00, // 251 Sys Yellow
+ 0x00, 0x00, 0xFF, 0x00, // 252 Sys Blue
+ 0xFF, 0x00, 0xFF, 0x00, // 253 Sys Violet
+ 0x00, 0xFF, 0xFF, 0x00, // 254 Sys Cyan
+ 0xFF, 0xFF, 0xFF, 0x00, // 255 Sys White, gray 255
+ };
+ }
+ }*/
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Pen.cs b/src/System.Drawing.Common/src/System/Drawing/Pen.cs
new file mode 100644
index 0000000000..0dc58de437
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Pen.cs
@@ -0,0 +1,1158 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.ComponentModel;
+ using System.Diagnostics;
+ using System.Drawing.Drawing2D;
+ using System.Drawing.Internal;
+ using System.Globalization;
+ using System.Runtime.InteropServices;
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Defines an object used to draw lines and curves.
+ /// </para>
+ /// </devdoc>
+ public sealed class Pen : MarshalByRefObject, ISystemColorTracker, ICloneable, IDisposable
+ {
+#if FINALIZATION_WATCH
+ private string allocationSite = Graphics.GetAllocationStack();
+#endif
+
+ // handle to native GDI+ pen object.
+ private IntPtr _nativePen;
+
+ // GDI+ doesn't understand system colors, so we need to cache the value here
+ private Color _color;
+ private bool _immutable;
+
+ /// <devdoc>
+ /// Creates a Pen from a native GDI+ object.
+ /// </devdoc>
+ private Pen(IntPtr nativePen)
+ {
+ SetNativePen(nativePen);
+ }
+
+
+ internal Pen(Color color, bool immutable) : this(color)
+ {
+ _immutable = immutable;
+ }
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.Pen"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the Pen
+ /// class with the specified <see cref='System.Drawing.Pen.Color'/>.
+ /// </para>
+ /// </devdoc>
+ public Pen(Color color) : this(color, (float)1.0)
+ {
+ }
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.Pen1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Pen'/> class with the specified
+ /// <see cref='System.Drawing.Pen.Color'/> and <see cref='System.Drawing.Pen.Width'/>.
+ /// </para>
+ /// </devdoc>
+ public Pen(Color color, float width)
+ {
+ _color = color;
+
+ IntPtr pen = IntPtr.Zero;
+ int status = SafeNativeMethods.Gdip.GdipCreatePen1(color.ToArgb(),
+ width,
+ (int)GraphicsUnit.World,
+ out pen);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativePen(pen);
+
+#if FEATURE_SYSTEM_EVENTS
+ if (this.color.IsSystemColor)
+ {
+ SystemColorTracker.Add(this);
+ }
+#endif
+ }
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.Pen2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the Pen class with the
+ /// specified <see cref='System.Drawing.Pen.Brush'/>.
+ /// </para>
+ /// </devdoc>
+ public Pen(Brush brush) : this(brush, (float)1.0)
+ {
+ }
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.Pen3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Pen'/> class with
+ /// the specified <see cref='System.Drawing.Brush'/> and width.
+ /// </para>
+ /// </devdoc>
+ public Pen(Brush brush, float width)
+ {
+ IntPtr pen = IntPtr.Zero;
+
+ if (brush == null)
+ throw new ArgumentNullException("brush");
+
+ int status = SafeNativeMethods.Gdip.GdipCreatePen2(new HandleRef(brush, brush.NativeBrush),
+ width,
+ (int)GraphicsUnit.World,
+ out pen);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativePen(pen);
+ }
+
+ internal void SetNativePen(IntPtr nativePen)
+ {
+ if (nativePen == IntPtr.Zero)
+ {
+ throw new ArgumentNullException("nativePen");
+ }
+
+ _nativePen = nativePen;
+ }
+
+ /// <devdoc>
+ /// Gets the GDI+ native object.
+ /// </devdoc>
+ [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
+ internal IntPtr NativePen
+ {
+ get
+ {
+ //Need to comment this line out to allow for checking this.NativePen == IntPtr.Zero.
+ //Debug.Assert(this.nativePen != IntPtr.Zero, "this.nativePen == null." );
+ return _nativePen;
+ }
+ }
+
+ /**
+ * Create a copy of the pen object
+ */
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.Clone"]/*' />
+ /// <devdoc>
+ /// Creates an exact copy of this <see cref='System.Drawing.Pen'/>.
+ /// </devdoc>
+ public object Clone()
+ {
+ IntPtr clonePen = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipClonePen(new HandleRef(this, NativePen), out clonePen);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ return new Pen(clonePen);
+ }
+
+ /**
+ * Dispose of resources associated with the Pen object
+ */
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.Dispose"]/*' />
+ /// <devdoc>
+ /// Cleans up Windows resources for this <see cref='System.Drawing.Pen'/>.
+ /// </devdoc>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ private void Dispose(bool disposing)
+ {
+#if FINALIZATION_WATCH
+ if (!disposing && nativePen != IntPtr.Zero)
+ Debug.WriteLine("**********************\nDisposed through finalization:\n" + allocationSite);
+#endif
+
+ if (!disposing)
+ {
+ // If we are finalizing, then we will be unreachable soon. Finalize calls dispose to
+ // release resources, so we must make sure that during finalization we are
+ // not immutable.
+ //
+ _immutable = false;
+ }
+ else if (_immutable)
+ {
+ throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, "Brush"));
+ }
+
+ if (_nativePen != IntPtr.Zero)
+ {
+ try
+ {
+#if DEBUG
+ int status =
+#endif
+ SafeNativeMethods.Gdip.GdipDeletePen(new HandleRef(this, NativePen));
+#if DEBUG
+ Debug.Assert(status == SafeNativeMethods.Gdip.Ok, "GDI+ returned an error status: " + status.ToString(CultureInfo.InvariantCulture));
+#endif
+ }
+ catch (Exception ex)
+ {
+ if (ClientUtils.IsSecurityOrCriticalException(ex))
+ {
+ throw;
+ }
+
+ Debug.Fail("Exception thrown during Dispose: " + ex.ToString());
+ }
+ finally
+ {
+ _nativePen = IntPtr.Zero;
+ }
+ }
+ }
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.Finalize"]/*' />
+ /// <devdoc>
+ /// Cleans up Windows resources for this <see cref='System.Drawing.Pen'/>.
+ /// </devdoc>
+ ~Pen()
+ {
+ Dispose(false);
+ }
+
+ /**
+ * Set/get pen width
+ */
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.Width"]/*' />
+ /// <devdoc>
+ /// Gets or sets the width of this <see cref='System.Drawing.Pen'/>.
+ /// </devdoc>
+ public float Width
+ {
+ get
+ {
+ float[] width = new float[] { 0 };
+
+ int status = SafeNativeMethods.Gdip.GdipGetPenWidth(new HandleRef(this, NativePen), width);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return width[0];
+ }
+
+ set
+ {
+ if (_immutable)
+ throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, "Pen"));
+
+ int status = SafeNativeMethods.Gdip.GdipSetPenWidth(new HandleRef(this, NativePen), value);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /**
+ * Set/get line caps: start, end, and dash
+ */
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.SetLineCap"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Sets the values that determine the style of
+ /// cap used to end lines drawn by this <see cref='System.Drawing.Pen'/>.
+ /// </para>
+ /// </devdoc>
+ public void SetLineCap(LineCap startCap, LineCap endCap, DashCap dashCap)
+ {
+ if (_immutable)
+ throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, "Pen"));
+ int status = SafeNativeMethods.Gdip.GdipSetPenLineCap197819(new HandleRef(this, NativePen),
+ unchecked((int)startCap), unchecked((int)endCap), unchecked((int)dashCap));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.StartCap"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets the cap style used at the
+ /// beginning of lines drawn with this <see cref='System.Drawing.Pen'/>.
+ /// </para>
+ /// </devdoc>
+ public LineCap StartCap
+ {
+ get
+ {
+ int startCap = 0;
+ int status = SafeNativeMethods.Gdip.GdipGetPenStartCap(new HandleRef(this, NativePen), out startCap);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return (LineCap)startCap;
+ }
+ set
+ {
+ //validate the enum value
+ switch (value)
+ {
+ case LineCap.Flat:
+ case LineCap.Square:
+ case LineCap.Round:
+ case LineCap.Triangle:
+ case LineCap.NoAnchor:
+ case LineCap.SquareAnchor:
+ case LineCap.RoundAnchor:
+ case LineCap.DiamondAnchor:
+ case LineCap.ArrowAnchor:
+ case LineCap.AnchorMask:
+ case LineCap.Custom:
+ break;
+ default:
+ throw new InvalidEnumArgumentException("value", unchecked((int)value), typeof(LineCap));
+ }
+ if (_immutable)
+ throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, "Pen"));
+
+ int status = SafeNativeMethods.Gdip.GdipSetPenStartCap(new HandleRef(this, NativePen), unchecked((int)value));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.EndCap"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets the cap style used at the end of
+ /// lines drawn with this <see cref='System.Drawing.Pen'/>.
+ /// </para>
+ /// </devdoc>
+ public LineCap EndCap
+ {
+ get
+ {
+ int endCap = 0;
+ int status = SafeNativeMethods.Gdip.GdipGetPenEndCap(new HandleRef(this, NativePen), out endCap);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return (LineCap)endCap;
+ }
+ set
+ {
+ //validate the enum value
+ switch (value)
+ {
+ case LineCap.Flat:
+ case LineCap.Square:
+ case LineCap.Round:
+ case LineCap.Triangle:
+ case LineCap.NoAnchor:
+ case LineCap.SquareAnchor:
+ case LineCap.RoundAnchor:
+ case LineCap.DiamondAnchor:
+ case LineCap.ArrowAnchor:
+ case LineCap.AnchorMask:
+ case LineCap.Custom:
+ break;
+ default:
+ throw new InvalidEnumArgumentException("value", unchecked((int)value), typeof(LineCap));
+ }
+
+ if (_immutable)
+ throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, "Pen"));
+
+ int status = SafeNativeMethods.Gdip.GdipSetPenEndCap(new HandleRef(this, NativePen), unchecked((int)value));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.DashCap"]/*' />
+ /// <devdoc>
+ /// Gets or sets the cap style used at the
+ /// beginning or end of dashed lines drawn with this <see cref='System.Drawing.Pen'/>.
+ /// </devdoc>
+ public DashCap DashCap
+ {
+ get
+ {
+ int dashCap = 0;
+ int status = SafeNativeMethods.Gdip.GdipGetPenDashCap197819(new HandleRef(this, NativePen), out dashCap);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return (DashCap)dashCap;
+ }
+
+ set
+ {
+ //validate the enum value
+ if (!ClientUtils.IsEnumValid_NotSequential(value, unchecked((int)value),
+ (int)DashCap.Flat,
+ (int)DashCap.Round,
+ (int)DashCap.Triangle))
+ {
+ throw new InvalidEnumArgumentException("value", unchecked((int)value), typeof(DashCap));
+ }
+
+ if (_immutable)
+ throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, "Pen"));
+
+ int status = SafeNativeMethods.Gdip.GdipSetPenDashCap197819(new HandleRef(this, NativePen), unchecked((int)value));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /**
+ * Set/get line join
+ */
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.LineJoin"]/*' />
+ /// <devdoc>
+ /// Gets or sets the join style for the ends of
+ /// two overlapping lines drawn with this <see cref='System.Drawing.Pen'/>.
+ /// </devdoc>
+ public LineJoin LineJoin
+ {
+ get
+ {
+ int lineJoin = 0;
+ int status = SafeNativeMethods.Gdip.GdipGetPenLineJoin(new HandleRef(this, NativePen), out lineJoin);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return (LineJoin)lineJoin;
+ }
+
+ set
+ {
+ //valid values are 0x0 to 0x3
+ if (!ClientUtils.IsEnumValid(value, unchecked((int)value), (int)LineJoin.Miter, (int)LineJoin.MiterClipped))
+ {
+ throw new InvalidEnumArgumentException("value", unchecked((int)value), typeof(LineJoin));
+ }
+
+ if (_immutable)
+ throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, "Pen"));
+
+ int status = SafeNativeMethods.Gdip.GdipSetPenLineJoin(new HandleRef(this, NativePen), unchecked((int)value));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /**
+ * Set/get custom start line cap
+ */
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.CustomStartCap"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets a custom cap style to use at the beginning of lines
+ /// drawn with this <see cref='System.Drawing.Pen'/>.
+ /// </para>
+ /// </devdoc>
+ public CustomLineCap CustomStartCap
+ {
+ get
+ {
+ IntPtr lineCap = IntPtr.Zero;
+ int status = SafeNativeMethods.Gdip.GdipGetPenCustomStartCap(new HandleRef(this, NativePen), out lineCap);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return CustomLineCap.CreateCustomLineCapObject(lineCap);
+ }
+
+ set
+ {
+ if (_immutable)
+ throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, "Pen"));
+
+ int status = SafeNativeMethods.Gdip.GdipSetPenCustomStartCap(new HandleRef(this, NativePen),
+ new HandleRef(value, (value == null) ? IntPtr.Zero : value.nativeCap));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /**
+ * Set/get custom end line cap
+ */
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.CustomEndCap"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets a custom cap style to use at the end of lines
+ /// drawn with this <see cref='System.Drawing.Pen'/>.
+ /// </para>
+ /// </devdoc>
+ public CustomLineCap CustomEndCap
+ {
+ get
+ {
+ IntPtr lineCap = IntPtr.Zero;
+ int status = SafeNativeMethods.Gdip.GdipGetPenCustomEndCap(new HandleRef(this, NativePen), out lineCap);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return CustomLineCap.CreateCustomLineCapObject(lineCap);
+ }
+
+ set
+ {
+ if (_immutable)
+ throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, "Pen"));
+
+ int status = SafeNativeMethods.Gdip.GdipSetPenCustomEndCap(new HandleRef(this, NativePen),
+ new HandleRef(value, (value == null) ? IntPtr.Zero : value.nativeCap));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.MiterLimit"]/*' />
+ /// <devdoc>
+ /// Gets or sets the limit of the thickness of
+ /// the join on a mitered corner.
+ /// </devdoc>
+ public float MiterLimit
+ {
+ get
+ {
+ float[] miterLimit = new float[] { 0 };
+ int status = SafeNativeMethods.Gdip.GdipGetPenMiterLimit(new HandleRef(this, NativePen), miterLimit);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return miterLimit[0];
+ }
+
+ set
+ {
+ if (_immutable)
+ throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, "Pen"));
+
+ int status = SafeNativeMethods.Gdip.GdipSetPenMiterLimit(new HandleRef(this, NativePen), value);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /**
+ * Pen Mode
+ */
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.Alignment"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets
+ /// the alignment for objects drawn with this <see cref='System.Drawing.Pen'/>.
+ /// </para>
+ /// </devdoc>
+ public PenAlignment Alignment
+ {
+ get
+ {
+ PenAlignment penMode = 0;
+
+ int status = SafeNativeMethods.Gdip.GdipGetPenMode(new HandleRef(this, NativePen), out penMode);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return (PenAlignment)penMode;
+ }
+ set
+ {
+ //validate the enum value
+ //valid values are 0x0 to 0x4
+ if (!ClientUtils.IsEnumValid(value, unchecked((int)value), (int)PenAlignment.Center, (int)PenAlignment.Right))
+ {
+ throw new InvalidEnumArgumentException("value", unchecked((int)value), typeof(PenAlignment));
+ }
+
+ if (_immutable)
+ throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, "Pen"));
+
+ int status = SafeNativeMethods.Gdip.GdipSetPenMode(new HandleRef(this, NativePen), value);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /**
+ * Set/get pen transform
+ */
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.Transform"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets
+ /// or sets the geometrical transform for objects drawn with this <see cref='System.Drawing.Pen'/>.
+ /// </para>
+ /// </devdoc>
+ public Matrix Transform
+ {
+ get
+ {
+ Matrix matrix = new Matrix();
+
+ int status = SafeNativeMethods.Gdip.GdipGetPenTransform(new HandleRef(this, NativePen), new HandleRef(matrix, matrix.nativeMatrix));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return matrix;
+ }
+
+ set
+ {
+ if (_immutable)
+ throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, "Pen"));
+
+ if (value == null)
+ {
+ throw new ArgumentNullException("value");
+ }
+
+ int status = SafeNativeMethods.Gdip.GdipSetPenTransform(new HandleRef(this, NativePen), new HandleRef(value, value.nativeMatrix));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.ResetTransform"]/*' />
+ /// <devdoc>
+ /// Resets the geometric transform for this
+ /// <see cref='System.Drawing.Pen'/> to
+ /// identity.
+ /// </devdoc>
+ public void ResetTransform()
+ {
+ int status = SafeNativeMethods.Gdip.GdipResetPenTransform(new HandleRef(this, NativePen));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.MultiplyTransform"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Multiplies the transform matrix for this
+ /// <see cref='System.Drawing.Pen'/> by
+ /// the specified <see cref='System.Drawing.Drawing2D.Matrix'/>.
+ /// </para>
+ /// </devdoc>
+ public void MultiplyTransform(Matrix matrix)
+ {
+ MultiplyTransform(matrix, MatrixOrder.Prepend);
+ }
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.MultiplyTransform1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Multiplies the transform matrix for this
+ /// <see cref='System.Drawing.Pen'/> by
+ /// the specified <see cref='System.Drawing.Drawing2D.Matrix'/> in the specified order.
+ /// </para>
+ /// </devdoc>
+ public void MultiplyTransform(Matrix matrix, MatrixOrder order)
+ {
+ int status = SafeNativeMethods.Gdip.GdipMultiplyPenTransform(new HandleRef(this, NativePen),
+ new HandleRef(matrix, matrix.nativeMatrix),
+ order);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.TranslateTransform"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Translates the local geometrical transform
+ /// by the specified dimmensions. This method prepends the translation to the
+ /// transform.
+ /// </para>
+ /// </devdoc>
+ public void TranslateTransform(float dx, float dy)
+ {
+ TranslateTransform(dx, dy, MatrixOrder.Prepend);
+ }
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.TranslateTransform1"]/*' />
+ /// <devdoc>
+ /// Translates the local geometrical transform
+ /// by the specified dimmensions in the specified order.
+ /// </devdoc>
+ public void TranslateTransform(float dx, float dy, MatrixOrder order)
+ {
+ int status = SafeNativeMethods.Gdip.GdipTranslatePenTransform(new HandleRef(this, NativePen),
+ dx, dy, order);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.ScaleTransform"]/*' />
+ /// <devdoc>
+ /// Scales the local geometric transform by the
+ /// specified amounts. This method prepends the scaling matrix to the transform.
+ /// </devdoc>
+ public void ScaleTransform(float sx, float sy)
+ {
+ ScaleTransform(sx, sy, MatrixOrder.Prepend);
+ }
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.ScaleTransform1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Scales the local geometric transform by the
+ /// specified amounts in the specified order.
+ /// </para>
+ /// </devdoc>
+ public void ScaleTransform(float sx, float sy, MatrixOrder order)
+ {
+ int status = SafeNativeMethods.Gdip.GdipScalePenTransform(new HandleRef(this, NativePen),
+ sx, sy, order);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.RotateTransform"]/*' />
+ /// <devdoc>
+ /// Rotates the local geometric transform by the
+ /// specified amount. This method prepends the rotation to the transform.
+ /// </devdoc>
+ public void RotateTransform(float angle)
+ {
+ RotateTransform(angle, MatrixOrder.Prepend);
+ }
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.RotateTransform1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Rotates the local geometric transform by the specified
+ /// amount in the specified order.
+ /// </para>
+ /// </devdoc>
+ public void RotateTransform(float angle, MatrixOrder order)
+ {
+ int status = SafeNativeMethods.Gdip.GdipRotatePenTransform(new HandleRef(this, NativePen),
+ angle, order);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /**
+ * Set/get pen type (color, line texture, or brush)
+ *
+ * @notes GetLineFill returns either a Brush object
+ * or a LineTexture object.
+ */
+
+ private void InternalSetColor(Color value)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetPenColor(new HandleRef(this, NativePen),
+ _color.ToArgb());
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ _color = value;
+ }
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.PenType"]/*' />
+ /// <devdoc>
+ /// Gets the style of lines drawn with this
+ /// <see cref='System.Drawing.Pen'/>.
+ /// </devdoc>
+ public PenType PenType
+ {
+ get
+ {
+ int type = -1;
+
+ int status = SafeNativeMethods.Gdip.GdipGetPenFillType(new HandleRef(this, NativePen), out type);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return (PenType)type;
+ }
+ }
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.Color"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets the color of this <see cref='System.Drawing.Pen'/>.
+ /// </para>
+ /// </devdoc>
+ public Color Color
+ {
+ get
+ {
+ if (_color == Color.Empty)
+ {
+ int colorARGB = 0;
+ int status = SafeNativeMethods.Gdip.GdipGetPenColor(new HandleRef(this, NativePen), out colorARGB);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ _color = Color.FromArgb(colorARGB);
+ }
+
+ // GDI+ doesn't understand system colors, so we can't use GdipGetPenColor in the general case
+ return _color;
+ }
+
+ set
+ {
+ if (_immutable)
+ throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, "Pen"));
+
+ if (value != _color)
+ {
+ Color oldColor = _color;
+ _color = value;
+ InternalSetColor(value);
+
+#if FEATURE_SYSTEM_EVENTS
+ // NOTE: We never remove pens from the active list, so if someone is
+ // changing their pen colors a lot, this could be a problem.
+ if (value.IsSystemColor && !oldColor.IsSystemColor)
+ {
+ SystemColorTracker.Add(this);
+ }
+#endif
+ }
+ }
+ }
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.Brush"]/*' />
+ /// <devdoc>
+ /// Gets or sets the <see cref='System.Drawing.Brush'/> that
+ /// determines attributes of this <see cref='System.Drawing.Pen'/>.
+ /// </devdoc>
+ public Brush Brush
+ {
+ get
+ {
+ Brush brush = null;
+
+ switch (PenType)
+ {
+ case PenType.SolidColor:
+ brush = new SolidBrush(GetNativeBrush());
+ break;
+
+ case PenType.HatchFill:
+ brush = new HatchBrush(GetNativeBrush());
+ break;
+
+ case PenType.TextureFill:
+ brush = new TextureBrush(GetNativeBrush());
+ break;
+
+ case PenType.PathGradient:
+ brush = new PathGradientBrush(GetNativeBrush());
+ break;
+
+ case PenType.LinearGradient:
+ brush = new LinearGradientBrush(GetNativeBrush());
+ break;
+
+ default:
+ break;
+ }
+
+ return brush;
+ }
+
+ set
+ {
+ if (_immutable)
+ throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, "Pen"));
+
+ if (value == null)
+ throw new ArgumentNullException("value");
+
+ int status = SafeNativeMethods.Gdip.GdipSetPenBrushFill(new HandleRef(this, NativePen),
+ new HandleRef(value, value.NativeBrush));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ private IntPtr GetNativeBrush()
+ {
+ IntPtr nativeBrush = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipGetPenBrushFill(new HandleRef(this, NativePen), out nativeBrush);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return nativeBrush;
+ }
+
+ /**
+ * Set/get dash attributes
+ */
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.DashStyle"]/*' />
+ /// <devdoc>
+ /// Gets or sets the style used for dashed
+ /// lines drawn with this <see cref='System.Drawing.Pen'/>.
+ /// </devdoc>
+ public DashStyle DashStyle
+ {
+ get
+ {
+ int dashstyle = 0;
+
+ int status = SafeNativeMethods.Gdip.GdipGetPenDashStyle(new HandleRef(this, NativePen), out dashstyle);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return (DashStyle)dashstyle;
+ }
+
+ set
+ {
+ //valid values are 0x0 to 0x5
+ if (!ClientUtils.IsEnumValid(value, unchecked((int)value), (int)DashStyle.Solid, (int)DashStyle.Custom))
+ {
+ throw new InvalidEnumArgumentException("value", unchecked((int)value), typeof(DashStyle));
+ }
+
+ if (_immutable)
+ throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, "Pen"));
+
+ int status = SafeNativeMethods.Gdip.GdipSetPenDashStyle(new HandleRef(this, NativePen), unchecked((int)value));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ //if we just set pen style to "custom" without defining the custom dash pattern,
+ //lets make sure we can return a valid value...
+ //
+ if (value == DashStyle.Custom)
+ {
+ EnsureValidDashPattern();
+ }
+ }
+ }
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.EnsureValidDashPattern"]/*' />
+ /// <devdoc>
+ /// This method is called after the user sets the pen's dash style to custom.
+ /// Here, we make sure that there is a default value set for the custom pattern.
+ /// </devdoc>
+ private void EnsureValidDashPattern()
+ {
+ int retval = 0;
+ int status = SafeNativeMethods.Gdip.GdipGetPenDashCount(new HandleRef(this, NativePen), out retval);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ if (retval == 0)
+ {
+ //just set to a solid pattern
+ DashPattern = new float[] { 1 };
+ }
+ }
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.DashOffset"]/*' />
+ /// <devdoc>
+ /// Gets or sets the distance from the start of
+ /// a line to the beginning of a dash pattern.
+ /// </devdoc>
+ public float DashOffset
+ {
+ get
+ {
+ float[] dashoffset = new float[] { 0 };
+
+ int status = SafeNativeMethods.Gdip.GdipGetPenDashOffset(new HandleRef(this, NativePen), dashoffset);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return dashoffset[0];
+ }
+ set
+ {
+ if (_immutable)
+ throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, "Pen"));
+
+ int status = SafeNativeMethods.Gdip.GdipSetPenDashOffset(new HandleRef(this, NativePen), value);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.DashPattern"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets an array of cutom dashes and
+ /// spaces. The dashes are made up of line segments.
+ /// </para>
+ /// </devdoc>
+ public float[] DashPattern
+ {
+ get
+ {
+ float[] dashArray;
+
+ // Figure out how many dash elements we have
+
+ int retval = 0;
+ int status = SafeNativeMethods.Gdip.GdipGetPenDashCount(new HandleRef(this, NativePen), out retval);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ int count = retval;
+
+ // Allocate temporary native memory buffer
+ // and pass it to GDI+ to retrieve dash array elements
+
+ IntPtr buf = Marshal.AllocHGlobal(checked(4 * count));
+ status = SafeNativeMethods.Gdip.GdipGetPenDashArray(new HandleRef(this, NativePen), buf, count);
+
+ try
+ {
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ dashArray = new float[count];
+
+ Marshal.Copy(buf, dashArray, 0, count);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+
+ return dashArray;
+ }
+
+ set
+ {
+ if (_immutable)
+ throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, "Pen"));
+
+
+ //validate the DashPattern value being set
+ if (value == null || value.Length == 0)
+ {
+ throw new ArgumentException(SR.Format(SR.InvalidDashPattern));
+ }
+
+ int count = value.Length;
+
+ IntPtr buf = Marshal.AllocHGlobal(checked(4 * count));
+
+ try
+ {
+ Marshal.Copy(value, 0, buf, count);
+
+ int status = SafeNativeMethods.Gdip.GdipSetPenDashArray(new HandleRef(this, NativePen), new HandleRef(buf, buf), count);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buf);
+ }
+ }
+ }
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.CompoundArray"]/*' />
+ /// <devdoc>
+ /// Gets or sets an array of cutom dashes and
+ /// spaces. The dashes are made up of line segments.
+ /// </devdoc>
+ public float[] CompoundArray
+ {
+ get
+ {
+ int count = 0;
+
+ int status = SafeNativeMethods.Gdip.GdipGetPenCompoundCount(new HandleRef(this, NativePen), out count);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ float[] array = new float[count];
+
+ status = SafeNativeMethods.Gdip.GdipGetPenCompoundArray(new HandleRef(this, NativePen), array, count);
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return array;
+ }
+ set
+ {
+ if (_immutable)
+ throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, "Pen"));
+
+ int status = SafeNativeMethods.Gdip.GdipSetPenCompoundArray(new HandleRef(this, NativePen), value, value.Length);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+ }
+
+ /// <include file='doc\Pen.uex' path='docs/doc[@for="Pen.ISystemColorTracker.OnSystemColorChanged"]/*' />
+ /// <internalonly/>
+ void ISystemColorTracker.OnSystemColorChanged()
+ {
+ if (NativePen != IntPtr.Zero)
+ InternalSetColor(_color);
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Pens.cs b/src/System.Drawing.Common/src/System/Drawing/Pens.cs
new file mode 100644
index 0000000000..130ff652a6
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Pens.cs
@@ -0,0 +1,2697 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens"]/*' />
+ /// <devdoc>
+ /// Pens for all the standard colors.
+ /// </devdoc>
+ public sealed class Pens
+ {
+ private static readonly object s_transparentKey = new object();
+ private static readonly object s_aliceBlueKey = new object();
+ private static readonly object s_antiqueWhiteKey = new object();
+ private static readonly object s_aquaKey = new object();
+ private static readonly object s_aquamarineKey = new object();
+ private static readonly object s_azureKey = new object();
+ private static readonly object s_beigeKey = new object();
+ private static readonly object s_bisqueKey = new object();
+ private static readonly object s_blackKey = new object();
+ private static readonly object s_blanchedAlmondKey = new object();
+ private static readonly object s_blueKey = new object();
+ private static readonly object s_blueVioletKey = new object();
+ private static readonly object s_brownKey = new object();
+ private static readonly object s_burlyWoodKey = new object();
+ private static readonly object s_cadetBlueKey = new object();
+ private static readonly object s_chartreuseKey = new object();
+ private static readonly object s_chocolateKey = new object();
+ private static readonly object s_choralKey = new object();
+ private static readonly object s_cornflowerBlueKey = new object();
+ private static readonly object s_cornsilkKey = new object();
+ private static readonly object s_crimsonKey = new object();
+ private static readonly object s_cyanKey = new object();
+ private static readonly object s_darkBlueKey = new object();
+ private static readonly object s_darkCyanKey = new object();
+ private static readonly object s_darkGoldenrodKey = new object();
+ private static readonly object s_darkGrayKey = new object();
+ private static readonly object s_darkGreenKey = new object();
+ private static readonly object s_darkKhakiKey = new object();
+ private static readonly object s_darkMagentaKey = new object();
+ private static readonly object s_darkOliveGreenKey = new object();
+ private static readonly object s_darkOrangeKey = new object();
+ private static readonly object s_darkOrchidKey = new object();
+ private static readonly object s_darkRedKey = new object();
+ private static readonly object s_darkSalmonKey = new object();
+ private static readonly object s_darkSeaGreenKey = new object();
+ private static readonly object s_darkSlateBlueKey = new object();
+ private static readonly object s_darkSlateGrayKey = new object();
+ private static readonly object s_darkTurquoiseKey = new object();
+ private static readonly object s_darkVioletKey = new object();
+ private static readonly object s_deepPinkKey = new object();
+ private static readonly object s_deepSkyBlueKey = new object();
+ private static readonly object s_dimGrayKey = new object();
+ private static readonly object s_dodgerBlueKey = new object();
+ private static readonly object s_firebrickKey = new object();
+ private static readonly object s_floralWhiteKey = new object();
+ private static readonly object s_forestGreenKey = new object();
+ private static readonly object s_fuchiaKey = new object();
+ private static readonly object s_gainsboroKey = new object();
+ private static readonly object s_ghostWhiteKey = new object();
+ private static readonly object s_goldKey = new object();
+ private static readonly object s_goldenrodKey = new object();
+ private static readonly object s_grayKey = new object();
+ private static readonly object s_greenKey = new object();
+ private static readonly object s_greenYellowKey = new object();
+ private static readonly object s_honeydewKey = new object();
+ private static readonly object s_hotPinkKey = new object();
+ private static readonly object s_indianRedKey = new object();
+ private static readonly object s_indigoKey = new object();
+ private static readonly object s_ivoryKey = new object();
+ private static readonly object s_khakiKey = new object();
+ private static readonly object s_lavenderKey = new object();
+ private static readonly object s_lavenderBlushKey = new object();
+ private static readonly object s_lawnGreenKey = new object();
+ private static readonly object s_lemonChiffonKey = new object();
+ private static readonly object s_lightBlueKey = new object();
+ private static readonly object s_lightCoralKey = new object();
+ private static readonly object s_lightCyanKey = new object();
+ private static readonly object s_lightGoldenrodYellowKey = new object();
+ private static readonly object s_lightGreenKey = new object();
+ private static readonly object s_lightGrayKey = new object();
+ private static readonly object s_lightPinkKey = new object();
+ private static readonly object s_lightSalmonKey = new object();
+ private static readonly object s_lightSeaGreenKey = new object();
+ private static readonly object s_lightSkyBlueKey = new object();
+ private static readonly object s_lightSlateGrayKey = new object();
+ private static readonly object s_lightSteelBlueKey = new object();
+ private static readonly object s_lightYellowKey = new object();
+ private static readonly object s_limeKey = new object();
+ private static readonly object s_limeGreenKey = new object();
+ private static readonly object s_linenKey = new object();
+ private static readonly object s_magentaKey = new object();
+ private static readonly object s_maroonKey = new object();
+ private static readonly object s_mediumAquamarineKey = new object();
+ private static readonly object s_mediumBlueKey = new object();
+ private static readonly object s_mediumOrchidKey = new object();
+ private static readonly object s_mediumPurpleKey = new object();
+ private static readonly object s_mediumSeaGreenKey = new object();
+ private static readonly object s_mediumSlateBlueKey = new object();
+ private static readonly object s_mediumSpringGreenKey = new object();
+ private static readonly object s_mediumTurquoiseKey = new object();
+ private static readonly object s_mediumVioletRedKey = new object();
+ private static readonly object s_midnightBlueKey = new object();
+ private static readonly object s_mintCreamKey = new object();
+ private static readonly object s_mistyRoseKey = new object();
+ private static readonly object s_moccasinKey = new object();
+ private static readonly object s_navajoWhiteKey = new object();
+ private static readonly object s_navyKey = new object();
+ private static readonly object s_oldLaceKey = new object();
+ private static readonly object s_oliveKey = new object();
+ private static readonly object s_oliveDrabKey = new object();
+ private static readonly object s_orangeKey = new object();
+ private static readonly object s_orangeRedKey = new object();
+ private static readonly object s_orchidKey = new object();
+ private static readonly object s_paleGoldenrodKey = new object();
+ private static readonly object s_paleGreenKey = new object();
+ private static readonly object s_paleTurquoiseKey = new object();
+ private static readonly object s_paleVioletRedKey = new object();
+ private static readonly object s_papayaWhipKey = new object();
+ private static readonly object s_peachPuffKey = new object();
+ private static readonly object s_peruKey = new object();
+ private static readonly object s_pinkKey = new object();
+ private static readonly object s_plumKey = new object();
+ private static readonly object s_powderBlueKey = new object();
+ private static readonly object s_purpleKey = new object();
+ private static readonly object s_redKey = new object();
+ private static readonly object s_rosyBrownKey = new object();
+ private static readonly object s_royalBlueKey = new object();
+ private static readonly object s_saddleBrownKey = new object();
+ private static readonly object s_salmonKey = new object();
+ private static readonly object s_sandyBrownKey = new object();
+ private static readonly object s_seaGreenKey = new object();
+ private static readonly object s_seaShellKey = new object();
+ private static readonly object s_siennaKey = new object();
+ private static readonly object s_silverKey = new object();
+ private static readonly object s_skyBlueKey = new object();
+ private static readonly object s_slateBlueKey = new object();
+ private static readonly object s_slateGrayKey = new object();
+ private static readonly object s_snowKey = new object();
+ private static readonly object s_springGreenKey = new object();
+ private static readonly object s_steelBlueKey = new object();
+ private static readonly object s_tanKey = new object();
+ private static readonly object s_tealKey = new object();
+ private static readonly object s_thistleKey = new object();
+ private static readonly object s_tomatoKey = new object();
+ private static readonly object s_turquoiseKey = new object();
+ private static readonly object s_violetKey = new object();
+ private static readonly object s_wheatKey = new object();
+ private static readonly object s_whiteKey = new object();
+ private static readonly object s_whiteSmokeKey = new object();
+ private static readonly object s_yellowKey = new object();
+ private static readonly object s_yellowGreenKey = new object();
+
+ private Pens()
+ {
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Transparent"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Transparent
+ {
+ get
+ {
+ Pen transparent = (Pen)SafeNativeMethods.Gdip.ThreadData[s_transparentKey];
+ if (transparent == null)
+ {
+ transparent = new Pen(Color.Transparent, true);
+ SafeNativeMethods.Gdip.ThreadData[s_transparentKey] = transparent;
+ }
+ return transparent;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.AliceBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen AliceBlue
+ {
+ get
+ {
+ Pen aliceBlue = (Pen)SafeNativeMethods.Gdip.ThreadData[s_aliceBlueKey];
+ if (aliceBlue == null)
+ {
+ aliceBlue = new Pen(Color.AliceBlue, true);
+ SafeNativeMethods.Gdip.ThreadData[s_aliceBlueKey] = aliceBlue;
+ }
+ return aliceBlue;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.AntiqueWhite"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen AntiqueWhite
+ {
+ get
+ {
+ Pen antiqueWhite = (Pen)SafeNativeMethods.Gdip.ThreadData[s_antiqueWhiteKey];
+ if (antiqueWhite == null)
+ {
+ antiqueWhite = new Pen(Color.AntiqueWhite, true);
+ SafeNativeMethods.Gdip.ThreadData[s_antiqueWhiteKey] = antiqueWhite;
+ }
+ return antiqueWhite;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Aqua"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Aqua
+ {
+ get
+ {
+ Pen aqua = (Pen)SafeNativeMethods.Gdip.ThreadData[s_aquaKey];
+ if (aqua == null)
+ {
+ aqua = new Pen(Color.Aqua, true);
+ SafeNativeMethods.Gdip.ThreadData[s_aquaKey] = aqua;
+ }
+ return aqua;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Aquamarine"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Aquamarine
+ {
+ get
+ {
+ Pen aquamarine = (Pen)SafeNativeMethods.Gdip.ThreadData[s_aquamarineKey];
+ if (aquamarine == null)
+ {
+ aquamarine = new Pen(Color.Aquamarine, true);
+ SafeNativeMethods.Gdip.ThreadData[s_aquamarineKey] = aquamarine;
+ }
+ return aquamarine;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Azure"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Azure
+ {
+ get
+ {
+ Pen azure = (Pen)SafeNativeMethods.Gdip.ThreadData[s_azureKey];
+ if (azure == null)
+ {
+ azure = new Pen(Color.Azure, true);
+ SafeNativeMethods.Gdip.ThreadData[s_azureKey] = azure;
+ }
+ return azure;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Beige"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Beige
+ {
+ get
+ {
+ Pen beige = (Pen)SafeNativeMethods.Gdip.ThreadData[s_beigeKey];
+ if (beige == null)
+ {
+ beige = new Pen(Color.Beige, true);
+ SafeNativeMethods.Gdip.ThreadData[s_beigeKey] = beige;
+ }
+ return beige;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Bisque"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Bisque
+ {
+ get
+ {
+ Pen bisque = (Pen)SafeNativeMethods.Gdip.ThreadData[s_bisqueKey];
+ if (bisque == null)
+ {
+ bisque = new Pen(Color.Bisque, true);
+ SafeNativeMethods.Gdip.ThreadData[s_bisqueKey] = bisque;
+ }
+ return bisque;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Black"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Black
+ {
+ get
+ {
+ Pen black = (Pen)SafeNativeMethods.Gdip.ThreadData[s_blackKey];
+ if (black == null)
+ {
+ black = new Pen(Color.Black, true);
+ SafeNativeMethods.Gdip.ThreadData[s_blackKey] = black;
+ }
+ return black;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.BlanchedAlmond"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen BlanchedAlmond
+ {
+ get
+ {
+ Pen blanchedAlmond = (Pen)SafeNativeMethods.Gdip.ThreadData[s_blanchedAlmondKey];
+ if (blanchedAlmond == null)
+ {
+ blanchedAlmond = new Pen(Color.BlanchedAlmond, true);
+ SafeNativeMethods.Gdip.ThreadData[s_blanchedAlmondKey] = blanchedAlmond;
+ }
+ return blanchedAlmond;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Blue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Blue
+ {
+ get
+ {
+ Pen blue = (Pen)SafeNativeMethods.Gdip.ThreadData[s_blueKey];
+ if (blue == null)
+ {
+ blue = new Pen(Color.Blue, true);
+ SafeNativeMethods.Gdip.ThreadData[s_blueKey] = blue;
+ }
+ return blue;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.BlueViolet"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen BlueViolet
+ {
+ get
+ {
+ Pen blueViolet = (Pen)SafeNativeMethods.Gdip.ThreadData[s_blueVioletKey];
+ if (blueViolet == null)
+ {
+ blueViolet = new Pen(Color.BlueViolet, true);
+ SafeNativeMethods.Gdip.ThreadData[s_blueVioletKey] = blueViolet;
+ }
+ return blueViolet;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Brown"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Brown
+ {
+ get
+ {
+ Pen brown = (Pen)SafeNativeMethods.Gdip.ThreadData[s_brownKey];
+ if (brown == null)
+ {
+ brown = new Pen(Color.Brown, true);
+ SafeNativeMethods.Gdip.ThreadData[s_brownKey] = brown;
+ }
+ return brown;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.BurlyWood"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen BurlyWood
+ {
+ get
+ {
+ Pen burlyWood = (Pen)SafeNativeMethods.Gdip.ThreadData[s_burlyWoodKey];
+ if (burlyWood == null)
+ {
+ burlyWood = new Pen(Color.BurlyWood, true);
+ SafeNativeMethods.Gdip.ThreadData[s_burlyWoodKey] = burlyWood;
+ }
+ return burlyWood;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.CadetBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen CadetBlue
+ {
+ get
+ {
+ Pen cadetBlue = (Pen)SafeNativeMethods.Gdip.ThreadData[s_cadetBlueKey];
+ if (cadetBlue == null)
+ {
+ cadetBlue = new Pen(Color.CadetBlue, true);
+ SafeNativeMethods.Gdip.ThreadData[s_cadetBlueKey] = cadetBlue;
+ }
+ return cadetBlue;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Chartreuse"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Chartreuse
+ {
+ get
+ {
+ Pen chartreuse = (Pen)SafeNativeMethods.Gdip.ThreadData[s_chartreuseKey];
+ if (chartreuse == null)
+ {
+ chartreuse = new Pen(Color.Chartreuse, true);
+ SafeNativeMethods.Gdip.ThreadData[s_chartreuseKey] = chartreuse;
+ }
+ return chartreuse;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Chocolate"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Chocolate
+ {
+ get
+ {
+ Pen chocolate = (Pen)SafeNativeMethods.Gdip.ThreadData[s_chocolateKey];
+ if (chocolate == null)
+ {
+ chocolate = new Pen(Color.Chocolate, true);
+ SafeNativeMethods.Gdip.ThreadData[s_chocolateKey] = chocolate;
+ }
+ return chocolate;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Coral"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Coral
+ {
+ get
+ {
+ Pen choral = (Pen)SafeNativeMethods.Gdip.ThreadData[s_choralKey];
+ if (choral == null)
+ {
+ choral = new Pen(Color.Coral, true);
+ SafeNativeMethods.Gdip.ThreadData[s_choralKey] = choral;
+ }
+ return choral;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.CornflowerBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen CornflowerBlue
+ {
+ get
+ {
+ Pen cornflowerBlue = (Pen)SafeNativeMethods.Gdip.ThreadData[s_cornflowerBlueKey];
+ if (cornflowerBlue == null)
+ {
+ cornflowerBlue = new Pen(Color.CornflowerBlue, true);
+ SafeNativeMethods.Gdip.ThreadData[s_cornflowerBlueKey] = cornflowerBlue;
+ }
+ return cornflowerBlue;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Cornsilk"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Cornsilk
+ {
+ get
+ {
+ Pen cornsilk = (Pen)SafeNativeMethods.Gdip.ThreadData[s_cornsilkKey];
+ if (cornsilk == null)
+ {
+ cornsilk = new Pen(Color.Cornsilk, true);
+ SafeNativeMethods.Gdip.ThreadData[s_cornsilkKey] = cornsilk;
+ }
+ return cornsilk;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Crimson"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Crimson
+ {
+ get
+ {
+ Pen crimson = (Pen)SafeNativeMethods.Gdip.ThreadData[s_crimsonKey];
+ if (crimson == null)
+ {
+ crimson = new Pen(Color.Crimson, true);
+ SafeNativeMethods.Gdip.ThreadData[s_crimsonKey] = crimson;
+ }
+ return crimson;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Cyan"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Cyan
+ {
+ get
+ {
+ Pen cyan = (Pen)SafeNativeMethods.Gdip.ThreadData[s_cyanKey];
+ if (cyan == null)
+ {
+ cyan = new Pen(Color.Cyan, true);
+ SafeNativeMethods.Gdip.ThreadData[s_cyanKey] = cyan;
+ }
+ return cyan;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.DarkBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen DarkBlue
+ {
+ get
+ {
+ Pen darkBlue = (Pen)SafeNativeMethods.Gdip.ThreadData[s_darkBlueKey];
+ if (darkBlue == null)
+ {
+ darkBlue = new Pen(Color.DarkBlue, true);
+ SafeNativeMethods.Gdip.ThreadData[s_darkBlueKey] = darkBlue;
+ }
+ return darkBlue;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.DarkCyan"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen DarkCyan
+ {
+ get
+ {
+ Pen darkCyan = (Pen)SafeNativeMethods.Gdip.ThreadData[s_darkCyanKey];
+ if (darkCyan == null)
+ {
+ darkCyan = new Pen(Color.DarkCyan, true);
+ SafeNativeMethods.Gdip.ThreadData[s_darkCyanKey] = darkCyan;
+ }
+ return darkCyan;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.DarkGoldenrod"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen DarkGoldenrod
+ {
+ get
+ {
+ Pen darkGoldenrod = (Pen)SafeNativeMethods.Gdip.ThreadData[s_darkGoldenrodKey];
+ if (darkGoldenrod == null)
+ {
+ darkGoldenrod = new Pen(Color.DarkGoldenrod, true);
+ SafeNativeMethods.Gdip.ThreadData[s_darkGoldenrodKey] = darkGoldenrod;
+ }
+ return darkGoldenrod;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.DarkGray"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen DarkGray
+ {
+ get
+ {
+ Pen darkGray = (Pen)SafeNativeMethods.Gdip.ThreadData[s_darkGrayKey];
+ if (darkGray == null)
+ {
+ darkGray = new Pen(Color.DarkGray, true);
+ SafeNativeMethods.Gdip.ThreadData[s_darkGrayKey] = darkGray;
+ }
+ return darkGray;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.DarkGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen DarkGreen
+ {
+ get
+ {
+ Pen darkGreen = (Pen)SafeNativeMethods.Gdip.ThreadData[s_darkGreenKey];
+ if (darkGreen == null)
+ {
+ darkGreen = new Pen(Color.DarkGreen, true);
+ SafeNativeMethods.Gdip.ThreadData[s_darkGreenKey] = darkGreen;
+ }
+ return darkGreen;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.DarkKhaki"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen DarkKhaki
+ {
+ get
+ {
+ Pen darkKhaki = (Pen)SafeNativeMethods.Gdip.ThreadData[s_darkKhakiKey];
+ if (darkKhaki == null)
+ {
+ darkKhaki = new Pen(Color.DarkKhaki, true);
+ SafeNativeMethods.Gdip.ThreadData[s_darkKhakiKey] = darkKhaki;
+ }
+ return darkKhaki;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.DarkMagenta"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen DarkMagenta
+ {
+ get
+ {
+ Pen darkMagenta = (Pen)SafeNativeMethods.Gdip.ThreadData[s_darkMagentaKey];
+ if (darkMagenta == null)
+ {
+ darkMagenta = new Pen(Color.DarkMagenta, true);
+ SafeNativeMethods.Gdip.ThreadData[s_darkMagentaKey] = darkMagenta;
+ }
+ return darkMagenta;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.DarkOliveGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen DarkOliveGreen
+ {
+ get
+ {
+ Pen darkOliveGreen = (Pen)SafeNativeMethods.Gdip.ThreadData[s_darkOliveGreenKey];
+ if (darkOliveGreen == null)
+ {
+ darkOliveGreen = new Pen(Color.DarkOliveGreen, true);
+ SafeNativeMethods.Gdip.ThreadData[s_darkOliveGreenKey] = darkOliveGreen;
+ }
+ return darkOliveGreen;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.DarkOrange"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen DarkOrange
+ {
+ get
+ {
+ Pen darkOrange = (Pen)SafeNativeMethods.Gdip.ThreadData[s_darkOrangeKey];
+ if (darkOrange == null)
+ {
+ darkOrange = new Pen(Color.DarkOrange, true);
+ SafeNativeMethods.Gdip.ThreadData[s_darkOrangeKey] = darkOrange;
+ }
+ return darkOrange;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.DarkOrchid"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen DarkOrchid
+ {
+ get
+ {
+ Pen darkOrchid = (Pen)SafeNativeMethods.Gdip.ThreadData[s_darkOrchidKey];
+ if (darkOrchid == null)
+ {
+ darkOrchid = new Pen(Color.DarkOrchid, true);
+ SafeNativeMethods.Gdip.ThreadData[s_darkOrchidKey] = darkOrchid;
+ }
+ return darkOrchid;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.DarkRed"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen DarkRed
+ {
+ get
+ {
+ Pen darkRed = (Pen)SafeNativeMethods.Gdip.ThreadData[s_darkRedKey];
+ if (darkRed == null)
+ {
+ darkRed = new Pen(Color.DarkRed, true);
+ SafeNativeMethods.Gdip.ThreadData[s_darkRedKey] = darkRed;
+ }
+ return darkRed;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.DarkSalmon"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen DarkSalmon
+ {
+ get
+ {
+ Pen darkSalmon = (Pen)SafeNativeMethods.Gdip.ThreadData[s_darkSalmonKey];
+ if (darkSalmon == null)
+ {
+ darkSalmon = new Pen(Color.DarkSalmon, true);
+ SafeNativeMethods.Gdip.ThreadData[s_darkSalmonKey] = darkSalmon;
+ }
+ return darkSalmon;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.DarkSeaGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen DarkSeaGreen
+ {
+ get
+ {
+ Pen darkSeaGreen = (Pen)SafeNativeMethods.Gdip.ThreadData[s_darkSeaGreenKey];
+ if (darkSeaGreen == null)
+ {
+ darkSeaGreen = new Pen(Color.DarkSeaGreen, true);
+ SafeNativeMethods.Gdip.ThreadData[s_darkSeaGreenKey] = darkSeaGreen;
+ }
+ return darkSeaGreen;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.DarkSlateBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen DarkSlateBlue
+ {
+ get
+ {
+ Pen darkSlateBlue = (Pen)SafeNativeMethods.Gdip.ThreadData[s_darkSlateBlueKey];
+ if (darkSlateBlue == null)
+ {
+ darkSlateBlue = new Pen(Color.DarkSlateBlue, true);
+ SafeNativeMethods.Gdip.ThreadData[s_darkSlateBlueKey] = darkSlateBlue;
+ }
+ return darkSlateBlue;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.DarkSlateGray"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen DarkSlateGray
+ {
+ get
+ {
+ Pen darkSlateGray = (Pen)SafeNativeMethods.Gdip.ThreadData[s_darkSlateGrayKey];
+ if (darkSlateGray == null)
+ {
+ darkSlateGray = new Pen(Color.DarkSlateGray, true);
+ SafeNativeMethods.Gdip.ThreadData[s_darkSlateGrayKey] = darkSlateGray;
+ }
+ return darkSlateGray;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.DarkTurquoise"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen DarkTurquoise
+ {
+ get
+ {
+ Pen darkTurquoise = (Pen)SafeNativeMethods.Gdip.ThreadData[s_darkTurquoiseKey];
+ if (darkTurquoise == null)
+ {
+ darkTurquoise = new Pen(Color.DarkTurquoise, true);
+ SafeNativeMethods.Gdip.ThreadData[s_darkTurquoiseKey] = darkTurquoise;
+ }
+ return darkTurquoise;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.DarkViolet"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen DarkViolet
+ {
+ get
+ {
+ Pen darkViolet = (Pen)SafeNativeMethods.Gdip.ThreadData[s_darkVioletKey];
+ if (darkViolet == null)
+ {
+ darkViolet = new Pen(Color.DarkViolet, true);
+ SafeNativeMethods.Gdip.ThreadData[s_darkVioletKey] = darkViolet;
+ }
+ return darkViolet;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.DeepPink"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen DeepPink
+ {
+ get
+ {
+ Pen deepPink = (Pen)SafeNativeMethods.Gdip.ThreadData[s_deepPinkKey];
+ if (deepPink == null)
+ {
+ deepPink = new Pen(Color.DeepPink, true);
+ SafeNativeMethods.Gdip.ThreadData[s_deepPinkKey] = deepPink;
+ }
+ return deepPink;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.DeepSkyBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen DeepSkyBlue
+ {
+ get
+ {
+ Pen deepSkyBlue = (Pen)SafeNativeMethods.Gdip.ThreadData[s_deepSkyBlueKey];
+ if (deepSkyBlue == null)
+ {
+ deepSkyBlue = new Pen(Color.DeepSkyBlue, true);
+ SafeNativeMethods.Gdip.ThreadData[s_deepSkyBlueKey] = deepSkyBlue;
+ }
+ return deepSkyBlue;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.DimGray"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen DimGray
+ {
+ get
+ {
+ Pen dimGray = (Pen)SafeNativeMethods.Gdip.ThreadData[s_dimGrayKey];
+ if (dimGray == null)
+ {
+ dimGray = new Pen(Color.DimGray, true);
+ SafeNativeMethods.Gdip.ThreadData[s_dimGrayKey] = dimGray;
+ }
+ return dimGray;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.DodgerBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen DodgerBlue
+ {
+ get
+ {
+ Pen dodgerBlue = (Pen)SafeNativeMethods.Gdip.ThreadData[s_dodgerBlueKey];
+ if (dodgerBlue == null)
+ {
+ dodgerBlue = new Pen(Color.DodgerBlue, true);
+ SafeNativeMethods.Gdip.ThreadData[s_dodgerBlueKey] = dodgerBlue;
+ }
+ return dodgerBlue;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Firebrick"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Firebrick
+ {
+ get
+ {
+ Pen firebrick = (Pen)SafeNativeMethods.Gdip.ThreadData[s_firebrickKey];
+ if (firebrick == null)
+ {
+ firebrick = new Pen(Color.Firebrick, true);
+ SafeNativeMethods.Gdip.ThreadData[s_firebrickKey] = firebrick;
+ }
+ return firebrick;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.FloralWhite"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen FloralWhite
+ {
+ get
+ {
+ Pen floralWhite = (Pen)SafeNativeMethods.Gdip.ThreadData[s_floralWhiteKey];
+ if (floralWhite == null)
+ {
+ floralWhite = new Pen(Color.FloralWhite, true);
+ SafeNativeMethods.Gdip.ThreadData[s_floralWhiteKey] = floralWhite;
+ }
+ return floralWhite;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.ForestGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen ForestGreen
+ {
+ get
+ {
+ Pen forestGreen = (Pen)SafeNativeMethods.Gdip.ThreadData[s_forestGreenKey];
+ if (forestGreen == null)
+ {
+ forestGreen = new Pen(Color.ForestGreen, true);
+ SafeNativeMethods.Gdip.ThreadData[s_forestGreenKey] = forestGreen;
+ }
+ return forestGreen;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Fuchsia"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Fuchsia
+ {
+ get
+ {
+ Pen fuchia = (Pen)SafeNativeMethods.Gdip.ThreadData[s_fuchiaKey];
+ if (fuchia == null)
+ {
+ fuchia = new Pen(Color.Fuchsia, true);
+ SafeNativeMethods.Gdip.ThreadData[s_fuchiaKey] = fuchia;
+ }
+ return fuchia;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Gainsboro"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Gainsboro
+ {
+ get
+ {
+ Pen gainsboro = (Pen)SafeNativeMethods.Gdip.ThreadData[s_gainsboroKey];
+ if (gainsboro == null)
+ {
+ gainsboro = new Pen(Color.Gainsboro, true);
+ SafeNativeMethods.Gdip.ThreadData[s_gainsboroKey] = gainsboro;
+ }
+ return gainsboro;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.GhostWhite"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen GhostWhite
+ {
+ get
+ {
+ Pen ghostWhite = (Pen)SafeNativeMethods.Gdip.ThreadData[s_ghostWhiteKey];
+ if (ghostWhite == null)
+ {
+ ghostWhite = new Pen(Color.GhostWhite, true);
+ SafeNativeMethods.Gdip.ThreadData[s_ghostWhiteKey] = ghostWhite;
+ }
+ return ghostWhite;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Gold"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Gold
+ {
+ get
+ {
+ Pen gold = (Pen)SafeNativeMethods.Gdip.ThreadData[s_goldKey];
+ if (gold == null)
+ {
+ gold = new Pen(Color.Gold, true);
+ SafeNativeMethods.Gdip.ThreadData[s_goldKey] = gold;
+ }
+ return gold;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Goldenrod"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Goldenrod
+ {
+ get
+ {
+ Pen goldenrod = (Pen)SafeNativeMethods.Gdip.ThreadData[s_goldenrodKey];
+ if (goldenrod == null)
+ {
+ goldenrod = new Pen(Color.Goldenrod, true);
+ SafeNativeMethods.Gdip.ThreadData[s_goldenrodKey] = goldenrod;
+ }
+ return goldenrod;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Gray"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Gray
+ {
+ get
+ {
+ Pen gray = (Pen)SafeNativeMethods.Gdip.ThreadData[s_grayKey];
+ if (gray == null)
+ {
+ gray = new Pen(Color.Gray, true);
+ SafeNativeMethods.Gdip.ThreadData[s_grayKey] = gray;
+ }
+ return gray;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Green"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Green
+ {
+ get
+ {
+ Pen green = (Pen)SafeNativeMethods.Gdip.ThreadData[s_greenKey];
+ if (green == null)
+ {
+ green = new Pen(Color.Green, true);
+ SafeNativeMethods.Gdip.ThreadData[s_greenKey] = green;
+ }
+ return green;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.GreenYellow"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen GreenYellow
+ {
+ get
+ {
+ Pen greenYellow = (Pen)SafeNativeMethods.Gdip.ThreadData[s_greenYellowKey];
+ if (greenYellow == null)
+ {
+ greenYellow = new Pen(Color.GreenYellow, true);
+ SafeNativeMethods.Gdip.ThreadData[s_greenYellowKey] = greenYellow;
+ }
+ return greenYellow;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Honeydew"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Honeydew
+ {
+ get
+ {
+ Pen honeydew = (Pen)SafeNativeMethods.Gdip.ThreadData[s_honeydewKey];
+ if (honeydew == null)
+ {
+ honeydew = new Pen(Color.Honeydew, true);
+ SafeNativeMethods.Gdip.ThreadData[s_honeydewKey] = honeydew;
+ }
+ return honeydew;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.HotPink"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen HotPink
+ {
+ get
+ {
+ Pen hotPink = (Pen)SafeNativeMethods.Gdip.ThreadData[s_hotPinkKey];
+ if (hotPink == null)
+ {
+ hotPink = new Pen(Color.HotPink, true);
+ SafeNativeMethods.Gdip.ThreadData[s_hotPinkKey] = hotPink;
+ }
+ return hotPink;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.IndianRed"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen IndianRed
+ {
+ get
+ {
+ Pen indianRed = (Pen)SafeNativeMethods.Gdip.ThreadData[s_indianRedKey];
+ if (indianRed == null)
+ {
+ indianRed = new Pen(Color.IndianRed, true);
+ SafeNativeMethods.Gdip.ThreadData[s_indianRedKey] = indianRed;
+ }
+ return indianRed;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Indigo"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Indigo
+ {
+ get
+ {
+ Pen indigo = (Pen)SafeNativeMethods.Gdip.ThreadData[s_indigoKey];
+ if (indigo == null)
+ {
+ indigo = new Pen(Color.Indigo, true);
+ SafeNativeMethods.Gdip.ThreadData[s_indigoKey] = indigo;
+ }
+ return indigo;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Ivory"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Ivory
+ {
+ get
+ {
+ Pen ivory = (Pen)SafeNativeMethods.Gdip.ThreadData[s_ivoryKey];
+ if (ivory == null)
+ {
+ ivory = new Pen(Color.Ivory, true);
+ SafeNativeMethods.Gdip.ThreadData[s_ivoryKey] = ivory;
+ }
+ return ivory;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Khaki"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Khaki
+ {
+ get
+ {
+ Pen khaki = (Pen)SafeNativeMethods.Gdip.ThreadData[s_khakiKey];
+ if (khaki == null)
+ {
+ khaki = new Pen(Color.Khaki, true);
+ SafeNativeMethods.Gdip.ThreadData[s_khakiKey] = khaki;
+ }
+ return khaki;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Lavender"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Lavender
+ {
+ get
+ {
+ Pen lavender = (Pen)SafeNativeMethods.Gdip.ThreadData[s_lavenderKey];
+ if (lavender == null)
+ {
+ lavender = new Pen(Color.Lavender, true);
+ SafeNativeMethods.Gdip.ThreadData[s_lavenderKey] = lavender;
+ }
+ return lavender;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.LavenderBlush"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen LavenderBlush
+ {
+ get
+ {
+ Pen lavenderBlush = (Pen)SafeNativeMethods.Gdip.ThreadData[s_lavenderBlushKey];
+ if (lavenderBlush == null)
+ {
+ lavenderBlush = new Pen(Color.LavenderBlush, true);
+ SafeNativeMethods.Gdip.ThreadData[s_lavenderBlushKey] = lavenderBlush;
+ }
+ return lavenderBlush;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.LawnGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen LawnGreen
+ {
+ get
+ {
+ Pen lawnGreen = (Pen)SafeNativeMethods.Gdip.ThreadData[s_lawnGreenKey];
+ if (lawnGreen == null)
+ {
+ lawnGreen = new Pen(Color.LawnGreen, true);
+ SafeNativeMethods.Gdip.ThreadData[s_lawnGreenKey] = lawnGreen;
+ }
+ return lawnGreen;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.LemonChiffon"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen LemonChiffon
+ {
+ get
+ {
+ Pen lemonChiffon = (Pen)SafeNativeMethods.Gdip.ThreadData[s_lemonChiffonKey];
+ if (lemonChiffon == null)
+ {
+ lemonChiffon = new Pen(Color.LemonChiffon, true);
+ SafeNativeMethods.Gdip.ThreadData[s_lemonChiffonKey] = lemonChiffon;
+ }
+ return lemonChiffon;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.LightBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen LightBlue
+ {
+ get
+ {
+ Pen lightBlue = (Pen)SafeNativeMethods.Gdip.ThreadData[s_lightBlueKey];
+ if (lightBlue == null)
+ {
+ lightBlue = new Pen(Color.LightBlue, true);
+ SafeNativeMethods.Gdip.ThreadData[s_lightBlueKey] = lightBlue;
+ }
+ return lightBlue;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.LightCoral"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen LightCoral
+ {
+ get
+ {
+ Pen lightCoral = (Pen)SafeNativeMethods.Gdip.ThreadData[s_lightCoralKey];
+ if (lightCoral == null)
+ {
+ lightCoral = new Pen(Color.LightCoral, true);
+ SafeNativeMethods.Gdip.ThreadData[s_lightCoralKey] = lightCoral;
+ }
+ return lightCoral;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.LightCyan"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen LightCyan
+ {
+ get
+ {
+ Pen lightCyan = (Pen)SafeNativeMethods.Gdip.ThreadData[s_lightCyanKey];
+ if (lightCyan == null)
+ {
+ lightCyan = new Pen(Color.LightCyan, true);
+ SafeNativeMethods.Gdip.ThreadData[s_lightCyanKey] = lightCyan;
+ }
+ return lightCyan;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.LightGoldenrodYellow"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen LightGoldenrodYellow
+ {
+ get
+ {
+ Pen lightGoldenrodYellow = (Pen)SafeNativeMethods.Gdip.ThreadData[s_lightGoldenrodYellowKey];
+ if (lightGoldenrodYellow == null)
+ {
+ lightGoldenrodYellow = new Pen(Color.LightGoldenrodYellow, true);
+ SafeNativeMethods.Gdip.ThreadData[s_lightGoldenrodYellowKey] = lightGoldenrodYellow;
+ }
+ return lightGoldenrodYellow;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.LightGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen LightGreen
+ {
+ get
+ {
+ Pen lightGreen = (Pen)SafeNativeMethods.Gdip.ThreadData[s_lightGreenKey];
+ if (lightGreen == null)
+ {
+ lightGreen = new Pen(Color.LightGreen, true);
+ SafeNativeMethods.Gdip.ThreadData[s_lightGreenKey] = lightGreen;
+ }
+ return lightGreen;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.LightGray"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen LightGray
+ {
+ get
+ {
+ Pen lightGray = (Pen)SafeNativeMethods.Gdip.ThreadData[s_lightGrayKey];
+ if (lightGray == null)
+ {
+ lightGray = new Pen(Color.LightGray, true);
+ SafeNativeMethods.Gdip.ThreadData[s_lightGrayKey] = lightGray;
+ }
+ return lightGray;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.LightPink"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen LightPink
+ {
+ get
+ {
+ Pen lightPink = (Pen)SafeNativeMethods.Gdip.ThreadData[s_lightPinkKey];
+ if (lightPink == null)
+ {
+ lightPink = new Pen(Color.LightPink, true);
+ SafeNativeMethods.Gdip.ThreadData[s_lightPinkKey] = lightPink;
+ }
+ return lightPink;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.LightSalmon"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen LightSalmon
+ {
+ get
+ {
+ Pen lightSalmon = (Pen)SafeNativeMethods.Gdip.ThreadData[s_lightSalmonKey];
+ if (lightSalmon == null)
+ {
+ lightSalmon = new Pen(Color.LightSalmon, true);
+ SafeNativeMethods.Gdip.ThreadData[s_lightSalmonKey] = lightSalmon;
+ }
+ return lightSalmon;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.LightSeaGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen LightSeaGreen
+ {
+ get
+ {
+ Pen lightSeaGreen = (Pen)SafeNativeMethods.Gdip.ThreadData[s_lightSeaGreenKey];
+ if (lightSeaGreen == null)
+ {
+ lightSeaGreen = new Pen(Color.LightSeaGreen, true);
+ SafeNativeMethods.Gdip.ThreadData[s_lightSeaGreenKey] = lightSeaGreen;
+ }
+ return lightSeaGreen;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.LightSkyBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen LightSkyBlue
+ {
+ get
+ {
+ Pen lightSkyBlue = (Pen)SafeNativeMethods.Gdip.ThreadData[s_lightSkyBlueKey];
+ if (lightSkyBlue == null)
+ {
+ lightSkyBlue = new Pen(Color.LightSkyBlue, true);
+ SafeNativeMethods.Gdip.ThreadData[s_lightSkyBlueKey] = lightSkyBlue;
+ }
+ return lightSkyBlue;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.LightSlateGray"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen LightSlateGray
+ {
+ get
+ {
+ Pen lightSlateGray = (Pen)SafeNativeMethods.Gdip.ThreadData[s_lightSlateGrayKey];
+ if (lightSlateGray == null)
+ {
+ lightSlateGray = new Pen(Color.LightSlateGray, true);
+ SafeNativeMethods.Gdip.ThreadData[s_lightSlateGrayKey] = lightSlateGray;
+ }
+ return lightSlateGray;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.LightSteelBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen LightSteelBlue
+ {
+ get
+ {
+ Pen lightSteelBlue = (Pen)SafeNativeMethods.Gdip.ThreadData[s_lightSteelBlueKey];
+ if (lightSteelBlue == null)
+ {
+ lightSteelBlue = new Pen(Color.LightSteelBlue, true);
+ SafeNativeMethods.Gdip.ThreadData[s_lightSteelBlueKey] = lightSteelBlue;
+ }
+ return lightSteelBlue;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.LightYellow"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen LightYellow
+ {
+ get
+ {
+ Pen lightYellow = (Pen)SafeNativeMethods.Gdip.ThreadData[s_lightYellowKey];
+ if (lightYellow == null)
+ {
+ lightYellow = new Pen(Color.LightYellow, true);
+ SafeNativeMethods.Gdip.ThreadData[s_lightYellowKey] = lightYellow;
+ }
+ return lightYellow;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Lime"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Lime
+ {
+ get
+ {
+ Pen lime = (Pen)SafeNativeMethods.Gdip.ThreadData[s_limeKey];
+ if (lime == null)
+ {
+ lime = new Pen(Color.Lime, true);
+ SafeNativeMethods.Gdip.ThreadData[s_limeKey] = lime;
+ }
+ return lime;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.LimeGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen LimeGreen
+ {
+ get
+ {
+ Pen limeGreen = (Pen)SafeNativeMethods.Gdip.ThreadData[s_limeGreenKey];
+ if (limeGreen == null)
+ {
+ limeGreen = new Pen(Color.LimeGreen, true);
+ SafeNativeMethods.Gdip.ThreadData[s_limeGreenKey] = limeGreen;
+ }
+ return limeGreen;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Linen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Linen
+ {
+ get
+ {
+ Pen linen = (Pen)SafeNativeMethods.Gdip.ThreadData[s_linenKey];
+ if (linen == null)
+ {
+ linen = new Pen(Color.Linen, true);
+ SafeNativeMethods.Gdip.ThreadData[s_linenKey] = linen;
+ }
+ return linen;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Magenta"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Magenta
+ {
+ get
+ {
+ Pen magenta = (Pen)SafeNativeMethods.Gdip.ThreadData[s_magentaKey];
+ if (magenta == null)
+ {
+ magenta = new Pen(Color.Magenta, true);
+ SafeNativeMethods.Gdip.ThreadData[s_magentaKey] = magenta;
+ }
+ return magenta;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Maroon"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Maroon
+ {
+ get
+ {
+ Pen maroon = (Pen)SafeNativeMethods.Gdip.ThreadData[s_maroonKey];
+ if (maroon == null)
+ {
+ maroon = new Pen(Color.Maroon, true);
+ SafeNativeMethods.Gdip.ThreadData[s_maroonKey] = maroon;
+ }
+ return maroon;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.MediumAquamarine"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen MediumAquamarine
+ {
+ get
+ {
+ Pen mediumAquamarine = (Pen)SafeNativeMethods.Gdip.ThreadData[s_mediumAquamarineKey];
+ if (mediumAquamarine == null)
+ {
+ mediumAquamarine = new Pen(Color.MediumAquamarine, true);
+ SafeNativeMethods.Gdip.ThreadData[s_mediumAquamarineKey] = mediumAquamarine;
+ }
+ return mediumAquamarine;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.MediumBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen MediumBlue
+ {
+ get
+ {
+ Pen mediumBlue = (Pen)SafeNativeMethods.Gdip.ThreadData[s_mediumBlueKey];
+ if (mediumBlue == null)
+ {
+ mediumBlue = new Pen(Color.MediumBlue, true);
+ SafeNativeMethods.Gdip.ThreadData[s_mediumBlueKey] = mediumBlue;
+ }
+ return mediumBlue;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.MediumOrchid"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen MediumOrchid
+ {
+ get
+ {
+ Pen mediumOrchid = (Pen)SafeNativeMethods.Gdip.ThreadData[s_mediumOrchidKey];
+ if (mediumOrchid == null)
+ {
+ mediumOrchid = new Pen(Color.MediumOrchid, true);
+ SafeNativeMethods.Gdip.ThreadData[s_mediumOrchidKey] = mediumOrchid;
+ }
+ return mediumOrchid;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.MediumPurple"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen MediumPurple
+ {
+ get
+ {
+ Pen mediumPurple = (Pen)SafeNativeMethods.Gdip.ThreadData[s_mediumPurpleKey];
+ if (mediumPurple == null)
+ {
+ mediumPurple = new Pen(Color.MediumPurple, true);
+ SafeNativeMethods.Gdip.ThreadData[s_mediumPurpleKey] = mediumPurple;
+ }
+ return mediumPurple;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.MediumSeaGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen MediumSeaGreen
+ {
+ get
+ {
+ Pen mediumSeaGreen = (Pen)SafeNativeMethods.Gdip.ThreadData[s_mediumSeaGreenKey];
+ if (mediumSeaGreen == null)
+ {
+ mediumSeaGreen = new Pen(Color.MediumSeaGreen, true);
+ SafeNativeMethods.Gdip.ThreadData[s_mediumSeaGreenKey] = mediumSeaGreen;
+ }
+ return mediumSeaGreen;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.MediumSlateBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen MediumSlateBlue
+ {
+ get
+ {
+ Pen mediumSlateBlue = (Pen)SafeNativeMethods.Gdip.ThreadData[s_mediumSlateBlueKey];
+ if (mediumSlateBlue == null)
+ {
+ mediumSlateBlue = new Pen(Color.MediumSlateBlue, true);
+ SafeNativeMethods.Gdip.ThreadData[s_mediumSlateBlueKey] = mediumSlateBlue;
+ }
+ return mediumSlateBlue;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.MediumSpringGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen MediumSpringGreen
+ {
+ get
+ {
+ Pen mediumSpringGreen = (Pen)SafeNativeMethods.Gdip.ThreadData[s_mediumSpringGreenKey];
+ if (mediumSpringGreen == null)
+ {
+ mediumSpringGreen = new Pen(Color.MediumSpringGreen, true);
+ SafeNativeMethods.Gdip.ThreadData[s_mediumSpringGreenKey] = mediumSpringGreen;
+ }
+ return mediumSpringGreen;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.MediumTurquoise"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen MediumTurquoise
+ {
+ get
+ {
+ Pen mediumTurquoise = (Pen)SafeNativeMethods.Gdip.ThreadData[s_mediumTurquoiseKey];
+ if (mediumTurquoise == null)
+ {
+ mediumTurquoise = new Pen(Color.MediumTurquoise, true);
+ SafeNativeMethods.Gdip.ThreadData[s_mediumTurquoiseKey] = mediumTurquoise;
+ }
+ return mediumTurquoise;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.MediumVioletRed"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen MediumVioletRed
+ {
+ get
+ {
+ Pen mediumVioletRed = (Pen)SafeNativeMethods.Gdip.ThreadData[s_mediumVioletRedKey];
+ if (mediumVioletRed == null)
+ {
+ mediumVioletRed = new Pen(Color.MediumVioletRed, true);
+ SafeNativeMethods.Gdip.ThreadData[s_mediumVioletRedKey] = mediumVioletRed;
+ }
+ return mediumVioletRed;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.MidnightBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen MidnightBlue
+ {
+ get
+ {
+ Pen midnightBlue = (Pen)SafeNativeMethods.Gdip.ThreadData[s_midnightBlueKey];
+ if (midnightBlue == null)
+ {
+ midnightBlue = new Pen(Color.MidnightBlue, true);
+ SafeNativeMethods.Gdip.ThreadData[s_midnightBlueKey] = midnightBlue;
+ }
+ return midnightBlue;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.MintCream"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen MintCream
+ {
+ get
+ {
+ Pen mintCream = (Pen)SafeNativeMethods.Gdip.ThreadData[s_mintCreamKey];
+ if (mintCream == null)
+ {
+ mintCream = new Pen(Color.MintCream, true);
+ SafeNativeMethods.Gdip.ThreadData[s_mintCreamKey] = mintCream;
+ }
+ return mintCream;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.MistyRose"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen MistyRose
+ {
+ get
+ {
+ Pen mistyRose = (Pen)SafeNativeMethods.Gdip.ThreadData[s_mistyRoseKey];
+ if (mistyRose == null)
+ {
+ mistyRose = new Pen(Color.MistyRose, true);
+ SafeNativeMethods.Gdip.ThreadData[s_mistyRoseKey] = mistyRose;
+ }
+ return mistyRose;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Moccasin"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Moccasin
+ {
+ get
+ {
+ Pen moccasin = (Pen)SafeNativeMethods.Gdip.ThreadData[s_moccasinKey];
+ if (moccasin == null)
+ {
+ moccasin = new Pen(Color.Moccasin, true);
+ SafeNativeMethods.Gdip.ThreadData[s_moccasinKey] = moccasin;
+ }
+ return moccasin;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.NavajoWhite"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen NavajoWhite
+ {
+ get
+ {
+ Pen navajoWhite = (Pen)SafeNativeMethods.Gdip.ThreadData[s_navajoWhiteKey];
+ if (navajoWhite == null)
+ {
+ navajoWhite = new Pen(Color.NavajoWhite, true);
+ SafeNativeMethods.Gdip.ThreadData[s_navajoWhiteKey] = navajoWhite;
+ }
+ return navajoWhite;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Navy"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Navy
+ {
+ get
+ {
+ Pen navy = (Pen)SafeNativeMethods.Gdip.ThreadData[s_navyKey];
+ if (navy == null)
+ {
+ navy = new Pen(Color.Navy, true);
+ SafeNativeMethods.Gdip.ThreadData[s_navyKey] = navy;
+ }
+ return navy;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.OldLace"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen OldLace
+ {
+ get
+ {
+ Pen oldLace = (Pen)SafeNativeMethods.Gdip.ThreadData[s_oldLaceKey];
+ if (oldLace == null)
+ {
+ oldLace = new Pen(Color.OldLace, true);
+ SafeNativeMethods.Gdip.ThreadData[s_oldLaceKey] = oldLace;
+ }
+ return oldLace;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Olive"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Olive
+ {
+ get
+ {
+ Pen olive = (Pen)SafeNativeMethods.Gdip.ThreadData[s_oliveKey];
+ if (olive == null)
+ {
+ olive = new Pen(Color.Olive, true);
+ SafeNativeMethods.Gdip.ThreadData[s_oliveKey] = olive;
+ }
+ return olive;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.OliveDrab"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen OliveDrab
+ {
+ get
+ {
+ Pen oliveDrab = (Pen)SafeNativeMethods.Gdip.ThreadData[s_oliveDrabKey];
+ if (oliveDrab == null)
+ {
+ oliveDrab = new Pen(Color.OliveDrab, true);
+ SafeNativeMethods.Gdip.ThreadData[s_oliveDrabKey] = oliveDrab;
+ }
+ return oliveDrab;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Orange"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Orange
+ {
+ get
+ {
+ Pen orange = (Pen)SafeNativeMethods.Gdip.ThreadData[s_orangeKey];
+ if (orange == null)
+ {
+ orange = new Pen(Color.Orange, true);
+ SafeNativeMethods.Gdip.ThreadData[s_orangeKey] = orange;
+ }
+ return orange;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.OrangeRed"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen OrangeRed
+ {
+ get
+ {
+ Pen orangeRed = (Pen)SafeNativeMethods.Gdip.ThreadData[s_orangeRedKey];
+ if (orangeRed == null)
+ {
+ orangeRed = new Pen(Color.OrangeRed, true);
+ SafeNativeMethods.Gdip.ThreadData[s_orangeRedKey] = orangeRed;
+ }
+ return orangeRed;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Orchid"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Orchid
+ {
+ get
+ {
+ Pen orchid = (Pen)SafeNativeMethods.Gdip.ThreadData[s_orchidKey];
+ if (orchid == null)
+ {
+ orchid = new Pen(Color.Orchid, true);
+ SafeNativeMethods.Gdip.ThreadData[s_orchidKey] = orchid;
+ }
+ return orchid;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.PaleGoldenrod"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen PaleGoldenrod
+ {
+ get
+ {
+ Pen paleGoldenrod = (Pen)SafeNativeMethods.Gdip.ThreadData[s_paleGoldenrodKey];
+ if (paleGoldenrod == null)
+ {
+ paleGoldenrod = new Pen(Color.PaleGoldenrod, true);
+ SafeNativeMethods.Gdip.ThreadData[s_paleGoldenrodKey] = paleGoldenrod;
+ }
+ return paleGoldenrod;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.PaleGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen PaleGreen
+ {
+ get
+ {
+ Pen paleGreen = (Pen)SafeNativeMethods.Gdip.ThreadData[s_paleGreenKey];
+ if (paleGreen == null)
+ {
+ paleGreen = new Pen(Color.PaleGreen, true);
+ SafeNativeMethods.Gdip.ThreadData[s_paleGreenKey] = paleGreen;
+ }
+ return paleGreen;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.PaleTurquoise"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen PaleTurquoise
+ {
+ get
+ {
+ Pen paleTurquoise = (Pen)SafeNativeMethods.Gdip.ThreadData[s_paleTurquoiseKey];
+ if (paleTurquoise == null)
+ {
+ paleTurquoise = new Pen(Color.PaleTurquoise, true);
+ SafeNativeMethods.Gdip.ThreadData[s_paleTurquoiseKey] = paleTurquoise;
+ }
+ return paleTurquoise;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.PaleVioletRed"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen PaleVioletRed
+ {
+ get
+ {
+ Pen paleVioletRed = (Pen)SafeNativeMethods.Gdip.ThreadData[s_paleVioletRedKey];
+ if (paleVioletRed == null)
+ {
+ paleVioletRed = new Pen(Color.PaleVioletRed, true);
+ SafeNativeMethods.Gdip.ThreadData[s_paleVioletRedKey] = paleVioletRed;
+ }
+ return paleVioletRed;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.PapayaWhip"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen PapayaWhip
+ {
+ get
+ {
+ Pen papayaWhip = (Pen)SafeNativeMethods.Gdip.ThreadData[s_papayaWhipKey];
+ if (papayaWhip == null)
+ {
+ papayaWhip = new Pen(Color.PapayaWhip, true);
+ SafeNativeMethods.Gdip.ThreadData[s_papayaWhipKey] = papayaWhip;
+ }
+ return papayaWhip;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.PeachPuff"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen PeachPuff
+ {
+ get
+ {
+ Pen peachPuff = (Pen)SafeNativeMethods.Gdip.ThreadData[s_peachPuffKey];
+ if (peachPuff == null)
+ {
+ peachPuff = new Pen(Color.PeachPuff, true);
+ SafeNativeMethods.Gdip.ThreadData[s_peachPuffKey] = peachPuff;
+ }
+ return peachPuff;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Peru"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Peru
+ {
+ get
+ {
+ Pen peru = (Pen)SafeNativeMethods.Gdip.ThreadData[s_peruKey];
+ if (peru == null)
+ {
+ peru = new Pen(Color.Peru, true);
+ SafeNativeMethods.Gdip.ThreadData[s_peruKey] = peru;
+ }
+ return peru;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Pink"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Pink
+ {
+ get
+ {
+ Pen pink = (Pen)SafeNativeMethods.Gdip.ThreadData[s_pinkKey];
+ if (pink == null)
+ {
+ pink = new Pen(Color.Pink, true);
+ SafeNativeMethods.Gdip.ThreadData[s_pinkKey] = pink;
+ }
+ return pink;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Plum"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Plum
+ {
+ get
+ {
+ Pen plum = (Pen)SafeNativeMethods.Gdip.ThreadData[s_plumKey];
+ if (plum == null)
+ {
+ plum = new Pen(Color.Plum, true);
+ SafeNativeMethods.Gdip.ThreadData[s_plumKey] = plum;
+ }
+ return plum;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.PowderBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen PowderBlue
+ {
+ get
+ {
+ Pen powderBlue = (Pen)SafeNativeMethods.Gdip.ThreadData[s_powderBlueKey];
+ if (powderBlue == null)
+ {
+ powderBlue = new Pen(Color.PowderBlue, true);
+ SafeNativeMethods.Gdip.ThreadData[s_powderBlueKey] = powderBlue;
+ }
+ return powderBlue;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Purple"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Purple
+ {
+ get
+ {
+ Pen purple = (Pen)SafeNativeMethods.Gdip.ThreadData[s_purpleKey];
+ if (purple == null)
+ {
+ purple = new Pen(Color.Purple, true);
+ SafeNativeMethods.Gdip.ThreadData[s_purpleKey] = purple;
+ }
+ return purple;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Red"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Red
+ {
+ get
+ {
+ Pen red = (Pen)SafeNativeMethods.Gdip.ThreadData[s_redKey];
+ if (red == null)
+ {
+ red = new Pen(Color.Red, true);
+ SafeNativeMethods.Gdip.ThreadData[s_redKey] = red;
+ }
+ return red;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.RosyBrown"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen RosyBrown
+ {
+ get
+ {
+ Pen rosyBrown = (Pen)SafeNativeMethods.Gdip.ThreadData[s_rosyBrownKey];
+ if (rosyBrown == null)
+ {
+ rosyBrown = new Pen(Color.RosyBrown, true);
+ SafeNativeMethods.Gdip.ThreadData[s_rosyBrownKey] = rosyBrown;
+ }
+ return rosyBrown;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.RoyalBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen RoyalBlue
+ {
+ get
+ {
+ Pen royalBlue = (Pen)SafeNativeMethods.Gdip.ThreadData[s_royalBlueKey];
+ if (royalBlue == null)
+ {
+ royalBlue = new Pen(Color.RoyalBlue, true);
+ SafeNativeMethods.Gdip.ThreadData[s_royalBlueKey] = royalBlue;
+ }
+ return royalBlue;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.SaddleBrown"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen SaddleBrown
+ {
+ get
+ {
+ Pen saddleBrown = (Pen)SafeNativeMethods.Gdip.ThreadData[s_saddleBrownKey];
+ if (saddleBrown == null)
+ {
+ saddleBrown = new Pen(Color.SaddleBrown, true);
+ SafeNativeMethods.Gdip.ThreadData[s_saddleBrownKey] = saddleBrown;
+ }
+ return saddleBrown;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Salmon"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Salmon
+ {
+ get
+ {
+ Pen salmon = (Pen)SafeNativeMethods.Gdip.ThreadData[s_salmonKey];
+ if (salmon == null)
+ {
+ salmon = new Pen(Color.Salmon, true);
+ SafeNativeMethods.Gdip.ThreadData[s_salmonKey] = salmon;
+ }
+ return salmon;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.SandyBrown"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen SandyBrown
+ {
+ get
+ {
+ Pen sandyBrown = (Pen)SafeNativeMethods.Gdip.ThreadData[s_sandyBrownKey];
+ if (sandyBrown == null)
+ {
+ sandyBrown = new Pen(Color.SandyBrown, true);
+ SafeNativeMethods.Gdip.ThreadData[s_sandyBrownKey] = sandyBrown;
+ }
+ return sandyBrown;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.SeaGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen SeaGreen
+ {
+ get
+ {
+ Pen seaGreen = (Pen)SafeNativeMethods.Gdip.ThreadData[s_seaGreenKey];
+ if (seaGreen == null)
+ {
+ seaGreen = new Pen(Color.SeaGreen, true);
+ SafeNativeMethods.Gdip.ThreadData[s_seaGreenKey] = seaGreen;
+ }
+ return seaGreen;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.SeaShell"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen SeaShell
+ {
+ get
+ {
+ Pen seaShell = (Pen)SafeNativeMethods.Gdip.ThreadData[s_seaShellKey];
+ if (seaShell == null)
+ {
+ seaShell = new Pen(Color.SeaShell, true);
+ SafeNativeMethods.Gdip.ThreadData[s_seaShellKey] = seaShell;
+ }
+ return seaShell;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Sienna"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Sienna
+ {
+ get
+ {
+ Pen sienna = (Pen)SafeNativeMethods.Gdip.ThreadData[s_siennaKey];
+ if (sienna == null)
+ {
+ sienna = new Pen(Color.Sienna, true);
+ SafeNativeMethods.Gdip.ThreadData[s_siennaKey] = sienna;
+ }
+ return sienna;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Silver"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Silver
+ {
+ get
+ {
+ Pen silver = (Pen)SafeNativeMethods.Gdip.ThreadData[s_silverKey];
+ if (silver == null)
+ {
+ silver = new Pen(Color.Silver, true);
+ SafeNativeMethods.Gdip.ThreadData[s_silverKey] = silver;
+ }
+ return silver;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.SkyBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen SkyBlue
+ {
+ get
+ {
+ Pen skyBlue = (Pen)SafeNativeMethods.Gdip.ThreadData[s_skyBlueKey];
+ if (skyBlue == null)
+ {
+ skyBlue = new Pen(Color.SkyBlue, true);
+ SafeNativeMethods.Gdip.ThreadData[s_skyBlueKey] = skyBlue;
+ }
+ return skyBlue;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.SlateBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen SlateBlue
+ {
+ get
+ {
+ Pen slateBlue = (Pen)SafeNativeMethods.Gdip.ThreadData[s_slateBlueKey];
+ if (slateBlue == null)
+ {
+ slateBlue = new Pen(Color.SlateBlue, true);
+ SafeNativeMethods.Gdip.ThreadData[s_slateBlueKey] = slateBlue;
+ }
+ return slateBlue;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.SlateGray"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen SlateGray
+ {
+ get
+ {
+ Pen slateGray = (Pen)SafeNativeMethods.Gdip.ThreadData[s_slateGrayKey];
+ if (slateGray == null)
+ {
+ slateGray = new Pen(Color.SlateGray, true);
+ SafeNativeMethods.Gdip.ThreadData[s_slateGrayKey] = slateGray;
+ }
+ return slateGray;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Snow"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Snow
+ {
+ get
+ {
+ Pen snow = (Pen)SafeNativeMethods.Gdip.ThreadData[s_snowKey];
+ if (snow == null)
+ {
+ snow = new Pen(Color.Snow, true);
+ SafeNativeMethods.Gdip.ThreadData[s_snowKey] = snow;
+ }
+ return snow;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.SpringGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen SpringGreen
+ {
+ get
+ {
+ Pen springGreen = (Pen)SafeNativeMethods.Gdip.ThreadData[s_springGreenKey];
+ if (springGreen == null)
+ {
+ springGreen = new Pen(Color.SpringGreen, true);
+ SafeNativeMethods.Gdip.ThreadData[s_springGreenKey] = springGreen;
+ }
+ return springGreen;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.SteelBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen SteelBlue
+ {
+ get
+ {
+ Pen steelBlue = (Pen)SafeNativeMethods.Gdip.ThreadData[s_steelBlueKey];
+ if (steelBlue == null)
+ {
+ steelBlue = new Pen(Color.SteelBlue, true);
+ SafeNativeMethods.Gdip.ThreadData[s_steelBlueKey] = steelBlue;
+ }
+ return steelBlue;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Tan"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Tan
+ {
+ get
+ {
+ Pen tan = (Pen)SafeNativeMethods.Gdip.ThreadData[s_tanKey];
+ if (tan == null)
+ {
+ tan = new Pen(Color.Tan, true);
+ SafeNativeMethods.Gdip.ThreadData[s_tanKey] = tan;
+ }
+ return tan;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Teal"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Teal
+ {
+ get
+ {
+ Pen teal = (Pen)SafeNativeMethods.Gdip.ThreadData[s_tealKey];
+ if (teal == null)
+ {
+ teal = new Pen(Color.Teal, true);
+ SafeNativeMethods.Gdip.ThreadData[s_tealKey] = teal;
+ }
+ return teal;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Thistle"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Thistle
+ {
+ get
+ {
+ Pen thistle = (Pen)SafeNativeMethods.Gdip.ThreadData[s_thistleKey];
+ if (thistle == null)
+ {
+ thistle = new Pen(Color.Thistle, true);
+ SafeNativeMethods.Gdip.ThreadData[s_thistleKey] = thistle;
+ }
+ return thistle;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Tomato"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Tomato
+ {
+ get
+ {
+ Pen tomato = (Pen)SafeNativeMethods.Gdip.ThreadData[s_tomatoKey];
+ if (tomato == null)
+ {
+ tomato = new Pen(Color.Tomato, true);
+ SafeNativeMethods.Gdip.ThreadData[s_tomatoKey] = tomato;
+ }
+ return tomato;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Turquoise"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Turquoise
+ {
+ get
+ {
+ Pen turquoise = (Pen)SafeNativeMethods.Gdip.ThreadData[s_turquoiseKey];
+ if (turquoise == null)
+ {
+ turquoise = new Pen(Color.Turquoise, true);
+ SafeNativeMethods.Gdip.ThreadData[s_turquoiseKey] = turquoise;
+ }
+ return turquoise;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Violet"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Violet
+ {
+ get
+ {
+ Pen violet = (Pen)SafeNativeMethods.Gdip.ThreadData[s_violetKey];
+ if (violet == null)
+ {
+ violet = new Pen(Color.Violet, true);
+ SafeNativeMethods.Gdip.ThreadData[s_violetKey] = violet;
+ }
+ return violet;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Wheat"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Wheat
+ {
+ get
+ {
+ Pen wheat = (Pen)SafeNativeMethods.Gdip.ThreadData[s_wheatKey];
+ if (wheat == null)
+ {
+ wheat = new Pen(Color.Wheat, true);
+ SafeNativeMethods.Gdip.ThreadData[s_wheatKey] = wheat;
+ }
+ return wheat;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.White"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen White
+ {
+ get
+ {
+ Pen white = (Pen)SafeNativeMethods.Gdip.ThreadData[s_whiteKey];
+ if (white == null)
+ {
+ white = new Pen(Color.White, true);
+ SafeNativeMethods.Gdip.ThreadData[s_whiteKey] = white;
+ }
+ return white;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.WhiteSmoke"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen WhiteSmoke
+ {
+ get
+ {
+ Pen whiteSmoke = (Pen)SafeNativeMethods.Gdip.ThreadData[s_whiteSmokeKey];
+ if (whiteSmoke == null)
+ {
+ whiteSmoke = new Pen(Color.WhiteSmoke, true);
+ SafeNativeMethods.Gdip.ThreadData[s_whiteSmokeKey] = whiteSmoke;
+ }
+ return whiteSmoke;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.Yellow"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen Yellow
+ {
+ get
+ {
+ Pen yellow = (Pen)SafeNativeMethods.Gdip.ThreadData[s_yellowKey];
+ if (yellow == null)
+ {
+ yellow = new Pen(Color.Yellow, true);
+ SafeNativeMethods.Gdip.ThreadData[s_yellowKey] = yellow;
+ }
+ return yellow;
+ }
+ }
+
+ /// <include file='doc\Pens.uex' path='docs/doc[@for="Pens.YellowGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen YellowGreen
+ {
+ get
+ {
+ Pen yellowGreen = (Pen)SafeNativeMethods.Gdip.ThreadData[s_yellowGreenKey];
+ if (yellowGreen == null)
+ {
+ yellowGreen = new Pen(Color.YellowGreen, true);
+ SafeNativeMethods.Gdip.ThreadData[s_yellowGreenKey] = yellowGreen;
+ }
+ return yellowGreen;
+ }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/PointConverter.cs b/src/System.Drawing.Common/src/System/Drawing/PointConverter.cs
new file mode 100644
index 0000000000..5fad16e358
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/PointConverter.cs
@@ -0,0 +1,204 @@
+//------------------------------------------------------------------------------
+// <copyright file="PointConverter.cs" company="Microsoft">
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// </copyright>
+//------------------------------------------------------------------------------
+
+/*
+ */
+namespace System.Drawing {
+ using System.Runtime.Serialization.Formatters;
+ using System.Runtime.InteropServices;
+
+ using System.Diagnostics;
+ using System.Diagnostics.CodeAnalysis;
+
+ using Microsoft.Win32;
+ using System.Collections;
+ using System.ComponentModel;
+ using System.ComponentModel.Design.Serialization;
+ using System.Globalization;
+ using System.Reflection;
+
+ /// <include file='doc\PointConverter.uex' path='docs/doc[@for="PointConverter"]/*' />
+ /// <devdoc>
+ /// PointConverter is a class that can be used to convert
+ /// Point from one data type to another. Access this
+ /// class through the TypeDescriptor.
+ /// </devdoc>
+ public class PointConverter : TypeConverter {
+
+ /// <include file='doc\PointConverter.uex' path='docs/doc[@for="PointConverter.CanConvertFrom"]/*' />
+ /// <devdoc>
+ /// Determines if this converter can convert an object in the given source
+ /// type to the native type of the converter.
+ /// </devdoc>
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) {
+ if (sourceType == typeof(string)) {
+ return true;
+ }
+ return base.CanConvertFrom(context, sourceType);
+ }
+
+ /// <include file='doc\PointConverter.uex' path='docs/doc[@for="PointConverter.CanConvertTo"]/*' />
+ /// <devdoc>
+ /// <para>Gets a value indicating whether this converter can
+ /// convert an object to the given destination type using the context.</para>
+ /// </devdoc>
+ public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {
+ if (destinationType == typeof(InstanceDescriptor)) {
+ return true;
+ }
+ return base.CanConvertTo(context, destinationType);
+ }
+
+ /// <include file='doc\PointConverter.uex' path='docs/doc[@for="PointConverter.ConvertFrom"]/*' />
+ /// <devdoc>
+ /// Converts the given object to the converter's native type.
+ /// </devdoc>
+ [SuppressMessage("Microsoft.Performance", "CA1808:AvoidCallsThatBoxValueTypes")]
+ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) {
+
+ string strValue = value as string;
+
+ if (strValue != null) {
+
+ string text = strValue.Trim();
+
+ if (text.Length == 0) {
+ return null;
+ }
+ else {
+
+ // Parse 2 integer values.
+ //
+ if (culture == null) {
+ culture = CultureInfo.CurrentCulture;
+ }
+ char sep = culture.TextInfo.ListSeparator[0];
+ string[] tokens = text.Split(new char[] {sep});
+ int[] values = new int[tokens.Length];
+ TypeConverter intConverter = TypeDescriptor.GetConverter(typeof(int));
+ for (int i = 0; i < values.Length; i++) {
+ // Note: ConvertFromString will raise exception if value cannot be converted.
+ values[i] = (int)intConverter.ConvertFromString(context, culture, tokens[i]);
+ }
+
+ if (values.Length == 2) {
+ return new Point(values[0], values[1]);
+ }
+ else {
+ throw new ArgumentException(SR.Format(SR.TextParseFailedFormat,
+ text,
+ "x, y"));
+ }
+ }
+ }
+
+ return base.ConvertFrom(context, culture, value);
+ }
+
+ /// <include file='doc\PointConverter.uex' path='docs/doc[@for="PointConverter.ConvertTo"]/*' />
+ /// <devdoc>
+ /// Converts the given object to another type. The most common types to convert
+ /// are to and from a string object. The default implementation will make a call
+ /// to ToString on the object if the object is valid and if the destination
+ /// type is string. If this cannot convert to the desitnation type, this will
+ /// throw a NotSupportedException.
+ /// </devdoc>
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) {
+ if (destinationType == null) {
+ throw new ArgumentNullException("destinationType");
+ }
+
+ if(value is Point){
+ if (destinationType == typeof(string)) {
+ Point pt = (Point)value;
+
+ if (culture == null) {
+ culture = CultureInfo.CurrentCulture;
+ }
+ string sep = culture.TextInfo.ListSeparator + " ";
+ TypeConverter intConverter = TypeDescriptor.GetConverter(typeof(int));
+ string[] args = new string[2];
+ int nArg = 0;
+
+ // Note: ConvertToString will raise exception if value cannot be converted.
+ args[nArg++] = intConverter.ConvertToString(context, culture, pt.X);
+ args[nArg++] = intConverter.ConvertToString(context, culture, pt.Y);
+
+ return string.Join(sep, args);
+ }
+ if (destinationType == typeof(InstanceDescriptor)) {
+ Point pt = (Point)value;
+
+ ConstructorInfo ctor = typeof(Point).GetConstructor(new Type[] {typeof(int), typeof(int)});
+ if (ctor != null) {
+ return new InstanceDescriptor(ctor, new object[] {pt.X, pt.Y});
+ }
+ }
+ }
+
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+
+ /// <include file='doc\PointConverter.uex' path='docs/doc[@for="PointConverter.CreateInstance"]/*' />
+ /// <devdoc>
+ /// Creates an instance of this type given a set of property values
+ /// for the object. This is useful for objects that are immutable, but still
+ /// want to provide changable properties.
+ /// </devdoc>
+ [SuppressMessage("Microsoft.Performance", "CA1808:AvoidCallsThatBoxValueTypes")]
+ [SuppressMessage("Microsoft.Security", "CA2102:CatchNonClsCompliantExceptionsInGeneralHandlers")]
+ public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues) {
+ if( propertyValues == null ) {
+ throw new ArgumentNullException( "propertyValues" );
+ }
+
+ object x = propertyValues["X"];
+ object y = propertyValues["Y"];
+
+ if(x == null || y == null ||
+ !(x is int) || !(y is int)) {
+ throw new ArgumentException(SR.Format(SR.PropertyValueInvalidEntry));
+ }
+
+
+ return new Point((int)x,
+ (int)y);
+
+ }
+
+ /// <include file='doc\PointConverter.uex' path='docs/doc[@for="PointConverter.GetCreateInstanceSupported"]/*' />
+ /// <devdoc>
+ /// Determines if changing a value on this object should require a call to
+ /// CreateInstance to create a new value.
+ /// </devdoc>
+ public override bool GetCreateInstanceSupported(ITypeDescriptorContext context) {
+ return true;
+ }
+
+ /// <include file='doc\PointConverter.uex' path='docs/doc[@for="PointConverter.GetProperties"]/*' />
+ /// <devdoc>
+ /// Retrieves the set of properties for this type. By default, a type has
+ /// does not return any properties. An easy implementation of this method
+ /// can just call TypeDescriptor.GetProperties for the correct data type.
+ /// </devdoc>
+ public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) {
+ PropertyDescriptorCollection props = TypeDescriptor.GetProperties(typeof(Point), attributes);
+ return props.Sort(new string[] {"X", "Y"});
+ }
+
+
+ /// <include file='doc\PointConverter.uex' path='docs/doc[@for="PointConverter.GetPropertiesSupported"]/*' />
+ /// <devdoc>
+ /// Determines if this object supports properties. By default, this
+ /// is false.
+ /// </devdoc>
+ public override bool GetPropertiesSupported(ITypeDescriptorContext context) {
+ return true;
+ }
+
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/DefaultPrintController.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/DefaultPrintController.cs
new file mode 100644
index 0000000000..f7f168b127
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/DefaultPrintController.cs
@@ -0,0 +1,166 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ using System.ComponentModel;
+ using System.Diagnostics;
+ using System.Drawing.Internal;
+ using System.Runtime.InteropServices;
+
+ /// <include file='doc\DefaultPrintController.uex' path='docs/doc[@for="StandardPrintController"]/*' />
+ /// <devdoc>
+ /// <para>Specifies a print controller that sends information to a printer.
+ /// </para>
+ /// </devdoc>
+ public class StandardPrintController : PrintController
+ {
+ private DeviceContext _dc;
+ private Graphics _graphics;
+
+ /// <include file='doc\DefaultPrintController.uex' path='docs/doc[@for="StandardPrintController.OnStartPrint"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Implements StartPrint for printing to a physical printer.
+ /// </para>
+ /// </devdoc>
+ public override void OnStartPrint(PrintDocument document, PrintEventArgs e)
+ {
+ Debug.Assert(_dc == null && _graphics == null, "PrintController methods called in the wrong order?");
+
+ base.OnStartPrint(document, e);
+ // the win32 methods below SuppressUnmanagedCodeAttributes so assertin on UnmanagedCodePermission is redundant
+ if (!document.PrinterSettings.IsValid)
+ throw new InvalidPrinterException(document.PrinterSettings);
+
+ _dc = document.PrinterSettings.CreateDeviceContext(modeHandle);
+ SafeNativeMethods.DOCINFO info = new SafeNativeMethods.DOCINFO();
+ info.lpszDocName = document.DocumentName;
+ if (document.PrinterSettings.PrintToFile)
+ info.lpszOutput = document.PrinterSettings.OutputPort; //This will be "FILE:"
+ else
+ info.lpszOutput = null;
+ info.lpszDatatype = null;
+ info.fwType = 0;
+
+ int result = SafeNativeMethods.StartDoc(new HandleRef(_dc, _dc.Hdc), info);
+ if (result <= 0)
+ {
+ int error = Marshal.GetLastWin32Error();
+ if (error == SafeNativeMethods.ERROR_CANCELLED)
+ {
+ e.Cancel = true;
+ }
+ else
+ {
+ throw new Win32Exception(error);
+ }
+ }
+ }
+
+ /// <include file='doc\DefaultPrintController.uex' path='docs/doc[@for="StandardPrintController.OnStartPage"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Implements StartPage for printing to a physical printer.
+ /// </para>
+ /// </devdoc>
+ public override Graphics OnStartPage(PrintDocument document, PrintPageEventArgs e)
+ {
+ Debug.Assert(_dc != null && _graphics == null, "PrintController methods called in the wrong order?");
+
+ base.OnStartPage(document, e);
+ e.PageSettings.CopyToHdevmode(modeHandle);
+ IntPtr modePointer = SafeNativeMethods.GlobalLock(new HandleRef(this, modeHandle));
+ try
+ {
+ IntPtr result = SafeNativeMethods.ResetDC(new HandleRef(_dc, _dc.Hdc), new HandleRef(null, modePointer));
+ Debug.Assert(result == _dc.Hdc, "ResetDC didn't return the same handle I gave it");
+ }
+ finally
+ {
+ SafeNativeMethods.GlobalUnlock(new HandleRef(this, modeHandle));
+ }
+
+ // int horizontalResolution = Windows.GetDeviceCaps(dc.Hdc, SafeNativeMethods.HORZRES);
+ // int verticalResolution = Windows.GetDeviceCaps(dc.Hdc, SafeNativeMethods.VERTRES);
+
+ _graphics = Graphics.FromHdcInternal(_dc.Hdc);
+
+ if (_graphics != null && document.OriginAtMargins)
+ {
+ // Adjust the origin of the graphics object to be at the
+ // user-specified margin location
+ //
+ int dpiX = UnsafeNativeMethods.GetDeviceCaps(new HandleRef(_dc, _dc.Hdc), SafeNativeMethods.LOGPIXELSX);
+ int dpiY = UnsafeNativeMethods.GetDeviceCaps(new HandleRef(_dc, _dc.Hdc), SafeNativeMethods.LOGPIXELSY);
+ int hardMarginX_DU = UnsafeNativeMethods.GetDeviceCaps(new HandleRef(_dc, _dc.Hdc), SafeNativeMethods.PHYSICALOFFSETX);
+ int hardMarginY_DU = UnsafeNativeMethods.GetDeviceCaps(new HandleRef(_dc, _dc.Hdc), SafeNativeMethods.PHYSICALOFFSETY);
+ float hardMarginX = hardMarginX_DU * 100 / dpiX;
+ float hardMarginY = hardMarginY_DU * 100 / dpiY;
+
+ _graphics.TranslateTransform(-hardMarginX, -hardMarginY);
+ _graphics.TranslateTransform(document.DefaultPageSettings.Margins.Left, document.DefaultPageSettings.Margins.Top);
+ }
+
+
+ int result2 = SafeNativeMethods.StartPage(new HandleRef(_dc, _dc.Hdc));
+ if (result2 <= 0)
+ throw new Win32Exception();
+ return _graphics;
+ }
+
+ /// <include file='doc\DefaultPrintController.uex' path='docs/doc[@for="StandardPrintController.OnEndPage"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Implements EndPage for printing to a physical printer.
+ /// </para>
+ /// </devdoc>
+ public override void OnEndPage(PrintDocument document, PrintPageEventArgs e)
+ {
+ Debug.Assert(_dc != null && _graphics != null, "PrintController methods called in the wrong order?");
+
+ try
+ {
+ int result = SafeNativeMethods.EndPage(new HandleRef(_dc, _dc.Hdc));
+ if (result <= 0)
+ throw new Win32Exception();
+ }
+ finally
+ {
+ _graphics.Dispose(); // Dispose of GDI+ Graphics; keep the DC
+ _graphics = null;
+ }
+ base.OnEndPage(document, e);
+ }
+
+ /// <include file='doc\DefaultPrintController.uex' path='docs/doc[@for="StandardPrintController.OnEndPrint"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Implements EndPrint for printing to a physical printer.
+ /// </para>
+ /// </devdoc>
+ public override void OnEndPrint(PrintDocument document, PrintEventArgs e)
+ {
+ Debug.Assert(_dc != null && _graphics == null, "PrintController methods called in the wrong order?");
+
+ if (_dc != null)
+ {
+ try
+ {
+ int result = (e.Cancel) ? SafeNativeMethods.AbortDoc(new HandleRef(_dc, _dc.Hdc)) : SafeNativeMethods.EndDoc(new HandleRef(_dc, _dc.Hdc));
+ if (result <= 0)
+ throw new Win32Exception();
+ }
+ finally
+ {
+ _dc.Dispose();
+ _dc = null;
+ }
+ }
+
+ base.OnEndPrint(document, e);
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/Duplex.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/Duplex.cs
new file mode 100644
index 0000000000..9c483c1ba2
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/Duplex.cs
@@ -0,0 +1,48 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ /// <include file='doc\Duplex.uex' path='docs/doc[@for="Duplex"]/*' />
+ /// <devdoc>
+ /// <para>Specifies the printer's duplex setting.</para>
+ /// </devdoc>
+ [Serializable]
+ public enum Duplex
+ {
+ /// <include file='doc\Duplex.uex' path='docs/doc[@for="Duplex.Default"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// The printer's default duplex setting.
+ /// </para>
+ /// </devdoc>
+ Default = -1,
+
+ /// <include file='doc\Duplex.uex' path='docs/doc[@for="Duplex.Simplex"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Single-sided printing.
+ /// </para>
+ /// </devdoc>
+ Simplex = SafeNativeMethods.DMDUP_SIMPLEX,
+
+ /// <include file='doc\Duplex.uex' path='docs/doc[@for="Duplex.Horizontal"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Double-sided, horizontal printing.
+ ///
+ /// </para>
+ /// </devdoc>
+ Horizontal = SafeNativeMethods.DMDUP_HORIZONTAL,
+
+ /// <include file='doc\Duplex.uex' path='docs/doc[@for="Duplex.Vertical"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Double-sided, vertical printing.
+ ///
+ /// </para>
+ /// </devdoc>
+ Vertical = SafeNativeMethods.DMDUP_VERTICAL,
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/InvalidPrinterException.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/InvalidPrinterException.cs
new file mode 100644
index 0000000000..01ac2fd3c2
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/InvalidPrinterException.cs
@@ -0,0 +1,74 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ using System.Runtime.Serialization;
+ using System.Security;
+ using System.Security.Permissions;
+
+ /// <include file='doc\InvalidPrinterException.uex' path='docs/doc[@for="InvalidPrinterException"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Represents
+ /// the
+ /// exception that is thrown when trying to access a printer using invalid printer settings.
+ /// </para>
+ /// </devdoc>
+ [Serializable()]
+ public class InvalidPrinterException : SystemException
+ {
+ private PrinterSettings _settings;
+
+ /// <include file='doc\InvalidPrinterException.uex' path='docs/doc[@for="InvalidPrinterException.InvalidPrinterException"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Printing.InvalidPrinterException'/> class.
+ /// </para>
+ /// </devdoc>
+ public InvalidPrinterException(PrinterSettings settings)
+ : base(GenerateMessage(settings))
+ {
+ _settings = settings;
+ }
+
+ /// <include file='doc\InvalidPrinterException.uex' path='docs/doc[@for="InvalidPrinterException.InvalidPrinterException1"]/*' />
+ protected InvalidPrinterException(SerializationInfo info, StreamingContext context) : base(info, context)
+ {
+ _settings = (PrinterSettings)info.GetValue("settings", typeof(PrinterSettings));
+ }
+
+ /// <include file='doc\InvalidPrinterException.uex' path='docs/doc[@for="InvalidPrinterException.GetObjectData"]/*' />
+ [SecurityPermissionAttribute(SecurityAction.Demand, SerializationFormatter = true)]
+ public override void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ if (info == null)
+ {
+ throw new ArgumentNullException("info");
+ }
+ info.AddValue("settings", _settings);
+ base.GetObjectData(info, context);
+ }
+
+ private static string GenerateMessage(PrinterSettings settings)
+ {
+ if (settings.IsDefaultPrinter)
+ {
+ return SR.Format(SR.InvalidPrinterException_NoDefaultPrinter);
+ }
+ else
+ {
+ try
+ {
+ return SR.Format(SR.InvalidPrinterException_InvalidPrinter, settings.PrinterName);
+ }
+ catch (SecurityException)
+ {
+ return SR.Format(SR.InvalidPrinterException_InvalidPrinter, SR.Format(SR.CantTellPrinterName));
+ }
+ }
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/Margins.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/Margins.cs
new file mode 100644
index 0000000000..22d326be5f
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/Margins.cs
@@ -0,0 +1,338 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ using System.Globalization;
+ using System.Runtime.Serialization;
+
+ /// <include file='doc\Margins.uex' path='docs/doc[@for="Margins"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the margins of a printed page.
+ /// </para>
+ /// </devdoc>
+ [Serializable]
+ public class Margins : ICloneable
+ {
+ private int _left;
+ private int _right;
+ private int _top;
+ private int _bottom;
+
+ [OptionalField]
+ private double _doubleLeft;
+ [OptionalField]
+ private double _doubleRight;
+ [OptionalField]
+ private double _doubleTop;
+ [OptionalField]
+ private double _doubleBottom;
+
+ /// <include file='doc\Margins.uex' path='docs/doc[@for="Margins.Margins"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of a the <see cref='System.Drawing.Printing.Margins'/> class with one-inch margins.
+ /// </para>
+ /// </devdoc>
+ public Margins() : this(100, 100, 100, 100)
+ {
+ }
+
+ /// <include file='doc\Margins.uex' path='docs/doc[@for="Margins.Margins1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of a the <see cref='System.Drawing.Printing.Margins'/> class with the specified left, right, top, and bottom
+ /// margins.
+ /// </para>
+ /// </devdoc>
+ public Margins(int left, int right, int top, int bottom)
+ {
+ CheckMargin(left, "left");
+ CheckMargin(right, "right");
+ CheckMargin(top, "top");
+ CheckMargin(bottom, "bottom");
+
+ _left = left;
+ _right = right;
+ _top = top;
+ _bottom = bottom;
+
+ _doubleLeft = (double)left;
+ _doubleRight = (double)right;
+ _doubleTop = (double)top;
+ _doubleBottom = (double)bottom;
+ }
+
+ /// <include file='doc\Margins.uex' path='docs/doc[@for="Margins.Left"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets the left margin, in hundredths of an inch.
+ /// </para>
+ /// </devdoc>
+ public int Left
+ {
+ get { return _left; }
+ set
+ {
+ CheckMargin(value, "Left");
+ _left = value;
+ _doubleLeft = (double)value;
+ }
+ }
+
+ /// <include file='doc\Margins.uex' path='docs/doc[@for="Margins.Right"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets the right margin, in hundredths of an inch.
+ /// </para>
+ /// </devdoc>
+ public int Right
+ {
+ get { return _right; }
+ set
+ {
+ CheckMargin(value, "Right");
+ _right = value;
+ _doubleRight = (double)value;
+ }
+ }
+
+ /// <include file='doc\Margins.uex' path='docs/doc[@for="Margins.Top"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets the top margin, in hundredths of an inch.
+ /// </para>
+ /// </devdoc>
+ public int Top
+ {
+ get { return _top; }
+ set
+ {
+ CheckMargin(value, "Top");
+ _top = value;
+ _doubleTop = (double)value;
+ }
+ }
+
+ /// <include file='doc\Margins.uex' path='docs/doc[@for="Margins.Bottom"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets the bottom margin, in hundredths of an inch.
+ /// </para>
+ /// </devdoc>
+ public int Bottom
+ {
+ get { return _bottom; }
+ set
+ {
+ CheckMargin(value, "Bottom");
+ _bottom = value;
+ _doubleBottom = (double)value;
+ }
+ }
+
+ /// <include file='doc\Margins.uex' path='docs/doc[@for="Margins.DoubleLeft"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets the left margin with double value, in hundredths of an inch.
+ /// When use the setter, the ranger of setting double value should between
+ /// 0 to Int.MaxValue;
+ /// </para>
+ /// </devdoc>
+ internal double DoubleLeft
+ {
+ get { return _doubleLeft; }
+ set
+ {
+ Left = (int)Math.Round(value);
+ _doubleLeft = value;
+ }
+ }
+
+ /// <include file='doc\Margins.uex' path='docs/doc[@for="Margins.DoubleRight"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets the right margin with double value, in hundredths of an inch.
+ /// When use the setter, the ranger of setting double value should between
+ /// 0 to Int.MaxValue;
+ /// </para>
+ /// </devdoc>
+ internal double DoubleRight
+ {
+ get { return _doubleRight; }
+ set
+ {
+ Right = (int)Math.Round(value);
+ _doubleRight = value;
+ }
+ }
+
+ /// <include file='doc\Margins.uex' path='docs/doc[@for="Margins.DoubleTop"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets the top margin with double value, in hundredths of an inch.
+ /// When use the setter, the ranger of setting double value should between
+ /// 0 to Int.MaxValue;
+ /// </para>
+ /// </devdoc>
+ internal double DoubleTop
+ {
+ get { return _doubleTop; }
+ set
+ {
+ Top = (int)Math.Round(value);
+ _doubleTop = value;
+ }
+ }
+
+ /// <include file='doc\Margins.uex' path='docs/doc[@for="Margins.DoubleBottom"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets the bottom margin with double value, in hundredths of an inch.
+ /// When use the setter, the ranger of setting double value should between
+ /// 0 to Int.MaxValue;
+ /// </para>
+ /// </devdoc>
+ internal double DoubleBottom
+ {
+ get { return _doubleBottom; }
+ set
+ {
+ Bottom = (int)Math.Round(value);
+ _doubleBottom = value;
+ }
+ }
+
+ [OnDeserialized()]
+ private void OnDeserializedMethod(StreamingContext context)
+ {
+ if (_doubleLeft == 0 && _left != 0)
+ {
+ _doubleLeft = (double)_left;
+ }
+
+ if (_doubleRight == 0 && _right != 0)
+ {
+ _doubleRight = (double)_right;
+ }
+
+ if (_doubleTop == 0 && _top != 0)
+ {
+ _doubleTop = (double)_top;
+ }
+
+ if (_doubleBottom == 0 && _bottom != 0)
+ {
+ _doubleBottom = (double)_bottom;
+ }
+ }
+
+ private void CheckMargin(int margin, string name)
+ {
+ if (margin < 0)
+ throw new ArgumentException(SR.Format(SR.InvalidLowBoundArgumentEx, name, margin, "0"));
+ }
+
+ /// <include file='doc\Margins.uex' path='docs/doc[@for="Margins.Clone"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Retrieves a duplicate of this object, member by member.
+ /// </para>
+ /// </devdoc>
+ public object Clone()
+ {
+ return MemberwiseClone();
+ }
+
+ /// <include file='doc\Margins.uex' path='docs/doc[@for="Margins.Equals"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Compares this <see cref='System.Drawing.Printing.Margins'/> to a specified <see cref='System.Drawing.Printing.Margins'/> to see whether they
+ /// are equal.
+ /// </para>
+ /// </devdoc>
+ public override bool Equals(object obj)
+ {
+ Margins margins = obj as Margins;
+ if (margins == this) return true;
+ if (margins == null) return false;
+
+ return margins.Left == Left
+ && margins.Right == Right
+ && margins.Top == Top
+ && margins.Bottom == Bottom;
+ }
+
+ /// <include file='doc\Margins.uex' path='docs/doc[@for="Margins.GetHashCode"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Calculates and retrieves a hash code based on the left, right, top, and bottom
+ /// margins.
+ /// </para>
+ /// </devdoc>
+ public override int GetHashCode()
+ {
+ // return HashCodes.Combine(left, right, top, bottom);
+ uint left = (uint)Left;
+ uint right = (uint)Right;
+ uint top = (uint)Top;
+ uint bottom = (uint)Bottom;
+
+ uint result = left ^
+ ((right << 13) | (right >> 19)) ^
+ ((top << 26) | (top >> 6)) ^
+ ((bottom << 7) | (bottom >> 25));
+
+ return unchecked((int)result);
+ }
+
+ /// <include file='doc\Margins.uex' path='docs/doc[@for="Margins.operator=="]/*' />
+ /// <devdoc>
+ /// Tests whether two <see cref='System.Drawing.Printing.Margins'/> objects
+ /// are identical.
+ /// </devdoc>
+ public static bool operator ==(Margins m1, Margins m2)
+ {
+ if (object.ReferenceEquals(m1, null) != object.ReferenceEquals(m2, null))
+ {
+ return false;
+ }
+ if (!object.ReferenceEquals(m1, null))
+ {
+ return m1.Left == m2.Left && m1.Top == m2.Top && m1.Right == m2.Right && m1.Bottom == m2.Bottom;
+ }
+ return true;
+ }
+
+ /// <include file='doc\Margins.uex' path='docs/doc[@for="Margins.operator!="]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Tests whether two <see cref='System.Drawing.Printing.Margins'/> objects are different.
+ /// </para>
+ /// </devdoc>
+ public static bool operator !=(Margins m1, Margins m2)
+ {
+ return !(m1 == m2);
+ }
+
+ /// <include file='doc\Margins.uex' path='docs/doc[@for="Margins.ToString"]/*' />
+ /// <internalonly/>
+ /// <devdoc>
+ /// <para>
+ /// Provides some interesting information for the Margins in
+ /// String form.
+ /// </para>
+ /// </devdoc>
+ public override string ToString()
+ {
+ return "[Margins"
+ + " Left=" + Left.ToString(CultureInfo.InvariantCulture)
+ + " Right=" + Right.ToString(CultureInfo.InvariantCulture)
+ + " Top=" + Top.ToString(CultureInfo.InvariantCulture)
+ + " Bottom=" + Bottom.ToString(CultureInfo.InvariantCulture)
+ + "]";
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/ModeField.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/ModeField.cs
new file mode 100644
index 0000000000..1d0307c362
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/ModeField.cs
@@ -0,0 +1,24 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ // Some of the fields in DEVMODE
+ internal enum ModeField
+ {
+ Orientation,
+ PaperSize,
+ PaperLength,
+ PaperWidth,
+ Copies,
+ DefaultSource,
+ PrintQuality,
+ Color,
+ Duplex,
+ YResolution,
+ TTOption,
+ Collate,
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/PageSettings.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/PageSettings.cs
new file mode 100644
index 0000000000..d3d186b37d
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/PageSettings.cs
@@ -0,0 +1,605 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ using System.Diagnostics;
+ using System.Drawing.Internal;
+ using System.Runtime.InteropServices;
+
+ /// <include file='doc\PageSettings.uex' path='docs/doc[@for="PageSettings"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies
+ /// settings that apply to a single page.
+ /// </para>
+ /// </devdoc>
+ [Serializable]
+ public class PageSettings : ICloneable
+ {
+ internal PrinterSettings printerSettings;
+
+ private TriState _color = TriState.Default;
+ private PaperSize _paperSize;
+ private PaperSource _paperSource;
+ private PrinterResolution _printerResolution;
+ private TriState _landscape = TriState.Default;
+ private Margins _margins = new Margins();
+
+ /// <include file='doc\PageSettings.uex' path='docs/doc[@for="PageSettings.PageSettings"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Printing.PageSettings'/> class using
+ /// the default printer.
+ /// </para>
+ /// </devdoc>
+ public PageSettings() : this(new PrinterSettings())
+ {
+ }
+
+ /// <include file='doc\PageSettings.uex' path='docs/doc[@for="PageSettings.PageSettings1"]/*' />
+ /// <devdoc>
+ /// <para>Initializes a new instance of the <see cref='System.Drawing.Printing.PageSettings'/> class using
+ /// the specified printer.</para>
+ /// </devdoc>
+ public PageSettings(PrinterSettings printerSettings)
+ {
+ Debug.Assert(printerSettings != null, "printerSettings == null");
+ this.printerSettings = printerSettings;
+ }
+
+ /// <include file='doc\PageSettings.uex' path='docs/doc[@for="PageSettings.Bounds"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the bounds of the page, taking into account the Landscape property.
+ /// </para>
+ /// </devdoc>
+ public Rectangle Bounds
+ {
+ get
+ {
+ IntPtr modeHandle = printerSettings.GetHdevmode();
+
+ Rectangle pageBounds = GetBounds(modeHandle);
+
+ SafeNativeMethods.GlobalFree(new HandleRef(this, modeHandle));
+ return pageBounds;
+ }
+ }
+
+ /// <include file='doc\PageSettings.uex' path='docs/doc[@for="PageSettings.Color"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets a value indicating whether the page is printed in color.
+ /// </para>
+ /// </devdoc>
+ public bool Color
+ {
+ get
+ {
+ if (_color.IsDefault)
+ return printerSettings.GetModeField(ModeField.Color, SafeNativeMethods.DMCOLOR_MONOCHROME) == SafeNativeMethods.DMCOLOR_COLOR;
+ else
+ return (bool)_color;
+ }
+ set { _color = value; }
+ }
+
+ /// <include file='doc\PageSettings.uex' path='docs/doc[@for="PageSettings.HardMarginX"]/*' />
+ /// <devdoc>
+ /// <para>Returns the x dimension of the hard margin</para>
+ /// </devdoc>
+ public float HardMarginX
+ {
+ get
+ {
+ float hardMarginX = 0;
+ DeviceContext dc = printerSettings.CreateDeviceContext(this);
+
+ try
+ {
+ int dpiX = UnsafeNativeMethods.GetDeviceCaps(new HandleRef(dc, dc.Hdc), SafeNativeMethods.LOGPIXELSX);
+ int hardMarginX_DU = UnsafeNativeMethods.GetDeviceCaps(new HandleRef(dc, dc.Hdc), SafeNativeMethods.PHYSICALOFFSETX);
+ hardMarginX = hardMarginX_DU * 100 / dpiX;
+ }
+ finally
+ {
+ dc.Dispose();
+ }
+ return hardMarginX;
+ }
+ }
+
+
+ /// <include file='doc\PageSettings.uex' path='docs/doc[@for="PageSettings.HardMarginY"]/*' />
+ /// <devdoc>
+ /// <para>Returns the y dimension of the hard margin</para>
+ /// </devdoc>
+ public float HardMarginY
+ {
+ get
+ {
+ float hardMarginY = 0;
+ DeviceContext dc = printerSettings.CreateDeviceContext(this);
+
+ try
+ {
+ int dpiY = UnsafeNativeMethods.GetDeviceCaps(new HandleRef(dc, dc.Hdc), SafeNativeMethods.LOGPIXELSY);
+ int hardMarginY_DU = UnsafeNativeMethods.GetDeviceCaps(new HandleRef(dc, dc.Hdc), SafeNativeMethods.PHYSICALOFFSETY);
+ hardMarginY = hardMarginY_DU * 100 / dpiY;
+ }
+ finally
+ {
+ dc.Dispose();
+ }
+ return hardMarginY;
+ }
+ }
+
+ /// <include file='doc\PageSettings.uex' path='docs/doc[@for="PageSettings.Landscape"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets a value indicating whether the page should be printed in landscape or portrait orientation.
+ /// </para>
+ /// </devdoc>
+ public bool Landscape
+ {
+ get
+ {
+ if (_landscape.IsDefault)
+ return printerSettings.GetModeField(ModeField.Orientation, SafeNativeMethods.DMORIENT_PORTRAIT) == SafeNativeMethods.DMORIENT_LANDSCAPE;
+ else
+ return (bool)_landscape;
+ }
+ set { _landscape = value; }
+ }
+
+ /// <include file='doc\PageSettings.uex' path='docs/doc[@for="PageSettings.Margins"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets a value indicating the margins for this page.
+ ///
+ /// </para>
+ /// </devdoc>
+ public Margins Margins
+ {
+ get { return _margins; }
+ set { _margins = value; }
+ }
+
+ /// <include file='doc\PageSettings.uex' path='docs/doc[@for="PageSettings.PaperSize"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets the paper size.
+ /// </para>
+ /// </devdoc>
+ public PaperSize PaperSize
+ {
+ get
+ {
+ return GetPaperSize(IntPtr.Zero);
+ }
+ set { _paperSize = value; }
+ }
+
+ /// <include file='doc\PageSettings.uex' path='docs/doc[@for="PageSettings.PaperSource"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets a value indicating the paper source (i.e. upper bin).
+ ///
+ /// </para>
+ /// </devdoc>
+ public PaperSource PaperSource
+ {
+ get
+ {
+ if (_paperSource == null)
+ {
+ IntPtr modeHandle = printerSettings.GetHdevmode();
+ IntPtr modePointer = SafeNativeMethods.GlobalLock(new HandleRef(this, modeHandle));
+ SafeNativeMethods.DEVMODE mode = (SafeNativeMethods.DEVMODE)UnsafeNativeMethods.PtrToStructure(modePointer, typeof(SafeNativeMethods.DEVMODE));
+
+ PaperSource result = PaperSourceFromMode(mode);
+
+ SafeNativeMethods.GlobalUnlock(new HandleRef(this, modeHandle));
+ SafeNativeMethods.GlobalFree(new HandleRef(this, modeHandle));
+
+ return result;
+ }
+ else
+ return _paperSource;
+ }
+ set { _paperSource = value; }
+ }
+
+ /// <include file='doc\PageSettings.uex' path='docs/doc[@for="PageSettings.PrintableArea"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the PrintableArea for the printer. Units = 100ths of an inch.
+ /// </para>
+ /// </devdoc>
+ public RectangleF PrintableArea
+ {
+ get
+ {
+ RectangleF printableArea = new RectangleF();
+ DeviceContext dc = printerSettings.CreateInformationContext(this);
+ HandleRef hdc = new HandleRef(dc, dc.Hdc);
+
+ try
+ {
+ int dpiX = UnsafeNativeMethods.GetDeviceCaps(hdc, SafeNativeMethods.LOGPIXELSX);
+ int dpiY = UnsafeNativeMethods.GetDeviceCaps(hdc, SafeNativeMethods.LOGPIXELSY);
+ if (!Landscape)
+ {
+ //
+ // Need to convert the printable area to 100th of an inch from the device units
+ printableArea.X = (float)UnsafeNativeMethods.GetDeviceCaps(hdc, SafeNativeMethods.PHYSICALOFFSETX) * 100 / dpiX;
+ printableArea.Y = (float)UnsafeNativeMethods.GetDeviceCaps(hdc, SafeNativeMethods.PHYSICALOFFSETY) * 100 / dpiY;
+ printableArea.Width = (float)UnsafeNativeMethods.GetDeviceCaps(hdc, SafeNativeMethods.HORZRES) * 100 / dpiX;
+ printableArea.Height = (float)UnsafeNativeMethods.GetDeviceCaps(hdc, SafeNativeMethods.VERTRES) * 100 / dpiY;
+ }
+ else
+ {
+ //
+ // Need to convert the printable area to 100th of an inch from the device units
+ printableArea.Y = (float)UnsafeNativeMethods.GetDeviceCaps(hdc, SafeNativeMethods.PHYSICALOFFSETX) * 100 / dpiX;
+ printableArea.X = (float)UnsafeNativeMethods.GetDeviceCaps(hdc, SafeNativeMethods.PHYSICALOFFSETY) * 100 / dpiY;
+ printableArea.Height = (float)UnsafeNativeMethods.GetDeviceCaps(hdc, SafeNativeMethods.HORZRES) * 100 / dpiX;
+ printableArea.Width = (float)UnsafeNativeMethods.GetDeviceCaps(hdc, SafeNativeMethods.VERTRES) * 100 / dpiY;
+ }
+ }
+ finally
+ {
+ dc.Dispose();
+ }
+
+ return printableArea;
+ }
+ }
+
+ /// <include file='doc\PageSettings.uex' path='docs/doc[@for="PageSettings.PrinterResolution"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets the printer resolution for the page.
+ /// </para>
+ /// </devdoc>
+ public PrinterResolution PrinterResolution
+ {
+ get
+ {
+ if (_printerResolution == null)
+ {
+ IntPtr modeHandle = printerSettings.GetHdevmode();
+ IntPtr modePointer = SafeNativeMethods.GlobalLock(new HandleRef(this, modeHandle));
+ SafeNativeMethods.DEVMODE mode = (SafeNativeMethods.DEVMODE)UnsafeNativeMethods.PtrToStructure(modePointer, typeof(SafeNativeMethods.DEVMODE));
+
+ PrinterResolution result = PrinterResolutionFromMode(mode);
+
+ SafeNativeMethods.GlobalUnlock(new HandleRef(this, modeHandle));
+ SafeNativeMethods.GlobalFree(new HandleRef(this, modeHandle));
+
+ return result;
+ }
+ else
+ return _printerResolution;
+ }
+ set
+ {
+ _printerResolution = value;
+ }
+ }
+
+ /// <include file='doc\PageSettings.uex' path='docs/doc[@for="PageSettings.PrinterSettings"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets the
+ /// associated printer settings.
+ /// </para>
+ /// </devdoc>
+ public PrinterSettings PrinterSettings
+ {
+ get { return printerSettings; }
+ set
+ {
+ if (value == null)
+ value = new PrinterSettings();
+ printerSettings = value;
+ }
+ }
+
+ /// <include file='doc\PageSettings.uex' path='docs/doc[@for="PageSettings.Clone"]/*' />
+ /// <devdoc>
+ /// Copies the settings and margins.
+ /// </devdoc>
+ public object Clone()
+ {
+ PageSettings result = (PageSettings)MemberwiseClone();
+ result._margins = (Margins)_margins.Clone();
+ return result;
+ }
+
+ /// <include file='doc\PageSettings.uex' path='docs/doc[@for="PageSettings.CopyToHdevmode"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Copies the relevant information out of the PageSettings and into the handle.
+ /// </para>
+ /// </devdoc>
+ public void CopyToHdevmode(IntPtr hdevmode)
+ {
+ IntPtr modePointer = SafeNativeMethods.GlobalLock(new HandleRef(null, hdevmode));
+ SafeNativeMethods.DEVMODE mode = (SafeNativeMethods.DEVMODE)UnsafeNativeMethods.PtrToStructure(modePointer, typeof(SafeNativeMethods.DEVMODE));
+
+ if (_color.IsNotDefault && ((mode.dmFields & SafeNativeMethods.DM_COLOR) == SafeNativeMethods.DM_COLOR))
+ mode.dmColor = unchecked((short)(((bool)_color) ? SafeNativeMethods.DMCOLOR_COLOR : SafeNativeMethods.DMCOLOR_MONOCHROME));
+ if (_landscape.IsNotDefault && ((mode.dmFields & SafeNativeMethods.DM_ORIENTATION) == SafeNativeMethods.DM_ORIENTATION))
+ mode.dmOrientation = unchecked((short)(((bool)_landscape) ? SafeNativeMethods.DMORIENT_LANDSCAPE : SafeNativeMethods.DMORIENT_PORTRAIT));
+
+ if (_paperSize != null)
+ {
+ if ((mode.dmFields & SafeNativeMethods.DM_PAPERSIZE) == SafeNativeMethods.DM_PAPERSIZE)
+ {
+ mode.dmPaperSize = unchecked((short)_paperSize.RawKind);
+ }
+
+ bool setWidth = false;
+ bool setLength = false;
+
+ if ((mode.dmFields & SafeNativeMethods.DM_PAPERLENGTH) == SafeNativeMethods.DM_PAPERLENGTH)
+ {
+ // dmPaperLength is always in tenths of millimeter but paperSizes are in hundredth of inch ..
+ // so we need to convert :: use PrinterUnitConvert.Convert(value, PrinterUnit.TenthsOfAMillimeter /*fromUnit*/, PrinterUnit.Display /*ToUnit*/)
+ int length = PrinterUnitConvert.Convert(_paperSize.Height, PrinterUnit.Display, PrinterUnit.TenthsOfAMillimeter);
+ mode.dmPaperLength = unchecked((short)length);
+ setLength = true;
+ }
+ if ((mode.dmFields & SafeNativeMethods.DM_PAPERWIDTH) == SafeNativeMethods.DM_PAPERWIDTH)
+ {
+ int width = PrinterUnitConvert.Convert(_paperSize.Width, PrinterUnit.Display, PrinterUnit.TenthsOfAMillimeter);
+ mode.dmPaperWidth = unchecked((short)width);
+ setWidth = true;
+ }
+
+ if (_paperSize.Kind == PaperKind.Custom)
+ {
+ if (!setLength)
+ {
+ mode.dmFields |= SafeNativeMethods.DM_PAPERLENGTH;
+ int length = PrinterUnitConvert.Convert(_paperSize.Height, PrinterUnit.Display, PrinterUnit.TenthsOfAMillimeter);
+ mode.dmPaperLength = unchecked((short)length);
+ }
+ if (!setWidth)
+ {
+ mode.dmFields |= SafeNativeMethods.DM_PAPERWIDTH;
+ int width = PrinterUnitConvert.Convert(_paperSize.Width, PrinterUnit.Display, PrinterUnit.TenthsOfAMillimeter);
+ mode.dmPaperWidth = unchecked((short)width);
+ }
+ }
+ }
+
+ if (_paperSource != null && ((mode.dmFields & SafeNativeMethods.DM_DEFAULTSOURCE) == SafeNativeMethods.DM_DEFAULTSOURCE))
+ {
+ mode.dmDefaultSource = unchecked((short)_paperSource.RawKind);
+ }
+
+ if (_printerResolution != null)
+ {
+ if (_printerResolution.Kind == PrinterResolutionKind.Custom)
+ {
+ if ((mode.dmFields & SafeNativeMethods.DM_PRINTQUALITY) == SafeNativeMethods.DM_PRINTQUALITY)
+ {
+ mode.dmPrintQuality = unchecked((short)_printerResolution.X);
+ }
+ if ((mode.dmFields & SafeNativeMethods.DM_YRESOLUTION) == SafeNativeMethods.DM_YRESOLUTION)
+ {
+ mode.dmYResolution = unchecked((short)_printerResolution.Y);
+ }
+ }
+ else
+ {
+ if ((mode.dmFields & SafeNativeMethods.DM_PRINTQUALITY) == SafeNativeMethods.DM_PRINTQUALITY)
+ {
+ mode.dmPrintQuality = unchecked((short)_printerResolution.Kind);
+ }
+ }
+ }
+
+ Marshal.StructureToPtr(mode, modePointer, false);
+
+ // It's possible this page has a DEVMODE for a different printer than the DEVMODE passed in here
+ // (Ex: occurs when Doc.DefaultPageSettings.PrinterSettings.PrinterName != Doc.PrinterSettings.PrinterName)
+ //
+ // if the passed in devmode has fewer bytes than our buffer for the extrainfo, we want to skip the merge as it will cause
+ // a buffer overrun
+ if (mode.dmDriverExtra >= ExtraBytes)
+ {
+ int retCode = SafeNativeMethods.DocumentProperties(NativeMethods.NullHandleRef, NativeMethods.NullHandleRef, printerSettings.PrinterName, modePointer, modePointer, SafeNativeMethods.DM_IN_BUFFER | SafeNativeMethods.DM_OUT_BUFFER);
+ if (retCode < 0)
+ {
+ SafeNativeMethods.GlobalFree(new HandleRef(null, modePointer));
+ }
+ }
+
+ SafeNativeMethods.GlobalUnlock(new HandleRef(null, hdevmode));
+ }
+
+ private short ExtraBytes
+ {
+ get
+ {
+ IntPtr modeHandle = printerSettings.GetHdevmodeInternal();
+ IntPtr modePointer = SafeNativeMethods.GlobalLock(new HandleRef(this, modeHandle));
+ SafeNativeMethods.DEVMODE mode = (SafeNativeMethods.DEVMODE)UnsafeNativeMethods.PtrToStructure(modePointer, typeof(SafeNativeMethods.DEVMODE));
+
+ short result = mode.dmDriverExtra;
+
+ SafeNativeMethods.GlobalUnlock(new HandleRef(this, modeHandle));
+ SafeNativeMethods.GlobalFree(new HandleRef(this, modeHandle));
+
+ return result;
+ }
+ }
+
+
+ // This function shows up big on profiles, so we need to make it fast
+ internal Rectangle GetBounds(IntPtr modeHandle)
+ {
+ Rectangle pageBounds;
+ PaperSize size = GetPaperSize(modeHandle);
+ if (GetLandscape(modeHandle))
+ pageBounds = new Rectangle(0, 0, size.Height, size.Width);
+ else
+ pageBounds = new Rectangle(0, 0, size.Width, size.Height);
+
+ return pageBounds;
+ }
+
+ private bool GetLandscape(IntPtr modeHandle)
+ {
+ if (_landscape.IsDefault)
+ return printerSettings.GetModeField(ModeField.Orientation, SafeNativeMethods.DMORIENT_PORTRAIT, modeHandle) == SafeNativeMethods.DMORIENT_LANDSCAPE;
+ else
+ return (bool)_landscape;
+ }
+
+ private PaperSize GetPaperSize(IntPtr modeHandle)
+ {
+ if (_paperSize == null)
+ {
+ bool ownHandle = false;
+ if (modeHandle == IntPtr.Zero)
+ {
+ modeHandle = printerSettings.GetHdevmode();
+ ownHandle = true;
+ }
+
+ IntPtr modePointer = SafeNativeMethods.GlobalLock(new HandleRef(null, modeHandle));
+ SafeNativeMethods.DEVMODE mode = (SafeNativeMethods.DEVMODE)UnsafeNativeMethods.PtrToStructure(modePointer, typeof(SafeNativeMethods.DEVMODE));
+
+ PaperSize result = PaperSizeFromMode(mode);
+
+ SafeNativeMethods.GlobalUnlock(new HandleRef(null, modeHandle));
+
+ if (ownHandle)
+ SafeNativeMethods.GlobalFree(new HandleRef(null, modeHandle));
+
+ return result;
+ }
+ else
+ return _paperSize;
+ }
+
+ private PaperSize PaperSizeFromMode(SafeNativeMethods.DEVMODE mode)
+ {
+ PaperSize[] sizes = printerSettings.Get_PaperSizes();
+ if ((mode.dmFields & SafeNativeMethods.DM_PAPERSIZE) == SafeNativeMethods.DM_PAPERSIZE)
+ {
+ for (int i = 0; i < sizes.Length; i++)
+ {
+ if ((int)sizes[i].RawKind == mode.dmPaperSize)
+ return sizes[i];
+ }
+ }
+ return new PaperSize(PaperKind.Custom, "custom",
+ //mode.dmPaperWidth, mode.dmPaperLength);
+ PrinterUnitConvert.Convert(mode.dmPaperWidth, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display),
+ PrinterUnitConvert.Convert(mode.dmPaperLength, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display));
+ }
+
+ private PaperSource PaperSourceFromMode(SafeNativeMethods.DEVMODE mode)
+ {
+ PaperSource[] sources = printerSettings.Get_PaperSources();
+ if ((mode.dmFields & SafeNativeMethods.DM_DEFAULTSOURCE) == SafeNativeMethods.DM_DEFAULTSOURCE)
+ {
+ for (int i = 0; i < sources.Length; i++)
+ {
+ // the dmDefaultSource == to the RawKind in the Papersource.. and Not the Kind...
+ // if the PaperSource is populated with CUSTOM values...
+ if (unchecked((short)sources[i].RawKind) == mode.dmDefaultSource)
+ {
+ return sources[i];
+ }
+ }
+ }
+ return new PaperSource((PaperSourceKind)mode.dmDefaultSource, "unknown");
+ }
+
+ private PrinterResolution PrinterResolutionFromMode(SafeNativeMethods.DEVMODE mode)
+ {
+ PrinterResolution[] resolutions = printerSettings.Get_PrinterResolutions();
+ for (int i = 0; i < resolutions.Length; i++)
+ {
+ if (mode.dmPrintQuality >= 0 && ((mode.dmFields & SafeNativeMethods.DM_PRINTQUALITY) == SafeNativeMethods.DM_PRINTQUALITY)
+ && ((mode.dmFields & SafeNativeMethods.DM_YRESOLUTION) == SafeNativeMethods.DM_YRESOLUTION))
+ {
+ if (resolutions[i].X == unchecked((int)(PrinterResolutionKind)mode.dmPrintQuality)
+ && resolutions[i].Y == unchecked((int)(PrinterResolutionKind)mode.dmYResolution))
+ return resolutions[i];
+ }
+ else
+ {
+ if ((mode.dmFields & SafeNativeMethods.DM_PRINTQUALITY) == SafeNativeMethods.DM_PRINTQUALITY)
+ {
+ if (resolutions[i].Kind == (PrinterResolutionKind)mode.dmPrintQuality)
+ return resolutions[i];
+ }
+ }
+ }
+ return new PrinterResolution(PrinterResolutionKind.Custom,
+ mode.dmPrintQuality, mode.dmYResolution);
+ }
+
+ /// <include file='doc\PageSettings.uex' path='docs/doc[@for="PageSettings.SetHdevmode"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Copies the relevant information out of the handle and into the PageSettings.
+ /// </para>
+ /// </devdoc>
+ public void SetHdevmode(IntPtr hdevmode)
+ {
+ if (hdevmode == IntPtr.Zero)
+ throw new ArgumentException(SR.Format(SR.InvalidPrinterHandle, hdevmode));
+
+ IntPtr pointer = SafeNativeMethods.GlobalLock(new HandleRef(null, hdevmode));
+ SafeNativeMethods.DEVMODE mode = (SafeNativeMethods.DEVMODE)UnsafeNativeMethods.PtrToStructure(pointer, typeof(SafeNativeMethods.DEVMODE));
+
+ if ((mode.dmFields & SafeNativeMethods.DM_COLOR) == SafeNativeMethods.DM_COLOR)
+ {
+ _color = (mode.dmColor == SafeNativeMethods.DMCOLOR_COLOR);
+ }
+
+ if ((mode.dmFields & SafeNativeMethods.DM_ORIENTATION) == SafeNativeMethods.DM_ORIENTATION)
+ {
+ _landscape = (mode.dmOrientation == SafeNativeMethods.DMORIENT_LANDSCAPE);
+ }
+
+ _paperSize = PaperSizeFromMode(mode);
+ _paperSource = PaperSourceFromMode(mode);
+ _printerResolution = PrinterResolutionFromMode(mode);
+
+ SafeNativeMethods.GlobalUnlock(new HandleRef(null, hdevmode));
+ }
+
+ /// <include file='doc\PageSettings.uex' path='docs/doc[@for="PageSettings.ToString"]/*' />
+ /// <internalonly/>
+ /// <devdoc>
+ /// <para>
+ /// Provides some interesting information about the PageSettings in
+ /// String form.
+ /// </para>
+ /// </devdoc>
+ public override string ToString()
+ {
+ return "[PageSettings:"
+ + " Color=" + Color.ToString()
+ + ", Landscape=" + Landscape.ToString()
+ + ", Margins=" + Margins.ToString()
+ + ", PaperSize=" + PaperSize.ToString()
+ + ", PaperSource=" + PaperSource.ToString()
+ + ", PrinterResolution=" + PrinterResolution.ToString()
+ + "]";
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/PaperKinds.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/PaperKinds.cs
new file mode 100644
index 0000000000..23cbe9be05
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/PaperKinds.cs
@@ -0,0 +1,999 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the standard paper sizes.
+ /// </para>
+ /// </devdoc>
+ [Serializable]
+ public enum PaperKind
+ {
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Custom"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// The paper size is defined by the user.
+ /// </para>
+ /// </devdoc>
+ Custom = 0,
+
+ // I got this information from two places: MSDN's writeup of DEVMODE
+ // (http://msdn.microsoft.com/library/psdk/gdi/prntspol_8nle.htm),
+ // and the raw C++ header file (wingdi.h). Beyond that, your guess
+ // is as good as mine as to what these members mean.
+
+
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Letter"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Letter paper (8.5 in.
+ /// by 11 in.).
+ /// </para>
+ /// </devdoc>
+ Letter = SafeNativeMethods.DMPAPER_LETTER,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Legal"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Legal paper (8.5 in.
+ /// by 14
+ /// in.).
+ /// </para>
+ /// </devdoc>
+ Legal = SafeNativeMethods.DMPAPER_LEGAL,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.A4"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A4 paper (210
+ /// mm by 297
+ /// mm).
+ /// </para>
+ /// </devdoc>
+ A4 = SafeNativeMethods.DMPAPER_A4,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.CSheet"]/*' />
+ /// <devdoc>
+ /// C paper (17 in. by 22 in.).
+ /// </devdoc>
+ CSheet = SafeNativeMethods.DMPAPER_CSHEET,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.DSheet"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// D paper (22
+ /// in. by 34 in.).
+ /// </para>
+ /// </devdoc>
+ DSheet = SafeNativeMethods.DMPAPER_DSHEET,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.ESheet"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// E paper (34
+ /// in. by 44 in.).
+ /// </para>
+ /// </devdoc>
+ ESheet = SafeNativeMethods.DMPAPER_ESHEET,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.LetterSmall"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Letter small paper (8.5 in. by 11 in.).
+ /// </para>
+ /// </devdoc>
+ LetterSmall = SafeNativeMethods.DMPAPER_LETTERSMALL,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Tabloid"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Tabloid paper (11
+ /// in. by 17 in.).
+ /// </para>
+ /// </devdoc>
+ Tabloid = SafeNativeMethods.DMPAPER_TABLOID,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Ledger"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Ledger paper (17
+ /// in. by 11 in.).
+ /// </para>
+ /// </devdoc>
+ Ledger = SafeNativeMethods.DMPAPER_LEDGER,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Statement"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Statement paper (5.5
+ /// in. by 8.5 in.).
+ /// </para>
+ /// </devdoc>
+ Statement = SafeNativeMethods.DMPAPER_STATEMENT,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Executive"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Executive paper (7.25
+ /// in. by 10.5
+ /// in.).
+ /// </para>
+ /// </devdoc>
+ Executive = SafeNativeMethods.DMPAPER_EXECUTIVE,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.A3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A3 paper
+ /// (297 mm by 420 mm).
+ /// </para>
+ /// </devdoc>
+ A3 = SafeNativeMethods.DMPAPER_A3,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.A4Small"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A4 small paper
+ /// (210 mm by 297 mm).
+ /// </para>
+ /// </devdoc>
+ A4Small = SafeNativeMethods.DMPAPER_A4SMALL,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.A5"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A5 paper (148
+ /// mm by 210
+ /// mm).
+ /// </para>
+ /// </devdoc>
+ A5 = SafeNativeMethods.DMPAPER_A5,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.B4"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// B4 paper (250 mm by 353 mm).
+ /// </para>
+ /// </devdoc>
+ B4 = SafeNativeMethods.DMPAPER_B4,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.B5"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// B5 paper (176
+ /// mm by 250 mm).
+ /// </para>
+ /// </devdoc>
+ B5 = SafeNativeMethods.DMPAPER_B5,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Folio"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Folio paper (8.5
+ /// in. by 13 in.).
+ /// </para>
+ /// </devdoc>
+ Folio = SafeNativeMethods.DMPAPER_FOLIO,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Quarto"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Quarto paper (215
+ /// mm by 275 mm).
+ /// </para>
+ /// </devdoc>
+ Quarto = SafeNativeMethods.DMPAPER_QUARTO,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Standard10x14"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// 10-by-14-inch paper.
+ ///
+ /// </para>
+ /// </devdoc>
+ Standard10x14 = SafeNativeMethods.DMPAPER_10X14,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Standard11x17"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// 11-by-17-inch paper.
+ ///
+ /// </para>
+ /// </devdoc>
+ Standard11x17 = SafeNativeMethods.DMPAPER_11X17,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Note"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Note paper (8.5 in.
+ /// by 11 in.).
+ /// </para>
+ /// </devdoc>
+ Note = SafeNativeMethods.DMPAPER_NOTE,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Number9Envelope"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// #9 envelope (3.875
+ /// in. by 8.875 in.).
+ /// </para>
+ /// </devdoc>
+ Number9Envelope = SafeNativeMethods.DMPAPER_ENV_9,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Number10Envelope"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// #10 envelope
+ /// (4.125 in. by 9.5 in.).
+ /// </para>
+ /// </devdoc>
+ Number10Envelope = SafeNativeMethods.DMPAPER_ENV_10,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Number11Envelope"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// #11 envelope (4.5
+ /// in. by 10.375 in.).
+ /// </para>
+ /// </devdoc>
+ Number11Envelope = SafeNativeMethods.DMPAPER_ENV_11,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Number12Envelope"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// #12 envelope (4.75
+ /// in. by 11 in.).
+ /// </para>
+ /// </devdoc>
+ Number12Envelope = SafeNativeMethods.DMPAPER_ENV_12,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Number14Envelope"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// #14 envelope (5 in. by 11.5 in.).
+ /// </para>
+ /// </devdoc>
+ Number14Envelope = SafeNativeMethods.DMPAPER_ENV_14,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.DLEnvelope"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// DL envelope
+ /// (110 mm by 220 mm).
+ /// </para>
+ /// </devdoc>
+ DLEnvelope = SafeNativeMethods.DMPAPER_ENV_DL,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.C5Envelope"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// C5 envelope
+ /// (162 mm by 229 mm).
+ /// </para>
+ /// </devdoc>
+ C5Envelope = SafeNativeMethods.DMPAPER_ENV_C5,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.C3Envelope"]/*' />
+ /// <devdoc>
+ /// C3 envelope (324 mm by 458 mm).
+ /// </devdoc>
+ C3Envelope = SafeNativeMethods.DMPAPER_ENV_C3,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.C4Envelope"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// C4 envelope (229
+ /// mm by 324 mm).
+ /// </para>
+ /// </devdoc>
+ C4Envelope = SafeNativeMethods.DMPAPER_ENV_C4,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.C6Envelope"]/*' />
+ /// <devdoc>
+ /// C6 envelope (114 mm by 162 mm).
+ /// </devdoc>
+ C6Envelope = SafeNativeMethods.DMPAPER_ENV_C6,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.C65Envelope"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// C65 envelope (114
+ /// mm by 229 mm).
+ /// </para>
+ /// </devdoc>
+ C65Envelope = SafeNativeMethods.DMPAPER_ENV_C65,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.B4Envelope"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// B4 envelope (250 mm by 353 mm).
+ /// </para>
+ /// </devdoc>
+ B4Envelope = SafeNativeMethods.DMPAPER_ENV_B4,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.B5Envelope"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// B5 envelope (176
+ /// mm by 250 mm).
+ /// </para>
+ /// </devdoc>
+ B5Envelope = SafeNativeMethods.DMPAPER_ENV_B5,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.B6Envelope"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// B6 envelope (176
+ /// mm by 125 mm).
+ /// </para>
+ /// </devdoc>
+ B6Envelope = SafeNativeMethods.DMPAPER_ENV_B6,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.ItalyEnvelope"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Italy envelope (110 mm by 230 mm).
+ /// </para>
+ /// </devdoc>
+ ItalyEnvelope = SafeNativeMethods.DMPAPER_ENV_ITALY,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.MonarchEnvelope"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Monarch envelope (3.875
+ /// in. by 7.5 in.).
+ /// </para>
+ /// </devdoc>
+ MonarchEnvelope = SafeNativeMethods.DMPAPER_ENV_MONARCH,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.PersonalEnvelope"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// 6 3/4 envelope
+ /// (3.625 in. by 6.5 in.).
+ /// </para>
+ /// </devdoc>
+ PersonalEnvelope = SafeNativeMethods.DMPAPER_ENV_PERSONAL,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.USStandardFanfold"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// US standard
+ /// fanfold (14.875 in. by 11 in.).
+ /// </para>
+ /// </devdoc>
+ USStandardFanfold = SafeNativeMethods.DMPAPER_FANFOLD_US,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.GermanStandardFanfold"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// German standard fanfold
+ /// (8.5 in. by 12 in.).
+ /// </para>
+ /// </devdoc>
+ GermanStandardFanfold = SafeNativeMethods.DMPAPER_FANFOLD_STD_GERMAN,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.GermanLegalFanfold"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// German legal fanfold
+ /// (8.5 in. by 13 in.).
+ /// </para>
+ /// </devdoc>
+ GermanLegalFanfold = SafeNativeMethods.DMPAPER_FANFOLD_LGL_GERMAN,
+
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.IsoB4"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// ISO B4 (250 mm by 353 mm).
+ /// </para>
+ /// </devdoc>
+ IsoB4 = SafeNativeMethods.DMPAPER_ISO_B4,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.JapanesePostcard"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Japanese postcard (100 mm by 148 mm).
+ /// </para>
+ /// </devdoc>
+ JapanesePostcard = SafeNativeMethods.DMPAPER_JAPANESE_POSTCARD,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Standard9x11"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// 9-by-11-inch
+ /// paper.
+ ///
+ /// </para>
+ /// </devdoc>
+ Standard9x11 = SafeNativeMethods.DMPAPER_9X11,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Standard10x11"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// 10-by-11-inch paper.
+ ///
+ /// </para>
+ /// </devdoc>
+ Standard10x11 = SafeNativeMethods.DMPAPER_10X11,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Standard15x11"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// 15-by-11-inch paper.
+ ///
+ /// </para>
+ /// </devdoc>
+ Standard15x11 = SafeNativeMethods.DMPAPER_15X11,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.InviteEnvelope"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Invite envelope (220
+ /// mm by 220 mm).
+ /// </para>
+ /// </devdoc>
+ InviteEnvelope = SafeNativeMethods.DMPAPER_ENV_INVITE,
+ //= SafeNativeMethods.DMPAPER_RESERVED_48,
+ //= SafeNativeMethods.DMPAPER_RESERVED_49,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.LetterExtra"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Letter extra paper
+ /// (9.275 in. by
+ /// 12 in.). This value is specific to the PostScript driver and is used only
+ /// by Linotronic printers in order to conserve paper.
+ /// </para>
+ /// </devdoc>
+ LetterExtra = SafeNativeMethods.DMPAPER_LETTER_EXTRA,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.LegalExtra"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Legal extra
+ /// paper (9.275 in.
+ /// by 15 in.). This value is specific to the PostScript driver, and is used
+ /// only by Linotronic printers in order to conserve paper.
+ /// </para>
+ /// </devdoc>
+ LegalExtra = SafeNativeMethods.DMPAPER_LEGAL_EXTRA,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.TabloidExtra"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Tabloid extra paper
+ /// (11.69 in. by 18 in.). This
+ /// value is specific to the PostScript driver and is used only by Linotronic printers in order to conserve paper.
+ /// </para>
+ /// </devdoc>
+ TabloidExtra = SafeNativeMethods.DMPAPER_TABLOID_EXTRA,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.A4Extra"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A4 extra
+ /// paper
+ /// (236 mm by 322 mm). This value is specific to the PostScript driver and is used only
+ /// by Linotronic printers to help save paper.
+ /// </para>
+ /// </devdoc>
+ A4Extra = SafeNativeMethods.DMPAPER_A4_EXTRA,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.LetterTransverse"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Letter transverse paper
+ /// (8.275 in. by 11 in.).
+ /// </para>
+ /// </devdoc>
+ LetterTransverse = SafeNativeMethods.DMPAPER_LETTER_TRANSVERSE,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.A4Transverse"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A4 transverse paper
+ /// (210 mm by 297 mm).
+ /// </para>
+ /// </devdoc>
+ A4Transverse = SafeNativeMethods.DMPAPER_A4_TRANSVERSE,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.LetterExtraTransverse"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Letter extra transverse
+ /// paper (9.275 in. by 12
+ /// in.).
+ /// </para>
+ /// </devdoc>
+ LetterExtraTransverse = SafeNativeMethods.DMPAPER_LETTER_EXTRA_TRANSVERSE,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.APlus"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// SuperA/SuperA/A4 paper (227
+ /// mm by 356 mm).
+ /// </para>
+ /// </devdoc>
+ APlus = SafeNativeMethods.DMPAPER_A_PLUS,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.BPlus"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// SuperB/SuperB/A3 paper (305
+ /// mm by 487 mm).
+ /// </para>
+ /// </devdoc>
+ BPlus = SafeNativeMethods.DMPAPER_B_PLUS,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.LetterPlus"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Letter plus paper
+ /// (8.5 in. by 12.69 in.).
+ /// </para>
+ /// </devdoc>
+ LetterPlus = SafeNativeMethods.DMPAPER_LETTER_PLUS,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.A4Plus"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A4 plus paper
+ /// (210 mm by 330 mm).
+ /// </para>
+ /// </devdoc>
+ A4Plus = SafeNativeMethods.DMPAPER_A4_PLUS,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.A5Transverse"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A5 transverse paper
+ /// (148 mm by 210
+ /// mm).
+ /// </para>
+ /// </devdoc>
+ A5Transverse = SafeNativeMethods.DMPAPER_A5_TRANSVERSE,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.B5Transverse"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// JIS B5 transverse
+ /// paper (182 mm by 257 mm).
+ /// </para>
+ /// </devdoc>
+ B5Transverse = SafeNativeMethods.DMPAPER_B5_TRANSVERSE,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.A3Extra"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A3 extra paper
+ /// (322 mm by 445 mm).
+ /// </para>
+ /// </devdoc>
+ A3Extra = SafeNativeMethods.DMPAPER_A3_EXTRA,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.A5Extra"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A5 extra paper
+ /// (174 mm by 235 mm).
+ /// </para>
+ /// </devdoc>
+ A5Extra = SafeNativeMethods.DMPAPER_A5_EXTRA,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.B5Extra"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// ISO B5 extra
+ /// paper (201 mm by 276 mm).
+ /// </para>
+ /// </devdoc>
+ B5Extra = SafeNativeMethods.DMPAPER_B5_EXTRA,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.A2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A2 paper
+ /// (420
+ /// mm by 594 mm).
+ /// </para>
+ /// </devdoc>
+ A2 = SafeNativeMethods.DMPAPER_A2,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.A3Transverse"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A3 transverse paper
+ /// (297 mm by 420 mm).
+ /// </para>
+ /// </devdoc>
+ A3Transverse = SafeNativeMethods.DMPAPER_A3_TRANSVERSE,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.A3ExtraTransverse"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A3 extra transverse
+ /// paper (322 mm by 445 mm).
+ /// </para>
+ /// </devdoc>
+ A3ExtraTransverse = SafeNativeMethods.DMPAPER_A3_EXTRA_TRANSVERSE,
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.JapaneseDoublePostcard"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Japanese double postcard
+ /// (200 mm by 148
+ /// mm). Requires Windows
+ /// 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ JapaneseDoublePostcard = SafeNativeMethods.DMPAPER_DBL_JAPANESE_POSTCARD, /* Japanese Double Postcard 200 x 148 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.A6"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A6 paper (105
+ /// mm by 148 mm). Requires
+ /// Windows 98,
+ /// Windows
+ /// NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ A6 = SafeNativeMethods.DMPAPER_A6, /* A6 105 x 148 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.JapaneseEnvelopeKakuNumber2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Japanese Kaku #2 envelope. Requires Windows
+ /// 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ JapaneseEnvelopeKakuNumber2 = SafeNativeMethods.DMPAPER_JENV_KAKU2, /* Japanese Envelope Kaku #2 */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.JapaneseEnvelopeKakuNumber3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Japanese Kaku #3 envelope. Requires Windows 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ JapaneseEnvelopeKakuNumber3 = SafeNativeMethods.DMPAPER_JENV_KAKU3, /* Japanese Envelope Kaku #3 */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.JapaneseEnvelopeChouNumber3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Japanese Chou #3 envelope. Requires Windows
+ /// 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ JapaneseEnvelopeChouNumber3 = SafeNativeMethods.DMPAPER_JENV_CHOU3, /* Japanese Envelope Chou #3 */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.JapaneseEnvelopeChouNumber4"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Japanese Chou #4 envelope. Requires Windows
+ /// 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ JapaneseEnvelopeChouNumber4 = SafeNativeMethods.DMPAPER_JENV_CHOU4, /* Japanese Envelope Chou #4 */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.LetterRotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Letter rotated paper (11
+ /// in. by
+ /// 8.5 in.).
+ /// </para>
+ /// </devdoc>
+ LetterRotated = SafeNativeMethods.DMPAPER_LETTER_ROTATED, /* Letter Rotated 11 x 8 1/2 11 in */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.A3Rotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A3
+ /// rotated paper (420mm by 297 mm).
+ /// </para>
+ /// </devdoc>
+ A3Rotated = SafeNativeMethods.DMPAPER_A3_ROTATED, /* A3 Rotated 420 x 297 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.A4Rotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A4 rotated paper
+ /// (297 mm by 210 mm).
+ /// Requires Windows
+ /// 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ A4Rotated = SafeNativeMethods.DMPAPER_A4_ROTATED, /* A4 Rotated 297 x 210 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.A5Rotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A5 rotated paper
+ /// (210 mm by 148 mm).
+ /// Requires Windows
+ /// 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ A5Rotated = SafeNativeMethods.DMPAPER_A5_ROTATED, /* A5 Rotated 210 x 148 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.B4JisRotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// JIS B4 rotated
+ /// paper (364 mm by 257
+ /// mm). Requires Windows
+ /// 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ B4JisRotated = SafeNativeMethods.DMPAPER_B4_JIS_ROTATED, /* B4 (JIS) Rotated 364 x 257 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.B5JisRotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// JIS B5 rotated
+ /// paper (257 mm by 182
+ /// mm). Requires Windows
+ /// 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ B5JisRotated = SafeNativeMethods.DMPAPER_B5_JIS_ROTATED, /* B5 (JIS) Rotated 257 x 182 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.JapanesePostcardRotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Japanese rotated postcard
+ /// (148 mm by 100
+ /// mm). Requires Windows
+ /// 98,
+ /// Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ JapanesePostcardRotated = SafeNativeMethods.DMPAPER_JAPANESE_POSTCARD_ROTATED, /* Japanese Postcard Rotated 148 x 100 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.JapaneseDoublePostcardRotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Japanese rotated double
+ /// postcard (148 mm by
+ /// 200 mm). Requires
+ /// Windows 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ JapaneseDoublePostcardRotated = SafeNativeMethods.DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED, /* Double Japanese Postcard Rotated 148 x 200 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.A6Rotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A6
+ /// rotated paper
+ /// (148 mm by 105 mm).
+ /// Requires Windows
+ /// 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ A6Rotated = SafeNativeMethods.DMPAPER_A6_ROTATED, /* A6 Rotated 148 x 105 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.JapaneseEnvelopeKakuNumber2Rotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Japanese rotated Kaku #2 envelope. Requires
+ /// Windows 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ JapaneseEnvelopeKakuNumber2Rotated = SafeNativeMethods.DMPAPER_JENV_KAKU2_ROTATED, /* Japanese Envelope Kaku #2 Rotated */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.JapaneseEnvelopeKakuNumber3Rotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Japanese rotated Kaku #3 envelope. Requires
+ /// Windows 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ JapaneseEnvelopeKakuNumber3Rotated = SafeNativeMethods.DMPAPER_JENV_KAKU3_ROTATED, /* Japanese Envelope Kaku #3 Rotated */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.JapaneseEnvelopeChouNumber3Rotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Japanese rotated Chou #3 envelope. Requires
+ /// Windows 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ JapaneseEnvelopeChouNumber3Rotated = SafeNativeMethods.DMPAPER_JENV_CHOU3_ROTATED, /* Japanese Envelope Chou #3 Rotated */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.JapaneseEnvelopeChouNumber4Rotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Japanese rotated Chou #4 envelope. Requires
+ /// Windows 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ JapaneseEnvelopeChouNumber4Rotated = SafeNativeMethods.DMPAPER_JENV_CHOU4_ROTATED, /* Japanese Envelope Chou #4 Rotated */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.B6Jis"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// JIS B6 paper
+ /// (128 mm by 182 mm).
+ /// Requires Windows 98,
+ /// Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ B6Jis = SafeNativeMethods.DMPAPER_B6_JIS, /* B6 (JIS) 128 x 182 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.B6JisRotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// JIS B6
+ /// rotated paper (182 mm by 128
+ /// mm). Requires Windows
+ /// 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ B6JisRotated = SafeNativeMethods.DMPAPER_B6_JIS_ROTATED, /* B6 (JIS) Rotated 182 x 128 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Standard12x11"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// 12-by-11-inch paper. Requires Windows 98,
+ /// Windows
+ /// NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ Standard12x11 = SafeNativeMethods.DMPAPER_12X11, /* 12 x 11 in */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.JapaneseEnvelopeYouNumber4"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Japanese You #4 envelope. Requires Windows
+ /// 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ JapaneseEnvelopeYouNumber4 = SafeNativeMethods.DMPAPER_JENV_YOU4, /* Japanese Envelope You #4 */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.JapaneseEnvelopeYouNumber4Rotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Japanese You #4 rotated envelope. Requires
+ /// Windows 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ JapaneseEnvelopeYouNumber4Rotated = SafeNativeMethods.DMPAPER_JENV_YOU4_ROTATED, /* Japanese Envelope You #4 Rotated*/
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Prc16K"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PRC 16K paper (146 mm
+ /// by 215
+ /// mm). Requires Windows
+ /// 98, Windows NT 4.0,
+ /// or later.
+ /// </para>
+ /// </devdoc>
+ Prc16K = SafeNativeMethods.DMPAPER_P16K, /* PRC 16K 146 x 215 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Prc32K"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PRC 32K paper (97 mm
+ /// by 151
+ /// mm). Requires Windows 98, Windows
+ /// NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ Prc32K = SafeNativeMethods.DMPAPER_P32K, /* PRC 32K 97 x 151 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Prc32KBig"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PRC 32K big paper (97
+ /// mm by
+ /// 151 mm). Requires Windows 98, Windows
+ /// NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ Prc32KBig = SafeNativeMethods.DMPAPER_P32KBIG, /* PRC 32K(Big) 97 x 151 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.PrcEnvelopeNumber1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PRC #1 envelope (102 mm
+ /// by 165
+ /// mm). Requires Windows 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ PrcEnvelopeNumber1 = SafeNativeMethods.DMPAPER_PENV_1, /* PRC Envelope #1 102 x 165 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.PrcEnvelopeNumber2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PRC #2 envelope (102 mm
+ /// by 176
+ /// mm). Requires Windows 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ PrcEnvelopeNumber2 = SafeNativeMethods.DMPAPER_PENV_2, /* PRC Envelope #2 102 x 176 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.PrcEnvelopeNumber3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PRC #3 envelope (125 mm
+ /// by 176
+ /// mm). Requires Windows 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ PrcEnvelopeNumber3 = SafeNativeMethods.DMPAPER_PENV_3, /* PRC Envelope #3 125 x 176 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.PrcEnvelopeNumber4"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PRC #4 envelope (110 mm
+ /// by 208
+ /// mm). Requires Windows 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ PrcEnvelopeNumber4 = SafeNativeMethods.DMPAPER_PENV_4, /* PRC Envelope #4 110 x 208 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.PrcEnvelopeNumber5"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PRC #5 envelope (110 mm by 220 mm). Requires Windows 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ PrcEnvelopeNumber5 = SafeNativeMethods.DMPAPER_PENV_5, /* PRC Envelope #5 110 x 220 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.PrcEnvelopeNumber6"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PRC #6 envelope (120 mm by 230 mm). Requires Windows 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ PrcEnvelopeNumber6 = SafeNativeMethods.DMPAPER_PENV_6, /* PRC Envelope #6 120 x 230 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.PrcEnvelopeNumber7"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PRC #7 envelope (160 mm
+ /// by 230
+ /// mm). Requires Windows 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ PrcEnvelopeNumber7 = SafeNativeMethods.DMPAPER_PENV_7, /* PRC Envelope #7 160 x 230 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.PrcEnvelopeNumber8"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PRC #8 envelope (120 mm
+ /// by 309
+ /// mm). Requires Windows 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ PrcEnvelopeNumber8 = SafeNativeMethods.DMPAPER_PENV_8, /* PRC Envelope #8 120 x 309 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.PrcEnvelopeNumber9"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PRC #9 envelope (229 mm by 324 mm). Requires Windows 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ PrcEnvelopeNumber9 = SafeNativeMethods.DMPAPER_PENV_9, /* PRC Envelope #9 229 x 324 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.PrcEnvelopeNumber10"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PRC #10 envelope (324 mm
+ /// by 458
+ /// mm). Requires Windows 98, Windows NT 4.0, or
+ /// later.
+ /// </para>
+ /// </devdoc>
+ PrcEnvelopeNumber10 = SafeNativeMethods.DMPAPER_PENV_10, /* PRC Envelope #10 324 x 458 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Prc16KRotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PRC 16K rotated paper (146 mm by 215 mm). Requires Windows 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ Prc16KRotated = SafeNativeMethods.DMPAPER_P16K_ROTATED, /* PRC 16K Rotated */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Prc32KRotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PRC 32K rotated paper (97 mm by 151
+ /// mm). Requires Windows 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ Prc32KRotated = SafeNativeMethods.DMPAPER_P32K_ROTATED, /* PRC 32K Rotated */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.Prc32KBigRotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PRC 32K big rotated paper (97 mm by 151 mm). Requires Windows 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ Prc32KBigRotated = SafeNativeMethods.DMPAPER_P32KBIG_ROTATED, /* PRC 32K(Big) Rotated */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.PrcEnvelopeNumber1Rotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PRC #1 rotated envelope (165 mm by 102 mm). Requires Windows 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ PrcEnvelopeNumber1Rotated = SafeNativeMethods.DMPAPER_PENV_1_ROTATED, /* PRC Envelope #1 Rotated 165 x 102 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.PrcEnvelopeNumber2Rotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PRC #2 rotated envelope
+ /// (176 mm by
+ /// 102 mm). Requires Windows 98, Windows NT 4.0, or
+ /// later.
+ /// </para>
+ /// </devdoc>
+ PrcEnvelopeNumber2Rotated = SafeNativeMethods.DMPAPER_PENV_2_ROTATED, /* PRC Envelope #2 Rotated 176 x 102 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.PrcEnvelopeNumber3Rotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PRC #3 rotated envelope
+ /// (176 mm by
+ /// 125 mm). Requires Windows 98, Windows NT 4.0, or
+ /// later.
+ /// </para>
+ /// </devdoc>
+ PrcEnvelopeNumber3Rotated = SafeNativeMethods.DMPAPER_PENV_3_ROTATED, /* PRC Envelope #3 Rotated 176 x 125 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.PrcEnvelopeNumber4Rotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PRC #4 rotated envelope (208 mm by 110 mm). Requires Windows 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ PrcEnvelopeNumber4Rotated = SafeNativeMethods.DMPAPER_PENV_4_ROTATED, /* PRC Envelope #4 Rotated 208 x 110 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.PrcEnvelopeNumber5Rotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PRC #5 rotated envelope (220 mm by 110 mm). Requires Windows 98, Windows NT 4.0, or
+ /// later.
+ /// </para>
+ /// </devdoc>
+ PrcEnvelopeNumber5Rotated = SafeNativeMethods.DMPAPER_PENV_5_ROTATED, /* PRC Envelope #5 Rotated 220 x 110 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.PrcEnvelopeNumber6Rotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PRC #6 rotated envelope (230 mm by 120 mm). Requires Windows 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ PrcEnvelopeNumber6Rotated = SafeNativeMethods.DMPAPER_PENV_6_ROTATED, /* PRC Envelope #6 Rotated 230 x 120 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.PrcEnvelopeNumber7Rotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PRC #7 rotated envelope (230 mm by 160 mm). Requires Windows 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ PrcEnvelopeNumber7Rotated = SafeNativeMethods.DMPAPER_PENV_7_ROTATED, /* PRC Envelope #7 Rotated 230 x 160 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.PrcEnvelopeNumber8Rotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PRC #8 rotated
+ /// envelope (309 mm
+ /// by 120
+ /// mm). Requires Windows 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ PrcEnvelopeNumber8Rotated = SafeNativeMethods.DMPAPER_PENV_8_ROTATED, /* PRC Envelope #8 Rotated 309 x 120 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.PrcEnvelopeNumber9Rotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PRC #9 rotated envelope (324 mm by 229 mm). Requires Windows 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ PrcEnvelopeNumber9Rotated = SafeNativeMethods.DMPAPER_PENV_9_ROTATED, /* PRC Envelope #9 Rotated 324 x 229 mm */
+ /// <include file='doc\PaperKinds.uex' path='docs/doc[@for="PaperKind.PrcEnvelopeNumber10Rotated"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// PRC #10 rotated envelope (458 mm by 324 mm). Requires Windows 98, Windows NT 4.0, or later.
+ /// </para>
+ /// </devdoc>
+ PrcEnvelopeNumber10Rotated = SafeNativeMethods.DMPAPER_PENV_10_ROTATED, /* PRC Envelope #10 Rotated 458 x 324 mm */
+
+ // Other useful values: SafeNativeMethods.DMPAPER_LAST, SafeNativeMethods.DMPAPER_USER
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/PaperSize.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/PaperSize.cs
new file mode 100644
index 0000000000..6ee2ca940c
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/PaperSize.cs
@@ -0,0 +1,167 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ using System.Globalization;
+
+ /// <include file='doc\PaperSize.uex' path='docs/doc[@for="PaperSize"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies
+ /// the size of a piece of paper.
+ /// </para>
+ /// </devdoc>
+ [Serializable]
+ public class PaperSize
+ {
+ private PaperKind _kind;
+ private string _name;
+
+ // standard hundredths of an inch units
+ private int _width;
+ private int _height;
+ private bool _createdByDefaultConstructor;
+
+ /// <include file='doc\PaperSize.uex' path='docs/doc[@for="PaperSize.PaperSize2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Printing.PaperSize'/> class with default properties.
+ /// This constructor is required for the serialization of the <see cref='System.Drawing.Printing.PaperSize'/> class.
+ /// </para>
+ /// </devdoc>
+ public PaperSize()
+ {
+ _kind = PaperKind.Custom;
+ _name = String.Empty;
+ _createdByDefaultConstructor = true;
+ }
+
+ internal PaperSize(PaperKind kind, string name, int width, int height)
+ {
+ _kind = kind;
+ _name = name;
+ _width = width;
+ _height = height;
+ }
+
+ /// <include file='doc\PaperSize.uex' path='docs/doc[@for="PaperSize.PaperSize"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Printing.PaperSize'/> class.
+ /// </para>
+ /// </devdoc>
+ public PaperSize(string name, int width, int height)
+ {
+ _kind = PaperKind.Custom;
+ _name = name;
+ _width = width;
+ _height = height;
+ }
+
+ /// <include file='doc\PaperSize.uex' path='docs/doc[@for="PaperSize.Height"]/*' />
+ /// <devdoc>
+ /// <para>Gets or sets
+ /// the height of the paper, in hundredths of an inch.</para>
+ /// </devdoc>
+ public int Height
+ {
+ get
+ {
+ return _height;
+ }
+
+ set
+ {
+ if (_kind != PaperKind.Custom && !_createdByDefaultConstructor) throw new ArgumentException(SR.Format(SR.PSizeNotCustom));
+ _height = value;
+ }
+ }
+
+ /// <include file='doc\PaperSize.uex' path='docs/doc[@for="PaperSize.Kind"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the type of paper.
+ ///
+ /// </para>
+ /// </devdoc>
+ public PaperKind Kind
+ {
+ get
+ {
+ if (_kind <= (PaperKind)SafeNativeMethods.DMPAPER_LAST &&
+ !(_kind == (PaperKind)SafeNativeMethods.DMPAPER_RESERVED_48 || _kind == (PaperKind)SafeNativeMethods.DMPAPER_RESERVED_49))
+ return _kind;
+ else
+ return PaperKind.Custom;
+ }
+ }
+
+ /// <include file='doc\PaperSize.uex' path='docs/doc[@for="PaperSize.PaperName"]/*' />
+ /// <devdoc>
+ /// <para>Gets
+ /// or sets the name of the type of paper.</para>
+ /// </devdoc>
+ public string PaperName
+ {
+ get { return _name; }
+
+ set
+ {
+ if (_kind != PaperKind.Custom && !_createdByDefaultConstructor) throw new ArgumentException(SR.Format(SR.PSizeNotCustom));
+ _name = value;
+ }
+ }
+
+ /// <include file='doc\PaperSize.uex' path='docs/doc[@for="PaperSize.RawKind"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Same as Kind, but values larger than or equal to DMPAPER_LAST do not map to PaperKind.Custom.
+ /// This property is needed for serialization of the PrinterSettings object.
+ /// </para>
+ /// </devdoc>
+ public int RawKind
+ {
+ get { return unchecked((int)_kind); }
+ set { _kind = unchecked((PaperKind)value); }
+ }
+
+ /// <include file='doc\PaperSize.uex' path='docs/doc[@for="PaperSize.Width"]/*' />
+ /// <devdoc>
+ /// <para>Gets or sets
+ /// the width of the paper, in hundredths of an inch.</para>
+ /// </devdoc>
+ public int Width
+ {
+ get
+ {
+ return _width;
+ }
+
+ set
+ {
+ if (_kind != PaperKind.Custom && !_createdByDefaultConstructor) throw new ArgumentException(SR.Format(SR.PSizeNotCustom));
+ _width = value;
+ }
+ }
+
+ /// <include file='doc\PaperSize.uex' path='docs/doc[@for="PaperSize.ToString"]/*' />
+ /// <internalonly/>
+ /// <devdoc>
+ /// <para>
+ /// Provides some interesting information about the PaperSize in
+ /// String form.
+ /// </para>
+ /// </devdoc>
+ public override string ToString()
+ {
+ return "[PaperSize " + PaperName
+ + " Kind=" + Kind.ToString()
+ + " Height=" + Height.ToString(CultureInfo.InvariantCulture)
+ + " Width=" + Width.ToString(CultureInfo.InvariantCulture)
+ + "]";
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/PaperSource.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/PaperSource.cs
new file mode 100644
index 0000000000..2236ff0873
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/PaperSource.cs
@@ -0,0 +1,98 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ /// <include file='doc\PaperSource.uex' path='docs/doc[@for="PaperSource"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the paper tray from which the printer gets paper.
+ /// </para>
+ /// </devdoc>
+ [Serializable]
+ public class PaperSource
+ {
+ private string _name;
+ private PaperSourceKind _kind;
+
+ /// <include file='doc\PaperSource.uex' path='docs/doc[@for="PaperSource.PaperSource"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Printing.PaperSource'/> class with default properties.
+ /// This constructor is required for the serialization of the <see cref='System.Drawing.Printing.PaperSource'/> class.
+ /// </para>
+ /// </devdoc>
+ public PaperSource()
+ {
+ _kind = PaperSourceKind.Custom;
+ _name = String.Empty;
+ }
+
+ internal PaperSource(PaperSourceKind kind, string name)
+ {
+ _kind = kind;
+ _name = name;
+ }
+
+ /// <include file='doc\PaperSource.uex' path='docs/doc[@for="PaperSource.Kind"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets
+ /// a value indicating the type of paper source.
+ ///
+ /// </para>
+ /// </devdoc>
+ public PaperSourceKind Kind
+ {
+ get
+ {
+ if ((unchecked((int)_kind)) >= SafeNativeMethods.DMBIN_USER)
+ return PaperSourceKind.Custom;
+ else
+ return _kind;
+ }
+ }
+
+ /// <include file='doc\PaperSource.uex' path='docs/doc[@for="PaperSource.RawKind"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Same as Kind, but values larger than DMBIN_USER do not map to PaperSourceKind.Custom.
+ /// This property is needed for serialization of the PrinterSettings object.
+ /// </para>
+ /// </devdoc>
+ public int RawKind
+ {
+ get { return unchecked((int)_kind); }
+ set { _kind = unchecked((PaperSourceKind)value); }
+ }
+
+ /// <include file='doc\PaperSource.uex' path='docs/doc[@for="PaperSource.SourceName"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the name of the paper source.
+ /// Setter is added for serialization of the PrinterSettings object.
+ /// </para>
+ /// </devdoc>
+ public string SourceName
+ {
+ get { return _name; }
+ set { _name = value; }
+ }
+
+ /// <include file='doc\PaperSource.uex' path='docs/doc[@for="PaperSource.ToString"]/*' />
+ /// <internalonly/>
+ /// <devdoc>
+ /// <para>
+ /// Provides some interesting information about the PaperSource in
+ /// String form.
+ /// </para>
+ /// </devdoc>
+ public override string ToString()
+ {
+ return "[PaperSource " + SourceName
+ + " Kind=" + Kind.ToString()
+ + "]";
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/PaperSourceKind.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/PaperSourceKind.cs
new file mode 100644
index 0000000000..f0dde3a452
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/PaperSourceKind.cs
@@ -0,0 +1,132 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ /// <include file='doc\PaperSourceKind.uex' path='docs/doc[@for="PaperSourceKind"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Standard paper sources.
+ /// </para>
+ /// </devdoc>
+ [Serializable]
+ public enum PaperSourceKind
+ {
+ // Please keep these in SafeNativeMethods.cs order
+
+ /// <include file='doc\PaperSourceKind.uex' path='docs/doc[@for="PaperSourceKind.Upper"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// The upper bin of a printer (or, if the printer only has one bin, the only bin).
+ /// </para>
+ /// </devdoc>
+ Upper = SafeNativeMethods.DMBIN_UPPER,
+
+ /// <include file='doc\PaperSourceKind.uex' path='docs/doc[@for="PaperSourceKind.Lower"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// The lower bin of a printer.
+ /// </para>
+ /// </devdoc>
+ Lower = SafeNativeMethods.DMBIN_LOWER,
+
+ /// <include file='doc\PaperSourceKind.uex' path='docs/doc[@for="PaperSourceKind.Middle"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// The middle bin of a printer.
+ /// </para>
+ /// </devdoc>
+ Middle = SafeNativeMethods.DMBIN_MIDDLE,
+
+ /// <include file='doc\PaperSourceKind.uex' path='docs/doc[@for="PaperSourceKind.Manual"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Manually-fed paper.
+ /// </para>
+ /// </devdoc>
+ Manual = SafeNativeMethods.DMBIN_MANUAL,
+
+ /// <include file='doc\PaperSourceKind.uex' path='docs/doc[@for="PaperSourceKind.Envelope"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// An envelope.
+ ///
+ /// </para>
+ /// </devdoc>
+ Envelope = SafeNativeMethods.DMBIN_ENVELOPE,
+
+ /// <include file='doc\PaperSourceKind.uex' path='docs/doc[@for="PaperSourceKind.ManualFeed"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A manually-fed envelope.
+ /// </para>
+ /// </devdoc>
+ ManualFeed = SafeNativeMethods.DMBIN_ENVMANUAL,
+
+ /// <include file='doc\PaperSourceKind.uex' path='docs/doc[@for="PaperSourceKind.AutomaticFeed"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Automatic-fed paper.
+ ///
+ /// </para>
+ /// </devdoc>
+ AutomaticFeed = SafeNativeMethods.DMBIN_AUTO,
+
+ /// <include file='doc\PaperSourceKind.uex' path='docs/doc[@for="PaperSourceKind.TractorFeed"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A tractor feed.
+ /// </para>
+ /// </devdoc>
+ TractorFeed = SafeNativeMethods.DMBIN_TRACTOR,
+
+ /// <include file='doc\PaperSourceKind.uex' path='docs/doc[@for="PaperSourceKind.SmallFormat"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Small-format paper.
+ /// </para>
+ /// </devdoc>
+ SmallFormat = SafeNativeMethods.DMBIN_SMALLFMT,
+
+ /// <include file='doc\PaperSourceKind.uex' path='docs/doc[@for="PaperSourceKind.LargeFormat"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Large-format paper.
+ /// </para>
+ /// </devdoc>
+ LargeFormat = SafeNativeMethods.DMBIN_LARGEFMT,
+
+ /// <include file='doc\PaperSourceKind.uex' path='docs/doc[@for="PaperSourceKind.LargeCapacity"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A large-capacity
+ /// bin a printer.
+ ///
+ /// </para>
+ /// </devdoc>
+ LargeCapacity = SafeNativeMethods.DMBIN_LARGECAPACITY,
+
+ /// <include file='doc\PaperSourceKind.uex' path='docs/doc[@for="PaperSourceKind.Cassette"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A paper cassette.
+ /// </para>
+ /// </devdoc>
+ Cassette = SafeNativeMethods.DMBIN_CASSETTE,
+
+ /// <include file='doc\PaperSourceKind.uex' path='docs/doc[@for="PaperSourceKind.FormSource"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ FormSource = SafeNativeMethods.DMBIN_FORMSOURCE,
+
+ /// <include file='doc\PaperSourceKind.uex' path='docs/doc[@for="PaperSourceKind.Custom"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// A printer-specific paper source.
+ /// </para>
+ /// </devdoc>
+ Custom = SafeNativeMethods.DMBIN_USER + 1,
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/PreviewPageInfo.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/PreviewPageInfo.cs
new file mode 100644
index 0000000000..5cbee65682
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/PreviewPageInfo.cs
@@ -0,0 +1,53 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ /// <include file='doc\PreviewPageInfo.uex' path='docs/doc[@for="PreviewPageInfo"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies print preview information for
+ /// a single page. This class cannot be inherited.
+ /// </para>
+ /// </devdoc>
+ public sealed class PreviewPageInfo
+ {
+ private Image _image;
+
+ // Physical measures in hundredths of an inch
+ private Size _physicalSize = Size.Empty;
+
+ /// <include file='doc\PreviewPageInfo.uex' path='docs/doc[@for="PreviewPageInfo.PreviewPageInfo"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Printing.PreviewPageInfo'/>
+ /// class.
+ /// </para>
+ /// </devdoc>
+ public PreviewPageInfo(Image image, Size physicalSize)
+ {
+ _image = image;
+ _physicalSize = physicalSize;
+ }
+
+ /// <include file='doc\PreviewPageInfo.uex' path='docs/doc[@for="PreviewPageInfo.Image"]/*' />
+ /// <devdoc>
+ /// <para>Gets the image of the printed page.</para>
+ /// </devdoc>
+ public Image Image
+ {
+ get { return _image; }
+ }
+
+ // Physical measures in hundredths of an inch
+ /// <include file='doc\PreviewPageInfo.uex' path='docs/doc[@for="PreviewPageInfo.PhysicalSize"]/*' />
+ /// <devdoc>
+ /// <para> Gets the size of the printed page, in hundredths of an inch.</para>
+ /// </devdoc>
+ public Size PhysicalSize
+ {
+ get { return _physicalSize; }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/PreviewPrintController.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/PreviewPrintController.cs
new file mode 100644
index 0000000000..6041bec087
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/PreviewPrintController.cs
@@ -0,0 +1,205 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ using System.Collections;
+ using System.Diagnostics;
+ using System.Drawing.Drawing2D;
+ using System.Drawing.Imaging;
+ using System.Drawing.Internal;
+ using System.Drawing.Text;
+ using System.Runtime.InteropServices;
+
+ /// <include file='doc\PreviewPrintController.uex' path='docs/doc[@for="PreviewPrintController"]/*' />
+ /// <devdoc>
+ /// A PrintController which "prints" to a series of images.
+ /// </devdoc>
+ public class PreviewPrintController : PrintController
+ {
+ private IList _list = new ArrayList(); // list of PreviewPageInfo
+ private System.Drawing.Graphics _graphics;
+ private DeviceContext _dc;
+ private bool _antiAlias;
+
+ private void CheckSecurity()
+ {
+ }
+
+ /// <include file='doc\PreviewPrintController.uex' path='docs/doc[@for="PreviewPrintController.IsPreview"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// This is new public property which notifies if this controller is used for PrintPreview.
+ /// </para>
+ /// </devdoc>
+ public override bool IsPreview
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ /// <include file='doc\PreviewPrintController.uex' path='docs/doc[@for="PreviewPrintController.OnStartPrint"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Implements StartPrint for generating print preview information.
+ /// </para>
+ /// </devdoc>
+ public override void OnStartPrint(PrintDocument document, PrintEventArgs e)
+ {
+ Debug.Assert(_dc == null && _graphics == null, "PrintController methods called in the wrong order?");
+
+ // For security purposes, don't assume our public methods methods are called in any particular order
+ CheckSecurity();
+
+ base.OnStartPrint(document, e);
+
+ if (!document.PrinterSettings.IsValid)
+ throw new InvalidPrinterException(document.PrinterSettings);
+
+ // We need a DC as a reference; we don't actually draw on it.
+ // We make sure to reuse the same one to improve performance.
+ _dc = document.PrinterSettings.CreateInformationContext(modeHandle);
+ }
+
+ /// <include file='doc\PreviewPrintController.uex' path='docs/doc[@for="PreviewPrintController.OnStartPage"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Implements StartEnd for generating print preview information.
+ /// </para>
+ /// </devdoc>
+ public override Graphics OnStartPage(PrintDocument document, PrintPageEventArgs e)
+ {
+ Debug.Assert(_dc != null && _graphics == null, "PrintController methods called in the wrong order?");
+
+ // For security purposes, don't assume our public methods methods are called in any particular order
+ CheckSecurity();
+
+ base.OnStartPage(document, e);
+
+ if (e.CopySettingsToDevMode)
+ {
+ e.PageSettings.CopyToHdevmode(modeHandle);
+ }
+
+ Size size = e.PageBounds.Size;
+
+ // Metafile framing rectangles apparently use hundredths of mm as their unit of measurement,
+ // instead of the GDI+ standard hundredth of an inch.
+ Size metafileSize = PrinterUnitConvert.Convert(size, PrinterUnit.Display, PrinterUnit.HundredthsOfAMillimeter);
+
+ // Create a Metafile which accepts only GDI+ commands since we are the ones creating
+ // and using this ...
+ // Framework creates a dual-mode EMF for each page in the preview.
+ // When these images are displayed in preview,
+ // they are added to the dual-mode EMF. However,
+ // GDI+ breaks during this process if the image
+ // is sufficiently large and has more than 254 colors.
+ // This code path can easily be avoided by requesting
+ // an EmfPlusOnly EMF..
+ Metafile metafile = new Metafile(_dc.Hdc, new Rectangle(0, 0, metafileSize.Width, metafileSize.Height), MetafileFrameUnit.GdiCompatible, EmfType.EmfPlusOnly);
+
+ PreviewPageInfo info = new PreviewPageInfo(metafile, size);
+ _list.Add(info);
+ PrintPreviewGraphics printGraphics = new PrintPreviewGraphics(document, e);
+ _graphics = Graphics.FromImage(metafile);
+
+ if (_graphics != null && document.OriginAtMargins)
+ {
+ // Adjust the origin of the graphics object to be at the
+ // user-specified margin location
+ //
+ int dpiX = UnsafeNativeMethods.GetDeviceCaps(new HandleRef(_dc, _dc.Hdc), SafeNativeMethods.LOGPIXELSX);
+ int dpiY = UnsafeNativeMethods.GetDeviceCaps(new HandleRef(_dc, _dc.Hdc), SafeNativeMethods.LOGPIXELSY);
+ int hardMarginX_DU = UnsafeNativeMethods.GetDeviceCaps(new HandleRef(_dc, _dc.Hdc), SafeNativeMethods.PHYSICALOFFSETX);
+ int hardMarginY_DU = UnsafeNativeMethods.GetDeviceCaps(new HandleRef(_dc, _dc.Hdc), SafeNativeMethods.PHYSICALOFFSETY);
+ float hardMarginX = hardMarginX_DU * 100 / dpiX;
+ float hardMarginY = hardMarginY_DU * 100 / dpiY;
+
+ _graphics.TranslateTransform(-hardMarginX, -hardMarginY);
+ _graphics.TranslateTransform(document.DefaultPageSettings.Margins.Left, document.DefaultPageSettings.Margins.Top);
+ }
+
+
+ _graphics.PrintingHelper = printGraphics;
+
+
+ if (_antiAlias)
+ {
+ _graphics.TextRenderingHint = TextRenderingHint.AntiAlias;
+ _graphics.SmoothingMode = SmoothingMode.AntiAlias;
+ }
+ return _graphics;
+ }
+
+ /// <include file='doc\PreviewPrintController.uex' path='docs/doc[@for="PreviewPrintController.OnEndPage"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Implements EndPage for generating print preview information.
+ /// </para>
+ /// </devdoc>
+ public override void OnEndPage(PrintDocument document, PrintPageEventArgs e)
+ {
+ Debug.Assert(_dc != null && _graphics != null, "PrintController methods called in the wrong order?");
+
+ // For security purposes, don't assume our public methods methods are called in any particular order
+ CheckSecurity();
+
+ _graphics.Dispose();
+ _graphics = null;
+
+ base.OnEndPage(document, e);
+ }
+
+ /// <include file='doc\PreviewPrintController.uex' path='docs/doc[@for="PreviewPrintController.OnEndPrint"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Implements EndPrint for generating print preview information.
+ /// </para>
+ /// </devdoc>
+ public override void OnEndPrint(PrintDocument document, PrintEventArgs e)
+ {
+ Debug.Assert(_dc != null && _graphics == null, "PrintController methods called in the wrong order?");
+
+ // For security purposes, don't assume our public methods are called in any particular order
+ CheckSecurity();
+
+ _dc.Dispose();
+ _dc = null;
+
+ base.OnEndPrint(document, e);
+ }
+
+ /// <include file='doc\PreviewPrintController.uex' path='docs/doc[@for="PreviewPrintController.GetPreviewPageInfo"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// The "printout".
+ /// </para>
+ /// </devdoc>
+ public PreviewPageInfo[] GetPreviewPageInfo()
+ {
+ // For security purposes, don't assume our public methods methods are called in any particular order
+ CheckSecurity();
+
+ PreviewPageInfo[] temp = new PreviewPageInfo[_list.Count];
+ _list.CopyTo(temp, 0);
+ return temp;
+ }
+
+ /// <include file='doc\PreviewPrintController.uex' path='docs/doc[@for="PreviewPrintController.UseAntiAlias"]/*' />
+ public virtual bool UseAntiAlias
+ {
+ get
+ {
+ return _antiAlias;
+ }
+ set
+ {
+ _antiAlias = value;
+ }
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/PrintAction.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/PrintAction.cs
new file mode 100644
index 0000000000..11a6e8983b
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/PrintAction.cs
@@ -0,0 +1,37 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ /// <include file='doc\PrintAction.uex' path='docs/doc[@for="PrintAction"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the type of action for the <see cref='System.Drawing.Printing.PrintEventArgs'/>.
+ /// </para>
+ /// </devdoc>
+ public enum PrintAction
+ {
+ /// <include file='doc\PrintAction.uex' path='docs/doc[@for="PrintAction.PrintToFile"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Printing to a file.
+ /// </para>
+ /// </devdoc>
+ PrintToFile,
+ /// <include file='doc\PrintAction.uex' path='docs/doc[@for="PrintAction.PrintToPreview"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Printing to a preview.
+ /// </para>
+ /// </devdoc>
+ PrintToPreview,
+ /// <include file='doc\PrintAction.uex' path='docs/doc[@for="PrintAction.PrintToPrinter"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Printing to a printer.
+ /// </para>
+ /// </devdoc>
+ PrintToPrinter
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/PrintController.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/PrintController.cs
new file mode 100644
index 0000000000..1c479222ce
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/PrintController.cs
@@ -0,0 +1,326 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ using System.Diagnostics;
+ using System.Runtime.InteropServices;
+ using System.Security;
+
+ /// <include file='doc\PrintController.uex' path='docs/doc[@for="PrintController"]/*' />
+ /// <devdoc>
+ /// <para>Controls how a document is printed.</para>
+ /// </devdoc>
+ public abstract class PrintController
+ {
+ // DEVMODEs are pretty expensive, so we cache one here and share it with the
+ // Standard and Preview print controllers. If it weren't for all the rules about API changes,
+ // I'd consider making this protected.
+
+ #region SafeDeviceModeHandle Class
+
+ /// <summary>
+ /// Represents a SafeHandle for a Printer's Device Mode struct handle (DEVMODE)
+ /// </summary>
+ /// <SecurityNote>
+ /// Critical: base class SafeHandle is critical
+ /// </SecurityNote>
+ [SecurityCritical]
+ internal sealed class SafeDeviceModeHandle : SafeHandle
+ {
+ // This constructor is used by the P/Invoke marshaling layer
+ // to allocate a SafeHandle instance. P/Invoke then does the
+ // appropriate method call, storing the handle in this class.
+ private SafeDeviceModeHandle() : base(IntPtr.Zero, true) { return; }
+
+ internal SafeDeviceModeHandle(IntPtr handle)
+ : base(IntPtr.Zero, true) // "true" means "owns the handle"
+ {
+ SetHandle(handle);
+ }
+
+ public override bool IsInvalid
+ {
+ get { return handle == IntPtr.Zero; }
+ }
+
+ // Specifies how to free the handle.
+ // The boolean returned should be true for success and false if the runtime
+ // should fire a SafeHandleCriticalFailure MDA (CustomerDebugProbe) if that
+ // MDA is enabled.
+ [SecurityCritical]
+ protected override bool ReleaseHandle()
+ {
+ if (!IsInvalid)
+ {
+ SafeNativeMethods.GlobalFree(new HandleRef(this, handle));
+ }
+ handle = IntPtr.Zero;
+
+ return true;
+ }
+
+ public static implicit operator IntPtr(SafeDeviceModeHandle handle)
+ {
+ return (handle == null) ? IntPtr.Zero : handle.handle;
+ }
+
+ public static explicit operator SafeDeviceModeHandle(IntPtr handle)
+ {
+ return new SafeDeviceModeHandle(handle);
+ }
+ }
+
+ #endregion
+
+ internal SafeDeviceModeHandle modeHandle = null;
+
+ /// <include file='doc\PrintController.uex' path='docs/doc[@for="PrintController.PrintController"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Printing.PrintController'/> class.
+ /// </para>
+ /// </devdoc>
+ protected PrintController()
+ {
+ }
+
+
+ /// <include file='doc\PrintController.uex' path='docs/doc[@for="PrintController.IsPreview"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// This is new public property which notifies if this controller is used for PrintPreview.
+ /// </para>
+ /// </devdoc>
+ public virtual bool IsPreview
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ // WARNING: if you have nested PrintControllers, this method won't get called on the inner one.
+ // Add initialization code to StartPrint or StartPage instead.
+ internal void Print(PrintDocument document)
+ {
+ //
+ // Get the PrintAction for this event
+ PrintAction printAction;
+ if (IsPreview)
+ {
+ printAction = PrintAction.PrintToPreview;
+ }
+ else
+ {
+ printAction = document.PrinterSettings.PrintToFile ? PrintAction.PrintToFile : PrintAction.PrintToPrinter;
+ }
+
+ // Check that user has permission to print to this particular printer
+ PrintEventArgs printEvent = new PrintEventArgs(printAction);
+ document._OnBeginPrint(printEvent);
+ if (printEvent.Cancel)
+ {
+ document._OnEndPrint(printEvent);
+ return;
+ }
+
+ OnStartPrint(document, printEvent);
+ if (printEvent.Cancel)
+ {
+ document._OnEndPrint(printEvent);
+ OnEndPrint(document, printEvent);
+ return;
+ }
+
+ bool canceled = true;
+
+ try
+ {
+ // To enable optimization of the preview dialog, add the following to the config file:
+ // <runtime >
+ // <!-- AppContextSwitchOverrides values are in the form of 'key1=true|false;key2=true|false -->
+ // <AppContextSwitchOverrides value = "Switch.System.Drawing.Printing.OptimizePrintPreview=true" />
+ // </runtime >
+ canceled = LocalAppContextSwitches.OptimizePrintPreview ? PrintLoopOptimized(document) : PrintLoop(document);
+ }
+ finally
+ {
+ try
+ {
+ document._OnEndPrint(printEvent);
+ printEvent.Cancel = canceled | printEvent.Cancel;
+ }
+ finally
+ {
+ OnEndPrint(document, printEvent);
+ }
+ }
+ }
+
+ // Returns true if print was aborted.
+ // WARNING: if you have nested PrintControllers, this method won't get called on the inner one
+ // Add initialization code to StartPrint or StartPage instead.
+ private bool PrintLoop(PrintDocument document)
+ {
+ QueryPageSettingsEventArgs queryEvent = new QueryPageSettingsEventArgs((PageSettings)document.DefaultPageSettings.Clone());
+ for (;;)
+ {
+ document._OnQueryPageSettings(queryEvent);
+ if (queryEvent.Cancel)
+ {
+ return true;
+ }
+
+ PrintPageEventArgs pageEvent = CreatePrintPageEvent(queryEvent.PageSettings);
+ Graphics graphics = OnStartPage(document, pageEvent);
+ pageEvent.SetGraphics(graphics);
+
+ try
+ {
+ document._OnPrintPage(pageEvent);
+ OnEndPage(document, pageEvent);
+ }
+ finally
+ {
+ pageEvent.Dispose();
+ }
+
+ if (pageEvent.Cancel)
+ {
+ return true;
+ }
+ else if (!pageEvent.HasMorePages)
+ {
+ return false;
+ }
+ else
+ {
+ // loop
+ }
+ }
+ }
+
+ private bool PrintLoopOptimized(PrintDocument document)
+ {
+ PrintPageEventArgs pageEvent = null;
+ PageSettings documentPageSettings = (PageSettings)document.DefaultPageSettings.Clone();
+ QueryPageSettingsEventArgs queryEvent = new QueryPageSettingsEventArgs(documentPageSettings);
+ for (;;)
+ {
+ queryEvent.PageSettingsChanged = false;
+ document._OnQueryPageSettings(queryEvent);
+ if (queryEvent.Cancel)
+ {
+ return true;
+ }
+
+ if (!queryEvent.PageSettingsChanged)
+ {
+ // QueryPageSettings event handler did not change the page settings,
+ // thus we use default page settings from the document object.
+ if (pageEvent == null)
+ {
+ pageEvent = CreatePrintPageEvent(queryEvent.PageSettings);
+ }
+ else
+ {
+ // This is not the first page and the settings had not changed since the previous page,
+ // thus don't re-apply them.
+ pageEvent.CopySettingsToDevMode = false;
+ }
+
+ Graphics graphics = OnStartPage(document, pageEvent);
+ pageEvent.SetGraphics(graphics);
+ }
+ else
+ {
+ // Page settings were customized, so use the customized ones in the start page event.
+ pageEvent = CreatePrintPageEvent(queryEvent.PageSettings);
+ Graphics graphics = OnStartPage(document, pageEvent);
+ pageEvent.SetGraphics(graphics);
+ }
+
+ try
+ {
+ document._OnPrintPage(pageEvent);
+ OnEndPage(document, pageEvent);
+ }
+ finally
+ {
+ pageEvent.Graphics.Dispose();
+ pageEvent.SetGraphics(null);
+ }
+
+ if (pageEvent.Cancel)
+ {
+ return true;
+ }
+ else if (!pageEvent.HasMorePages)
+ {
+ return false;
+ }
+ }
+ }
+
+ private PrintPageEventArgs CreatePrintPageEvent(PageSettings pageSettings)
+ {
+ Debug.Assert((modeHandle != null), "modeHandle is null. Someone must have forgot to call base.StartPrint");
+
+
+ Rectangle pageBounds = pageSettings.GetBounds(modeHandle);
+ Rectangle marginBounds = new Rectangle(pageSettings.Margins.Left,
+ pageSettings.Margins.Top,
+ pageBounds.Width - (pageSettings.Margins.Left + pageSettings.Margins.Right),
+ pageBounds.Height - (pageSettings.Margins.Top + pageSettings.Margins.Bottom));
+
+ PrintPageEventArgs pageEvent = new PrintPageEventArgs(null, marginBounds, pageBounds, pageSettings);
+ return pageEvent;
+ }
+
+
+ /// <include file='doc\PrintController.uex' path='docs/doc[@for="PrintController.OnStartPrint"]/*' />
+ /// <devdoc>
+ /// <para>When overridden in a derived class, begins the control sequence of when and how to print a document.</para>
+ /// </devdoc>
+ public virtual void OnStartPrint(PrintDocument document, PrintEventArgs e)
+ {
+ modeHandle = (SafeDeviceModeHandle)document.PrinterSettings.GetHdevmode(document.DefaultPageSettings);
+ }
+
+ /// <include file='doc\PrintController.uex' path='docs/doc[@for="PrintController.OnStartPage"]/*' />
+ /// <devdoc>
+ /// <para>When overridden in a derived class, begins the control
+ /// sequence of when and how to print a page in a document.</para>
+ /// </devdoc>
+ public virtual Graphics OnStartPage(PrintDocument document, PrintPageEventArgs e)
+ {
+ return null;
+ }
+
+ /// <include file='doc\PrintController.uex' path='docs/doc[@for="PrintController.OnEndPage"]/*' />
+ /// <devdoc>
+ /// <para>When overridden in a derived class, completes the control sequence of when and how
+ /// to print a page in a document.</para>
+ /// </devdoc>
+ public virtual void OnEndPage(PrintDocument document, PrintPageEventArgs e)
+ {
+ }
+
+ /// <include file='doc\PrintController.uex' path='docs/doc[@for="PrintController.OnEndPrint"]/*' />
+ /// <devdoc>
+ /// <para>When overridden in a derived class, completes the
+ /// control sequence of when and how to print a document.</para>
+ /// </devdoc>
+ public virtual void OnEndPrint(PrintDocument document, PrintEventArgs e)
+ {
+ Debug.Assert((modeHandle != null), "modeHandle is null. Someone must have forgot to call base.StartPrint");
+ if (modeHandle != null)
+ {
+ modeHandle.Close();
+ }
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/PrintDocument.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/PrintDocument.cs
new file mode 100644
index 0000000000..aa6bd665dd
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/PrintDocument.cs
@@ -0,0 +1,322 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ using System.ComponentModel;
+
+ /// <include file='doc\PrintDocument.uex' path='docs/doc[@for="PrintDocument"]/*' />
+ /// <devdoc>
+ /// <para>Defines a reusable object that sends output to the
+ /// printer.</para>
+ /// </devdoc>
+ [SRDescription(nameof(SR.PrintDocumentDesc))]
+ public class PrintDocument : Component
+ {
+ private string _documentName = "document";
+
+ private PrintEventHandler _beginPrintHandler;
+ private PrintEventHandler _endPrintHandler;
+ private PrintPageEventHandler _printPageHandler;
+ private QueryPageSettingsEventHandler _queryHandler;
+
+ private PrinterSettings _printerSettings = new PrinterSettings();
+ private PageSettings _defaultPageSettings;
+
+ private PrintController _printController;
+
+ private bool _originAtMargins;
+ private bool _userSetPageSettings;
+
+ /// <include file='doc\PrintDocument.uex' path='docs/doc[@for="PrintDocument.PrintDocument"]/*' />
+ /// <devdoc>
+ /// <para>Initializes a new instance of the <see cref='System.Drawing.Printing.PrintDocument'/>
+ /// class.</para>
+ /// </devdoc>
+ public PrintDocument()
+ {
+ _defaultPageSettings = new PageSettings(_printerSettings);
+ }
+
+ /// <include file='doc\PrintDocument.uex' path='docs/doc[@for="PrintDocument.DefaultPageSettings"]/*' />
+ /// <devdoc>
+ /// <para>Gets or sets the
+ /// default
+ /// page settings for the document being printed.</para>
+ /// </devdoc>
+ [
+ Browsable(false),
+ DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden),
+ SRDescription(nameof(SR.PDOCdocumentPageSettingsDescr))
+ ]
+ public PageSettings DefaultPageSettings
+ {
+ get { return _defaultPageSettings; }
+ set
+ {
+ if (value == null)
+ value = new PageSettings();
+ _defaultPageSettings = value;
+ _userSetPageSettings = true;
+ }
+ }
+
+ /// <include file='doc\PrintDocument.uex' path='docs/doc[@for="PrintDocument.DocumentName"]/*' />
+ /// <devdoc>
+ /// <para>Gets or sets the name to display to the user while printing the document;
+ /// for example, in a print status dialog or a printer
+ /// queue.</para>
+ /// </devdoc>
+ [
+ DefaultValue("document"),
+ SRDescription(nameof(SR.PDOCdocumentNameDescr))
+ ]
+ public string DocumentName
+ {
+ get { return _documentName; }
+
+ set
+ {
+ if (value == null)
+ value = "";
+ _documentName = value;
+ }
+ }
+
+ /// <include file='doc\PrintDocument.uex' path='docs/doc[@for="PrintDocument.OriginAtMargins"]/*' />
+ // If true, positions the origin of the graphics object
+ // associated with the page at the point just inside
+ // the user-specified margins of the page.
+ // If false, the graphics origin is at the top-left
+ // corner of the printable area of the page.
+ //
+ [
+ DefaultValue(false),
+ SRDescription(nameof(SR.PDOCoriginAtMarginsDescr))
+ ]
+ public bool OriginAtMargins
+ {
+ get
+ {
+ return _originAtMargins;
+ }
+ set
+ {
+ _originAtMargins = value;
+ }
+ }
+
+ /// <include file='doc\PrintDocument.uex' path='docs/doc[@for="PrintDocument.PrintController"]/*' />
+ /// <devdoc>
+ /// <para>Gets or sets the <see cref='System.Drawing.Printing.PrintController'/>
+ /// that guides the printing process.</para>
+ /// </devdoc>
+ [
+ Browsable(false),
+ DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden),
+ SRDescription(nameof(SR.PDOCprintControllerDescr))
+ ]
+ public PrintController PrintController
+ {
+ get
+ {
+ if (_printController == null)
+ {
+ _printController = new StandardPrintController();
+ }
+ return _printController;
+ }
+ set
+ {
+ _printController = value;
+ }
+ }
+
+ /// <include file='doc\PrintDocument.uex' path='docs/doc[@for="PrintDocument.PrinterSettings"]/*' />
+ /// <devdoc>
+ /// <para> Gets or sets the printer on which the
+ /// document is printed.</para>
+ /// </devdoc>
+ [
+ Browsable(false),
+ DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden),
+ SRDescription(nameof(SR.PDOCprinterSettingsDescr))
+ ]
+ public PrinterSettings PrinterSettings
+ {
+ get { return _printerSettings; }
+ set
+ {
+ if (value == null)
+ value = new PrinterSettings();
+ _printerSettings = value;
+ // reset the PageSettings that match the PrinterSettings only if we have created the defaultPageSettings..
+ if (!_userSetPageSettings)
+ {
+ _defaultPageSettings = _printerSettings.DefaultPageSettings;
+ }
+ }
+ }
+
+ /// <include file='doc\PrintDocument.uex' path='docs/doc[@for="PrintDocument.BeginPrint"]/*' />
+ /// <devdoc>
+ /// <para>Occurs when the <see cref='System.Drawing.Printing.PrintDocument.Print'/> method is called, before
+ /// the
+ /// first page prints.</para>
+ /// </devdoc>
+ [SRDescription(nameof(SR.PDOCbeginPrintDescr))]
+ public event PrintEventHandler BeginPrint
+ {
+ add
+ {
+ _beginPrintHandler += value;
+ }
+ remove
+ {
+ _beginPrintHandler -= value;
+ }
+ }
+
+ /// <include file='doc\PrintDocument.uex' path='docs/doc[@for="PrintDocument.EndPrint"]/*' />
+ /// <devdoc>
+ /// <para>Occurs when <see cref='System.Drawing.Printing.PrintDocument.Print'/> is
+ /// called, after the last page is printed.</para>
+ /// </devdoc>
+ [SRDescription(nameof(SR.PDOCendPrintDescr))]
+ public event PrintEventHandler EndPrint
+ {
+ add
+ {
+ _endPrintHandler += value;
+ }
+ remove
+ {
+ _endPrintHandler -= value;
+ }
+ }
+
+ /// <include file='doc\PrintDocument.uex' path='docs/doc[@for="PrintDocument.PrintPage"]/*' />
+ /// <devdoc>
+ /// <para>Occurs when a page is printed. </para>
+ /// </devdoc>
+ [SRDescription(nameof(SR.PDOCprintPageDescr))]
+ public event PrintPageEventHandler PrintPage
+ {
+ add
+ {
+ _printPageHandler += value;
+ }
+ remove
+ {
+ _printPageHandler -= value;
+ }
+ }
+
+ /// <include file='doc\PrintDocument.uex' path='docs/doc[@for="PrintDocument.QueryPageSettings"]/*' />
+ /// <devdoc>
+ /// <para>Occurs</para>
+ /// </devdoc>
+ [SRDescription(nameof(SR.PDOCqueryPageSettingsDescr))]
+ public event QueryPageSettingsEventHandler QueryPageSettings
+ {
+ add
+ {
+ _queryHandler += value;
+ }
+ remove
+ {
+ _queryHandler -= value;
+ }
+ }
+
+ internal void _OnBeginPrint(PrintEventArgs e)
+ {
+ OnBeginPrint(e);
+ }
+
+ /// <include file='doc\PrintDocument.uex' path='docs/doc[@for="PrintDocument.OnBeginPrint"]/*' />
+ /// <devdoc>
+ /// <para>Raises the <see cref='E:System.Drawing.Printing.PrintDocument.BeginPrint'/>
+ /// event.</para>
+ /// </devdoc>
+ protected virtual void OnBeginPrint(PrintEventArgs e)
+ {
+ if (_beginPrintHandler != null)
+ _beginPrintHandler(this, e);
+ }
+
+ internal void _OnEndPrint(PrintEventArgs e)
+ {
+ OnEndPrint(e);
+ }
+
+ /// <include file='doc\PrintDocument.uex' path='docs/doc[@for="PrintDocument.OnEndPrint"]/*' />
+ /// <devdoc>
+ /// <para>Raises the <see cref='E:System.Drawing.Printing.PrintDocument.EndPrint'/>
+ /// event.</para>
+ /// </devdoc>
+ protected virtual void OnEndPrint(PrintEventArgs e)
+ {
+ if (_endPrintHandler != null)
+ _endPrintHandler(this, e);
+ }
+
+ internal void _OnPrintPage(PrintPageEventArgs e)
+ {
+ OnPrintPage(e);
+ }
+
+ /// <include file='doc\PrintDocument.uex' path='docs/doc[@for="PrintDocument.OnPrintPage"]/*' />
+ /// <devdoc>
+ /// <para>Raises the <see cref='E:System.Drawing.Printing.PrintDocument.PrintPage'/>
+ /// event.</para>
+ /// </devdoc>
+ protected virtual void OnPrintPage(PrintPageEventArgs e)
+ {
+ if (_printPageHandler != null)
+ _printPageHandler(this, e);
+ }
+
+ internal void _OnQueryPageSettings(QueryPageSettingsEventArgs e)
+ {
+ OnQueryPageSettings(e);
+ }
+
+ /// <include file='doc\PrintDocument.uex' path='docs/doc[@for="PrintDocument.OnQueryPageSettings"]/*' />
+ /// <devdoc>
+ /// <para>Raises the <see cref='E:System.Drawing.Printing.PrintDocument.QueryPageSettings'/> event.</para>
+ /// </devdoc>
+ protected virtual void OnQueryPageSettings(QueryPageSettingsEventArgs e)
+ {
+ if (_queryHandler != null)
+ _queryHandler(this, e);
+ }
+
+ /// <include file='doc\PrintDocument.uex' path='docs/doc[@for="PrintDocument.Print"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Prints the document.
+ /// </para>
+ /// </devdoc>
+ public void Print()
+ {
+ PrintController controller = PrintController;
+ controller.Print(this);
+ }
+
+ /// <include file='doc\PrintDocument.uex' path='docs/doc[@for="PrintDocument.ToString"]/*' />
+ /// <internalonly/>
+ /// <devdoc>
+ /// <para>
+ /// Provides some interesting information about the PrintDocument in
+ /// String form.
+ /// </para>
+ /// </devdoc>
+ public override string ToString()
+ {
+ return "[PrintDocument " + DocumentName + "]";
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/PrintEvent.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/PrintEvent.cs
new file mode 100644
index 0000000000..54877745f6
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/PrintEvent.cs
@@ -0,0 +1,54 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ using System.ComponentModel;
+
+ /// <include file='doc\PrintEvent.uex' path='docs/doc[@for="PrintEventArgs"]/*' />
+ /// <devdoc>
+ /// <para>Provides data for the <see cref='E:System.Drawing.Printing.PrintDocument.BeginPrint'/> and
+ /// <see cref='E:System.Drawing.Printing.PrintDocument.EndPrint'/> events.</para>
+ /// </devdoc>
+ public class PrintEventArgs : CancelEventArgs
+ {
+ private PrintAction _printAction;
+
+ /// <include file='doc\PrintEvent.uex' path='docs/doc[@for="PrintEventArgs.PrintEventArgs"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Printing.PrintEventArgs'/> class.
+ /// </para>
+ /// </devdoc>
+ public PrintEventArgs()
+ {
+ }
+
+ /// <include file='doc\PrintEvent.uex' path='docs/doc[@for="PrintEventArgs.PrintEventArgs1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Printing.PrintEventArgs'/> class.
+ /// </para>
+ /// </devdoc>
+ internal PrintEventArgs(PrintAction action)
+ {
+ _printAction = action;
+ }
+
+ /// <include file='doc\PrintEvent.uex' path='docs/doc[@for="PrintEventArgs.PrintAction"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies which <see cref='System.Drawing.Printing.PrintAction'/> is causing this event.
+ /// </para>
+ /// </devdoc>
+ public PrintAction PrintAction
+ {
+ get
+ {
+ return _printAction;
+ }
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/PrintEventHandler.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/PrintEventHandler.cs
new file mode 100644
index 0000000000..62495667c7
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/PrintEventHandler.cs
@@ -0,0 +1,16 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ /// <include file='doc\PrintEventHandler.uex' path='docs/doc[@for="PrintEventHandler"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Represents the method that will handle the <see cref='E:System.Drawing.Printing.PrintDocument.BeginPrint'/>,
+ /// <see cref='E:System.Drawing.Printing.PrintDocument.EndPrint'/>, or <see cref='E:System.Drawing.Printing.PrintDocument.QueryPageSettings'/> event of a <see cref='System.Drawing.Printing.PrintDocument'/>.
+ /// </para>
+ /// </devdoc>
+ public delegate void PrintEventHandler(object sender, PrintEventArgs e);
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/PrintPageEvent.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/PrintPageEvent.cs
new file mode 100644
index 0000000000..e9b65b083f
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/PrintPageEvent.cs
@@ -0,0 +1,134 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ /// <include file='doc\PrintPageEvent.uex' path='docs/doc[@for="PrintPageEventArgs"]/*' />
+ /// <devdoc>
+ /// <para>Provides data for the <see cref='E:System.Drawing.Printing.PrintDocument.PrintPage'/>
+ /// event.</para>
+ /// </devdoc>
+ // NOTE: Please keep this class consistent with PaintEventArgs.
+ public class PrintPageEventArgs : EventArgs
+ {
+ private bool _hasMorePages;
+ private bool _cancel;
+
+ private Graphics _graphics;
+ private readonly Rectangle _marginBounds;
+ private readonly Rectangle _pageBounds;
+ private readonly PageSettings _pageSettings;
+
+ // Apply page settings to the printer.
+ internal bool CopySettingsToDevMode = true;
+
+
+ /// <include file='doc\PrintPageEvent.uex' path='docs/doc[@for="PrintPageEventArgs.PrintPageEventArgs"]/*' />
+ /// <devdoc>
+ /// <para>Initializes a new instance of the <see cref='System.Drawing.Printing.PrintPageEventArgs'/> class.</para>
+ /// </devdoc>
+ public PrintPageEventArgs(Graphics graphics, Rectangle marginBounds, Rectangle pageBounds, PageSettings pageSettings)
+ {
+ _graphics = graphics; // may be null, see PrintController
+ _marginBounds = marginBounds;
+ _pageBounds = pageBounds;
+ _pageSettings = pageSettings;
+ }
+
+ /// <include file='doc\PrintPageEvent.uex' path='docs/doc[@for="PrintPageEventArgs.Cancel"]/*' />
+ /// <devdoc>
+ /// <para>Gets or sets a value indicating whether the print job should be canceled.</para>
+ /// </devdoc>
+ public bool Cancel
+ {
+ get { return _cancel; }
+ set { _cancel = value; }
+ }
+
+ /// <include file='doc\PrintPageEvent.uex' path='docs/doc[@for="PrintPageEventArgs.Graphics"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the <see cref='System.Drawing.Graphics'/>
+ /// used to paint the
+ /// item.
+ /// </para>
+ /// </devdoc>
+ public Graphics Graphics
+ {
+ get
+ {
+ return _graphics;
+ }
+ }
+
+ /// <include file='doc\PrintPageEvent.uex' path='docs/doc[@for="PrintPageEventArgs.HasMorePages"]/*' />
+ /// <devdoc>
+ /// <para> Gets or sets a value indicating whether an additional page should
+ /// be printed.</para>
+ /// </devdoc>
+ public bool HasMorePages
+ {
+ get { return _hasMorePages; }
+ set { _hasMorePages = value; }
+ }
+
+ /// <include file='doc\PrintPageEvent.uex' path='docs/doc[@for="PrintPageEventArgs.MarginBounds"]/*' />
+ /// <devdoc>
+ /// <para>Gets the rectangular area that represents the portion of the page between the margins.</para>
+ /// </devdoc>
+ public Rectangle MarginBounds
+ {
+ get
+ {
+ return _marginBounds;
+ }
+ }
+
+ /// <include file='doc\PrintPageEvent.uex' path='docs/doc[@for="PrintPageEventArgs.PageBounds"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the rectangular area that represents the total area of the page.
+ /// </para>
+ /// </devdoc>
+ public Rectangle PageBounds
+ {
+ get
+ {
+ return _pageBounds;
+ }
+ }
+
+ /// <include file='doc\PrintPageEvent.uex' path='docs/doc[@for="PrintPageEventArgs.PageSettings"]/*' />
+ /// <devdoc>
+ /// <para>Gets
+ /// the page settings for the current page.</para>
+ /// </devdoc>
+ public PageSettings PageSettings
+ {
+ get
+ {
+ return _pageSettings;
+ }
+ }
+
+ /// <include file='doc\PrintPageEvent.uex' path='docs/doc[@for="PrintPageEventArgs.Dispose"]/*' />
+ /// <devdoc>
+ /// <para>Disposes
+ /// of the resources (other than memory) used by
+ /// the <see cref='System.Drawing.Printing.PrintPageEventArgs'/>.</para>
+ /// </devdoc>
+ // We want a way to dispose the GDI+ Graphics, but we don't want to create one
+ // simply to dispose it
+ internal void Dispose()
+ {
+ _graphics.Dispose();
+ }
+
+ internal void SetGraphics(Graphics value)
+ {
+ _graphics = value;
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/PrintPageEventHandler.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/PrintPageEventHandler.cs
new file mode 100644
index 0000000000..06d8716625
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/PrintPageEventHandler.cs
@@ -0,0 +1,14 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ /// <include file='doc\PrintPageEventHandler.uex' path='docs/doc[@for="PrintPageEventHandler"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Represents the method that will handle the <see cref='E:System.Drawing.Printing.PrintDocument.PrintPage'/> event of a <see cref='System.Drawing.Printing.PrintDocument'/>.
+ /// </para>
+ /// </devdoc>
+ public delegate void PrintPageEventHandler(object sender, PrintPageEventArgs e);
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/PrintPreviewGraphics.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/PrintPreviewGraphics.cs
new file mode 100644
index 0000000000..29fb852342
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/PrintPreviewGraphics.cs
@@ -0,0 +1,61 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.Drawing.Internal;
+ using System.Drawing.Printing;
+ using System.Runtime.InteropServices;
+
+ /// <include file='doc\PrintPreviewGraphics.uex' path='docs/doc[@for="PrintPreviewGraphics"]/*' />
+ /// <devdoc>
+ /// <para> Retrives the printer graphics during preview.</para>
+ /// </devdoc>
+ internal class PrintPreviewGraphics
+ {
+ private PrintPageEventArgs _printPageEventArgs;
+ private PrintDocument _printDocument;
+
+ public PrintPreviewGraphics(PrintDocument document, PrintPageEventArgs e)
+ {
+ _printPageEventArgs = e;
+ _printDocument = document;
+ }
+
+ /// <include file='doc\PrintPreviewGraphics.uex' path='docs/doc[@for="PrintPreviewGraphics.VisibleClipBounds"]/*' />
+ /// <devdoc>
+ /// Gets the Visible bounds of this graphics object. Used during print preview.
+ /// </devdoc>
+ public RectangleF VisibleClipBounds
+ {
+ get
+ {
+ IntPtr hdevMode = _printPageEventArgs.PageSettings.PrinterSettings.GetHdevmodeInternal();
+
+ using (DeviceContext dc = _printPageEventArgs.PageSettings.PrinterSettings.CreateDeviceContext(hdevMode))
+ {
+ using (Graphics graphics = Graphics.FromHdcInternal(dc.Hdc))
+ {
+ if (_printDocument.OriginAtMargins)
+ {
+ // Adjust the origin of the graphics object to be at the user-specified margin location
+ // Note: Graphics.FromHdc internally calls SaveDC(hdc), we can still use the saved hdc to get the resolution.
+ int dpiX = UnsafeNativeMethods.GetDeviceCaps(new HandleRef(dc, dc.Hdc), SafeNativeMethods.LOGPIXELSX);
+ int dpiY = UnsafeNativeMethods.GetDeviceCaps(new HandleRef(dc, dc.Hdc), SafeNativeMethods.LOGPIXELSY);
+ int hardMarginX_DU = UnsafeNativeMethods.GetDeviceCaps(new HandleRef(dc, dc.Hdc), SafeNativeMethods.PHYSICALOFFSETX);
+ int hardMarginY_DU = UnsafeNativeMethods.GetDeviceCaps(new HandleRef(dc, dc.Hdc), SafeNativeMethods.PHYSICALOFFSETY);
+ float hardMarginX = hardMarginX_DU * 100 / dpiX;
+ float hardMarginY = hardMarginY_DU * 100 / dpiY;
+
+ graphics.TranslateTransform(-hardMarginX, -hardMarginY);
+ graphics.TranslateTransform(_printDocument.DefaultPageSettings.Margins.Left, _printDocument.DefaultPageSettings.Margins.Top);
+ }
+
+ return graphics.VisibleClipBounds;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/PrintRange.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/PrintRange.cs
new file mode 100644
index 0000000000..9d4c5c28ef
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/PrintRange.cs
@@ -0,0 +1,58 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ /// <include file='doc\PrintRange.uex' path='docs/doc[@for="PrintRange"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies the option buttons in the print dialog box that
+ /// designate the part of the document to print.
+ /// </para>
+ /// </devdoc>
+ [Serializable]
+ public enum PrintRange
+ {
+ /// <include file='doc\PrintRange.uex' path='docs/doc[@for="PrintRange.AllPages"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// All pages are printed.
+ ///
+ /// </para>
+ /// </devdoc>
+ AllPages = SafeNativeMethods.PD_ALLPAGES,
+
+ /// <include file='doc\PrintRange.uex' path='docs/doc[@for="PrintRange.SomePages"]/*' />
+ /// <devdoc>
+ /// <para> The pages between <see cref='System.Drawing.Printing.PrinterSettings.FromPage'/> and
+ /// <see cref='System.Drawing.Printing.PrinterSettings.ToPage'/>
+ /// are
+ /// printed.</para>
+ /// </devdoc>
+ SomePages = SafeNativeMethods.PD_PAGENUMS,
+
+ /// <include file='doc\PrintRange.uex' path='docs/doc[@for="PrintRange.Selection"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// The selected pages are printed.
+ ///
+ /// </para>
+ /// </devdoc>
+ Selection = SafeNativeMethods.PD_SELECTION,
+
+ /// <internalonly/>
+ /// <summary>
+ /// <para>
+ /// The
+ /// current page is printed. The print dialog box requires Windows 2000 or
+ /// later for this setting; if used with an earlier operating system, all pages will be printed.
+ ///
+ /// </para>
+ /// </summary>
+ CurrentPage = SafeNativeMethods.PD_CURRENTPAGE,
+
+ // When adding new members, be sure to update PrintDialog.printRangeMask.
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterResolution.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterResolution.cs
new file mode 100644
index 0000000000..3b97e95f49
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterResolution.cs
@@ -0,0 +1,123 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ using System.ComponentModel;
+ using System.Globalization;
+
+ /// <include file='doc\PrinterResolution.uex' path='docs/doc[@for="PrinterResolution"]/*' />
+ /// <devdoc>
+ /// <para> Retrieves
+ /// the resolution supported by a printer.</para>
+ /// </devdoc>
+ [Serializable]
+ public class PrinterResolution
+ {
+ private int _x;
+ private int _y;
+ private PrinterResolutionKind _kind;
+
+ /// <include file='doc\PrinterResolution.uex' path='docs/doc[@for="PrinterResolution.PrinterResolution"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Printing.PrinterResolution'/> class with default properties.
+ /// This constructor is required for the serialization of the <see cref='System.Drawing.Printing.PrinterResolution'/> class.
+ /// </para>
+ /// </devdoc>
+ public PrinterResolution()
+ {
+ _kind = PrinterResolutionKind.Custom;
+ }
+
+ internal PrinterResolution(PrinterResolutionKind kind, int x, int y)
+ {
+ _kind = kind;
+ _x = x;
+ _y = y;
+ }
+
+ /// <include file='doc\PrinterResolution.uex' path='docs/doc[@for="PrinterResolution.Kind"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets
+ /// a value indicating the kind of printer resolution.
+ /// Setter added to enable serialization of the PrinterSettings object.
+ /// </para>
+ /// </devdoc>
+ public PrinterResolutionKind Kind
+ {
+ get { return _kind; }
+ set
+ {
+ //valid values are 0xfffffffc to 0x0
+ if (!ClientUtils.IsEnumValid(value, unchecked((int)value), unchecked((int)PrinterResolutionKind.High), unchecked((int)PrinterResolutionKind.Custom)))
+ {
+ throw new InvalidEnumArgumentException("value", unchecked((int)value), typeof(PrinterResolutionKind));
+ }
+
+ _kind = value;
+ }
+ }
+
+ /// <include file='doc\PrinterResolution.uex' path='docs/doc[@for="PrinterResolution.X"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the printer resolution in the horizontal direction,
+ /// in dots per inch.
+ /// Setter added to enable serialization of the PrinterSettings object.
+ /// </para>
+ /// </devdoc>
+ public int X
+ {
+ get
+ {
+ return _x;
+ }
+ set
+ {
+ _x = value;
+ }
+ }
+
+ /// <include file='doc\PrinterResolution.uex' path='docs/doc[@for="PrinterResolution.Y"]/*' />
+ /// <devdoc>
+ /// <para> Gets the printer resolution in the vertical direction,
+ /// in dots per inch.
+ /// Setter added to enable serialization of the PrinterSettings object.
+ /// </para>
+ /// </devdoc>
+ public int Y
+ {
+ get
+ {
+ return _y;
+ }
+ set
+ {
+ _y = value;
+ }
+ }
+
+ /// <include file='doc\PrinterResolution.uex' path='docs/doc[@for="PrinterResolution.ToString"]/*' />
+ /// <internalonly/>
+ /// <devdoc>
+ /// <para>
+ /// Provides some interesting information about the PrinterResolution in
+ /// String form.
+ /// </para>
+ /// </devdoc>
+ public override string ToString()
+ {
+ if (_kind != PrinterResolutionKind.Custom)
+ return "[PrinterResolution " + Kind.ToString()
+ + "]";
+ else
+ return "[PrinterResolution"
+ + " X=" + X.ToString(CultureInfo.InvariantCulture)
+ + " Y=" + Y.ToString(CultureInfo.InvariantCulture)
+ + "]";
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterResolutionKind.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterResolutionKind.cs
new file mode 100644
index 0000000000..9a6c62b583
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterResolutionKind.cs
@@ -0,0 +1,55 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ /// <include file='doc\PrinterResolutionKind.uex' path='docs/doc[@for="PrinterResolutionKind"]/*' />
+ /// <devdoc>
+ /// <para>Specifies a printer resolution.</para>
+ /// </devdoc>
+ [Serializable]
+ public enum PrinterResolutionKind
+ {
+ /// <include file='doc\PrinterResolutionKind.uex' path='docs/doc[@for="PrinterResolutionKind.High"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// High resolution.
+ ///
+ /// </para>
+ /// </devdoc>
+ High = SafeNativeMethods.DMRES_HIGH,
+ /// <include file='doc\PrinterResolutionKind.uex' path='docs/doc[@for="PrinterResolutionKind.Medium"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Medium resolution.
+ ///
+ /// </para>
+ /// </devdoc>
+ Medium = SafeNativeMethods.DMRES_MEDIUM,
+ /// <include file='doc\PrinterResolutionKind.uex' path='docs/doc[@for="PrinterResolutionKind.Low"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Low resolution.
+ ///
+ /// </para>
+ /// </devdoc>
+ Low = SafeNativeMethods.DMRES_LOW,
+ /// <include file='doc\PrinterResolutionKind.uex' path='docs/doc[@for="PrinterResolutionKind.Draft"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Draft-quality resolution.
+ ///
+ /// </para>
+ /// </devdoc>
+ Draft = SafeNativeMethods.DMRES_DRAFT,
+ /// <include file='doc\PrinterResolutionKind.uex' path='docs/doc[@for="PrinterResolutionKind.Custom"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Custom resolution.
+ ///
+ /// </para>
+ /// </devdoc>
+ Custom = 0,
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterSettings.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterSettings.cs
new file mode 100644
index 0000000000..7f29125a57
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterSettings.cs
@@ -0,0 +1,2040 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ using System.Collections;
+ using System.ComponentModel;
+ using System.Diagnostics;
+ using System.Drawing.Imaging;
+ using System.Drawing.Internal;
+ using System.Globalization;
+ using System.IO;
+ using System.Runtime.InteropServices;
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings"]/*' />
+ /// <devdoc>
+ /// Information about how a document should be printed, including which printer
+ /// to print it on.
+ /// </devdoc>
+ [Serializable]
+ public class PrinterSettings : ICloneable
+ {
+ // All read/write data is stored in managed code, and whenever we need to call Win32,
+ // we create new DEVMODE and DEVNAMES structures. We don't store device capabilities,
+ // though.
+ //
+ // Also, all properties have hidden tri-state logic -- yes/no/default
+ private const int PADDING_IA64 = 4;
+
+ private string _printerName; // default printer.
+ private string _driverName = "";
+ private string _outputPort = "";
+ private bool _printToFile;
+
+ // Whether the PrintDialog has been shown (not whether it's currently shown). This is how we enforce SafePrinting.
+ private bool _printDialogDisplayed;
+
+ private short _extrabytes;
+ private byte[] _extrainfo;
+
+ private short _copies = -1;
+ private Duplex _duplex = System.Drawing.Printing.Duplex.Default;
+ private TriState _collate = TriState.Default;
+ private PageSettings _defaultPageSettings;
+ private int _fromPage;
+ private int _toPage;
+ private int _maxPage = 9999;
+ private int _minPage;
+ private PrintRange _printRange;
+
+ private short _devmodebytes;
+ private byte[] _cachedDevmode;
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PrinterSettings"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Printing.PrinterSettings'/> class.
+ /// </para>
+ /// </devdoc>
+ public PrinterSettings()
+ {
+ _defaultPageSettings = new PageSettings(this);
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.CanDuplex"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets a value indicating whether the printer supports duplex (double-sided) printing.
+ /// </para>
+ /// </devdoc>
+ public bool CanDuplex
+ {
+ get { return DeviceCapabilities(SafeNativeMethods.DC_DUPLEX, IntPtr.Zero, 0) == 1; }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.Copies"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets the number of copies to print.
+ /// </para>
+ /// </devdoc>
+ public short Copies
+ {
+ get
+ {
+ if (_copies != -1)
+ return _copies;
+ else
+ return GetModeField(ModeField.Copies, 1);
+ }
+ set
+ {
+ if (value < 0)
+ throw new ArgumentException(SR.Format(SR.InvalidLowBoundArgumentEx,
+ "value", value.ToString(CultureInfo.CurrentCulture),
+ (0).ToString(CultureInfo.CurrentCulture)));
+ /*
+ We shouldnt allow copies to be set since the copies can be a large number
+ and can be reflected in PrintDialog. So for the Copies property,
+ we prefer that for SafePrinting, copied cannot be set programmatically
+ but through the print dialog.
+ Any lower security could set copies to anything. Vs Whidbey 93475*/
+ _copies = value;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.Collate"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets
+ /// a value indicating whether the print out is collated.
+ /// </para>
+ /// </devdoc>
+ public bool Collate
+ {
+ get
+ {
+ if (!_collate.IsDefault)
+ return (bool)_collate;
+ else
+ return GetModeField(ModeField.Collate, SafeNativeMethods.DMCOLLATE_FALSE) == SafeNativeMethods.DMCOLLATE_TRUE;
+ }
+ set { _collate = value; }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.DefaultPageSettings"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the default page settings for this printer.
+ /// </para>
+ /// </devdoc>
+ public PageSettings DefaultPageSettings
+ {
+ get { return _defaultPageSettings; }
+ }
+
+ // As far as I can tell, Windows no longer pays attention to driver names and output ports.
+ // But I'm leaving this code in place in case I'm wrong.
+ internal string DriverName
+ {
+ get { return _driverName; }
+ // set { driverName = value;}
+ }
+
+ /* // No point in having a driver version if you can't get the driver name
+ /// <summary>
+ /// <para>
+ /// Gets the printer driver version number.
+ /// </para>
+ /// </summary>
+ /// <value>
+ /// <para>
+ /// The printer driver version number.
+ /// </para>
+ /// </value>
+ public int DriverVersion {
+ get { return DeviceCapabilities(SafeNativeMethods.DC_DRIVER, 0, -1);}
+ }
+ */
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.Duplex"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets the printer's duplex setting.
+ /// </para>
+ /// </devdoc>
+ public Duplex Duplex
+ {
+ get
+ {
+ if (_duplex != Duplex.Default)
+ return _duplex;
+ else
+ return (Duplex)GetModeField(ModeField.Duplex, SafeNativeMethods.DMDUP_SIMPLEX);
+ }
+ set
+ {
+ //valid values are 0xffffffff to 0x3
+ if (!ClientUtils.IsEnumValid(value, unchecked((int)value), unchecked((int)Duplex.Default), unchecked((int)Duplex.Horizontal)))
+ {
+ throw new InvalidEnumArgumentException("value", unchecked((int)value), typeof(Duplex));
+ }
+ _duplex = value;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.FromPage"]/*' />
+ /// <devdoc>
+ /// <para>Gets or sets the first page to print.</para>
+ /// </devdoc>
+ public int FromPage
+ {
+ get { return _fromPage; }
+ set
+ {
+ if (value < 0)
+ throw new ArgumentException(SR.Format(SR.InvalidLowBoundArgumentEx,
+ "value", value.ToString(CultureInfo.CurrentCulture),
+ (0).ToString(CultureInfo.CurrentCulture)));
+ _fromPage = value;
+ }
+ }
+
+
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.InstalledPrinters"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the names of all printers installed on the machine.
+ /// </para>
+ /// </devdoc>
+ public static StringCollection InstalledPrinters
+ {
+ get
+ {
+ int returnCode;
+ int bufferSize;
+ int count;
+ int level, sizeofstruct;
+ // Note: Level 5 doesn't seem to work properly on NT platforms
+ // (atleast the call to get the size of the buffer reqd.),
+ // and Level 4 doesn't work on Win9x.
+ //
+ if (Environment.OSVersion.Platform == System.PlatformID.Win32NT)
+ {
+ level = 4;
+ // PRINTER_INFO_4 are 12 bytes in size
+ if (IntPtr.Size == 8)
+ {
+ sizeofstruct = (IntPtr.Size * 2) + (Marshal.SizeOf(typeof(int)) * 1) + PADDING_IA64;
+ }
+ else
+ {
+ sizeofstruct = (IntPtr.Size * 2) + (Marshal.SizeOf(typeof(int)) * 1);
+ }
+ }
+ else
+ {
+ level = 5;
+ // PRINTER_INFO_5 are 20 bytes in size
+ sizeofstruct = (IntPtr.Size * 2) + (Marshal.SizeOf(typeof(int)) * 3);
+ }
+ string[] array;
+
+ SafeNativeMethods.EnumPrinters(SafeNativeMethods.PRINTER_ENUM_LOCAL | SafeNativeMethods.PRINTER_ENUM_CONNECTIONS, null, level, IntPtr.Zero, 0, out bufferSize, out count);
+
+ IntPtr buffer = Marshal.AllocCoTaskMem(bufferSize);
+ returnCode = SafeNativeMethods.EnumPrinters(SafeNativeMethods.PRINTER_ENUM_LOCAL | SafeNativeMethods.PRINTER_ENUM_CONNECTIONS,
+ null, level, buffer,
+ bufferSize, out bufferSize, out count);
+ array = new string[count];
+
+ if (returnCode == 0)
+ {
+ Marshal.FreeCoTaskMem(buffer);
+ throw new Win32Exception();
+ }
+
+ for (int i = 0; i < count; i++)
+ {
+ // The printer name is at offset 0
+ //
+ IntPtr namePointer = (IntPtr)Marshal.ReadIntPtr((IntPtr)(checked((long)buffer + i * sizeofstruct)));
+ array[i] = Marshal.PtrToStringAuto(namePointer);
+ }
+
+ Marshal.FreeCoTaskMem(buffer);
+
+ return new StringCollection(array);
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.IsDefaultPrinter"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets a value indicating whether the <see cref='System.Drawing.Printing.PrinterSettings.PrinterName'/>
+ /// property designates the default printer.
+ /// </para>
+ /// </devdoc>
+ public bool IsDefaultPrinter
+ {
+ get
+ {
+ return (_printerName == null || _printerName == GetDefaultPrinterName());
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.IsPlotter"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets a value indicating whether the printer is a plotter, as opposed to a raster printer.
+ /// </para>
+ /// </devdoc>
+ public bool IsPlotter
+ {
+ get
+ {
+ return GetDeviceCaps(SafeNativeMethods.TECHNOLOGY, SafeNativeMethods.DT_RASPRINTER) == SafeNativeMethods.DT_PLOTTER;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.IsValid"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets a value indicating whether the <see cref='System.Drawing.Printing.PrinterSettings.PrinterName'/>
+ /// property designates a valid printer.
+ /// </para>
+ /// </devdoc>
+ public bool IsValid
+ {
+ get
+ {
+ return DeviceCapabilities(SafeNativeMethods.DC_COPIES, IntPtr.Zero, -1) != -1;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.LandscapeAngle"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the angle, in degrees, which the portrait orientation is rotated
+ /// to produce the landscape orientation.
+ /// </para>
+ /// </devdoc>
+ public int LandscapeAngle
+ {
+ get { return DeviceCapabilities(SafeNativeMethods.DC_ORIENTATION, IntPtr.Zero, 0); }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.MaximumCopies"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the maximum number of copies allowed by the printer.
+ /// </para>
+ /// </devdoc>
+ public int MaximumCopies
+ {
+ get { return DeviceCapabilities(SafeNativeMethods.DC_COPIES, IntPtr.Zero, 1); }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.MaximumPage"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets the highest <see cref='System.Drawing.Printing.PrinterSettings.FromPage'/> or <see cref='System.Drawing.Printing.PrinterSettings.ToPage'/>
+ /// which may be selected in a print dialog box.
+ /// </para>
+ /// </devdoc>
+ public int MaximumPage
+ {
+ get { return _maxPage; }
+ set
+ {
+ if (value < 0)
+ throw new ArgumentException(SR.Format(SR.InvalidLowBoundArgumentEx,
+ "value", value.ToString(CultureInfo.CurrentCulture),
+ (0).ToString(CultureInfo.CurrentCulture)));
+ _maxPage = value;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.MinimumPage"]/*' />
+ /// <devdoc>
+ /// <para>Gets or sets the lowest <see cref='System.Drawing.Printing.PrinterSettings.FromPage'/> or <see cref='System.Drawing.Printing.PrinterSettings.ToPage'/>
+ /// which may be selected in a print dialog box.</para>
+ /// </devdoc>
+ public int MinimumPage
+ {
+ get { return _minPage; }
+ set
+ {
+ if (value < 0)
+ throw new ArgumentException(SR.Format(SR.InvalidLowBoundArgumentEx,
+ "value", value.ToString(CultureInfo.CurrentCulture),
+ (0).ToString(CultureInfo.CurrentCulture)));
+ _minPage = value;
+ }
+ }
+
+ internal string OutputPort
+ {
+ get
+ {
+ return _outputPort;
+ }
+ set
+ {
+ _outputPort = value;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PrintFileName"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Indicates the name of the printerfile.
+ /// </para>
+ /// </devdoc>
+ public string PrintFileName
+ {
+ get
+ {
+ string printFileName = OutputPort;
+ return printFileName;
+ }
+ set
+ {
+ if (string.IsNullOrEmpty(value))
+ {
+ throw new ArgumentNullException(value);
+ }
+ OutputPort = value;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PaperSizes"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the paper sizes supported by this printer.
+ /// </para>
+ /// </devdoc>
+ public PaperSizeCollection PaperSizes
+ {
+ get { return new PaperSizeCollection(Get_PaperSizes()); }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PaperSources"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the paper sources available on this printer.
+ /// </para>
+ /// </devdoc>
+ public PaperSourceCollection PaperSources
+ {
+ get { return new PaperSourceCollection(Get_PaperSources()); }
+ }
+
+ /// <devdoc>
+ /// <para>
+ /// Whether the print dialog has been displayed. In SafePrinting mode,
+ /// a print dialog is required to print. After printing,
+ /// this property is set to false if the program does not have AllPrinting;
+ /// this guarantees a document is only printed once each time the print dialog is shown.
+ /// </para>
+ /// </devdoc>
+ internal bool PrintDialogDisplayed
+ {
+ get
+ {
+ // no security check
+
+ return _printDialogDisplayed;
+ }
+
+ set
+ {
+ _printDialogDisplayed = value;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PrintRange"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets the pages the user has asked to print.</para>
+ /// </devdoc>
+ public PrintRange PrintRange
+ {
+ get { return _printRange; }
+ set
+ {
+ if (!Enum.IsDefined(typeof(PrintRange), value))
+ throw new InvalidEnumArgumentException("value", unchecked((int)value), typeof(PrintRange));
+
+ _printRange = value;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PrintToFile"]/*' />
+ /// <devdoc>
+ /// Indicates whether to print to a file instead of a port.
+ /// </devdoc>
+ public bool PrintToFile
+ {
+ get
+ {
+ return _printToFile;
+ }
+ set
+ {
+ _printToFile = value;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PrinterName"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets the name of the printer.
+ /// </para>
+ /// </devdoc>
+ public string PrinterName
+ {
+ get
+ {
+ return PrinterNameInternal;
+ }
+
+ set
+ {
+ PrinterNameInternal = value;
+ }
+ }
+
+ private string PrinterNameInternal
+ {
+ get
+ {
+ if (_printerName == null)
+ return GetDefaultPrinterName();
+ else
+ return _printerName;
+ }
+ set
+ {
+ // Reset the DevMode and Extrabytes...
+ _cachedDevmode = null;
+ _extrainfo = null;
+ _printerName = value;
+ // VsWhidbey : 235920: PrinterName can be set through a fulltrusted assembly without using the PrintDialog.
+ // So dont set this variable here.
+ //PrintDialogDisplayed = true;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PrinterResolutions"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the resolutions supported by this printer.
+ /// </para>
+ /// </devdoc>
+ public PrinterResolutionCollection PrinterResolutions
+ {
+ get { return new PrinterResolutionCollection(Get_PrinterResolutions()); }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.IsDirectPrintingSupported"]/*' />
+ /// <devdoc>
+ /// If the image is a JPEG or a PNG (Image.RawFormat) and the printer returns true
+ /// from ExtEscape(CHECKJPEGFORMAT) or ExtEscape(CHECKPNGFORMAT) then this function returns true.
+ /// </devdoc>
+ public bool IsDirectPrintingSupported(ImageFormat imageFormat)
+ {
+ bool isDirectPrintingSupported = false;
+ if (imageFormat.Equals(ImageFormat.Jpeg) || imageFormat.Equals(ImageFormat.Png))
+ {
+ int nEscape = imageFormat.Equals(ImageFormat.Jpeg) ? SafeNativeMethods.CHECKJPEGFORMAT : SafeNativeMethods.CHECKPNGFORMAT;
+ int outData = 0;
+ DeviceContext dc = CreateInformationContext(DefaultPageSettings);
+ HandleRef hdc = new HandleRef(dc, dc.Hdc);
+ try
+ {
+ isDirectPrintingSupported = SafeNativeMethods.ExtEscape(hdc, SafeNativeMethods.QUERYESCSUPPORT, Marshal.SizeOf(typeof(int)), ref nEscape, 0, out outData) > 0;
+ }
+ finally
+ {
+ dc.Dispose();
+ }
+ }
+ return isDirectPrintingSupported;
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.IsDirectPrintingSupported"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// This method utilizes the CHECKJPEGFORMAT/CHECKPNGFORMAT printer escape functions
+ /// to determine whether the printer can handle a JPEG image.
+ /// See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspol_51ys.asp
+ /// for more information on this printer escape function.
+ ///
+ /// If the image is a JPEG or a PNG (Image.RawFormat) and the printer returns true
+ /// from ExtEscape(CHECKJPEGFORMAT) or ExtEscape(CHECKPNGFORMAT) then this function returns true.
+ /// </para>
+ /// </devdoc>
+ public bool IsDirectPrintingSupported(Image image)
+ {
+ bool isDirectPrintingSupported = false;
+ if (image.RawFormat.Equals(ImageFormat.Jpeg) || image.RawFormat.Equals(ImageFormat.Png))
+ {
+ MemoryStream stream = new MemoryStream();
+ try
+ {
+ image.Save(stream, image.RawFormat);
+ stream.Position = 0;
+ using (BufferedStream inStream = new BufferedStream(stream))
+ {
+ int pvImageLen = (int)inStream.Length;
+ byte[] pvImage = new byte[pvImageLen];
+
+ int nRead = inStream.Read(pvImage, 0, (int)pvImageLen);
+
+ int nEscape = image.RawFormat.Equals(ImageFormat.Jpeg) ? SafeNativeMethods.CHECKJPEGFORMAT : SafeNativeMethods.CHECKPNGFORMAT;
+ int outData = 0;
+
+ DeviceContext dc = CreateInformationContext(DefaultPageSettings);
+ HandleRef hdc = new HandleRef(dc, dc.Hdc);
+ try
+ {
+ bool querySupported = SafeNativeMethods.ExtEscape(hdc, SafeNativeMethods.QUERYESCSUPPORT, Marshal.SizeOf(typeof(int)), ref nEscape, 0, out outData) > 0;
+ if (querySupported)
+ {
+ isDirectPrintingSupported = (SafeNativeMethods.ExtEscape(hdc, nEscape, pvImageLen, pvImage, Marshal.SizeOf(typeof(int)), out outData) > 0)
+ && (outData == 1);
+ }
+ }
+ finally
+ {
+ dc.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ stream.Close();
+ }
+ }
+ return isDirectPrintingSupported;
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.SupportsColor"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets a
+ /// value indicating whether the printer supports color printing.
+ /// </para>
+ /// </devdoc>
+ public bool SupportsColor
+ {
+ get
+ {
+ return GetDeviceCaps(SafeNativeMethods.BITSPIXEL, 1) > 1;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.ToPage"]/*' />
+ /// <devdoc>
+ /// Gets or sets the last page to print.
+ /// </devdoc>
+ public int ToPage
+ {
+ get { return _toPage; }
+ set
+ {
+ if (value < 0)
+ throw new ArgumentException(SR.Format(SR.InvalidLowBoundArgumentEx,
+ "value", value.ToString(CultureInfo.CurrentCulture),
+ (0).ToString(CultureInfo.CurrentCulture)));
+ _toPage = value;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.Clone"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Creates an identical copy of this object.
+ /// </para>
+ /// </devdoc>
+ public object Clone()
+ {
+ PrinterSettings clone = (PrinterSettings)MemberwiseClone();
+ clone._printDialogDisplayed = false;
+ return clone;
+ }
+ // what is done in copytohdevmode cannot give unwanted access AllPrinting permission
+ internal DeviceContext CreateDeviceContext(PageSettings pageSettings)
+ {
+ IntPtr modeHandle = GetHdevmodeInternal();
+ DeviceContext dc = null;
+
+ try
+ {
+ //Copy the PageSettings to the DEVMODE...
+ pageSettings.CopyToHdevmode(modeHandle);
+ dc = CreateDeviceContext(modeHandle);
+ }
+ finally
+ {
+ SafeNativeMethods.GlobalFree(new HandleRef(null, modeHandle));
+ }
+ return dc;
+ }
+
+ internal DeviceContext CreateDeviceContext(IntPtr hdevmode)
+ {
+ IntPtr modePointer = SafeNativeMethods.GlobalLock(new HandleRef(null, hdevmode));
+ DeviceContext dc = DeviceContext.CreateDC(DriverName, PrinterNameInternal, (string)null, new HandleRef(null, modePointer));
+ SafeNativeMethods.GlobalUnlock(new HandleRef(null, hdevmode));
+ return dc;
+ }
+
+ // A read-only DC, which is faster than CreateHdc // what is done in copytohdevmode cannot give unwanted access AllPrinting permission
+ internal DeviceContext CreateInformationContext(PageSettings pageSettings)
+ {
+ IntPtr modeHandle = GetHdevmodeInternal();
+ DeviceContext dc;
+
+ try
+ {
+ //Copy the PageSettings to the DEVMODE...
+ pageSettings.CopyToHdevmode(modeHandle);
+ dc = CreateInformationContext(modeHandle);
+ }
+ finally
+ {
+ SafeNativeMethods.GlobalFree(new HandleRef(null, modeHandle));
+ }
+ return dc;
+ }
+
+ // A read-only DC, which is faster than CreateHdc
+ internal DeviceContext CreateInformationContext(IntPtr hdevmode)
+ {
+ IntPtr modePointer = SafeNativeMethods.GlobalLock(new HandleRef(null, hdevmode));
+ DeviceContext dc = DeviceContext.CreateIC(DriverName, PrinterNameInternal, (string)null, new HandleRef(null, modePointer));
+ SafeNativeMethods.GlobalUnlock(new HandleRef(null, hdevmode));
+ return dc;
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.CreateMeasurementGraphics"]/*' />
+ public Graphics CreateMeasurementGraphics()
+ {
+ return CreateMeasurementGraphics(DefaultPageSettings);
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.CreateMeasurementGraphics2"]/*' /> //whatever the call stack calling HardMarginX and HardMarginY here is safe
+ public Graphics CreateMeasurementGraphics(bool honorOriginAtMargins)
+ {
+ Graphics g = CreateMeasurementGraphics();
+ if (g != null && honorOriginAtMargins)
+ {
+ g.TranslateTransform(-_defaultPageSettings.HardMarginX, -_defaultPageSettings.HardMarginY);
+ g.TranslateTransform(_defaultPageSettings.Margins.Left, _defaultPageSettings.Margins.Top);
+ }
+ return g;
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.CreateMeasurementGraphics3"]/*' />
+ public Graphics CreateMeasurementGraphics(PageSettings pageSettings)
+ {
+ // returns the Graphics object for the printer
+ DeviceContext dc = CreateDeviceContext(pageSettings);
+ Graphics g = Graphics.FromHdcInternal(dc.Hdc);
+ g.PrintingHelper = dc; // Graphics will dispose of the DeviceContext.
+ return g;
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.CreateMeasurementGraphics4"]/*' /> //whatever the call stack calling HardMarginX and HardMarginY here is safe
+ public Graphics CreateMeasurementGraphics(PageSettings pageSettings, bool honorOriginAtMargins)
+ {
+ Graphics g = CreateMeasurementGraphics();
+ if (g != null && honorOriginAtMargins)
+ {
+ g.TranslateTransform(-pageSettings.HardMarginX, -pageSettings.HardMarginY);
+ g.TranslateTransform(pageSettings.Margins.Left, pageSettings.Margins.Top);
+ }
+ return g;
+ }
+
+
+ // Create a PRINTDLG with a few useful defaults.
+ // Try to keep this consistent with PrintDialog.CreatePRINTDLG.
+ private static SafeNativeMethods.PRINTDLGX86 CreatePRINTDLGX86()
+ {
+ SafeNativeMethods.PRINTDLGX86 data = new SafeNativeMethods.PRINTDLGX86();
+ data.lStructSize = Marshal.SizeOf(typeof(SafeNativeMethods.PRINTDLGX86));
+ data.hwndOwner = IntPtr.Zero;
+ data.hDevMode = IntPtr.Zero;
+ data.hDevNames = IntPtr.Zero;
+ data.Flags = 0;
+ data.hwndOwner = IntPtr.Zero;
+ data.hDC = IntPtr.Zero;
+ data.nFromPage = 1;
+ data.nToPage = 1;
+ data.nMinPage = 0;
+ data.nMaxPage = 9999;
+ data.nCopies = 1;
+ data.hInstance = IntPtr.Zero;
+ data.lCustData = IntPtr.Zero;
+ data.lpfnPrintHook = IntPtr.Zero;
+ data.lpfnSetupHook = IntPtr.Zero;
+ data.lpPrintTemplateName = null;
+ data.lpSetupTemplateName = null;
+ data.hPrintTemplate = IntPtr.Zero;
+ data.hSetupTemplate = IntPtr.Zero;
+ return data;
+ }
+
+
+ // Create a PRINTDLG with a few useful defaults.
+ // Try to keep this consistent with PrintDialog.CreatePRINTDLG.
+ private static SafeNativeMethods.PRINTDLG CreatePRINTDLG()
+ {
+ SafeNativeMethods.PRINTDLG data = new SafeNativeMethods.PRINTDLG();
+ data.lStructSize = Marshal.SizeOf(typeof(SafeNativeMethods.PRINTDLG));
+ data.hwndOwner = IntPtr.Zero;
+ data.hDevMode = IntPtr.Zero;
+ data.hDevNames = IntPtr.Zero;
+ data.Flags = 0;
+ data.hwndOwner = IntPtr.Zero;
+ data.hDC = IntPtr.Zero;
+ data.nFromPage = 1;
+ data.nToPage = 1;
+ data.nMinPage = 0;
+ data.nMaxPage = 9999;
+ data.nCopies = 1;
+ data.hInstance = IntPtr.Zero;
+ data.lCustData = IntPtr.Zero;
+ data.lpfnPrintHook = IntPtr.Zero;
+ data.lpfnSetupHook = IntPtr.Zero;
+ data.lpPrintTemplateName = null;
+ data.lpSetupTemplateName = null;
+ data.hPrintTemplate = IntPtr.Zero;
+ data.hSetupTemplate = IntPtr.Zero;
+ return data;
+ }
+
+ // Use FastDeviceCapabilities where possible -- computing PrinterName is quite slow
+ private int DeviceCapabilities(short capability, IntPtr pointerToBuffer, int defaultValue)
+ {
+ string printerName = PrinterName;
+ return FastDeviceCapabilities(capability, pointerToBuffer, defaultValue, printerName);
+ }
+
+ // We pass PrinterName in as a parameter rather than computing it ourselves because it's expensive to compute.
+ // We need to pass IntPtr.Zero since passing HDevMode is non-performant.
+ private static int FastDeviceCapabilities(short capability, IntPtr pointerToBuffer, int defaultValue, string printerName)
+ {
+ int result = SafeNativeMethods.DeviceCapabilities(printerName, GetOutputPort(),
+ capability, pointerToBuffer, IntPtr.Zero);
+ if (result == -1)
+ return defaultValue;
+ return result;
+ }
+
+ // Called by get_PrinterName
+ private static string GetDefaultPrinterName()
+ {
+ if (IntPtr.Size == 8)
+ {
+ SafeNativeMethods.PRINTDLG data = CreatePRINTDLG();
+ data.Flags = SafeNativeMethods.PD_RETURNDEFAULT;
+ bool status = SafeNativeMethods.PrintDlg(data);
+
+ if (!status)
+ return SR.Format(SR.NoDefaultPrinter);
+
+ IntPtr handle = data.hDevNames;
+ IntPtr names = SafeNativeMethods.GlobalLock(new HandleRef(data, handle));
+ if (names == IntPtr.Zero)
+ throw new Win32Exception();
+
+ string name = ReadOneDEVNAME(names, 1);
+ SafeNativeMethods.GlobalUnlock(new HandleRef(data, handle));
+ names = IntPtr.Zero;
+
+ // Windows allocates them, but we have to free them
+ SafeNativeMethods.GlobalFree(new HandleRef(data, data.hDevNames));
+ SafeNativeMethods.GlobalFree(new HandleRef(data, data.hDevMode));
+
+ return name;
+ }
+ else
+ {
+ SafeNativeMethods.PRINTDLGX86 data = CreatePRINTDLGX86();
+ data.Flags = SafeNativeMethods.PD_RETURNDEFAULT;
+ bool status = SafeNativeMethods.PrintDlg(data);
+
+ if (!status)
+ return SR.Format(SR.NoDefaultPrinter);
+
+ IntPtr handle = data.hDevNames;
+ IntPtr names = SafeNativeMethods.GlobalLock(new HandleRef(data, handle));
+ if (names == IntPtr.Zero)
+ throw new Win32Exception();
+
+ string name = ReadOneDEVNAME(names, 1);
+ SafeNativeMethods.GlobalUnlock(new HandleRef(data, handle));
+ names = IntPtr.Zero;
+
+ // Windows allocates them, but we have to free them
+ SafeNativeMethods.GlobalFree(new HandleRef(data, data.hDevNames));
+ SafeNativeMethods.GlobalFree(new HandleRef(data, data.hDevMode));
+
+ return name;
+ }
+ }
+
+
+ // Called by get_OutputPort
+ private static string GetOutputPort()
+ {
+ if (IntPtr.Size == 8)
+ {
+ SafeNativeMethods.PRINTDLG data = CreatePRINTDLG();
+ data.Flags = SafeNativeMethods.PD_RETURNDEFAULT;
+ bool status = SafeNativeMethods.PrintDlg(data);
+ if (!status)
+ return SR.Format(SR.NoDefaultPrinter);
+
+ IntPtr handle = data.hDevNames;
+ IntPtr names = SafeNativeMethods.GlobalLock(new HandleRef(data, handle));
+ if (names == IntPtr.Zero)
+ throw new Win32Exception();
+
+ string name = ReadOneDEVNAME(names, 2);
+
+ SafeNativeMethods.GlobalUnlock(new HandleRef(data, handle));
+ names = IntPtr.Zero;
+
+ // Windows allocates them, but we have to free them
+ SafeNativeMethods.GlobalFree(new HandleRef(data, data.hDevNames));
+ SafeNativeMethods.GlobalFree(new HandleRef(data, data.hDevMode));
+
+ return name;
+ }
+ else
+ {
+ SafeNativeMethods.PRINTDLGX86 data = CreatePRINTDLGX86();
+ data.Flags = SafeNativeMethods.PD_RETURNDEFAULT;
+ bool status = SafeNativeMethods.PrintDlg(data);
+
+ if (!status)
+ return SR.Format(SR.NoDefaultPrinter);
+
+ IntPtr handle = data.hDevNames;
+ IntPtr names = SafeNativeMethods.GlobalLock(new HandleRef(data, handle));
+ if (names == IntPtr.Zero)
+ throw new Win32Exception();
+
+ string name = ReadOneDEVNAME(names, 2);
+
+ SafeNativeMethods.GlobalUnlock(new HandleRef(data, handle));
+ names = IntPtr.Zero;
+
+ // Windows allocates them, but we have to free them
+ SafeNativeMethods.GlobalFree(new HandleRef(data, data.hDevNames));
+ SafeNativeMethods.GlobalFree(new HandleRef(data, data.hDevMode));
+
+ return name;
+ }
+ }
+
+ private int GetDeviceCaps(int capability, int defaultValue)
+ {
+ DeviceContext dc = CreateInformationContext(DefaultPageSettings);
+ int result = defaultValue;
+
+ try
+ {
+ result = UnsafeNativeMethods.GetDeviceCaps(new HandleRef(dc, dc.Hdc), capability);
+ }
+ catch (InvalidPrinterException)
+ {
+ // do nothing, will return defaultValue.
+ }
+ finally
+ {
+ dc.Dispose();
+ }
+
+ return result;
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.GetHdevmode"]/*' />
+ /// <devdoc>
+ /// <para>Creates a handle to a DEVMODE structure which correspond too the printer settings.
+ /// When you are done with the handle, you must deallocate it yourself:
+ /// Windows.GlobalFree(handle);
+ /// Where "handle" is the return value from this method.</para>
+ /// </devdoc>
+ public IntPtr GetHdevmode()
+ {
+ // Don't assert unmanaged code -- anyone using handles should have unmanaged code permission
+ IntPtr modeHandle = GetHdevmodeInternal();
+ _defaultPageSettings.CopyToHdevmode(modeHandle);
+ return modeHandle;
+ }
+
+ internal IntPtr GetHdevmodeInternal()
+ {
+ // getting the printer name is quite expensive if PrinterName is left default,
+ // because it needs to figure out what the default printer is
+ return GetHdevmodeInternal(PrinterNameInternal);
+ }
+
+ private IntPtr GetHdevmodeInternal(string printer)
+ {
+ // Create DEVMODE
+ int modeSize = SafeNativeMethods.DocumentProperties(NativeMethods.NullHandleRef, NativeMethods.NullHandleRef, printer, IntPtr.Zero, NativeMethods.NullHandleRef, 0);
+ if (modeSize < 1)
+ {
+ throw new InvalidPrinterException(this);
+ }
+ IntPtr handle = SafeNativeMethods.GlobalAlloc(SafeNativeMethods.GMEM_MOVEABLE, (uint)modeSize); // cannot be <0 anyway
+ IntPtr pointer = SafeNativeMethods.GlobalLock(new HandleRef(null, handle));
+
+ //Get the DevMode only if its not cached....
+ if (_cachedDevmode != null)
+ {
+ Marshal.Copy(_cachedDevmode, 0, pointer, _devmodebytes);
+ }
+ else
+ {
+ int returnCode = SafeNativeMethods.DocumentProperties(NativeMethods.NullHandleRef, NativeMethods.NullHandleRef, printer, pointer, NativeMethods.NullHandleRef, SafeNativeMethods.DM_OUT_BUFFER);
+ if (returnCode < 0)
+ {
+ throw new Win32Exception();
+ }
+ }
+
+ SafeNativeMethods.DEVMODE mode = (SafeNativeMethods.DEVMODE)UnsafeNativeMethods.PtrToStructure(pointer, typeof(SafeNativeMethods.DEVMODE));
+
+
+ if (_extrainfo != null)
+ {
+ // guard against buffer overrun attacks (since design allows client to set a new printer name without updating the devmode)
+ // by checking for a large enough buffer size before copying the extrainfo buffer
+ if (_extrabytes <= mode.dmDriverExtra)
+ {
+ IntPtr pointeroffset = (IntPtr)(checked((long)pointer + (long)mode.dmSize));
+ Marshal.Copy(_extrainfo, 0, pointeroffset, _extrabytes);
+ }
+ }
+ if ((mode.dmFields & SafeNativeMethods.DM_COPIES) == SafeNativeMethods.DM_COPIES)
+ {
+ if (_copies != -1) mode.dmCopies = _copies;
+ }
+
+ if ((mode.dmFields & SafeNativeMethods.DM_DUPLEX) == SafeNativeMethods.DM_DUPLEX)
+ {
+ if (unchecked((int)_duplex) != -1) mode.dmDuplex = unchecked((short)_duplex);
+ }
+
+ if ((mode.dmFields & SafeNativeMethods.DM_COLLATE) == SafeNativeMethods.DM_COLLATE)
+ {
+ if (_collate.IsNotDefault)
+ mode.dmCollate = (short)(((bool)_collate) ? SafeNativeMethods.DMCOLLATE_TRUE : SafeNativeMethods.DMCOLLATE_FALSE);
+ }
+
+ Marshal.StructureToPtr(mode, pointer, false);
+
+ int retCode = SafeNativeMethods.DocumentProperties(NativeMethods.NullHandleRef, NativeMethods.NullHandleRef, printer, pointer, pointer, SafeNativeMethods.DM_IN_BUFFER | SafeNativeMethods.DM_OUT_BUFFER);
+ if (retCode < 0)
+ {
+ SafeNativeMethods.GlobalFree(new HandleRef(null, handle));
+ SafeNativeMethods.GlobalUnlock(new HandleRef(null, handle));
+ return IntPtr.Zero;
+ }
+
+
+ SafeNativeMethods.GlobalUnlock(new HandleRef(null, handle));
+ return handle;
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.GetHdevmode1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Creates a handle to a DEVMODE structure which correspond to the printer
+ /// and page settings.
+ /// When you are done with the handle, you must deallocate it yourself:
+ /// Windows.GlobalFree(handle);
+ /// Where "handle" is the return value from this method.
+ /// </para>
+ /// </devdoc>
+ public IntPtr GetHdevmode(PageSettings pageSettings)
+ {
+ // Don't assert unmanaged code -- anyone using handles should have unmanaged code permission
+ IntPtr modeHandle = GetHdevmodeInternal();
+ pageSettings.CopyToHdevmode(modeHandle);
+
+ return modeHandle;
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.GetHdevnames"]/*' />
+ /// <devdoc>
+ /// Creates a handle to a DEVNAMES structure which correspond to the printer settings.
+ /// When you are done with the handle, you must deallocate it yourself:
+ /// Windows.GlobalFree(handle);
+ /// Where "handle" is the return value from this method.
+ /// </devdoc>
+ public IntPtr GetHdevnames()
+ {
+ // Don't assert unmanaged code -- anyone using handles should have unmanaged code permission
+
+ string printerName = PrinterName; // the PrinterName property is slow when using the default printer
+ string driver = DriverName; // make sure we are writing out exactly the same string as we got the length of
+ string outPort = OutputPort;
+
+ // Create DEVNAMES structure
+ // +4 for null terminator
+ int namesCharacters = checked(4 + printerName.Length + driver.Length + outPort.Length);
+
+ // 8 = size of fixed portion of DEVNAMES
+ short offset = (short)(8 / Marshal.SystemDefaultCharSize); // Offsets are in characters, not bytes
+ uint namesSize = (uint)checked(Marshal.SystemDefaultCharSize * (offset + namesCharacters)); // always >0
+ IntPtr handle = SafeNativeMethods.GlobalAlloc(SafeNativeMethods.GMEM_MOVEABLE | SafeNativeMethods.GMEM_ZEROINIT, namesSize);
+ IntPtr namesPointer = SafeNativeMethods.GlobalLock(new HandleRef(null, handle));
+
+ Marshal.WriteInt16(namesPointer, offset); // wDriverOffset
+ offset += WriteOneDEVNAME(driver, namesPointer, offset);
+ Marshal.WriteInt16((IntPtr)(checked((long)namesPointer + 2)), offset); // wDeviceOffset
+ offset += WriteOneDEVNAME(printerName, namesPointer, offset);
+ Marshal.WriteInt16((IntPtr)(checked((long)namesPointer + 4)), offset); // wOutputOffset
+ offset += WriteOneDEVNAME(outPort, namesPointer, offset);
+ Marshal.WriteInt16((IntPtr)(checked((long)namesPointer + 6)), offset); // wDefault
+
+ SafeNativeMethods.GlobalUnlock(new HandleRef(null, handle));
+ return handle;
+ }
+
+ // Handles creating then disposing a default DEVMODE
+ internal short GetModeField(ModeField field, short defaultValue)
+ {
+ return GetModeField(field, defaultValue, IntPtr.Zero);
+ }
+
+ internal short GetModeField(ModeField field, short defaultValue, IntPtr modeHandle)
+ {
+ bool ownHandle = false;
+ short result;
+ try
+ {
+ if (modeHandle == IntPtr.Zero)
+ {
+ try
+ {
+ modeHandle = GetHdevmodeInternal();
+ ownHandle = true;
+ }
+ catch (InvalidPrinterException)
+ {
+ return defaultValue;
+ }
+ }
+
+ IntPtr modePointer = SafeNativeMethods.GlobalLock(new HandleRef(this, modeHandle));
+ SafeNativeMethods.DEVMODE mode = (SafeNativeMethods.DEVMODE)UnsafeNativeMethods.PtrToStructure(modePointer, typeof(SafeNativeMethods.DEVMODE));
+ switch (field)
+ {
+ case ModeField.Orientation: result = mode.dmOrientation; break;
+ case ModeField.PaperSize: result = mode.dmPaperSize; break;
+ case ModeField.PaperLength: result = mode.dmPaperLength; break;
+ case ModeField.PaperWidth: result = mode.dmPaperWidth; break;
+ case ModeField.Copies: result = mode.dmCopies; break;
+ case ModeField.DefaultSource: result = mode.dmDefaultSource; break;
+ case ModeField.PrintQuality: result = mode.dmPrintQuality; break;
+ case ModeField.Color: result = mode.dmColor; break;
+ case ModeField.Duplex: result = mode.dmDuplex; break;
+ case ModeField.YResolution: result = mode.dmYResolution; break;
+ case ModeField.TTOption: result = mode.dmTTOption; break;
+ case ModeField.Collate: result = mode.dmCollate; break;
+ default:
+ Debug.Fail("Invalid field in GetModeField");
+ result = defaultValue;
+ break;
+ }
+ SafeNativeMethods.GlobalUnlock(new HandleRef(this, modeHandle));
+ }
+ finally
+ {
+ if (ownHandle)
+ {
+ SafeNativeMethods.GlobalFree(new HandleRef(this, modeHandle));
+ }
+ }
+ return result;
+ }
+
+ internal PaperSize[] Get_PaperSizes()
+ {
+ string printerName = PrinterName; // this is quite expensive if PrinterName is left default
+
+ int count = FastDeviceCapabilities(SafeNativeMethods.DC_PAPERNAMES, IntPtr.Zero, -1, printerName);
+ if (count == -1)
+ return new PaperSize[0];
+ int stringSize = Marshal.SystemDefaultCharSize * 64;
+ IntPtr namesBuffer = Marshal.AllocCoTaskMem(checked(stringSize * count));
+ FastDeviceCapabilities(SafeNativeMethods.DC_PAPERNAMES, namesBuffer, -1, printerName);
+
+ Debug.Assert(FastDeviceCapabilities(SafeNativeMethods.DC_PAPERS, IntPtr.Zero, -1, printerName) == count,
+ "Not the same number of paper kinds as paper names?");
+ IntPtr kindsBuffer = Marshal.AllocCoTaskMem(2 * count);
+ FastDeviceCapabilities(SafeNativeMethods.DC_PAPERS, kindsBuffer, -1, printerName);
+
+ Debug.Assert(FastDeviceCapabilities(SafeNativeMethods.DC_PAPERSIZE, IntPtr.Zero, -1, printerName) == count,
+ "Not the same number of paper kinds as paper names?");
+ IntPtr dimensionsBuffer = Marshal.AllocCoTaskMem(8 * count);
+ FastDeviceCapabilities(SafeNativeMethods.DC_PAPERSIZE, dimensionsBuffer, -1, printerName);
+
+ PaperSize[] result = new PaperSize[count];
+ for (int i = 0; i < count; i++)
+ {
+ string name = Marshal.PtrToStringAuto((IntPtr)(checked((long)namesBuffer + stringSize * i)), 64);
+ int index = name.IndexOf('\0');
+ if (index > -1)
+ {
+ name = name.Substring(0, index);
+ }
+ short kind = Marshal.ReadInt16((IntPtr)(checked((long)kindsBuffer + i * 2)));
+ int width = Marshal.ReadInt32((IntPtr)(checked((long)dimensionsBuffer + i * 8)));
+ int height = Marshal.ReadInt32((IntPtr)(checked((long)dimensionsBuffer + i * 8 + 4)));
+ result[i] = new PaperSize((PaperKind)kind, name,
+ PrinterUnitConvert.Convert(width, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display),
+ PrinterUnitConvert.Convert(height, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display));
+ }
+
+ Marshal.FreeCoTaskMem(namesBuffer);
+ Marshal.FreeCoTaskMem(kindsBuffer);
+ Marshal.FreeCoTaskMem(dimensionsBuffer);
+ return result;
+ }
+
+ internal PaperSource[] Get_PaperSources()
+ {
+ string printerName = PrinterName; // this is quite expensive if PrinterName is left default
+
+ int count = FastDeviceCapabilities(SafeNativeMethods.DC_BINNAMES, IntPtr.Zero, -1, printerName);
+ if (count == -1)
+ return new PaperSource[0];
+
+ // Contrary to documentation, DeviceCapabilities returns char[count, 24],
+ // not char[count][24]
+ int stringSize = Marshal.SystemDefaultCharSize * 24;
+ IntPtr namesBuffer = Marshal.AllocCoTaskMem(checked(stringSize * count));
+ FastDeviceCapabilities(SafeNativeMethods.DC_BINNAMES, namesBuffer, -1, printerName);
+
+ Debug.Assert(FastDeviceCapabilities(SafeNativeMethods.DC_BINS, IntPtr.Zero, -1, printerName) == count,
+ "Not the same number of bin kinds as bin names?");
+ IntPtr kindsBuffer = Marshal.AllocCoTaskMem(2 * count);
+ FastDeviceCapabilities(SafeNativeMethods.DC_BINS, kindsBuffer, -1, printerName);
+
+ PaperSource[] result = new PaperSource[count];
+ for (int i = 0; i < count; i++)
+ {
+ string name = Marshal.PtrToStringAuto((IntPtr)(checked((long)namesBuffer + stringSize * i)), 24);
+ int index = name.IndexOf('\0');
+ if (index > -1)
+ {
+ name = name.Substring(0, index);
+ }
+
+ short kind = Marshal.ReadInt16((IntPtr)(checked((long)kindsBuffer + 2 * i)));
+ result[i] = new PaperSource((PaperSourceKind)kind, name);
+ }
+
+ Marshal.FreeCoTaskMem(namesBuffer);
+ Marshal.FreeCoTaskMem(kindsBuffer);
+ return result;
+ }
+
+ internal PrinterResolution[] Get_PrinterResolutions()
+ {
+ string printerName = PrinterName; // this is quite expensive if PrinterName is left default
+ PrinterResolution[] result;
+
+ int count = FastDeviceCapabilities(SafeNativeMethods.DC_ENUMRESOLUTIONS, IntPtr.Zero, -1, printerName);
+ if (count == -1)
+ {
+ //Just return the standrard values if custom resolutions absemt ....
+ result = new PrinterResolution[4];
+ result[0] = new PrinterResolution(PrinterResolutionKind.High, -4, -1);
+ result[1] = new PrinterResolution(PrinterResolutionKind.Medium, -3, -1);
+ result[2] = new PrinterResolution(PrinterResolutionKind.Low, -2, -1);
+ result[3] = new PrinterResolution(PrinterResolutionKind.Draft, -1, -1);
+
+ return result;
+ }
+
+ result = new PrinterResolution[count + 4];
+ result[0] = new PrinterResolution(PrinterResolutionKind.High, -4, -1);
+ result[1] = new PrinterResolution(PrinterResolutionKind.Medium, -3, -1);
+ result[2] = new PrinterResolution(PrinterResolutionKind.Low, -2, -1);
+ result[3] = new PrinterResolution(PrinterResolutionKind.Draft, -1, -1);
+
+ IntPtr buffer = Marshal.AllocCoTaskMem(checked(8 * count));
+ FastDeviceCapabilities(SafeNativeMethods.DC_ENUMRESOLUTIONS, buffer, -1, printerName);
+
+ for (int i = 0; i < count; i++)
+ {
+ int x = Marshal.ReadInt32((IntPtr)(checked((long)buffer + i * 8)));
+ int y = Marshal.ReadInt32((IntPtr)(checked((long)buffer + i * 8 + 4)));
+ result[i + 4] = new PrinterResolution(PrinterResolutionKind.Custom, x, y);
+ }
+
+ Marshal.FreeCoTaskMem(buffer);
+ return result;
+ }
+
+ // names is pointer to DEVNAMES
+ private static String ReadOneDEVNAME(IntPtr pDevnames, int slot)
+ {
+ int offset = checked(Marshal.SystemDefaultCharSize * Marshal.ReadInt16((IntPtr)(checked((long)pDevnames + slot * 2))));
+ string result = Marshal.PtrToStringAuto((IntPtr)(checked((long)pDevnames + offset)));
+ return result;
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.SetHdevmode"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Copies the relevant information out of the handle and into the PrinterSettings.
+ /// </para>
+ /// </devdoc>
+ public void SetHdevmode(IntPtr hdevmode)
+ {
+ if (hdevmode == IntPtr.Zero)
+ throw new ArgumentException(SR.Format(SR.InvalidPrinterHandle, hdevmode));
+
+ IntPtr pointer = SafeNativeMethods.GlobalLock(new HandleRef(null, hdevmode));
+ SafeNativeMethods.DEVMODE mode = (SafeNativeMethods.DEVMODE)UnsafeNativeMethods.PtrToStructure(pointer, typeof(SafeNativeMethods.DEVMODE));
+
+ //Copy entire public devmode as a byte array...
+ _devmodebytes = mode.dmSize;
+ if (_devmodebytes > 0)
+ {
+ _cachedDevmode = new byte[_devmodebytes];
+ Marshal.Copy(pointer, _cachedDevmode, 0, _devmodebytes);
+ }
+
+ //Copy private devmode as a byte array..
+ _extrabytes = mode.dmDriverExtra;
+ if (_extrabytes > 0)
+ {
+ _extrainfo = new byte[_extrabytes];
+ Marshal.Copy((IntPtr)(checked((long)pointer + (long)mode.dmSize)), _extrainfo, 0, _extrabytes);
+ }
+
+ if ((mode.dmFields & SafeNativeMethods.DM_COPIES) == SafeNativeMethods.DM_COPIES)
+ {
+ _copies = mode.dmCopies;
+ }
+
+ if ((mode.dmFields & SafeNativeMethods.DM_DUPLEX) == SafeNativeMethods.DM_DUPLEX)
+ {
+ _duplex = (Duplex)mode.dmDuplex;
+ }
+
+ if ((mode.dmFields & SafeNativeMethods.DM_COLLATE) == SafeNativeMethods.DM_COLLATE)
+ {
+ _collate = (mode.dmCollate == SafeNativeMethods.DMCOLLATE_TRUE);
+ }
+
+ SafeNativeMethods.GlobalUnlock(new HandleRef(null, hdevmode));
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.SetHdevnames"]/*' />
+ /// <devdoc>
+ /// <para>Copies the relevant information out of the handle and into the PrinterSettings.</para>
+ /// </devdoc>
+ public void SetHdevnames(IntPtr hdevnames)
+ {
+ if (hdevnames == IntPtr.Zero)
+ throw new ArgumentException(SR.Format(SR.InvalidPrinterHandle, hdevnames));
+
+ IntPtr namesPointer = SafeNativeMethods.GlobalLock(new HandleRef(null, hdevnames));
+
+ _driverName = ReadOneDEVNAME(namesPointer, 0);
+ _printerName = ReadOneDEVNAME(namesPointer, 1);
+ _outputPort = ReadOneDEVNAME(namesPointer, 2);
+
+ PrintDialogDisplayed = true;
+
+ SafeNativeMethods.GlobalUnlock(new HandleRef(null, hdevnames));
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.ToString"]/*' />
+ /// <internalonly/>
+ /// <devdoc>
+ /// <para>
+ /// Provides some interesting information about the PrinterSettings in
+ /// String form.
+ /// </para>
+ /// </devdoc>
+ public override string ToString()
+ {
+ string printerName = PrinterName;
+ return "[PrinterSettings "
+ + printerName
+ + " Copies=" + Copies.ToString(CultureInfo.InvariantCulture)
+ + " Collate=" + Collate.ToString(CultureInfo.InvariantCulture)
+ // + " DriverName=" + DriverName.ToString(CultureInfo.InvariantCulture)
+ // + " DriverVersion=" + DriverVersion.ToString(CultureInfo.InvariantCulture)
+ + " Duplex=" + Duplex.ToString()
+ + " FromPage=" + FromPage.ToString(CultureInfo.InvariantCulture)
+ + " LandscapeAngle=" + LandscapeAngle.ToString(CultureInfo.InvariantCulture)
+ + " MaximumCopies=" + MaximumCopies.ToString(CultureInfo.InvariantCulture)
+ + " OutputPort=" + OutputPort.ToString(CultureInfo.InvariantCulture)
+ + " ToPage=" + ToPage.ToString(CultureInfo.InvariantCulture)
+ + "]";
+ }
+
+ // Write null terminated string, return length of string in characters (including null)
+ private short WriteOneDEVNAME(string str, IntPtr bufferStart, int index)
+ {
+ if (str == null) str = "";
+ IntPtr address = (IntPtr)(checked((long)bufferStart + index * Marshal.SystemDefaultCharSize));
+
+ if (Marshal.SystemDefaultCharSize == 1)
+ {
+ byte[] bytes = System.Text.Encoding.Default.GetBytes(str);
+ Marshal.Copy(bytes, 0, address, bytes.Length);
+ Marshal.WriteByte(checked((IntPtr)((long)address + bytes.Length)), 0);
+ }
+ else
+ {
+ char[] data = str.ToCharArray();
+ Marshal.Copy(data, 0, address, data.Length);
+ Marshal.WriteInt16((IntPtr)(checked((long)address + data.Length * 2)), 0);
+ }
+
+ return checked((short)(str.Length + 1));
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PaperSizeCollection"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Collection of PaperSize's...
+ /// </para>
+ /// </devdoc>
+ public class PaperSizeCollection : ICollection
+ {
+ private PaperSize[] _array;
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PaperSizeCollection.PaperSizeCollection"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Printing.PrinterSettings.PaperSizeCollection'/> class.
+ /// </para>
+ /// </devdoc>
+ public PaperSizeCollection(PaperSize[] array)
+ {
+ _array = array;
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PaperSizeCollection.Count"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets a value indicating the number of paper sizes.
+ /// </para>
+ /// </devdoc>
+ public int Count
+ {
+ get
+ {
+ return _array.Length;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PaperSizeCollection.this"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Retrieves the PaperSize with the specified index.
+ /// </para>
+ /// </devdoc>
+ public virtual PaperSize this[int index]
+ {
+ get
+ {
+ return _array[index];
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PaperSizeCollection.GetEnumerator"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ public IEnumerator GetEnumerator()
+ {
+ return new ArrayEnumerator(_array, 0, Count);
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PaperSizeCollection.ICollection.Count"]/*' />
+ /// <devdoc>
+ /// ICollection private interface implementation.
+ /// </devdoc>
+ /// <internalonly/>
+ int ICollection.Count
+ {
+ get
+ {
+ return Count;
+ }
+ }
+
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PaperSizeCollection.ICollection.IsSynchronized"]/*' />
+ /// <devdoc>
+ /// ICollection private interface implementation.
+ /// </devdoc>
+ /// <internalonly/>
+ bool ICollection.IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PaperSizeCollection.ICollection.SyncRoot"]/*' />
+ /// <devdoc>
+ /// ICollection private interface implementation.
+ /// </devdoc>
+ /// <internalonly/>
+ object ICollection.SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PaperSizeCollection.ICollection.CopyTo"]/*' />
+ /// <devdoc>
+ /// ICollection private interface implementation.
+ /// </devdoc>
+ /// <internalonly/>
+ void ICollection.CopyTo(Array array, int index)
+ {
+ Array.Copy(_array, index, array, 0, _array.Length);
+ }
+
+ public void CopyTo(PaperSize[] paperSizes, int index)
+ {
+ Array.Copy(_array, index, paperSizes, 0, _array.Length);
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PaperSizeCollection.IEnumerable.GetEnumerator"]/*' />
+ /// <devdoc>
+ /// IEnumerable private interface implementation.
+ /// </devdoc>
+ /// <internalonly/>
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PaperSizeCollection.Add"]/*' />
+ /// <devdoc>
+ /// Empty implementation required for serialization of PrinterSettings object.
+ /// </devdoc>
+ /// <internalonly/>
+ [
+ EditorBrowsable(EditorBrowsableState.Never)
+ ]
+ public Int32 Add(PaperSize paperSize)
+ {
+ PaperSize[] newArray = new PaperSize[Count + 1];
+ ((ICollection)this).CopyTo(newArray, 0);
+ newArray[Count] = paperSize;
+ _array = newArray;
+ return Count;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PaperSourceCollection"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Collection of PaperSource's...
+ /// </para>
+ /// </devdoc>
+ public class PaperSourceCollection : ICollection
+ {
+ private PaperSource[] _array;
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PaperSourceCollection.PaperSourceCollection"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Printing.PrinterSettings.PaperSourceCollection'/> class.
+ /// </para>
+ /// </devdoc>
+ public PaperSourceCollection(PaperSource[] array)
+ {
+ _array = array;
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PaperSourceCollection.Count"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets a value indicating the number of paper sources.
+ /// </para>
+ /// </devdoc>
+ public int Count
+ {
+ get
+ {
+ return _array.Length;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PaperSourceCollection.this"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the PaperSource with the specified index.
+ /// </para>
+ /// </devdoc>
+ public virtual PaperSource this[int index]
+ {
+ get
+ {
+ return _array[index];
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PaperSourceCollection.GetEnumerator"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ /// <devdoc>
+ /// </devdoc>
+ /// <devdoc>
+ /// </devdoc>
+ public IEnumerator GetEnumerator()
+ {
+ return new ArrayEnumerator(_array, 0, Count);
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PaperSourceCollection.ICollection.Count"]/*' />
+ /// <devdoc>
+ /// ICollection private interface implementation.
+ /// </devdoc>
+ /// <internalonly/>
+ int ICollection.Count
+ {
+ get
+ {
+ return Count;
+ }
+ }
+
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PaperSourceCollection.ICollection.IsSynchronized"]/*' />
+ /// <devdoc>
+ /// ICollection private interface implementation.
+ /// </devdoc>
+ /// <internalonly/>
+ bool ICollection.IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PaperSourceCollection.ICollection.SyncRoot"]/*' />
+ /// <devdoc>
+ /// ICollection private interface implementation.
+ /// </devdoc>
+ /// <internalonly/>
+ object ICollection.SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PaperSourceCollection.ICollection.CopyTo"]/*' />
+ /// <devdoc>
+ /// ICollection private interface implementation.
+ /// </devdoc>
+ /// <internalonly/>
+ void ICollection.CopyTo(Array array, int index)
+ {
+ Array.Copy(_array, index, array, 0, _array.Length);
+ }
+
+ public void CopyTo(PaperSource[] paperSources, int index)
+ {
+ Array.Copy(_array, index, paperSources, 0, _array.Length);
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PaperSourceCollection.IEnumerable.GetEnumerator"]/*' />
+ /// <devdoc>
+ /// IEnumerable private interface implementation.
+ /// </devdoc>
+ /// <internalonly/>
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PaperSourceCollection.Add"]/*' />
+ /// <devdoc>
+ /// Empty implementation required for serialization of PrinterSettings object.
+ /// </devdoc>
+ /// <internalonly/>
+ [
+ EditorBrowsable(EditorBrowsableState.Never)
+ ]
+ public Int32 Add(PaperSource paperSource)
+ {
+ PaperSource[] newArray = new PaperSource[Count + 1];
+ ((ICollection)this).CopyTo(newArray, 0);
+ newArray[Count] = paperSource;
+ _array = newArray;
+ return Count;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PrinterResolutionCollection"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Collection of PrinterResolution's...
+ /// </para>
+ /// </devdoc>
+ public class PrinterResolutionCollection : ICollection
+ {
+ private PrinterResolution[] _array;
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PrinterResolutionCollection.PrinterResolutionCollection"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Printing.PrinterSettings.PrinterResolutionCollection'/> class.
+ /// </para>
+ /// </devdoc>
+ public PrinterResolutionCollection(PrinterResolution[] array)
+ {
+ _array = array;
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PrinterResolutionCollection.Count"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets a
+ /// value indicating the number of available printer resolutions.
+ /// </para>
+ /// </devdoc>
+ public int Count
+ {
+ get
+ {
+ return _array.Length;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PrinterResolutionCollection.this"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Retrieves the PrinterResolution with the specified index.
+ /// </para>
+ /// </devdoc>
+ public virtual PrinterResolution this[int index]
+ {
+ get
+ {
+ return _array[index];
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PrinterResolutionCollection.GetEnumerator"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ /// <devdoc>
+ /// </devdoc>
+ /// <devdoc>
+ /// </devdoc>
+ public IEnumerator GetEnumerator()
+ {
+ return new ArrayEnumerator(_array, 0, Count);
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PrinterResolutionCollection.ICollection.Count"]/*' />
+ /// <devdoc>
+ /// ICollection private interface implementation.
+ /// </devdoc>
+ /// <internalonly/>
+ int ICollection.Count
+ {
+ get
+ {
+ return Count;
+ }
+ }
+
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PrinterResolutionCollection.ICollection.IsSynchronized"]/*' />
+ /// <devdoc>
+ /// ICollection private interface implementation.
+ /// </devdoc>
+ /// <internalonly/>
+ bool ICollection.IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PrinterResolutionCollection.ICollection.SyncRoot"]/*' />
+ /// <devdoc>
+ /// ICollection private interface implementation.
+ /// </devdoc>
+ /// <internalonly/>
+ object ICollection.SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterResolutionCollection.ICollection.CopyTo"]/*' />
+ /// <devdoc>
+ /// ICollection private interface implementation.
+ /// </devdoc>
+ /// <internalonly/>
+ void ICollection.CopyTo(Array array, int index)
+ {
+ Array.Copy(_array, index, array, 0, _array.Length);
+ }
+
+ public void CopyTo(PrinterResolution[] printerResolutions, int index)
+ {
+ Array.Copy(_array, index, printerResolutions, 0, _array.Length);
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PrinterResolutionCollection.IEnumerable.GetEnumerator"]/*' />
+ /// <devdoc>
+ /// IEnumerable private interface implementation.
+ /// </devdoc>
+ /// <internalonly/>
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.PrinterResolutionCollection.Add"]/*' />
+ /// <devdoc>
+ /// Empty implementation required for serialization of PrinterSettings object.
+ /// </devdoc>
+ /// <internalonly/>
+ [
+ EditorBrowsable(EditorBrowsableState.Never)
+ ]
+ public Int32 Add(PrinterResolution printerResolution)
+ {
+ PrinterResolution[] newArray = new PrinterResolution[Count + 1];
+ ((ICollection)this).CopyTo(newArray, 0);
+ newArray[Count] = printerResolution;
+ _array = newArray;
+ return Count;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.StringCollection"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Collection of String's...
+ /// </para>
+ /// </devdoc>
+ /// <internalonly/>
+ public class StringCollection : ICollection
+ {
+ private String[] _array;
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.StringCollection.StringCollection"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Printing.PrinterSettings.StringCollection'/> class.
+ /// </para>
+ /// </devdoc>
+ public StringCollection(String[] array)
+ {
+ _array = array;
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.StringCollection.Count"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets a value indicating the number of strings.
+ /// </para>
+ /// </devdoc>
+ public int Count
+ {
+ get
+ {
+ return _array.Length;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.StringCollection.this"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the string with the specified index.
+ /// </para>
+ /// </devdoc>
+ public virtual String this[int index]
+ {
+ get
+ {
+ return _array[index];
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.StringCollection.GetEnumerator"]/*' />
+ /// <devdoc>
+ /// </devdoc>
+ /// <devdoc>
+ /// </devdoc>
+ /// <devdoc>
+ /// </devdoc>
+ public IEnumerator GetEnumerator()
+ {
+ return new ArrayEnumerator(_array, 0, Count);
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.StringCollection.ICollection.Count"]/*' />
+ /// <devdoc>
+ /// ICollection private interface implementation.
+ /// </devdoc>
+ /// <internalonly/>
+ int ICollection.Count
+ {
+ get
+ {
+ return Count;
+ }
+ }
+
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.StringCollection.ICollection.IsSynchronized"]/*' />
+ /// <devdoc>
+ /// ICollection private interface implementation.
+ /// </devdoc>
+ /// <internalonly/>
+ bool ICollection.IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="PrinterSettings.StringCollection.ICollection.SyncRoot"]/*' />
+ /// <devdoc>
+ /// ICollection private interface implementation.
+ /// </devdoc>
+ /// <internalonly/>
+ object ICollection.SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="StringCollection.ICollection.CopyTo"]/*' />
+ /// <devdoc>
+ /// ICollection private interface implementation.
+ /// </devdoc>
+ /// <internalonly/>
+ void ICollection.CopyTo(Array array, int index)
+ {
+ Array.Copy(_array, index, array, 0, _array.Length);
+ }
+
+
+ public void CopyTo(string[] strings, int index)
+ {
+ Array.Copy(_array, index, strings, 0, _array.Length);
+ }
+
+
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="StringCollection.IEnumerable.GetEnumerator"]/*' />
+ /// <devdoc>
+ /// IEnumerable private interface implementation.
+ /// </devdoc>
+ /// <internalonly/>
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+
+ /// <include file='doc\PrinterSettings.uex' path='docs/doc[@for="StringCollection.Add"]/*' />
+ /// <devdoc>
+ /// Empty implementation required for serialization of PrinterSettings object.
+ /// </devdoc>
+ /// <internalonly/>
+ [
+ EditorBrowsable(EditorBrowsableState.Never)
+ ]
+ public Int32 Add(String value)
+ {
+ String[] newArray = new String[Count + 1];
+ ((ICollection)this).CopyTo(newArray, 0);
+ newArray[Count] = value;
+ _array = newArray;
+ return Count;
+ }
+ }
+
+ private class ArrayEnumerator : IEnumerator
+ {
+ private object[] _array;
+ private object _item;
+ private int _index;
+ private int _startIndex;
+ private int _endIndex;
+
+ public ArrayEnumerator(object[] array, int startIndex, int count)
+ {
+ _array = array;
+ _startIndex = startIndex;
+ _endIndex = _index + count;
+
+ _index = _startIndex;
+ }
+
+ public object Current
+ {
+ get
+ {
+ return _item;
+ }
+ }
+
+
+ public bool MoveNext()
+ {
+ if (_index >= _endIndex) return false;
+ _item = _array[_index++];
+ return true;
+ }
+
+ public void Reset()
+ {
+ // Position enumerator before first item
+
+ _index = _startIndex;
+ _item = null;
+ }
+ }
+ }
+}
+
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterUnit.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterUnit.cs
new file mode 100644
index 0000000000..a8ef2bfbc9
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterUnit.cs
@@ -0,0 +1,47 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ /// <include file='doc\PrinterUnit.uex' path='docs/doc[@for="PrinterUnit"]/*' />
+ /// <devdoc>
+ /// <para>Specifies several of
+ /// the units of measure Microsoft Win32 uses for printing.</para>
+ /// </devdoc>
+ public enum PrinterUnit
+ {
+ /// <include file='doc\PrinterUnit.uex' path='docs/doc[@for="PrinterUnit.Display"]/*' />
+ /// <devdoc>
+ /// <para>The default unit (0.01 in.).</para>
+ /// </devdoc>
+ // Our default units, as well as GDI+'s
+ Display = 0,
+
+ /// <include file='doc\PrinterUnit.uex' path='docs/doc[@for="PrinterUnit.ThousandthsOfAnInch"]/*' />
+ /// <devdoc>
+ /// <para>One
+ /// thousandth of an inch
+ /// (0.001 in.).</para>
+ /// </devdoc>
+ // Used by PAGESETUPDLG.rtMargin and rtMinMargin
+ ThousandthsOfAnInch = 1,
+
+ /// <include file='doc\PrinterUnit.uex' path='docs/doc[@for="PrinterUnit.HundredthsOfAMillimeter"]/*' />
+ /// <devdoc>
+ /// <para>One hundredth of a millimeter
+ /// (0.01 mm).</para>
+ /// </devdoc>
+ // Used by PAGESETUPDLG.rtMargin and rtMinMargin
+ HundredthsOfAMillimeter = 2,
+
+ /// <include file='doc\PrinterUnit.uex' path='docs/doc[@for="PrinterUnit.TenthsOfAMillimeter"]/*' />
+ /// <devdoc>
+ /// <para>One tenth of a millimeter
+ /// (0.1 mm).</para>
+ /// </devdoc>
+ // DeviceCapabilities(DC_PAPERSIZE)
+ TenthsOfAMillimeter = 3,
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterUnitConvert.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterUnitConvert.cs
new file mode 100644
index 0000000000..e1b2341dc7
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterUnitConvert.cs
@@ -0,0 +1,136 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ using System.Diagnostics;
+
+ /// <include file='doc\PrinterUnitConvert.uex' path='docs/doc[@for="PrinterUnitConvert"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Specifies a series of conversion methods that are
+ /// useful when interoperating with the raw Win32 printing API.
+ /// This class cannot be inherited.
+ /// </para>
+ /// </devdoc>
+ public sealed class PrinterUnitConvert
+ {
+ private PrinterUnitConvert()
+ {
+ }
+
+ /// <include file='doc\PrinterUnitConvert.uex' path='docs/doc[@for="PrinterUnitConvert.Convert"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Converts the value, in fromUnit units, to toUnit units.
+ /// </para>
+ /// </devdoc>
+ public static double Convert(double value, PrinterUnit fromUnit, PrinterUnit toUnit)
+ {
+ double fromUnitsPerDisplay = UnitsPerDisplay(fromUnit);
+ double toUnitsPerDisplay = UnitsPerDisplay(toUnit);
+ return value * toUnitsPerDisplay / fromUnitsPerDisplay;
+ }
+
+ /// <include file='doc\PrinterUnitConvert.uex' path='docs/doc[@for="PrinterUnitConvert.Convert1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Converts the value, in fromUnit units, to toUnit units.
+ /// </para>
+ /// </devdoc>
+ public static int Convert(int value, PrinterUnit fromUnit, PrinterUnit toUnit)
+ {
+ return (int)Math.Round(Convert((double)value, fromUnit, toUnit));
+ }
+
+ /// <include file='doc\PrinterUnitConvert.uex' path='docs/doc[@for="PrinterUnitConvert.Convert2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Converts the value, in fromUnit units, to toUnit units.
+ /// </para>
+ /// </devdoc>
+ public static Point Convert(Point value, PrinterUnit fromUnit, PrinterUnit toUnit)
+ {
+ return new Point(
+ Convert(value.X, fromUnit, toUnit),
+ Convert(value.Y, fromUnit, toUnit)
+ );
+ }
+
+ /// <include file='doc\PrinterUnitConvert.uex' path='docs/doc[@for="PrinterUnitConvert.Convert3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Converts the value, in fromUnit units, to toUnit units.
+ /// </para>
+ /// </devdoc>
+ public static Size Convert(Size value, PrinterUnit fromUnit, PrinterUnit toUnit)
+ {
+ return new Size(
+ Convert(value.Width, fromUnit, toUnit),
+ Convert(value.Height, fromUnit, toUnit)
+ );
+ }
+
+ /// <include file='doc\PrinterUnitConvert.uex' path='docs/doc[@for="PrinterUnitConvert.Convert4"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Converts the value, in fromUnit units, to toUnit units.
+ /// </para>
+ /// </devdoc>
+ public static Rectangle Convert(Rectangle value, PrinterUnit fromUnit, PrinterUnit toUnit)
+ {
+ return new Rectangle(
+ Convert(value.X, fromUnit, toUnit),
+ Convert(value.Y, fromUnit, toUnit),
+ Convert(value.Width, fromUnit, toUnit),
+ Convert(value.Height, fromUnit, toUnit)
+ );
+ }
+
+ /// <include file='doc\PrinterUnitConvert.uex' path='docs/doc[@for="PrinterUnitConvert.Convert5"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Converts the value, in fromUnit units, to toUnit units.
+ /// </para>
+ /// </devdoc>
+ public static Margins Convert(Margins value, PrinterUnit fromUnit, PrinterUnit toUnit)
+ {
+ Margins result = new Margins();
+
+ result.DoubleLeft = Convert(value.DoubleLeft, fromUnit, toUnit);
+ result.DoubleRight = Convert(value.DoubleRight, fromUnit, toUnit);
+ result.DoubleTop = Convert(value.DoubleTop, fromUnit, toUnit);
+ result.DoubleBottom = Convert(value.DoubleBottom, fromUnit, toUnit);
+
+ return result;
+ }
+
+ private static double UnitsPerDisplay(PrinterUnit unit)
+ {
+ double result;
+ switch (unit)
+ {
+ case PrinterUnit.Display:
+ result = 1.0;
+ break;
+ case PrinterUnit.ThousandthsOfAnInch:
+ result = 10.0;
+ break;
+ case PrinterUnit.HundredthsOfAMillimeter:
+ result = 25.4;
+ break;
+ case PrinterUnit.TenthsOfAMillimeter:
+ result = 2.54;
+ break;
+ default:
+ Debug.Fail("Unknown PrinterUnit " + unit);
+ result = 1.0;
+ break;
+ }
+
+ return result;
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/PrintingPermission.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/PrintingPermission.cs
new file mode 100644
index 0000000000..f20f1b2a93
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/PrintingPermission.cs
@@ -0,0 +1,220 @@
+/*
+ * Copyright (c) 2000 Microsoft Corporation. All Rights Reserved.
+ * Microsoft Confidential.
+ */
+
+namespace System.Drawing.Printing {
+ using System;
+ using System.Security;
+ using System.Security.Permissions;
+ using System.IO;
+ using System.Runtime.Serialization;
+ using System.Reflection;
+ using System.Collections;
+ using System.Globalization;
+ using System.Diagnostics.CodeAnalysis;
+
+ /// <include file='doc\PrintingPermission.uex' path='docs/doc[@for="PrintingPermission"]/*' />
+ /// <devdoc>
+ /// <para> Controls the ability to use the printer. This class cannot be inherited.</para>
+ /// </devdoc>
+ [Serializable]
+ public sealed class PrintingPermission : CodeAccessPermission, IUnrestrictedPermission {
+ private PrintingPermissionLevel printingLevel;
+
+ /// <include file='doc\PrintingPermission.uex' path='docs/doc[@for="PrintingPermission.PrintingPermission"]/*' />
+ /// <devdoc>
+ /// <para>Initializes a new instance of the PrintingPermission class with either fully restricted
+ /// or unrestricted access, as specified.</para>
+ /// </devdoc>
+ public PrintingPermission(PermissionState state) {
+ if (state == PermissionState.Unrestricted) {
+ printingLevel = PrintingPermissionLevel.AllPrinting;
+ }
+ else if (state == PermissionState.None) {
+ printingLevel = PrintingPermissionLevel.NoPrinting;
+ }
+ else {
+ throw new ArgumentException(SR.Format(SR.InvalidPermissionState));
+ }
+ }
+
+ /// <include file='doc\PrintingPermission.uex' path='docs/doc[@for="PrintingPermission.PrintingPermission1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public PrintingPermission(PrintingPermissionLevel printingLevel) {
+ VerifyPrintingLevel(printingLevel);
+
+ this.printingLevel = printingLevel;
+ }
+
+ /// <include file='doc\PrintingPermission.uex' path='docs/doc[@for="PrintingPermission.Level"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public PrintingPermissionLevel Level {
+ get {
+ return printingLevel;
+ }
+
+ set {
+ VerifyPrintingLevel(value);
+ printingLevel = value;
+ }
+ }
+
+ private static void VerifyPrintingLevel(PrintingPermissionLevel level) {
+ if (level < PrintingPermissionLevel.NoPrinting || level > PrintingPermissionLevel.AllPrinting) {
+ throw new ArgumentException(SR.Format(SR.InvalidPermissionLevel));
+ }
+ }
+
+
+ //------------------------------------------------------
+ //
+ // CODEACCESSPERMISSION IMPLEMENTATION
+ //
+ //------------------------------------------------------
+
+ /// <include file='doc\PrintingPermission.uex' path='docs/doc[@for="PrintingPermission.IsUnrestricted"]/*' />
+ /// <devdoc>
+ /// <para> Gets a
+ /// value indicating whether permission is unrestricted.</para>
+ /// </devdoc>
+ public bool IsUnrestricted() {
+ return printingLevel == PrintingPermissionLevel.AllPrinting;
+ }
+
+ //------------------------------------------------------
+ //
+ // IPERMISSION IMPLEMENTATION
+ //
+ //------------------------------------------------------
+
+ /// <include file='doc\PrintingPermission.uex' path='docs/doc[@for="PrintingPermission.IsSubsetOf"]/*' />
+ /// <devdoc>
+ /// <para>Determines whether the current permission object is a subset of
+ /// the specified permission.</para>
+ /// </devdoc>
+ public override bool IsSubsetOf(IPermission target) {
+ if (target == null) {
+ return printingLevel == PrintingPermissionLevel.NoPrinting;
+ }
+
+ PrintingPermission operand = target as PrintingPermission;
+ if(operand == null) {
+ throw new ArgumentException(SR.Format(SR.TargetNotPrintingPermission));
+ }
+ return this.printingLevel <= operand.printingLevel;
+ }
+
+ /// <include file='doc\PrintingPermission.uex' path='docs/doc[@for="PrintingPermission.Intersect"]/*' />
+ /// <devdoc>
+ /// <para>Creates and returns a permission that is the intersection of the current
+ /// permission object and a target permission object.</para>
+ /// </devdoc>
+ public override IPermission Intersect(IPermission target) {
+ if (target == null) {
+ return null;
+ }
+
+ PrintingPermission operand = target as PrintingPermission;
+ if(operand == null) {
+ throw new ArgumentException(SR.Format(SR.TargetNotPrintingPermission));
+ }
+ PrintingPermissionLevel isectLevels = printingLevel < operand.printingLevel ? printingLevel : operand.printingLevel;
+ if (isectLevels == PrintingPermissionLevel.NoPrinting)
+ return null;
+ else
+ return new PrintingPermission(isectLevels);
+ }
+
+ /// <include file='doc\PrintingPermission.uex' path='docs/doc[@for="PrintingPermission.Union"]/*' />
+ /// <devdoc>
+ /// <para>Creates a permission that is the union of the permission object
+ /// and the target parameter permission object.</para>
+ /// </devdoc>
+ public override IPermission Union(IPermission target) {
+ if (target == null) {
+ return this.Copy();
+ }
+
+ PrintingPermission operand = target as PrintingPermission;
+ if(operand == null) {
+ throw new ArgumentException(SR.Format(SR.TargetNotPrintingPermission));
+ }
+ PrintingPermissionLevel isectLevels = printingLevel > operand.printingLevel ? printingLevel : operand.printingLevel;
+ if (isectLevels == PrintingPermissionLevel.NoPrinting)
+ return null;
+ else
+ return new PrintingPermission(isectLevels);
+ }
+
+ /// <include file='doc\PrintingPermission.uex' path='docs/doc[@for="PrintingPermission.Copy"]/*' />
+ /// <devdoc>
+ /// <para>Creates and returns an identical copy of the current permission
+ /// object.</para>
+ /// </devdoc>
+ [SuppressMessage("Microsoft.Security", "CA2103:ReviewImperativeSecurity")]
+ public override IPermission Copy() {
+ return new PrintingPermission(this.printingLevel);
+ }
+
+
+ /// <include file='doc\PrintingPermission.uex' path='docs/doc[@for="PrintingPermission.ToXml"]/*' />
+ /// <devdoc>
+ /// <para>Creates an XML encoding of the security object and its current
+ /// state.</para>
+ /// </devdoc>
+ public override SecurityElement ToXml() {
+ SecurityElement securityElement = new SecurityElement("IPermission");
+
+ securityElement.AddAttribute("class", this.GetType().FullName + ", " + this.GetType().Module.Assembly.FullName.Replace('\"', '\''));
+ securityElement.AddAttribute("version", "1");
+ if (!IsUnrestricted()) {
+ securityElement.AddAttribute("Level", Enum.GetName(typeof(PrintingPermissionLevel), printingLevel));
+ }
+ else {
+ securityElement.AddAttribute("Unrestricted", "true");
+ }
+ return securityElement;
+ }
+
+ /// <include file='doc\PrintingPermission.uex' path='docs/doc[@for="PrintingPermission.FromXml"]/*' />
+ /// <devdoc>
+ /// <para>Reconstructs a security object with a specified state from an XML
+ /// encoding.</para>
+ /// </devdoc>
+ [SuppressMessage("Microsoft.Performance", "CA1808:AvoidCallsThatBoxValueTypes")]
+ public override void FromXml(SecurityElement esd) {
+ if (esd == null) {
+ throw new ArgumentNullException("esd");
+ }
+
+ String className = esd.Attribute("class");
+
+ if (className == null || className.IndexOf(this.GetType().FullName) == -1) {
+ throw new ArgumentException(SR.Format(SR.InvalidClassName));
+ }
+
+ String unrestricted = esd.Attribute("Unrestricted");
+
+ if (unrestricted != null && String.Equals(unrestricted, "true", StringComparison.OrdinalIgnoreCase))
+ {
+ printingLevel = PrintingPermissionLevel.AllPrinting;
+ return;
+ }
+
+ printingLevel = PrintingPermissionLevel.NoPrinting;
+
+ String printing = esd.Attribute("Level");
+
+ if (printing != null)
+ {
+ printingLevel = (PrintingPermissionLevel)Enum.Parse(typeof(PrintingPermissionLevel), printing);
+ }
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/PrintingPermissionAttribute.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/PrintingPermissionAttribute.cs
new file mode 100644
index 0000000000..bef5b5502b
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/PrintingPermissionAttribute.cs
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2000 Microsoft Corporation. All Rights Reserved.
+ * Microsoft Confidential.
+ */
+
+namespace System.Drawing.Printing {
+ using System;
+ using System.Security;
+ using System.Security.Permissions;
+ using System.IO;
+ using System.Runtime.Serialization;
+ using System.Reflection;
+ using System.Collections;
+ using System.Diagnostics.CodeAnalysis;
+
+ /// <include file='doc\PrintingPermissionAttribute.uex' path='docs/doc[@for="PrintingPermissionAttribute"]/*' />
+ [AttributeUsage(AttributeTargets.All, AllowMultiple = true)]
+ public sealed class PrintingPermissionAttribute : CodeAccessSecurityAttribute {
+ PrintingPermissionLevel level;
+
+ /// <include file='doc\PrintingPermissionAttribute.uex' path='docs/doc[@for="PrintingPermissionAttribute.PrintingPermissionAttribute"]/*' />
+ public PrintingPermissionAttribute(SecurityAction action) : base(action) {
+ }
+
+
+ /// <include file='doc\PrintingPermissionAttribute.uex' path='docs/doc[@for="PrintingPermissionAttribute.Level"]/*' />
+ public PrintingPermissionLevel Level {
+ get {
+ return level;
+ }
+
+ set {
+ if (value < PrintingPermissionLevel.NoPrinting || value > PrintingPermissionLevel.AllPrinting) {
+ throw new ArgumentException(SR.Format(SR.PrintingPermissionAttributeInvalidPermissionLevel), "value");
+ }
+ level = value;
+ }
+ }
+
+ /// <include file='doc\PrintingPermissionAttribute.uex' path='docs/doc[@for="PrintingPermissionAttribute.CreatePermission"]/*' />
+ [SuppressMessage("Microsoft.Security", "CA2103:ReviewImperativeSecurity")]
+ public override IPermission CreatePermission() {
+ if (Unrestricted) {
+ return new PrintingPermission(PermissionState.Unrestricted);
+ }
+ else {
+ return new PrintingPermission(level);
+ }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/PrintingPermissionLevel.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/PrintingPermissionLevel.cs
new file mode 100644
index 0000000000..971074cec4
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/PrintingPermissionLevel.cs
@@ -0,0 +1,58 @@
+/*
+ * PrintingPermission.cool
+ *
+ * Copyright (c) 2000 Microsoft Corporation. All Rights Reserved.
+ * Microsoft Confidential.
+ */
+
+namespace System.Drawing.Printing {
+ using System;
+
+ /// <include file='doc\PrintingPermissionLevel.uex' path='docs/doc[@for="PrintingPermissionLevel"]/*' />
+ /// <devdoc>
+ /// <para>Specifies the type of printing that code is allowed to do.</para>
+ /// </devdoc>
+ [Serializable]
+ public enum PrintingPermissionLevel {
+ /**
+ * No printing use allowed at all.
+ */
+ /// <include file='doc\PrintingPermissionLevel.uex' path='docs/doc[@for="PrintingPermissionLevel.NoPrinting"]/*' />
+ /// <devdoc>
+ /// <para>Users have no ability to use any printers.</para>
+ /// </devdoc>
+ NoPrinting = 0x0,
+
+ /**
+ * Only allow safe printing use.
+ */
+ /// <include file='doc\PrintingPermissionLevel.uex' path='docs/doc[@for="PrintingPermissionLevel.SafePrinting"]/*' />
+ /// <devdoc>
+ /// <para>Users can only use safe printing to print from a restricted dialog box.</para>
+ /// </devdoc>
+ SafePrinting = 0x01,
+
+ /**
+ * Use of the default printer allowed.
+ */
+ /// <include file='doc\PrintingPermissionLevel.uex' path='docs/doc[@for="PrintingPermissionLevel.DefaultPrinting"]/*' />
+ /// <devdoc>
+ /// <para>Users can print programmically to the default printer along with safe printing through
+ /// a less restricted dialog box.</para>
+ /// </devdoc>
+ DefaultPrinting = 0x02,
+
+ /**
+ * All windows and all event may be used.
+ */
+ /// <include file='doc\PrintingPermissionLevel.uex' path='docs/doc[@for="PrintingPermissionLevel.AllPrinting"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Users have full access to all printers on the network.
+ /// </para>
+ /// </devdoc>
+ AllPrinting = 0x03,
+
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/QueryPageSettingsEventArgs.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/QueryPageSettingsEventArgs.cs
new file mode 100644
index 0000000000..dabe532ec6
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/QueryPageSettingsEventArgs.cs
@@ -0,0 +1,61 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ /// <include file='doc\QueryPageSettingsEventArgs.uex' path='docs/doc[@for="QueryPageSettingsEventArgs"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Provides data for the <see cref='E:System.Drawing.Printing.PrintDocument.QueryPageSettings'/> event.
+ /// </para>
+ /// </devdoc>
+ public class QueryPageSettingsEventArgs : PrintEventArgs
+ {
+ private PageSettings _pageSettings;
+
+ /// <summary>
+ /// It's too expensive to compare 2 instances of PageSettings class, as the getters
+ /// are accessing the printer spooler, thus we track any explicit invocations of the setters or getters on this class,
+ /// and this field tracks if PageSettings property was accessed. It will return a false
+ /// positive when the user is reading property values, but we'll take a perf hit in this case assuming this event is not
+ /// used often.
+ internal bool PageSettingsChanged;
+
+ /// <include file='doc\QueryPageSettingsEventArgs.uex' path='docs/doc[@for="QueryPageSettingsEventArgs.QueryPageSettingsEventArgs"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Printing.QueryPageSettingsEventArgs'/> class.
+ /// </para>
+ /// </devdoc>
+ public QueryPageSettingsEventArgs(PageSettings pageSettings) : base()
+ {
+ _pageSettings = pageSettings;
+ }
+
+ /// <include file='doc\QueryPageSettingsEventArgs.uex' path='docs/doc[@for="QueryPageSettingsEventArgs.PageSettings"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets or sets the page settings for the page to be printed.
+ /// </para>
+ /// </devdoc>
+ public PageSettings PageSettings
+ {
+ get
+ {
+ PageSettingsChanged = true;
+ return _pageSettings;
+ }
+ set
+ {
+ if (value == null)
+ {
+ value = new PageSettings();
+ }
+ _pageSettings = value;
+ PageSettingsChanged = true;
+ }
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/QueryPageSettingsEventHandler.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/QueryPageSettingsEventHandler.cs
new file mode 100644
index 0000000000..ac090af5d2
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/QueryPageSettingsEventHandler.cs
@@ -0,0 +1,14 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ /// <include file='doc\QueryPageSettingsEventHandler.uex' path='docs/doc[@for="QueryPageSettingsEventHandler"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Represents the method that will handle the <see cref='E:System.Drawing.Printing.PrintDocument.QueryPageSettings'/> event of a <see cref='System.Drawing.Printing.PrintDocument'/>.
+ /// </para>
+ /// </devdoc>
+ public delegate void QueryPageSettingsEventHandler(object sender, QueryPageSettingsEventArgs e);
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/TriState.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/TriState.cs
new file mode 100644
index 0000000000..16b8148c3a
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Printing/TriState.cs
@@ -0,0 +1,91 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Printing
+{
+ [Serializable]
+ internal struct TriState
+ {
+ private byte _value; // 0 is "default", not false
+
+ public static readonly TriState Default = new TriState(0);
+ public static readonly TriState False = new TriState(1);
+ public static readonly TriState True = new TriState(2);
+
+ private TriState(byte value)
+ {
+ _value = value;
+ }
+
+ public bool IsDefault
+ {
+ get { return this == Default; }
+ }
+
+ public bool IsFalse
+ {
+ get { return this == False; }
+ }
+
+ public bool IsNotDefault
+ {
+ get { return this != Default; }
+ }
+
+ public bool IsTrue
+ {
+ get { return this == True; }
+ }
+
+ public static bool operator ==(TriState left, TriState right)
+ {
+ return left._value == right._value;
+ }
+
+ public static bool operator !=(TriState left, TriState right)
+ {
+ return !(left == right);
+ }
+
+ public override bool Equals(object o)
+ {
+ TriState state = (TriState)o;
+ return _value == state._value;
+ }
+
+ public override int GetHashCode()
+ {
+ return _value;
+ }
+
+ public static implicit operator TriState(bool value)
+ {
+ return (value) ? True : False;
+ }
+
+ public static explicit operator bool (TriState value)
+ {
+ if (value.IsDefault)
+ throw new InvalidCastException(SR.Format(SR.TriStateCompareError));
+ else
+ return (value == TriState.True);
+ }
+
+ /// <include file='doc\TriState.uex' path='docs/doc[@for="TriState.ToString"]/*' />
+ /// <internalonly/>
+ /// <devdoc>
+ /// <para>
+ /// Provides some interesting information about the TriState in
+ /// String form.
+ /// </para>
+ /// </devdoc>
+ public override string ToString()
+ {
+ if (this == Default) return "Default";
+ else if (this == False) return "False";
+ else return "True";
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/PropertyItemInternal.cs b/src/System.Drawing.Common/src/System/Drawing/PropertyItemInternal.cs
new file mode 100644
index 0000000000..39e58f5edb
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/PropertyItemInternal.cs
@@ -0,0 +1,121 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Imaging
+{
+ using System.Runtime.InteropServices;
+
+ // sdkinc\imaging.h
+ [StructLayout(LayoutKind.Sequential)]
+ internal sealed class PropertyItemInternal : IDisposable
+ {
+ public int id;
+ public int len;
+ public short type;
+ public IntPtr value = IntPtr.Zero;
+
+ internal PropertyItemInternal()
+ {
+ }
+
+ ~PropertyItemInternal()
+ {
+ Dispose(false);
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+
+ private void Dispose(bool disposing)
+ {
+ if (value != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(value);
+ value = IntPtr.Zero;
+ }
+
+ if (disposing)
+ {
+ GC.SuppressFinalize(this);
+ }
+ }
+
+ internal static PropertyItemInternal ConvertFromPropertyItem(PropertyItem propItem)
+ {
+ PropertyItemInternal propItemInternal = new PropertyItemInternal();
+ propItemInternal.id = propItem.Id;
+ propItemInternal.len = 0;
+ propItemInternal.type = propItem.Type;
+
+ byte[] propItemValue = propItem.Value;
+ if (propItemValue != null)
+ {
+ int length = propItemValue.Length;
+ propItemInternal.len = length;
+ propItemInternal.value = Marshal.AllocHGlobal(length);
+ Marshal.Copy(propItemValue, 0, propItemInternal.value, length);
+ }
+
+ return propItemInternal;
+ }
+
+ internal static PropertyItem[] ConvertFromMemory(IntPtr propdata, int count)
+ {
+ PropertyItem[] props = new PropertyItem[count];
+
+ for (int i = 0; i < count; i++)
+ {
+ PropertyItemInternal propcopy = null;
+ try
+ {
+ propcopy = (PropertyItemInternal)UnsafeNativeMethods.PtrToStructure(propdata,
+ typeof(PropertyItemInternal));
+
+ props[i] = new PropertyItem();
+ props[i].Id = propcopy.id;
+ props[i].Len = propcopy.len;
+ props[i].Type = propcopy.type;
+
+ // this calls Marshal.Copy and creates a copy of the original memory into a byte array.
+ props[i].Value = propcopy.Value;
+
+ propcopy.value = IntPtr.Zero; // we dont actually own this memory so dont free it.
+ }
+ finally
+ {
+ if (propcopy != null)
+ {
+ propcopy.Dispose();
+ }
+ }
+
+ propdata = (IntPtr)((long)propdata + (int)Marshal.SizeOf(typeof(PropertyItemInternal)));
+ }
+
+ return props;
+ }
+
+ public byte[] Value
+ {
+ get
+ {
+ if (len == 0)
+ {
+ return null;
+ }
+
+ byte[] bytes = new byte[len];
+
+ Marshal.Copy(value,
+ bytes,
+ 0,
+ (int)len);
+ return bytes;
+ }
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/RectangleConverter.cs b/src/System.Drawing.Common/src/System/Drawing/RectangleConverter.cs
new file mode 100644
index 0000000000..32746ca795
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/RectangleConverter.cs
@@ -0,0 +1,209 @@
+//------------------------------------------------------------------------------
+// <copyright file="RectangleConverter.cs" company="Microsoft">
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// </copyright>
+//------------------------------------------------------------------------------
+
+/*
+ */
+namespace System.Drawing {
+ using System.Runtime.Serialization.Formatters;
+ using System.Runtime.InteropServices;
+
+ using System.Diagnostics;
+ using System.Diagnostics.CodeAnalysis;
+
+ using Microsoft.Win32;
+ using System.Collections;
+ using System.ComponentModel;
+ using System.ComponentModel.Design.Serialization;
+ using System.Globalization;
+ using System.Reflection;
+
+ /// <include file='doc\RectangleConverter.uex' path='docs/doc[@for="RectangleConverter"]/*' />
+ /// <devdoc>
+ /// RectangleConverter is a class that can be used to convert
+ /// rectangles from one data type to another. Access this
+ /// class through the TypeDescriptor.
+ /// </devdoc>
+ public class RectangleConverter : TypeConverter {
+
+ /// <include file='doc\RectangleConverter.uex' path='docs/doc[@for="RectangleConverter.CanConvertFrom"]/*' />
+ /// <devdoc>
+ /// Determines if this converter can convert an object in the given source
+ /// type to the native type of the converter.
+ /// </devdoc>
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) {
+ if (sourceType == typeof(string)) {
+ return true;
+ }
+ return base.CanConvertFrom(context, sourceType);
+ }
+
+ /// <include file='doc\RectangleConverter.uex' path='docs/doc[@for="RectangleConverter.CanConvertTo"]/*' />
+ /// <devdoc>
+ /// <para>Gets a value indicating whether this converter can
+ /// convert an object to the given destination type using the context.</para>
+ /// </devdoc>
+ public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {
+ if (destinationType == typeof(InstanceDescriptor)) {
+ return true;
+ }
+ return base.CanConvertTo(context, destinationType);
+ }
+
+ /// <include file='doc\RectangleConverter.uex' path='docs/doc[@for="RectangleConverter.ConvertFrom"]/*' />
+ /// <devdoc>
+ /// Converts the given object to the converter's native type.
+ /// </devdoc>
+ [SuppressMessage("Microsoft.Performance", "CA1808:AvoidCallsThatBoxValueTypes")]
+ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) {
+
+ string strValue = value as string;
+
+ if (strValue != null) {
+
+ string text = strValue.Trim();
+
+ if (text.Length == 0) {
+ return null;
+ }
+ else {
+
+ // Parse 4 integer values.
+ //
+ if (culture == null) {
+ culture = CultureInfo.CurrentCulture;
+ }
+ char sep = culture.TextInfo.ListSeparator[0];
+ string[] tokens = text.Split(new char[] {sep});
+ int[] values = new int[tokens.Length];
+ TypeConverter intConverter = TypeDescriptor.GetConverter(typeof(int));
+ for (int i = 0; i < values.Length; i++) {
+ // Note: ConvertFromString will raise exception if value cannot be converted.
+ values[i] = (int)intConverter.ConvertFromString(context, culture, tokens[i]);
+ }
+
+ if (values.Length == 4) {
+ return new Rectangle(values[0], values[1], values[2], values[3]);
+ }
+ else {
+ throw new ArgumentException(SR.Format(SR.TextParseFailedFormat,
+ "text",
+ text,
+ "x, y, width, height"));
+ }
+ }
+ }
+
+ return base.ConvertFrom(context, culture, value);
+ }
+
+ /// <include file='doc\RectangleConverter.uex' path='docs/doc[@for="RectangleConverter.ConvertTo"]/*' />
+ /// <devdoc>
+ /// Converts the given object to another type. The most common types to convert
+ /// are to and from a string object. The default implementation will make a call
+ /// to ToString on the object if the object is valid and if the destination
+ /// type is string. If this cannot convert to the desitnation type, this will
+ /// throw a NotSupportedException.
+ /// </devdoc>
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) {
+ if (destinationType == null) {
+ throw new ArgumentNullException("destinationType");
+ }
+
+ if( value is Rectangle ){
+ if (destinationType == typeof(string)) {
+ Rectangle rect = (Rectangle)value;
+
+ if (culture == null) {
+ culture = CultureInfo.CurrentCulture;
+ }
+ string sep = culture.TextInfo.ListSeparator + " ";
+ TypeConverter intConverter = TypeDescriptor.GetConverter(typeof(int));
+ string[] args = new string[4];
+ int nArg = 0;
+
+ // Note: ConvertToString will raise exception if value cannot be converted.
+ args[nArg++] = intConverter.ConvertToString(context, culture, rect.X);
+ args[nArg++] = intConverter.ConvertToString(context, culture, rect.Y);
+ args[nArg++] = intConverter.ConvertToString(context, culture, rect.Width);
+ args[nArg++] = intConverter.ConvertToString(context, culture, rect.Height);
+
+ return string.Join(sep, args);
+ }
+ if (destinationType == typeof(InstanceDescriptor)) {
+ Rectangle rect = (Rectangle)value;
+ ConstructorInfo ctor = typeof(Rectangle).GetConstructor(new Type[] {
+ typeof(int), typeof(int), typeof(int), typeof(int)});
+
+ if (ctor != null) {
+ return new InstanceDescriptor(ctor, new object[] {
+ rect.X, rect.Y, rect.Width, rect.Height});
+ }
+ }
+ }
+
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+
+ /// <include file='doc\RectangleConverter.uex' path='docs/doc[@for="RectangleConverter.CreateInstance"]/*' />
+ /// <devdoc>
+ /// Creates an instance of this type given a set of property values
+ /// for the object. This is useful for objects that are immutable, but still
+ /// want to provide changable properties.
+ /// </devdoc>
+ [SuppressMessage("Microsoft.Performance", "CA1808:AvoidCallsThatBoxValueTypes")]
+ [SuppressMessage("Microsoft.Security", "CA2102:CatchNonClsCompliantExceptionsInGeneralHandlers")]
+ public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues) {
+ if( propertyValues == null ){
+ throw new ArgumentNullException( "propertyValues" );
+ }
+
+ object x = propertyValues["X"];
+ object y = propertyValues["Y"];
+ object width = propertyValues["Width"];
+ object height = propertyValues["Height"];
+
+ if(x == null || y == null || width == null || height == null ||
+ !(x is int) || !(y is int) || !(width is int) || !(height is int) ) {
+ throw new ArgumentException(SR.Format(SR.PropertyValueInvalidEntry));
+ }
+ return new Rectangle((int)x,
+ (int)y,
+ (int)width,
+ (int)height);
+ }
+
+ /// <include file='doc\RectangleConverter.uex' path='docs/doc[@for="RectangleConverter.GetCreateInstanceSupported"]/*' />
+ /// <devdoc>
+ /// Determines if changing a value on this object should require a call to
+ /// CreateInstance to create a new value.
+ /// </devdoc>
+ public override bool GetCreateInstanceSupported(ITypeDescriptorContext context) {
+ return true;
+ }
+
+ /// <include file='doc\RectangleConverter.uex' path='docs/doc[@for="RectangleConverter.GetProperties"]/*' />
+ /// <devdoc>
+ /// Retrieves the set of properties for this type. By default, a type has
+ /// does not return any properties. An easy implementation of this method
+ /// can just call TypeDescriptor.GetProperties for the correct data type.
+ /// </devdoc>
+ public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) {
+ PropertyDescriptorCollection props = TypeDescriptor.GetProperties(typeof(Rectangle), attributes);
+ return props.Sort(new string[] {"X", "Y", "Width", "Height"});
+ }
+
+ /// <include file='doc\RectangleConverter.uex' path='docs/doc[@for="RectangleConverter.GetPropertiesSupported"]/*' />
+ /// <devdoc>
+ /// Determines if this object supports properties. By default, this
+ /// is false.
+ /// </devdoc>
+ public override bool GetPropertiesSupported(ITypeDescriptorContext context) {
+ return true;
+ }
+
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/Region.cs b/src/System.Drawing.Common/src/System/Drawing/Region.cs
new file mode 100644
index 0000000000..ae4acc8807
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/Region.cs
@@ -0,0 +1,1079 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.Diagnostics;
+ using System.Drawing.Drawing2D;
+ using System.Drawing.Internal;
+ using System.Globalization;
+ using System.Runtime.InteropServices;
+
+ /**
+ * Represent a Region object
+ */
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Describes the interior of a graphics shape
+ /// composed of rectangles and paths.
+ /// </para>
+ /// </devdoc>
+ public sealed class Region : MarshalByRefObject, IDisposable
+ {
+#if FINALIZATION_WATCH
+ private string allocationSite = Graphics.GetAllocationStack();
+#endif
+
+ /**
+ * Construct a new region object
+ */
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Region"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Region'/> class.
+ /// </para>
+ /// </devdoc>
+ public Region()
+ {
+ IntPtr region = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateRegion(out region);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeRegion(region);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Region1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Region'/> class from the specified <see cref='System.Drawing.RectangleF'/> .
+ /// </para>
+ /// </devdoc>
+ public Region(RectangleF rect)
+ {
+ IntPtr region = IntPtr.Zero;
+
+ GPRECTF gprectf = rect.ToGPRECTF();
+
+ int status = SafeNativeMethods.Gdip.GdipCreateRegionRect(ref gprectf, out region);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeRegion(region);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Region2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Region'/> class from the specified <see cref='System.Drawing.Rectangle'/>.
+ /// </para>
+ /// </devdoc>
+ public Region(Rectangle rect)
+ {
+ IntPtr region = IntPtr.Zero;
+
+ GPRECT gprect = new GPRECT(rect);
+
+ int status = SafeNativeMethods.Gdip.GdipCreateRegionRectI(ref gprect, out region);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeRegion(region);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Region3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.Region'/> class
+ /// with the specified <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </para>
+ /// </devdoc>
+ public Region(GraphicsPath path)
+ {
+ if (path == null)
+ throw new ArgumentNullException("path");
+
+ IntPtr region = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateRegionPath(new HandleRef(path, path.nativePath), out region);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeRegion(region);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Region4"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Region'/> class
+ /// from the specified data.
+ /// </devdoc>
+ public Region(RegionData rgnData)
+ {
+ if (rgnData == null)
+ throw new ArgumentNullException("rgnData");
+ IntPtr region = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateRegionRgnData(rgnData.Data,
+ rgnData.Data.Length,
+ out region);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeRegion(region);
+ }
+
+ internal Region(IntPtr nativeRegion)
+ {
+ SetNativeRegion(nativeRegion);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.FromHrgn"]/*' />
+ /// <devdoc>
+ /// Initializes a new instance of the <see cref='System.Drawing.Region'/> class
+ /// from the specified existing <see cref='System.Drawing.Region'/>.
+ /// </devdoc>
+ public static Region FromHrgn(IntPtr hrgn)
+ {
+ IntPtr region = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCreateRegionHrgn(new HandleRef(null, hrgn), out region);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return new Region(region);
+ }
+
+ private void SetNativeRegion(IntPtr nativeRegion)
+ {
+ if (nativeRegion == IntPtr.Zero)
+ throw new ArgumentNullException("nativeRegion");
+
+ this.nativeRegion = nativeRegion;
+ }
+
+ /**
+ * Make a copy of the region object
+ */
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Clone"]/*' />
+ /// <devdoc>
+ /// Creates an exact copy if this <see cref='System.Drawing.Region'/>.
+ /// </devdoc>
+ public Region Clone()
+ {
+ IntPtr region = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCloneRegion(new HandleRef(this, nativeRegion), out region);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return new Region(region);
+ }
+
+ /**
+ * Dispose of resources associated with the
+ */
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Dispose"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Cleans up Windows resources for this
+ /// <see cref='System.Drawing.Region'/>.
+ /// </para>
+ /// </devdoc>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+ private void Dispose(bool disposing)
+ {
+#if FINALIZATION_WATCH
+ if (!disposing && nativeRegion != IntPtr.Zero)
+ Debug.WriteLine("**********************\nDisposed through finalization:\n" + allocationSite);
+#endif
+ if (nativeRegion != IntPtr.Zero)
+ {
+ try
+ {
+#if DEBUG
+ int status =
+#endif
+ SafeNativeMethods.Gdip.GdipDeleteRegion(new HandleRef(this, nativeRegion));
+#if DEBUG
+ Debug.Assert(status == SafeNativeMethods.Gdip.Ok, "GDI+ returned an error status: " + status.ToString(CultureInfo.InvariantCulture));
+#endif
+ }
+ catch (Exception ex)
+ {
+ if (ClientUtils.IsSecurityOrCriticalException(ex))
+ {
+ throw;
+ }
+
+ Debug.Fail("Exception thrown during Dispose: " + ex.ToString());
+ }
+ finally
+ {
+ nativeRegion = IntPtr.Zero;
+ }
+ }
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Finalize"]/*' />
+ /// <devdoc>
+ /// Cleans up Windows resources for this
+ /// <see cref='System.Drawing.Region'/>.
+ /// </devdoc>
+ ~Region()
+ {
+ Dispose(false);
+ }
+
+ /*
+ * Region operations
+ */
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.MakeInfinite"]/*' />
+ /// <devdoc>
+ /// Initializes this <see cref='System.Drawing.Region'/> to an
+ /// infinite interior.
+ /// </devdoc>
+ public void MakeInfinite()
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetInfinite(new HandleRef(this, nativeRegion));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.MakeEmpty"]/*' />
+ /// <devdoc>
+ /// Initializes this <see cref='System.Drawing.Region'/> to an
+ /// empty interior.
+ /// </devdoc>
+ public void MakeEmpty()
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetEmpty(new HandleRef(this, nativeRegion));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ // float version
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Intersect"]/*' />
+ /// <devdoc>
+ /// Updates this <see cref='System.Drawing.Region'/> to the intersection of itself
+ /// with the specified <see cref='System.Drawing.RectangleF'/>.
+ /// </devdoc>
+ public void Intersect(RectangleF rect)
+ {
+ GPRECTF gprectf = rect.ToGPRECTF();
+ int status = SafeNativeMethods.Gdip.GdipCombineRegionRect(new HandleRef(this, nativeRegion), ref gprectf, CombineMode.Intersect);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ // int version
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Intersect1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Updates this <see cref='System.Drawing.Region'/> to the intersection of itself with the specified
+ /// <see cref='System.Drawing.Rectangle'/>.
+ /// </para>
+ /// </devdoc>
+ public void Intersect(Rectangle rect)
+ {
+ GPRECT gprect = new GPRECT(rect);
+ int status = SafeNativeMethods.Gdip.GdipCombineRegionRectI(new HandleRef(this, nativeRegion), ref gprect, CombineMode.Intersect);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Intersect2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Updates this <see cref='System.Drawing.Region'/> to the intersection of itself with the specified
+ /// <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </para>
+ /// </devdoc>
+ public void Intersect(GraphicsPath path)
+ {
+ if (path == null)
+ throw new ArgumentNullException("path");
+
+ int status = SafeNativeMethods.Gdip.GdipCombineRegionPath(new HandleRef(this, nativeRegion), new HandleRef(path, path.nativePath), CombineMode.Intersect);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Intersect3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Updates this <see cref='System.Drawing.Region'/> to the intersection of itself with the specified
+ /// <see cref='System.Drawing.Region'/>.
+ /// </para>
+ /// </devdoc>
+ public void Intersect(Region region)
+ {
+ if (region == null)
+ throw new ArgumentNullException("region");
+
+ int status = SafeNativeMethods.Gdip.GdipCombineRegionRegion(new HandleRef(this, nativeRegion), new HandleRef(region, region.nativeRegion), CombineMode.Intersect);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.ReleaseHrgn"]/*' />
+ /// <devdoc>
+ /// Releases the handle to the region handle.
+ /// </devdoc>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
+ public void ReleaseHrgn(IntPtr regionHandle)
+ {
+ if (regionHandle == IntPtr.Zero)
+ {
+ throw new ArgumentNullException("regionHandle");
+ }
+
+ SafeNativeMethods.IntDeleteObject(new HandleRef(this, regionHandle));
+ }
+
+ // float version
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Union"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Updates this <see cref='System.Drawing.Region'/> to the union of itself and the
+ /// specified <see cref='System.Drawing.RectangleF'/>.
+ /// </para>
+ /// </devdoc>
+ public void Union(RectangleF rect)
+ {
+ GPRECTF gprectf = new GPRECTF(rect);
+ int status = SafeNativeMethods.Gdip.GdipCombineRegionRect(new HandleRef(this, nativeRegion), ref gprectf, CombineMode.Union);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ // int version
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Union1"]/*' />
+ /// <devdoc>
+ /// Updates this <see cref='System.Drawing.Region'/> to the union of itself and the
+ /// specified <see cref='System.Drawing.Rectangle'/>.
+ /// </devdoc>
+ public void Union(Rectangle rect)
+ {
+ GPRECT gprect = new GPRECT(rect);
+ int status = SafeNativeMethods.Gdip.GdipCombineRegionRectI(new HandleRef(this, nativeRegion), ref gprect, CombineMode.Union);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Union2"]/*' />
+ /// <devdoc>
+ /// Updates this <see cref='System.Drawing.Region'/> to the union of itself and the
+ /// specified <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </devdoc>
+ public void Union(GraphicsPath path)
+ {
+ if (path == null)
+ throw new ArgumentNullException("path");
+
+ int status = SafeNativeMethods.Gdip.GdipCombineRegionPath(new HandleRef(this, nativeRegion), new HandleRef(path, path.nativePath), CombineMode.Union);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Union3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Updates this <see cref='System.Drawing.Region'/> to the union of itself and the specified <see cref='System.Drawing.Region'/>.
+ /// </para>
+ /// </devdoc>
+ public void Union(Region region)
+ {
+ if (region == null)
+ throw new ArgumentNullException("region");
+
+ int status = SafeNativeMethods.Gdip.GdipCombineRegionRegion(new HandleRef(this, nativeRegion), new HandleRef(region, region.nativeRegion), CombineMode.Union);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ // float version
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Xor"]/*' />
+ /// <devdoc>
+ /// Updates this <see cref='System.Drawing.Region'/> to the union minus the
+ /// intersection of itself with the specified <see cref='System.Drawing.RectangleF'/>.
+ /// </devdoc>
+ public void Xor(RectangleF rect)
+ {
+ GPRECTF gprectf = new GPRECTF(rect);
+ int status = SafeNativeMethods.Gdip.GdipCombineRegionRect(new HandleRef(this, nativeRegion), ref gprectf, CombineMode.Xor);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ // int version
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Xor1"]/*' />
+ /// <devdoc>
+ /// Updates this <see cref='System.Drawing.Region'/> to the union minus the
+ /// intersection of itself with the specified <see cref='System.Drawing.Rectangle'/>.
+ /// </devdoc>
+ public void Xor(Rectangle rect)
+ {
+ GPRECT gprect = new GPRECT(rect);
+ int status = SafeNativeMethods.Gdip.GdipCombineRegionRectI(new HandleRef(this, nativeRegion), ref gprect, CombineMode.Xor);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Xor2"]/*' />
+ /// <devdoc>
+ /// Updates this <see cref='System.Drawing.Region'/> to the union minus the
+ /// intersection of itself with the specified <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </devdoc>
+ public void Xor(GraphicsPath path)
+ {
+ if (path == null)
+ throw new ArgumentNullException("path");
+
+ int status = SafeNativeMethods.Gdip.GdipCombineRegionPath(new HandleRef(this, nativeRegion), new HandleRef(path, path.nativePath), CombineMode.Xor);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Xor3"]/*' />
+ /// <devdoc>
+ /// Updates this <see cref='System.Drawing.Region'/> to the union minus the
+ /// intersection of itself with the specified <see cref='System.Drawing.Region'/>.
+ /// </devdoc>
+ public void Xor(Region region)
+ {
+ if (region == null)
+ throw new ArgumentNullException("region");
+
+ int status = SafeNativeMethods.Gdip.GdipCombineRegionRegion(new HandleRef(this, nativeRegion), new HandleRef(region, region.nativeRegion), CombineMode.Xor);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ // float version
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Exclude"]/*' />
+ /// <devdoc>
+ /// Updates this <see cref='System.Drawing.Region'/> to the portion of its interior
+ /// that does not intersect with the specified <see cref='System.Drawing.RectangleF'/>.
+ /// </devdoc>
+ public void Exclude(RectangleF rect)
+ {
+ GPRECTF gprectf = new GPRECTF(rect);
+ int status = SafeNativeMethods.Gdip.GdipCombineRegionRect(new HandleRef(this, nativeRegion), ref gprectf, CombineMode.Exclude);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ // int version
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Exclude1"]/*' />
+ /// <devdoc>
+ /// Updates this <see cref='System.Drawing.Region'/> to the portion of its interior
+ /// that does not intersect with the specified <see cref='System.Drawing.Rectangle'/>.
+ /// </devdoc>
+ public void Exclude(Rectangle rect)
+ {
+ GPRECT gprect = new GPRECT(rect);
+ int status = SafeNativeMethods.Gdip.GdipCombineRegionRectI(new HandleRef(this, nativeRegion), ref gprect, CombineMode.Exclude);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Exclude2"]/*' />
+ /// <devdoc>
+ /// Updates this <see cref='System.Drawing.Region'/> to the portion of its interior
+ /// that does not intersect with the specified <see cref='System.Drawing.Drawing2D.GraphicsPath'/>.
+ /// </devdoc>
+ public void Exclude(GraphicsPath path)
+ {
+ if (path == null)
+ throw new ArgumentNullException("path");
+
+ int status = SafeNativeMethods.Gdip.GdipCombineRegionPath(new HandleRef(this, nativeRegion), new HandleRef(path, path.nativePath),
+ CombineMode.Exclude);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Exclude3"]/*' />
+ /// <devdoc>
+ /// Updates this <see cref='System.Drawing.Region'/> to the portion of its interior
+ /// that does not intersect with the specified <see cref='System.Drawing.Region'/>.
+ /// </devdoc>
+ public void Exclude(Region region)
+ {
+ if (region == null)
+ throw new ArgumentNullException("region");
+
+ int status = SafeNativeMethods.Gdip.GdipCombineRegionRegion(new HandleRef(this, nativeRegion), new HandleRef(region, region.nativeRegion),
+ CombineMode.Exclude);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ // float version
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Complement"]/*' />
+ /// <devdoc>
+ /// Updates this <see cref='System.Drawing.Region'/> to the portion of the
+ /// specified <see cref='System.Drawing.RectangleF'/> that does not intersect with this <see cref='System.Drawing.Region'/>.
+ /// </devdoc>
+ public void Complement(RectangleF rect)
+ {
+ GPRECTF gprectf = rect.ToGPRECTF();
+ int status = SafeNativeMethods.Gdip.GdipCombineRegionRect(new HandleRef(this, nativeRegion), ref gprectf, CombineMode.Complement);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ // int version
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Complement1"]/*' />
+ /// <devdoc>
+ /// Updates this <see cref='System.Drawing.Region'/> to the portion of the
+ /// specified <see cref='System.Drawing.Rectangle'/> that does not intersect with this <see cref='System.Drawing.Region'/>.
+ /// </devdoc>
+ public void Complement(Rectangle rect)
+ {
+ GPRECT gprect = new GPRECT(rect);
+ int status = SafeNativeMethods.Gdip.GdipCombineRegionRectI(new HandleRef(this, nativeRegion), ref gprect, CombineMode.Complement);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Complement2"]/*' />
+ /// <devdoc>
+ /// Updates this <see cref='System.Drawing.Region'/> to the portion of the
+ /// specified <see cref='System.Drawing.Drawing2D.GraphicsPath'/> that does not intersect with this
+ /// <see cref='System.Drawing.Region'/>.
+ /// </devdoc>
+ public void Complement(GraphicsPath path)
+ {
+ if (path == null)
+ throw new ArgumentNullException("path");
+
+ int status = SafeNativeMethods.Gdip.GdipCombineRegionPath(new HandleRef(this, nativeRegion), new HandleRef(path, path.nativePath), CombineMode.Complement);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Complement3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Updates this <see cref='System.Drawing.Region'/> to the portion of the
+ /// specified <see cref='System.Drawing.Region'/> that does not intersect with this <see cref='System.Drawing.Region'/>.
+ /// </para>
+ /// </devdoc>
+ public void Complement(Region region)
+ {
+ if (region == null)
+ throw new ArgumentNullException("region");
+
+ int status = SafeNativeMethods.Gdip.GdipCombineRegionRegion(new HandleRef(this, nativeRegion), new HandleRef(region, region.nativeRegion), CombineMode.Complement);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /**
+ * Transform operations
+ */
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Translate"]/*' />
+ /// <devdoc>
+ /// Offsets the coordinates of this <see cref='System.Drawing.Region'/> by the
+ /// specified amount.
+ /// </devdoc>
+ public void Translate(float dx, float dy)
+ {
+ int status = SafeNativeMethods.Gdip.GdipTranslateRegion(new HandleRef(this, nativeRegion), dx, dy);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Translate1"]/*' />
+ /// <devdoc>
+ /// Offsets the coordinates of this <see cref='System.Drawing.Region'/> by the
+ /// specified amount.
+ /// </devdoc>
+ public void Translate(int dx, int dy)
+ {
+ int status = SafeNativeMethods.Gdip.GdipTranslateRegionI(new HandleRef(this, nativeRegion), dx, dy);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Transform"]/*' />
+ /// <devdoc>
+ /// Transforms this <see cref='System.Drawing.Region'/> by the
+ /// specified <see cref='System.Drawing.Drawing2D.Matrix'/>.
+ /// </devdoc>
+ public void Transform(Matrix matrix)
+ {
+ if (matrix == null)
+ throw new ArgumentNullException("matrix");
+
+ int status = SafeNativeMethods.Gdip.GdipTransformRegion(new HandleRef(this, nativeRegion),
+ new HandleRef(matrix, matrix.nativeMatrix));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ /**
+ * Get region attributes
+ */
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.GetBounds"]/*' />
+ /// <devdoc>
+ /// Returns a <see cref='System.Drawing.RectangleF'/> that represents a rectangular
+ /// region that bounds this <see cref='System.Drawing.Region'/> on the drawing surface of a <see cref='System.Drawing.Graphics'/>.
+ /// </devdoc>
+ public RectangleF GetBounds(Graphics g)
+ {
+ if (g == null)
+ throw new ArgumentNullException("g");
+
+ GPRECTF gprectf = new GPRECTF();
+
+ int status = SafeNativeMethods.Gdip.GdipGetRegionBounds(new HandleRef(this, nativeRegion), new HandleRef(g, g.NativeGraphics), ref gprectf);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return gprectf.ToRectangleF();
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.GetHrgn"]/*' />
+ /// <devdoc>
+ /// Returns a Windows handle to this <see cref='System.Drawing.Region'/> in the
+ /// specified graphics context.
+ ///
+ /// Remarks from MSDN:
+ /// It is the caller's responsibility to call the GDI function
+ /// DeleteObject to free the GDI region when it is no longer needed.
+ /// </devdoc>
+ public IntPtr GetHrgn(Graphics g)
+ {
+ if (g == null)
+ throw new ArgumentNullException("g");
+
+ IntPtr hrgn = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipGetRegionHRgn(new HandleRef(this, nativeRegion), new HandleRef(g, g.NativeGraphics), out hrgn);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return hrgn;
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.IsEmpty"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Tests whether this <see cref='System.Drawing.Region'/> has an
+ /// empty interior on the specified drawing surface.
+ /// </para>
+ /// </devdoc>
+ public bool IsEmpty(Graphics g)
+ {
+ if (g == null)
+ throw new ArgumentNullException("g");
+
+ int isEmpty;
+ int status = SafeNativeMethods.Gdip.GdipIsEmptyRegion(new HandleRef(this, nativeRegion), new HandleRef(g, g.NativeGraphics), out isEmpty);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return isEmpty != 0;
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.IsInfinite"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Tests whether this <see cref='System.Drawing.Region'/> has
+ /// an infinite interior on the specified drawing surface.
+ /// </para>
+ /// </devdoc>
+ public bool IsInfinite(Graphics g)
+ {
+ if (g == null)
+ throw new ArgumentNullException("g");
+
+ int isInfinite;
+ int status = SafeNativeMethods.Gdip.GdipIsInfiniteRegion(new HandleRef(this, nativeRegion), new HandleRef(g, g.NativeGraphics), out isInfinite);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return isInfinite != 0;
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.Equals"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Tests whether the specified <see cref='System.Drawing.Region'/> is
+ /// identical to this <see cref='System.Drawing.Region'/>
+ /// on the specified drawing surface.
+ /// </para>
+ /// </devdoc>
+ public bool Equals(Region region, Graphics g)
+ {
+ if (g == null)
+ throw new ArgumentNullException("g");
+
+ if (region == null)
+ throw new ArgumentNullException("region");
+
+ int isEqual;
+ int status = SafeNativeMethods.Gdip.GdipIsEqualRegion(new HandleRef(this, nativeRegion), new HandleRef(region, region.nativeRegion), new HandleRef(g, g.NativeGraphics), out isEqual);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return isEqual != 0;
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.GetRegionData"]/*' />
+ /// <devdoc>
+ /// Returns a <see cref='System.Drawing.Drawing2D.RegionData'/> that represents the
+ /// information that describes this <see cref='System.Drawing.Region'/>.
+ /// </devdoc>
+ public RegionData GetRegionData()
+ {
+ int regionSize = 0;
+
+ int status = SafeNativeMethods.Gdip.GdipGetRegionDataSize(new HandleRef(this, nativeRegion), out regionSize);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ if (regionSize == 0)
+ return null;
+
+ byte[] regionData = new byte[regionSize];
+
+ status = SafeNativeMethods.Gdip.GdipGetRegionData(new HandleRef(this, nativeRegion), regionData, regionSize, out regionSize);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return new RegionData(regionData);
+ }
+
+ /*
+ * Hit testing operations
+ */
+ // float version
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.IsVisible"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Tests whether the specified point is
+ /// contained within this <see cref='System.Drawing.Region'/> in the specified graphics context.
+ /// </para>
+ /// </devdoc>
+ public bool IsVisible(float x, float y)
+ {
+ return IsVisible(new PointF(x, y), null);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.IsVisible1"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Tests whether the specified <see cref='System.Drawing.PointF'/> is contained within this <see cref='System.Drawing.Region'/>.
+ /// </para>
+ /// </devdoc>
+ public bool IsVisible(PointF point)
+ {
+ return IsVisible(point, null);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.IsVisible2"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Tests whether the specified point is contained within this <see cref='System.Drawing.Region'/> in the
+ /// specified graphics context.
+ /// </para>
+ /// </devdoc>
+ public bool IsVisible(float x, float y, Graphics g)
+ {
+ return IsVisible(new PointF(x, y), g);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.IsVisible3"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Tests whether the specified <see cref='System.Drawing.PointF'/> is
+ /// contained within this <see cref='System.Drawing.Region'/> in the specified graphics context.
+ /// </para>
+ /// </devdoc>
+ public bool IsVisible(PointF point, Graphics g)
+ {
+ int isVisible;
+
+ int status = SafeNativeMethods.Gdip.GdipIsVisibleRegionPoint(new HandleRef(this, nativeRegion), point.X, point.Y,
+ new HandleRef(g, (g == null) ? IntPtr.Zero : g.NativeGraphics),
+ out isVisible);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return isVisible != 0;
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.IsVisible4"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Tests whether the specified rectangle is contained within this <see cref='System.Drawing.Region'/>
+ /// .
+ /// </para>
+ /// </devdoc>
+ public bool IsVisible(float x, float y, float width, float height)
+ {
+ return IsVisible(new RectangleF(x, y, width, height), null);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.IsVisible5"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Tests whether the specified <see cref='System.Drawing.RectangleF'/> is contained within this
+ /// <see cref='System.Drawing.Region'/>.
+ /// </para>
+ /// </devdoc>
+ public bool IsVisible(RectangleF rect)
+ {
+ return IsVisible(rect, null);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.IsVisible6"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Tests whether the specified rectangle is contained within this <see cref='System.Drawing.Region'/> in the
+ /// specified graphics context.
+ /// </para>
+ /// </devdoc>
+ public bool IsVisible(float x, float y, float width, float height, Graphics g)
+ {
+ return IsVisible(new RectangleF(x, y, width, height), g);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.IsVisible7"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Tests whether the specified <see cref='System.Drawing.RectangleF'/> is contained within this <see cref='System.Drawing.Region'/> in the specified graphics context.
+ /// </para>
+ /// </devdoc>
+ public bool IsVisible(RectangleF rect, Graphics g)
+ {
+ int isVisible = 0;
+ int status = SafeNativeMethods.Gdip.GdipIsVisibleRegionRect(new HandleRef(this, nativeRegion), rect.X, rect.Y,
+ rect.Width, rect.Height,
+ new HandleRef(g, (g == null) ? IntPtr.Zero : g.NativeGraphics),
+ out isVisible);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return isVisible != 0;
+ }
+
+ // int version
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.IsVisible8"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Tests whether the specified point is contained within this <see cref='System.Drawing.Region'/> in the
+ /// specified graphics context.
+ /// </para>
+ /// </devdoc>
+ public bool IsVisible(int x, int y, Graphics g)
+ {
+ return IsVisible(new Point(x, y), g);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.IsVisible9"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Tests whether the specified <see cref='System.Drawing.Point'/> is contained within this <see cref='System.Drawing.Region'/>.
+ /// </para>
+ /// </devdoc>
+ public bool IsVisible(Point point)
+ {
+ return IsVisible(point, null);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.IsVisible10"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Tests whether the specified <see cref='System.Drawing.Point'/> is contained within this
+ /// <see cref='System.Drawing.Region'/> in the specified
+ /// graphics context.
+ /// </para>
+ /// </devdoc>
+ public bool IsVisible(Point point, Graphics g)
+ {
+ int isVisible = 0;
+ int status = SafeNativeMethods.Gdip.GdipIsVisibleRegionPointI(new HandleRef(this, nativeRegion), point.X, point.Y,
+ new HandleRef(g, (g == null) ? IntPtr.Zero : g.NativeGraphics),
+ out isVisible);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return isVisible != 0;
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.IsVisible11"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Tests whether the specified rectangle is contained within this <see cref='System.Drawing.Region'/>
+ /// .
+ /// </para>
+ /// </devdoc>
+ public bool IsVisible(int x, int y, int width, int height)
+ {
+ return IsVisible(new Rectangle(x, y, width, height), null);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.IsVisible12"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Tests whether the specified <see cref='System.Drawing.Rectangle'/> is contained within this
+ /// <see cref='System.Drawing.Region'/>.
+ /// </para>
+ /// </devdoc>
+ public bool IsVisible(Rectangle rect)
+ {
+ return IsVisible(rect, null);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.IsVisible13"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Tests whether the specified rectangle is contained within this <see cref='System.Drawing.Region'/> in the
+ /// specified graphics context.
+ /// </para>
+ /// </devdoc>
+ public bool IsVisible(int x, int y, int width, int height, Graphics g)
+ {
+ return IsVisible(new Rectangle(x, y, width, height), g);
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.IsVisible14"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Tests whether the specified <see cref='System.Drawing.Rectangle'/> is contained within this
+ /// <see cref='System.Drawing.Region'/>
+ /// in the specified graphics context.
+ /// </para>
+ /// </devdoc>
+ public bool IsVisible(Rectangle rect, Graphics g)
+ {
+ int isVisible = 0;
+ int status = SafeNativeMethods.Gdip.GdipIsVisibleRegionRectI(new HandleRef(this, nativeRegion), rect.X, rect.Y,
+ rect.Width, rect.Height,
+ new HandleRef(g, (g == null) ? IntPtr.Zero : g.NativeGraphics),
+ out isVisible);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ return isVisible != 0;
+ }
+
+ /// <include file='doc\Region.uex' path='docs/doc[@for="Region.GetRegionScans"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Returns an array of <see cref='System.Drawing.RectangleF'/>
+ /// objects that approximate this Region on the specified
+ /// </para>
+ /// </devdoc>
+ public RectangleF[] GetRegionScans(Matrix matrix)
+ {
+ if (matrix == null)
+ throw new ArgumentNullException("matrix");
+
+ int count = 0;
+
+ // call first time to get actual count of rectangles
+
+ int status = SafeNativeMethods.Gdip.GdipGetRegionScansCount(new HandleRef(this, nativeRegion),
+ out count,
+ new HandleRef(matrix, matrix.nativeMatrix));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ RectangleF[] rectangles;
+ int rectsize = (int)Marshal.SizeOf(typeof(GPRECTF));
+ IntPtr memoryRects = Marshal.AllocHGlobal(checked(rectsize * count));
+
+ try
+ {
+ status = SafeNativeMethods.Gdip.GdipGetRegionScans(new HandleRef(this, nativeRegion),
+ memoryRects,
+ out count,
+ new HandleRef(matrix, matrix.nativeMatrix));
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ {
+ throw SafeNativeMethods.Gdip.StatusException(status);
+ }
+
+ int index;
+ GPRECTF gprectf = new GPRECTF();
+
+ rectangles = new RectangleF[count];
+
+ for (index = 0; index < count; index++)
+ {
+ gprectf = (GPRECTF)UnsafeNativeMethods.PtrToStructure((IntPtr)(checked((long)memoryRects + rectsize * index)), typeof(GPRECTF));
+ rectangles[index] = gprectf.ToRectangleF();
+ }
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(memoryRects);
+ }
+
+ return rectangles;
+ }
+
+ /*
+ * handle to native region object
+ */
+ internal IntPtr nativeRegion;
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/RotateFlipType.cs b/src/System.Drawing.Common/src/System/Drawing/RotateFlipType.cs
new file mode 100644
index 0000000000..88c0d9cf32
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/RotateFlipType.cs
@@ -0,0 +1,99 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ /// <include file='doc\RotateFlipType.uex' path='docs/doc[@for="RotateFlipType"]/*' />
+ /// <devdoc>
+ /// Specifies the different patterns available 'RotateFlipType' objects.
+ /// </devdoc>
+
+ public enum RotateFlipType
+ {
+ /// <include file='doc\RotateFlipType.uex' path='docs/doc[@for="RotateFlipType.RotateNoneFlipNone"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ RotateNoneFlipNone = 0,
+ /// <include file='doc\RotateFlipType.uex' path='docs/doc[@for="RotateFlipType.Rotate90FlipNone"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Rotate90FlipNone = 1,
+ /// <include file='doc\RotateFlipType.uex' path='docs/doc[@for="RotateFlipType.Rotate180FlipNone"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Rotate180FlipNone = 2,
+ /// <include file='doc\RotateFlipType.uex' path='docs/doc[@for="RotateFlipType.Rotate270FlipNone"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Rotate270FlipNone = 3,
+
+ /// <include file='doc\RotateFlipType.uex' path='docs/doc[@for="RotateFlipType.RotateNoneFlipX"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ RotateNoneFlipX = 4,
+ /// <include file='doc\RotateFlipType.uex' path='docs/doc[@for="RotateFlipType.Rotate90FlipX"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Rotate90FlipX = 5,
+ /// <include file='doc\RotateFlipType.uex' path='docs/doc[@for="RotateFlipType.Rotate180FlipX"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Rotate180FlipX = 6,
+ /// <include file='doc\RotateFlipType.uex' path='docs/doc[@for="RotateFlipType.Rotate270FlipX"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Rotate270FlipX = 7,
+
+ /// <include file='doc\RotateFlipType.uex' path='docs/doc[@for="RotateFlipType.RotateNoneFlipY"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ RotateNoneFlipY = Rotate180FlipX,
+ /// <include file='doc\RotateFlipType.uex' path='docs/doc[@for="RotateFlipType.Rotate90FlipY"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Rotate90FlipY = Rotate270FlipX,
+ /// <include file='doc\RotateFlipType.uex' path='docs/doc[@for="RotateFlipType.Rotate180FlipY"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Rotate180FlipY = RotateNoneFlipX,
+ /// <include file='doc\RotateFlipType.uex' path='docs/doc[@for="RotateFlipType.Rotate270FlipY"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Rotate270FlipY = Rotate90FlipX,
+
+ /// <include file='doc\RotateFlipType.uex' path='docs/doc[@for="RotateFlipType.RotateNoneFlipXY"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ RotateNoneFlipXY = Rotate180FlipNone,
+ /// <include file='doc\RotateFlipType.uex' path='docs/doc[@for="RotateFlipType.Rotate90FlipXY"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Rotate90FlipXY = Rotate270FlipNone,
+ /// <include file='doc\RotateFlipType.uex' path='docs/doc[@for="RotateFlipType.Rotate180FlipXY"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Rotate180FlipXY = RotateNoneFlipNone,
+ /// <include file='doc\RotateFlipType.uex' path='docs/doc[@for="RotateFlipType.Rotate270FlipXY"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Rotate270FlipXY = Rotate90FlipNone
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/SizeConverter.cs b/src/System.Drawing.Common/src/System/Drawing/SizeConverter.cs
new file mode 100644
index 0000000000..ba37bc593d
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/SizeConverter.cs
@@ -0,0 +1,201 @@
+//------------------------------------------------------------------------------
+// <copyright file="SizeConverter.cs" company="Microsoft">
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// </copyright>
+//------------------------------------------------------------------------------
+
+/*
+ */
+namespace System.Drawing {
+ using System.Runtime.Serialization.Formatters;
+ using System.Runtime.InteropServices;
+
+ using System.Diagnostics;
+ using System.Diagnostics.CodeAnalysis;
+
+ using Microsoft.Win32;
+ using System.Collections;
+ using System.ComponentModel;
+ using System.ComponentModel.Design.Serialization;
+ using System.Globalization;
+ using System.Reflection;
+
+ /// <include file='doc\SizeConverter.uex' path='docs/doc[@for="SizeConverter"]/*' />
+ /// <devdoc>
+ /// SizeConverter is a class that can be used to convert
+ /// Size from one data type to another. Access this
+ /// class through the TypeDescriptor.
+ /// </devdoc>
+ public class SizeConverter : TypeConverter {
+
+ /// <include file='doc\SizeConverter.uex' path='docs/doc[@for="SizeConverter.CanConvertFrom"]/*' />
+ /// <devdoc>
+ /// Determines if this converter can convert an object in the given source
+ /// type to the native type of the converter.
+ /// </devdoc>
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) {
+ if (sourceType == typeof(string)) {
+ return true;
+ }
+ return base.CanConvertFrom(context, sourceType);
+ }
+
+ /// <include file='doc\SizeConverter.uex' path='docs/doc[@for="SizeConverter.CanConvertTo"]/*' />
+ /// <devdoc>
+ /// <para>Gets a value indicating whether this converter can
+ /// convert an object to the given destination type using the context.</para>
+ /// </devdoc>
+ public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {
+ if (destinationType == typeof(InstanceDescriptor)) {
+ return true;
+ }
+ return base.CanConvertTo(context, destinationType);
+ }
+
+ /// <include file='doc\SizeConverter.uex' path='docs/doc[@for="SizeConverter.ConvertFrom"]/*' />
+ /// <devdoc>
+ /// Converts the given object to the converter's native type.
+ /// </devdoc>
+ [SuppressMessage("Microsoft.Performance", "CA1808:AvoidCallsThatBoxValueTypes")]
+ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) {
+
+ string strValue = value as string;
+
+ if (strValue != null) {
+
+ string text = strValue.Trim();
+
+ if (text.Length == 0) {
+ return null;
+ }
+ else {
+
+ // Parse 2 integer values.
+ //
+ if (culture == null) {
+ culture = CultureInfo.CurrentCulture;
+ }
+ char sep = culture.TextInfo.ListSeparator[0];
+ string[] tokens = text.Split(new char[] {sep});
+ int[] values = new int[tokens.Length];
+ TypeConverter intConverter = TypeDescriptor.GetConverter(typeof(int));
+ for (int i = 0; i < values.Length; i++) {
+ // Note: ConvertFromString will raise exception if value cannot be converted.
+ values[i] = (int)intConverter.ConvertFromString(context, culture, tokens[i]);
+ }
+
+ if (values.Length == 2) {
+ return new Size(values[0], values[1]);
+ }
+ else {
+ throw new ArgumentException(SR.Format(SR.TextParseFailedFormat,
+ text,
+ "Width,Height"));
+ }
+ }
+ }
+
+ return base.ConvertFrom(context, culture, value);
+ }
+
+ /// <include file='doc\SizeConverter.uex' path='docs/doc[@for="SizeConverter.ConvertTo"]/*' />
+ /// <devdoc>
+ /// Converts the given object to another type. The most common types to convert
+ /// are to and from a string object. The default implementation will make a call
+ /// to ToString on the object if the object is valid and if the destination
+ /// type is string. If this cannot convert to the desitnation type, this will
+ /// throw a NotSupportedException.
+ /// </devdoc>
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) {
+ if (destinationType == null) {
+ throw new ArgumentNullException("destinationType");
+ }
+
+ if(value is Size){
+ if (destinationType == typeof(string)) {
+ Size size = (Size)value;
+
+ if (culture == null) {
+ culture = CultureInfo.CurrentCulture;
+ }
+ string sep = culture.TextInfo.ListSeparator + " ";
+ TypeConverter intConverter = TypeDescriptor.GetConverter(typeof(int));
+ string[] args = new string[2];
+ int nArg = 0;
+
+ // Note: ConvertToString will raise exception if value cannot be converted.
+ args[nArg++] = intConverter.ConvertToString(context, culture, size.Width);
+ args[nArg++] = intConverter.ConvertToString(context, culture, size.Height);
+
+ return string.Join(sep, args);
+ }
+ if (destinationType == typeof(InstanceDescriptor)) {
+ Size size = (Size)value;
+
+ ConstructorInfo ctor = typeof(Size).GetConstructor(new Type[] {typeof(int), typeof(int)});
+ if (ctor != null) {
+ return new InstanceDescriptor(ctor, new object[] {size.Width, size.Height});
+ }
+ }
+ }
+
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+
+ /// <include file='doc\SizeConverter.uex' path='docs/doc[@for="SizeConverter.CreateInstance"]/*' />
+ /// <devdoc>
+ /// Creates an instance of this type given a set of property values
+ /// for the object. This is useful for objects that are immutable, but still
+ /// want to provide changable properties.
+ /// </devdoc>
+ [SuppressMessage("Microsoft.Performance", "CA1808:AvoidCallsThatBoxValueTypes")]
+ [SuppressMessage("Microsoft.Security", "CA2102:CatchNonClsCompliantExceptionsInGeneralHandlers")]
+ public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues) {
+ if( propertyValues == null ){
+ throw new ArgumentNullException( "propertyValues" );
+ }
+
+
+ object width = propertyValues["Width"];
+ object height = propertyValues["Height"];
+
+ if(width == null || height == null ||
+ !(width is int) || !(height is int)) {
+ throw new ArgumentException(SR.Format(SR.PropertyValueInvalidEntry));
+ }
+ return new Size((int)width,
+ (int)height);
+ }
+
+ /// <include file='doc\SizeConverter.uex' path='docs/doc[@for="SizeConverter.GetCreateInstanceSupported"]/*' />
+ /// <devdoc>
+ /// Determines if changing a value on this object should require a call to
+ /// CreateInstance to create a new value.
+ /// </devdoc>
+ public override bool GetCreateInstanceSupported(ITypeDescriptorContext context) {
+ return true;
+ }
+
+ /// <include file='doc\SizeConverter.uex' path='docs/doc[@for="SizeConverter.GetProperties"]/*' />
+ /// <devdoc>
+ /// Retrieves the set of properties for this type. By default, a type has
+ /// does not return any properties. An easy implementation of this method
+ /// can just call TypeDescriptor.GetProperties for the correct data type.
+ /// </devdoc>
+ public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) {
+ PropertyDescriptorCollection props = TypeDescriptor.GetProperties(typeof(Size), attributes);
+ return props.Sort(new string[] {"Width", "Height"});
+ }
+
+
+ /// <include file='doc\SizeConverter.uex' path='docs/doc[@for="SizeConverter.GetPropertiesSupported"]/*' />
+ /// <devdoc>
+ /// Determines if this object supports properties. By default, this
+ /// is false.
+ /// </devdoc>
+ public override bool GetPropertiesSupported(ITypeDescriptorContext context) {
+ return true;
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/SolidBrush.cs b/src/System.Drawing.Common/src/System/Drawing/SolidBrush.cs
new file mode 100644
index 0000000000..bd373b900c
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/SolidBrush.cs
@@ -0,0 +1,173 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.Diagnostics;
+ using System.Drawing.Internal;
+ using System.Runtime.InteropServices;
+
+ /// <include file='doc\SolidBrush.uex' path='docs/doc[@for="SolidBrush"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Defines a brush made up of a single color. Brushes are
+ /// used to fill graphics shapes such as rectangles, ellipses, pies, polygons, and paths.
+ /// </para>
+ /// </devdoc>
+ public sealed class SolidBrush : Brush, ISystemColorTracker
+ {
+ // GDI+ doesn't understand system colors, so we need to cache the value here
+ private Color _color = Color.Empty;
+ private bool _immutable;
+
+ /**
+ * Create a new solid fill brush object
+ */
+ /// <include file='doc\SolidBrush.uex' path='docs/doc[@for="SolidBrush.SolidBrush"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Initializes a new instance of the <see cref='System.Drawing.SolidBrush'/> class of the specified
+ /// color.
+ /// </para>
+ /// </devdoc>
+ public SolidBrush(Color color)
+ {
+ _color = color;
+
+ IntPtr brush = IntPtr.Zero;
+ int status = SafeNativeMethods.Gdip.GdipCreateSolidFill(_color.ToArgb(), out brush);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ SetNativeBrushInternal(brush);
+
+#if FEATURE_SYSTEM_EVENTS
+ if (color.IsSystemColor)
+ {
+ SystemColorTracker.Add(this);
+ }
+#endif
+ }
+
+ internal SolidBrush(Color color, bool immutable) : this(color)
+ {
+ _immutable = immutable;
+ }
+
+ /// <devdoc>
+ /// Constructor to initialized this object from a GDI+ Brush native pointer.
+ /// </devdoc>
+ internal SolidBrush(IntPtr nativeBrush)
+ {
+ Debug.Assert(nativeBrush != IntPtr.Zero, "Initializing native brush with null.");
+ SetNativeBrushInternal(nativeBrush);
+ }
+
+ /// <include file='doc\SolidBrush.uex' path='docs/doc[@for="SolidBrush.Clone"]/*' />
+ /// <devdoc>
+ /// Creates an exact copy of this <see cref='System.Drawing.SolidBrush'/>.
+ /// </devdoc>
+ public override object Clone()
+ {
+ IntPtr cloneBrush = IntPtr.Zero;
+
+ int status = SafeNativeMethods.Gdip.GdipCloneBrush(new HandleRef(this, NativeBrush), out cloneBrush);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ // We intentionally lose the "immutable" bit.
+
+ return new SolidBrush(cloneBrush);
+ }
+
+
+ /// <include file='doc\SolidBrush.uex' path='docs/doc[@for="SolidBrush.Dispose"]/*' />
+ protected override void Dispose(bool disposing)
+ {
+ if (!disposing)
+ {
+ _immutable = false;
+ }
+ else if (_immutable)
+ {
+ throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, "Brush"));
+ }
+
+ base.Dispose(disposing);
+ }
+
+ /// <include file='doc\SolidBrush.uex' path='docs/doc[@for="SolidBrush.Color"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// The color of this <see cref='System.Drawing.SolidBrush'/>.
+ /// </para>
+ /// </devdoc>
+ public Color Color
+ {
+ get
+ {
+ if (_color == Color.Empty)
+ {
+ int colorARGB = 0;
+ int status = SafeNativeMethods.Gdip.GdipGetSolidFillColor(new HandleRef(this, NativeBrush), out colorARGB);
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ _color = Color.FromArgb(colorARGB);
+ }
+
+ // GDI+ doesn't understand system colors, so we can't use GdipGetSolidFillColor in the general case
+ return _color;
+ }
+
+ set
+ {
+ if (_immutable)
+ {
+ throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, "Brush"));
+ }
+
+ if (_color != value)
+ {
+ Color oldColor = _color;
+ InternalSetColor(value);
+
+#if FEATURE_SYSTEM_EVENTS
+ // NOTE: We never remove brushes from the active list, so if someone is
+ // changing their brush colors a lot, this could be a problem.
+ if (value.IsSystemColor && !oldColor.IsSystemColor)
+ {
+ SystemColorTracker.Add(this);
+ }
+#endif
+ }
+ }
+ }
+
+ // Sets the color even if the brush is considered immutable
+ private void InternalSetColor(Color value)
+ {
+ int status = SafeNativeMethods.Gdip.GdipSetSolidFillColor(new HandleRef(this, NativeBrush), value.ToArgb());
+
+ if (status != SafeNativeMethods.Gdip.Ok)
+ throw SafeNativeMethods.Gdip.StatusException(status);
+
+ _color = value;
+ }
+
+ /// <include file='doc\SolidBrush.uex' path='docs/doc[@for="SolidBrush.ISystemColorTracker.OnSystemColorChanged"]/*' />
+ /// <internalonly/>
+ void ISystemColorTracker.OnSystemColorChanged()
+ {
+ if (NativeBrush != IntPtr.Zero)
+ {
+ InternalSetColor(_color);
+ }
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/SystemBrushes.cs b/src/System.Drawing.Common/src/System/Drawing/SystemBrushes.cs
new file mode 100644
index 0000000000..a18b0d81bb
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/SystemBrushes.cs
@@ -0,0 +1,455 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.Diagnostics;
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes"]/*' />
+ /// <devdoc>
+ /// Brushes for select Windows system-wide colors. Whenever possible, try to use
+ /// SystemPens and SystemBrushes rather than SystemColors.
+ /// </devdoc>
+ public sealed class SystemBrushes
+ {
+ private static readonly object s_systemBrushesKey = new object();
+
+ private SystemBrushes()
+ {
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.ActiveBorder"]/*' />
+ /// <devdoc>
+ /// Brush is the color of the active window border.
+ /// </devdoc>
+ public static Brush ActiveBorder
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.ActiveBorder);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.ActiveCaption"]/*' />
+ /// <devdoc>
+ /// Brush is the color of the active caption bar.
+ /// </devdoc>
+ public static Brush ActiveCaption
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.ActiveCaption);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.ActiveCaptionText"]/*' />
+ /// <devdoc>
+ /// Brush is the color of the active caption bar.
+ /// </devdoc>
+ public static Brush ActiveCaptionText
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.ActiveCaptionText);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.AppWorkspace"]/*' />
+ /// <devdoc>
+ /// Brush is the color of the app workspace window.
+ /// </devdoc>
+ public static Brush AppWorkspace
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.AppWorkspace);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.ButtonFace"]/*' />
+ /// <devdoc>
+ /// Brush for the ButtonFace system color.
+ /// </devdoc>
+ public static Brush ButtonFace
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.ButtonFace);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.ButtonHighlight"]/*' />
+ /// <devdoc>
+ /// Brush for the ButtonHighlight system color.
+ /// </devdoc>
+ public static Brush ButtonHighlight
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.ButtonHighlight);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.ButtonShadow"]/*' />
+ /// <devdoc>
+ /// Brush for the ButtonShadow system color.
+ /// </devdoc>
+ public static Brush ButtonShadow
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.ButtonShadow);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.Control"]/*' />
+ /// <devdoc>
+ /// Brush is the control color, which is the surface color for 3D elements.
+ /// </devdoc>
+ public static Brush Control
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.Control);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.ControlLightLight"]/*' />
+ /// <devdoc>
+ /// Brush is the lighest part of a 3D element.
+ /// </devdoc>
+ public static Brush ControlLightLight
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.ControlLightLight);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.ControlLight"]/*' />
+ /// <devdoc>
+ /// Brush is the highlight part of a 3D element.
+ /// </devdoc>
+ public static Brush ControlLight
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.ControlLight);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.ControlDark"]/*' />
+ /// <devdoc>
+ /// Brush is the shadow part of a 3D element.
+ /// </devdoc>
+ public static Brush ControlDark
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.ControlDark);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.ControlDarkDark"]/*' />
+ /// <devdoc>
+ /// Brush is the darkest part of a 3D element.
+ /// </devdoc>
+ public static Brush ControlDarkDark
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.ControlDarkDark);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.ControlText"]/*' />
+ /// <devdoc>
+ /// Brush is the color of text on controls.
+ /// </devdoc>
+ public static Brush ControlText
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.ControlText);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.Desktop"]/*' />
+ /// <devdoc>
+ /// Brush is the color of the desktop.
+ /// </devdoc>
+ public static Brush Desktop
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.Desktop);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.GradientActiveCaption"]/*' />
+ /// <devdoc>
+ /// Brush for the GradientActiveCaption system color.
+ /// </devdoc>
+ public static Brush GradientActiveCaption
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.GradientActiveCaption);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.GradientInactiveCaption"]/*' />
+ /// <devdoc>
+ /// Brush for the GradientInactiveCaption system color.
+ /// </devdoc>
+ public static Brush GradientInactiveCaption
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.GradientInactiveCaption);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.GrayText"]/*' />
+ /// <devdoc>
+ /// Brush for the GrayText system color.
+ /// </devdoc>
+ public static Brush GrayText
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.GrayText);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.Highlight"]/*' />
+ /// <devdoc>
+ /// Brush is the color of the background of highlighted elements.
+ /// </devdoc>
+ public static Brush Highlight
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.Highlight);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.HighlightText"]/*' />
+ /// <devdoc>
+ /// Brush is the color of the foreground of highlighted elements.
+ /// </devdoc>
+ public static Brush HighlightText
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.HighlightText);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.HotTrack"]/*' />
+ /// <devdoc>
+ /// Brush is the color used to represent hot tracking.
+ /// </devdoc>
+ public static Brush HotTrack
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.HotTrack);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.InactiveCaption"]/*' />
+ /// <devdoc>
+ /// Brush is the color of an inactive caption bar.
+ /// </devdoc>
+ public static Brush InactiveCaption
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.InactiveCaption);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.InactiveBorder"]/*' />
+ /// <devdoc>
+ /// Brush is the color if an inactive window border.
+ /// </devdoc>
+ public static Brush InactiveBorder
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.InactiveBorder);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.InactiveCaptionText"]/*' />
+ /// <devdoc>
+ /// Brush is the color of an inactive caption text.
+ /// </devdoc>
+ public static Brush InactiveCaptionText
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.InactiveCaptionText);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.Info"]/*' />
+ /// <devdoc>
+ /// Brush is the color of the background of the info tooltip.
+ /// </devdoc>
+ public static Brush Info
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.Info);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.InfoText"]/*' />
+ /// <devdoc>
+ /// Brush is the color of the info tooltip's text.
+ /// </devdoc>
+ public static Brush InfoText
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.InfoText);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.Menu"]/*' />
+ /// <devdoc>
+ /// Brush is the color of the menu background.
+ /// </devdoc>
+ public static Brush Menu
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.Menu);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.MenuBar"]/*' />
+ /// <devdoc>
+ /// Brush is the color of the menu background.
+ /// </devdoc>
+ public static Brush MenuBar
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.MenuBar);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.MenuHighlight"]/*' />
+ /// <devdoc>
+ /// Brush for the MenuHighlight system color.
+ /// </devdoc>
+ public static Brush MenuHighlight
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.MenuHighlight);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.MenuText"]/*' />
+ /// <devdoc>
+ /// Brush is the color of the menu text.
+ /// </devdoc>
+ public static Brush MenuText
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.MenuText);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.ScrollBar"]/*' />
+ /// <devdoc>
+ /// Brush is the color of the scroll bar area that is not being used by the
+ /// thumb button.
+ /// </devdoc>
+ public static Brush ScrollBar
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.ScrollBar);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.Window"]/*' />
+ /// <devdoc>
+ /// Brush is the color of the window background.
+ /// </devdoc>
+ public static Brush Window
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.Window);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.WindowFrame"]/*' />
+ /// <devdoc>
+ /// Brush is the color of the thin frame drawn around a window.
+ /// </devdoc>
+ public static Brush WindowFrame
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.WindowFrame);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.WindowText"]/*' />
+ /// <devdoc>
+ /// Brush is the color of text on controls.
+ /// </devdoc>
+ public static Brush WindowText
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.WindowText);
+ }
+ }
+
+ /// <include file='doc\SystemBrushes.uex' path='docs/doc[@for="SystemBrushes.FromSystemColor"]/*' />
+ /// <devdoc>
+ /// Retrieves a brush given a system color. An error will be raised
+ /// if the color provide is not a system color.
+ /// </devdoc>
+ public static Brush FromSystemColor(Color c)
+ {
+ if (!c.IsSystemColor)
+ {
+ throw new ArgumentException(SR.Format(SR.ColorNotSystemColor, c.ToString()));
+ }
+
+ Brush[] systemBrushes = (Brush[])SafeNativeMethods.Gdip.ThreadData[s_systemBrushesKey];
+ if (systemBrushes == null)
+ {
+ systemBrushes = new Brush[(int)KnownColor.WindowText + (int)KnownColor.MenuHighlight - (int)KnownColor.YellowGreen];
+ SafeNativeMethods.Gdip.ThreadData[s_systemBrushesKey] = systemBrushes;
+ }
+ int idx = (int)c.ToKnownColor();
+ if (idx > (int)KnownColor.YellowGreen)
+ {
+ idx -= (int)KnownColor.YellowGreen - (int)KnownColor.WindowText;
+ }
+ idx--;
+
+ Debug.Assert(idx >= 0 && idx < systemBrushes.Length, "System colors have been added but our system color array has not been expanded.");
+
+ if (systemBrushes[idx] == null)
+ {
+ systemBrushes[idx] = new SolidBrush(c, true);
+ }
+
+ return systemBrushes[idx];
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/SystemColors.cs b/src/System.Drawing.Common/src/System/Drawing/SystemColors.cs
new file mode 100644
index 0000000000..7d1ce771ab
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/SystemColors.cs
@@ -0,0 +1,425 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors"]/*' />
+ /// <devdoc>
+ /// Windows system-wide colors. Whenever possible, try to use
+ /// SystemPens and SystemBrushes rather than SystemColors.
+ /// </devdoc>
+ public sealed class SystemColors
+ {
+ // not creatable...
+ //
+ private SystemColors()
+ {
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.ActiveBorder"]/*' />
+ /// <devdoc>
+ /// The color of the filled area of an active window border.
+ /// </devdoc>
+ public static Color ActiveBorder
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.ActiveBorder);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.ActiveCaption"]/*' />
+ /// <devdoc>
+ /// The color of the background of an active title bar caption.
+ /// </devdoc>
+ public static Color ActiveCaption
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.ActiveCaption);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.ActiveCaptionText"]/*' />
+ /// <devdoc>
+ /// The color of the text of an active title bar caption.
+ /// </devdoc>
+ public static Color ActiveCaptionText
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.ActiveCaptionText);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.AppWorkspace"]/*' />
+ /// <devdoc>
+ /// The color of the application workspace. The application workspace
+ /// is the area in a multiple document view that is not being occupied
+ /// by documents.
+ /// </devdoc>
+ public static Color AppWorkspace
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.AppWorkspace);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.ButtonFace"]/*' />
+ /// <devdoc>
+ /// Face color for three-dimensional display elements and for dialog box backgrounds.
+ /// </devdoc>
+ public static Color ButtonFace
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.ButtonFace);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.ButtonHighlight"]/*' />
+ /// <devdoc>
+ /// Highlight color for three-dimensional display elements (for edges facing the light source.)
+ /// </devdoc>
+ public static Color ButtonHighlight
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.ButtonHighlight);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.ButtonShadow"]/*' />
+ /// <devdoc>
+ /// Shadow color for three-dimensional display elements (for edges facing away from the light source.)
+ /// </devdoc>
+ public static Color ButtonShadow
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.ButtonShadow);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.Control"]/*' />
+ /// <devdoc>
+ /// The color of the background of push buttons and other 3D objects.
+ /// </devdoc>
+ public static Color Control
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.Control);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.ControlDark"]/*' />
+ /// <devdoc>
+ /// The color of shadows on 3D objects.
+ /// </devdoc>
+ public static Color ControlDark
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.ControlDark);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.ControlDarkDark"]/*' />
+ /// <devdoc>
+ /// The color of very dark shadows on 3D objects.
+ /// </devdoc>
+ public static Color ControlDarkDark
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.ControlDarkDark);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.ControlLight"]/*' />
+ /// <devdoc>
+ /// The color of highlights on 3D objects.
+ /// </devdoc>
+ public static Color ControlLight
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.ControlLight);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.ControlLightLight"]/*' />
+ /// <devdoc>
+ /// The color of very light highlights on 3D objects.
+ /// </devdoc>
+ public static Color ControlLightLight
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.ControlLightLight);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.ControlText"]/*' />
+ /// <devdoc>
+ /// The color of the text of push buttons and other 3D objects
+ /// </devdoc>
+ public static Color ControlText
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.ControlText);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.Desktop"]/*' />
+ /// <devdoc>
+ /// This color is the user-defined color of the Windows desktop.
+ /// </devdoc>
+ public static Color Desktop
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.Desktop);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.GradientActiveCaption"]/*' />
+ /// <devdoc>
+ /// Right side color in the color gradient of an active window's title bar.
+ /// The ActiveCaption Color specifies the left side color.
+ /// </devdoc>
+ public static Color GradientActiveCaption
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.GradientActiveCaption);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.GradientInactiveCaption"]/*' />
+ /// <devdoc>
+ /// Right side color in the color gradient of an inactive window's title bar.
+ /// The InactiveCaption Color specifies the left side color.
+ /// </devdoc>
+ public static Color GradientInactiveCaption
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.GradientInactiveCaption);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.GrayText"]/*' />
+ /// <devdoc>
+ /// The color of text that is being shown in a disabled, or grayed-out
+ /// state.
+ /// </devdoc>
+ public static Color GrayText
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.GrayText);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.Highlight"]/*' />
+ /// <devdoc>
+ /// The color of the background of highlighted text. This includes
+ /// selected menu items as well as selected text.
+ /// </devdoc>
+ public static Color Highlight
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.Highlight);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.HighlightText"]/*' />
+ /// <devdoc>
+ /// The color of the text of highlighted text. This includes
+ /// selected menu items as well as selected text.
+ /// </devdoc>
+ public static Color HighlightText
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.HighlightText);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.HotTrack"]/*' />
+ /// <devdoc>
+ /// The hot track color.
+ /// </devdoc>
+ public static Color HotTrack
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.HotTrack);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.InactiveBorder"]/*' />
+ /// <devdoc>
+ /// The color of the filled area of an inactive window border.
+ /// </devdoc>
+ public static Color InactiveBorder
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.InactiveBorder);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.InactiveCaption"]/*' />
+ /// <devdoc>
+ /// The color of the background of an inactive title bar caption.
+ /// </devdoc>
+ public static Color InactiveCaption
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.InactiveCaption);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.InactiveCaptionText"]/*' />
+ /// <devdoc>
+ /// The color of the text of an inactive title bar caption.
+ /// </devdoc>
+ public static Color InactiveCaptionText
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.InactiveCaptionText);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.Info"]/*' />
+ /// <devdoc>
+ /// The color of the info/tool tip background.
+ /// </devdoc>
+ public static Color Info
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.Info);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.InfoText"]/*' />
+ /// <devdoc>
+ /// The color of the info/tool tip text.
+ /// </devdoc>
+ public static Color InfoText
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.InfoText);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.Menu"]/*' />
+ /// <devdoc>
+ /// The color of the background of a menu.
+ /// </devdoc>
+ public static Color Menu
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.Menu);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.MenuBar"]/*' />
+ /// <devdoc>
+ /// The color of the background of a menu bar.
+ /// </devdoc>
+ public static Color MenuBar
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.MenuBar);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.MenuHighlight"]/*' />
+ /// <devdoc>
+ /// The color used to highlight menu items when the menu appears as a flat menu.
+ /// The highlighted menu item is outlined with the Highlight Color.
+ /// </devdoc>
+ public static Color MenuHighlight
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.MenuHighlight);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.MenuText"]/*' />
+ /// <devdoc>
+ /// The color of the text on a menu.
+ /// </devdoc>
+ public static Color MenuText
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.MenuText);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.ScrollBar"]/*' />
+ /// <devdoc>
+ /// The color of the scroll bar area that is not being used by the
+ /// thumb button.
+ /// </devdoc>
+ public static Color ScrollBar
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.ScrollBar);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.Window"]/*' />
+ /// <devdoc>
+ /// The color of the client area of a window.
+ /// </devdoc>
+ public static Color Window
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.Window);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.WindowFrame"]/*' />
+ /// <devdoc>
+ /// The color of the thin frame drawn around a window.
+ /// </devdoc>
+ public static Color WindowFrame
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.WindowFrame);
+ }
+ }
+
+ /// <include file='doc\SystemColors.uex' path='docs/doc[@for="SystemColors.WindowText"]/*' />
+ /// <devdoc>
+ /// The color of the text in the client area of a window.
+ /// </devdoc>
+ public static Color WindowText
+ {
+ get
+ {
+ return Color.FromKnownColor(KnownColor.WindowText);
+ }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/SystemFonts.cs b/src/System.Drawing.Common/src/System/Drawing/SystemFonts.cs
new file mode 100644
index 0000000000..f4b3763e92
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/SystemFonts.cs
@@ -0,0 +1,538 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.Diagnostics;
+ using System.IO;
+ using System.Runtime.InteropServices;
+
+ /// <include file='doc\SystemFonts.uex' path='docs/doc[@for="SystemFonts"]/*' />
+ /// <devdoc>
+ /// Selected system-wide fonts.
+ /// </devdoc>
+ public sealed class SystemFonts
+ {
+ private static readonly object s_systemFontsKey = new object();
+
+ // Cannot be instantiated.
+ private SystemFonts()
+ {
+ }
+
+ /// <include file='doc\SystemFonts.uex' path='docs/doc[@for="SystemFonts.CaptionFont"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the system's font for captions.
+ /// </para>
+ /// </devdoc>
+ public static Font CaptionFont
+ {
+ get
+ {
+ Font captionFont = null;
+
+ NativeMethods.NONCLIENTMETRICS data = new NativeMethods.NONCLIENTMETRICS();
+ bool result = UnsafeNativeMethods.SystemParametersInfo(NativeMethods.SPI_GETNONCLIENTMETRICS, data.cbSize, data, 0);
+
+ if (result && data.lfCaptionFont != null)
+ {
+ try
+ {
+ captionFont = Font.FromLogFont(data.lfCaptionFont);
+ }
+ catch (Exception ex)
+ {
+ if (IsCriticalFontException(ex))
+ {
+ throw;
+ }
+ }
+
+ if (captionFont == null)
+ {
+ captionFont = DefaultFont;
+ }
+ else if (captionFont.Unit != GraphicsUnit.Point)
+ {
+ captionFont = FontInPoints(captionFont);
+ }
+ }
+
+ captionFont.SetSystemFontName("CaptionFont");
+ return captionFont;
+ }
+ }
+
+
+ /// <include file='doc\SystemFonts.uex' path='docs/doc[@for="SystemFonts.SmallCaptionFont"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the system's font for small captions.
+ /// </para>
+ /// </devdoc>
+ public static Font SmallCaptionFont
+ {
+ get
+ {
+ Font smcaptionFont = null;
+
+ NativeMethods.NONCLIENTMETRICS data = new NativeMethods.NONCLIENTMETRICS();
+ bool result = UnsafeNativeMethods.SystemParametersInfo(NativeMethods.SPI_GETNONCLIENTMETRICS, data.cbSize, data, 0);
+
+ if (result && data.lfSmCaptionFont != null)
+ {
+ try
+ {
+ smcaptionFont = Font.FromLogFont(data.lfSmCaptionFont);
+ }
+ catch (Exception ex)
+ {
+ if (IsCriticalFontException(ex))
+ {
+ throw;
+ }
+ }
+
+ if (smcaptionFont == null)
+ {
+ smcaptionFont = DefaultFont;
+ }
+ else if (smcaptionFont.Unit != GraphicsUnit.Point)
+ {
+ smcaptionFont = FontInPoints(smcaptionFont);
+ }
+ }
+
+ smcaptionFont.SetSystemFontName("SmallCaptionFont");
+ return smcaptionFont;
+ }
+ }
+
+ /// <include file='doc\SystemFonts.uex' path='docs/doc[@for="SystemFonts.MenuFont"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the system's font for menus.
+ /// </para>
+ /// </devdoc>
+ public static Font MenuFont
+ {
+ get
+ {
+ Font menuFont = null;
+
+ NativeMethods.NONCLIENTMETRICS data = new NativeMethods.NONCLIENTMETRICS();
+ bool result = UnsafeNativeMethods.SystemParametersInfo(NativeMethods.SPI_GETNONCLIENTMETRICS, data.cbSize, data, 0);
+
+ if (result && data.lfMenuFont != null)
+ {
+ try
+ {
+ menuFont = Font.FromLogFont(data.lfMenuFont);
+ }
+ catch (Exception ex)
+ {
+ if (IsCriticalFontException(ex))
+ {
+ throw;
+ }
+ }
+
+ if (menuFont == null)
+ {
+ menuFont = DefaultFont;
+ }
+ else if (menuFont.Unit != GraphicsUnit.Point)
+ {
+ menuFont = FontInPoints(menuFont);
+ }
+ }
+
+ menuFont.SetSystemFontName("MenuFont");
+ return menuFont;
+ }
+ }
+
+ /// <include file='doc\SystemFonts.uex' path='docs/doc[@for="SystemFonts.StatusFont"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the system's font for status bars.
+ /// </para>
+ /// </devdoc>
+ public static Font StatusFont
+ {
+ get
+ {
+ Font statusFont = null;
+
+ NativeMethods.NONCLIENTMETRICS data = new NativeMethods.NONCLIENTMETRICS();
+ bool result = UnsafeNativeMethods.SystemParametersInfo(NativeMethods.SPI_GETNONCLIENTMETRICS, data.cbSize, data, 0);
+
+ if (result && data.lfStatusFont != null)
+ {
+ try
+ {
+ statusFont = Font.FromLogFont(data.lfStatusFont);
+ }
+ catch (Exception ex)
+ {
+ if (IsCriticalFontException(ex))
+ {
+ throw;
+ }
+ }
+
+ if (statusFont == null)
+ {
+ statusFont = DefaultFont;
+ }
+ else if (statusFont.Unit != GraphicsUnit.Point)
+ {
+ statusFont = FontInPoints(statusFont);
+ }
+ }
+
+ statusFont.SetSystemFontName("StatusFont");
+ return statusFont;
+ }
+ }
+
+ /// <include file='doc\SystemFonts.uex' path='docs/doc[@for="SystemFonts.MessageBoxFont"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the system's font for message boxes.
+ /// </para>
+ /// </devdoc>
+ public static Font MessageBoxFont
+ {
+ get
+ {
+ Font messageboxFont = null;
+
+ NativeMethods.NONCLIENTMETRICS data = new NativeMethods.NONCLIENTMETRICS();
+ bool result = UnsafeNativeMethods.SystemParametersInfo(NativeMethods.SPI_GETNONCLIENTMETRICS, data.cbSize, data, 0);
+
+ if (result && data.lfMessageFont != null)
+ {
+ try
+ {
+ messageboxFont = Font.FromLogFont(data.lfMessageFont);
+ }
+ catch (Exception ex)
+ {
+ if (IsCriticalFontException(ex))
+ {
+ throw;
+ }
+ }
+
+ if (messageboxFont == null)
+ {
+ messageboxFont = DefaultFont;
+ }
+ else if (messageboxFont.Unit != GraphicsUnit.Point)
+ {
+ messageboxFont = FontInPoints(messageboxFont);
+ }
+ }
+
+ messageboxFont.SetSystemFontName("MessageBoxFont");
+ return messageboxFont;
+ }
+ }
+
+ /// <devdoc>
+ /// Determines whether the specified exception should be handled.
+ /// </devdoc>
+ private static bool IsCriticalFontException(Exception ex)
+ {
+ return !(
+ // In any of these cases we'll handle the exception.
+ ex is ExternalException ||
+ ex is ArgumentException ||
+ ex is OutOfMemoryException || // GDI+ throws this one for many reasons other than actual OOM.
+ ex is InvalidOperationException ||
+ ex is NotImplementedException ||
+ ex is FileNotFoundException);
+ }
+
+ /// <include file='doc\SystemFonts.uex' path='docs/doc[@for="SystemFonts.IconTitleFont"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the system's font for icon titles.
+ /// </para>
+ /// </devdoc>
+ public static Font IconTitleFont
+ {
+ get
+ {
+ Font icontitleFont = null;
+
+ SafeNativeMethods.LOGFONT itfont = new SafeNativeMethods.LOGFONT();
+ bool result = UnsafeNativeMethods.SystemParametersInfo(NativeMethods.SPI_GETICONTITLELOGFONT, Marshal.SizeOf(itfont), itfont, 0);
+
+ if (result && itfont != null)
+ {
+ try
+ {
+ icontitleFont = Font.FromLogFont(itfont);
+ }
+ catch (Exception ex)
+ {
+ if (IsCriticalFontException(ex))
+ {
+ throw;
+ }
+ }
+
+ if (icontitleFont == null)
+ {
+ icontitleFont = DefaultFont;
+ }
+ else if (icontitleFont.Unit != GraphicsUnit.Point)
+ {
+ icontitleFont = FontInPoints(icontitleFont);
+ }
+ }
+
+ icontitleFont.SetSystemFontName("IconTitleFont");
+ return icontitleFont;
+ }
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ // //
+ // SystemFonts.DefaultFont is code moved from System.Windows.Forms.Control.DefaultFont //
+ // System.Windows.Forms.Control.DefaultFont delegates to SystemFonts.DefaultFont now. //
+ // Treat any changes to this code as you would treat breaking changes. //
+ // //
+ //////////////////////////////////////////////////////////////////////////////////////////////
+
+ /// <include file='doc\SystemFonts.uex' path='docs/doc[@for="SystemFonts.DefaultFont"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the system's default font.
+ /// </para>
+ /// </devdoc>
+ public static Font DefaultFont
+ {
+ get
+ {
+ Font defaultFont = null;
+
+ //special case defaultfont for arabic systems too
+ bool systemDefaultLCIDIsArabic = false;
+
+ // For Japanese on Win9x get the MS UI Gothic font
+ if (Environment.OSVersion.Platform == System.PlatformID.Win32NT &&
+ Environment.OSVersion.Version.Major <= 4)
+ {
+ if ((UnsafeNativeMethods.GetSystemDefaultLCID() & 0x3ff) == 0x0011)
+ {
+ try
+ {
+ defaultFont = new Font("MS UI Gothic", 9);
+ }
+ //fall through here if this fails and we'll get the default
+ //font via the DEFAULT_GUI method
+ catch (Exception ex)
+ {
+ if (IsCriticalFontException(ex))
+ {
+ throw;
+ }
+ }
+ }
+ }
+
+ if (defaultFont == null)
+ {
+ systemDefaultLCIDIsArabic = ((UnsafeNativeMethods.GetSystemDefaultLCID() & 0x3ff) == 0x0001);
+ }
+
+ // For arabic systems, regardless of the platform, always return Tahoma 8.
+ // vsWhidbey 82453.
+ if (systemDefaultLCIDIsArabic)
+ {
+ Debug.Assert(defaultFont == null);
+ // Try TAHOMA 8
+ try
+ {
+ defaultFont = new Font("Tahoma", 8);
+ }
+ catch (Exception ex)
+ {
+ if (IsCriticalFontException(ex))
+ {
+ throw;
+ }
+ }
+ }
+
+ //
+ // Neither Japanese on Win9x nor Arabic.
+ // First try DEFAULT_GUI, then Tahoma 8, then GenericSansSerif 8.
+ //
+
+ // first, try DEFAULT_GUI font.
+ //
+ if (defaultFont == null)
+ {
+ IntPtr handle = UnsafeNativeMethods.GetStockObject(NativeMethods.DEFAULT_GUI_FONT);
+ try
+ {
+ Font fontInWorldUnits = Font.FromHfont(handle);
+
+ try
+ {
+ defaultFont = FontInPoints(fontInWorldUnits);
+ }
+ finally
+ {
+ fontInWorldUnits.Dispose();
+ }
+ }
+ catch (ArgumentException)
+ {
+ }
+ }
+
+ // If DEFAULT_GUI didn't work, we try Tahoma.
+ //
+ if (defaultFont == null)
+ {
+ try
+ {
+ defaultFont = new Font("Tahoma", 8);
+ }
+ catch (ArgumentException)
+ {
+ }
+ }
+
+ // Last resort, we use the GenericSansSerif - this will
+ // always work.
+ //
+ if (defaultFont == null)
+ {
+ defaultFont = new Font(FontFamily.GenericSansSerif, 8);
+ }
+
+ if (defaultFont.Unit != GraphicsUnit.Point)
+ {
+ defaultFont = FontInPoints(defaultFont);
+ }
+
+ Debug.Assert(defaultFont != null, "defaultFont wasn't set!");
+
+ defaultFont.SetSystemFontName("DefaultFont");
+ return defaultFont;
+ }
+ }
+
+ /// <include file='doc\SystemFonts.uex' path='docs/doc[@for="SystemFonts.DialogFont"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the system's font for dialogs.
+ /// </para>
+ /// </devdoc>
+ public static Font DialogFont
+ {
+ get
+ {
+ Font dialogFont = null;
+
+ if ((UnsafeNativeMethods.GetSystemDefaultLCID() & 0x3ff) == 0x0011)
+ {
+ // for JAPANESE culture always return DefaultFont
+ dialogFont = DefaultFont;
+ }
+ else if (Environment.OSVersion.Platform == System.PlatformID.Win32Windows)
+ {
+ // use DefaultFont for Win9X
+ dialogFont = DefaultFont;
+ }
+ else
+ {
+ try
+ {
+ // use MS Shell Dlg 2, 8pt for anything else than Japanese and Win9x
+ dialogFont = new Font("MS Shell Dlg 2", 8);
+ }
+ catch (ArgumentException)
+ {
+ }
+ }
+
+ if (dialogFont == null)
+ {
+ dialogFont = DefaultFont;
+ }
+ else if (dialogFont.Unit != GraphicsUnit.Point)
+ {
+ dialogFont = FontInPoints(dialogFont);
+ }
+
+ //
+ // JAPANESE or Win9x: SystemFonts.DefaultFont returns a new Font object every time it is invoked.
+ // So for JAPANESE or Win9x we return the DefaultFont w/ its SystemFontName set to DialogFont.
+ //
+ dialogFont.SetSystemFontName("DialogFont");
+ return dialogFont;
+ }
+ }
+
+ //Copied from System.Windows.Forms.ControlPaint
+ private static Font FontInPoints(Font font)
+ {
+ return new Font(font.FontFamily, font.SizeInPoints, font.Style, GraphicsUnit.Point, font.GdiCharSet, font.GdiVerticalFont);
+ }
+ /// <include file='doc\SystemFonts.uex' path='docs/doc[@for="SystemFonts.GetFontByName"]/*' />
+ /// <devdoc>
+ /// <para>
+ /// Gets the <see cref='System.Drawing.SystemFont'/> that corresponds to a given SystemFont name.
+ /// </para>
+ /// </devdoc>
+ public static Font GetFontByName(string systemFontName)
+ {
+ if ("CaptionFont".Equals(systemFontName))
+ {
+ return CaptionFont;
+ }
+ else if ("DefaultFont".Equals(systemFontName))
+ {
+ return DefaultFont;
+ }
+ else if ("DialogFont".Equals(systemFontName))
+ {
+ return DialogFont;
+ }
+ else if ("IconTitleFont".Equals(systemFontName))
+ {
+ return IconTitleFont;
+ }
+ else if ("MenuFont".Equals(systemFontName))
+ {
+ return MenuFont;
+ }
+ else if ("MessageBoxFont".Equals(systemFontName))
+ {
+ return MessageBoxFont;
+ }
+ else if ("SmallCaptionFont".Equals(systemFontName))
+ {
+ return SmallCaptionFont;
+ }
+ else if ("StatusFont".Equals(systemFontName))
+ {
+ return StatusFont;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/SystemIcons.cs b/src/System.Drawing.Common/src/System/Drawing/SystemIcons.cs
new file mode 100644
index 0000000000..d7da484544
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/SystemIcons.cs
@@ -0,0 +1,216 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.Diagnostics.Contracts;
+
+ /// <include file='doc\SystemIcons.uex' path='docs/doc[@for="SystemIcons"]/*' />
+ /// <devdoc>
+ /// Icon objects for Windows system-wide icons.
+ /// </devdoc>
+ public sealed class SystemIcons
+ {
+ private static Icon s_application;
+ private static Icon s_asterisk;
+ private static Icon s_error;
+ private static Icon s_exclamation;
+ private static Icon s_hand;
+ private static Icon s_information;
+ private static Icon s_question;
+ private static Icon s_warning;
+ private static Icon s_winlogo;
+ private static Icon s_shield;
+
+ // not creatable...
+ //
+ private SystemIcons()
+ {
+ }
+
+ /// <include file='doc\SystemIcons.uex' path='docs/doc[@for="SystemIcons.Application"]/*' />
+ /// <devdoc>
+ /// Icon is the default Application icon. (WIN32: IDI_APPLICATION)
+ /// </devdoc>
+ public static Icon Application
+ {
+ get
+ {
+ Contract.Ensures(Contract.Result<Icon>() != null);
+
+ if (s_application == null)
+ s_application = new Icon(SafeNativeMethods.LoadIcon(NativeMethods.NullHandleRef, SafeNativeMethods.IDI_APPLICATION));
+ return s_application;
+ }
+ }
+
+ /// <include file='doc\SystemIcons.uex' path='docs/doc[@for="SystemIcons.Asterisk"]/*' />
+ /// <devdoc>
+ /// Icon is the system Asterisk icon. (WIN32: IDI_ASTERISK)
+ /// </devdoc>
+ public static Icon Asterisk
+ {
+ get
+ {
+ Contract.Ensures(Contract.Result<Icon>() != null);
+
+ if (s_asterisk == null)
+ s_asterisk = new Icon(SafeNativeMethods.LoadIcon(NativeMethods.NullHandleRef, SafeNativeMethods.IDI_ASTERISK));
+ return s_asterisk;
+ }
+ }
+
+ /// <include file='doc\SystemIcons.uex' path='docs/doc[@for="SystemIcons.Error"]/*' />
+ /// <devdoc>
+ /// Icon is the system Error icon. (WIN32: IDI_ERROR)
+ /// </devdoc>
+ public static Icon Error
+ {
+ get
+ {
+ Contract.Ensures(Contract.Result<Icon>() != null);
+
+ if (s_error == null)
+ s_error = new Icon(SafeNativeMethods.LoadIcon(NativeMethods.NullHandleRef, SafeNativeMethods.IDI_ERROR));
+ return s_error;
+ }
+ }
+
+ /// <include file='doc\SystemIcons.uex' path='docs/doc[@for="SystemIcons.Exclamation"]/*' />
+ /// <devdoc>
+ /// Icon is the system Exclamation icon. (WIN32: IDI_EXCLAMATION)
+ /// </devdoc>
+ public static Icon Exclamation
+ {
+ get
+ {
+ Contract.Ensures(Contract.Result<Icon>() != null);
+
+ if (s_exclamation == null)
+ s_exclamation = new Icon(SafeNativeMethods.LoadIcon(NativeMethods.NullHandleRef, SafeNativeMethods.IDI_EXCLAMATION));
+ return s_exclamation;
+ }
+ }
+
+ /// <include file='doc\SystemIcons.uex' path='docs/doc[@for="SystemIcons.Hand"]/*' />
+ /// <devdoc>
+ /// Icon is the system Hand icon. (WIN32: IDI_HAND)
+ /// </devdoc>
+ public static Icon Hand
+ {
+ get
+ {
+ Contract.Ensures(Contract.Result<Icon>() != null);
+
+ if (s_hand == null)
+ s_hand = new Icon(SafeNativeMethods.LoadIcon(NativeMethods.NullHandleRef, SafeNativeMethods.IDI_HAND));
+ return s_hand;
+ }
+ }
+
+ /// <include file='doc\SystemIcons.uex' path='docs/doc[@for="SystemIcons.Information"]/*' />
+ /// <devdoc>
+ /// Icon is the system Information icon. (WIN32: IDI_INFORMATION)
+ /// </devdoc>
+ public static Icon Information
+ {
+ get
+ {
+ Contract.Ensures(Contract.Result<Icon>() != null);
+
+ if (s_information == null)
+ s_information = new Icon(SafeNativeMethods.LoadIcon(NativeMethods.NullHandleRef, SafeNativeMethods.IDI_INFORMATION));
+ return s_information;
+ }
+ }
+
+ /// <include file='doc\SystemIcons.uex' path='docs/doc[@for="SystemIcons.Question"]/*' />
+ /// <devdoc>
+ /// Icon is the system Question icon. (WIN32: IDI_QUESTION)
+ /// </devdoc>
+ public static Icon Question
+ {
+ get
+ {
+ Contract.Ensures(Contract.Result<Icon>() != null);
+
+ if (s_question == null)
+ s_question = new Icon(SafeNativeMethods.LoadIcon(NativeMethods.NullHandleRef, SafeNativeMethods.IDI_QUESTION));
+ return s_question;
+ }
+ }
+
+ /// <include file='doc\SystemIcons.uex' path='docs/doc[@for="SystemIcons.Warning"]/*' />
+ /// <devdoc>
+ /// Icon is the system Warning icon. (WIN32: IDI_WARNING)
+ /// </devdoc>
+ public static Icon Warning
+ {
+ get
+ {
+ Contract.Ensures(Contract.Result<Icon>() != null);
+
+ if (s_warning == null)
+ s_warning = new Icon(SafeNativeMethods.LoadIcon(NativeMethods.NullHandleRef, SafeNativeMethods.IDI_WARNING));
+ return s_warning;
+ }
+ }
+
+ /// <include file='doc\SystemIcons.uex' path='docs/doc[@for="SystemIcons.WinLogo"]/*' />
+ /// <devdoc>
+ /// Icon is the Windows Logo icon. (WIN32: IDI_WINLOGO)
+ /// </devdoc>
+ public static Icon WinLogo
+ {
+ get
+ {
+ Contract.Ensures(Contract.Result<Icon>() != null);
+
+ if (s_winlogo == null)
+ s_winlogo = new Icon(SafeNativeMethods.LoadIcon(NativeMethods.NullHandleRef, SafeNativeMethods.IDI_WINLOGO));
+ return s_winlogo;
+ }
+ }
+
+ /// <include file='doc\SystemIcons.uex' path='docs/doc[@for="SystemIcons.Shield"]/*' />
+ /// <devdoc>
+ /// Icon is the Windows Shield Icon.
+ /// </devdoc>
+ public static Icon Shield
+ {
+ get
+ {
+ Contract.Ensures(Contract.Result<Icon>() != null);
+
+ if (s_shield == null)
+ {
+ try
+ {
+ // IDI_SHIELD is defined in OS Vista and above
+ if (Environment.OSVersion.Version.Major >= 6)
+ {
+ // we hard-code size here, to prevent breaking change
+ // the size of _shield before this change is always 32 * 32
+ IntPtr hIcon = IntPtr.Zero;
+ int result = SafeNativeMethods.LoadIconWithScaleDown(NativeMethods.NullHandleRef, SafeNativeMethods.IDI_SHIELD, 32, 32, ref hIcon);
+
+ if (result == 0)
+ s_shield = new Icon(hIcon);
+ }
+ }
+ catch
+ {
+ // we don't want to throw exception here.
+ // If there is an exception, we will load an icon from file ShieldIcon.ico
+ }
+ }
+ if (s_shield == null)
+ {
+ s_shield = new Icon(typeof(SystemIcons), "ShieldIcon.ico");
+ }
+ return s_shield;
+ }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/SystemPens.cs b/src/System.Drawing.Common/src/System/Drawing/SystemPens.cs
new file mode 100644
index 0000000000..2e759b9564
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/SystemPens.cs
@@ -0,0 +1,457 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.Diagnostics;
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens"]/*' />
+ /// <devdoc>
+ /// Pens for select Windows system-wide colors. Whenever possible, try to use
+ /// SystemPens and SystemBrushes rather than SystemColors.
+ /// </devdoc>
+ public sealed class SystemPens
+ {
+ private static readonly object s_systemPensKey = new object();
+
+ private SystemPens()
+ {
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.ActiveBorder"]/*' />
+ /// <devdoc>
+ /// Pen is the color of the filled area of an active window border.
+ /// </devdoc>
+ public static Pen ActiveBorder
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.ActiveBorder);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.ActiveCaption"]/*' />
+ /// <devdoc>
+ /// Pen is the color of the background of an active title bar caption.
+ /// </devdoc>
+ public static Pen ActiveCaption
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.ActiveCaption);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.ActiveCaptionText"]/*' />
+ /// <devdoc>
+ /// Pen is the color of the active window's caption text.
+ /// </devdoc>
+ public static Pen ActiveCaptionText
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.ActiveCaptionText);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.AppWorkspace"]/*' />
+ /// <devdoc>
+ /// Pen is the color of the application workspace. The application workspace
+ /// is the area in a multiple document view that is not being occupied
+ /// by documents.
+ /// </devdoc>
+ public static Pen AppWorkspace
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.AppWorkspace);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.ButtonFace"]/*' />
+ /// <devdoc>
+ /// Pen for the ButtonFace system color.
+ /// </devdoc>
+ public static Pen ButtonFace
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.ButtonFace);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.ButtonHighlight"]/*' />
+ /// <devdoc>
+ /// Pen for the ButtonHighlight system color.
+ /// </devdoc>
+ public static Pen ButtonHighlight
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.ButtonHighlight);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.ButtonShadow"]/*' />
+ /// <devdoc>
+ /// Pen for the ButtonShadow system color.
+ /// </devdoc>
+ public static Pen ButtonShadow
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.ButtonShadow);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.Control"]/*' />
+ /// <devdoc>
+ /// Pen is the color of a button or control.
+ /// </devdoc>
+ public static Pen Control
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.Control);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.ControlText"]/*' />
+ /// <devdoc>
+ /// Pen is the color of the text on a button or control.
+ /// </devdoc>
+ public static Pen ControlText
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.ControlText);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.ControlDark"]/*' />
+ /// <devdoc>
+ /// Pen is the color of the shadow part of a 3D element
+ /// </devdoc>
+ public static Pen ControlDark
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.ControlDark);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.ControlDarkDark"]/*' />
+ /// <devdoc>
+ /// Pen is the color of the darkest part of a 3D element
+ /// </devdoc>
+ public static Pen ControlDarkDark
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.ControlDarkDark);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.ControlLight"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Pen ControlLight
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.ControlLight);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.ControlLightLight"]/*' />
+ /// <devdoc>
+ /// Pen is the color of the lightest part of a 3D element
+ /// </devdoc>
+ public static Pen ControlLightLight
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.ControlLightLight);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.Desktop"]/*' />
+ /// <devdoc>
+ /// Pen is the color of the desktop.
+ /// </devdoc>
+ public static Pen Desktop
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.Desktop);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.GradientActiveCaption"]/*' />
+ /// <devdoc>
+ /// Pen for the GradientActiveCaption system color.
+ /// </devdoc>
+ public static Pen GradientActiveCaption
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.GradientActiveCaption);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.GradientInactiveCaption"]/*' />
+ /// <devdoc>
+ /// Pen for the GradientInactiveCaption system color.
+ /// </devdoc>
+ public static Pen GradientInactiveCaption
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.GradientInactiveCaption);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.GrayText"]/*' />
+ /// <devdoc>
+ /// Pen is the color of disabled text.
+ /// </devdoc>
+ public static Pen GrayText
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.GrayText);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.Highlight"]/*' />
+ /// <devdoc>
+ /// Pen is the color of a highlighted background.
+ /// </devdoc>
+ public static Pen Highlight
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.Highlight);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.HighlightText"]/*' />
+ /// <devdoc>
+ /// Pen is the color of highlighted text.
+ /// </devdoc>
+ public static Pen HighlightText
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.HighlightText);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.HotTrack"]/*' />
+ /// <devdoc>
+ /// Pen is the color used to represent hot tracking.
+ /// </devdoc>
+ public static Pen HotTrack
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.HotTrack);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.InactiveBorder"]/*' />
+ /// <devdoc>
+ /// Pen is the color if an inactive window border.
+ /// </devdoc>
+ public static Pen InactiveBorder
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.InactiveBorder);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.InactiveCaption"]/*' />
+ /// <devdoc>
+ /// Pen is the color of an inactive caption bar.
+ /// </devdoc>
+ public static Pen InactiveCaption
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.InactiveCaption);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.InactiveCaptionText"]/*' />
+ /// <devdoc>
+ /// Pen is the color of an inactive window's caption text.
+ /// </devdoc>
+ public static Pen InactiveCaptionText
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.InactiveCaptionText);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.Info"]/*' />
+ /// <devdoc>
+ /// Pen is the color of the info tooltip's background.
+ /// </devdoc>
+ public static Pen Info
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.Info);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.InfoText"]/*' />
+ /// <devdoc>
+ /// Pen is the color of the info tooltip's text.
+ /// </devdoc>
+ public static Pen InfoText
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.InfoText);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.Menu"]/*' />
+ /// <devdoc>
+ /// Pen is the color of the background of a menu.
+ /// </devdoc>
+ public static Pen Menu
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.Menu);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.MenuBar"]/*' />
+ /// <devdoc>
+ /// Pen is the color of the background of a menu bar.
+ /// </devdoc>
+ public static Pen MenuBar
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.MenuBar);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.MenuHighlight"]/*' />
+ /// <devdoc>
+ /// Pen for the MenuHighlight system color.
+ /// </devdoc>
+ public static Pen MenuHighlight
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.MenuHighlight);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.MenuText"]/*' />
+ /// <devdoc>
+ /// Pen is the color of the menu text.
+ /// </devdoc>
+ public static Pen MenuText
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.MenuText);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.ScrollBar"]/*' />
+ /// <devdoc>
+ /// Pen is the color of the scroll bar area that is not being used by the
+ /// thumb button.
+ /// </devdoc>
+ public static Pen ScrollBar
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.ScrollBar);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.Window"]/*' />
+ /// <devdoc>
+ /// Pen is the color of the client area of a window.
+ /// </devdoc>
+ public static Pen Window
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.Window);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.WindowFrame"]/*' />
+ /// <devdoc>
+ /// Pen is the color of the window frame.
+ /// </devdoc>
+ public static Pen WindowFrame
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.WindowFrame);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.WindowText"]/*' />
+ /// <devdoc>
+ /// Pen is the color of a window's text.
+ /// </devdoc>
+ public static Pen WindowText
+ {
+ get
+ {
+ return FromSystemColor(SystemColors.WindowText);
+ }
+ }
+
+ /// <include file='doc\SystemPens.uex' path='docs/doc[@for="SystemPens.FromSystemColor"]/*' />
+ /// <devdoc>
+ /// Retrieves a pen given a system color. An error will be raised
+ /// if the color provide is not a system color.
+ /// </devdoc>
+ public static Pen FromSystemColor(Color c)
+ {
+ if (!c.IsSystemColor)
+ {
+ throw new ArgumentException(SR.Format(SR.ColorNotSystemColor, c.ToString()));
+ }
+
+ Pen[] systemPens = (Pen[])SafeNativeMethods.Gdip.ThreadData[s_systemPensKey];
+ if (systemPens == null)
+ {
+ systemPens = new Pen[(int)KnownColor.WindowText + (int)KnownColor.MenuHighlight - (int)KnownColor.YellowGreen];
+ SafeNativeMethods.Gdip.ThreadData[s_systemPensKey] = systemPens;
+ }
+
+ int idx = (int)c.ToKnownColor();
+ if (idx > (int)KnownColor.YellowGreen)
+ {
+ idx -= (int)KnownColor.YellowGreen - (int)KnownColor.WindowText;
+ }
+ idx--;
+ Debug.Assert(idx >= 0 && idx < systemPens.Length, "System colors have been added but our system color array has not been expanded.");
+
+ if (systemPens[idx] == null)
+ {
+ systemPens[idx] = new Pen(c, true);
+ }
+
+ return systemPens[idx];
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/System/Drawing/ToolboxBitmapAttribute.cs b/src/System.Drawing.Common/src/System/Drawing/ToolboxBitmapAttribute.cs
new file mode 100644
index 0000000000..34ea3cc181
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/ToolboxBitmapAttribute.cs
@@ -0,0 +1,516 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.Diagnostics;
+ using System.Globalization;
+ using System.IO;
+ using DpiHelper = System.Windows.Forms.DpiHelper;
+
+ /// <include file='doc\ToolboxBitmapAttribute.uex' path='docs/doc[@for="ToolboxBitmapAttribute"]/*' />
+ /// <devdoc>
+ /// ToolboxBitmapAttribute defines the images associated with
+ /// a specified component. The component can offer a small
+ /// and large image (large is optional).
+ ///
+ /// </devdoc>
+ [AttributeUsage(AttributeTargets.Class)]
+ public class ToolboxBitmapAttribute : Attribute
+ {
+ /// <include file='doc\ToolboxBitmapAttribute.uex' path='docs/doc[@for="ToolboxBitmapAttribute.smallImage"]/*' />
+ /// <devdoc>
+ /// The small image for this component
+ /// </devdoc>
+ private Image _smallImage;
+
+ /// <include file='doc\ToolboxBitmapAttribute.uex' path='docs/doc[@for="ToolboxBitmapAttribute.largeImage"]/*' />
+ /// <devdoc>
+ /// The large image for this component.
+ /// </devdoc>
+ private Image _largeImage;
+
+ /// <include file='doc\ToolboxBitmapAttribute.uex' path='docs/doc[@for="ToolboxBitmapAttribute.originalBitmap"]/*' />
+ /// <devdoc>
+ /// The original small image for this component, before scaling per DPI.
+ /// </devdoc>
+ private Bitmap _originalBitmap;
+
+ /// <include file='doc\ToolboxBitmapAttribute.uex' path='docs/doc[@for="ToolboxBitmapAttribute.imageFile"]/*' />
+ /// <devdoc>
+ /// The path to the image file for this toolbox item, if any.
+ /// </devdoc>
+ private string _imageFile;
+
+ /// <include file='doc\ToolboxBitmapAttribute.uex' path='docs/doc[@for="ToolboxBitmapAttribute.imagetype"]/*' />
+ /// <devdoc>
+ /// The Type used to retrieve the toolbox image for this component, if provided upon initialization of this class.
+ /// </devdoc>
+ private Type _imageType;
+
+ /// <include file='doc\ToolboxBitmapAttribute.uex' path='docs/doc[@for="ToolboxBitmapAttribute.imageName"]/*' />
+ /// <devdoc>
+ /// The resource name of the toolbox image for the component, if provided upon initialization of this class.
+ /// </devdoc>
+ private string _imageName;
+
+ /// <include file='doc\ToolboxBitmapAttribute.uex' path='docs/doc[@for="ToolboxBitmapAttribute.largeSize"]/*' />
+ /// <devdoc>
+ /// The default size of the large image.
+ /// </devdoc>
+ private static readonly Size s_largeSize = new Size(32, 32);
+
+ /// <include file='doc\ToolboxBitmapAttribute.uex' path='docs/doc[@for="ToolboxBitmapAttribute.smallSize"]/*' />
+ /// <devdoc>
+ /// The default size of the large image.
+ /// </devdoc>
+ private static readonly Size s_smallSize = new Size(16, 16);
+
+ // Used to help cache the last result of BitmapSelector.GetFileName
+ private static string s_lastOriginalFileName;
+ private static string s_lastUpdatedFileName;
+
+ /// <include file='doc\ToolboxBitmapAttribute.uex' path='docs/doc[@for="ToolboxBitmapAttribute.ToolboxBitmapAttribute"]/*' />
+ /// <devdoc>
+ /// Constructs a new ToolboxBitmapAttribute.
+ /// </devdoc>
+ public ToolboxBitmapAttribute(string imageFile)
+ : this(GetImageFromFile(imageFile, false), GetImageFromFile(imageFile, true))
+ {
+ _imageFile = imageFile;
+ }
+
+ /// <include file='doc\ToolboxBitmapAttribute.uex' path='docs/doc[@for="ToolboxBitmapAttribute.ToolboxBitmapAttribute1"]/*' />
+ /// <devdoc>
+ /// Constructs a new ToolboxBitmapAttribute.
+ /// </devdoc>
+ public ToolboxBitmapAttribute(Type t)
+ : this(GetImageFromResource(t, null, false), GetImageFromResource(t, null, true))
+ {
+ _imageType = t;
+ }
+
+ /// <include file='doc\ToolboxBitmapAttribute.uex' path='docs/doc[@for="ToolboxBitmapAttribute.ToolboxBitmapAttribute2"]/*' />
+ /// <devdoc>
+ /// Constructs a new ToolboxBitmapAttribute.
+ /// </devdoc>
+ public ToolboxBitmapAttribute(Type t, string name)
+ : this(GetImageFromResource(t, name, false), GetImageFromResource(t, name, true))
+ {
+ _imageType = t;
+ _imageName = name;
+ }
+
+
+ /// <include file='doc\ToolboxBitmapAttribute.uex' path='docs/doc[@for="ToolboxBitmapAttribute.ToolboxBitmapAttribute3"]/*' />
+ /// <devdoc>
+ /// Constructs a new ToolboxBitmapAttribute.
+ /// </devdoc>
+ private ToolboxBitmapAttribute(Image smallImage, Image largeImage)
+ {
+ _smallImage = smallImage;
+ _largeImage = largeImage;
+ }
+
+ /// <include file='doc\ToolboxBitmapAttribute.uex' path='docs/doc[@for="ToolboxBitmapAttribute.Equals"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public override bool Equals(object value)
+ {
+ if (value == this)
+ {
+ return true;
+ }
+
+ ToolboxBitmapAttribute attr = value as ToolboxBitmapAttribute;
+ if (attr != null)
+ {
+ return attr._smallImage == _smallImage && attr._largeImage == _largeImage;
+ }
+
+ return false;
+ }
+
+ /// <include file='doc\ToolboxBitmapAttribute.uex' path='docs/doc[@for="ToolboxBitmapAttribute.GetHashCode"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+
+ /// <include file='doc\ToolboxBitmapAttribute.uex' path='docs/doc[@for="ToolboxBitmapAttribute.GetImage"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public Image GetImage(object component)
+ {
+ return GetImage(component, true);
+ }
+ /// <include file='doc\ToolboxBitmapAttribute.uex' path='docs/doc[@for="ToolboxBitmapAttribute.GetImage1"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public Image GetImage(object component, bool large)
+ {
+ if (component != null)
+ {
+ return GetImage(component.GetType(), large);
+ }
+ return null;
+ }
+ /// <include file='doc\ToolboxBitmapAttribute.uex' path='docs/doc[@for="ToolboxBitmapAttribute.GetImage2"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public Image GetImage(Type type)
+ {
+ return GetImage(type, false);
+ }
+
+ /// <include file='doc\ToolboxBitmapAttribute.uex' path='docs/doc[@for="ToolboxBitmapAttribute.GetImage3"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public Image GetImage(Type type, bool large)
+ {
+ return GetImage(type, null, large);
+ }
+
+ /// <include file='doc\ToolboxBitmapAttribute.uex' path='docs/doc[@for="ToolboxBitmapAttribute.GetImage4"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public Image GetImage(Type type, string imgName, bool large)
+ {
+ if ((large && _largeImage == null) ||
+ (!large && _smallImage == null))
+ {
+ Image img = null;
+ if (large)
+ {
+ img = _largeImage;
+ }
+ else
+ {
+ img = _smallImage;
+ }
+
+ if (img == null)
+ {
+ img = GetImageFromResource(type, imgName, large);
+ }
+
+ //last resort for large images.
+ if (large && _largeImage == null && _smallImage != null)
+ {
+ img = new Bitmap((Bitmap)_smallImage, s_largeSize.Width, s_largeSize.Height);
+ }
+
+ Bitmap b = img as Bitmap;
+
+ if (b != null)
+ {
+ MakeBackgroundAlphaZero(b);
+ }
+
+ if (img == null)
+ {
+ img = s_defaultComponent.GetImage(type, large);
+ }
+
+ if (large)
+ {
+ _largeImage = img;
+ }
+ else
+ {
+ _smallImage = img;
+ }
+ }
+
+ Image toReturn = (large) ? _largeImage : _smallImage;
+
+ if (Equals(Default))
+ {
+ _largeImage = null;
+ _smallImage = null;
+ }
+
+ return toReturn;
+ }
+
+ internal Bitmap GetOriginalBitmap()
+ {
+ if (_originalBitmap != null)
+ {
+ return _originalBitmap;
+ }
+
+ // If the control does not have a toolbox icon associated with it, then exit.
+ if (_smallImage == null)
+ {
+ return null;
+ }
+
+ // If we are not scaling for DPI, then the small icon had not been modified
+ if (!DpiHelper.IsScalingRequired)
+ {
+ return null;
+ }
+
+ // Get small unscaled icon (toolbox can handle only 16x16).
+ if (!string.IsNullOrEmpty(_imageFile))
+ {
+ _originalBitmap = GetImageFromFile(_imageFile, false, false) as Bitmap;
+ }
+ else if (_imageType != null)
+ {
+ _originalBitmap = GetImageFromResource(_imageType, _imageName, false, false) as Bitmap;
+ }
+
+ return _originalBitmap;
+ }
+
+ //helper to get the right icon from the given stream that represents an icon
+ private static Image GetIconFromStream(Stream stream, bool large, bool scaled)
+ {
+ if (stream == null)
+ {
+ return null;
+ }
+ Icon ico = new Icon(stream);
+ Icon sizedico = new Icon(ico, large ? s_largeSize : s_smallSize);
+ Bitmap b = sizedico.ToBitmap();
+ if (DpiHelper.IsScalingRequired && scaled)
+ {
+ DpiHelper.ScaleBitmapLogicalToDevice(ref b);
+ }
+ return b;
+ }
+
+ // Cache the last result of BitmapSelector.GetFileName because we commonly load images twice
+ // in succession from the same file and we don't need to compute the name twice.
+ private static string GetFileNameFromBitmapSelector(string originalName)
+ {
+ if (originalName != s_lastOriginalFileName)
+ {
+ s_lastOriginalFileName = originalName;
+ s_lastUpdatedFileName = BitmapSelector.GetFileName(originalName);
+ }
+
+ return s_lastUpdatedFileName;
+ }
+
+ // Just forwards to Image.FromFile eating any non-critical exceptions that may result.
+ private static Image GetImageFromFile(string imageFile, bool large, bool scaled = true)
+ {
+ Image image = null;
+ try
+ {
+ if (imageFile != null)
+ {
+ imageFile = GetFileNameFromBitmapSelector(imageFile);
+
+ string ext = Path.GetExtension(imageFile);
+ if (ext != null && string.Equals(ext, ".ico", StringComparison.OrdinalIgnoreCase))
+ {
+ //ico files support both large and small, so we respect the large flag here.
+
+ FileStream reader = System.IO.File.Open(imageFile, FileMode.Open);
+ if (reader != null)
+ {
+ try
+ {
+ image = GetIconFromStream(reader, large, scaled);
+ }
+ finally
+ {
+ reader.Close();
+ }
+ }
+ }
+ else if (!large)
+ {
+ //we only read small from non-ico files.
+ image = Image.FromFile(imageFile);
+ Bitmap b = image as Bitmap;
+ if (DpiHelper.IsScalingRequired && scaled)
+ {
+ DpiHelper.ScaleBitmapLogicalToDevice(ref b);
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ if (ClientUtils.IsCriticalException(e))
+ {
+ throw;
+ }
+ Debug.Fail("Failed to load toolbox image '" + imageFile + "':\r\n" + e.ToString());
+ }
+
+ return image;
+ }
+
+ static private Image GetBitmapFromResource(Type t, string bitmapname, bool large, bool scaled)
+ {
+ if (bitmapname == null)
+ {
+ return null;
+ }
+
+ Image img = null;
+
+ // load the image from the manifest resources.
+ //
+ Stream stream = BitmapSelector.GetResourceStream(t, bitmapname);
+ if (stream != null)
+ {
+ Bitmap b = new Bitmap(stream);
+ img = b;
+ MakeBackgroundAlphaZero(b);
+ if (large)
+ {
+ img = new Bitmap(b, s_largeSize.Width, s_largeSize.Height);
+ }
+ if (DpiHelper.IsScalingRequired && scaled)
+ {
+ b = (Bitmap)img;
+ DpiHelper.ScaleBitmapLogicalToDevice(ref b);
+ img = b;
+ }
+ }
+ return img;
+ }
+
+ static private Image GetIconFromResource(Type t, string bitmapname, bool large, bool scaled)
+ {
+ if (bitmapname == null)
+ {
+ return null;
+ }
+
+ return GetIconFromStream(BitmapSelector.GetResourceStream(t, bitmapname), large, scaled);
+ }
+
+ /// <include file='doc\ToolboxBitmapAttribute.uex' path='docs/doc[@for="ToolboxBitmapAttribute.GetImageFromResource"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ public static Image GetImageFromResource(Type t, string imageName, bool large)
+ {
+ return GetImageFromResource(t, imageName, large, true /*scaled*/);
+ }
+
+ /// <include file='doc\ToolboxBitmapAttribute.uex' path='docs/doc[@for="ToolboxBitmapAttribute.GetImageFromResource"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ internal static Image GetImageFromResource(Type t, string imageName, bool large, bool scaled)
+ {
+ Image img = null;
+ try
+ {
+ string name = imageName;
+ string iconname = null;
+ string bmpname = null;
+ string rawbmpname = null;
+
+ // if we didn't get a name, use the class name
+ //
+ if (name == null)
+ {
+ name = t.FullName;
+ int indexDot = name.LastIndexOf('.');
+ if (indexDot != -1)
+ {
+ name = name.Substring(indexDot + 1);
+ }
+ iconname = name + ".ico";
+ bmpname = name + ".bmp";
+ }
+ else
+ {
+ if (String.Compare(Path.GetExtension(imageName), ".ico", true, CultureInfo.CurrentCulture) == 0)
+ {
+ iconname = name;
+ }
+ else if (String.Compare(Path.GetExtension(imageName), ".bmp", true, CultureInfo.CurrentCulture) == 0)
+ {
+ bmpname = name;
+ }
+ else
+ {
+ //we dont recognize the name as either bmp or ico. we need to try three things.
+ //1. the name as a bitmap (back compat)
+ //2. name+.bmp
+ //3. name+.ico
+ rawbmpname = name;
+ bmpname = name + ".bmp";
+ iconname = name + ".ico";
+ }
+ }
+ if (rawbmpname != null)
+ {
+ img = GetBitmapFromResource(t, rawbmpname, large, scaled);
+ }
+ if (img == null && bmpname != null)
+ {
+ img = GetBitmapFromResource(t, bmpname, large, scaled);
+ }
+ if (img == null && iconname != null)
+ {
+ img = GetIconFromResource(t, iconname, large, scaled);
+ }
+ }
+ catch (Exception e)
+ {
+ if (t == null)
+ {
+ Debug.Fail("Failed to load toolbox image for null type:\r\n" + e.ToString());
+ }
+ else
+ {
+ Debug.Fail("Failed to load toolbox image for '" + t.FullName + "':\r\n" + e.ToString());
+ }
+ }
+ return img;
+ }
+
+ private static void MakeBackgroundAlphaZero(Bitmap img)
+ {
+ Color bottomLeft = img.GetPixel(0, img.Height - 1);
+ img.MakeTransparent();
+
+ Color newBottomLeft = Color.FromArgb(0, bottomLeft);
+ img.SetPixel(0, img.Height - 1, newBottomLeft);
+ }
+
+ /// <include file='doc\ToolboxBitmapAttribute.uex' path='docs/doc[@for="ToolboxBitmapAttribute.Default"]/*' />
+ /// <devdoc>
+ /// Default name is null
+ /// </devdoc>
+ public static readonly ToolboxBitmapAttribute Default = new ToolboxBitmapAttribute((Image)null, (Image)null);
+
+ private static readonly ToolboxBitmapAttribute s_defaultComponent;
+ static ToolboxBitmapAttribute()
+ {
+ //Fix for Dev10 560430. When we call Gdip.DummyFunction, JIT will make sure Gdip..cctor will be called before
+ SafeNativeMethods.Gdip.DummyFunction();
+
+ Bitmap bitmap = null;
+ Stream stream = BitmapSelector.GetResourceStream(typeof(ToolboxBitmapAttribute), "DefaultComponent.bmp");
+ if (stream != null)
+ {
+ bitmap = new Bitmap(stream);
+ MakeBackgroundAlphaZero(bitmap);
+ }
+ s_defaultComponent = new ToolboxBitmapAttribute(bitmap, null);
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/System/Drawing/UnsafeNativeMethods.cs b/src/System.Drawing.Common/src/System/Drawing/UnsafeNativeMethods.cs
new file mode 100644
index 0000000000..0355ed1945
--- /dev/null
+++ b/src/System.Drawing.Common/src/System/Drawing/UnsafeNativeMethods.cs
@@ -0,0 +1,361 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.IO;
+ using System.Runtime.InteropServices;
+ using System.Security.Permissions;
+
+ [
+ System.Security.SuppressUnmanagedCodeSecurityAttribute()
+ ]
+ internal class UnsafeNativeMethods
+ {
+ [DllImport(ExternDll.Kernel32, SetLastError = true, ExactSpelling = true, EntryPoint = "RtlMoveMemory", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern void CopyMemory(HandleRef destData, HandleRef srcData, int size);
+
+ [DllImport(ExternDll.User32, SetLastError = true, ExactSpelling = true, EntryPoint = "GetDC", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ private static extern IntPtr IntGetDC(HandleRef hWnd);
+ public static IntPtr GetDC(HandleRef hWnd)
+ {
+ return System.Internal.HandleCollector.Add(IntGetDC(hWnd), SafeNativeMethods.CommonHandles.HDC);
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "DeleteDC", CharSet = CharSet.Auto)]
+ private static extern bool IntDeleteDC(HandleRef hDC);
+ public static bool DeleteDC(HandleRef hDC)
+ {
+ System.Internal.HandleCollector.Remove((IntPtr)hDC, SafeNativeMethods.CommonHandles.GDI);
+ return IntDeleteDC(hDC);
+ }
+
+ [DllImport(ExternDll.User32, SetLastError = true, ExactSpelling = true, EntryPoint = "ReleaseDC", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ private static extern int IntReleaseDC(HandleRef hWnd, HandleRef hDC);
+ public static int ReleaseDC(HandleRef hWnd, HandleRef hDC)
+ {
+ System.Internal.HandleCollector.Remove((IntPtr)hDC, SafeNativeMethods.CommonHandles.HDC);
+ return IntReleaseDC(hWnd, hDC);
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "CreateCompatibleDC", CharSet = CharSet.Auto)]
+ private static extern IntPtr IntCreateCompatibleDC(HandleRef hDC);
+ public static IntPtr CreateCompatibleDC(HandleRef hDC)
+ {
+ return System.Internal.HandleCollector.Add(IntCreateCompatibleDC(hDC), SafeNativeMethods.CommonHandles.GDI);
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)]
+ public static extern IntPtr GetStockObject(int nIndex);
+
+ [DllImport(ExternDll.Kernel32, SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetSystemDefaultLCID();
+
+ [DllImport(ExternDll.User32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetSystemMetrics(int nIndex);
+
+ [DllImport(ExternDll.User32, SetLastError = true, CharSet = CharSet.Auto, BestFitMapping = false)]
+ public static extern bool SystemParametersInfo(int uiAction, int uiParam, [In, Out] NativeMethods.NONCLIENTMETRICS pvParam, int fWinIni);
+
+ [DllImport(ExternDll.User32, SetLastError = true, CharSet = CharSet.Auto, BestFitMapping = false)]
+ public static extern bool SystemParametersInfo(int uiAction, int uiParam, [In, Out] SafeNativeMethods.LOGFONT pvParam, int fWinIni);
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetDeviceCaps(HandleRef hDC, int nIndex);
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)]
+ public static extern int GetObjectType(HandleRef hObject);
+
+ // SECUNDONE : For some reason "PtrToStructure" requires super high permission.. put this
+ // : assert here until we can get a resolution on this.
+ // : this is ok as long as the lparam is not obtained from external code.
+ [ReflectionPermission(SecurityAction.Assert, Unrestricted = true),
+ SecurityPermission(SecurityAction.Assert, Flags = SecurityPermissionFlag.UnmanagedCode)]
+ public static object PtrToStructure(IntPtr lparam, Type cls)
+ {
+ return Marshal.PtrToStructure(lparam, cls);
+ }
+
+ // SECUNDONE : For some reason "PtrToStructure" requires super high permission.. put this
+ // : assert here until we can get a resolution on this.
+ // : this is ok as long as the lparam is not obtained from external code.
+ [ReflectionPermission(SecurityAction.Assert, Unrestricted = true),
+ SecurityPermission(SecurityAction.Assert, Flags = SecurityPermissionFlag.UnmanagedCode)]
+ public static void PtrToStructure(IntPtr lparam, object data)
+ {
+ Marshal.PtrToStructure(lparam, data);
+ }
+
+ [ComImport(), Guid("0000000C-0000-0000-C000-000000000046"), System.Runtime.InteropServices.InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)]
+ public interface IStream
+ {
+ int Read(
+ [In]
+ IntPtr buf,
+ [In]
+ int len);
+
+
+ int Write(
+ [In]
+ IntPtr buf,
+ [In]
+ int len);
+
+ [return: MarshalAs(UnmanagedType.I8)]
+ long Seek(
+ [In, MarshalAs(UnmanagedType.I8)]
+ long dlibMove,
+ [In]
+ int dwOrigin);
+
+
+ void SetSize(
+ [In, MarshalAs(UnmanagedType.I8)]
+ long libNewSize);
+
+ [return: MarshalAs(UnmanagedType.I8)]
+ long CopyTo(
+ [In, MarshalAs(UnmanagedType.Interface)]
+ UnsafeNativeMethods.IStream pstm,
+ [In, MarshalAs(UnmanagedType.I8)]
+ long cb,
+ [Out, MarshalAs(UnmanagedType.LPArray)]
+ long[] pcbRead);
+
+
+ void Commit(
+ [In]
+ int grfCommitFlags);
+
+
+ void Revert();
+
+
+ void LockRegion(
+ [In, MarshalAs(UnmanagedType.I8)]
+ long libOffset,
+ [In, MarshalAs(UnmanagedType.I8)]
+ long cb,
+ [In]
+ int dwLockType);
+
+
+ void UnlockRegion(
+ [In, MarshalAs(UnmanagedType.I8)]
+ long libOffset,
+ [In, MarshalAs(UnmanagedType.I8)]
+ long cb,
+ [In]
+ int dwLockType);
+
+
+ void Stat(
+ [In]
+ IntPtr pStatstg,
+ [In]
+ int grfStatFlag);
+
+ [return: MarshalAs(UnmanagedType.Interface)]
+ UnsafeNativeMethods.IStream Clone();
+ }
+
+ internal class ComStreamFromDataStream : IStream
+ {
+ protected Stream dataStream;
+
+ // to support seeking ahead of the stream length...
+ private long _virtualPosition = -1;
+
+ internal ComStreamFromDataStream(Stream dataStream)
+ {
+ if (dataStream == null) throw new ArgumentNullException("dataStream");
+ this.dataStream = dataStream;
+ }
+
+ private void ActualizeVirtualPosition()
+ {
+ if (_virtualPosition == -1) return;
+
+ if (_virtualPosition > dataStream.Length)
+ dataStream.SetLength(_virtualPosition);
+
+ dataStream.Position = _virtualPosition;
+
+ _virtualPosition = -1;
+ }
+
+ public virtual IStream Clone()
+ {
+ NotImplemented();
+ return null;
+ }
+
+ public virtual void Commit(int grfCommitFlags)
+ {
+ dataStream.Flush();
+ // Extend the length of the file if needed.
+ ActualizeVirtualPosition();
+ }
+
+ public virtual long CopyTo(IStream pstm, long cb, long[] pcbRead)
+ {
+ int bufsize = 4096; // one page
+ IntPtr buffer = Marshal.AllocHGlobal(bufsize);
+ if (buffer == IntPtr.Zero) throw new OutOfMemoryException();
+ long written = 0;
+ try
+ {
+ while (written < cb)
+ {
+ int toRead = bufsize;
+ if (written + toRead > cb) toRead = (int)(cb - written);
+ int read = Read(buffer, toRead);
+ if (read == 0) break;
+ if (pstm.Write(buffer, read) != read)
+ {
+ throw EFail("Wrote an incorrect number of bytes");
+ }
+ written += read;
+ }
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(buffer);
+ }
+ if (pcbRead != null && pcbRead.Length > 0)
+ {
+ pcbRead[0] = written;
+ }
+
+ return written;
+ }
+
+ public virtual Stream GetDataStream()
+ {
+ return dataStream;
+ }
+
+ public virtual void LockRegion(long libOffset, long cb, int dwLockType)
+ {
+ }
+
+ protected static ExternalException EFail(string msg)
+ {
+ throw new ExternalException(msg, SafeNativeMethods.E_FAIL);
+ }
+
+ protected static void NotImplemented()
+ {
+ throw new ExternalException(SR.Format(SR.NotImplemented), SafeNativeMethods.E_NOTIMPL);
+ }
+
+ public virtual int Read(IntPtr buf, /* cpr: int offset,*/ int length)
+ {
+ // System.Text.Out.WriteLine("IStream::Read(" + length + ")");
+ byte[] buffer = new byte[length];
+ int count = Read(buffer, length);
+ Marshal.Copy(buffer, 0, buf, length);
+ return count;
+ }
+
+ public virtual int Read(byte[] buffer, /* cpr: int offset,*/ int length)
+ {
+ ActualizeVirtualPosition();
+ return dataStream.Read(buffer, 0, length);
+ }
+
+ public virtual void Revert()
+ {
+ NotImplemented();
+ }
+
+ public virtual long Seek(long offset, int origin)
+ {
+ // Console.WriteLine("IStream::Seek("+ offset + ", " + origin + ")");
+ long pos = _virtualPosition;
+ if (_virtualPosition == -1)
+ {
+ pos = dataStream.Position;
+ }
+ long len = dataStream.Length;
+ switch (origin)
+ {
+ case SafeNativeMethods.StreamConsts.STREAM_SEEK_SET:
+ if (offset <= len)
+ {
+ dataStream.Position = offset;
+ _virtualPosition = -1;
+ }
+ else
+ {
+ _virtualPosition = offset;
+ }
+ break;
+ case SafeNativeMethods.StreamConsts.STREAM_SEEK_END:
+ if (offset <= 0)
+ {
+ dataStream.Position = len + offset;
+ _virtualPosition = -1;
+ }
+ else
+ {
+ _virtualPosition = len + offset;
+ }
+ break;
+ case SafeNativeMethods.StreamConsts.STREAM_SEEK_CUR:
+ if (offset + pos <= len)
+ {
+ dataStream.Position = pos + offset;
+ _virtualPosition = -1;
+ }
+ else
+ {
+ _virtualPosition = offset + pos;
+ }
+ break;
+ }
+ if (_virtualPosition != -1)
+ {
+ return _virtualPosition;
+ }
+ else
+ {
+ return dataStream.Position;
+ }
+ }
+
+ public virtual void SetSize(long value)
+ {
+ dataStream.SetLength(value);
+ }
+
+ public virtual void Stat(IntPtr pstatstg, int grfStatFlag)
+ {
+ // GpStream has a partial implementation, but it's so partial rather
+ // restrict it to use with GDI+
+ NotImplemented();
+ }
+
+ public virtual void UnlockRegion(long libOffset, long cb, int dwLockType)
+ {
+ }
+
+ public virtual int Write(IntPtr buf, /* cpr: int offset,*/ int length)
+ {
+ byte[] buffer = new byte[length];
+ Marshal.Copy(buf, buffer, 0, length);
+ return Write(buffer, length);
+ }
+
+ public virtual int Write(byte[] buffer, /* cpr: int offset,*/ int length)
+ {
+ ActualizeVirtualPosition();
+ dataStream.Write(buffer, 0, length);
+ return length;
+ }
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/misc/ClientUtils.cs b/src/System.Drawing.Common/src/misc/ClientUtils.cs
new file mode 100644
index 0000000000..29ec00b237
--- /dev/null
+++ b/src/System.Drawing.Common/src/misc/ClientUtils.cs
@@ -0,0 +1,530 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing
+{
+ using System.Collections;
+ using System.Diagnostics;
+ using System.Globalization;
+
+ // Miscellaneous utilities
+ internal static class ClientUtils
+ {
+ // ExecutionEngineException is obsolete and shouldn't be used (to catch, throw or reference) anymore.
+ // Pragma added to prevent converting the "type is obsolete" warning into build error.
+ // File owner should fix this.
+#pragma warning disable 618
+ public static bool IsCriticalException(Exception ex)
+ {
+ return ex is NullReferenceException
+ || ex is StackOverflowException
+ || ex is OutOfMemoryException
+ || ex is System.Threading.ThreadAbortException
+ || ex is ExecutionEngineException
+ || ex is IndexOutOfRangeException
+ || ex is AccessViolationException;
+ }
+#pragma warning restore 618
+
+ public static bool IsSecurityOrCriticalException(Exception ex)
+ {
+ return (ex is System.Security.SecurityException) || IsCriticalException(ex);
+ }
+
+ public static int GetBitCount(uint x)
+ {
+ int count = 0;
+ while (x > 0)
+ {
+ x &= x - 1;
+ count++;
+ }
+ return count;
+ }
+
+
+ // Sequential version
+ // assumes sequential enum members 0,1,2,3,4 -etc.
+ //
+ public static bool IsEnumValid(Enum enumValue, int value, int minValue, int maxValue)
+ {
+ bool valid = (value >= minValue) && (value <= maxValue);
+#if DEBUG
+ Debug_SequentialEnumIsDefinedCheck(enumValue, minValue, maxValue);
+#endif
+ return valid;
+ }
+
+ // Useful for sequential enum values which only use powers of two 0,1,2,4,8 etc: IsEnumValid(val, min, max, 1)
+ // Valid example: TextImageRelation 0,1,2,4,8 - only one bit can ever be on, and the value is between 0 and 8.
+ //
+ // ClientUtils.IsEnumValid((int)(relation), /*min*/(int)TextImageRelation.None, (int)TextImageRelation.TextBeforeImage,1);
+ //
+ public static bool IsEnumValid(Enum enumValue, int value, int minValue, int maxValue, int maxNumberOfBitsOn)
+ {
+ System.Diagnostics.Debug.Assert(maxNumberOfBitsOn >= 0 && maxNumberOfBitsOn < 32, "expect this to be greater than zero and less than 32");
+
+ bool valid = (value >= minValue) && (value <= maxValue);
+ //Note: if it's 0, it'll have no bits on. If it's a power of 2, it'll have 1.
+ valid = (valid && GetBitCount((uint)value) <= maxNumberOfBitsOn);
+#if DEBUG
+ Debug_NonSequentialEnumIsDefinedCheck(enumValue, minValue, maxValue, maxNumberOfBitsOn, valid);
+#endif
+ return valid;
+ }
+
+ // Useful for enums that are a subset of a bitmask
+ // Valid example: EdgeEffects 0, 0x800 (FillInterior), 0x1000 (Flat), 0x4000(Soft), 0x8000(Mono)
+ //
+ // ClientUtils.IsEnumValid((int)(effects), /*mask*/ FillInterior | Flat | Soft | Mono,
+ // ,2);
+ //
+ public static bool IsEnumValid_Masked(Enum enumValue, int value, UInt32 mask)
+ {
+ bool valid = ((value & mask) == value);
+
+#if DEBUG
+ Debug_ValidateMask(enumValue, mask);
+#endif
+
+ return valid;
+ }
+
+
+
+
+
+ // Useful for cases where you have discontiguous members of the enum.
+ // Valid example: AutoComplete source.
+ // if (!ClientUtils.IsEnumValid(value, AutoCompleteSource.None,
+ // AutoCompleteSource.AllSystemSources
+ // AutoCompleteSource.AllUrl,
+ // AutoCompleteSource.CustomSource,
+ // AutoCompleteSource.FileSystem,
+ // AutoCompleteSource.FileSystemDirectories,
+ // AutoCompleteSource.HistoryList,
+ // AutoCompleteSource.ListItems,
+ // AutoCompleteSource.RecentlyUsedList))
+ //
+ // PERF tip: put the default value in the enum towards the front of the argument list.
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ public static bool IsEnumValid_NotSequential(System.Enum enumValue, int value, params int[] enumValues)
+ {
+ System.Diagnostics.Debug.Assert(Enum.GetValues(enumValue.GetType()).Length == enumValues.Length, "Not all the enum members were passed in.");
+ for (int i = 0; i < enumValues.Length; i++)
+ {
+ if (enumValues[i] == value)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+#if DEBUG
+ [ThreadStatic]
+ private static Hashtable t_enumValueInfo;
+ public const int MAXCACHE = 300; // we think we're going to get O(100) of these, put in a tripwire if it gets larger.
+
+ private class SequentialEnumInfo
+ {
+ public SequentialEnumInfo(Type t)
+ {
+ int actualMinimum = Int32.MaxValue;
+ int actualMaximum = Int32.MinValue;
+ int countEnumVals = 0;
+
+ foreach (int iVal in Enum.GetValues(t))
+ {
+ actualMinimum = Math.Min(actualMinimum, iVal);
+ actualMaximum = Math.Max(actualMaximum, iVal);
+ countEnumVals++;
+ }
+
+ if (countEnumVals - 1 != (actualMaximum - actualMinimum))
+ {
+ Debug.Fail("this enum cannot be sequential.");
+ }
+ MinValue = actualMinimum;
+ MaxValue = actualMaximum;
+ }
+ public int MinValue;
+ public int MaxValue;
+ }
+
+
+ private static void Debug_SequentialEnumIsDefinedCheck(System.Enum value, int minVal, int maxVal)
+ {
+ Type t = value.GetType();
+
+ if (t_enumValueInfo == null)
+ {
+ t_enumValueInfo = new Hashtable();
+ }
+
+ SequentialEnumInfo sequentialEnumInfo = null;
+
+ if (t_enumValueInfo.ContainsKey(t))
+ {
+ sequentialEnumInfo = t_enumValueInfo[t] as SequentialEnumInfo;
+ }
+ if (sequentialEnumInfo == null)
+ {
+ sequentialEnumInfo = new SequentialEnumInfo(t);
+
+ if (t_enumValueInfo.Count > MAXCACHE)
+ {
+ // see comment next to MAXCACHE declaration.
+ Debug.Fail("cache is too bloated, clearing out, we need to revisit this.");
+ t_enumValueInfo.Clear();
+ }
+ t_enumValueInfo[t] = sequentialEnumInfo;
+ }
+ if (minVal != sequentialEnumInfo.MinValue)
+ {
+ // put string allocation in the IF block so the common case doesnt build up the string.
+ System.Diagnostics.Debug.Fail("Minimum passed in is not the actual minimum for the enum. Consider changing the parameters or using a different function.");
+ }
+ if (maxVal != sequentialEnumInfo.MaxValue)
+ {
+ // put string allocation in the IF block so the common case doesnt build up the string.
+ Debug.Fail("Maximum passed in is not the actual maximum for the enum. Consider changing the parameters or using a different function.");
+ }
+ }
+
+
+
+ private static void Debug_ValidateMask(System.Enum value, UInt32 mask)
+ {
+ Type t = value.GetType();
+ UInt32 newmask = 0;
+ foreach (int iVal in Enum.GetValues(t))
+ {
+ newmask = newmask | (UInt32)iVal;
+ }
+ System.Diagnostics.Debug.Assert(newmask == mask, "Mask not valid in IsEnumValid!");
+ }
+
+ private static void Debug_NonSequentialEnumIsDefinedCheck(System.Enum value, int minVal, int maxVal, int maxBitsOn, bool isValid)
+ {
+ Type t = value.GetType();
+ int actualMinimum = Int32.MaxValue;
+ int actualMaximum = Int32.MinValue;
+ int checkedValue = Convert.ToInt32(value, CultureInfo.InvariantCulture);
+ int maxBitsFound = 0;
+ bool foundValue = false;
+ foreach (int iVal in Enum.GetValues(t))
+ {
+ actualMinimum = Math.Min(actualMinimum, iVal);
+ actualMaximum = Math.Max(actualMaximum, iVal);
+ maxBitsFound = Math.Max(maxBitsFound, GetBitCount((uint)iVal));
+ if (checkedValue == iVal)
+ {
+ foundValue = true;
+ }
+ }
+ if (minVal != actualMinimum)
+ {
+ // put string allocation in the IF block so the common case doesnt build up the string.
+ System.Diagnostics.Debug.Fail("Minimum passed in is not the actual minimum for the enum. Consider changing the parameters or using a different function.");
+ }
+ if (maxVal != actualMaximum)
+ {
+ // put string allocation in the IF block so the common case doesnt build up the string.
+ System.Diagnostics.Debug.Fail("Maximum passed in is not the actual maximum for the enum. Consider changing the parameters or using a different function.");
+ }
+
+ if (maxBitsFound != maxBitsOn)
+ {
+ System.Diagnostics.Debug.Fail("Incorrect usage of IsEnumValid function. The bits set to 1 in this enum was found to be: " + maxBitsFound.ToString(CultureInfo.InvariantCulture) + "this does not match what's passed in: " + maxBitsOn.ToString(CultureInfo.InvariantCulture));
+ }
+ if (foundValue != isValid)
+ {
+ System.Diagnostics.Debug.Fail(String.Format(CultureInfo.InvariantCulture, "Returning {0} but we actually {1} found the value in the enum! Consider using a different overload to IsValidEnum.", isValid, ((foundValue) ? "have" : "have not")));
+ }
+ }
+#endif
+
+ /// <devdoc>
+ /// WeakRefCollection - a collection that holds onto weak references
+ ///
+ /// Essentially you pass in the object as it is, and under the covers
+ /// we only hold a weak reference to the object.
+ ///
+ /// -----------------------------------------------------------------
+ /// !!!IMPORTANT USAGE NOTE!!!
+ /// Users of this class should set the RefCheckThreshold property
+ /// explicitly or call ScavengeReferences every once in a while to
+ /// remove dead references.
+ /// Also avoid calling Remove(item). Instead call RemoveByHashCode(item)
+ /// to make sure dead refs are removed.
+ /// -----------------------------------------------------------------
+ ///
+ /// </devdoc>
+ internal class WeakRefCollection : IList
+ {
+ private int _refCheckThreshold = Int32.MaxValue; // this means this is disabled by default.
+ private ArrayList _innerList;
+
+ internal WeakRefCollection()
+ {
+ _innerList = new ArrayList(4);
+ }
+
+ internal WeakRefCollection(int size)
+ {
+ _innerList = new ArrayList(size);
+ }
+
+ internal ArrayList InnerList
+ {
+ get { return _innerList; }
+ }
+
+ /// <summary>
+ /// Indicates the value where the collection should check its items to remove dead weakref left over.
+ /// Note: When GC collects weak refs from this collection the WeakRefObject identity changes since its
+ /// Target becomes null. This makes the item unrecognizable by the collection and cannot be
+ /// removed - Remove(item) and Contains(item) will not find it anymore.
+ ///
+ /// </summary>
+ public int RefCheckThreshold
+ {
+ get
+ {
+ return _refCheckThreshold;
+ }
+ set
+ {
+ _refCheckThreshold = value;
+ }
+ }
+
+ public object this[int index]
+ {
+ get
+ {
+ WeakRefObject weakRef = InnerList[index] as WeakRefObject;
+
+ if ((weakRef != null) && (weakRef.IsAlive))
+ {
+ return weakRef.Target;
+ }
+
+ return null;
+ }
+ set
+ {
+ InnerList[index] = CreateWeakRefObject(value);
+ }
+ }
+
+ public void ScavengeReferences()
+ {
+ int currentIndex = 0;
+ int currentCount = Count;
+ for (int i = 0; i < currentCount; i++)
+ {
+ object item = this[currentIndex];
+
+ if (item == null)
+ {
+ InnerList.RemoveAt(currentIndex);
+ }
+ else
+ { // only incriment if we have not removed the item
+ currentIndex++;
+ }
+ }
+ }
+
+ public override bool Equals(object obj)
+ {
+ WeakRefCollection other = obj as WeakRefCollection;
+
+ if (other == this)
+ {
+ return true;
+ }
+
+ if (other == null || Count != other.Count)
+ {
+ return false;
+ }
+
+ for (int i = 0; i < Count; i++)
+ {
+ if (InnerList[i] != other.InnerList[i])
+ {
+ if (InnerList[i] == null || !InnerList[i].Equals(other.InnerList[i]))
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+
+ private WeakRefObject CreateWeakRefObject(object value)
+ {
+ if (value == null)
+ {
+ return null;
+ }
+ return new WeakRefObject(value);
+ }
+
+ private static void Copy(WeakRefCollection sourceList, int sourceIndex, WeakRefCollection destinationList, int destinationIndex, int length)
+ {
+ if (sourceIndex < destinationIndex)
+ {
+ // We need to copy from the back forward to prevent overwrite if source and
+ // destination lists are the same, so we need to flip the source/dest indices
+ // to point at the end of the spans to be copied.
+ sourceIndex = sourceIndex + length;
+ destinationIndex = destinationIndex + length;
+ for (; length > 0; length--)
+ {
+ destinationList.InnerList[--destinationIndex] = sourceList.InnerList[--sourceIndex];
+ }
+ }
+ else
+ {
+ for (; length > 0; length--)
+ {
+ destinationList.InnerList[destinationIndex++] = sourceList.InnerList[sourceIndex++];
+ }
+ }
+ }
+
+ /// <summary>
+ /// Removes the value using its hash code as its identity.
+ /// This is needed because the underlying item in the collection may have already been collected
+ /// changing the identity of the WeakRefObject making it impossible for the collection to identify
+ /// it. See WeakRefObject for more info.
+ /// </summary>
+ public void RemoveByHashCode(object value)
+ {
+ if (value == null)
+ {
+ return;
+ }
+
+ int hash = value.GetHashCode();
+
+ for (int idx = 0; idx < InnerList.Count; idx++)
+ {
+ if (InnerList[idx] != null && InnerList[idx].GetHashCode() == hash)
+ {
+ RemoveAt(idx);
+ return;
+ }
+ }
+ }
+
+ #region IList Members
+ public void Clear() { InnerList.Clear(); }
+ public bool IsFixedSize { get { return InnerList.IsFixedSize; } }
+ public bool Contains(object value) { return InnerList.Contains(CreateWeakRefObject(value)); }
+ public void RemoveAt(int index) { InnerList.RemoveAt(index); }
+ public void Remove(object value) { InnerList.Remove(CreateWeakRefObject(value)); }
+ public int IndexOf(object value) { return InnerList.IndexOf(CreateWeakRefObject(value)); }
+ public void Insert(int index, object value) { InnerList.Insert(index, CreateWeakRefObject(value)); }
+ public int Add(object value)
+ {
+ if (Count > RefCheckThreshold)
+ {
+ ScavengeReferences();
+ }
+ return InnerList.Add(CreateWeakRefObject(value));
+ }
+ #endregion
+
+ #region ICollection Members
+ /// <include file='doc\ArrangedElementCollection.uex' path='docs/doc[@for="ArrangedElementCollection.Count"]/*' />
+ public int Count { get { return InnerList.Count; } }
+ object ICollection.SyncRoot { get { return InnerList.SyncRoot; } }
+ public bool IsReadOnly { get { return InnerList.IsReadOnly; } }
+ public void CopyTo(Array array, int index) { InnerList.CopyTo(array, index); }
+ bool ICollection.IsSynchronized { get { return InnerList.IsSynchronized; } }
+ #endregion
+
+ #region IEnumerable Members
+ public IEnumerator GetEnumerator()
+ {
+ return InnerList.GetEnumerator();
+ }
+ #endregion
+
+ /// <summary>
+ /// Wraps a weak ref object.
+ /// WARNING: Use this class carefully!
+ /// When the weak ref is collected, this object looses its identity. This is bad when the object
+ /// has been added to a collection since Contains(WeakRef(item)) and Remove(WeakRef(item)) would
+ /// not be able to identify the item.
+ /// </summary>
+ internal class WeakRefObject
+ {
+ private int _hash;
+ private WeakReference _weakHolder;
+
+ internal WeakRefObject(object obj)
+ {
+ Debug.Assert(obj != null, "Unexpected null object!");
+ _weakHolder = new WeakReference(obj);
+ _hash = obj.GetHashCode();
+ }
+
+ internal bool IsAlive
+ {
+ get { return _weakHolder.IsAlive; }
+ }
+
+ internal object Target
+ {
+ get
+ {
+ return _weakHolder.Target;
+ }
+ }
+
+ public override int GetHashCode()
+ {
+ return _hash;
+ }
+
+ public override bool Equals(object obj)
+ {
+ WeakRefObject other = obj as WeakRefObject;
+
+ if (other == this)
+ {
+ return true;
+ }
+
+ if (other == null)
+ {
+ return false;
+ }
+
+ if (other.Target != Target)
+ {
+ if (Target == null || !Target.Equals(other.Target))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+ }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/misc/CompModSwitches.cs b/src/System.Drawing.Common/src/misc/CompModSwitches.cs
new file mode 100644
index 0000000000..88549705d1
--- /dev/null
+++ b/src/System.Drawing.Common/src/misc/CompModSwitches.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.ComponentModel.CompModSwitches.get_DGEditColumnEditing():System.Diagnostics.TraceSwitch")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.ComponentModel.CompModSwitches.get_LayoutPerformance():System.Diagnostics.TraceSwitch")]
+
+namespace System.ComponentModel
+{
+ using System.Diagnostics;
+
+ internal static class CompModSwitches
+ {
+ private static TraceSwitch s_handleLeak;
+
+ public static TraceSwitch HandleLeak
+ {
+ get
+ {
+ if (s_handleLeak == null)
+ {
+ s_handleLeak = new TraceSwitch("HANDLELEAK", "HandleCollector: Track Win32 Handle Leaks");
+ }
+ return s_handleLeak;
+ }
+ }
+
+ private static BooleanSwitch s_traceCollect;
+ public static BooleanSwitch TraceCollect
+ {
+ get
+ {
+ if (s_traceCollect == null)
+ {
+ s_traceCollect = new BooleanSwitch("TRACECOLLECT", "HandleCollector: Trace HandleCollector operations");
+ }
+ return s_traceCollect;
+ }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/misc/CoreSwitches.cs b/src/System.Drawing.Common/src/misc/CoreSwitches.cs
new file mode 100644
index 0000000000..7c219b8840
--- /dev/null
+++ b/src/System.Drawing.Common/src/misc/CoreSwitches.cs
@@ -0,0 +1,26 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.ComponentModel
+{
+ using System.Diagnostics;
+
+ internal static class CoreSwitches
+ {
+ private static BooleanSwitch s_perfTrack;
+
+ public static BooleanSwitch PerfTrack
+ {
+ get
+ {
+ if (s_perfTrack == null)
+ {
+ s_perfTrack = new BooleanSwitch("PERFTRACK", "Debug performance critical sections.");
+ }
+ return s_perfTrack;
+ }
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/misc/DbgUtil.cs b/src/System.Drawing.Common/src/misc/DbgUtil.cs
new file mode 100644
index 0000000000..d62793abf4
--- /dev/null
+++ b/src/System.Drawing.Common/src/misc/DbgUtil.cs
@@ -0,0 +1,368 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Internal
+{
+ using System.Diagnostics;
+ using System.Globalization;
+ using System.Reflection;
+ using System.Runtime.InteropServices;
+ using System.Security.Permissions;
+ using System.Text;
+
+
+ /// <include file='doc\DbgUtil.uex' path='docs/doc[@for="DbgUtil"]/*' />
+ /// <devdoc>
+ /// Debug help utility.
+ /// </devdoc>
+ [
+ ReflectionPermission(SecurityAction.Assert, MemberAccess = true),
+ EnvironmentPermission(SecurityAction.Assert, Unrestricted = true),
+ FileIOPermission(SecurityAction.Assert, Unrestricted = true),
+ SecurityPermission(SecurityAction.Assert, Flags = SecurityPermissionFlag.UnmanagedCode),
+ UIPermission(SecurityAction.Assert, Unrestricted = true)
+ ]
+ internal sealed class DbgUtil
+ {
+ public const int
+ FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x00000100,
+ FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200,
+ FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000,
+ FORMAT_MESSAGE_DEFAULT = FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM;
+
+ [DllImport(ExternDll.Kernel32, SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetUserDefaultLCID();
+ [DllImport(ExternDll.Kernel32, SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int FormatMessage(int dwFlags, HandleRef lpSource, int dwMessageId, int dwLanguageId, StringBuilder lpBuffer, int nSize, HandleRef arguments);
+
+ public static int gdipInitMaxFrameCount = 8;
+ // disable csharp compiler warning #0414: field assigned unused value
+#pragma warning disable 0414
+ public static int gdiUseMaxFrameCount = 8;
+ public static int finalizeMaxFrameCount = 5;
+#pragma warning restore 0414
+
+ // Methods
+
+
+ /// <devdoc>
+ /// Call this method from your Dispose(bool) to assert that unmanaged resources has been explicitly disposed.
+ /// </devdoc>
+ [Conditional("DEBUG")] // This code will be compiled into the assembly anyways, it is up to the compiler to ignore the call.
+ public static void AssertFinalization(object obj, bool disposing)
+ {
+#if GDI_FINALIZATION_WATCH
+ if( disposing || AppDomain.CurrentDomain.IsFinalizingForUnload() )
+ {
+ return;
+ }
+
+ try
+ {
+ BindingFlags bindingFlags = BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Static | BindingFlags.Instance;
+ FieldInfo allocSiteFld = obj.GetType().GetField("AllocationSite", bindingFlags);
+ string allocationSite = allocSiteFld != null ? allocSiteFld.GetValue( obj ).ToString() : "<Allocation site unavailable>";
+
+ // ignore ojects created by WindowsGraphicsCacheManager.
+ if( allocationSite.Contains("WindowsGraphicsCacheManager") )
+ {
+ return;
+ }
+
+ Debug.Fail("Object Disposed through finalization - it should be explicitly disposed.");
+ Debug.WriteLine("Allocation stack:\r\n" + allocationSite);
+ }
+ catch(Exception ex)
+ {
+ try
+ {
+ Debug.WriteLine("Exception thrown while trying to get allocation stack: " + ex);
+ }
+ catch
+ {
+ }
+ }
+#endif
+ }
+
+ /// <devdoc>
+ /// </devdoc>
+ [Conditional("DEBUG")]
+ public static void AssertWin32(bool expression, string message)
+ {
+#if DEBUG
+ if (!expression)
+ {
+ Debug.Fail(message + "\r\nError: " + DbgUtil.GetLastErrorStr());
+ }
+#endif
+ }
+
+ /// <devdoc>
+ /// </devdoc>
+ [Conditional("DEBUG")]
+ public static void AssertWin32(bool expression, string format, object arg1)
+ {
+#if DEBUG
+ if (!expression)
+ {
+ object[] args = new object[] { arg1 };
+ AssertWin32Impl(expression, format, args);
+ }
+#endif
+ }
+
+ /// <devdoc>
+ /// </devdoc>
+ [Conditional("DEBUG")]
+ public static void AssertWin32(bool expression, string format, object arg1, object arg2)
+ {
+#if DEBUG
+ if (!expression)
+ {
+ object[] args = new object[] { arg1, arg2 };
+ AssertWin32Impl(expression, format, args);
+ }
+#endif
+ }
+
+ /// <devdoc>
+ /// </devdoc>
+ [Conditional("DEBUG")]
+ public static void AssertWin32(bool expression, string format, object arg1, object arg2, object arg3)
+ {
+#if DEBUG
+ if (!expression)
+ {
+ object[] args = new object[] { arg1, arg2, arg3 };
+ AssertWin32Impl(expression, format, args);
+ }
+#endif
+ }
+
+ /// <devdoc>
+ /// </devdoc>
+ [Conditional("DEBUG")]
+ public static void AssertWin32(bool expression, string format, object arg1, object arg2, object arg3, object arg4)
+ {
+#if DEBUG
+ if (!expression)
+ {
+ object[] args = new object[] { arg1, arg2, arg3, arg4 };
+ AssertWin32Impl(expression, format, args);
+ }
+#endif
+ }
+
+ /// <devdoc>
+ /// </devdoc>
+ [Conditional("DEBUG")]
+ public static void AssertWin32(bool expression, string format, object arg1, object arg2, object arg3, object arg4, object arg5)
+ {
+#if DEBUG
+ if (!expression)
+ {
+ object[] args = new object[] { arg1, arg2, arg3, arg4, arg5 };
+ AssertWin32Impl(expression, format, args);
+ }
+#endif
+ }
+
+ /// <devdoc>
+ /// </devdoc>
+ [Conditional("DEBUG")] // This code will be compiled into the assembly anyways, it is up to the compiler to ignore the call.
+ private static void AssertWin32Impl(bool expression, string format, object[] args)
+ {
+#if DEBUG
+ if (!expression)
+ {
+ string message = string.Format(CultureInfo.CurrentCulture, format, args);
+ Debug.Fail(message + "\r\nError: " + DbgUtil.GetLastErrorStr());
+ }
+#endif
+ }
+
+ //
+ // WARNING: Your PInvoke function needs to have the DllImport.SetLastError=true for this method
+ // to work properly. From the MSDN:
+ // GetLastWin32Error exposes the Win32 GetLastError API method from Kernel32.DLL. This method exists
+ // because it is not safe to make a direct platform invoke call to GetLastError to obtain this information.
+ // If you want to access this error code, you must call GetLastWin32Error rather than writing your own
+ // platform invoke definition for GetLastError and calling it. The common language runtime can make
+ // internal calls to APIs that overwrite the operating system maintained GetLastError.
+ //
+ // You can only use this method to obtain error codes if you apply the System.Runtime.InteropServices.DllImportAttribute
+ // to the method signature and set the SetLastError field to true.
+ //
+ public static string GetLastErrorStr()
+ {
+ int MAX_SIZE = 255;
+ StringBuilder buffer = new StringBuilder(MAX_SIZE);
+ string message = String.Empty;
+ int err = 0;
+
+ try
+ {
+ err = Marshal.GetLastWin32Error();
+
+ int retVal = FormatMessage(
+ FORMAT_MESSAGE_DEFAULT,
+ new HandleRef(null, IntPtr.Zero),
+ err,
+ GetUserDefaultLCID(),
+ buffer,
+ MAX_SIZE,
+ new HandleRef(null, IntPtr.Zero));
+
+ message = retVal != 0 ? buffer.ToString() : "<error returned>";
+ }
+ catch (Exception ex)
+ {
+ if (DbgUtil.IsCriticalException(ex))
+ {
+ throw; //rethrow critical exception.
+ }
+ message = ex.ToString();
+ }
+
+ return String.Format(CultureInfo.CurrentCulture, "0x{0:x8} - {1}", err, message);
+ }
+
+ /// <devdoc>
+ /// Duplicated here from ClientUtils not to depend on that code because this class is to be
+ /// compiled into System.Drawing and System.Windows.Forms.
+ /// </devdoc>
+ private static bool IsCriticalException(Exception ex)
+ {
+ return
+ //ex is NullReferenceException ||
+ ex is StackOverflowException ||
+ ex is OutOfMemoryException ||
+ ex is System.Threading.ThreadAbortException;
+ }
+
+ /// <devdoc>
+ /// </devdoc>
+ public static string StackTrace
+ {
+ get
+ {
+ return Environment.StackTrace;
+ }
+ }
+
+ /// <devdoc>
+ /// Returns information about the top stack frames in a string format. The input param determines the number of
+ /// frames to include.
+ /// </devdoc>
+ public static string StackFramesToStr(int maxFrameCount)
+ {
+ string trace = String.Empty;
+
+ try
+ {
+ StackTrace st = new StackTrace(true);
+ int dbgUtilFrameCount = 0;
+
+ //
+ // Ignore frames for methods on this library.
+ // Note: The stack frame holds the latest frame at index 0.
+ //
+ while (dbgUtilFrameCount < st.FrameCount)
+ {
+ StackFrame sf = st.GetFrame(dbgUtilFrameCount);
+
+ if (sf == null || sf.GetMethod().DeclaringType != typeof(DbgUtil))
+ {
+ break;
+ }
+
+ dbgUtilFrameCount++;
+ }
+
+ maxFrameCount += dbgUtilFrameCount; // add ignored frames.
+
+ if (maxFrameCount > st.FrameCount)
+ {
+ maxFrameCount = st.FrameCount;
+ }
+
+ for (int i = dbgUtilFrameCount; i < maxFrameCount; i++)
+ {
+ StackFrame sf = st.GetFrame(i);
+
+ if (sf == null)
+ {
+ continue;
+ }
+
+ MethodBase mi = sf.GetMethod();
+
+ if (mi == null)
+ {
+ continue;
+ }
+
+ string args = String.Empty;
+ string fileName = sf.GetFileName();
+
+ int backSlashIndex = fileName == null ? -1 : fileName.LastIndexOf('\\');
+
+ if (backSlashIndex != -1)
+ {
+ fileName = fileName.Substring(backSlashIndex + 1, fileName.Length - backSlashIndex - 1);
+ }
+
+ foreach (ParameterInfo pi in mi.GetParameters())
+ {
+ args += pi.ParameterType.Name + ", ";
+ }
+
+ if (args.Length > 0) // remove last comma.
+ {
+ args = args.Substring(0, args.Length - 2);
+ }
+
+ trace += String.Format(CultureInfo.CurrentCulture, "at {0} {1}.{2}({3})\r\n", fileName, mi.DeclaringType, mi.Name, args);
+ }
+ }
+ catch (Exception ex)
+ {
+ if (DbgUtil.IsCriticalException(ex))
+ {
+ throw; //rethrow critical exception.
+ }
+ trace += ex.ToString();
+ }
+
+ return trace.ToString();
+ }
+
+ /// <devdoc>
+ /// Returns information about the top stack frames in a string format.
+ /// </devdoc>
+ public static string StackFramesToStr()
+ {
+ return StackFramesToStr(DbgUtil.gdipInitMaxFrameCount);
+ }
+
+ /// <devdoc>
+ /// Returns information about the top stack frames in a string format. The input param determines the number of
+ /// frames to include. The 'message' parameter is used as the header of the returned string.
+ /// </devdoc>
+ public static string StackTraceToStr(string message, int frameCount)
+ {
+ return String.Format(CultureInfo.CurrentCulture, "{0}\r\nTop Stack Trace:\r\n{1}", message, DbgUtil.StackFramesToStr(frameCount));
+ }
+
+ /// <devdoc>
+ /// Returns information about the top stack frames in a string format. The 'message' parameter is used as the header of the returned string.
+ /// </devdoc>
+ public static string StackTraceToStr(string message)
+ {
+ return StackTraceToStr(message, DbgUtil.gdipInitMaxFrameCount);
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/misc/DebugHandleTracker.cs b/src/System.Drawing.Common/src/misc/DebugHandleTracker.cs
new file mode 100644
index 0000000000..b1afaecc1f
--- /dev/null
+++ b/src/System.Drawing.Common/src/misc/DebugHandleTracker.cs
@@ -0,0 +1,538 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Internal
+{
+ using System.ComponentModel;
+ using System.Diagnostics;
+
+ using Hashtable = System.Collections.Hashtable;
+
+ /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker"]/*' />
+ /// <devdoc>
+ /// The job of this class is to collect and track handle usage in
+ /// windows forms. Ideally, a developer should never have to call dispose() on
+ /// any windows forms object. The problem in making this happen is in objects that
+ /// are very small to the VM garbage collector, but take up huge amounts
+ /// of resources to the system. A good example of this is a Win32 region
+ /// handle. To the VM, a Region object is a small six ubyte object, so there
+ /// isn't much need to garbage collect it anytime soon. To Win32, however,
+ /// a region handle consumes expensive USER and GDI resources. Ideally we
+ /// would like to be able to mark an object as "expensive" so it uses a different
+ /// garbage collection algorithm. In absence of that, we use the HandleCollector class, which
+ /// runs a daemon thread to garbage collect when handle usage goes up.
+ /// </devdoc>
+ /// <internalonly/>
+ internal class DebugHandleTracker
+ {
+ private static Hashtable s_handleTypes = new Hashtable();
+ private static DebugHandleTracker s_tracker;
+
+ static DebugHandleTracker()
+ {
+ s_tracker = new DebugHandleTracker();
+
+ if (CompModSwitches.HandleLeak.Level > TraceLevel.Off || CompModSwitches.TraceCollect.Enabled)
+ {
+ System.Internal.HandleCollector.HandleAdded += new System.Internal.HandleChangeEventHandler(s_tracker.OnHandleAdd);
+ System.Internal.HandleCollector.HandleRemoved += new System.Internal.HandleChangeEventHandler(s_tracker.OnHandleRemove);
+ }
+ }
+
+ private DebugHandleTracker()
+ {
+ }
+
+ private static object s_internalSyncObject = new object();
+
+ /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.IgnoreCurrentHandlesAsLeaks"]/*' />
+ /// <devdoc>
+ /// All handles available at this time will be not be considered as leaks
+ /// when CheckLeaks is called to report leaks.
+ /// </devdoc>
+ /** @conditional(DEBUG) */
+ public static void IgnoreCurrentHandlesAsLeaks()
+ {
+ lock (s_internalSyncObject)
+ {
+ if (CompModSwitches.HandleLeak.Level >= TraceLevel.Warning)
+ {
+ HandleType[] types = new HandleType[s_handleTypes.Values.Count];
+ s_handleTypes.Values.CopyTo(types, 0);
+
+ for (int i = 0; i < types.Length; i++)
+ {
+ if (types[i] != null)
+ {
+ types[i].IgnoreCurrentHandlesAsLeaks();
+ }
+ }
+ }
+ }
+ }
+
+ /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.CheckLeaks"]/*' />
+ /// <devdoc>
+ /// Called at shutdown to check for handles that are currently allocated.
+ /// Normally, there should be none. This will print a list of all
+ /// handle leaks.
+ /// </devdoc>
+ /** @conditional(DEBUG) */
+ public static void CheckLeaks()
+ {
+ lock (s_internalSyncObject)
+ {
+ if (CompModSwitches.HandleLeak.Level >= TraceLevel.Warning)
+ {
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ HandleType[] types = new HandleType[s_handleTypes.Values.Count];
+ s_handleTypes.Values.CopyTo(types, 0);
+
+ Debug.WriteLine("------------Begin--CheckLeaks--------------------");
+ for (int i = 0; i < types.Length; i++)
+ {
+ if (types[i] != null)
+ {
+ types[i].CheckLeaks();
+ }
+ }
+ Debug.WriteLine("-------------End--CheckLeaks---------------------");
+ }
+ }
+ }
+
+ /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.Initialize"]/*' />
+ /// <devdoc>
+ /// Ensures leak detection has been initialized.
+ /// </devdoc>
+ /** @conditional(DEBUG) */
+ public static void Initialize()
+ {
+ // Calling this method forces the class to be loaded, thus running the
+ // static constructor which does all the work.
+ }
+
+ /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.OnHandleAdd"]/*' />
+ /// <devdoc>
+ /// Called by the Win32 handle collector when a new handle is created.
+ /// </devdoc>
+ /** @conditional(DEBUG) */
+ private void OnHandleAdd(string handleName, IntPtr handle, int handleCount)
+ {
+ HandleType type = (HandleType)s_handleTypes[handleName];
+ if (type == null)
+ {
+ type = new HandleType(handleName);
+ s_handleTypes[handleName] = type;
+ }
+ type.Add(handle);
+ }
+
+ /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.OnHandleRemove"]/*' />
+ /// <devdoc>
+ /// Called by the Win32 handle collector when a new handle is created.
+ /// </devdoc>
+ /** @conditional(DEBUG) */
+ private void OnHandleRemove(string handleName, IntPtr handle, int HandleCount)
+ {
+ HandleType type = (HandleType)s_handleTypes[handleName];
+
+ bool removed = false;
+ if (type != null)
+ {
+ removed = type.Remove(handle);
+ }
+
+ if (!removed)
+ {
+ if (CompModSwitches.HandleLeak.Level >= TraceLevel.Error)
+ {
+ // It seems to me we shouldn't call HandleCollector.Remove more than once
+ // for a given handle, but we do just that for HWND's (NativeWindow.DestroyWindow
+ // and Control.WmNCDestroy).
+ Debug.WriteLine("*************************************************");
+ Debug.WriteLine("While removing, couldn't find handle: " + Convert.ToString(unchecked((int)handle), 16));
+ Debug.WriteLine("Handle Type : " + handleName);
+ Debug.WriteLine(Environment.StackTrace);
+ Debug.WriteLine("-------------------------------------------------");
+ }
+ }
+ }
+
+ /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.HandleType"]/*' />
+ /// <devdoc>
+ /// Represents a specific type of handle.
+ /// </devdoc>
+ private class HandleType
+ {
+ public readonly string name;
+
+ private int _handleCount;
+ private HandleEntry[] _buckets;
+
+ private const int BUCKETS = 10;
+
+ /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.HandleType.HandleType"]/*' />
+ /// <devdoc>
+ /// Creates a new handle type.
+ /// </devdoc>
+ public HandleType(string name)
+ {
+ this.name = name;
+ _buckets = new HandleEntry[BUCKETS];
+ }
+
+ /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.HandleType.Add"]/*' />
+ /// <devdoc>
+ /// Adds a handle to this handle type for monitoring.
+ /// </devdoc>
+ public void Add(IntPtr handle)
+ {
+ lock (this)
+ {
+ int hash = ComputeHash(handle);
+ if (CompModSwitches.HandleLeak.Level >= TraceLevel.Info)
+ {
+ Debug.WriteLine("-------------------------------------------------");
+ Debug.WriteLine("Handle Allocating: " + Convert.ToString(unchecked((int)handle), 16));
+ Debug.WriteLine("Handle Type : " + name);
+ if (CompModSwitches.HandleLeak.Level >= TraceLevel.Verbose)
+ Debug.WriteLine(Environment.StackTrace);
+ }
+
+ HandleEntry entry = _buckets[hash];
+ while (entry != null)
+ {
+ Debug.Assert(entry.handle != handle, "Duplicate handle of type " + name);
+ entry = entry.next;
+ }
+
+ _buckets[hash] = new HandleEntry(_buckets[hash], handle);
+
+ _handleCount++;
+ }
+ }
+
+ /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.HandleType.CheckLeaks"]/*' />
+ /// <devdoc>
+ /// Checks and reports leaks for handle monitoring.
+ /// </devdoc>
+ public void CheckLeaks()
+ {
+ lock (this)
+ {
+ bool reportedFirstLeak = false;
+ if (_handleCount > 0)
+ {
+ for (int i = 0; i < BUCKETS; i++)
+ {
+ HandleEntry e = _buckets[i];
+ while (e != null)
+ {
+ if (!e.ignorableAsLeak)
+ {
+ if (!reportedFirstLeak)
+ {
+ Debug.WriteLine("\r\nHandle leaks detected for handles of type " + name + ":");
+ reportedFirstLeak = true;
+ }
+ Debug.WriteLine(e.ToString(this));
+ }
+ e = e.next;
+ }
+ }
+ }
+ }
+ }
+
+ /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.HandleType.IgnoreCurrentHandlesAsLeaks"]/*' />
+ /// <devdoc>
+ /// Marks all the handles currently stored, as ignorable, so that they will not be reported as leaks later.
+ /// </devdoc>
+ public void IgnoreCurrentHandlesAsLeaks()
+ {
+ lock (this)
+ {
+ if (_handleCount > 0)
+ {
+ for (int i = 0; i < BUCKETS; i++)
+ {
+ HandleEntry e = _buckets[i];
+ while (e != null)
+ {
+ e.ignorableAsLeak = true;
+ e = e.next;
+ }
+ }
+ }
+ }
+ }
+
+ /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.HandleType.ComputeHash"]/*' />
+ /// <devdoc>
+ /// Computes the hash bucket for this handle.
+ /// </devdoc>
+ private int ComputeHash(IntPtr handle)
+ {
+ return (unchecked((int)handle) & 0xFFFF) % BUCKETS;
+ }
+
+ /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.HandleType.Remove"]/*' />
+ /// <devdoc>
+ /// Removes the given handle from our monitor list.
+ /// </devdoc>
+ public bool Remove(IntPtr handle)
+ {
+ lock (this)
+ {
+ int hash = ComputeHash(handle);
+ if (CompModSwitches.HandleLeak.Level >= TraceLevel.Info)
+ {
+ Debug.WriteLine("-------------------------------------------------");
+ Debug.WriteLine("Handle Releaseing: " + Convert.ToString(unchecked((int)handle), 16));
+ Debug.WriteLine("Handle Type : " + name);
+ if (CompModSwitches.HandleLeak.Level >= TraceLevel.Verbose)
+ Debug.WriteLine(Environment.StackTrace);
+ }
+ HandleEntry e = _buckets[hash];
+ HandleEntry last = null;
+ while (e != null && e.handle != handle)
+ {
+ last = e;
+ e = e.next;
+ }
+ if (e != null)
+ {
+ if (last == null)
+ {
+ _buckets[hash] = e.next;
+ }
+ else
+ {
+ last.next = e.next;
+ }
+ _handleCount--;
+ return true;
+ }
+ return false;
+ }
+ }
+
+ /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.HandleType.HandleEntry"]/*' />
+ /// <devdoc>
+ /// Denotes a single entry in our handle list.
+ /// </devdoc>
+ private class HandleEntry
+ {
+ public readonly IntPtr handle;
+ public HandleEntry next;
+ public readonly string callStack;
+ public bool ignorableAsLeak;
+
+ /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.HandleType.HandleEntry.HandleEntry"]/*' />
+ /// <devdoc>
+ /// Creates a new handle entry
+ /// </devdoc>
+ public HandleEntry(HandleEntry next, IntPtr handle)
+ {
+ this.handle = handle;
+ this.next = next;
+
+ if (CompModSwitches.HandleLeak.Level > TraceLevel.Off)
+ {
+ callStack = Environment.StackTrace;
+ }
+ else
+ {
+ callStack = null;
+ }
+ }
+
+ /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.HandleType.HandleEntry.ToString"]/*' />
+ /// <devdoc>
+ /// Converts this handle to a printable string. the string consists
+ /// of the handle value along with the callstack for it's
+ /// allocation.
+ /// </devdoc>
+ public string ToString(HandleType type)
+ {
+ StackParser sp = new StackParser(callStack);
+
+ // Discard all of the stack up to and including the "Handle.create" call
+ //
+ sp.DiscardTo("HandleCollector.Add");
+
+ // Skip the next call as it is always a debug wrapper
+ //
+ sp.DiscardNext();
+
+ // Now recreate the leak list with a lot of stack entries
+ //
+ sp.Truncate(40);
+
+ string description = "";
+ /*if (type.name.Equals("GDI") || type.name.Equals("HDC")) {
+ int objectType = UnsafeNativeMethods.GetObjectType(new HandleRef(null, handle));
+ switch (objectType) {
+ case NativeMethods.OBJ_DC: description = "normal DC"; break;
+ case NativeMethods.OBJ_MEMDC: description = "memory DC"; break;
+ case NativeMethods.OBJ_METADC: description = "metafile DC"; break;
+ case NativeMethods.OBJ_ENHMETADC: description = "enhanced metafile DC"; break;
+
+ case NativeMethods.OBJ_PEN: description = "Pen"; break;
+ case NativeMethods.OBJ_BRUSH: description = "Brush"; break;
+ case NativeMethods.OBJ_PAL: description = "Palette"; break;
+ case NativeMethods.OBJ_FONT: description = "Font"; break;
+ case NativeMethods.OBJ_BITMAP: description = "Bitmap"; break;
+ case NativeMethods.OBJ_REGION: description = "Region"; break;
+ case NativeMethods.OBJ_METAFILE: description = "Metafile"; break;
+ case NativeMethods.OBJ_EXTPEN: description = "Extpen"; break;
+ default: description = "?"; break;
+ }
+ description = " (" + description + ")";
+ }*/
+
+ return Convert.ToString(unchecked((int)handle), 16) + description + ": " + sp.ToString();
+ }
+
+ /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.HandleType.HandleEntry.StackParser"]/*' />
+ /// <devdoc>
+ /// Simple stack parsing class to manipulate our callstack.
+ /// </devdoc>
+ private class StackParser
+ {
+ internal string releventStack;
+ internal int startIndex;
+ internal int endIndex;
+ internal int length;
+
+ /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.HandleType.HandleEntry.StackParser.StackParser"]/*' />
+ /// <devdoc>
+ /// Creates a new stackparser with the given callstack
+ /// </devdoc>
+ public StackParser(string callStack)
+ {
+ releventStack = callStack;
+ length = releventStack.Length;
+ }
+
+ /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.HandleType.HandleEntry.StackParser.ContainsString"]/*' />
+ /// <devdoc>
+ /// Determines if the given string contains token. This is a case
+ /// sensitive match.
+ /// </devdoc>
+ private static bool ContainsString(string str, string token)
+ {
+ int stringLength = str.Length;
+ int tokenLength = token.Length;
+
+ for (int s = 0; s < stringLength; s++)
+ {
+ int t = 0;
+ while (t < tokenLength && str[s + t] == token[t])
+ {
+ t++;
+ }
+ if (t == tokenLength)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.HandleType.HandleEntry.StackParser.DiscardNext"]/*' />
+ /// <devdoc>
+ /// Discards the next line of the stack trace.
+ /// </devdoc>
+ public void DiscardNext()
+ {
+ GetLine();
+ }
+
+ /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.HandleType.HandleEntry.StackParser.DiscardTo"]/*' />
+ /// <devdoc>
+ /// Discards all lines up to and including the line that contains
+ /// discardText.
+ /// </devdoc>
+ public void DiscardTo(string discardText)
+ {
+ while (startIndex < length)
+ {
+ string line = GetLine();
+ if (line == null || ContainsString(line, discardText))
+ {
+ break;
+ }
+ }
+ }
+
+ /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.HandleType.HandleEntry.StackParser.GetLine"]/*' />
+ /// <devdoc>
+ /// Retrieves the next line of the stack.
+ /// </devdoc>
+ private string GetLine()
+ {
+ endIndex = releventStack.IndexOf('\r', startIndex);
+ if (endIndex < 0)
+ {
+ endIndex = length - 1;
+ }
+
+ string line = releventStack.Substring(startIndex, endIndex - startIndex);
+ char ch;
+
+ while (endIndex < length && ((ch = releventStack[endIndex]) == '\r' || ch == '\n'))
+ {
+ endIndex++;
+ }
+ if (startIndex == endIndex) return null;
+ startIndex = endIndex;
+ line = line.Replace('\t', ' ');
+ return line;
+ }
+
+ /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.HandleType.HandleEntry.StackParser.ToString"]/*' />
+ /// <devdoc>
+ /// Rereives the string of the parsed stack trace
+ /// </devdoc>
+ public override string ToString()
+ {
+ return releventStack.Substring(startIndex);
+ }
+
+ /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.HandleType.HandleEntry.StackParser.Truncate"]/*' />
+ /// <devdoc>
+ /// Truncates the stack trace, saving the given # of lines.
+ /// </devdoc>
+ public void Truncate(int lines)
+ {
+ string truncatedStack = "";
+
+ while (lines-- > 0 && startIndex < length)
+ {
+ if (truncatedStack == null)
+ {
+ truncatedStack = GetLine();
+ }
+ else
+ {
+ truncatedStack += ": " + GetLine();
+ }
+ truncatedStack += Environment.NewLine;
+ }
+
+ releventStack = truncatedStack;
+ startIndex = 0;
+ endIndex = 0;
+ length = releventStack.Length;
+ }
+ }
+ }
+ }
+
+ //#endif // DEBUG
+ }
+}
diff --git a/src/System.Drawing.Common/src/misc/DpiHelper.cs b/src/System.Drawing.Common/src/misc/DpiHelper.cs
new file mode 100644
index 0000000000..45f18d756d
--- /dev/null
+++ b/src/System.Drawing.Common/src/misc/DpiHelper.cs
@@ -0,0 +1,242 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Configuration;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Runtime.InteropServices;
+
+using CAPS = System.Drawing.SafeNativeMethods;
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// Helper class for scaling coordinates and images according to current DPI scaling set in Windows for the primary screen.
+ /// </summary>
+ internal static class DpiHelper
+ {
+ private const string EnableHighDpiConfigurationValueName = "EnableWindowsFormsHighDpiAutoResizing";
+ private const double LogicalDpi = 96.0;
+ private static bool s_isInitialized = false;
+ /// <summary>
+ /// The primary screen's (device) current horizontal DPI
+ /// </summary>
+ private static double s_deviceDpiX = LogicalDpi;
+
+ /// <summary>
+ /// The primary screen's (device) current vertical DPI
+ /// </summary>
+ private static double s_deviceDpiY = LogicalDpi;
+
+ private static double s_logicalToDeviceUnitsScalingFactorX = 0.0;
+ private static double s_logicalToDeviceUnitsScalingFactorY = 0.0;
+ private static bool s_enableHighDpi = false;
+ private static InterpolationMode s_interpolationMode = InterpolationMode.Invalid;
+
+ private static void Initialize()
+ {
+ if (s_isInitialized)
+ {
+ return;
+ }
+ try
+ {
+ string value = ConfigurationManager.AppSettings.Get(EnableHighDpiConfigurationValueName);
+ if (string.Equals(value, "true", StringComparison.InvariantCultureIgnoreCase))
+ {
+ s_enableHighDpi = true;
+ }
+ }
+ catch
+ {
+ }
+ if (s_enableHighDpi)
+ {
+ IntPtr hDC = UnsafeNativeMethods.GetDC(NativeMethods.NullHandleRef);
+ if (hDC != IntPtr.Zero)
+ {
+ s_deviceDpiX = UnsafeNativeMethods.GetDeviceCaps(new HandleRef(null, hDC), CAPS.LOGPIXELSX);
+ s_deviceDpiY = UnsafeNativeMethods.GetDeviceCaps(new HandleRef(null, hDC), CAPS.LOGPIXELSY);
+
+ UnsafeNativeMethods.ReleaseDC(NativeMethods.NullHandleRef, new HandleRef(null, hDC));
+ }
+ }
+ s_isInitialized = true;
+ }
+
+ private static double LogicalToDeviceUnitsScalingFactorX
+ {
+ get
+ {
+ if (s_logicalToDeviceUnitsScalingFactorX == 0.0)
+ {
+ Initialize();
+ s_logicalToDeviceUnitsScalingFactorX = s_deviceDpiX / LogicalDpi;
+ }
+ return s_logicalToDeviceUnitsScalingFactorX;
+ }
+ }
+
+ private static double LogicalToDeviceUnitsScalingFactorY
+ {
+ get
+ {
+ if (s_logicalToDeviceUnitsScalingFactorY == 0.0)
+ {
+ Initialize();
+ s_logicalToDeviceUnitsScalingFactorY = s_deviceDpiY / LogicalDpi;
+ }
+ return s_logicalToDeviceUnitsScalingFactorY;
+ }
+ }
+
+ private static InterpolationMode InterpolationMode
+ {
+ get
+ {
+ if (s_interpolationMode == InterpolationMode.Invalid)
+ {
+ int dpiScalePercent = (int)Math.Round(LogicalToDeviceUnitsScalingFactorX * 100);
+
+ // We will prefer NearestNeighbor algorithm for 200, 300, 400, etc zoom factors, in which each pixel become a 2x2, 3x3, 4x4, etc rectangle.
+ // This produces sharp edges in the scaled image and doesn't cause distorsions of the original image.
+ // For any other scale factors we will prefer a high quality resizing algorith. While that introduces fuzziness in the resulting image,
+ // it will not distort the original (which is extremely important for small zoom factors like 125%, 150%).
+ // We'll use Bicubic in those cases, except on reducing (zoom < 100, which we shouldn't have anyway), in which case Linear produces better
+ // results because it uses less neighboring pixels.
+ if ((dpiScalePercent % 100) == 0)
+ {
+ s_interpolationMode = InterpolationMode.NearestNeighbor;
+ }
+ else if (dpiScalePercent < 100)
+ {
+ s_interpolationMode = InterpolationMode.HighQualityBilinear;
+ }
+ else
+ {
+ s_interpolationMode = InterpolationMode.HighQualityBicubic;
+ }
+ }
+ return s_interpolationMode;
+ }
+ }
+
+ private static Bitmap ScaleBitmapToSize(Bitmap logicalImage, Size deviceImageSize)
+ {
+ Bitmap deviceImage;
+ deviceImage = new Bitmap(deviceImageSize.Width, deviceImageSize.Height, logicalImage.PixelFormat);
+
+ using (Graphics graphics = Graphics.FromImage(deviceImage))
+ {
+ graphics.InterpolationMode = InterpolationMode;
+
+ RectangleF sourceRect = new RectangleF(0, 0, logicalImage.Size.Width, logicalImage.Size.Height);
+ RectangleF destRect = new RectangleF(0, 0, deviceImageSize.Width, deviceImageSize.Height);
+
+ // Specify a source rectangle shifted by half of pixel to account for GDI+ considering the source origin the center of top-left pixel
+ // Failing to do so will result in the right and bottom of the bitmap lines being interpolated with the graphics' background color,
+ // and will appear black even if we cleared the background with transparent color.
+ // The apparition of these artifacts depends on the interpolation mode, on the dpi scaling factor, etc.
+ // E.g. at 150% DPI, Bicubic produces them and NearestNeighbor is fine, but at 200% DPI NearestNeighbor also shows them.
+ sourceRect.Offset(-0.5f, -0.5f);
+
+ graphics.DrawImage(logicalImage, destRect, sourceRect, GraphicsUnit.Pixel);
+ }
+
+ return deviceImage;
+ }
+
+ private static Bitmap CreateScaledBitmap(Bitmap logicalImage)
+ {
+ Size deviceImageSize = DpiHelper.LogicalToDeviceUnits(logicalImage.Size);
+ return ScaleBitmapToSize(logicalImage, deviceImageSize);
+ }
+
+ /// <summary>
+ /// Returns whether scaling is required when converting between logical-device units,
+ /// if the application opted in the automatic scaling in the .config file.
+ /// </summary>
+ public static bool IsScalingRequired
+ {
+ get
+ {
+ Initialize();
+ return s_deviceDpiX != LogicalDpi || s_deviceDpiY != LogicalDpi;
+ }
+ }
+
+ /// <summary>
+ /// Transforms a horizontal integer coordinate from logical to device units
+ /// by scaling it up for current DPI and rounding to nearest integer value
+ /// Note: this method should be called only inside an if (DpiHelper.IsScalingRequired) clause
+ /// </summary>
+ /// <param name="value">The horizontal value in logical units</param>
+ /// <returns>The horizontal value in device units</returns>
+ public static int LogicalToDeviceUnitsX(int value)
+ {
+ return (int)Math.Round(LogicalToDeviceUnitsScalingFactorX * (double)value);
+ }
+
+ /// <summary>
+ /// Transforms a vertical integer coordinate from logical to device units
+ /// by scaling it up for current DPI and rounding to nearest integer value
+ /// Note: this method should be called only inside an if (DpiHelper.IsScalingRequired) clause
+ /// </summary>
+ /// <param name="value">The vertical value in logical units</param>
+ /// <returns>The vertical value in device units</returns>
+ public static int LogicalToDeviceUnitsY(int value)
+ {
+ return (int)Math.Round(LogicalToDeviceUnitsScalingFactorY * (double)value);
+ }
+
+ /// <summary>
+ /// Returns a new Size with the input's
+ /// dimensions converted from logical units to device units.
+ /// Note: this method should be called only inside an if (DpiHelper.IsScalingRequired) clause
+ /// </summary>
+ /// <param name="logicalSize">Size in logical units</param>
+ /// <returns>Size in device units</returns>
+ public static Size LogicalToDeviceUnits(Size logicalSize)
+ {
+ return new Size(LogicalToDeviceUnitsX(logicalSize.Width),
+ LogicalToDeviceUnitsY(logicalSize.Height));
+ }
+
+ /// <summary>
+ /// Create and return a new bitmap scaled to the specified size.
+ /// Note: this method should be called only inside an if (DpiHelper.IsScalingRequired) clause
+ /// </summary>
+ /// <param name="logicalImage">The image to scale from logical units to device units</param>
+ /// <param name="targetImageSize">The size to scale image to</param>
+ public static Bitmap CreateResizedBitmap(Bitmap logicalImage, Size targetImageSize)
+ {
+ if (logicalImage == null)
+ {
+ return null;
+ }
+
+ return ScaleBitmapToSize(logicalImage, targetImageSize);
+ }
+
+ /// <summary>
+ /// Create a new bitmap scaled for the device units.
+ /// When displayed on the device, the scaled image will have same size as the original image would have when displayed at 96dpi.
+ /// Note: this method should be called only inside an if (DpiHelper.IsScalingRequired) clause
+ /// </summary>
+ /// <param name="logicalBitmap">The image to scale from logical units to device units</param>
+ public static void ScaleBitmapLogicalToDevice(ref Bitmap logicalBitmap)
+ {
+ if (logicalBitmap == null)
+ {
+ return;
+ }
+ Bitmap deviceBitmap = CreateScaledBitmap(logicalBitmap);
+ if (deviceBitmap != null)
+ {
+ logicalBitmap.Dispose();
+ logicalBitmap = deviceBitmap;
+ }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/misc/ExternDll.cs b/src/System.Drawing.Common/src/misc/ExternDll.cs
new file mode 100644
index 0000000000..c2810fee30
--- /dev/null
+++ b/src/System.Drawing.Common/src/misc/ExternDll.cs
@@ -0,0 +1,51 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System
+{
+ internal static class ExternDll
+ {
+ public const string Activeds = "activeds.dll";
+ public const string Advapi32 = "advapi32.dll";
+ public const string Comctl32 = "comctl32.dll";
+ public const string Comdlg32 = "comdlg32.dll";
+ public const string Gdi32 = "gdi32.dll";
+ public const string Gdiplus = "gdiplus.dll";
+ public const string Hhctrl = "hhctrl.ocx";
+ public const string Imm32 = "imm32.dll";
+ public const string Kernel32 = "kernel32.dll";
+ public const string Loadperf = "Loadperf.dll";
+ public const string Mscoree = "mscoree.dll";
+ public const string Clr = "clr.dll";
+ public const string Msi = "msi.dll";
+ public const string Mqrt = "mqrt.dll";
+ public const string Ntdll = "ntdll.dll";
+ public const string Ole32 = "ole32.dll";
+ public const string Oleacc = "oleacc.dll";
+ public const string Oleaut32 = "oleaut32.dll";
+ public const string Olepro32 = "olepro32.dll";
+ public const string PerfCounter = "perfcounter.dll";
+ public const string Powrprof = "Powrprof.dll";
+ public const string Psapi = "psapi.dll";
+ public const string Shell32 = "shell32.dll";
+ public const string User32 = "user32.dll";
+ public const string Uxtheme = "uxtheme.dll";
+ public const string WinMM = "winmm.dll";
+ public const string Winspool = "winspool.drv";
+ public const string Wtsapi32 = "wtsapi32.dll";
+ public const string Version = "version.dll";
+ public const string Vsassert = "vsassert.dll";
+ public const string Fxassert = "Fxassert.dll";
+ public const string Shlwapi = "shlwapi.dll";
+ public const string Crypt32 = "crypt32.dll";
+
+ // system.data specific
+ internal const string Odbc32 = "odbc32.dll";
+ internal const string SNI = "System.Data.dll";
+
+ // system.data.oracleclient specific
+ internal const string OciDll = "oci.dll";
+ internal const string OraMtsDll = "oramts.dll";
+ }
+}
diff --git a/src/System.Drawing.Common/src/misc/GDI/ApplyGraphicsProperties.cs b/src/System.Drawing.Common/src/misc/GDI/ApplyGraphicsProperties.cs
new file mode 100644
index 0000000000..e65a6d5174
--- /dev/null
+++ b/src/System.Drawing.Common/src/misc/GDI/ApplyGraphicsProperties.cs
@@ -0,0 +1,23 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Internal
+{
+ /// <devdoc>
+ /// Enumeration defining the different Graphics properties to apply to a WindowsGraphics when creating it
+ /// from a Graphics object.
+ /// </devdoc>
+ [Flags]
+ internal enum ApplyGraphicsProperties
+ {
+ // No properties to be applied to the DC obtained from the Graphics object.
+ None = 0x00000000,
+ // Apply clipping region.
+ Clipping = 0x00000001,
+ // Apply coordinate transformation.
+ TranslateTransform = 0x00000002,
+ // Apply all supported Graphics properties.
+ All = Clipping | TranslateTransform
+ }
+}
diff --git a/src/System.Drawing.Common/src/misc/GDI/DeviceContext.cs b/src/System.Drawing.Common/src/misc/GDI/DeviceContext.cs
new file mode 100644
index 0000000000..735b35b045
--- /dev/null
+++ b/src/System.Drawing.Common/src/misc/GDI/DeviceContext.cs
@@ -0,0 +1,601 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Internal
+{
+ using System.Collections;
+ using System.Diagnostics;
+ using System.Runtime.InteropServices;
+
+ /// <include file='doc\IDeviceContext.uex' path='docs/doc[@for="DeviceContext"]/*' />
+ /// <devdoc>
+ /// Represents a Win32 device context. Provides operations for setting some of the properties
+ /// of a device context. It's the managed wrapper for an HDC.
+ ///
+ /// This class is divided into two files separating the code that needs to be compiled into
+ /// reatail builds and debugging code.
+ /// </devdoc>
+ internal sealed partial class DeviceContext : MarshalByRefObject, IDeviceContext, IDisposable
+ {
+ /// <devdoc>
+ /// This class is a wrapper to a Win32 device context, and the Hdc property is the way to get a
+ /// handle to it.
+ ///
+ /// The hDc is released/deleted only when owned by the object, meaning it was created internally;
+ /// in this case, the object is responsible for releasing/deleting it.
+ /// In the case the object is created from an exisiting hdc, it is not released; this is consistent
+ /// with the Win32 guideline that says if you call GetDC/CreateDC/CreatIC/CreateEnhMetafile, you are
+ /// responsible for calling ReleaseDC/DeleteDC/DeleteEnhMetafile respectivelly.
+ ///
+ /// This class implements some of the operations commonly performed on the properties of a dc in WinForms,
+ /// specially for interacting with GDI+, like clipping and coordinate transformation.
+ /// Several properties are not persisted in the dc but instead they are set/reset during a more comprehensive
+ /// operation like text rendering or painting; for instance text alignment is set and reset during DrawText (GDI),
+ /// DrawString (GDI+).
+ ///
+ /// Other properties are persisted from operation to operation until they are reset, like clipping,
+ /// one can make several calls to Graphics or WindowsGraphics obect after setting the dc clip area and
+ /// before resetting it; these kinds of properties are the ones implemented in this class.
+ /// This kind of properties place an extra chanllenge in the scenario where a DeviceContext is obtained
+ /// from a Graphics object that has been used with GDI+, because GDI+ saves the hdc internally, rendering the
+ /// DeviceContext underlying hdc out of sync. DeviceContext needs to support these kind of properties to
+ /// be able to keep the GDI+ and GDI HDCs in sync.
+ ///
+ /// A few other persisting properties have been implemented in DeviceContext2, among them:
+ /// 1. Window origin.
+ /// 2. Bounding rectangle.
+ /// 3. DC origin.
+ /// 4. View port extent.
+ /// 5. View port origin.
+ /// 6. Window extent
+ ///
+ /// Other non-persisted properties just for information: Background/Forground color, Palette, Color adjustment,
+ /// Color space, ICM mode and profile, Current pen position, Binary raster op (not supported by GDI+),
+ /// Background mode, Logical Pen, DC pen color, ARc direction, Miter limit, Logical brush, DC brush color,
+ /// Brush origin, Polygon filling mode, Bitmap stretching mode, Logical font, Intercharacter spacing,
+ /// Font mapper flags, Text alignment, Test justification, Layout, Path, Meta region.
+ /// See book "Windows Graphics Programming - Feng Yuang", P315 - Device Context Attributes.
+ /// </devdoc>
+
+ private IntPtr _hDC;
+ private DeviceContextType _dcType;
+
+ public event EventHandler Disposing;
+
+ private bool _disposed;
+
+ // We cache the hWnd when creating the dc from one, to provide support forIDeviceContext.GetHdc/ReleaseHdc.
+ // This hWnd could be null, in such case it is referring to the screen.
+ private IntPtr _hWnd = (IntPtr)(-1); // Unlikely to be a valid hWnd.
+
+ private IntPtr _hInitialPen;
+ private IntPtr _hInitialBrush;
+ private IntPtr _hInitialBmp;
+ private IntPtr _hInitialFont;
+
+ private IntPtr _hCurrentPen;
+ private IntPtr _hCurrentBrush;
+ private IntPtr _hCurrentBmp;
+ private IntPtr _hCurrentFont;
+
+ private Stack _contextStack;
+
+#if GDI_FINALIZATION_WATCH
+ private string AllocationSite = DbgUtil.StackTrace;
+ private string DeAllocationSite = "";
+#endif
+
+ ///
+ /// Class properties...
+ ///
+
+ /// <devdoc>
+ /// Specifies whether a modification has been applied to the dc, like setting the clipping area or a coordinate transform.
+ /// </devdoc>
+
+ /// <devdoc>
+ /// The device type the context refers to.
+ /// </devdoc>
+ public DeviceContextType DeviceContextType
+ {
+ get
+ {
+ return _dcType;
+ }
+ }
+
+ /// <devdoc>
+ /// This object's hdc. If this property is called, then the object will be used as an HDC wrapper,
+ /// so the hdc is cached and calls to GetHdc/ReleaseHdc won't PInvoke into GDI.
+ /// Call Dispose to properly release the hdc.
+ /// </devdoc>
+ public IntPtr Hdc
+ {
+ get
+ {
+ if (_hDC == IntPtr.Zero)
+ {
+ if (_dcType == DeviceContextType.Display)
+ {
+ Debug.Assert(!_disposed, "Accessing a disposed DC, forcing recreation of HDC - this will generate a Handle leak!");
+
+ // Note: ReleaseDC must be called from the same thread. This applies only to HDC obtained
+ // from calling GetDC. This means Display DeviceContext objects should never be finalized.
+ _hDC = ((IDeviceContext)this).GetHdc(); // _hDC will be released on call to Dispose.
+ CacheInitialState();
+ }
+#if GDI_FINALIZATION_WATCH
+ else
+ {
+ try { Debug.WriteLine(string.Format("Allocation stack:\r\n{0}\r\nDeallocation stack:\r\n{1}", AllocationSite, DeAllocationSite)); } catch {}
+ }
+#endif
+ }
+
+ Debug.Assert(_hDC != IntPtr.Zero, "Attempt to use deleted HDC - DC type: " + _dcType);
+
+ return _hDC;
+ }
+ }
+
+ // VSWhidbey 536325
+ // Due to a problem with calling DeleteObject() on currently selected GDI objects,
+ // we now track the initial set of objects when a DeviceContext is created. Then,
+ // we also track which objects are currently selected in the DeviceContext. When
+ // a currently selected object is disposed, it is first replaced in the DC and then
+ // deleted.
+ private void CacheInitialState()
+ {
+ Debug.Assert(_hDC != IntPtr.Zero, "Cannot get initial state without a valid HDC");
+ _hCurrentPen = _hInitialPen = IntUnsafeNativeMethods.GetCurrentObject(new HandleRef(this, _hDC), IntNativeMethods.OBJ_PEN);
+ _hCurrentBrush = _hInitialBrush = IntUnsafeNativeMethods.GetCurrentObject(new HandleRef(this, _hDC), IntNativeMethods.OBJ_BRUSH);
+ _hCurrentBmp = _hInitialBmp = IntUnsafeNativeMethods.GetCurrentObject(new HandleRef(this, _hDC), IntNativeMethods.OBJ_BITMAP);
+ _hCurrentFont = _hInitialFont = IntUnsafeNativeMethods.GetCurrentObject(new HandleRef(this, _hDC), IntNativeMethods.OBJ_FONT);
+ }
+
+ public void DeleteObject(IntPtr handle, GdiObjectType type)
+ {
+ IntPtr handleToDelete = IntPtr.Zero;
+ switch (type)
+ {
+ case GdiObjectType.Pen:
+ if (handle == _hCurrentPen)
+ {
+ IntPtr currentPen = IntUnsafeNativeMethods.SelectObject(new HandleRef(this, Hdc), new HandleRef(this, _hInitialPen));
+ Debug.Assert(currentPen == _hCurrentPen, "DeviceContext thinks a different pen is selected than the HDC");
+ _hCurrentPen = IntPtr.Zero;
+ }
+ handleToDelete = handle;
+ break;
+ case GdiObjectType.Brush:
+ if (handle == _hCurrentBrush)
+ {
+ IntPtr currentBrush = IntUnsafeNativeMethods.SelectObject(new HandleRef(this, Hdc), new HandleRef(this, _hInitialBrush));
+ Debug.Assert(currentBrush == _hCurrentBrush, "DeviceContext thinks a different brush is selected than the HDC");
+ _hCurrentBrush = IntPtr.Zero;
+ }
+ handleToDelete = handle;
+ break;
+ case GdiObjectType.Bitmap:
+ if (handle == _hCurrentBmp)
+ {
+ IntPtr currentBmp = IntUnsafeNativeMethods.SelectObject(new HandleRef(this, Hdc), new HandleRef(this, _hInitialBmp));
+ Debug.Assert(currentBmp == _hCurrentBmp, "DeviceContext thinks a different brush is selected than the HDC");
+ _hCurrentBmp = IntPtr.Zero;
+ }
+ handleToDelete = handle;
+ break;
+ }
+
+ IntUnsafeNativeMethods.DeleteObject(new HandleRef(this, handleToDelete));
+ }
+
+ //
+ // object construction API. Publicly constructable from static methods only.
+ //
+
+ /// <devdoc>
+ /// Constructor to contruct a DeviceContext object from an window handle.
+ /// </devdoc>
+ private DeviceContext(IntPtr hWnd)
+ {
+ _hWnd = hWnd;
+ _dcType = DeviceContextType.Display;
+
+ DeviceContexts.AddDeviceContext(this);
+
+ // the hDc will be created on demand.
+
+#if TRACK_HDC
+ Debug.WriteLine( DbgUtil.StackTraceToStr(String.Format( "DeviceContext( hWnd=0x{0:x8} )", unchecked((int) hWnd))));
+#endif
+ }
+
+ /// <devdoc>
+ /// Constructor to contruct a DeviceContext object from an existing Win32 device context handle.
+ /// </devdoc>
+ private DeviceContext(IntPtr hDC, DeviceContextType dcType)
+ {
+ _hDC = hDC;
+ _dcType = dcType;
+
+ CacheInitialState();
+ DeviceContexts.AddDeviceContext(this);
+
+ if (dcType == DeviceContextType.Display)
+ {
+ _hWnd = IntUnsafeNativeMethods.WindowFromDC(new HandleRef(this, _hDC));
+ }
+#if TRACK_HDC
+ Debug.WriteLine( DbgUtil.StackTraceToStr( String.Format("DeviceContext( hDC=0x{0:X8}, Type={1} )", unchecked((int) hDC), dcType) ));
+#endif
+ }
+
+
+
+ /// <devdoc>
+ /// CreateDC creates a DeviceContext object wrapping an hdc created with the Win32 CreateDC function.
+ /// </devdoc>
+ public static DeviceContext CreateDC(string driverName, string deviceName, string fileName, HandleRef devMode)
+ {
+ // Note: All input params can be null but not at the same time. See MSDN for information.
+
+ IntPtr hdc = IntUnsafeNativeMethods.CreateDC(driverName, deviceName, fileName, devMode);
+ return new DeviceContext(hdc, DeviceContextType.NamedDevice);
+ }
+
+ /// <devdoc>
+ /// CreateIC creates a DeviceContext object wrapping an hdc created with the Win32 CreateIC function.
+ /// </devdoc>
+ public static DeviceContext CreateIC(string driverName, string deviceName, string fileName, HandleRef devMode)
+ {
+ // Note: All input params can be null but not at the same time. See MSDN for information.
+
+ IntPtr hdc = IntUnsafeNativeMethods.CreateIC(driverName, deviceName, fileName, devMode);
+ return new DeviceContext(hdc, DeviceContextType.Information);
+ }
+
+ /// <devdoc>
+ /// Creates a DeviceContext object wrapping a memory DC compatible with the specified device.
+ /// </devdoc>
+ public static DeviceContext FromCompatibleDC(IntPtr hdc)
+ {
+ // If hdc is null, the function creates a memory DC compatible with the application's current screen.
+ // Win2K+: (See CreateCompatibleDC in the MSDN).
+ // In this case the thread that calls CreateCompatibleDC owns the HDC that is created. When this thread is destroyed,
+ // the HDC is no longer valid.
+
+ IntPtr compatibleDc = IntUnsafeNativeMethods.CreateCompatibleDC(new HandleRef(null, hdc));
+ return new DeviceContext(compatibleDc, DeviceContextType.Memory);
+ }
+
+ /// <include file='doc\IDeviceContext.uex' path='docs/doc[@for="DeviceContext.FromHdc"]/*' />
+ /// <devdoc>
+ /// Used for wrapping an existing hdc. In this case, this object doesn't own the hdc
+ /// so calls to GetHdc/ReleaseHdc don't PInvoke into GDI.
+ /// </devdoc>
+ public static DeviceContext FromHdc(IntPtr hdc)
+ {
+ Debug.Assert(hdc != IntPtr.Zero, "hdc == 0");
+ return new DeviceContext(hdc, DeviceContextType.Unknown);
+ }
+
+ /// <include file='doc\IDeviceContext.uex' path='docs/doc[@for="DeviceContext.FromHwnd"]/*' />
+ /// <devdoc>
+ /// When hwnd is null, we are getting the screen DC.
+ /// </devdoc>
+ public static DeviceContext FromHwnd(IntPtr hwnd)
+ {
+ return new DeviceContext(hwnd);
+ }
+
+
+ /// <include file='doc\IDeviceContext.uex' path='docs/doc[@for="DeviceContext.Finalize"]/*' />
+ ~DeviceContext()
+ {
+ Dispose(false);
+ }
+
+ /// <include file='doc\IDeviceContext.uex' path='docs/doc[@for="DeviceContext.Dispose"]/*' />
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <include file='doc\IDeviceContext.uex' path='docs/doc[@for="DeviceContext.Dispose1"]/*' />
+ internal void Dispose(bool disposing)
+ {
+ if (_disposed)
+ {
+ return;
+ }
+
+ if (Disposing != null)
+ {
+ Disposing(this, EventArgs.Empty);
+ }
+
+ _disposed = true;
+
+ switch (_dcType)
+ {
+ case DeviceContextType.Display:
+ Debug.Assert(disposing, "WARNING: Finalizing a Display DeviceContext.\r\nReleaseDC may fail when not called from the same thread GetDC was called from.");
+
+ ((IDeviceContext)this).ReleaseHdc();
+ break;
+
+ case DeviceContextType.Information:
+ case DeviceContextType.NamedDevice:
+
+ // CreateDC and CreateIC add an HDC handle to the HandleCollector; to remove it properly we need
+ // to call DeleteHDC.
+#if TRACK_HDC
+ Debug.WriteLine( DbgUtil.StackTraceToStr( String.Format("DC.DeleteHDC(hdc=0x{0:x8})", unchecked((int) _hDC))));
+#endif
+
+ IntUnsafeNativeMethods.DeleteHDC(new HandleRef(this, _hDC));
+
+ _hDC = IntPtr.Zero;
+ break;
+
+ case DeviceContextType.Memory:
+
+ // CreatCompatibleDC adds a GDI handle to HandleCollector, to remove it properly we need to call
+ // DeleteDC.
+#if TRACK_HDC
+ Debug.WriteLine( DbgUtil.StackTraceToStr( String.Format("DC.DeleteDC(hdc=0x{0:x8})", unchecked((int) _hDC))));
+#endif
+ IntUnsafeNativeMethods.DeleteDC(new HandleRef(this, _hDC));
+
+ _hDC = IntPtr.Zero;
+ break;
+
+ // case DeviceContextType.Metafile: - not yet supported.
+ case DeviceContextType.Unknown:
+ default:
+ return;
+ // do nothing, the hdc is not owned by this object.
+ // in this case it is ok if disposed throught finalization.
+ }
+
+ DbgUtil.AssertFinalization(this, disposing);
+ }
+
+ /// <include file='doc\IDeviceContext.uex' path='docs/doc[@for="DeviceContext.GetHdc"]/*' />
+ /// <devdoc>
+ /// Explicit interface method implementation to hide them a bit for usability reasons so the object is seen
+ /// as a wrapper around an hdc that is always available, and for performance reasons since it caches the hdc
+ /// if used in this way.
+ /// </devdoc>
+ IntPtr IDeviceContext.GetHdc()
+ {
+ if (_hDC == IntPtr.Zero)
+ {
+ Debug.Assert(_dcType == DeviceContextType.Display, "Calling GetDC from a non display/window device.");
+
+ // Note: for common DCs, GetDC assigns default attributes to the DC each time it is retrieved.
+ // For example, the default font is System.
+ _hDC = IntUnsafeNativeMethods.GetDC(new HandleRef(this, _hWnd));
+#if TRACK_HDC
+ Debug.WriteLine( DbgUtil.StackTraceToStr( String.Format("hdc[0x{0:x8}]=DC.GetHdc(hWnd=0x{1:x8})", unchecked((int) _hDC), unchecked((int) _hWnd))));
+#endif
+ }
+
+ return _hDC;
+ }
+
+
+ /// <include file='doc\IDeviceContext.uex' path='docs/doc[@for="DeviceContext.ReleaseHdc"]/*' />
+ ///<devdoc>
+ /// If the object was created from a DC, this object doesn't 'own' the dc so we just ignore
+ /// this call.
+ ///</devdoc>
+ void IDeviceContext.ReleaseHdc()
+ {
+ if (_hDC != IntPtr.Zero && _dcType == DeviceContextType.Display)
+ {
+#if TRACK_HDC
+ int retVal =
+#endif
+ IntUnsafeNativeMethods.ReleaseDC(new HandleRef(this, _hWnd), new HandleRef(this, _hDC));
+ // Note: retVal == 0 means it was not released but doesn't necessarily means an error; class or private DCs are never released.
+#if TRACK_HDC
+ Debug.WriteLine( DbgUtil.StackTraceToStr( String.Format("[ret={0}]=DC.ReleaseDC(hDc=0x{1:x8}, hWnd=0x{2:x8})", retVal, unchecked((int) _hDC), unchecked((int) _hWnd))));
+#endif
+ _hDC = IntPtr.Zero;
+ }
+ }
+
+
+ /// <devdoc>
+ /// Specifies whether the DC is in GM_ADVANCE mode (supported only in NT platforms).
+ /// If false, it is in GM_COMPATIBLE mode.
+ /// </devdoc>
+ public DeviceContextGraphicsMode GraphicsMode
+ {
+ get
+ {
+ return (DeviceContextGraphicsMode)IntUnsafeNativeMethods.GetGraphicsMode(new HandleRef(this, _hDC));
+ }
+ }
+
+ /// <devdoc>
+ /// Sets the dc graphics mode and returns the old value.
+ /// </devdoc>
+ public DeviceContextGraphicsMode SetGraphicsMode(DeviceContextGraphicsMode newMode)
+ {
+ return (DeviceContextGraphicsMode)IntUnsafeNativeMethods.SetGraphicsMode(new HandleRef(this, _hDC), unchecked((int)newMode));
+ }
+
+ /// <devdoc>
+ /// Restores the device context to the specified state. The DC is restored by popping state information off a
+ /// stack created by earlier calls to the SaveHdc function.
+ /// The stack can contain the state information for several instances of the DC. If the state specified by the
+ /// specified parameter is not at the top of the stack, RestoreDC deletes all state information between the top
+ /// of the stack and the specified instance.
+ /// Specifies the saved state to be restored. If this parameter is positive, nSavedDC represents a specific
+ /// instance of the state to be restored. If this parameter is negative, nSavedDC represents an instance relative
+ /// to the current state. For example, -1 restores the most recently saved state.
+ /// See MSDN for more info.
+ /// </devdoc>
+ public void RestoreHdc()
+ {
+#if TRACK_HDC
+ bool result =
+#endif
+ // Note: Don't use the Hdc property here, it would force handle creation.
+ IntUnsafeNativeMethods.RestoreDC(new HandleRef(this, _hDC), -1);
+#if TRACK_HDC
+ // Note: Winforms may call this method during app exit at which point the DC may have been finalized already causing this assert to popup.
+ Debug.WriteLine( DbgUtil.StackTraceToStr( String.Format("ret[0]=DC.RestoreHdc(hDc=0x{1:x8}, state={2})", result, unchecked((int) _hDC), restoreState) ));
+#endif
+ Debug.Assert(_contextStack != null, "Someone is calling RestoreHdc() before SaveHdc()");
+
+ if (_contextStack != null)
+ {
+ GraphicsState g = (GraphicsState)_contextStack.Pop();
+
+ _hCurrentBmp = g.hBitmap;
+ _hCurrentBrush = g.hBrush;
+ _hCurrentPen = g.hPen;
+ _hCurrentFont = g.hFont;
+ }
+
+#if OPTIMIZED_MEASUREMENTDC
+ // in this case, GDI will copy back the previously saved font into the DC.
+ // we dont actually know what the font is in our measurement DC so
+ // we need to clear it off.
+ MeasurementDCInfo.ResetIfIsMeasurementDC(_hDC);
+#endif
+ }
+
+ /// <devdoc>
+ /// Saves the current state of the device context by copying data describing selected objects and graphic
+ /// modes (such as the bitmap, brush, palette, font, pen, region, drawing mode, and mapping mode) to a
+ /// context stack.
+ /// The SaveDC function can be used any number of times to save any number of instances of the DC state.
+ /// A saved state can be restored by using the RestoreHdc method.
+ /// See MSDN for more details.
+ /// </devdoc>
+ public int SaveHdc()
+ {
+ HandleRef hdc = new HandleRef(this, _hDC);
+ int state = IntUnsafeNativeMethods.SaveDC(hdc);
+
+ if (_contextStack == null)
+ {
+ _contextStack = new Stack();
+ }
+
+ GraphicsState g = new GraphicsState();
+ g.hBitmap = _hCurrentBmp;
+ g.hBrush = _hCurrentBrush;
+ g.hPen = _hCurrentPen;
+ g.hFont = _hCurrentFont;
+
+ _contextStack.Push(g);
+
+#if TRACK_HDC
+ Debug.WriteLine( DbgUtil.StackTraceToStr( String.Format("state[0]=DC.SaveHdc(hDc=0x{1:x8})", state, unchecked((int) _hDC)) ));
+#endif
+
+ return state;
+ }
+
+ /// <devdoc>
+ /// Selects a region as the current clipping region for the device context.
+ /// Remarks (From MSDN):
+ /// - Only a copy of the selected region is used. The region itself can be selected for any number of other device contexts or it can be deleted.
+ /// - The SelectClipRgn function assumes that the coordinates for a region are specified in device units.
+ /// - To remove a device-context's clipping region, specify a NULL region handle.
+ /// </devdoc>
+ public void SetClip(WindowsRegion region)
+ {
+ HandleRef hdc = new HandleRef(this, _hDC);
+ HandleRef hRegion = new HandleRef(region, region.HRegion);
+
+ IntUnsafeNativeMethods.SelectClipRgn(hdc, hRegion);
+ }
+
+ ///<devdoc>
+ /// Creates a new clipping region from the intersection of the current clipping region and
+ /// the specified rectangle.
+ ///</devdoc>
+ public void IntersectClip(WindowsRegion wr)
+ {
+ //if the incoming windowsregion is infinite, there is no need to do any intersecting.
+ if (wr.HRegion == IntPtr.Zero)
+ {
+ return;
+ }
+
+ WindowsRegion clip = new WindowsRegion(0, 0, 0, 0);
+ try
+ {
+ int result = IntUnsafeNativeMethods.GetClipRgn(new HandleRef(this, _hDC), new HandleRef(clip, clip.HRegion));
+
+ // If the function succeeds and there is a clipping region for the given device context, the return value is 1.
+ if (result == 1)
+ {
+ Debug.Assert(clip.HRegion != IntPtr.Zero);
+ wr.CombineRegion(clip, wr, RegionCombineMode.AND); //1 = AND (or Intersect)
+ }
+
+ SetClip(wr);
+ }
+ finally
+ {
+ clip.Dispose();
+ }
+ }
+
+ /// <devdoc>
+ /// Modifies the viewport origin for a device context using the specified horizontal and vertical offsets in logical units.
+ /// </devdoc>
+ public void TranslateTransform(int dx, int dy)
+ {
+ IntNativeMethods.POINT orgn = new IntNativeMethods.POINT();
+ IntUnsafeNativeMethods.OffsetViewportOrgEx(new HandleRef(this, _hDC), dx, dy, orgn);
+ }
+
+ /// <summary>
+ /// </summary>
+ public override bool Equals(object obj)
+ {
+ DeviceContext other = obj as DeviceContext;
+
+ if (other == this)
+ {
+ return true;
+ }
+
+ if (other == null)
+ {
+ return false;
+ }
+
+ // Note: Use property instead of field so the HDC is initialized. Also, this avoid serialization issues (the obj could be a proxy that does not have access to private fields).
+ return other.Hdc == _hDC;
+ }
+
+ /// <summary>
+ /// This allows collections to treat DeviceContext objects wrapping the same HDC as the same objects.
+ /// </summary>
+ public override int GetHashCode()
+ {
+ return _hDC.GetHashCode();
+ }
+
+
+ internal class GraphicsState
+ {
+ internal IntPtr hBrush;
+ internal IntPtr hFont;
+ internal IntPtr hPen;
+ internal IntPtr hBitmap;
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/misc/GDI/DeviceContextGraphicsMode.cs b/src/System.Drawing.Common/src/misc/GDI/DeviceContextGraphicsMode.cs
new file mode 100644
index 0000000000..2d3d16b47f
--- /dev/null
+++ b/src/System.Drawing.Common/src/misc/GDI/DeviceContextGraphicsMode.cs
@@ -0,0 +1,48 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Internal
+{
+ /// <devdoc>
+ /// Specifies the graphics mode of a device context.
+ /// </devdoc>
+ internal enum DeviceContextGraphicsMode
+ {
+ /*
+ Sets the graphics mode that is compatible with 16-bit Windows. This is the default mode.
+ If this value is specified, the application can only modify the world-to-device transform
+ by calling functions that set window and viewport extents and origins, but not by using
+ SetWorldTransform or ModifyWorldTransform; calls to those functions will fail.
+ Examples of functions that set window and viewport extents and origins are SetViewportExtEx
+ and SetWindowExtEx.
+ */
+ Compatible = 1,
+
+ /*
+ Windows NT/2000/XP: Sets the advanced graphics mode that allows world transformations. This value
+ must be specified if the application will set or modify the world transformation for the specified
+ device context. In this mode all graphics, including text output, fully conform to the world-to-device
+ transformation specified in the device context.
+ Windows 95/98/Me:The GM_ADVANCED value is not supported. When playing enhanced metafiles, the system
+ attempts to make enhanced metafiles look the same as they do on Windows NT/2000/XP. To accomplish this,
+ the system may simulate GM_ADVANCED mode when playing specific enhanced metafile records.
+ */
+ Advanced = 2,
+
+ /*
+ Resets the current world transformation by using the identity matrix. If this mode is specified,
+ the XFORM structure pointed to by lpXform is ignored.
+ */
+ ModifyWorldIdentity = 1
+
+ /*
+ GM_COMPATIBLE = 1,
+ GM_ADVANCED = 2,
+
+ MWT_IDENTITY = 1,
+ MWT_LEFTMULTIPLY // Multiplies the current transformation by the data in the XFORM structure. (The data in the XFORM structure becomes the left multiplicand, and the data for the current transformation becomes the right multiplicand.)
+ MWT_RIGHTMULTIPLY // Multiplies the current transformation by the data in the XFORM structure. (The data in the XFORM structure becomes the right multiplicand, and the data for the current transformation becomes the left multiplicand.)
+ */
+ }
+}
diff --git a/src/System.Drawing.Common/src/misc/GDI/DeviceContextType.cs b/src/System.Drawing.Common/src/misc/GDI/DeviceContextType.cs
new file mode 100644
index 0000000000..07a9a0eaac
--- /dev/null
+++ b/src/System.Drawing.Common/src/misc/GDI/DeviceContextType.cs
@@ -0,0 +1,34 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Internal
+{
+ /// <devdoc>
+ /// Represent the device type the context refers to.
+ /// </devdoc>
+ internal enum DeviceContextType
+ {
+ // Unknown device
+ Unknown = 0x00,
+
+ // Display DC - obtained from GetDC/GetDCEx/BeginPaint.
+ Display = 0x01,
+
+ // Window DC including non-client area - obtained from GetWindowDC
+ NCWindow = 0x02,
+
+ // Printer DC - obtained from CreateDC.
+ NamedDevice = 0x03,
+
+ // Information context - obtained from CreateIC.
+ Information = 0x04,
+
+ // Memory dc - obtained from CreateCompatibleDC.
+ Memory = 0x05,
+
+ // Metafile dc - obtained from CreateEnhMetafile.
+ Metafile = 0x06 // currently not supported.
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/misc/GDI/DeviceContexts.cs b/src/System.Drawing.Common/src/misc/GDI/DeviceContexts.cs
new file mode 100644
index 0000000000..40e49541bd
--- /dev/null
+++ b/src/System.Drawing.Common/src/misc/GDI/DeviceContexts.cs
@@ -0,0 +1,56 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Internal
+{
+ /// <devdoc>
+ /// Keeps a cache of some graphics primitives.
+ /// Created to improve performance of TextRenderer.MeasureText methods that don't receive a WindowsGraphics.
+ /// This class mantains a cache of MRU WindowsFont objects in the process.
+ /// </devdoc>
+ internal static class DeviceContexts
+ {
+ [ThreadStatic]
+ private static ClientUtils.WeakRefCollection t_activeDeviceContexts;
+
+ /// <devdoc>
+ /// WindowsGraphicsCacheManager needs to track DeviceContext
+ /// objects so it can ask them if a font is in use before they
+ /// it's deleted.
+ internal static void AddDeviceContext(DeviceContext dc)
+ {
+ if (t_activeDeviceContexts == null)
+ {
+ t_activeDeviceContexts = new ClientUtils.WeakRefCollection();
+ t_activeDeviceContexts.RefCheckThreshold = 20;
+ }
+
+ if (!t_activeDeviceContexts.Contains(dc))
+ {
+ dc.Disposing += new EventHandler(OnDcDisposing);
+ t_activeDeviceContexts.Add(dc);
+ }
+ }
+
+ private static void OnDcDisposing(object sender, EventArgs e)
+ {
+ DeviceContext dc = sender as DeviceContext;
+
+ if (dc != null)
+ {
+ dc.Disposing -= new EventHandler(OnDcDisposing);
+ RemoveDeviceContext(dc);
+ }
+ }
+
+ internal static void RemoveDeviceContext(DeviceContext dc)
+ {
+ if (t_activeDeviceContexts == null)
+ {
+ return;
+ }
+ t_activeDeviceContexts.RemoveByHashCode(dc);
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/misc/GDI/GdiObjectType.cs b/src/System.Drawing.Common/src/misc/GDI/GdiObjectType.cs
new file mode 100644
index 0000000000..8338ac18f4
--- /dev/null
+++ b/src/System.Drawing.Common/src/misc/GDI/GdiObjectType.cs
@@ -0,0 +1,39 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Internal
+{
+ /// <devdoc>
+ /// Specifies the the type of a GDI object.
+ /// </devdoc>
+ internal enum GdiObjectType
+ {
+ Pen = 1,
+ Brush = 2,
+ DisplayDC = 3,
+ MetafileDC = 4,
+ Palette = 5,
+ Font = 6,
+ Bitmap = 7,
+ Region = 8,
+ Metafile = 9,
+ MemoryDC = 10,
+ ExtendedPen = 11,
+ EnhancedMetafileDC = 12,
+ EnhMetafile = 13,
+ ColorSpace = 14
+
+ /*
+ OBJ_PEN = 1,
+ OBJ_BRUSH = 2,
+ OBJ_FONT = 6,
+ OBJ_EXTPEN = 11,
+
+ OBJ_DC = 3,
+ OBJ_METADC = 4,
+ OBJ_MEMDC = 10,
+ OBJ_ENHMETADC = 12,
+ */
+ }
+}
diff --git a/src/System.Drawing.Common/src/misc/GDI/NativeMethods.cs b/src/System.Drawing.Common/src/misc/GDI/NativeMethods.cs
new file mode 100644
index 0000000000..e81fb002bf
--- /dev/null
+++ b/src/System.Drawing.Common/src/misc/GDI/NativeMethods.cs
@@ -0,0 +1,371 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Internal
+{
+ using System.Diagnostics;
+ using System.Runtime.InteropServices;
+
+ internal partial class IntNativeMethods
+ {
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")]
+ public const int MaxTextLengthInWin9x = 8192;
+
+ public const int
+ DT_TOP = 0x00000000,
+ DT_LEFT = 0x00000000,
+ DT_CENTER = 0x00000001,
+ DT_RIGHT = 0x00000002,
+ DT_VCENTER = 0x00000004,
+ DT_BOTTOM = 0x00000008,
+ DT_WORDBREAK = 0x00000010,
+ DT_SINGLELINE = 0x00000020,
+ DT_EXPANDTABS = 0x00000040,
+ DT_TABSTOP = 0x00000080,
+ DT_NOCLIP = 0x00000100,
+ DT_EXTERNALLEADING = 0x00000200,
+ DT_CALCRECT = 0x00000400,
+ DT_NOPREFIX = 0x00000800,
+ DT_INTERNAL = 0x00001000,
+ DT_EDITCONTROL = 0x00002000,
+ DT_PATH_ELLIPSIS = 0x00004000,
+ DT_END_ELLIPSIS = 0x00008000,
+ DT_MODIFYSTRING = 0x00010000,
+ DT_RTLREADING = 0x00020000,
+ DT_WORD_ELLIPSIS = 0x00040000,
+ DT_NOFULLWIDTHCHARBREAK = 0x00080000,
+ DT_HIDEPREFIX = 0x00100000,
+ DT_PREFIXONLY = 0x00200000,
+
+ DIB_RGB_COLORS = 0,
+ BI_BITFIELDS = 3,
+ BI_RGB = 0,
+ BITMAPINFO_MAX_COLORSIZE = 256,
+ SPI_GETICONTITLELOGFONT = 0x001F,
+ SPI_GETNONCLIENTMETRICS = 41,
+ DEFAULT_GUI_FONT = 17,
+ HOLLOW_BRUSH = 5,
+
+ BITSPIXEL = 12,
+ ALTERNATE = 1,
+ WINDING = 2,
+
+ SRCCOPY = 0x00CC0020,
+ SRCPAINT = 0x00EE0086, /* dest = source OR dest */
+ SRCAND = 0x008800C6, /* dest = source AND dest */
+ SRCINVERT = 0x00660046, /* dest = source XOR dest */
+ SRCERASE = 0x00440328, /* dest = source AND (NOT dest ) */
+ NOTSRCCOPY = 0x00330008, /* dest = (NOT source) */
+ NOTSRCERASE = 0x001100A6, /* dest = (NOT src) AND (NOT dest) */
+ MERGECOPY = 0x00C000CA, /* dest = (source AND pattern) */
+ MERGEPAINT = 0x00BB0226, /* dest = (NOT source) OR dest */
+ PATCOPY = 0x00F00021, /* dest = pattern */
+ PATPAINT = 0x00FB0A09, /* dest = DPSnoo */
+ PATINVERT = 0x005A0049, /* dest = pattern XOR dest */
+ DSTINVERT = 0x00550009, /* dest = (NOT dest) */
+ BLACKNESS = 0x00000042, /* dest = BLACK */
+ WHITENESS = 0x00FF0062, /* dest = WHITE */
+ CAPTUREBLT = 0x40000000, /* Include layered windows */
+
+
+ /* FONT WEIGHT (BOLD) VALUES */
+ FW_DONTCARE = 0,
+ FW_NORMAL = 400,
+ FW_BOLD = 700,
+ // some others...
+
+ /* FONT CHARACTER SET */
+ ANSI_CHARSET = 0,
+ DEFAULT_CHARSET = 1,
+ // plus others ....
+
+ /* Font OutPrecision */
+ OUT_DEFAULT_PRECIS = 0,
+ OUT_TT_PRECIS = 4,
+ OUT_TT_ONLY_PRECIS = 7,
+ // some others...
+
+ /* Font clip precision */
+ CLIP_DEFAULT_PRECIS = 0,
+ // some others...
+
+ /* Font Quality */
+ DEFAULT_QUALITY = 0,
+ DRAFT_QUALITY = 1,
+ PROOF_QUALITY = 2,
+ NONANTIALIASED_QUALITY = 3,
+ ANTIALIASED_QUALITY = 4,
+ CLEARTYPE_QUALITY = 5,
+ CLEARTYPE_NATURAL_QUALITY = 6,
+
+ /* Object Definitions for GetCurrentObject() and others. */
+ OBJ_PEN = 1,
+ OBJ_BRUSH = 2,
+ OBJ_DC = 3,
+ OBJ_METADC = 4,
+ // OBJ_PAL = 5,
+ OBJ_FONT = 6,
+ OBJ_BITMAP = 7,
+ // OBJ_REGION = 8,
+ // OBJ_METAFILE = 9,
+ OBJ_MEMDC = 10,
+ OBJ_EXTPEN = 11,
+ OBJ_ENHMETADC = 12,
+ // OBJ_ENHMETAFILE = 13,
+ // OBJ_COLORSPACE = 14
+
+ // Brush styles
+ BS_SOLID = 0,
+ BS_HATCHED = 2,
+ // BS_PATTERN = 3,
+ // some others...
+
+ // Code page
+ CP_ACP = 0, // ANSI
+
+
+ FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x00000100,
+ FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200,
+ FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000,
+ FORMAT_MESSAGE_DEFAULT = FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM;
+ // some others...
+
+ public enum RegionFlags
+ {
+ ERROR = 0,
+ NULLREGION = 1,
+ SIMPLEREGION = 2,
+ COMPLEXREGION = 3,
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct RECT
+ {
+ public int left;
+ public int top;
+ public int right;
+ public int bottom;
+
+ public RECT(int left, int top, int right, int bottom)
+ {
+ this.left = left;
+ this.top = top;
+ this.right = right;
+ this.bottom = bottom;
+ }
+
+ public RECT(System.Drawing.Rectangle r)
+ {
+ left = r.Left;
+ top = r.Top;
+ right = r.Right;
+ bottom = r.Bottom;
+ }
+
+ public static RECT FromXYWH(int x, int y, int width, int height)
+ {
+ return new RECT(
+ x,
+ y,
+ x + width,
+ y + height);
+ }
+
+ public Size Size
+ {
+ get
+ {
+ return new Size(right - left, bottom - top);
+ }
+ }
+
+ public System.Drawing.Rectangle ToRectangle()
+ {
+ return new Rectangle(
+ left,
+ top,
+ right - left,
+ bottom - top);
+ }
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ public class POINT
+ {
+ public int x;
+ public int y;
+
+ public POINT()
+ {
+ }
+
+ public POINT(int x, int y)
+ {
+ this.x = x;
+ this.y = y;
+ }
+
+ public System.Drawing.Point ToPoint()
+ {
+ return new System.Drawing.Point(x, y);
+ }
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ public class DRAWTEXTPARAMS
+ {
+ private int _cbSize = Marshal.SizeOf(typeof(DRAWTEXTPARAMS));
+ public int iTabLength;
+ public int iLeftMargin;
+ public int iRightMargin;
+
+ /// <devdoc>
+ /// Receives the number of characters processed by DrawTextEx, including white-space characters.
+ /// The number can be the length of the string or the index of the first line that falls below the drawing area.
+ /// Note that DrawTextEx always processes the entire string if the DT_NOCLIP formatting flag is specified.
+ /// </devdoc>
+ public int uiLengthDrawn;
+
+ public DRAWTEXTPARAMS()
+ {
+ }
+ public DRAWTEXTPARAMS(DRAWTEXTPARAMS original)
+ {
+ iLeftMargin = original.iLeftMargin;
+ iRightMargin = original.iRightMargin;
+ iTabLength = original.iTabLength;
+ }
+
+ public DRAWTEXTPARAMS(int leftMargin, int rightMargin)
+ {
+ iLeftMargin = leftMargin;
+ iRightMargin = rightMargin;
+ }
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ public class LOGBRUSH
+ {
+ public int lbStyle;
+ public int lbColor;
+ public int lbHatch;
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
+ public class LOGFONT
+ {
+ public int lfHeight;
+ public int lfWidth;
+ public int lfEscapement;
+ public int lfOrientation;
+ public int lfWeight;
+ public byte lfItalic;
+ public byte lfUnderline;
+ public byte lfStrikeOut;
+ public byte lfCharSet;
+ public byte lfOutPrecision;
+ public byte lfClipPrecision;
+ public byte lfQuality;
+ public byte lfPitchAndFamily;
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 32)]
+ public string lfFaceName;
+
+ public LOGFONT()
+ {
+ }
+
+ public LOGFONT(LOGFONT lf)
+ {
+ Debug.Assert(lf != null, "lf is null");
+
+ lfHeight = lf.lfHeight;
+ lfWidth = lf.lfWidth;
+ lfEscapement = lf.lfEscapement;
+ lfOrientation = lf.lfOrientation;
+ lfWeight = lf.lfWeight;
+ lfItalic = lf.lfItalic;
+ lfUnderline = lf.lfUnderline;
+ lfStrikeOut = lf.lfStrikeOut;
+ lfCharSet = lf.lfCharSet;
+ lfOutPrecision = lf.lfOutPrecision;
+ lfClipPrecision = lf.lfClipPrecision;
+ lfQuality = lf.lfQuality;
+ lfPitchAndFamily = lf.lfPitchAndFamily;
+ lfFaceName = lf.lfFaceName;
+ }
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+ public struct TEXTMETRIC
+ {
+ public int tmHeight;
+ public int tmAscent;
+ public int tmDescent;
+ public int tmInternalLeading;
+ public int tmExternalLeading;
+ public int tmAveCharWidth;
+ public int tmMaxCharWidth;
+ public int tmWeight;
+ public int tmOverhang;
+ public int tmDigitizedAspectX;
+ public int tmDigitizedAspectY;
+ public char tmFirstChar;
+ public char tmLastChar;
+ public char tmDefaultChar;
+ public char tmBreakChar;
+ public byte tmItalic;
+ public byte tmUnderlined;
+ public byte tmStruckOut;
+ public byte tmPitchAndFamily;
+ public byte tmCharSet;
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
+ public struct TEXTMETRICA
+ {
+ public int tmHeight;
+ public int tmAscent;
+ public int tmDescent;
+ public int tmInternalLeading;
+ public int tmExternalLeading;
+ public int tmAveCharWidth;
+ public int tmMaxCharWidth;
+ public int tmWeight;
+ public int tmOverhang;
+ public int tmDigitizedAspectX;
+ public int tmDigitizedAspectY;
+ public byte tmFirstChar;
+ public byte tmLastChar;
+ public byte tmDefaultChar;
+ public byte tmBreakChar;
+ public byte tmItalic;
+ public byte tmUnderlined;
+ public byte tmStruckOut;
+ public byte tmPitchAndFamily;
+ public byte tmCharSet;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ public class SIZE
+ {
+ public int cx;
+ public int cy;
+
+ public SIZE()
+ {
+ }
+
+ public SIZE(int cx, int cy)
+ {
+ this.cx = cx;
+ this.cy = cy;
+ }
+
+ public System.Drawing.Size ToSize()
+ {
+ return new System.Drawing.Size(cx, cy);
+ }
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/misc/GDI/SafeNativeMethods.cs b/src/System.Drawing.Common/src/misc/GDI/SafeNativeMethods.cs
new file mode 100644
index 0000000000..ce58d3dc49
--- /dev/null
+++ b/src/System.Drawing.Common/src/misc/GDI/SafeNativeMethods.cs
@@ -0,0 +1,89 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Internal
+{
+ using System.Runtime.InteropServices;
+
+ /// <devdoc>
+ /// This is an extract of the System.Drawing IntNativeMethods in the CommonUI tree.
+ /// This is done to be able to compile the GDI code in both assemblies System.Drawing
+ /// and System.Windows.Forms.
+ /// </devdoc>
+ [System.Security.SuppressUnmanagedCodeSecurityAttribute()]
+ internal static partial class IntSafeNativeMethods
+ {
+ public sealed class CommonHandles
+ {
+ static CommonHandles() { }
+
+ /// <devdoc>
+ /// Handle type for enhanced metafiles.
+ /// </devdoc>
+ public static readonly int EMF = System.Internal.HandleCollector.RegisterType("EnhancedMetaFile", 20, 500);
+
+ /// <devdoc>
+ /// Handle type for GDI objects.
+ /// </devdoc>
+ public static readonly int GDI = System.Internal.HandleCollector.RegisterType("GDI", 90, 50);
+
+ /// <devdoc>
+ /// Handle type for HDC's that count against the Win98 limit of five DC's. HDC's
+ /// which are not scarce, such as HDC's for bitmaps, are counted as GDIHANDLE's.
+ /// </devdoc>
+ public static readonly int HDC = System.Internal.HandleCollector.RegisterType("HDC", 100, 2); // wait for 2 dc's before collecting
+ }
+
+ // Brush.
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "CreateSolidBrush", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ private static extern IntPtr IntCreateSolidBrush(int crColor);
+ public static IntPtr CreateSolidBrush(int crColor)
+ {
+ IntPtr hBrush = System.Internal.HandleCollector.Add(IntCreateSolidBrush(crColor), IntSafeNativeMethods.CommonHandles.GDI);
+ DbgUtil.AssertWin32(hBrush != IntPtr.Zero, "IntCreateSolidBrush(color={0}) failed.", crColor);
+ return hBrush;
+ }
+
+ // Pen.
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "CreatePen", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ private static extern IntPtr IntCreatePen(int fnStyle, int nWidth, int crColor);
+ public static IntPtr CreatePen(int fnStyle, int nWidth, int crColor)
+ {
+ IntPtr hPen = System.Internal.HandleCollector.Add(IntCreatePen(fnStyle, nWidth, crColor), IntSafeNativeMethods.CommonHandles.GDI);
+ DbgUtil.AssertWin32(hPen != IntPtr.Zero, "IntCreatePen(style={0}, width={1}, color=[{2}]) failed.", fnStyle, nWidth, crColor);
+ return hPen;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "ExtCreatePen", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ private static extern IntPtr IntExtCreatePen(int fnStyle, int dwWidth, IntNativeMethods.LOGBRUSH lplb, int dwStyleCount, [MarshalAs(UnmanagedType.LPArray)] int[] lpStyle);
+ public static IntPtr ExtCreatePen(int fnStyle, int dwWidth, IntNativeMethods.LOGBRUSH lplb, int dwStyleCount, int[] lpStyle)
+ {
+ IntPtr hPen = System.Internal.HandleCollector.Add(IntExtCreatePen(fnStyle, dwWidth, lplb, dwStyleCount, lpStyle), IntSafeNativeMethods.CommonHandles.GDI);
+ DbgUtil.AssertWin32(hPen != IntPtr.Zero, "IntExtCreatePen(style={0}, width={1}, brush={2}, styleCount={3}, styles={4}) failed.", fnStyle, dwWidth, lplb, dwStyleCount, lpStyle);
+ return hPen;
+ }
+
+ // Region
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "CreateRectRgn", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern IntPtr IntCreateRectRgn(int x1, int y1, int x2, int y2);
+ public static IntPtr CreateRectRgn(int x1, int y1, int x2, int y2)
+ {
+ IntPtr hRgn = System.Internal.HandleCollector.Add(IntCreateRectRgn(x1, y1, x2, y2), IntSafeNativeMethods.CommonHandles.GDI);
+ DbgUtil.AssertWin32(hRgn != IntPtr.Zero, "IntCreateRectRgn([x1={0}, y1={1}, x2={2}, y2={3}]) failed.", x1, y1, x2, y2);
+ return hRgn;
+ }
+
+ // Misc.
+
+ [DllImport(ExternDll.Kernel32, SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetUserDefaultLCID();
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool GdiFlush();
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/misc/GDI/UnsafeNativeMethods.cs b/src/System.Drawing.Common/src/misc/GDI/UnsafeNativeMethods.cs
new file mode 100644
index 0000000000..fc2015e653
--- /dev/null
+++ b/src/System.Drawing.Common/src/misc/GDI/UnsafeNativeMethods.cs
@@ -0,0 +1,631 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Internal
+{
+ using System.Diagnostics;
+ using System.Runtime.InteropServices;
+
+ [System.Security.SuppressUnmanagedCodeSecurityAttribute]
+ internal static partial class IntUnsafeNativeMethods
+ {
+ [DllImport(ExternDll.User32, SetLastError = true, ExactSpelling = true, EntryPoint = "GetDC", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern IntPtr IntGetDC(HandleRef hWnd);
+ public static IntPtr GetDC(HandleRef hWnd)
+ {
+ IntPtr hdc = System.Internal.HandleCollector.Add(IntGetDC(hWnd), IntSafeNativeMethods.CommonHandles.HDC);
+ DbgUtil.AssertWin32(hdc != IntPtr.Zero, "GetHdc([hWnd=0x{0:X8}]) failed.", hWnd);
+ return hdc;
+ }
+
+ /// <devdoc>
+ /// NOTE: DeleteDC is to be used to delete the hdc created from CreateCompatibleDC ONLY. All other hdcs should be
+ /// deleted with DeleteHDC.
+ /// </devdoc>
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "DeleteDC", CharSet = CharSet.Auto)]
+ public static extern bool IntDeleteDC(HandleRef hDC);
+ public static bool DeleteDC(HandleRef hDC)
+ {
+ System.Internal.HandleCollector.Remove((IntPtr)hDC, IntSafeNativeMethods.CommonHandles.GDI);
+ bool retVal = IntDeleteDC(hDC);
+ DbgUtil.AssertWin32(retVal, "DeleteDC([hdc=0x{0:X8}]) failed.", hDC.Handle);
+ return retVal;
+ }
+ public static bool DeleteHDC(HandleRef hDC)
+ {
+ System.Internal.HandleCollector.Remove((IntPtr)hDC, IntSafeNativeMethods.CommonHandles.HDC);
+ bool retVal = IntDeleteDC(hDC);
+ DbgUtil.AssertWin32(retVal, "DeleteHDC([hdc=0x{0:X8}]) failed.", hDC.Handle);
+ return retVal;
+ }
+
+ [DllImport(ExternDll.User32, SetLastError = true, ExactSpelling = true, EntryPoint = "ReleaseDC", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int IntReleaseDC(HandleRef hWnd, HandleRef hDC);
+ public static int ReleaseDC(HandleRef hWnd, HandleRef hDC)
+ {
+ System.Internal.HandleCollector.Remove((IntPtr)hDC, IntSafeNativeMethods.CommonHandles.HDC);
+ // Note: retVal == 0 means it was not released but doesn't necessarily means an error; class or private DCs are never released.
+ return IntReleaseDC(hWnd, hDC);
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, EntryPoint = "CreateDC", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern IntPtr IntCreateDC(string lpszDriverName, string lpszDeviceName, string lpszOutput, HandleRef /*DEVMODE*/ lpInitData);
+ public static IntPtr CreateDC(String lpszDriverName, string lpszDeviceName, string lpszOutput, HandleRef /*DEVMODE*/ lpInitData)
+ {
+ IntPtr hdc = System.Internal.HandleCollector.Add(IntCreateDC(lpszDriverName, lpszDeviceName, lpszOutput, lpInitData), IntSafeNativeMethods.CommonHandles.HDC);
+ DbgUtil.AssertWin32(hdc != IntPtr.Zero, "CreateDC([driverName={0}], [deviceName={1}], [fileName={2}], [devMode={3}]) failed.", lpszDriverName, lpszDeviceName, lpszOutput, lpInitData.Handle);
+ return hdc;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, EntryPoint = "CreateIC", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern IntPtr IntCreateIC(string lpszDriverName, string lpszDeviceName, string lpszOutput, HandleRef /*DEVMODE*/ lpInitData);
+ public static IntPtr CreateIC(string lpszDriverName, string lpszDeviceName, string lpszOutput, HandleRef /*DEVMODE*/ lpInitData)
+ {
+ IntPtr hdc = System.Internal.HandleCollector.Add(IntCreateIC(lpszDriverName, lpszDeviceName, lpszOutput, lpInitData), IntSafeNativeMethods.CommonHandles.HDC);
+ DbgUtil.AssertWin32(hdc != IntPtr.Zero, "CreateIC([driverName={0}], [deviceName={1}], [fileName={2}], [devMode={3}]) failed.", lpszDriverName, lpszDeviceName, lpszOutput, lpInitData.Handle);
+ return hdc;
+ }
+
+ /// <devdoc>
+ /// CreateCompatibleDC requires to add a GDI handle instead of an HDC handle to avoid perf penalty in HandleCollector.
+ /// The hdc obtained from this method needs to be deleted with DeleteDC instead of DeleteHDC.
+ /// </devdoc>
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "CreateCompatibleDC", CharSet = CharSet.Auto)]
+ public static extern IntPtr IntCreateCompatibleDC(HandleRef hDC);
+ public static IntPtr CreateCompatibleDC(HandleRef hDC)
+ {
+ IntPtr compatibleDc = System.Internal.HandleCollector.Add(IntCreateCompatibleDC(hDC), IntSafeNativeMethods.CommonHandles.GDI);
+ DbgUtil.AssertWin32(compatibleDc != IntPtr.Zero, "CreateCompatibleDC([hdc=0x{0:X8}]) failed", hDC.Handle);
+ return compatibleDc;
+ }
+
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "SaveDC", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int IntSaveDC(HandleRef hDC);
+ public static int SaveDC(HandleRef hDC)
+ {
+ int state = IntSaveDC(hDC);
+ DbgUtil.AssertWin32(state != 0, "SaveDC([hdc=0x{0:X8}]) failed", hDC.Handle);
+ return state;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "RestoreDC", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool IntRestoreDC(HandleRef hDC, int nSavedDC);
+ public static bool RestoreDC(HandleRef hDC, int nSavedDC)
+ {
+ bool retVal = IntRestoreDC(hDC, nSavedDC);
+ // When a winforms app is closing, the cached MeasurementGraphics is finalized but it is possible that
+ // its DeviceContext is finalized first so when this method is called the DC has already been relesaed poping up the
+ // assert window. Need to find a way to work around this and enable the assert IF NEEDED.
+ // DbgUtil.AssertWin32(retVal, "RestoreDC([hdc=0x{0:X8}], [restoreState={1}]) failed.", (int)hDC.Handle, nSavedDC);
+ return retVal;
+ }
+
+ [DllImport(ExternDll.User32, SetLastError = true, ExactSpelling = true)]
+ public static extern IntPtr WindowFromDC(HandleRef hDC);
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)]
+ public static extern int GetDeviceCaps(HandleRef hDC, int nIndex);
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "OffsetViewportOrgEx", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool IntOffsetViewportOrgEx(HandleRef hDC, int nXOffset, int nYOffset, [In, Out] IntNativeMethods.POINT point);
+ public static bool OffsetViewportOrgEx(HandleRef hDC, int nXOffset, int nYOffset, [In, Out] IntNativeMethods.POINT point)
+ {
+ bool retVal = IntOffsetViewportOrgEx(hDC, nXOffset, nYOffset, point);
+ DbgUtil.AssertWin32(retVal, "OffsetViewportOrgEx([hdc=0x{0:X8}], dx=[{1}], dy=[{2}], [out pPoint]) failed.", hDC.Handle, nXOffset, nYOffset);
+ return retVal;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "SetGraphicsMode", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int IntSetGraphicsMode(HandleRef hDC, int iMode);
+ public static int SetGraphicsMode(HandleRef hDC, int iMode)
+ {
+ iMode = IntSetGraphicsMode(hDC, iMode);
+ DbgUtil.AssertWin32(iMode != 0, "SetGraphicsMode([hdc=0x{0:X8}], [GM_ADVANCED]) failed.", hDC.Handle);
+ return iMode;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetGraphicsMode(HandleRef hDC);
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true)]
+ public static extern int GetROP2(HandleRef hdc);
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int SetROP2(HandleRef hDC, int nDrawMode);
+
+
+ // Region.
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "CombineRgn", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern IntNativeMethods.RegionFlags IntCombineRgn(HandleRef hRgnDest, HandleRef hRgnSrc1, HandleRef hRgnSrc2, RegionCombineMode combineMode);
+ public static IntNativeMethods.RegionFlags CombineRgn(HandleRef hRgnDest, HandleRef hRgnSrc1, HandleRef hRgnSrc2, RegionCombineMode combineMode)
+ {
+ Debug.Assert(hRgnDest.Wrapper != null && hRgnDest.Handle != IntPtr.Zero, "Destination region is invalid");
+ Debug.Assert(hRgnSrc1.Wrapper != null && hRgnSrc1.Handle != IntPtr.Zero, "Source region 1 is invalid");
+ Debug.Assert(hRgnSrc2.Wrapper != null && hRgnSrc2.Handle != IntPtr.Zero, "Source region 2 is invalid");
+
+ if (hRgnDest.Wrapper == null || hRgnSrc1.Wrapper == null || hRgnSrc2.Wrapper == null)
+ {
+ return IntNativeMethods.RegionFlags.ERROR;
+ }
+
+ // Note: CombineRgn can return Error when no regions are combined, this is not an error condition.
+ return IntCombineRgn(hRgnDest, hRgnSrc1, hRgnSrc2, combineMode);
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "GetClipRgn", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int IntGetClipRgn(HandleRef hDC, HandleRef hRgn);
+ public static int GetClipRgn(HandleRef hDC, HandleRef hRgn)
+ {
+ int retVal = IntGetClipRgn(hDC, hRgn);
+ DbgUtil.AssertWin32(retVal != -1, "IntGetClipRgn([hdc=0x{0:X8}], [hRgn]) failed.", hDC.Handle);
+ return retVal;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "SelectClipRgn", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern IntNativeMethods.RegionFlags IntSelectClipRgn(HandleRef hDC, HandleRef hRgn);
+ public static IntNativeMethods.RegionFlags SelectClipRgn(HandleRef hDC, HandleRef hRgn)
+ {
+ IntNativeMethods.RegionFlags result = IntSelectClipRgn(hDC, hRgn);
+ DbgUtil.AssertWin32(result != IntNativeMethods.RegionFlags.ERROR, "SelectClipRgn([hdc=0x{0:X8}], [hRegion=0x{1:X8}]) failed.", hDC.Handle, hRgn.Handle);
+ return result;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "GetRgnBox", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern IntNativeMethods.RegionFlags IntGetRgnBox(HandleRef hRgn, [In, Out] ref IntNativeMethods.RECT clipRect);
+ public static IntNativeMethods.RegionFlags GetRgnBox(HandleRef hRgn, [In, Out] ref IntNativeMethods.RECT clipRect)
+ {
+ IntNativeMethods.RegionFlags result = IntGetRgnBox(hRgn, ref clipRect);
+ DbgUtil.AssertWin32(result != IntNativeMethods.RegionFlags.ERROR, "GetRgnBox([hRegion=0x{0:X8}], [out rect]) failed.", hRgn.Handle);
+ return result;
+ }
+
+ // Font.
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, EntryPoint = "CreateFontIndirect", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+#pragma warning disable CS0618 // Legacy code: We don't care about using obsolete API's.
+ public static extern IntPtr IntCreateFontIndirect([In, Out, MarshalAs(UnmanagedType.AsAny)] object lf); // need object here since LOGFONT is not public.
+#pragma warning restore CS0618
+ public static IntPtr CreateFontIndirect(/*IntNativeMethods.LOGFONT*/ object lf)
+ {
+ IntPtr hFont = System.Internal.HandleCollector.Add(IntCreateFontIndirect(lf), IntSafeNativeMethods.CommonHandles.GDI);
+ DbgUtil.AssertWin32(hFont != IntPtr.Zero, "CreateFontIndirect(logFont) failed.");
+ return hFont;
+ }
+
+ // Common.
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "DeleteObject", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool IntDeleteObject(HandleRef hObject);
+ public static bool DeleteObject(HandleRef hObject)
+ {
+ System.Internal.HandleCollector.Remove((IntPtr)hObject, IntSafeNativeMethods.CommonHandles.GDI);
+ bool retVal = IntDeleteObject(hObject);
+ DbgUtil.AssertWin32(retVal, "DeleteObject(hObj=[0x{0:X8}]) failed.", hObject.Handle);
+ return retVal;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, EntryPoint = "GetObject", ExactSpelling = false, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int IntGetObject(HandleRef hBrush, int nSize, [In, Out] IntNativeMethods.LOGBRUSH lb);
+ public static int GetObject(HandleRef hBrush, IntNativeMethods.LOGBRUSH lb)
+ {
+ int retVal = IntGetObject(hBrush, System.Runtime.InteropServices.Marshal.SizeOf(typeof(IntNativeMethods.LOGBRUSH)), lb);
+ DbgUtil.AssertWin32(retVal != 0, "GetObject(hObj=[0x{0:X8}], [LOGBRUSH]) failed.", hBrush.Handle);
+ return retVal;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, EntryPoint = "GetObject", ExactSpelling = false, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int IntGetObject(HandleRef hFont, int nSize, [In, Out] IntNativeMethods.LOGFONT lf);
+ public static int GetObject(HandleRef hFont, IntNativeMethods.LOGFONT lp)
+ {
+ int retVal = IntGetObject(hFont, System.Runtime.InteropServices.Marshal.SizeOf(typeof(IntNativeMethods.LOGFONT)), lp);
+ DbgUtil.AssertWin32(retVal != 0, "GetObject(hObj=[0x{0:X8}], [LOGFONT]) failed.", hFont.Handle);
+ return retVal;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "SelectObject", CharSet = CharSet.Auto)]
+ public static extern IntPtr IntSelectObject(HandleRef hdc, HandleRef obj);
+ public static IntPtr SelectObject(HandleRef hdc, HandleRef obj)
+ {
+ IntPtr oldObj = IntSelectObject(hdc, obj);
+ DbgUtil.AssertWin32(oldObj != IntPtr.Zero, "SelectObject(hdc=hObj=[0x{0:X8}], hObj=[0x{1:X8}]) failed.", hdc.Handle, obj.Handle);
+ return oldObj;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "GetCurrentObject", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern IntPtr IntGetCurrentObject(HandleRef hDC, int uObjectType);
+ public static IntPtr GetCurrentObject(HandleRef hDC, int uObjectType)
+ {
+ IntPtr hGdiObj = IntGetCurrentObject(hDC, uObjectType);
+ // If the selected object is a region the return value is HGI_ERROR on failure.
+ DbgUtil.AssertWin32(hGdiObj != IntPtr.Zero, "GetObject(hdc=[0x{0:X8}], type=[{1}]) failed.", hDC, uObjectType);
+ return hGdiObj;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "GetStockObject", CharSet = CharSet.Auto)]
+ public static extern IntPtr IntGetStockObject(int nIndex);
+ public static IntPtr GetStockObject(int nIndex)
+ {
+ IntPtr hGdiObj = IntGetStockObject(nIndex);
+ DbgUtil.AssertWin32(hGdiObj != IntPtr.Zero, "GetStockObject({0}) failed.", nIndex);
+ return hGdiObj;
+ }
+
+
+ // Drawing.
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetNearestColor(HandleRef hDC, int color);
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int /*COLORREF*/ SetTextColor(HandleRef hDC, int crColor);
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetTextAlign(HandleRef hdc);
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int /*COLORREF*/ GetTextColor(HandleRef hDC);
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int SetBkColor(HandleRef hDC, int clr);
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "SetBkMode", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int IntSetBkMode(HandleRef hDC, int nBkMode);
+ public static int SetBkMode(HandleRef hDC, int nBkMode)
+ {
+ int oldMode = IntSetBkMode(hDC, nBkMode);
+ DbgUtil.AssertWin32(oldMode != 0, "SetBkMode(hdc=[0x{0:X8}], Mode=[{1}]) failed.", hDC.Handle, nBkMode);
+ return oldMode;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "GetBkMode", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int IntGetBkMode(HandleRef hDC);
+ public static int GetBkMode(HandleRef hDC)
+ {
+ int mode = IntGetBkMode(hDC);
+ DbgUtil.AssertWin32(mode != 0, "GetBkMode(hdc=[0x{0:X8}]) failed.", hDC.Handle);
+ return mode;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int GetBkColor(HandleRef hDC);
+
+
+ [DllImport(ExternDll.User32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
+ public static extern int DrawTextW(HandleRef hDC, string lpszString, int nCount, ref IntNativeMethods.RECT lpRect, int nFormat);
+
+ [DllImport(ExternDll.User32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Ansi)]
+ public static extern int DrawTextA(HandleRef hDC, byte[] lpszString, int byteCount, ref IntNativeMethods.RECT lpRect, int nFormat);
+
+ public static int DrawText(HandleRef hDC, string text, ref IntNativeMethods.RECT lpRect, int nFormat)
+ {
+ int retVal;
+ if (Marshal.SystemDefaultCharSize == 1)
+ {
+ // CapRectangleForWin9x(ref lpRect);
+ // we have to do this because if we pass too big of a value (<= 2^31) to win9x
+ // it fails and returns negative values as the rect in which it painted the text
+ lpRect.top = Math.Min(Int16.MaxValue, lpRect.top);
+ lpRect.left = Math.Min(Int16.MaxValue, lpRect.left);
+ lpRect.right = Math.Min(Int16.MaxValue, lpRect.right);
+ lpRect.bottom = Math.Min(Int16.MaxValue, lpRect.bottom);
+
+ // Convert Unicode string to ANSI.
+ int byteCount = IntUnsafeNativeMethods.WideCharToMultiByte(IntNativeMethods.CP_ACP, 0, text, text.Length, null, 0, IntPtr.Zero, IntPtr.Zero);
+ byte[] textBytes = new byte[byteCount];
+ IntUnsafeNativeMethods.WideCharToMultiByte(IntNativeMethods.CP_ACP, 0, text, text.Length, textBytes, textBytes.Length, IntPtr.Zero, IntPtr.Zero);
+
+ // Security: Windows 95/98/Me: This value may not exceed 8192.
+ byteCount = Math.Min(byteCount, IntNativeMethods.MaxTextLengthInWin9x);
+ retVal = DrawTextA(hDC, textBytes, byteCount, ref lpRect, nFormat);
+ }
+ else
+ {
+ retVal = DrawTextW(hDC, text, text.Length, ref lpRect, nFormat);
+ }
+
+ DbgUtil.AssertWin32(retVal != 0, "DrawText(hdc=[0x{0:X8}], text=[{1}], rect=[{2}], flags=[{3}] failed.", hDC.Handle, text, lpRect, nFormat);
+ return retVal;
+ }
+
+ [DllImport(ExternDll.User32, SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
+ public static extern int DrawTextExW(HandleRef hDC, string lpszString, int nCount, ref IntNativeMethods.RECT lpRect, int nFormat, [In, Out] IntNativeMethods.DRAWTEXTPARAMS lpDTParams);
+
+ [DllImport(ExternDll.User32, SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Ansi)]
+ public static extern int DrawTextExA(HandleRef hDC, byte[] lpszString, int byteCount, ref IntNativeMethods.RECT lpRect, int nFormat, [In, Out] IntNativeMethods.DRAWTEXTPARAMS lpDTParams);
+
+ public static int DrawTextEx(HandleRef hDC, string text, ref IntNativeMethods.RECT lpRect, int nFormat, [In, Out] IntNativeMethods.DRAWTEXTPARAMS lpDTParams)
+ {
+ int retVal;
+ if (Marshal.SystemDefaultCharSize == 1)
+ {
+ // CapRectangleForWin9x(ref lpRect);
+ // we have to do this because if we pass too big of a value (<= 2^31) to win9x
+ // it fails and returns negative values as the rect in which it painted the text
+ lpRect.top = Math.Min(Int16.MaxValue, lpRect.top);
+ lpRect.left = Math.Min(Int16.MaxValue, lpRect.left);
+ lpRect.right = Math.Min(Int16.MaxValue, lpRect.right);
+ lpRect.bottom = Math.Min(Int16.MaxValue, lpRect.bottom);
+
+ // Convert Unicode string to ANSI.
+ int byteCount = IntUnsafeNativeMethods.WideCharToMultiByte(IntNativeMethods.CP_ACP, 0, text, text.Length, null, 0, IntPtr.Zero, IntPtr.Zero);
+ byte[] textBytes = new byte[byteCount];
+ IntUnsafeNativeMethods.WideCharToMultiByte(IntNativeMethods.CP_ACP, 0, text, text.Length, textBytes, textBytes.Length, IntPtr.Zero, IntPtr.Zero);
+
+ // Security: Windows 95/98/Me: This value may not exceed 8192.
+ byteCount = Math.Min(byteCount, IntNativeMethods.MaxTextLengthInWin9x);
+ retVal = DrawTextExA(hDC, textBytes, byteCount, ref lpRect, nFormat, lpDTParams);
+ }
+ else
+ {
+ retVal = DrawTextExW(hDC, text, text.Length, ref lpRect, nFormat, lpDTParams);
+ }
+
+ DbgUtil.AssertWin32(retVal != 0, "DrawTextEx(hdc=[0x{0:X8}], text=[{1}], rect=[{2}], flags=[{3}] failed.", hDC.Handle, text, lpRect, nFormat);
+ return retVal;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
+ public static extern int GetTextExtentPoint32W(HandleRef hDC, string text, int len, [In, Out] IntNativeMethods.SIZE size);
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Ansi)]
+ public static extern int GetTextExtentPoint32A(HandleRef hDC, byte[] lpszString, int byteCount, [In, Out] IntNativeMethods.SIZE size);
+
+ public static int GetTextExtentPoint32(HandleRef hDC, string text, [In, Out] IntNativeMethods.SIZE size)
+ {
+ int retVal;
+ int byteCount = text.Length;
+
+ if (Marshal.SystemDefaultCharSize == 1)
+ {
+ // Convert Unicode string to ANSI.
+ byteCount = IntUnsafeNativeMethods.WideCharToMultiByte(IntNativeMethods.CP_ACP, 0, text, text.Length, null, 0, IntPtr.Zero, IntPtr.Zero);
+ byte[] textBytes = new byte[byteCount];
+ IntUnsafeNativeMethods.WideCharToMultiByte(IntNativeMethods.CP_ACP, 0, text, text.Length, textBytes, textBytes.Length, IntPtr.Zero, IntPtr.Zero);
+
+ // Security: Windows 95/98/Me: This value may not exceed 8192.
+ byteCount = Math.Min(text.Length, IntNativeMethods.MaxTextLengthInWin9x);
+ retVal = GetTextExtentPoint32A(hDC, textBytes, byteCount, size);
+ }
+ else
+ {
+ retVal = GetTextExtentPoint32W(hDC, text, text.Length, size);
+ }
+
+ DbgUtil.AssertWin32(retVal != 0, "GetTextExtentPoint32(hdc=[0x{0:X8}], text=[{1}], size=[{2}] failed.", hDC.Handle, text, size);
+ return retVal;
+ }
+
+ // WARNING: This method is currently used just for drawing the text background (ComponentEditorForm.cs) and not for rendering text.
+ // Prefer using DrawText over this method if possible, it handles Win9x issues properly. Ideally, we should remove this method
+ // but to avoid issues at this point I'm leaving it here.
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2101:SpecifyMarshalingForPInvokeStringArguments")]
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = false, CharSet = CharSet.Auto)]
+ internal static extern bool ExtTextOut(HandleRef hdc, int x, int y, int options, ref IntNativeMethods.RECT rect, string str, int length, int[] spacing);
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "LineTo", CharSet = CharSet.Auto)]
+ public static extern bool IntLineTo(HandleRef hdc, int x, int y);
+ public static bool LineTo(HandleRef hdc, int x, int y)
+ {
+ bool retVal = IntLineTo(hdc, x, y);
+ DbgUtil.AssertWin32(retVal, "LineTo(hdc=[0x{0:X8}], x=[{1}], y=[{2}] failed.", hdc.Handle, x, y);
+ return retVal;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "MoveToEx", CharSet = CharSet.Auto)]
+ public static extern bool IntMoveToEx(HandleRef hdc, int x, int y, IntNativeMethods.POINT pt);
+ public static bool MoveToEx(HandleRef hdc, int x, int y, IntNativeMethods.POINT pt)
+ {
+ bool retVal = IntMoveToEx(hdc, x, y, pt);
+ DbgUtil.AssertWin32(retVal, "MoveToEx(hdc=[0x{0:X8}], x=[{1}], y=[{2}], pt=[{3}] failed.", hdc.Handle, x, y, pt);
+ return retVal;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "Rectangle", CharSet = CharSet.Auto)]
+ public static extern bool IntRectangle(HandleRef hdc, int left, int top, int right, int bottom);
+ public static bool Rectangle(HandleRef hdc, int left, int top, int right, int bottom)
+ {
+ bool retVal = IntRectangle(hdc, left, top, right, bottom);
+ DbgUtil.AssertWin32(retVal, "Rectangle(hdc=[0x{0:X8}], left=[{1}], top=[{2}], right=[{3}], bottom=[{4}] failed.", hdc.Handle, left, top, right, bottom);
+ return retVal;
+ }
+
+ [DllImport(ExternDll.User32, SetLastError = true, ExactSpelling = true, EntryPoint = "FillRect", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool IntFillRect(HandleRef hdc, [In] ref IntNativeMethods.RECT rect, HandleRef hbrush);
+ public static bool FillRect(HandleRef hDC, [In] ref IntNativeMethods.RECT rect, HandleRef hbrush)
+ {
+ bool retVal = IntFillRect(hDC, ref rect, hbrush);
+ DbgUtil.AssertWin32(retVal, "FillRect(hdc=[0x{0:X8}], rect=[{1}], hbrush=[{2}]", hDC.Handle, rect, hbrush.Handle);
+ return retVal;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "SetMapMode", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int IntSetMapMode(HandleRef hDC, int nMapMode);
+ public static int SetMapMode(HandleRef hDC, int nMapMode)
+ {
+ int oldMapMode = IntSetMapMode(hDC, nMapMode);
+ DbgUtil.AssertWin32(oldMapMode != 0, "SetMapMode(hdc=[0x{0:X8}], MapMode=[{1}]", hDC.Handle, nMapMode);
+ return oldMapMode;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "GetMapMode", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int IntGetMapMode(HandleRef hDC);
+ public static int GetMapMode(HandleRef hDC)
+ {
+ int mapMode = IntGetMapMode(hDC);
+ DbgUtil.AssertWin32(mapMode != 0, "GetMapMode(hdc=[0x{0:X8}]", hDC.Handle);
+ return mapMode;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "GetViewportExtEx")]
+ public static extern bool IntGetViewportExtEx(HandleRef hdc, [In, Out] IntNativeMethods.SIZE lpSize);
+ public static bool GetViewportExtEx(HandleRef hdc, [In, Out] IntNativeMethods.SIZE lpSize)
+ {
+ bool retVal = IntGetViewportExtEx(hdc, lpSize);
+ DbgUtil.AssertWin32(retVal, "GetViewportExtEx([hdc=0x{0:X8}], [out size]) failed.", hdc.Handle);
+ return retVal;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "GetViewportOrgEx")]
+ public static extern bool IntGetViewportOrgEx(HandleRef hdc, [In, Out] IntNativeMethods.POINT lpPoint);
+ public static bool GetViewportOrgEx(HandleRef hdc, [In, Out] IntNativeMethods.POINT lpPoint)
+ {
+ bool retVal = IntGetViewportOrgEx(hdc, lpPoint);
+ DbgUtil.AssertWin32(retVal, "GetViewportOrgEx([hdc=0x{0:X8}], [out point]) failed.", hdc.Handle);
+ return retVal;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "SetViewportExtEx", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool IntSetViewportExtEx(HandleRef hDC, int x, int y, [In, Out] IntNativeMethods.SIZE size);
+ public static bool SetViewportExtEx(HandleRef hDC, int x, int y, [In, Out] IntNativeMethods.SIZE size)
+ {
+ bool retVal = IntSetViewportExtEx(hDC, x, y, size);
+ DbgUtil.AssertWin32(retVal, "SetViewportExtEx([hdc=0x{0:X8}], x=[{1}], y=[{2}], [out size]) failed.", hDC.Handle, x, y);
+ return retVal;
+ }
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "SetViewportOrgEx", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool IntSetViewportOrgEx(HandleRef hDC, int x, int y, [In, Out] IntNativeMethods.POINT point);
+ public static bool SetViewportOrgEx(HandleRef hDC, int x, int y, [In, Out] IntNativeMethods.POINT point)
+ {
+ bool retVal = IntSetViewportOrgEx(hDC, x, y, point);
+ DbgUtil.AssertWin32(retVal, "SetViewportOrgEx([hdc=0x{0:X8}], x=[{1}], y=[{2}], [out point]) failed.", hDC.Handle, x, y);
+ return retVal;
+ }
+
+
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
+ public static extern int GetTextMetricsW(HandleRef hDC, [In, Out] ref IntNativeMethods.TEXTMETRIC lptm);
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Ansi)]
+ public static extern int GetTextMetricsA(HandleRef hDC, [In, Out] ref IntNativeMethods.TEXTMETRICA lptm);
+
+ public static int GetTextMetrics(HandleRef hDC, ref IntNativeMethods.TEXTMETRIC lptm)
+ {
+ int retVal;
+
+ if (Marshal.SystemDefaultCharSize == 1)
+ {
+ // ANSI
+ IntNativeMethods.TEXTMETRICA lptmA = new IntNativeMethods.TEXTMETRICA();
+ retVal = IntUnsafeNativeMethods.GetTextMetricsA(hDC, ref lptmA);
+
+ lptm.tmHeight = lptmA.tmHeight;
+ lptm.tmAscent = lptmA.tmAscent;
+ lptm.tmDescent = lptmA.tmDescent;
+ lptm.tmInternalLeading = lptmA.tmInternalLeading;
+ lptm.tmExternalLeading = lptmA.tmExternalLeading;
+ lptm.tmAveCharWidth = lptmA.tmAveCharWidth;
+ lptm.tmMaxCharWidth = lptmA.tmMaxCharWidth;
+ lptm.tmWeight = lptmA.tmWeight;
+ lptm.tmOverhang = lptmA.tmOverhang;
+ lptm.tmDigitizedAspectX = lptmA.tmDigitizedAspectX;
+ lptm.tmDigitizedAspectY = lptmA.tmDigitizedAspectY;
+ lptm.tmFirstChar = (char)lptmA.tmFirstChar;
+ lptm.tmLastChar = (char)lptmA.tmLastChar;
+ lptm.tmDefaultChar = (char)lptmA.tmDefaultChar;
+ lptm.tmBreakChar = (char)lptmA.tmBreakChar;
+ lptm.tmItalic = lptmA.tmItalic;
+ lptm.tmUnderlined = lptmA.tmUnderlined;
+ lptm.tmStruckOut = lptmA.tmStruckOut;
+ lptm.tmPitchAndFamily = lptmA.tmPitchAndFamily;
+ lptm.tmCharSet = lptmA.tmCharSet;
+ }
+ else
+ {
+ // Unicode
+ retVal = IntUnsafeNativeMethods.GetTextMetricsW(hDC, ref lptm);
+ }
+
+ DbgUtil.AssertWin32(retVal != 0, "GetTextMetrics(hdc=[0x{0:X8}], [out TEXTMETRIC] failed.", hDC.Handle);
+ return retVal;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "BeginPath", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool IntBeginPath(HandleRef hDC);
+ public static bool BeginPath(HandleRef hDC)
+ {
+ bool retVal = IntBeginPath(hDC);
+ DbgUtil.AssertWin32(retVal, "BeginPath(hdc=[0x{0:X8}]failed.", hDC.Handle);
+ return retVal;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "EndPath", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool IntEndPath(HandleRef hDC);
+ public static bool EndPath(HandleRef hDC)
+ {
+ bool retVal = IntEndPath(hDC);
+ DbgUtil.AssertWin32(retVal, "EndPath(hdc=[0x{0:X8}]failed.", hDC.Handle);
+ return retVal;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "StrokePath", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool IntStrokePath(HandleRef hDC);
+ public static bool StrokePath(HandleRef hDC)
+ {
+ bool retVal = IntStrokePath(hDC);
+ DbgUtil.AssertWin32(retVal, "StrokePath(hdc=[0x{0:X8}]failed.", hDC.Handle);
+ return retVal;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "AngleArc", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool IntAngleArc(HandleRef hDC, int x, int y, int radius, float startAngle, float endAngle);
+ public static bool AngleArc(HandleRef hDC, int x, int y, int radius, float startAngle, float endAngle)
+ {
+ bool retVal = IntAngleArc(hDC, x, y, radius, startAngle, endAngle);
+ DbgUtil.AssertWin32(retVal, "AngleArc(hdc=[0x{0:X8}], ...) failed.", hDC.Handle);
+ return retVal;
+ }
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "Arc", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool IntArc(
+ HandleRef hDC,
+ int nLeftRect, // x-coord of rectangle's upper-left corner
+ int nTopRect, // y-coord of rectangle's upper-left corner
+ int nRightRect, // x-coord of rectangle's lower-right corner
+ int nBottomRect, // y-coord of rectangle's lower-right corner
+ int nXStartArc, // x-coord of first radial ending point
+ int nYStartArc, // y-coord of first radial ending point
+ int nXEndArc, // x-coord of second radial ending point
+ int nYEndArc // y-coord of second radial ending point
+ );
+ public static bool Arc(
+ HandleRef hDC,
+ int nLeftRect, // x-coord of rectangle's upper-left corner
+ int nTopRect, // y-coord of rectangle's upper-left corner
+ int nRightRect, // x-coord of rectangle's lower-right corner
+ int nBottomRect, // y-coord of rectangle's lower-right corner
+ int nXStartArc, // x-coord of first radial ending point
+ int nYStartArc, // y-coord of first radial ending point
+ int nXEndArc, // x-coord of second radial ending point
+ int nYEndArc // y-coord of second radial ending point
+ )
+ {
+ bool retVal = IntArc(hDC, nLeftRect, nTopRect, nRightRect, nBottomRect, nXStartArc, nYStartArc, nXEndArc, nYEndArc);
+ DbgUtil.AssertWin32(retVal, "Arc(hdc=[0x{0:X8}], ...) failed.", hDC.Handle);
+ return retVal;
+ }
+
+ // Misc.
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern int SetTextAlign(HandleRef hDC, int nMode);
+
+ [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "Ellipse", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
+ public static extern bool IntEllipse(HandleRef hDc, int x1, int y1, int x2, int y2);
+ public static bool Ellipse(HandleRef hDc, int x1, int y1, int x2, int y2)
+ {
+ bool retVal = IntEllipse(hDc, x1, y1, x2, y2);
+ DbgUtil.AssertWin32(retVal, "Ellipse(hdc=[0x{0:X8}], x1=[{1}], y1=[{2}], x2=[{3}], y2=[{4}]) failed.", hDc.Handle, x1, y1, x2, y2);
+ return retVal;
+ }
+
+ // From MSDN: Using the MultiByteToWideChar/WideCharToMultiByte function incorrectly can compromise the security of your application.
+ // Calling the WideCharToMultiByte function can easily cause a buffer overrun because the size of the In buffer equals the number
+ // of WCHARs in the string, while the size of the Out buffer equals the number of bytes. To avoid a buffer overrun, be sure to specify
+ // a buffer size appropriate for the data type the buffer receives. For more information, see Security Considerations: International Features.
+ // Always call these functions passing a null destination buffer to get its size and the create the buffer with the exact size.
+ [DllImport(ExternDll.Kernel32, ExactSpelling = true, CharSet = CharSet.Unicode)]
+ public static extern int WideCharToMultiByte(int codePage, int flags, [MarshalAs(UnmanagedType.LPWStr)]string wideStr, int chars, [In, Out]byte[] pOutBytes, int bufferBytes, IntPtr defaultChar, IntPtr pDefaultUsed);
+ }
+}
diff --git a/src/System.Drawing.Common/src/misc/GDI/WindowsGraphics.cs b/src/System.Drawing.Common/src/misc/GDI/WindowsGraphics.cs
new file mode 100644
index 0000000000..b12b823941
--- /dev/null
+++ b/src/System.Drawing.Common/src/misc/GDI/WindowsGraphics.cs
@@ -0,0 +1,260 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+// THIS PARTIAL CLASS CONTAINS THE BASE METHODS FOR CREATING AND DISPOSING A WINDOWSGRAPHICS AS WELL
+// GETTING, DISPOSING AND WORKING WITH A DC.
+
+namespace System.Drawing.Internal
+{
+ using System.Diagnostics;
+ using System.Drawing.Drawing2D;
+
+ /// <include file='doc\WindowsGraphics.uex' path='docs/doc[@for="WindowsGraphics"]/*' />
+ /// <devdoc>
+ /// WindowsGraphics is a library for rendering text and drawing using GDI; it was
+ /// created to address performance and compatibility issues found in GDI+ Graphics
+ /// class.
+ ///
+ /// Note: WindowsGraphics is a stateful component, DC properties are persisted from
+ /// method calls, as opposed to Graphics (GDI+) which performs attomic operations and
+ /// always restores the hdc.
+ /// The underlying hdc is always saved and restored on dispose so external HDCs won't
+ /// be modified by WindowsGraphics. So we don't need to restore previous objects into
+ /// the dc in method calls.
+ ///</devdoc>
+ internal sealed partial class WindowsGraphics : MarshalByRefObject, IDisposable, IDeviceContext
+ {
+ // Wrapper around the window dc this object refers to.
+ // Note: this dc is only disposed when owned (created) by the WindowsGraphics.
+ private DeviceContext _dc;
+ private bool _disposeDc;
+ private Graphics _graphics; // cached when initialized FromGraphics to be able to call g.ReleaseHdc from Dispose.
+
+#if GDI_FINALIZATION_WATCH
+ private string AllocationSite = DbgUtil.StackTrace;
+#endif
+
+ // Construction/destruction API
+
+ /// <include file='doc\WindowsGraphics.uex' path='docs/doc[@for="WindowsGraphics.WindowsGraphics"]/*' />
+ public WindowsGraphics(DeviceContext dc)
+ {
+ Debug.Assert(dc != null, "null dc!");
+ _dc = dc;
+ _dc.SaveHdc();
+ //this.disposeDc = false; // the dc is not owned by this object.
+ }
+
+ /// <devdoc>
+ /// Creates a WindowsGraphics from a memory DeviceContext object compatible with the primary screen device.
+ /// This object is suitable for performing text measuring but not for drawing into it because it does
+ /// not have a backup bitmap.
+ /// </devdoc>
+ public static WindowsGraphics CreateMeasurementWindowsGraphics()
+ {
+ DeviceContext dc = DeviceContext.FromCompatibleDC(IntPtr.Zero);
+ WindowsGraphics wg = new WindowsGraphics(dc);
+ wg._disposeDc = true; // we create it, we dispose it.
+
+ return wg;
+ }
+
+ /// <include file='doc\WindowsGraphics.uex' path='docs/doc[@for="WindowsGraphics.FromHwnd"]/*' />
+ public static WindowsGraphics FromHwnd(IntPtr hWnd)
+ {
+ DeviceContext dc = DeviceContext.FromHwnd(hWnd);
+ WindowsGraphics wg = new WindowsGraphics(dc);
+ wg._disposeDc = true; // we create it, we dispose it.
+
+ return wg;
+ }
+
+ /// <include file='doc\WindowsGraphics.uex' path='docs/doc[@for="WindowsGraphics.FromHwnd"]/*' />
+ public static WindowsGraphics FromHdc(IntPtr hDc)
+ {
+ Debug.Assert(hDc != IntPtr.Zero, "null hDc");
+
+ DeviceContext dc = DeviceContext.FromHdc(hDc);
+ WindowsGraphics wg = new WindowsGraphics(dc);
+ wg._disposeDc = true; // we create it, we dispose it.
+
+ return wg;
+ }
+
+ /// <devdoc>
+ /// Creates a WindowsGraphics object from a Graphics object. Clipping and coordinate transforms
+ /// are preserved.
+ ///
+ /// Notes:
+ /// - The passed Graphics object cannot be used until the WindowsGraphics is disposed
+ /// since it borrows the hdc from the Graphics object locking it.
+ /// - Changes to the hdc using the WindowsGraphics object are not preserved into the Graphics object;
+ /// the hdc is returned to the Graphics object intact.
+ ///
+ /// Some background about how Graphics uses the internal hdc when created from an existing one
+ /// (mail from GillesK from GDI+ team):
+ /// User has an HDC with a particular state:
+ /// Graphics object gets created based on that HDC. We query the HDC for its state and apply it to the Graphics.
+ /// At this stage, we do a SaveHDC and clear everything out of it.
+ /// User calls GetHdc. We restore the HDC to the state it was in and give it to the user.
+ /// User calls ReleaseHdc, we save the current state of the HDC and clear everything
+ /// (so that the graphics state gets applied next time we use it).
+ /// Next time the user calls GetHdc we give him back the state after the second ReleaseHdc.
+ /// (But the state changes between the GetHdc and ReleaseHdc are not applied to the Graphics).
+ /// Please note that this only applies the HDC created graphics, for Bitmap derived graphics, GetHdc creates a new DIBSection and
+ /// things get a lot more complicated.
+ /// </devdoc>
+ public static WindowsGraphics FromGraphics(Graphics g)
+ {
+ ApplyGraphicsProperties properties = ApplyGraphicsProperties.All;
+ return WindowsGraphics.FromGraphics(g, properties);
+ }
+
+ public static WindowsGraphics FromGraphics(Graphics g, ApplyGraphicsProperties properties)
+ {
+ Debug.Assert(g != null, "null Graphics object.");
+ //Debug.Assert( properties != ApplyGraphicsProperties.None, "Consider using other WindowsGraphics constructor if not preserving Graphics properties." );
+
+ WindowsRegion wr = null;
+ float[] elements = null;
+
+ Region clipRgn = null;
+ Matrix worldTransf = null;
+
+ if ((properties & ApplyGraphicsProperties.TranslateTransform) != 0 || (properties & ApplyGraphicsProperties.Clipping) != 0)
+ {
+ object[] data = g.GetContextInfo() as object[];
+
+ if (data != null && data.Length == 2)
+ {
+ clipRgn = data[0] as Region;
+ worldTransf = data[1] as Matrix;
+ }
+
+ if (worldTransf != null)
+ {
+ if ((properties & ApplyGraphicsProperties.TranslateTransform) != 0)
+ {
+ elements = worldTransf.Elements;
+ }
+ worldTransf.Dispose();
+ }
+
+ if (clipRgn != null)
+ {
+ if ((properties & ApplyGraphicsProperties.Clipping) != 0)
+ {
+ // We have to create the WindowsRegion and dipose the Region object before locking the Graphics object,
+ // in case of an unlikely exception before releasing the WindowsRegion, the finalizer will do it for us.
+ // (no try-finally block since this method is used frequently - perf).
+ // If the Graphics.Clip has not been set (Region.IsInfinite) we don't need to apply it to the DC.
+ if (!clipRgn.IsInfinite(g))
+ {
+ wr = WindowsRegion.FromRegion(clipRgn, g); // WindowsRegion will take ownership of the hRegion.
+ }
+ }
+ clipRgn.Dispose(); // Disposing the Region object doesn't destroy the hRegion.
+ }
+ }
+
+ WindowsGraphics wg = WindowsGraphics.FromHdc(g.GetHdc()); // This locks the Graphics object.
+ wg._graphics = g;
+
+ // Apply transform and clip
+ if (wr != null)
+ {
+ using (wr)
+ {
+ // If the Graphics object was created from a native DC the actual clipping region is the intersection
+ // beteween the original DC clip region and the GDI+ one - for display Graphics it is the same as
+ // Graphics.VisibleClipBounds.
+ wg.DeviceContext.IntersectClip(wr);
+ }
+ }
+
+ if (elements != null)
+ {
+ // elements (XFORM) = [eM11, eM12, eM21, eM22, eDx, eDy], eDx/eDy specify the translation offset.
+ wg.DeviceContext.TranslateTransform((int)elements[4], (int)elements[5]);
+ }
+
+ return wg;
+ }
+
+ /// <include file='doc\WindowsGraphics.uex' path='docs/doc[@for="WindowsGraphics.Finalize"]/*' />
+ ~WindowsGraphics()
+ {
+ Dispose(false);
+ }
+
+ public DeviceContext DeviceContext
+ {
+ get
+ {
+ return _dc;
+ }
+ }
+
+
+ /// <include file='doc\WindowsGraphics.uex' path='docs/doc[@for="WindowsGraphics.Dispose"]/*' />
+ // Okay to suppress.
+ //"WindowsGraphics object does not own the Graphics object. For instance in a control’s Paint event we pass the
+ //GraphicsContainer object to TextRenderer, which uses WindowsGraphics;
+ //if the Graphics object is disposed then further painting will be broken."
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ internal void Dispose(bool disposing)
+ {
+ if (_dc != null)
+ {
+ DbgUtil.AssertFinalization(this, disposing);
+
+ try
+ {
+ // Restore original dc.
+ _dc.RestoreHdc();
+
+ if (_disposeDc)
+ {
+ _dc.Dispose(disposing);
+ }
+
+ if (_graphics != null) // if created from a Graphics object...
+ {
+ _graphics.ReleaseHdcInternal(_dc.Hdc);
+ _graphics = null;
+ }
+ }
+ catch (Exception ex)
+ {
+ if (ClientUtils.IsSecurityOrCriticalException(ex))
+ {
+ throw; // rethrow the original exception.
+ }
+ Debug.Fail("Exception thrown during disposing: \r\n" + ex.ToString());
+ }
+ finally
+ {
+ _dc = null;
+ }
+ }
+ }
+
+ /// <include file='doc\WindowsGraphics.uex' path='docs/doc[@for="WindowsGraphics.GetHdc"]/*' />
+ public IntPtr GetHdc()
+ {
+ return _dc.Hdc;
+ }
+
+ /// <include file='doc\WindowsGraphics.uex' path='docs/doc[@for="WindowsGraphics.ReleaseHdc"]/*' />
+ public void ReleaseHdc()
+ {
+ _dc.Dispose();
+ }
+ }
+}
diff --git a/src/System.Drawing.Common/src/misc/GDI/WindowsRegion.cs b/src/System.Drawing.Common/src/misc/GDI/WindowsRegion.cs
new file mode 100644
index 0000000000..2aa4f9c643
--- /dev/null
+++ b/src/System.Drawing.Common/src/misc/GDI/WindowsRegion.cs
@@ -0,0 +1,195 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Internal
+{
+ using System.Diagnostics;
+ using System.Runtime.InteropServices;
+
+ /// <devdoc>
+ /// <para>
+ /// Encapsulates a GDI Region object.
+ /// </para>
+ /// </devdoc>
+
+ internal sealed partial class WindowsRegion : MarshalByRefObject, ICloneable, IDisposable
+ {
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")]
+ private IntPtr _nativeHandle; // The hRegion, this class always takes ownership of the hRegion.
+ private bool _ownHandle;
+
+#if GDI_FINALIZATION_WATCH
+ private string AllocationSite = DbgUtil.StackTrace;
+#endif
+
+ /// <devdoc>
+ /// </devdoc>
+ private WindowsRegion()
+ {
+ }
+
+ /// <devdoc>
+ /// </devdoc>
+ public WindowsRegion(Rectangle rect)
+ {
+ CreateRegion(rect);
+ }
+
+ /// <devdoc>
+ /// </devdoc>
+ public WindowsRegion(int x, int y, int width, int height)
+ {
+ CreateRegion(new Rectangle(x, y, width, height));
+ }
+
+ // Consider implementing a constructor that calls ExtCreateRegion(XFORM lpXform, DWORD nCount, RGNDATA lpRgnData) if needed.
+
+ /// <devdoc>
+ /// Creates a WindowsRegion from a region handle, if 'takeOwnership' is true, the handle is added to the HandleCollector
+ /// and is removed & destroyed on dispose.
+ /// </devdoc>
+ public static WindowsRegion FromHregion(IntPtr hRegion, bool takeOwnership)
+ {
+ WindowsRegion wr = new WindowsRegion();
+
+ // Note: Passing IntPtr.Zero for hRegion is ok. GDI+ infinite regions will have hRegion == null.
+ // GDI's SelectClipRgn interprets null region handle as resetting the clip region (all region will be available for painting).
+ if (hRegion != IntPtr.Zero)
+ {
+ wr._nativeHandle = hRegion;
+
+ if (takeOwnership)
+ {
+ wr._ownHandle = true;
+ System.Internal.HandleCollector.Add(hRegion, IntSafeNativeMethods.CommonHandles.GDI);
+ }
+ }
+ return wr;
+ }
+
+ /// <devdoc>
+ /// Creates a WindowsRegion from a System.Drawing.Region.
+ /// </devdoc>
+ public static WindowsRegion FromRegion(Region region, Graphics g)
+ {
+ if (region.IsInfinite(g))
+ {
+ // An infinite region would cover the entire device region which is the same as
+ // not having a clipping region. Observe that this is not the same as having an
+ // empty region, which when clipping to it has the effect of excluding the entire
+ // device region.
+ // To remove the clip region from a dc the SelectClipRgn() function needs to be
+ // called with a null region ptr - that's why we use the empty constructor here.
+ // GDI+ will return IntPtr.Zero for Region.GetHrgn(Graphics) when the region is
+ // Infinite.
+ return new WindowsRegion();
+ }
+
+ return WindowsRegion.FromHregion(region.GetHrgn(g), true);
+ }
+
+ /// <devdoc>
+ /// </devdoc>
+ public object Clone()
+ {
+ // WARNING: WindowsRegion currently supports rectangulare regions only, if the WindowsRegion was created
+ // from an HRegion and it is not rectangular this method won't work as expected.
+ // Note: This method is currently not used and is here just to implement ICloneable.
+ return IsInfinite ?
+ new WindowsRegion() :
+ new WindowsRegion(ToRectangle());
+ }
+
+ /// <devdoc>
+ /// Combines region1 & region2 into this region. The regions cannot be null.
+ /// The three regions need not be distinct. For example, the sourceRgn1 can equal this region.
+ /// </devdoc>
+ public IntNativeMethods.RegionFlags CombineRegion(WindowsRegion region1, WindowsRegion region2, RegionCombineMode mode)
+ {
+ return IntUnsafeNativeMethods.CombineRgn(new HandleRef(this, HRegion), new HandleRef(region1, region1.HRegion), new HandleRef(region2, region2.HRegion), mode);
+ }
+
+ /// <devdoc>
+ /// </devdoc>
+ private void CreateRegion(Rectangle rect)
+ {
+ Debug.Assert(_nativeHandle == IntPtr.Zero, "nativeHandle should be null, we're leaking handle");
+ _nativeHandle = IntSafeNativeMethods.CreateRectRgn(rect.X, rect.Y, rect.X + rect.Width, rect.Y + rect.Height);
+ _ownHandle = true;
+ }
+
+ /// <devdoc>
+ /// </devdoc>
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+
+ /// <devdoc>
+ /// </devdoc>
+ public void Dispose(bool disposing)
+ {
+ if (_nativeHandle != IntPtr.Zero)
+ {
+ DbgUtil.AssertFinalization(this, disposing);
+
+ if (_ownHandle)
+ {
+ IntUnsafeNativeMethods.DeleteObject(new HandleRef(this, _nativeHandle));
+ }
+
+ _nativeHandle = IntPtr.Zero;
+
+ if (disposing)
+ {
+ GC.SuppressFinalize(this);
+ }
+ }
+ }
+
+ /// <devdoc>
+ /// </devdoc>
+ ~WindowsRegion()
+ {
+ Dispose(false);
+ }
+
+ /// <devdoc>
+ /// The native region handle.
+ /// </devdoc>
+ public IntPtr HRegion
+ {
+ get
+ {
+ return _nativeHandle;
+ }
+ }
+
+ /// <devdoc>
+ /// </devdoc>
+ public bool IsInfinite
+ {
+ get
+ {
+ return _nativeHandle == IntPtr.Zero;
+ }
+ }
+
+ /// <devdoc>
+ /// A rectangle representing the window region set with the SetWindowRgn function.
+ /// </devdoc>
+ public Rectangle ToRectangle()
+ {
+ if (IsInfinite)
+ {
+ return new Rectangle(-Int32.MaxValue, -Int32.MaxValue, Int32.MaxValue, Int32.MaxValue);
+ }
+
+ IntNativeMethods.RECT rect = new IntNativeMethods.RECT();
+ IntUnsafeNativeMethods.GetRgnBox(new HandleRef(this, _nativeHandle), ref rect);
+ return new Rectangle(new Point(rect.left, rect.top), rect.Size);
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Common/src/misc/GDI/WindowsRegionCombineMode.cs b/src/System.Drawing.Common/src/misc/GDI/WindowsRegionCombineMode.cs
new file mode 100644
index 0000000000..15d11149c8
--- /dev/null
+++ b/src/System.Drawing.Common/src/misc/GDI/WindowsRegionCombineMode.cs
@@ -0,0 +1,19 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Drawing.Internal
+{
+ /// <devdoc>
+ /// </devdoc>
+ internal enum RegionCombineMode
+ {
+ AND = 1,
+ OR = 2,
+ XOR = 3,
+ DIFF = 4,
+ COPY = 5,
+ MIN = AND,
+ MAX = COPY
+ }
+}
diff --git a/src/System.Drawing.Common/src/misc/HandleCollector.cs b/src/System.Drawing.Common/src/misc/HandleCollector.cs
new file mode 100644
index 0000000000..40b00bda67
--- /dev/null
+++ b/src/System.Drawing.Common/src/misc/HandleCollector.cs
@@ -0,0 +1,297 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#if DEBUG_HANDLECOLLECTOR
+ using System.Diagnostics;
+#endif
+
+using System.Diagnostics.CodeAnalysis;
+[module: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System.Internal")]
+
+namespace System.Internal
+{
+ internal sealed class HandleCollector
+ {
+ private static HandleType[] s_handleTypes;
+ private static int s_handleTypeCount;
+ private static int s_suspendCount;
+
+ internal static event HandleChangeEventHandler HandleAdded;
+
+ internal static event HandleChangeEventHandler HandleRemoved;
+
+ private static object s_internalSyncObject = new object();
+
+ /// <include file='doc\NativeMethods.uex' path='docs/doc[@for="NativeMethods.HandleCollector.Add"]/*' />
+ /// <devdoc>
+ /// Adds the given handle to the handle collector. This keeps the
+ /// handle on a "hot list" of objects that may need to be garbage
+ /// collected.
+ /// </devdoc>
+ internal static IntPtr Add(IntPtr handle, int type)
+ {
+ s_handleTypes[type - 1].Add(handle);
+ return handle;
+ }
+
+ /// <include file='doc\NativeMethods.uex' path='docs/doc[@for="NativeMethods.HandleCollector.Add"]/*' />
+ /// <devdoc>
+ /// Suspends GC.Collect
+ /// </devdoc>
+ internal static void SuspendCollect()
+ {
+ lock (s_internalSyncObject)
+ {
+ s_suspendCount++;
+ }
+ }
+
+ /// <include file='doc\NativeMethods.uex' path='docs/doc[@for="NativeMethods.HandleCollector.Add"]/*' />
+ /// <devdoc>
+ /// Resumes GC.Collect
+ /// </devdoc>
+ internal static void ResumeCollect()
+ {
+ bool performCollect = false;
+ lock (s_internalSyncObject)
+ {
+ if (s_suspendCount > 0)
+ {
+ s_suspendCount--;
+ }
+
+ if (s_suspendCount == 0)
+ {
+ for (int i = 0; i < s_handleTypeCount; i++)
+ {
+ lock (s_handleTypes[i])
+ {
+ if (s_handleTypes[i].NeedCollection())
+ {
+ performCollect = true;
+ }
+ }
+ }
+ }
+ }
+
+ if (performCollect)
+ {
+ GC.Collect();
+ }
+ }
+
+ /// <include file='doc\NativeMethods.uex' path='docs/doc[@for="NativeMethods.HandleCollector.RegisterType"]/*' />
+ /// <devdoc>
+ /// Registers a new type of handle with the handle collector.
+ /// </devdoc>
+ internal static int RegisterType(string typeName, int expense, int initialThreshold)
+ {
+ lock (s_internalSyncObject)
+ {
+ if (s_handleTypeCount == 0 || s_handleTypeCount == s_handleTypes.Length)
+ {
+ HandleType[] newTypes = new HandleType[s_handleTypeCount + 10];
+ if (s_handleTypes != null)
+ {
+ Array.Copy(s_handleTypes, 0, newTypes, 0, s_handleTypeCount);
+ }
+ s_handleTypes = newTypes;
+ }
+
+ s_handleTypes[s_handleTypeCount++] = new HandleType(typeName, expense, initialThreshold);
+ return s_handleTypeCount;
+ }
+ }
+
+ /// <include file='doc\NativeMethods.uex' path='docs/doc[@for="NativeMethods.HandleCollector.Remove"]/*' />
+ /// <devdoc>
+ /// Removes the given handle from the handle collector. Removing a
+ /// handle removes it from our "hot list" of objects that should be
+ /// frequently garbage collected.
+ /// </devdoc>
+ internal static IntPtr Remove(IntPtr handle, int type)
+ {
+ return s_handleTypes[type - 1].Remove(handle);
+ }
+
+ /// <include file='doc\NativeMethods.uex' path='docs/doc[@for="NativeMethods.HandleCollector.HandleType"]/*' />
+ /// <devdoc>
+ /// Represents a specific type of handle.
+ /// </devdoc>
+ private class HandleType
+ {
+ internal readonly string name;
+
+ private int _initialThreshHold;
+ private int _threshHold;
+ private int _handleCount;
+ private readonly int _deltaPercent;
+
+#if DEBUG_HANDLECOLLECTOR
+ private List<IntPtr> handles = new List<IntPtr>();
+#endif
+
+ /// <include file='doc\NativeMethods.uex' path='docs/doc[@for="NativeMethods.HandleCollector.HandleType.HandleType"]/*' />
+ /// <devdoc>
+ /// Creates a new handle type.
+ /// </devdoc>
+ internal HandleType(string name, int expense, int initialThreshHold)
+ {
+ this.name = name;
+ _initialThreshHold = initialThreshHold;
+ _threshHold = initialThreshHold;
+ _deltaPercent = 100 - expense;
+ }
+
+ /// <include file='doc\NativeMethods.uex' path='docs/doc[@for="NativeMethods.HandleCollector.HandleType.Add"]/*' />
+ /// <devdoc>
+ /// Adds a handle to this handle type for monitoring.
+ /// </devdoc>
+ internal void Add(IntPtr handle)
+ {
+ if (handle == IntPtr.Zero)
+ {
+ return;
+ }
+
+ bool performCollect = false;
+ int currentCount = 0;
+
+ lock (this)
+ {
+ _handleCount++;
+#if DEBUG_HANDLECOLLECTOR
+ Debug.Assert(!handles.Contains(handle));
+ handles.Add(handle);
+#endif
+ performCollect = NeedCollection();
+ currentCount = _handleCount;
+ }
+ lock (s_internalSyncObject)
+ {
+ if (HandleCollector.HandleAdded != null)
+ {
+ HandleCollector.HandleAdded(name, handle, currentCount);
+ }
+ }
+
+ if (!performCollect)
+ {
+ return;
+ }
+
+
+ if (performCollect)
+ {
+#if DEBUG_HANDLECOLLECTOR
+ Debug.WriteLine("HC> Forcing garbage collect");
+ Debug.WriteLine("HC> name :" + name);
+ Debug.WriteLine("HC> threshHold :" + (threshHold).ToString());
+ Debug.WriteLine("HC> handleCount :" + (handleCount).ToString());
+ Debug.WriteLine("HC> deltaPercent:" + (deltaPercent).ToString());
+#endif
+ GC.Collect();
+
+ // We just performed a GC. If the main thread is in a tight
+ // loop there is a this will cause us to increase handles forever and prevent handle collector
+ // from doing its job. Yield the thread here. This won't totally cause
+ // a finalization pass but it will effectively elevate the priority
+ // of the finalizer thread just for an instant. But how long should
+ // we sleep? We base it on how expensive the handles are because the
+ // more expensive the handle, the more critical that it be reclaimed.
+ int sleep = (100 - _deltaPercent) / 4;
+ System.Threading.Thread.Sleep(sleep);
+ }
+ }
+
+
+ /// <include file='doc\NativeMethods.uex' path='docs/doc[@for="NativeMethods.HandleCollector.HandleType.GetHandleCount"]/*' />
+ /// <devdoc>
+ /// Retrieves the outstanding handle count for this
+ /// handle type.
+ /// </devdoc>
+ internal int GetHandleCount()
+ {
+ lock (this)
+ {
+ return _handleCount;
+ }
+ }
+
+ /// <include file='doc\NativeMethods.uex' path='docs/doc[@for="NativeMethods.HandleCollector.HandleType.NeedCollection"]/*' />
+ /// <devdoc>
+ /// Determines if this handle type needs a garbage collection pass.
+ /// </devdoc>
+ internal bool NeedCollection()
+ {
+ if (s_suspendCount > 0)
+ {
+ return false;
+ }
+ if (_handleCount > _threshHold)
+ {
+ _threshHold = _handleCount + ((_handleCount * _deltaPercent) / 100);
+#if DEBUG_HANDLECOLLECTOR
+ Debug.WriteLine("HC> NeedCollection: increase threshHold to " + threshHold);
+#endif
+ return true;
+ }
+
+ // If handle count < threshHold, we don't
+ // need to collect, but if it 10% below the next lowest threshhold we
+ // will bump down a rung. We need to choose a percentage here or else
+ // we will oscillate.
+ //
+ int oldThreshHold = (100 * _threshHold) / (100 + _deltaPercent);
+ if (oldThreshHold >= _initialThreshHold && _handleCount < (int)(oldThreshHold * .9F))
+ {
+#if DEBUG_HANDLECOLLECTOR
+ Debug.WriteLine("HC> NeedCollection: throttle threshhold " + threshHold + " down to " + oldThreshHold);
+#endif
+ _threshHold = oldThreshHold;
+ }
+
+ return false;
+ }
+
+ /// <include file='doc\NativeMethods.uex' path='docs/doc[@for="NativeMethods.HandleCollector.HandleType.Remove"]/*' />
+ /// <devdoc>
+ /// Removes the given handle from our monitor list.
+ /// </devdoc>
+ internal IntPtr Remove(IntPtr handle)
+ {
+ if (handle == IntPtr.Zero)
+ {
+ return handle;
+ }
+ int currentCount = 0;
+ lock (this)
+ {
+ _handleCount--;
+#if DEBUG_HANDLECOLLECTOR
+ Debug.Assert(handles.Contains(handle));
+ handles.Remove(handle);
+#endif
+ if (_handleCount < 0)
+ {
+ System.Diagnostics.Debug.Fail("Handle collector underflow for type '" + name + "'");
+ _handleCount = 0;
+ }
+ currentCount = _handleCount;
+ }
+ lock (s_internalSyncObject)
+ {
+ if (HandleCollector.HandleRemoved != null)
+ {
+ HandleCollector.HandleRemoved(name, handle, currentCount);
+ }
+ }
+ return handle;
+ }
+ }
+ }
+
+ internal delegate void HandleChangeEventHandler(string handleType, IntPtr handleValue, int currentHandleCount);
+}
diff --git a/src/System.Drawing.Common/src/misc/InvariantComparer.cs b/src/System.Drawing.Common/src/misc/InvariantComparer.cs
new file mode 100644
index 0000000000..b6317ae337
--- /dev/null
+++ b/src/System.Drawing.Common/src/misc/InvariantComparer.cs
@@ -0,0 +1,32 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System
+{
+ using System.Collections;
+ using System.Globalization;
+
+ [Serializable]
+ internal class InvariantComparer : IComparer
+ {
+ private CompareInfo _compareInfo;
+ internal static readonly InvariantComparer Default = new InvariantComparer();
+
+ internal InvariantComparer()
+ {
+ _compareInfo = CultureInfo.InvariantCulture.CompareInfo;
+ }
+
+ public int Compare(Object a, Object b)
+ {
+ String sa = a as String;
+ String sb = b as String;
+ if (sa != null && sb != null)
+ return _compareInfo.Compare(sa, sb);
+ else
+ return Comparer.Default.Compare(a, b);
+ }
+ }
+}
+
diff --git a/src/System.Drawing.Primitives/ref/System.Drawing.Primitives.cs b/src/System.Drawing.Primitives/ref/System.Drawing.Primitives.cs
index e28d6de3f0..517d082523 100644
--- a/src/System.Drawing.Primitives/ref/System.Drawing.Primitives.cs
+++ b/src/System.Drawing.Primitives/ref/System.Drawing.Primitives.cs
@@ -72,7 +72,9 @@ namespace System.Drawing
public static System.Drawing.Color IndianRed { get { throw null; } }
public static System.Drawing.Color Indigo { get { throw null; } }
public bool IsEmpty { get { throw null; } }
+ public bool IsKnownColor { get { throw null; } }
public bool IsNamedColor { get { throw null; } }
+ public bool IsSystemColor { get { throw null; } }
public static System.Drawing.Color Ivory { get { throw null; } }
public static System.Drawing.Color Khaki { get { throw null; } }
public static System.Drawing.Color Lavender { get { throw null; } }
@@ -165,6 +167,7 @@ namespace System.Drawing
public static System.Drawing.Color FromArgb(int alpha, System.Drawing.Color baseColor) { throw null; }
public static System.Drawing.Color FromArgb(int red, int green, int blue) { throw null; }
public static System.Drawing.Color FromArgb(int alpha, int red, int green, int blue) { throw null; }
+ public static System.Drawing.Color FromKnownColor(System.Drawing.KnownColor color) { throw null; }
public static System.Drawing.Color FromName(string name) { throw null; }
public float GetBrightness() { throw null; }
public override int GetHashCode() { throw null; }
@@ -173,6 +176,7 @@ namespace System.Drawing
public static bool operator ==(System.Drawing.Color left, System.Drawing.Color right) { throw null; }
public static bool operator !=(System.Drawing.Color left, System.Drawing.Color right) { throw null; }
public int ToArgb() { throw null; }
+ public System.Drawing.KnownColor ToKnownColor() { throw null; }
public override string ToString() { throw null; }
}
public partial struct Point : System.IEquatable<System.Drawing.Point>
@@ -365,4 +369,181 @@ namespace System.Drawing
public System.Drawing.Size ToSize() { throw null; }
public override string ToString() { throw null; }
}
+ public enum KnownColor
+ {
+ ActiveBorder = 1,
+ ActiveCaption = 2,
+ ActiveCaptionText = 3,
+ AliceBlue = 28,
+ AntiqueWhite = 29,
+ AppWorkspace = 4,
+ Aqua = 30,
+ Aquamarine = 31,
+ Azure = 32,
+ Beige = 33,
+ Bisque = 34,
+ Black = 35,
+ BlanchedAlmond = 36,
+ Blue = 37,
+ BlueViolet = 38,
+ Brown = 39,
+ BurlyWood = 40,
+ ButtonFace = 168,
+ ButtonHighlight = 169,
+ ButtonShadow = 170,
+ CadetBlue = 41,
+ Chartreuse = 42,
+ Chocolate = 43,
+ Control = 5,
+ ControlDark = 6,
+ ControlDarkDark = 7,
+ ControlLight = 8,
+ ControlLightLight = 9,
+ ControlText = 10,
+ Coral = 44,
+ CornflowerBlue = 45,
+ Cornsilk = 46,
+ Crimson = 47,
+ Cyan = 48,
+ DarkBlue = 49,
+ DarkCyan = 50,
+ DarkGoldenrod = 51,
+ DarkGray = 52,
+ DarkGreen = 53,
+ DarkKhaki = 54,
+ DarkMagenta = 55,
+ DarkOliveGreen = 56,
+ DarkOrange = 57,
+ DarkOrchid = 58,
+ DarkRed = 59,
+ DarkSalmon = 60,
+ DarkSeaGreen = 61,
+ DarkSlateBlue = 62,
+ DarkSlateGray = 63,
+ DarkTurquoise = 64,
+ DarkViolet = 65,
+ DeepPink = 66,
+ DeepSkyBlue = 67,
+ Desktop = 11,
+ DimGray = 68,
+ DodgerBlue = 69,
+ Firebrick = 70,
+ FloralWhite = 71,
+ ForestGreen = 72,
+ Fuchsia = 73,
+ Gainsboro = 74,
+ GhostWhite = 75,
+ Gold = 76,
+ Goldenrod = 77,
+ GradientActiveCaption = 171,
+ GradientInactiveCaption = 172,
+ Gray = 78,
+ GrayText = 12,
+ Green = 79,
+ GreenYellow = 80,
+ Highlight = 13,
+ HighlightText = 14,
+ Honeydew = 81,
+ HotPink = 82,
+ HotTrack = 15,
+ InactiveBorder = 16,
+ InactiveCaption = 17,
+ InactiveCaptionText = 18,
+ IndianRed = 83,
+ Indigo = 84,
+ Info = 19,
+ InfoText = 20,
+ Ivory = 85,
+ Khaki = 86,
+ Lavender = 87,
+ LavenderBlush = 88,
+ LawnGreen = 89,
+ LemonChiffon = 90,
+ LightBlue = 91,
+ LightCoral = 92,
+ LightCyan = 93,
+ LightGoldenrodYellow = 94,
+ LightGray = 95,
+ LightGreen = 96,
+ LightPink = 97,
+ LightSalmon = 98,
+ LightSeaGreen = 99,
+ LightSkyBlue = 100,
+ LightSlateGray = 101,
+ LightSteelBlue = 102,
+ LightYellow = 103,
+ Lime = 104,
+ LimeGreen = 105,
+ Linen = 106,
+ Magenta = 107,
+ Maroon = 108,
+ MediumAquamarine = 109,
+ MediumBlue = 110,
+ MediumOrchid = 111,
+ MediumPurple = 112,
+ MediumSeaGreen = 113,
+ MediumSlateBlue = 114,
+ MediumSpringGreen = 115,
+ MediumTurquoise = 116,
+ MediumVioletRed = 117,
+ Menu = 21,
+ MenuBar = 173,
+ MenuHighlight = 174,
+ MenuText = 22,
+ MidnightBlue = 118,
+ MintCream = 119,
+ MistyRose = 120,
+ Moccasin = 121,
+ NavajoWhite = 122,
+ Navy = 123,
+ OldLace = 124,
+ Olive = 125,
+ OliveDrab = 126,
+ Orange = 127,
+ OrangeRed = 128,
+ Orchid = 129,
+ PaleGoldenrod = 130,
+ PaleGreen = 131,
+ PaleTurquoise = 132,
+ PaleVioletRed = 133,
+ PapayaWhip = 134,
+ PeachPuff = 135,
+ Peru = 136,
+ Pink = 137,
+ Plum = 138,
+ PowderBlue = 139,
+ Purple = 140,
+ Red = 141,
+ RosyBrown = 142,
+ RoyalBlue = 143,
+ SaddleBrown = 144,
+ Salmon = 145,
+ SandyBrown = 146,
+ ScrollBar = 23,
+ SeaGreen = 147,
+ SeaShell = 148,
+ Sienna = 149,
+ Silver = 150,
+ SkyBlue = 151,
+ SlateBlue = 152,
+ SlateGray = 153,
+ Snow = 154,
+ SpringGreen = 155,
+ SteelBlue = 156,
+ Tan = 157,
+ Teal = 158,
+ Thistle = 159,
+ Tomato = 160,
+ Transparent = 27,
+ Turquoise = 161,
+ Violet = 162,
+ Wheat = 163,
+ White = 164,
+ WhiteSmoke = 165,
+ Window = 24,
+ WindowFrame = 25,
+ WindowText = 26,
+ Yellow = 166,
+ YellowGreen = 167,
+ }
}
diff --git a/src/System.Drawing.Primitives/src/System/Drawing/Color.cs b/src/System.Drawing.Primitives/src/System/Drawing/Color.cs
index 07ff82e444..71f0a8f957 100644
--- a/src/System.Drawing.Primitives/src/System/Drawing/Color.cs
+++ b/src/System.Drawing.Primitives/src/System/Drawing/Color.cs
@@ -363,12 +363,14 @@ namespace System.Drawing
public byte A => (byte)((Value >> ARGBAlphaShift) & 0xFF);
- private bool IsKnownColor => ((state & StateKnownColorValid) != 0);
+ public bool IsKnownColor => ((state & StateKnownColorValid) != 0);
public bool IsEmpty => state == 0;
public bool IsNamedColor => ((state & StateNameValid) != 0) || IsKnownColor;
+ public bool IsSystemColor => IsKnownColor && ((((KnownColor) knownColor) <= KnownColor.WindowText) || (((KnownColor) knownColor) > KnownColor.YellowGreen));
+
// Not localized because it's only used for the DebuggerDisplayAttribute, and the values are
// programmatic items.
// Also, don't inline into the attribute for performance reasons. This way means the debugger
@@ -449,7 +451,7 @@ namespace System.Drawing
public static Color FromArgb(int red, int green, int blue) => FromArgb(255, red, green, blue);
- private static Color FromKnownColor(KnownColor color)
+ public static Color FromKnownColor(KnownColor color)
{
var value = (int)color;
if (value < (int)KnownColor.FirstColor || value > (int)KnownColor.LastColor)
@@ -574,7 +576,7 @@ namespace System.Drawing
public int ToArgb() => unchecked((int)Value);
- private KnownColor ToKnownColor() => (KnownColor)knownColor;
+ public KnownColor ToKnownColor() => (KnownColor)knownColor;
public override string ToString()
{
diff --git a/src/System.Drawing.Primitives/src/System/Drawing/KnownColor.cs b/src/System.Drawing.Primitives/src/System/Drawing/KnownColor.cs
index 450f3bfbf7..dbd287dd06 100644
--- a/src/System.Drawing.Primitives/src/System/Drawing/KnownColor.cs
+++ b/src/System.Drawing.Primitives/src/System/Drawing/KnownColor.cs
@@ -7,7 +7,7 @@ using System.Diagnostics.CodeAnalysis;
namespace System.Drawing
{
[SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue")]
- internal enum KnownColor
+ public enum KnownColor
{
// This enum is order dependant!!!
//
@@ -17,192 +17,883 @@ namespace System.Drawing
// 0 - reserved for "not a known color"
-
+ FirstColor = 0,
// "System" colors
- /*
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.ActiveBorder"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
ActiveBorder = 1,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.ActiveCaption"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
ActiveCaption,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.ActiveCaptionText"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
ActiveCaptionText,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.AppWorkspace"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
AppWorkspace,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Control"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Control,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.ControlDark"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
ControlDark,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.ControlDarkDark"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
ControlDarkDark,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.ControlLight"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
ControlLight,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.ControlLightLight"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
ControlLightLight,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.ControlText"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
ControlText,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Desktop"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Desktop,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.GrayText"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
GrayText,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Highlight"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Highlight,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.HighlightText"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
HighlightText,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.HotTrack"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
HotTrack,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.InactiveBorder"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
InactiveBorder,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.InactiveCaption"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
InactiveCaption,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.InactiveCaptionText"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
InactiveCaptionText,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Info"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Info,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.InfoText"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
InfoText,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Menu"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Menu,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.MenuText"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
MenuText,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.ScrollBar"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
ScrollBar,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Window"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Window,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.WindowFrame"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
WindowFrame,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.WindowText"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
WindowText,
- */
// "Web" Colors
- FirstColor = 0,
- Transparent = FirstColor,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Transparent"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
+ Transparent,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.AliceBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
AliceBlue,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.AntiqueWhite"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
AntiqueWhite,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Aqua"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Aqua,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Aquamarine"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Aquamarine,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Azure"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Azure,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Beige"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Beige,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Bisque"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Bisque,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Black"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Black,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.BlanchedAlmond"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
BlanchedAlmond,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Blue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Blue,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.BlueViolet"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
BlueViolet,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Brown"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Brown,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.BurlyWood"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
BurlyWood,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.CadetBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
CadetBlue,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Chartreuse"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Chartreuse,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Chocolate"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Chocolate,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Coral"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Coral,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.CornflowerBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
CornflowerBlue,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Cornsilk"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Cornsilk,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Crimson"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Crimson,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Cyan"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Cyan,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.DarkBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
DarkBlue,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.DarkCyan"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
DarkCyan,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.DarkGoldenrod"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
DarkGoldenrod,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.DarkGray"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
DarkGray,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.DarkGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
DarkGreen,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.DarkKhaki"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
DarkKhaki,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.DarkMagenta"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
DarkMagenta,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.DarkOliveGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
DarkOliveGreen,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.DarkOrange"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
DarkOrange,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.DarkOrchid"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
DarkOrchid,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.DarkRed"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
DarkRed,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.DarkSalmon"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
DarkSalmon,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.DarkSeaGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
DarkSeaGreen,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.DarkSlateBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
DarkSlateBlue,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.DarkSlateGray"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
DarkSlateGray,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.DarkTurquoise"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
DarkTurquoise,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.DarkViolet"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
DarkViolet,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.DeepPink"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
DeepPink,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.DeepSkyBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
DeepSkyBlue,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.DimGray"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
DimGray,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.DodgerBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
DodgerBlue,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Firebrick"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Firebrick,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.FloralWhite"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
FloralWhite,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.ForestGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
ForestGreen,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Fuchsia"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Fuchsia,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Gainsboro"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Gainsboro,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.GhostWhite"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
GhostWhite,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Gold"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Gold,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Goldenrod"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Goldenrod,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Gray"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Gray,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Green"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Green,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.GreenYellow"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
GreenYellow,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Honeydew"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Honeydew,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.HotPink"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
HotPink,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.IndianRed"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
IndianRed,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Indigo"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Indigo,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Ivory"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Ivory,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Khaki"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Khaki,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Lavender"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Lavender,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.LavenderBlush"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
LavenderBlush,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.LawnGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
LawnGreen,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.LemonChiffon"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
LemonChiffon,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.LightBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
LightBlue,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.LightCoral"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
LightCoral,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.LightCyan"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
LightCyan,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.LightGoldenrodYellow"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
LightGoldenrodYellow,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.LightGray"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
LightGray,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.LightGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
LightGreen,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.LightPink"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
LightPink,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.LightSalmon"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
LightSalmon,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.LightSeaGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
LightSeaGreen,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.LightSkyBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
LightSkyBlue,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.LightSlateGray"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
LightSlateGray,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.LightSteelBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
LightSteelBlue,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.LightYellow"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
LightYellow,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Lime"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Lime,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.LimeGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
LimeGreen,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Linen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Linen,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Magenta"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Magenta,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Maroon"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Maroon,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.MediumAquamarine"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
MediumAquamarine,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.MediumBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
MediumBlue,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.MediumOrchid"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
MediumOrchid,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.MediumPurple"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
MediumPurple,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.MediumSeaGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
MediumSeaGreen,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.MediumSlateBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
MediumSlateBlue,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.MediumSpringGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
MediumSpringGreen,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.MediumTurquoise"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
MediumTurquoise,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.MediumVioletRed"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
MediumVioletRed,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.MidnightBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
MidnightBlue,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.MintCream"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
MintCream,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.MistyRose"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
MistyRose,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Moccasin"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Moccasin,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.NavajoWhite"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
NavajoWhite,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Navy"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Navy,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.OldLace"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
OldLace,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Olive"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Olive,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.OliveDrab"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
OliveDrab,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Orange"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Orange,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.OrangeRed"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
OrangeRed,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Orchid"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Orchid,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.PaleGoldenrod"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
PaleGoldenrod,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.PaleGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
PaleGreen,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.PaleTurquoise"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
PaleTurquoise,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.PaleVioletRed"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
PaleVioletRed,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.PapayaWhip"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
PapayaWhip,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.PeachPuff"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
PeachPuff,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Peru"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Peru,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Pink"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Pink,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Plum"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Plum,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.PowderBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
PowderBlue,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Purple"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Purple,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Red"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Red,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.RosyBrown"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
RosyBrown,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.RoyalBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
RoyalBlue,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.SaddleBrown"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
SaddleBrown,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Salmon"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Salmon,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.SandyBrown"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
SandyBrown,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.SeaGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
SeaGreen,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.SeaShell"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
SeaShell,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Sienna"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Sienna,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Silver"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Silver,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.SkyBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
SkyBlue,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.SlateBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
SlateBlue,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.SlateGray"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
SlateGray,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Snow"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Snow,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.SpringGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
SpringGreen,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.SteelBlue"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
SteelBlue,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Tan"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Tan,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Teal"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Teal,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Thistle"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Thistle,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Tomato"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Tomato,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Turquoise"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Turquoise,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Violet"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Violet,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Wheat"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Wheat,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.White"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
White,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.WhiteSmoke"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
WhiteSmoke,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.Yellow"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
Yellow,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.YellowGreen"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
YellowGreen,
- LastColor = YellowGreen
// NEW ADDITIONS IN WHIDBEY - DO NOT MOVE THESE UP OR IT WILL BE A BREAKING CHANGE
- /*
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.ButtonFace"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
ButtonFace,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.ButtonHighlight"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
ButtonHighlight,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.ButtonShadow"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
ButtonShadow,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.GradientActiveCaption"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
GradientActiveCaption,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.GradientInactiveCaption"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
GradientInactiveCaption,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.MenuBar"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
MenuBar,
+ /// <include file='doc\KnownColor.uex' path='docs/doc[@for="KnownColor.MenuHighlight"]/*' />
+ /// <devdoc>
+ /// <para>[To be supplied.]</para>
+ /// </devdoc>
MenuHighlight,
- */
+ LastColor = MenuHighlight,
}
} \ No newline at end of file
diff --git a/src/System.Drawing.Primitives/src/System/Drawing/Point.cs b/src/System.Drawing.Primitives/src/System/Drawing/Point.cs
index 56fb285778..6f9fdf9f50 100644
--- a/src/System.Drawing.Primitives/src/System/Drawing/Point.cs
+++ b/src/System.Drawing.Primitives/src/System/Drawing/Point.cs
@@ -20,8 +20,8 @@ namespace System.Drawing
/// </summary>
public static readonly Point Empty = new Point();
- private int _x;
- private int _y;
+ private int x; // Do not rename (binary serialization)
+ private int y; // Do not rename (binary serialization)
/// <summary>
/// Initializes a new instance of the <see cref='System.Drawing.Point'/> class
@@ -29,8 +29,8 @@ namespace System.Drawing
/// </summary>
public Point(int x, int y)
{
- _x = x;
- _y = y;
+ this.x = x;
+ this.y = y;
}
/// <summary>
@@ -41,8 +41,8 @@ namespace System.Drawing
/// </summary>
public Point(Size sz)
{
- _x = sz.Width;
- _y = sz.Height;
+ x = sz.Width;
+ y = sz.Height;
}
/// <summary>
@@ -51,8 +51,8 @@ namespace System.Drawing
/// </summary>
public Point(int dw)
{
- _x = LowInt16(dw);
- _y = HighInt16(dw);
+ x = LowInt16(dw);
+ y = HighInt16(dw);
}
/// <summary>
@@ -61,15 +61,15 @@ namespace System.Drawing
/// </para>
/// </summary>
[Browsable(false)]
- public bool IsEmpty => _x == 0 && _y == 0;
+ public bool IsEmpty => x == 0 && y == 0;
/// <summary>
/// Gets the x-coordinate of this <see cref='System.Drawing.Point'/>.
/// </summary>
public int X
{
- get { return _x; }
- set { _x = value; }
+ get { return x; }
+ set { x = value; }
}
/// <summary>
@@ -79,8 +79,8 @@ namespace System.Drawing
/// </summary>
public int Y
{
- get { return _y; }
- set { _y = value; }
+ get { return y; }
+ set { y = value; }
}
/// <summary>
diff --git a/src/System.Drawing.Primitives/src/System/Drawing/PointF.cs b/src/System.Drawing.Primitives/src/System/Drawing/PointF.cs
index e05e67087e..891fb535d4 100644
--- a/src/System.Drawing.Primitives/src/System/Drawing/PointF.cs
+++ b/src/System.Drawing.Primitives/src/System/Drawing/PointF.cs
@@ -21,8 +21,8 @@ namespace System.Drawing
/// </para>
/// </summary>
public static readonly PointF Empty = new PointF();
- private float _x;
- private float _y;
+ private float x; // Do not rename (binary serialization)
+ private float y; // Do not rename (binary serialization)
/// <summary>
/// <para>
@@ -32,8 +32,8 @@ namespace System.Drawing
/// </summary>
public PointF(float x, float y)
{
- _x = x;
- _y = y;
+ this.x = x;
+ this.y = y;
}
/// <summary>
@@ -42,7 +42,7 @@ namespace System.Drawing
/// </para>
/// </summary>
[Browsable(false)]
- public bool IsEmpty => _x == 0f && _y == 0f;
+ public bool IsEmpty => x == 0f && y == 0f;
/// <summary>
/// <para>
@@ -51,8 +51,8 @@ namespace System.Drawing
/// </summary>
public float X
{
- get { return _x; }
- set { _x = value; }
+ get { return x; }
+ set { x = value; }
}
/// <summary>
@@ -62,8 +62,8 @@ namespace System.Drawing
/// </summary>
public float Y
{
- get { return _y; }
- set { _y = value; }
+ get { return y; }
+ set { y = value; }
}
/// <summary>
@@ -147,6 +147,6 @@ namespace System.Drawing
public override int GetHashCode() => HashHelpers.Combine(X.GetHashCode(), Y.GetHashCode());
- public override string ToString() => "{X=" + _x.ToString() + ", Y=" + _y.ToString() + "}";
+ public override string ToString() => "{X=" + x.ToString() + ", Y=" + y.ToString() + "}";
}
}
diff --git a/src/System.Drawing.Primitives/src/System/Drawing/Rectangle.cs b/src/System.Drawing.Primitives/src/System/Drawing/Rectangle.cs
index 5165a73660..ddd1a5a9fd 100644
--- a/src/System.Drawing.Primitives/src/System/Drawing/Rectangle.cs
+++ b/src/System.Drawing.Primitives/src/System/Drawing/Rectangle.cs
@@ -18,10 +18,10 @@ namespace System.Drawing
{
public static readonly Rectangle Empty = new Rectangle();
- private int _x;
- private int _y;
- private int _width;
- private int _height;
+ private int x; // Do not rename (binary serialization)
+ private int y; // Do not rename (binary serialization)
+ private int width; // Do not rename (binary serialization)
+ private int height; // Do not rename (binary serialization)
/// <summary>
/// <para>
@@ -31,10 +31,10 @@ namespace System.Drawing
/// </summary>
public Rectangle(int x, int y, int width, int height)
{
- _x = x;
- _y = y;
- _width = width;
- _height = height;
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
}
/// <summary>
@@ -45,10 +45,10 @@ namespace System.Drawing
/// </summary>
public Rectangle(Point location, Size size)
{
- _x = location.X;
- _y = location.Y;
- _width = size.Width;
- _height = size.Height;
+ x = location.X;
+ y = location.Y;
+ width = size.Width;
+ height = size.Height;
}
/// <summary>
@@ -95,8 +95,8 @@ namespace System.Drawing
/// </summary>
public int X
{
- get { return _x; }
- set { _x = value; }
+ get { return x; }
+ set { x = value; }
}
/// <summary>
@@ -105,8 +105,8 @@ namespace System.Drawing
/// </summary>
public int Y
{
- get { return _y; }
- set { _y = value; }
+ get { return y; }
+ set { y = value; }
}
/// <summary>
@@ -115,8 +115,8 @@ namespace System.Drawing
/// </summary>
public int Width
{
- get { return _width; }
- set { _width = value; }
+ get { return width; }
+ set { width = value; }
}
/// <summary>
@@ -125,8 +125,8 @@ namespace System.Drawing
/// </summary>
public int Height
{
- get { return _height; }
- set { _height = value; }
+ get { return height; }
+ set { height = value; }
}
/// <summary>
@@ -172,7 +172,7 @@ namespace System.Drawing
/// </para>
/// </summary>
[Browsable(false)]
- public bool IsEmpty => _height == 0 && _width == 0 && _x == 0 && _y == 0;
+ public bool IsEmpty => height == 0 && width == 0 && x == 0 && y == 0;
/// <summary>
/// <para>
diff --git a/src/System.Drawing.Primitives/src/System/Drawing/RectangleF.cs b/src/System.Drawing.Primitives/src/System/Drawing/RectangleF.cs
index 40276361bf..338896522c 100644
--- a/src/System.Drawing.Primitives/src/System/Drawing/RectangleF.cs
+++ b/src/System.Drawing.Primitives/src/System/Drawing/RectangleF.cs
@@ -22,10 +22,10 @@ namespace System.Drawing
/// </summary>
public static readonly RectangleF Empty = new RectangleF();
- private float _x;
- private float _y;
- private float _width;
- private float _height;
+ private float x; // Do not rename (binary serialization)
+ private float y; // Do not rename (binary serialization)
+ private float width; // Do not rename (binary serialization)
+ private float height; // Do not rename (binary serialization)
/// <summary>
/// <para>
@@ -35,10 +35,10 @@ namespace System.Drawing
/// </summary>
public RectangleF(float x, float y, float width, float height)
{
- _x = x;
- _y = y;
- _width = width;
- _height = height;
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
}
/// <summary>
@@ -50,10 +50,10 @@ namespace System.Drawing
/// </summary>
public RectangleF(PointF location, SizeF size)
{
- _x = location.X;
- _y = location.Y;
- _width = size.Width;
- _height = size.Height;
+ x = location.X;
+ y = location.Y;
+ width = size.Width;
+ height = size.Height;
}
/// <summary>
@@ -106,8 +106,8 @@ namespace System.Drawing
/// </summary>
public float X
{
- get { return _x; }
- set { _x = value; }
+ get { return x; }
+ set { x = value; }
}
/// <summary>
@@ -118,8 +118,8 @@ namespace System.Drawing
/// </summary>
public float Y
{
- get { return _y; }
- set { _y = value; }
+ get { return y; }
+ set { y = value; }
}
/// <summary>
@@ -130,8 +130,8 @@ namespace System.Drawing
/// </summary>
public float Width
{
- get { return _width; }
- set { _width = value; }
+ get { return width; }
+ set { width = value; }
}
/// <summary>
@@ -142,8 +142,8 @@ namespace System.Drawing
/// </summary>
public float Height
{
- get { return _height; }
- set { _height = value; }
+ get { return height; }
+ set { height = value; }
}
/// <summary>
diff --git a/src/System.Drawing.Primitives/src/System/Drawing/Size.cs b/src/System.Drawing.Primitives/src/System/Drawing/Size.cs
index 19cf1e314b..35da1dcb6e 100644
--- a/src/System.Drawing.Primitives/src/System/Drawing/Size.cs
+++ b/src/System.Drawing.Primitives/src/System/Drawing/Size.cs
@@ -22,8 +22,8 @@ namespace System.Drawing
/// </summary>
public static readonly Size Empty = new Size();
- private int _width;
- private int _height;
+ private int width; // Do not rename (binary serialization)
+ private int height; // Do not rename (binary serialization)
/**
* Create a new Size object from a point
@@ -36,8 +36,8 @@ namespace System.Drawing
/// </summary>
public Size(Point pt)
{
- _width = pt.X;
- _height = pt.Y;
+ width = pt.X;
+ height = pt.Y;
}
/**
@@ -49,8 +49,8 @@ namespace System.Drawing
/// </summary>
public Size(int width, int height)
{
- _width = width;
- _height = height;
+ this.width = width;
+ this.height = height;
}
/// <summary>
@@ -97,7 +97,7 @@ namespace System.Drawing
/// width and height.
/// </summary>
[Browsable(false)]
- public bool IsEmpty => _width == 0 && _height == 0;
+ public bool IsEmpty => width == 0 && height == 0;
/**
* Horizontal dimension
@@ -111,8 +111,8 @@ namespace System.Drawing
/// </summary>
public int Width
{
- get { return _width; }
- set { _width = value; }
+ get { return width; }
+ set { width = value; }
}
/**
@@ -125,8 +125,8 @@ namespace System.Drawing
/// </summary>
public int Height
{
- get { return _height; }
- set { _height = value; }
+ get { return height; }
+ set { height = value; }
}
/// <summary>
@@ -189,6 +189,6 @@ namespace System.Drawing
/// <see cref='System.Drawing.Size'/>.
/// </para>
/// </summary>
- public override string ToString() => "{Width=" + _width.ToString() + ", Height=" + _height.ToString() + "}";
+ public override string ToString() => "{Width=" + width.ToString() + ", Height=" + height.ToString() + "}";
}
}
diff --git a/src/System.Drawing.Primitives/src/System/Drawing/SizeF.cs b/src/System.Drawing.Primitives/src/System/Drawing/SizeF.cs
index 82ae869061..1ea50b1064 100644
--- a/src/System.Drawing.Primitives/src/System/Drawing/SizeF.cs
+++ b/src/System.Drawing.Primitives/src/System/Drawing/SizeF.cs
@@ -23,8 +23,8 @@ namespace System.Drawing
/// Initializes a new instance of the <see cref='System.Drawing.SizeF'/> class.
/// </summary>
public static readonly SizeF Empty = new SizeF();
- private float _width;
- private float _height;
+ private float width; // Do not rename (binary serialization)
+ private float height; // Do not rename (binary serialization)
/**
* Create a new SizeF object from another size object
@@ -35,8 +35,8 @@ namespace System.Drawing
/// </summary>
public SizeF(SizeF size)
{
- _width = size._width;
- _height = size._height;
+ width = size.width;
+ height = size.height;
}
/**
@@ -50,8 +50,8 @@ namespace System.Drawing
/// </summary>
public SizeF(PointF pt)
{
- _width = pt.X;
- _height = pt.Y;
+ width = pt.X;
+ height = pt.Y;
}
/**
@@ -65,8 +65,8 @@ namespace System.Drawing
/// </summary>
public SizeF(float width, float height)
{
- _width = width;
- _height = height;
+ this.width = width;
+ this.height = height;
}
/// <summary>
@@ -111,7 +111,7 @@ namespace System.Drawing
/// </para>
/// </summary>
[Browsable(false)]
- public bool IsEmpty => _width == 0 && _height == 0;
+ public bool IsEmpty => width == 0 && height == 0;
/**
* Horizontal dimension
@@ -125,8 +125,8 @@ namespace System.Drawing
/// </summary>
public float Width
{
- get { return _width; }
- set { _width = value; }
+ get { return width; }
+ set { width = value; }
}
/**
@@ -141,8 +141,8 @@ namespace System.Drawing
/// </summary>
public float Height
{
- get { return _height; }
- set { _height = value; }
+ get { return height; }
+ set { height = value; }
}
/// <summary>
@@ -183,7 +183,7 @@ namespace System.Drawing
/// <see cref='System.Drawing.SizeF'/>.
/// </para>
/// </summary>
- public override string ToString() => "{Width=" + _width.ToString() + ", Height=" + _height.ToString() + "}";
+ public override string ToString() => "{Width=" + width.ToString() + ", Height=" + height.ToString() + "}";
}
}
diff --git a/src/System.Globalization/tests/CultureInfo/CultureInfoAll.cs b/src/System.Globalization/tests/CultureInfo/CultureInfoAll.cs
index 6da81e6eee..4975ebb041 100644
--- a/src/System.Globalization/tests/CultureInfo/CultureInfoAll.cs
+++ b/src/System.Globalization/tests/CultureInfo/CultureInfoAll.cs
@@ -629,6 +629,7 @@ namespace System.Globalization.Tests
}
[Fact]
+ [ActiveIssue("TFS 444333 - Should ExceptionMiniaturizer exempt CultureNotFoundException.InvalidCultureName from being optimized away?", TargetFrameworkMonikers.UapAot)]
public void CultureNotFoundExceptionTest()
{
AssertExtensions.Throws<CultureNotFoundException>("name", () => new CultureInfo("!@#$%^&*()"));
diff --git a/src/System.Globalization/tests/CultureInfo/CultureInfoAsync.cs b/src/System.Globalization/tests/CultureInfo/CultureInfoAsync.cs
index ca3b73155d..b582ae581a 100644
--- a/src/System.Globalization/tests/CultureInfo/CultureInfoAsync.cs
+++ b/src/System.Globalization/tests/CultureInfo/CultureInfoAsync.cs
@@ -12,6 +12,7 @@ namespace System.Globalization.Tests
[Fact]
// async current cultures feature is supported on 4.6.1 and up on Windows desktop framework
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)]
+ [ActiveIssue("https://github.com/dotnet/corert/issues/3747 - Port async-aware CultureInfo property from CoreCLR", TargetFrameworkMonikers.UapAot)]
public void TestCurrentCulturesAsync()
{
CultureInfo currentCulture = CultureInfo.CurrentCulture;
@@ -43,6 +44,7 @@ namespace System.Globalization.Tests
[Fact]
// async current cultures feature is supported on 4.6.1 and up on Windows desktop framework
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)]
+ [ActiveIssue("https://github.com/dotnet/corert/issues/3747 - Port async-aware CultureInfo property from CoreCLR", TargetFrameworkMonikers.UapAot)]
public void TestCurrentCulturesWithAwait()
{
CultureInfo currentCulture = CultureInfo.CurrentCulture;
diff --git a/src/System.Globalization/tests/CultureInfo/CultureInfoCurrentCulture.cs b/src/System.Globalization/tests/CultureInfo/CultureInfoCurrentCulture.cs
index a46550602a..f8ea84a6bd 100644
--- a/src/System.Globalization/tests/CultureInfo/CultureInfoCurrentCulture.cs
+++ b/src/System.Globalization/tests/CultureInfo/CultureInfoCurrentCulture.cs
@@ -57,6 +57,7 @@ namespace System.Globalization.Tests
}
[Fact]
+ [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "Thread cultures is not honored in UWP.")]
public void DefaultThreadCurrentCulture()
{
RemoteInvoke(() =>
@@ -76,6 +77,7 @@ namespace System.Globalization.Tests
}
[Fact]
+ [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "Thread cultures is not honored in UWP.")]
public void DefaultThreadCurrentUICulture()
{
RemoteInvoke(() =>
diff --git a/src/System.Globalization/tests/System.Globalization.Tests.csproj b/src/System.Globalization/tests/System.Globalization.Tests.csproj
index 9dcadd7507..f9f3b21250 100644
--- a/src/System.Globalization/tests/System.Globalization.Tests.csproj
+++ b/src/System.Globalization/tests/System.Globalization.Tests.csproj
@@ -149,11 +149,16 @@
<Compile Include="$(CommonTestPath)\System\IO\FileCleanupTestBase.cs">
<Link>Common\System\IO\FileCleanupTestBase.cs</Link>
</Compile>
- <ProjectReference Include="$(CommonTestPath)\System\Diagnostics\RemoteExecutorConsoleApp\RemoteExecutorConsoleApp.csproj">
+ <ProjectReference Condition="'$(TargetGroup)' != 'uap'" Include="$(CommonTestPath)\System\Diagnostics\RemoteExecutorConsoleApp\RemoteExecutorConsoleApp.csproj">
<Project>{69e46a6f-9966-45a5-8945-2559fe337827}</Project>
<Name>RemoteExecutorConsoleApp</Name>
</ProjectReference>
</ItemGroup>
+
+ <ItemGroup Condition="'$(TargetGroup)' == 'uap'">
+ <Reference Include="Windows" />
+ </ItemGroup>
+
<ItemGroup>
<EmbeddedResource Include="$(CommonTestPath)\Data\UnicodeData.8.0.txt">
<Link>CharUnicodeInfo\UnicodeData8.0.txt</Link>
diff --git a/src/System.IO.FileSystem/src/System/IO/File.cs b/src/System.IO.FileSystem/src/System/IO/File.cs
index 39e0c720a2..c58fed4c4b 100644
--- a/src/System.IO.FileSystem/src/System/IO/File.cs
+++ b/src/System.IO.FileSystem/src/System/IO/File.cs
@@ -1005,7 +1005,7 @@ namespace System.IO
int index = 0;
while (index < count)
{
- int batchSize = Math.Min(DefaultBufferSize, count);
+ int batchSize = Math.Min(DefaultBufferSize, count - index);
contents.CopyTo(index, buffer, 0, batchSize);
cancellationToken.ThrowIfCancellationRequested();
await sw.WriteAsync(buffer, 0, batchSize).ConfigureAwait(false);
diff --git a/src/System.IO.FileSystem/tests/Directory/CreateDirectory.cs b/src/System.IO.FileSystem/tests/Directory/CreateDirectory.cs
index df92fd0ba3..a5db695dc5 100644
--- a/src/System.IO.FileSystem/tests/Directory/CreateDirectory.cs
+++ b/src/System.IO.FileSystem/tests/Directory/CreateDirectory.cs
@@ -359,14 +359,11 @@ namespace System.IO.Tests
public void WindowsExtendedSyntaxWhiteSpace()
{
var paths = IOInputs.GetSimpleWhiteSpace();
- using (TemporaryDirectory directory = new TemporaryDirectory())
- {
- foreach (var path in paths)
- {
- string extendedPath = Path.Combine(IOInputs.ExtendedPrefix + directory.Path, path);
- Directory.CreateDirectory(extendedPath);
- Assert.True(Directory.Exists(extendedPath), extendedPath);
- }
+ foreach (var path in paths)
+ {
+ string extendedPath = Path.Combine(IOInputs.ExtendedPrefix + TestDirectory, path);
+ Directory.CreateDirectory(extendedPath);
+ Assert.True(Directory.Exists(extendedPath), extendedPath);
}
}
@@ -416,13 +413,10 @@ namespace System.IO.Tests
public void PathWithReservedDeviceNameAsExtendedPath()
{
var paths = IOInputs.GetReservedDeviceNames();
- using (TemporaryDirectory directory = new TemporaryDirectory())
+ Assert.All(paths, (path) =>
{
- Assert.All(paths, (path) =>
- {
- Assert.True(Create(IOInputs.ExtendedPrefix + Path.Combine(directory.Path, path)).Exists, path);
- });
- }
+ Assert.True(Create(IOInputs.ExtendedPrefix + Path.Combine(TestDirectory, path)).Exists, path);
+ });
}
[Fact]
diff --git a/src/System.IO.FileSystem/tests/Directory/GetDirectories.cs b/src/System.IO.FileSystem/tests/Directory/GetDirectories.cs
index f7ab14bcbf..0f5adb759d 100644
--- a/src/System.IO.FileSystem/tests/Directory/GetDirectories.cs
+++ b/src/System.IO.FileSystem/tests/Directory/GetDirectories.cs
@@ -21,31 +21,31 @@ namespace System.IO.Tests
[ConditionalFact(nameof(CanCreateSymbolicLinks))]
public void EnumerateWithSymLinkToDirectory()
{
- using (var containingFolder = new TemporaryDirectory())
+ DirectoryInfo containingFolder = Directory.CreateDirectory(GetTestFilePath());
+
+ // Test a symlink to a directory that does and then doesn't exist
+ DirectoryInfo targetDir = Directory.CreateDirectory(GetTestFilePath());
{
- // Test a symlink to a directory that does and then doesn't exist
- using (var targetDir = new TemporaryDirectory())
- {
- // Create a symlink to a folder that exists
- string linkPath = Path.Combine(containingFolder.Path, Path.GetRandomFileName());
- Assert.True(MountHelper.CreateSymbolicLink(linkPath, targetDir.Path, isDirectory: true));
+ // Create a symlink to a folder that exists
+ string linkPath = Path.Combine(containingFolder.FullName, Path.GetRandomFileName());
+ Assert.True(MountHelper.CreateSymbolicLink(linkPath, targetDir.FullName, isDirectory: true));
- Assert.True(Directory.Exists(linkPath));
- Assert.Equal(1, GetEntries(containingFolder.Path).Count());
- }
+ Assert.True(Directory.Exists(linkPath));
+ Assert.Equal(1, GetEntries(containingFolder.FullName).Count());
+ }
+ targetDir.Delete(recursive: true);
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- {
- Assert.Equal(1, GetEntries(containingFolder.Path).Count());
- Assert.Equal(0, Directory.GetFiles(containingFolder.Path).Count());
- }
- else
- {
- // The target file is gone and the symlink still exists; since it can't be resolved,
- // on Unix it's treated as a file rather than as a directory.
- Assert.Equal(0, GetEntries(containingFolder.Path).Count());
- Assert.Equal(1, Directory.GetFiles(containingFolder.Path).Count());
- }
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ Assert.Equal(1, GetEntries(containingFolder.FullName).Count());
+ Assert.Equal(0, Directory.GetFiles(containingFolder.FullName).Count());
+ }
+ else
+ {
+ // The target file is gone and the symlink still exists; since it can't be resolved,
+ // on Unix it's treated as a file rather than as a directory.
+ Assert.Equal(0, GetEntries(containingFolder.FullName).Count());
+ Assert.Equal(1, Directory.GetFiles(containingFolder.FullName).Count());
}
}
}
diff --git a/src/System.IO.FileSystem/tests/Directory/GetFiles.cs b/src/System.IO.FileSystem/tests/Directory/GetFiles.cs
index c999231add..3c4724334f 100644
--- a/src/System.IO.FileSystem/tests/Directory/GetFiles.cs
+++ b/src/System.IO.FileSystem/tests/Directory/GetFiles.cs
@@ -21,27 +21,26 @@ namespace System.IO.Tests
[ConditionalFact(nameof(CanCreateSymbolicLinks))]
public void EnumerateWithSymLinkToFile()
{
- using (var containingFolder = new TemporaryDirectory())
- {
- string linkPath;
+ DirectoryInfo containingFolder = Directory.CreateDirectory(GetTestFilePath());
- // Test a symlink to a file that does and then doesn't exist
- using (var targetFile = new TemporaryFile())
- {
- linkPath = Path.Combine(containingFolder.Path, Path.GetRandomFileName());
- Assert.True(MountHelper.CreateSymbolicLink(linkPath, targetFile.Path, isDirectory: false));
+ // Test a symlink to a file that does and then doesn't exist
+ FileInfo targetFile = new FileInfo(GetTestFilePath());
+ targetFile.Create().Dispose();
- Assert.True(File.Exists(linkPath));
- Assert.Equal(1, GetEntries(containingFolder.Path).Count());
- }
+ string linkPath = Path.Combine(containingFolder.FullName, Path.GetRandomFileName());
+ Assert.True(MountHelper.CreateSymbolicLink(linkPath, targetFile.FullName, isDirectory: false));
- // The symlink still exists even though the target file is gone.
- Assert.Equal(1, GetEntries(containingFolder.Path).Count());
+ Assert.True(File.Exists(linkPath));
+ Assert.Equal(1, GetEntries(containingFolder.FullName).Count());
- // The symlink is gone
- File.Delete(linkPath);
- Assert.Equal(0, GetEntries(containingFolder.Path).Count());
- }
+ targetFile.Delete();
+
+ // The symlink still exists even though the target file is gone.
+ Assert.Equal(1, GetEntries(containingFolder.FullName).Count());
+
+ // The symlink is gone
+ File.Delete(linkPath);
+ Assert.Equal(0, GetEntries(containingFolder.FullName).Count());
}
}
diff --git a/src/System.IO.FileSystem/tests/File/ReadWriteAllTextAsync.cs b/src/System.IO.FileSystem/tests/File/ReadWriteAllTextAsync.cs
index a62d609adf..55929d6151 100644
--- a/src/System.IO.FileSystem/tests/File/ReadWriteAllTextAsync.cs
+++ b/src/System.IO.FileSystem/tests/File/ReadWriteAllTextAsync.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
@@ -61,10 +62,13 @@ namespace System.IO.Tests
[Theory]
[InlineData(0)]
[InlineData(100)]
+ [InlineData(4096)]
+ [InlineData(4097)]
+ [InlineData(10000)]
public async Task ValidWriteAsync(int size)
{
string path = GetTestFilePath();
- string toWrite = new string('c', size);
+ string toWrite = new string(Enumerable.Range(0, size).Select(i => (char)(i + 1)).ToArray());
File.Create(path).Dispose();
await WriteAsync(path, toWrite);
diff --git a/src/System.IO.FileSystem/tests/FileSystemTest.cs b/src/System.IO.FileSystem/tests/FileSystemTest.cs
index 07aaef81f6..c19d453fbe 100644
--- a/src/System.IO.FileSystem/tests/FileSystemTest.cs
+++ b/src/System.IO.FileSystem/tests/FileSystemTest.cs
@@ -29,16 +29,16 @@ namespace System.IO.Tests
/// the symbolic link may fail to create. Only run this test if it creates
/// links successfully.
/// </summary>
- protected static bool CanCreateSymbolicLinks
+ protected static bool CanCreateSymbolicLinks => s_canCreateSymbolicLinks.Value;
+
+ private static readonly Lazy<bool> s_canCreateSymbolicLinks = new Lazy<bool>(() =>
{
- get
+ try
{
- bool success = true;
-
// Verify file symlink creation
string path = Path.GetTempFileName();
string linkPath = path + ".link";
- success = MountHelper.CreateSymbolicLink(linkPath, path, isDirectory: false);
+ bool success = MountHelper.CreateSymbolicLink(linkPath, path, isDirectory: false);
try { File.Delete(path); } catch { }
try { File.Delete(linkPath); } catch { }
@@ -51,6 +51,12 @@ namespace System.IO.Tests
return success;
}
- }
+ catch
+ {
+ // Problems with Process.Start (used by CreateSymbolicLinks) on some platforms
+ // https://github.com/dotnet/corefx/issues/19909
+ return false;
+ }
+ });
}
}
diff --git a/src/System.IO.FileSystem/tests/PortedCommon/ReparsePointUtilities.cs b/src/System.IO.FileSystem/tests/PortedCommon/ReparsePointUtilities.cs
index 756817a254..d9bf124acf 100644
--- a/src/System.IO.FileSystem/tests/PortedCommon/ReparsePointUtilities.cs
+++ b/src/System.IO.FileSystem/tests/PortedCommon/ReparsePointUtilities.cs
@@ -45,6 +45,7 @@ public static class MountHelper
symLinkProcess.StartInfo.FileName = "/bin/ln";
symLinkProcess.StartInfo.Arguments = string.Format("-s \"{0}\" \"{1}\"", targetPath, linkPath);
}
+ symLinkProcess.StartInfo.UseShellExecute = false;
symLinkProcess.StartInfo.RedirectStandardOutput = true;
symLinkProcess.Start();
diff --git a/src/System.IO.FileSystem/tests/PortedCommon/TemporaryDirectory.cs b/src/System.IO.FileSystem/tests/PortedCommon/TemporaryDirectory.cs
deleted file mode 100644
index eabbcaa71c..0000000000
--- a/src/System.IO.FileSystem/tests/PortedCommon/TemporaryDirectory.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.IO;
-using IOPath = System.IO.Path;
-
-internal class TemporaryDirectory : TemporaryFileSystemItem<DirectoryInfo>
-{
- public TemporaryDirectory()
- : base(CreateTemporaryDirectoryInfo())
- {
- }
-
- protected override void Delete()
- {
- if (Directory.Exists(Path))
- {
- Directory.Delete(Path, true);
- }
- }
-
- private static DirectoryInfo CreateTemporaryDirectoryInfo()
- {
- string path = IOPath.Combine(TestInfo.CurrentDirectory, IOPath.GetRandomFileName());
-
- return Directory.CreateDirectory(path);
- }
-}
diff --git a/src/System.IO.FileSystem/tests/PortedCommon/TemporaryFile.cs b/src/System.IO.FileSystem/tests/PortedCommon/TemporaryFile.cs
deleted file mode 100644
index 51c59b0544..0000000000
--- a/src/System.IO.FileSystem/tests/PortedCommon/TemporaryFile.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.IO;
-using IOPath = System.IO.Path;
-
-internal class TemporaryFile : TemporaryFileSystemItem<FileInfo>
-{
- public TemporaryFile()
- : base(new FileInfo(IOPath.GetTempFileName()))
- {
- }
-
- protected override void Delete()
- {
- File.Delete(Path);
- }
-}
diff --git a/src/System.IO.FileSystem/tests/PortedCommon/TemporaryFileSystemItem.cs b/src/System.IO.FileSystem/tests/PortedCommon/TemporaryFileSystemItem.cs
deleted file mode 100644
index 20a29020ec..0000000000
--- a/src/System.IO.FileSystem/tests/PortedCommon/TemporaryFileSystemItem.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Diagnostics;
-using System.IO;
-using IOPath = System.IO.Path;
-
-internal abstract class TemporaryFileSystemItem<T> : IDisposable
- where T : FileSystemInfo
-{
- private readonly T _info;
-
- protected TemporaryFileSystemItem(T info)
- {
-#if !TEST_WINRT // TODO: reenable once DirectoryInfo adapter is in place
- Debug.Assert(info.Exists);
-#endif
-
- _info = info;
- }
-
- public string Path
- {
- get { return _info.FullName; }
- }
-
- public string Drive
- {
- get { return IOServices.RemoveTrailingSlash(IOPath.GetPathRoot(_info.FullName)); }
- }
-
- public T Info
- {
- get { return _info; }
- }
-
- public bool IsReadOnly
- {
- get { return (_info.Attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly; }
- set
- {
- if (value)
- {
- _info.Attributes |= FileAttributes.ReadOnly;
- }
- else
- {
- _info.Attributes &= ~FileAttributes.ReadOnly;
- }
- }
- }
-
- public bool IsHidden
- {
- get { return (_info.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden; }
- set
- {
- if (value)
- {
- _info.Attributes |= FileAttributes.Hidden;
- }
- else
- {
- _info.Attributes &= ~FileAttributes.Hidden;
- }
- }
- }
-
- public void Dispose()
- {
- if (Info.Exists && IsReadOnly)
- {
- IsReadOnly = false;
- }
-
- Delete();
- }
-
- protected abstract void Delete();
-}
diff --git a/src/System.IO.FileSystem/tests/Resources/System.IO.FileSystem.Tests.rd.xml b/src/System.IO.FileSystem/tests/Resources/System.IO.FileSystem.Tests.rd.xml
new file mode 100644
index 0000000000..79edab30e4
--- /dev/null
+++ b/src/System.IO.FileSystem/tests/Resources/System.IO.FileSystem.Tests.rd.xml
@@ -0,0 +1,6 @@
+<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
+ <Library>
+ <!-- Needed because of FileOptions instance in [Theory] data which causes xunit to reflect on its ToString() -->
+ <Type Name="System.IO.FileOptions" Dynamic="Required Public" />
+ </Library>
+</Directives>
diff --git a/src/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj b/src/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj
index 7e346d3068..3382fab9d2 100644
--- a/src/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj
+++ b/src/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj
@@ -108,9 +108,6 @@
<Compile Include="PortedCommon\IOServices.cs" />
<Compile Include="PortedCommon\PathInfo.cs" />
<Compile Include="PortedCommon\ReparsePointUtilities.cs" />
- <Compile Include="PortedCommon\TemporaryDirectory.cs" />
- <Compile Include="PortedCommon\TemporaryFile.cs" />
- <Compile Include="PortedCommon\TemporaryFileSystemItem.cs" />
<Compile Include="DirectoryInfo\EnumerableAPIs.cs" />
<Compile Include="DirectoryInfo\GetDirectories.cs" />
<Compile Include="DirectoryInfo\GetFiles.cs" />
@@ -176,5 +173,8 @@
<Name>RemoteExecutorConsoleApp</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Resources\$(AssemblyName).rd.xml" />
+ </ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project> \ No newline at end of file
+</Project>
diff --git a/src/System.IO.Ports/src/System/IO/Ports/SerialStream.cs b/src/System.IO.Ports/src/System/IO/Ports/SerialStream.cs
index a5029bfc78..d84a2510de 100644
--- a/src/System.IO.Ports/src/System/IO/Ports/SerialStream.cs
+++ b/src/System.IO.Ports/src/System/IO/Ports/SerialStream.cs
@@ -8,6 +8,7 @@ using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Threading;
+using System.Threading.Tasks;
// Notes about the SerialStream:
// * The stream is always opened via the SerialStream constructor.
@@ -52,6 +53,7 @@ namespace System.IO.Ports
// internal-use members
internal SafeFileHandle _handle = null;
internal EventLoopRunner _eventRunner;
+ private Task _waitForComEventTask = null;
private byte[] _tempBuf; // used to avoid multiple array allocations in ReadByte()
@@ -714,13 +716,8 @@ namespace System.IO.Ports
// prep. for starting event cycle.
_eventRunner = new EventLoopRunner(this);
-
- // We should consider migrating to a Task here rather than simple background Thread
- // This would let any exceptions be marshalled back to the owner of the SerialPort
- // Some discussion in GH issue #17666
- Thread eventLoopThread = new Thread(_eventRunner.SafelyWaitForCommEvent);
- eventLoopThread.IsBackground = true;
- eventLoopThread.Start();
+ _waitForComEventTask = Task.Factory.StartNew(s => ((EventLoopRunner)s).WaitForCommEvent(), _eventRunner, CancellationToken.None,
+ TaskCreationOptions.DenyChildAttach | TaskCreationOptions.LongRunning, TaskScheduler.Default);
}
catch
{
@@ -745,7 +742,6 @@ namespace System.IO.Ports
{
try
{
-
_eventRunner.endEventLoop = true;
Thread.MemoryBarrier();
@@ -793,12 +789,9 @@ namespace System.IO.Ports
DiscardOutBuffer();
}
- if (disposing && _eventRunner != null)
+ if (disposing && _eventRunner != null && _waitForComEventTask != null)
{
- // now we need to wait for the event loop to tell us it's done. Without this we could get into a race where the
- // event loop kept the port open even after Dispose ended.
- _eventRunner.eventLoopEndedSignal.WaitOne();
- _eventRunner.eventLoopEndedSignal.Close();
+ _waitForComEventTask.GetAwaiter().GetResult();
_eventRunner.waitCommEventWaitHandle.Close();
}
}
@@ -1647,7 +1640,6 @@ namespace System.IO.Ports
internal sealed class EventLoopRunner
{
private WeakReference streamWeakReference;
- internal ManualResetEvent eventLoopEndedSignal = new ManualResetEvent(false);
internal ManualResetEvent waitCommEventWaitHandle = new ManualResetEvent(false);
private SafeFileHandle handle = null;
private bool isAsync;
@@ -1686,36 +1678,9 @@ namespace System.IO.Ports
}
}
- /// <summary>
- /// Call WaitForCommEvent (which is a thread function for a background thread)
- /// within an exception handler, so that unhandled exceptions in WaitForCommEvent
- /// don't cause process termination
- /// Ultimately it would be good to migrate to a Task here rather than simple background Thread
- /// This would let any exceptions be marshalled back to the owner of the SerialPort
- /// Some discussion in GH issue #17666
- /// </summary>
- internal void SafelyWaitForCommEvent()
- {
- try
- {
- WaitForCommEvent();
- }
- catch (ObjectDisposedException)
- {
- // These can happen in some messy tear-down situations (e.g. unexpected USB unplug)
- // See GH issue #17661
- }
- catch (Exception ex)
- {
- // We don't know of any reason why this should happen, but we still
- // don't want process termination
- Debug.Fail("Unhandled exception thrown from WaitForCommEvent", ex.ToString());
- }
- }
-
// This is the blocking method that waits for an event to occur. It wraps the SDK's WaitCommEvent function.
[SuppressMessage("Microsoft.Interoperability", "CA1404:CallGetLastErrorImmediatelyAfterPInvoke", Justification = "this is debug-only code")]
- private unsafe void WaitForCommEvent()
+ internal unsafe void WaitForCommEvent()
{
int unused = 0;
bool doCleanup = false;
@@ -1808,7 +1773,6 @@ namespace System.IO.Ports
endEventLoop = true;
Overlapped.Free(intOverlapped);
}
- eventLoopEndedSignal.Set();
}
private unsafe void FreeNativeOverlappedCallback(uint errorCode, uint numBytes, NativeOverlapped* pOverlapped)
diff --git a/src/System.IO.Ports/tests/SerialPort/GetPortNames.cs b/src/System.IO.Ports/tests/SerialPort/GetPortNames.cs
index 18857a2f26..a770d3806b 100644
--- a/src/System.IO.Ports/tests/SerialPort/GetPortNames.cs
+++ b/src/System.IO.Ports/tests/SerialPort/GetPortNames.cs
@@ -14,6 +14,7 @@ namespace System.IO.Ports.Tests
#region Test Cases
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20588 - GetPortNames() has registry dependency.", TargetFrameworkMonikers.UapAot)]
private void OpenEveryPortName()
{
string[] portNames = SerialPort.GetPortNames();
diff --git a/src/System.IO.Ports/tests/Support/PortHelper.cs b/src/System.IO.Ports/tests/Support/PortHelper.cs
index f9ea0f16d2..2795dcd955 100644
--- a/src/System.IO.Ports/tests/Support/PortHelper.cs
+++ b/src/System.IO.Ports/tests/Support/PortHelper.cs
@@ -35,7 +35,7 @@ namespace Legacy.Support
returnSize = QueryDosDevice(null, mem, maxSize);
if (returnSize != 0)
{
- string allDevices = Marshal.PtrToStringAnsi(mem, returnSize);
+ string allDevices = Marshal.PtrToStringUni(mem, returnSize);
retval = allDevices.Split('\0');
break; // not really needed, but makes it more clear...
}
diff --git a/src/System.IO.UnmanagedMemoryStream/tests/Uma.ReadWriteStructArray.cs b/src/System.IO.UnmanagedMemoryStream/tests/Uma.ReadWriteStructArray.cs
index 9dcee38419..944c702d0f 100644
--- a/src/System.IO.UnmanagedMemoryStream/tests/Uma.ReadWriteStructArray.cs
+++ b/src/System.IO.UnmanagedMemoryStream/tests/Uma.ReadWriteStructArray.cs
@@ -10,6 +10,7 @@ namespace System.IO.Tests
public class Uma_ReadWriteStructArray : Uma_TestStructs
{
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20522", TargetFrameworkMonikers.UapAot)]
public static void UmaReadWriteStructArray_InvalidParameters()
{
const int capacity = 100;
diff --git a/src/System.Linq.Expressions/tests/SequenceTests/SequenceTests.cs b/src/System.Linq.Expressions/tests/SequenceTests/SequenceTests.cs
index f29331e907..86b4763c58 100644
--- a/src/System.Linq.Expressions/tests/SequenceTests/SequenceTests.cs
+++ b/src/System.Linq.Expressions/tests/SequenceTests/SequenceTests.cs
@@ -841,6 +841,7 @@ namespace System.Linq.Expressions.Tests
[Theory]
[ClassData(typeof(CompilationTypes))]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20717 - fails on x64", TargetFrameworkMonikers.UapAot)]
public static void UnaryPlus(bool useInterpreter)
{
ConstantExpression ce = Expression.Constant((UInt16)10);
diff --git a/src/System.Linq/tests/Resources/System.Linq.Tests.rd.xml b/src/System.Linq/tests/Resources/System.Linq.Tests.rd.xml
index 1f4c530fb9..d7898bb3ec 100644
--- a/src/System.Linq/tests/Resources/System.Linq.Tests.rd.xml
+++ b/src/System.Linq/tests/Resources/System.Linq.Tests.rd.xml
@@ -1,7 +1,7 @@
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Library>
<!-- Needed because of StringComparer instance in [Theory] data which causes xunit to reflect on its ToString() -->
- <Type Name="System.StringComparer" Dynamic="Required Public" />
+ <Type Name="System.OrdinalComparer" Dynamic="Required Public" />
<!-- ConsistencyTests.MatchSequencePattern() test explicitly probes these types -->
<Type Name="System.Linq.Enumerable" Dynamic="Required Public" />
diff --git a/src/System.Memory/ref/System.Memory.cs b/src/System.Memory/ref/System.Memory.cs
index 0fc16a271d..c13794f3bc 100644
--- a/src/System.Memory/ref/System.Memory.cs
+++ b/src/System.Memory/ref/System.Memory.cs
@@ -95,6 +95,8 @@ namespace System
public static ReadOnlySpan<char> AsSpan(this string text) { throw null; }
public static Span<T> AsSpan<T>(this T[] array) { throw null; }
public static Span<T> AsSpan<T>(this ArraySegment<T> arraySegment) { throw null; }
+ public static ReadOnlySpan<T> AsReadOnlySpan<T>(this T[] array) { throw null; }
+ public static ReadOnlySpan<T> AsReadOnlySpan<T>(this ArraySegment<T> arraySegment) { throw null; }
public static void CopyTo<T>(this T[] array, Span<T> destination) { throw null; }
diff --git a/src/System.Memory/src/System/SpanExtensions.cs b/src/System.Memory/src/System/SpanExtensions.cs
index 343146b434..31bc74c7da 100644
--- a/src/System.Memory/src/System/SpanExtensions.cs
+++ b/src/System.Memory/src/System/SpanExtensions.cs
@@ -280,6 +280,24 @@ namespace System
}
/// <summary>
+ /// Creates a new readonly span over the entire target array.
+ /// </summary>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static ReadOnlySpan<T> AsReadOnlySpan<T>(this T[] array)
+ {
+ return new ReadOnlySpan<T>(array);
+ }
+
+ /// <summary>
+ /// Creates a new readonly span over the target array segment.
+ /// </summary>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static ReadOnlySpan<T> AsReadOnlySpan<T>(this ArraySegment<T> arraySegment)
+ {
+ return new ReadOnlySpan<T>(arraySegment.Array, arraySegment.Offset, arraySegment.Count);
+ }
+
+ /// <summary>
/// Copies the contents of the array into the span. If the source
/// and destinations overlap, this method behaves as if the original values in
/// a temporary location before the destination is overwritten.
diff --git a/src/System.Memory/tests/ReadOnlySpan/AsReadOnlySpan.cs b/src/System.Memory/tests/ReadOnlySpan/AsReadOnlySpan.cs
new file mode 100644
index 0000000000..5281c96870
--- /dev/null
+++ b/src/System.Memory/tests/ReadOnlySpan/AsReadOnlySpan.cs
@@ -0,0 +1,83 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using Xunit;
+using System.Runtime.CompilerServices;
+
+namespace System.SpanTests
+{
+ public static partial class ReadOnlySpanTests
+ {
+ [Fact]
+ public static void ArrayAsReadOnlySpan()
+ {
+ int[] a = { 19, -17 };
+ ReadOnlySpan<int> spanInt = a.AsReadOnlySpan();
+ spanInt.Validate<int>(19, -17);
+
+ long[] b = { 1, -3, 7, -15, 31 };
+ ReadOnlySpan<long> spanLong = b.AsReadOnlySpan();
+ spanLong.Validate<long>(1, -3, 7, -15, 31);
+
+ object o1 = new object();
+ object o2 = new object();
+ object[] c = { o1, o2 };
+ ReadOnlySpan<object> spanObject = c.AsReadOnlySpan();
+ spanObject.Validate<object>(o1, o2);
+ }
+
+ [Fact]
+ public static void NullArrayAsReadOnlySpan()
+ {
+ int[] a = null;
+ ReadOnlySpan<int> span;
+ AssertThrows<ArgumentNullException, int>(span, _span => _span = a.AsReadOnlySpan());
+ }
+
+ [Fact]
+ public static void EmptyArrayAsReadOnlySpan()
+ {
+ int[] empty = Array.Empty<int>();
+ ReadOnlySpan<int> span = empty.AsReadOnlySpan();
+ span.Validate<int>();
+ }
+
+ [Fact]
+ public static void ArraySegmentAsSpan()
+ {
+ int[] a = { 19, -17 };
+ ArraySegment<int> segmentInt = new ArraySegment<int>(a, 1, 1);
+ ReadOnlySpan<int> spanInt = segmentInt.AsReadOnlySpan();
+ spanInt.Validate<int>(-17);
+
+ long[] b = { 1, -3, 7, -15, 31 };
+ ArraySegment<long> segmentLong = new ArraySegment<long>(b, 1, 3);
+ ReadOnlySpan<long> spanLong = segmentLong.AsReadOnlySpan();
+ spanLong.Validate<long>(-3, 7, -15);
+
+ object o1 = new object();
+ object o2 = new object();
+ object o3 = new object();
+ object o4 = new object();
+ object[] c = { o1, o2, o3, o4 };
+ ArraySegment<object> segmentObject = new ArraySegment<object>(c, 0, 2);
+ ReadOnlySpan<object> spanObject = segmentObject.AsReadOnlySpan();
+ spanObject.Validate<object>(o1, o2);
+ }
+
+ [Fact]
+ public static void ZeroLengthArraySegmentAsReadOnlySpan()
+ {
+ int[] empty = Array.Empty<int>();
+ ArraySegment<int> emptySegment = new ArraySegment<int>(empty);
+ ReadOnlySpan<int> span = emptySegment.AsReadOnlySpan();
+ span.Validate<int>();
+
+ int[] a = { 19, -17 };
+ ArraySegment<int> segmentInt = new ArraySegment<int>(a, 1, 0);
+ ReadOnlySpan<int> spanInt = segmentInt.AsReadOnlySpan();
+ spanInt.Validate<int>();
+ }
+ }
+} \ No newline at end of file
diff --git a/src/System.Memory/tests/System.Memory.Tests.csproj b/src/System.Memory/tests/System.Memory.Tests.csproj
index 0a5dadd89e..156b5a9edb 100644
--- a/src/System.Memory/tests/System.Memory.Tests.csproj
+++ b/src/System.Memory/tests/System.Memory.Tests.csproj
@@ -48,6 +48,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="ReadOnlySpan\AsBytes.cs" />
+ <Compile Include="ReadOnlySpan\AsReadOnlySpan.cs" />
<Compile Include="ReadOnlySpan\AsSpan.cs" />
<Compile Include="ReadOnlySpan\CopyTo.cs" />
<Compile Include="ReadOnlySpan\CtorArray.cs" />
@@ -77,4 +78,4 @@
<Compile Include="ReadOnlySpan\ToArray.cs" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
+</Project> \ No newline at end of file
diff --git a/src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpResponseStream.cs b/src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpResponseStream.cs
index 138a381116..20730e5189 100644
--- a/src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpResponseStream.cs
+++ b/src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpResponseStream.cs
@@ -207,6 +207,11 @@ namespace System.Net.Http
private async Task<int> ReadAsyncCore(byte[] buffer, int offset, int count, CancellationToken token)
{
+ if (count == 0)
+ {
+ return 0;
+ }
+
_state.PinReceiveBuffer(buffer);
var ctr = token.Register(s => ((WinHttpResponseStream)s).CancelPendingResponseStreamReadOperation(), this);
_state.AsyncReadInProgress = true;
diff --git a/src/System.Net.Http/src/System/Net/Http/Unix/CurlHandler.EasyRequest.cs b/src/System.Net.Http/src/System/Net/Http/Unix/CurlHandler.EasyRequest.cs
index 393ae0706b..6b3dc1813d 100644
--- a/src/System.Net.Http/src/System/Net/Http/Unix/CurlHandler.EasyRequest.cs
+++ b/src/System.Net.Http/src/System/Net/Http/Unix/CurlHandler.EasyRequest.cs
@@ -97,6 +97,10 @@ namespace System.Net.Http
SetCurlOption(CURLoption.CURLOPT_VERBOSE, 1L);
}
+ // Before actually configuring the handle based on the state of the request,
+ // do any necessary cleanup of the request object.
+ SanitizeRequestMessage();
+
// Configure the handle
SetUrl();
SetNetworkingOptions();
@@ -245,6 +249,15 @@ namespace System.Net.Http
_sendTransferState?.Dispose();
}
+ private void SanitizeRequestMessage()
+ {
+ // Make sure Transfer-Encoding and Content-Length make sense together.
+ if (_requestMessage.Content != null)
+ {
+ SetChunkedModeForSend(_requestMessage);
+ }
+ }
+
private void SetUrl()
{
Uri requestUri = _requestMessage.RequestUri;
@@ -692,8 +705,6 @@ namespace System.Net.Http
// Add content request headers
if (_requestMessage.Content != null)
{
- SetChunkedModeForSend(_requestMessage);
-
AddRequestHeaders(_requestMessage.Content.Headers, slist);
if (_requestMessage.Content.Headers.ContentType == null)
diff --git a/src/System.Net.Http/tests/FunctionalTests/PostScenarioTest.cs b/src/System.Net.Http/tests/FunctionalTests/PostScenarioTest.cs
index 77aafa7947..065ff8f331 100644
--- a/src/System.Net.Http/tests/FunctionalTests/PostScenarioTest.cs
+++ b/src/System.Net.Http/tests/FunctionalTests/PostScenarioTest.cs
@@ -72,6 +72,14 @@ namespace System.Net.Http.Functional.Tests
[OuterLoop] // TODO: Issue #11345
[Theory, MemberData(nameof(EchoServers))]
+ public async Task PostEmptyContentUsingConflictingSemantics_Success(Uri serverUri)
+ {
+ await PostHelper(serverUri, string.Empty, new StringContent(string.Empty),
+ useContentLengthUpload: true, useChunkedEncodingUpload: true);
+ }
+
+ [OuterLoop] // TODO: Issue #11345
+ [Theory, MemberData(nameof(EchoServers))]
public async Task PostUsingContentLengthSemantics_Success(Uri serverUri)
{
await PostHelper(serverUri, ExpectedContent, new StringContent(ExpectedContent),
diff --git a/src/System.Net.Http/tests/FunctionalTests/ResponseStreamTest.cs b/src/System.Net.Http/tests/FunctionalTests/ResponseStreamTest.cs
index ef506eb2ae..ee6add5d71 100644
--- a/src/System.Net.Http/tests/FunctionalTests/ResponseStreamTest.cs
+++ b/src/System.Net.Http/tests/FunctionalTests/ResponseStreamTest.cs
@@ -94,6 +94,18 @@ namespace System.Net.Http.Functional.Tests
[OuterLoop] // TODO: Issue #11345
[Fact]
+ public async Task GetStreamAsync_ReadZeroBytes_Success()
+ {
+ using (var client = new HttpClient())
+ using (Stream stream = await client.GetStreamAsync(Configuration.Http.RemoteEchoServer))
+ {
+ int bytesRead = await stream.ReadAsync(new byte[1], 0, 0);
+ Assert.Equal(0, bytesRead);
+ }
+ }
+
+ [OuterLoop] // TODO: Issue #11345
+ [Fact]
public async Task ReadAsStreamAsync_Cancel_TaskIsCanceled()
{
var cts = new CancellationTokenSource();
diff --git a/src/System.Net.HttpListener/src/System/Net/HttpListenerRequestUriBuilder.cs b/src/System.Net.HttpListener/src/System/Net/HttpListenerRequestUriBuilder.cs
index 25146bb865..8bdd83c4aa 100644
--- a/src/System.Net.HttpListener/src/System/Net/HttpListenerRequestUriBuilder.cs
+++ b/src/System.Net.HttpListener/src/System/Net/HttpListenerRequestUriBuilder.cs
@@ -36,8 +36,8 @@ namespace System.Net
//
// When parsing ANSI (Latin 1) encoded path '/pa%C4th/', %C4 will be added to rawOctets and when
// we reach 't', the content of rawOctets { 0xC4 } will be fed into the ANSI encoding. The resulting
- // string 'Ä' will be percent encoded into UTF-8 octets and appended to requestUriString. The final
- // path will be '/pa%C3%84th/', where '%C3%84' is the UTF-8 percent encoded character 'Ä'.
+ // string 'Ä' will be percent encoded into UTF-8 octets and appended to requestUriString. The final
+ // path will be '/pa%C3%84th/', where '%C3%84' is the UTF-8 percent encoded character 'Ä'.
private List<byte> _rawOctets;
private string _rawPath;
diff --git a/src/System.Net.HttpListener/src/System/Net/Managed/HttpRequestStream.Managed.cs b/src/System.Net.HttpListener/src/System/Net/Managed/HttpRequestStream.Managed.cs
index 8e68ec7f50..be0740e6f3 100644
--- a/src/System.Net.HttpListener/src/System/Net/Managed/HttpRequestStream.Managed.cs
+++ b/src/System.Net.HttpListener/src/System/Net/Managed/HttpRequestStream.Managed.cs
@@ -28,6 +28,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+using System.Diagnostics;
using System.IO;
using System.Net.Sockets;
using System.Runtime.ExceptionServices;
@@ -103,9 +104,24 @@ namespace System.Net
return nread;
}
+ if (_remainingBody > 0)
+ {
+ size = (int)Math.Min(_remainingBody, (long)size);
+ }
+
nread = _stream.Read(buffer, offset, size);
- if (nread > 0 && _remainingBody > 0)
+
+ if (_remainingBody > 0)
+ {
+ if (nread == 0)
+ {
+ throw new HttpListenerException((int)HttpStatusCode.BadRequest);
+ }
+
+ Debug.Assert(nread <= _remainingBody);
_remainingBody -= nread;
+ }
+
return nread;
}
@@ -138,7 +154,7 @@ namespace System.Net
// for HTTP pipelining
if (_remainingBody >= 0 && size > _remainingBody)
{
- size = (int)Math.Min(int.MaxValue, _remainingBody);
+ size = (int)Math.Min(_remainingBody, (long)size);
}
return _stream.BeginRead(buffer, offset, size, cback, state);
@@ -182,8 +198,14 @@ namespace System.Net
ExceptionDispatchInfo.Throw(e.InnerException);
}
- if (_remainingBody > 0 && nread > 0)
+ if (_remainingBody > 0)
{
+ if (nread == 0)
+ {
+ throw new HttpListenerException((int)HttpStatusCode.BadRequest);
+ }
+
+ Debug.Assert(nread <= _remainingBody);
_remainingBody -= nread;
}
diff --git a/src/System.Net.HttpListener/tests/AuthenticationTests.cs b/src/System.Net.HttpListener/tests/AuthenticationTests.cs
index a4871b00f2..95fd915c65 100644
--- a/src/System.Net.HttpListener/tests/AuthenticationTests.cs
+++ b/src/System.Net.HttpListener/tests/AuthenticationTests.cs
@@ -30,7 +30,8 @@ namespace System.Net.Tests
public void Dispose() => _factory.Dispose();
- [ConditionalTheory(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))] // Managed implementation connects successfully.
+ [ConditionalTheory(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))] // Managed implementation connects successfully.
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData("Basic")]
[InlineData("NTLM")]
[InlineData("Negotiate")]
@@ -46,7 +47,8 @@ namespace System.Net.Tests
}
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(AuthenticationSchemes.Basic)]
[InlineData(AuthenticationSchemes.Basic | AuthenticationSchemes.None)]
[InlineData(AuthenticationSchemes.Basic | AuthenticationSchemes.Anonymous)]
@@ -57,7 +59,8 @@ namespace System.Net.Tests
}
[ActiveIssue(19967, TargetFrameworkMonikers.NetFramework)]
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[MemberData(nameof(BasicAuthenticationHeader_TestData))]
public async Task BasicAuthentication_InvalidRequest_SendsStatusCodeClient(string header, HttpStatusCode statusCode)
{
@@ -89,7 +92,8 @@ namespace System.Net.Tests
}
[ActiveIssue(19967, TargetFrameworkMonikers.NetFramework)]
- [ConditionalTheory(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))] // [ActiveIssue(20098, TestPlatforms.Unix)]
+ [ConditionalTheory(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))] // [ActiveIssue(20098, TestPlatforms.Unix)]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData("ExampleRealm")]
[InlineData(" ExampleRealm ")]
[InlineData("")]
@@ -107,14 +111,16 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task TestAnonymousAuthentication()
{
_listener.AuthenticationSchemes = AuthenticationSchemes.Anonymous;
await ValidateNullUser();
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task TestBasicAuthenticationWithDelegate()
{
_listener.AuthenticationSchemes = AuthenticationSchemes.None;
@@ -124,7 +130,8 @@ namespace System.Net.Tests
await ValidateValidUser();
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData("somename:somepassword", "somename", "somepassword")]
[InlineData("somename:", "somename", "")]
[InlineData(":somepassword", "", "somepassword")]
@@ -136,7 +143,8 @@ namespace System.Net.Tests
await ValidateValidUser(authString, expectedName, expectedPassword);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task TestAnonymousAuthenticationWithDelegate()
{
_listener.AuthenticationSchemes = AuthenticationSchemes.None;
@@ -146,8 +154,9 @@ namespace System.Net.Tests
await ValidateNullUser();
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))] // [PlatformSpecific(TestPlatforms.Windows, "Managed impl doesn't support NTLM")]
- [ActiveIssue(20096)]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))] // [PlatformSpecific(TestPlatforms.Windows, "Managed impl doesn't support NTLM")]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
+ [ActiveIssue(20604)]
public async Task NtlmAuthentication_Conversation_ReturnsExpectedType2Message()
{
_listener.AuthenticationSchemes = AuthenticationSchemes.Ntlm;
@@ -169,8 +178,9 @@ namespace System.Net.Tests
yield return new object[] { "abcd", HttpStatusCode.BadRequest };
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))] // [PlatformSpecific(TestPlatforms.Windows, "Managed impl doesn't support NTLM")]
- [ActiveIssue(20096)]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))] // [PlatformSpecific(TestPlatforms.Windows, "Managed impl doesn't support NTLM")]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
+ [ActiveIssue(20604)]
[MemberData(nameof(InvalidNtlmNegotiateAuthentication_TestData))]
public async Task NtlmAuthentication_InvalidRequestHeaders_ReturnsExpectedStatusCode(string header, HttpStatusCode statusCode)
{
@@ -192,8 +202,9 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))] // [PlatformSpecific(TestPlatforms.Windows, "Managed impl doesn't support Negotiate")]
- [ActiveIssue(20096)]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))] // [PlatformSpecific(TestPlatforms.Windows, "Managed impl doesn't support Negotiate")]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
+ [ActiveIssue(20604)]
public async Task NegotiateAuthentication_Conversation_ReturnsExpectedType2Message()
{
_listener.AuthenticationSchemes = AuthenticationSchemes.Negotiate;
@@ -207,8 +218,9 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))] // [PlatformSpecific(TestPlatforms.Windows, "Managed impl doesn't support Negotiate")]
- [ActiveIssue(20096)]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))] // [PlatformSpecific(TestPlatforms.Windows, "Managed impl doesn't support Negotiate")]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
+ [ActiveIssue(20604)]
[MemberData(nameof(InvalidNtlmNegotiateAuthentication_TestData))]
public async Task NegotiateAuthentication_InvalidRequestHeaders_ReturnsExpectedStatusCode(string header, HttpStatusCode statusCode)
{
@@ -223,7 +235,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task AuthenticationSchemeSelectorDelegate_ReturnsInvalidAuthenticationScheme_PerformsNoAuthentication()
{
_listener.AuthenticationSchemes = AuthenticationSchemes.Basic;
@@ -241,7 +254,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task AuthenticationSchemeSelectorDelegate_ThrowsException_SendsInternalServerErrorToClient()
{
_listener.AuthenticationSchemes = AuthenticationSchemes.Basic;
@@ -253,7 +267,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void AuthenticationSchemeSelectorDelegate_ThrowsOutOfMemoryException_RethrowsException()
{
_listener.AuthenticationSchemes = AuthenticationSchemes.Basic;
@@ -266,7 +281,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void AuthenticationSchemeSelectorDelegate_SetDisposed_ThrowsObjectDisposedException()
{
var listener = new HttpListener();
@@ -275,7 +291,8 @@ namespace System.Net.Tests
Assert.Throws<ObjectDisposedException>(() => listener.AuthenticationSchemeSelectorDelegate = null);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void AuthenticationSchemes_SetDisposed_ThrowsObjectDisposedException()
{
var listener = new HttpListener();
@@ -284,7 +301,8 @@ namespace System.Net.Tests
Assert.Throws<ObjectDisposedException>(() => listener.AuthenticationSchemes = AuthenticationSchemes.Basic);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void ExtendedProtectionPolicy_SetNull_ThrowsArgumentNullException()
{
using (var listener = new HttpListener())
@@ -293,7 +311,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void ExtendedProtectionPolicy_SetDisposed_ThrowsObjectDisposedException()
{
var listener = new HttpListener();
@@ -302,7 +321,8 @@ namespace System.Net.Tests
Assert.Throws<ObjectDisposedException>(() => listener.ExtendedProtectionPolicy = null);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void ExtendedProtectionPolicy_SetCustomChannelBinding_ThrowsObjectDisposedException()
{
using (var listener = new HttpListener())
@@ -312,7 +332,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void UnsafeConnectionNtlmAuthentication_SetGet_ReturnsExpected()
{
using (var listener = new HttpListener())
@@ -330,7 +351,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void UnsafeConnectionNtlmAuthentication_SetDisposed_ThrowsObjectDisposedException()
{
var listener = new HttpListener();
@@ -339,7 +361,8 @@ namespace System.Net.Tests
Assert.Throws<ObjectDisposedException>(() => listener.UnsafeConnectionNtlmAuthentication = false);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void ExtendedProtectionSelectorDelegate_SetNull_ThrowsArgumentNullException()
{
using (var listener = new HttpListener())
@@ -348,7 +371,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void ExtendedProtectionSelectorDelegate_SetDisposed_ThrowsObjectDisposedException()
{
var listener = new HttpListener();
@@ -357,7 +381,8 @@ namespace System.Net.Tests
Assert.Throws<ObjectDisposedException>(() => listener.ExtendedProtectionSelectorDelegate = null);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task Realm_SetWithoutBasicAuthenticationScheme_SendsNoChallengeToClient()
{
_listener.Realm = "ExampleRealm";
@@ -373,7 +398,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void Realm_SetDisposed_ThrowsObjectDisposedException()
{
var listener = new HttpListener();
diff --git a/src/System.Net.HttpListener/tests/GetContextHelper.cs b/src/System.Net.HttpListener/tests/GetContextHelper.cs
index 9f9ae66e75..da8540b11b 100644
--- a/src/System.Net.HttpListener/tests/GetContextHelper.cs
+++ b/src/System.Net.HttpListener/tests/GetContextHelper.cs
@@ -58,26 +58,16 @@ namespace System.Net.Tests
public static class Helpers
{
- public static bool IsWindowsImplementationAndNotUap { get; } =
- (TypeExists("Interop+HttpApi") || TypeExists("System.Net.UnsafeNclNativeMethods")) && // types only in Windows netcoreapp/netfx builds, respectively
- PlatformDetection.IsNotOneCoreUAP; // never run for UAP
- public static bool IsManagedImplementationAndNotUap =>
- TypeExists("System.Net.WebSockets.ManagedWebSocket") && // type only in managed build
- PlatformDetection.IsNotOneCoreUAP; // never run for UAP
+ public static bool IsWindowsImplementation { get; } =
+ (TypeExists("Interop+HttpApi") || TypeExists("System.Net.UnsafeNclNativeMethods")); // types only in Windows netcoreapp/netfx builds, respectively
+
+ public static bool IsManagedImplementation => TypeExists("System.Net.WebSockets.ManagedWebSocket"); // type only in managed build
private static bool TypeExists(string name) => typeof(HttpListener).Assembly.GetType(name, throwOnError: false, ignoreCase: false) != null;
public static void WaitForSocketShutdown(Socket socket)
{
- if (PlatformDetection.IsWindows || PlatformDetection.IsOSX)
- {
- socket.Shutdown(SocketShutdown.Both);
- while (SocketConnected(socket));
- }
- else
- {
- socket.Close();
- }
+ socket.Close();
}
public static bool SocketConnected(Socket socket)
diff --git a/src/System.Net.HttpListener/tests/HttpListenerContextTests.cs b/src/System.Net.HttpListener/tests/HttpListenerContextTests.cs
index 1e8e2ea509..915ffedd0b 100644
--- a/src/System.Net.HttpListener/tests/HttpListenerContextTests.cs
+++ b/src/System.Net.HttpListener/tests/HttpListenerContextTests.cs
@@ -31,8 +31,7 @@ namespace System.Net.Tests
Socket.Dispose();
}
- public static bool IsNotWindows7OrUapCore { get; } = !PlatformDetection.IsWindows7 && PlatformDetection.IsNotOneCoreUAP;
- public static bool IsNotWindows7OrUapCoreAndIsWindowsImplementation { get; } = IsNotWindows7OrUapCore && Helpers.IsWindowsImplementationAndNotUap;
+ public static bool IsNotWindows7 { get; } = !PlatformDetection.IsWindows7;
public static IEnumerable<object[]> SubProtocol_TestData()
{
@@ -46,7 +45,8 @@ namespace System.Net.Tests
yield return new object[] { new string[] { "MyProtocol1", "MyProtocol2" }, "MyProtocol2" };
}
- [ConditionalTheory(nameof(IsNotWindows7OrUapCoreAndIsWindowsImplementation))] // [ActiveIssue(20246, TestPlatforms.AnyUnix)] // CI hanging frequently
+ [ConditionalTheory(nameof(IsNotWindows7))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[MemberData(nameof(SubProtocol_TestData))]
public async Task AcceptWebSocketAsync_ValidSubProtocol_Success(string[] clientProtocols, string serverProtocol)
{
@@ -55,7 +55,8 @@ namespace System.Net.Tests
Assert.Equal(serverProtocol, socketContext.WebSocket.SubProtocol);
}
- [ConditionalFact(nameof(IsNotWindows7OrUapCoreAndIsWindowsImplementation))] // [ActiveIssue(20246, TestPlatforms.AnyUnix)] // CI hanging frequently
+ [ConditionalTheory(nameof(IsNotWindows7))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task AcceptWebSocketAsync_ValidWebSocket_SetsUpHeadersInResponse()
{
HttpListenerContext context = await GetWebSocketContext(new string[] { "SubProtocol", "SubProtocol2" });
@@ -79,7 +80,8 @@ namespace System.Net.Tests
Assert.Equal("websocket", socketContext.Headers["Upgrade"], ignoreCase: true);
}
- [ConditionalFact(nameof(IsNotWindows7OrUapCore))]
+ [ConditionalFact(nameof(IsNotWindows7))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task AcceptWebSocketAsync_ValidWebSocket_SetsUpContextProperties()
{
Socket.Options.SetRequestHeader("origin", "Browser");
@@ -97,7 +99,8 @@ namespace System.Net.Tests
Assert.False(socketContext.IsSecureConnection);
}
- [ConditionalFact(nameof(IsNotWindows7OrUapCore))]
+ [ConditionalFact(nameof(IsNotWindows7))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task AcceptWebSocketAsync_AuthorizationInHeaders_ThrowsNotImplementedException()
{
Socket.Options.SetRequestHeader("Authorization", "Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes("user:password")));
@@ -116,21 +119,24 @@ namespace System.Net.Tests
Assert.Equal("Basic", webSocketContext.User.Identity.AuthenticationType);
}
- [ConditionalFact(nameof(IsNotWindows7OrUapCoreAndIsWindowsImplementation))] // [ActiveIssue(20246, TestPlatforms.AnyUnix)] // CI hanging frequently
+ [ConditionalFact(nameof(IsNotWindows7))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task AcceptWebSocketAsync_UnsupportedProtocol_ThrowsWebSocketException()
{
HttpListenerContext context = await GetWebSocketContext(new string[] { "MyProtocol" });
await Assert.ThrowsAsync<WebSocketException>(() => context.AcceptWebSocketAsync("MyOtherProtocol"));
}
- [ConditionalFact(nameof(IsNotWindows7OrUapCore))]
+ [ConditionalFact(nameof(IsNotWindows7))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task AcceptWebSocketAsync_NoClientSubProtocol_ThrowsWebSocketException()
{
HttpListenerContext context = await GetWebSocketContext();
await Assert.ThrowsAsync<WebSocketException>(() => context.AcceptWebSocketAsync("SubProtocol"));
}
- [ConditionalTheory(nameof(IsNotWindows7OrUapCore))]
+ [ConditionalTheory(nameof(IsNotWindows7))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData("Connection: ")]
[InlineData("Connection: Connection\r\nUpgrade: ")]
[InlineData("Connection: Test1\r\nUpgrade: Test2")]
@@ -150,8 +156,8 @@ namespace System.Net.Tests
});
}
- [ActiveIssue(20246)] // CI hanging frequently
- [ConditionalTheory(nameof(IsNotWindows7OrUapCore))]
+ [ConditionalTheory(nameof(IsNotWindows7))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData("")]
[InlineData(" ")]
[InlineData("random(text")]
@@ -179,8 +185,8 @@ namespace System.Net.Tests
await AssertExtensions.ThrowsAsync<ArgumentException>("subProtocol", () => context.AcceptWebSocketAsync(subProtocol));
}
- [ActiveIssue(20246)] // CI hanging frequently
- [ConditionalTheory(nameof(IsNotWindows7OrUapCore))]
+ [ConditionalTheory(nameof(IsNotWindows7))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData("!")]
[InlineData("#")]
[InlineData("YouDontKnowMe")]
@@ -190,8 +196,8 @@ namespace System.Net.Tests
await Assert.ThrowsAsync<WebSocketException>(() => context.AcceptWebSocketAsync(subProtocol));
}
- [ActiveIssue(20246)] // CI hanging frequently
- [ConditionalFact(nameof(IsNotWindows7OrUapCore))]
+ [ConditionalFact(nameof(IsNotWindows7))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task AcceptWebSocketAsync_InvalidKeepAlive_ThrowsWebSocketException()
{
HttpListenerContext context = await GetWebSocketContext();
@@ -200,8 +206,8 @@ namespace System.Net.Tests
await Assert.ThrowsAsync<ArgumentOutOfRangeException>("keepAliveInterval", () => context.AcceptWebSocketAsync(null, keepAlive));
}
- [ActiveIssue(20246)] // CI hanging frequently
- [ConditionalTheory(nameof(IsNotWindows7OrUapCore))]
+ [ConditionalTheory(nameof(IsNotWindows7))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(-1)]
[InlineData(0)]
[InlineData(255)]
@@ -212,7 +218,8 @@ namespace System.Net.Tests
await Assert.ThrowsAsync<ArgumentOutOfRangeException>("receiveBufferSize", () => context.AcceptWebSocketAsync(null, receiveBufferSize, TimeSpan.MaxValue));
}
- [ConditionalFact(nameof(IsNotWindows7OrUapCore))]
+ [ConditionalFact(nameof(IsNotWindows7))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task AcceptWebSocketAsync_NullArrayInArraySegment_ThrowsArgumentNullException()
{
HttpListenerContext context = await GetWebSocketContext();
@@ -221,8 +228,8 @@ namespace System.Net.Tests
await AssertExtensions.ThrowsAsync<ArgumentNullException>("internalBuffer.Array", () => context.AcceptWebSocketAsync(null, 1024, TimeSpan.MaxValue, internalBuffer));
}
- [ActiveIssue(20246)] // CI hanging frequently
- [ConditionalTheory(nameof(IsNotWindows7OrUapCore))]
+ [ConditionalTheory(nameof(IsNotWindows7))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(-1)]
[InlineData(11)]
public async Task AcceptWebSocketAsync_InvalidOffsetInArraySegment_ThrowsArgumentNullException(int offset)
@@ -233,8 +240,8 @@ namespace System.Net.Tests
await AssertExtensions.ThrowsAsync<ArgumentOutOfRangeException>("internalBuffer.Offset", () => context.AcceptWebSocketAsync(null, 1024, TimeSpan.MaxValue, internalBuffer));
}
- [ActiveIssue(20246)] // CI hanging frequently
- [ConditionalTheory(nameof(IsNotWindows7OrUapCore))]
+ [ConditionalTheory(nameof(IsNotWindows7))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(0, -1)]
[InlineData(0, 11)]
[InlineData(10, 1)]
diff --git a/src/System.Net.HttpListener/tests/HttpListenerFactory.cs b/src/System.Net.HttpListener/tests/HttpListenerFactory.cs
index e64969575a..762804e50f 100644
--- a/src/System.Net.HttpListener/tests/HttpListenerFactory.cs
+++ b/src/System.Net.HttpListener/tests/HttpListenerFactory.cs
@@ -5,14 +5,18 @@
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
+using System.Runtime.InteropServices;
using System.Text;
-using Xunit;
namespace System.Net.Tests
{
// Utilities for generating URL prefixes for HttpListener
public class HttpListenerFactory : IDisposable
{
+ const int MinPort = 1025;
+ private static readonly object s_createListenerLock = new object();
+ private static int s_nextPort = MinPort;
+
private readonly HttpListener _processPrefixListener;
private readonly Exception _processPrefixException;
private readonly string _processPrefix;
@@ -29,44 +33,54 @@ namespace System.Net.Tests
_path = path ?? Guid.NewGuid().ToString("N");
string pathComponent = string.IsNullOrEmpty(_path) ? _path : $"{_path}/";
- for (int port = 1025; port <= IPEndPoint.MaxPort; port++)
+ lock (s_createListenerLock)
{
- string prefix = $"http://{hostname}:{port}/{pathComponent}";
-
- var listener = new HttpListener();
- try
- {
- listener.Prefixes.Add(prefix);
- listener.Start();
-
- _processPrefixListener = listener;
- _processPrefix = prefix;
- _port = port;
- break;
- }
- catch (Exception e)
+ foreach (int port in Enumerable.Range(s_nextPort, IPEndPoint.MaxPort - s_nextPort + 1).Concat(Enumerable.Range(MinPort, s_nextPort - MinPort)))
{
- // can't use this prefix
- listener.Close();
-
- // Remember the exception for later
- _processPrefixException = e;
+ string prefix = $"http://{hostname}:{port}/{pathComponent}";
- if (e is HttpListenerException listenerException)
+ var listener = new HttpListener();
+ try
{
- // If we can't access the host (e.g. if it is '+' or '*' and the current user is the administrator)
- // then throw.
- const int ERROR_ACCESS_DENIED = 5;
- if (listenerException.ErrorCode == ERROR_ACCESS_DENIED && (hostname == "*" || hostname == "+"))
+ listener.Prefixes.Add(prefix);
+ listener.Start();
+
+ _processPrefixListener = listener;
+ _processPrefix = prefix;
+ _port = port;
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && Helpers.IsManagedImplementation)
{
- throw new InvalidOperationException($"Access denied for host {hostname}");
+ // Try to avoid reusing the same port from test to test if we're using
+ // the WinHttp ClientWebSocket against the managed HttpListener.
+ // https://github.com/dotnet/corefx/issues/20439
+ s_nextPort = port + 1;
}
+ break;
}
- else if (!(e is SocketException))
+ catch (Exception e)
{
- // If this is not an HttpListenerException or SocketException, something very wrong has happened, and there's no point
- // in trying again.
- break;
+ // can't use this prefix
+ listener.Close();
+
+ // Remember the exception for later
+ _processPrefixException = e;
+
+ if (e is HttpListenerException listenerException)
+ {
+ // If we can't access the host (e.g. if it is '+' or '*' and the current user is the administrator)
+ // then throw.
+ const int ERROR_ACCESS_DENIED = 5;
+ if (listenerException.ErrorCode == ERROR_ACCESS_DENIED && (hostname == "*" || hostname == "+"))
+ {
+ throw new InvalidOperationException($"Access denied for host {hostname}");
+ }
+ }
+ else if (!(e is SocketException))
+ {
+ // If this is not an HttpListenerException or SocketException, something very wrong has happened, and there's no point
+ // in trying again.
+ break;
+ }
}
}
}
diff --git a/src/System.Net.HttpListener/tests/HttpListenerPrefixCollectionTests.cs b/src/System.Net.HttpListener/tests/HttpListenerPrefixCollectionTests.cs
index c6b5389610..6e8ad8ec7d 100644
--- a/src/System.Net.HttpListener/tests/HttpListenerPrefixCollectionTests.cs
+++ b/src/System.Net.HttpListener/tests/HttpListenerPrefixCollectionTests.cs
@@ -107,6 +107,7 @@ namespace System.Net.Tests
}
[Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.UapAot)]
public void CopyTo_NonZeroLowerBoundArray_ThrowsIndexOutOfRangeException()
{
var listener = new HttpListener();
@@ -215,7 +216,8 @@ namespace System.Net.Tests
}
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[MemberData(nameof(Hosts_TestData))]
public void Add_PrefixAlreadyRegisteredAndNotStarted_ThrowsHttpListenerException(string hostname)
{
@@ -230,7 +232,8 @@ namespace System.Net.Tests
}
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[MemberData(nameof(Hosts_TestData))]
public void Add_PrefixAlreadyRegisteredWithDifferentPathAndNotStarted_Works(string hostname)
{
@@ -247,7 +250,8 @@ namespace System.Net.Tests
}
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[MemberData(nameof(Hosts_TestData))]
public void Add_PrefixAlreadyRegisteredAndStarted_ThrowsHttpListenerException(string hostname)
{
@@ -273,7 +277,8 @@ namespace System.Net.Tests
}
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[MemberData(nameof(Hosts_TestData))]
public void Add_SamePortDifferentPathDifferentListenerNotStarted_Works(string host)
{
@@ -292,7 +297,8 @@ namespace System.Net.Tests
}
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[MemberData(nameof(Hosts_TestData))]
public void Add_SamePortDifferentPathDifferentListenerStarted_Works(string host)
{
@@ -320,7 +326,8 @@ namespace System.Net.Tests
}
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[MemberData(nameof(Hosts_TestData))]
public void Add_SamePortDifferentPathMultipleStarted_Success(string host)
{
diff --git a/src/System.Net.HttpListener/tests/HttpListenerRequestTests.cs b/src/System.Net.HttpListener/tests/HttpListenerRequestTests.cs
index 0a5e11ac16..e06b335351 100644
--- a/src/System.Net.HttpListener/tests/HttpListenerRequestTests.cs
+++ b/src/System.Net.HttpListener/tests/HttpListenerRequestTests.cs
@@ -12,9 +12,25 @@ using Xunit;
namespace System.Net.Tests
{
- public class HttpListenerRequestTests
+ public class HttpListenerRequestTests : IDisposable
{
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ private HttpListenerFactory Factory { get; }
+ private Socket Client { get; }
+
+ public HttpListenerRequestTests()
+ {
+ Factory = new HttpListenerFactory();
+ Client = Factory.GetConnectedSocket();
+ }
+
+ public void Dispose()
+ {
+ Factory?.Dispose();
+ Client?.Dispose();
+ }
+
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData("Accept: Test", new string[] { "Test" })]
[InlineData("Accept: Test, Test2,Test3 , Test4", new string[] { "Test", "Test2", "Test3 ", " Test4" })]
[InlineData("Accept: Test", new string[] { "Test" })]
@@ -22,15 +38,13 @@ namespace System.Net.Tests
[InlineData("Unknown-Header: ", null)]
public async Task AcceptTypes_GetProperty_ReturnsExpected(string acceptString, string[] expected)
{
- await GetRequest("POST", "", new string[] { acceptString }, (_, request) =>
+ HttpListenerRequest request = await GetRequest("POST", "", new string[] { acceptString });
+ Assert.Equal(request.AcceptTypes, request.AcceptTypes);
+ if (expected != null)
{
- Assert.Equal(request.AcceptTypes, request.AcceptTypes);
- if (expected != null)
- {
- Assert.NotSame(request.AcceptTypes, request.AcceptTypes);
- }
- Assert.Equal(expected, request.AcceptTypes);
- });
+ Assert.NotSame(request.AcceptTypes, request.AcceptTypes);
+ }
+ Assert.Equal(expected, request.AcceptTypes);
}
public static IEnumerable<object[]> ContentEncoding_TestData()
@@ -74,26 +88,25 @@ namespace System.Net.Tests
yield return new object[] { "Unknown-Header: Test", Encoding.Default };
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[MemberData(nameof(ContentEncoding_TestData))]
public async Task ContentEncoding_GetProperty_ReturnsExpected(string header, Encoding expected)
{
- await GetRequest("POST", "", new string[] { header }, (_, request) =>
- {
- Assert.Equal(expected, request.ContentEncoding);
- });
+ HttpListenerRequest request = await GetRequest("POST", "", new string[] { header });
+ Assert.Equal(expected, request.ContentEncoding);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task ContentEncoding_NoBody_ReturnsDefault()
{
- await GetRequest("POST", "", new string[] { "Content-Length: 0", "Content-Type:application/json;charset=unicode" }, (_, request) =>
- {
- Assert.Equal(Encoding.Default, request.ContentEncoding);
- }, content: null);
+ HttpListenerRequest request = await GetRequest("POST", "", new string[] { "Content-Length: 0", "Content-Type:application/json;charset=unicode" }, content: null);
+ Assert.Equal(Encoding.Default, request.ContentEncoding);
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData("POST", "Content-Length: 9223372036854775807", 9223372036854775807, true)] // long.MaxValue
[InlineData("POST", "Content-Length: 9223372036854775808", 0, false)] // long.MaxValue + 1
[InlineData("POST", "Content-Length: 18446744073709551615 ", 0, false)] // ulong.MaxValue
@@ -108,14 +121,13 @@ namespace System.Net.Tests
[InlineData("PUT", "Transfer-Encoding: chunked\nContent-Length: 10", -1, true)]
public async Task ContentLength_GetProperty_ReturnsExpected(string method, string contentLengthString, long expected, bool hasEntityBody)
{
- await GetRequest(method, "", contentLengthString.Split('\n'), (_, request) =>
- {
- Assert.Equal(expected, request.ContentLength64);
- Assert.Equal(hasEntityBody, request.HasEntityBody);
- }, content: "\r\n");
+ HttpListenerRequest request = await GetRequest(method, "", contentLengthString.Split('\n'), content: "\r\n");
+ Assert.Equal(expected, request.ContentLength64);
+ Assert.Equal(hasEntityBody, request.HasEntityBody);
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(100)]
[InlineData("-100")]
[InlineData("")]
@@ -124,49 +136,47 @@ namespace System.Net.Tests
[ActiveIssue(20294, TargetFrameworkMonikers.Netcoreapp)]
public async Task ContentLength_ManuallySetInHeaders_ReturnsExpected(string newValue)
{
- await GetRequest("POST", null, new string[] { "Content-Length: 1" }, (_, request) =>
- {
- Assert.Equal("1", request.Headers["Content-Length"]);
+ HttpListenerRequest request = await GetRequest("POST", null, new string[] { "Content-Length: 1" }, content: "\r\n");
+ Assert.Equal("1", request.Headers["Content-Length"]);
- request.Headers.Set("Content-Length", newValue);
- Assert.Equal(newValue, request.Headers["Content-Length"]);
- Assert.Equal(1, request.ContentLength64);
+ request.Headers.Set("Content-Length", newValue);
+ Assert.Equal(newValue, request.Headers["Content-Length"]);
+ Assert.Equal(1, request.ContentLength64);
- Assert.True(request.HasEntityBody);
- }, content: "\r\n");
+ Assert.True(request.HasEntityBody);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[ActiveIssue(20294, TargetFrameworkMonikers.Netcoreapp)]
public async Task ContentLength_ManuallyRemovedFromHeaders_DoesNotAffect()
{
- await GetRequest("POST", null, new string[] { "Content-Length: 1" }, (_, request) =>
- {
- Assert.Equal("1", request.Headers["Content-Length"]);
+ HttpListenerRequest request = await GetRequest("POST", null, new string[] { "Content-Length: 1" }, content: "\r\n");
+ Assert.Equal("1", request.Headers["Content-Length"]);
- request.Headers.Remove("Content-Length");
- Assert.Equal(1, request.ContentLength64);
+ request.Headers.Remove("Content-Length");
+ Assert.Equal(1, request.ContentLength64);
- Assert.True(request.HasEntityBody);
- }, content: "\r\n");
+ Assert.True(request.HasEntityBody);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task ContentLength_SetInHeadersAfterAccessingProperty_DoesNothing()
{
- await GetRequest("POST", null, new string[] { "Content-Length: 1" }, (_, request) =>
- {
- Assert.Equal("1", request.Headers["Content-Length"]);
- Assert.Equal(1, request.ContentLength64);
+ HttpListenerRequest request = await GetRequest("POST", null, new string[] { "Content-Length: 1" }, content: "\r\n");
+
+ Assert.Equal("1", request.Headers["Content-Length"]);
+ Assert.Equal(1, request.ContentLength64);
- request.Headers.Set("Content-Length", "1000");
- Assert.Equal(1, request.ContentLength64);
+ request.Headers.Set("Content-Length", "1000");
+ Assert.Equal(1, request.ContentLength64);
- Assert.True(request.HasEntityBody);
- }, content: "\r\n");
+ Assert.True(request.HasEntityBody);
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData("Referer: http://microsoft.com", "http://microsoft.com/")]
[InlineData("referer: /relativePath", "/relativePath")]
[InlineData("Referer: NoSuchSite", "NoSuchSite")]
@@ -175,79 +185,66 @@ namespace System.Net.Tests
[InlineData("Unknown-Header: ", null)]
public async Task Referer_GetProperty_ReturnsExpected(string refererString, string expected)
{
- await GetRequest("POST", "", new string[] { refererString }, (_, request) =>
- {
- Assert.Equal(expected, request.UrlReferrer?.ToString());
- });
+ HttpListenerRequest request = await GetRequest("POST", "", new string[] { refererString });
+ Assert.Equal(expected, request.UrlReferrer?.ToString());
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData("User-Agent: Test", "Test")]
[InlineData("user-agent: Test", "Test")]
[InlineData("User-Agent: ", "")]
[InlineData("Unknown-Header: Test", null)]
public async Task UserAgent_GetProperty_ReturnsExpected(string userAgentString, string expected)
{
- await GetRequest("POST", "", new string[] { userAgentString }, (_, request) =>
- {
- Assert.Equal(expected, request.UserAgent);
- });
+ HttpListenerRequest request = await GetRequest("POST", "", new string[] { userAgentString });
+ Assert.Equal(expected, request.UserAgent);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task UserHostName_GetProperty_ReturnsExpected()
{
- await GetRequest("POST", null, null, (_, request) =>
- {
- Assert.Equal("localhost", request.UserHostName);
- });
+ HttpListenerRequest request = await GetRequest("POST", null, null);
+ Assert.Equal("localhost", request.UserHostName);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task EndPointProperties_GetProperty_ReturnsExpected()
{
- using (HttpListenerFactory factory = new HttpListenerFactory())
- using (Socket client = factory.GetConnectedSocket())
- {
- client.Send(factory.GetContent("POST", "Text", headerOnly: false));
+ HttpListenerRequest request = await GetRequest("POST", "", null);
+ Assert.Equal(Client.RemoteEndPoint.ToString(), request.UserHostAddress);
- HttpListener listener = factory.GetListener();
- HttpListenerContext context = await listener.GetContextAsync();
+ Assert.Equal(Client.RemoteEndPoint, request.LocalEndPoint);
+ Assert.Same(request.LocalEndPoint, request.LocalEndPoint);
- HttpListenerRequest request = context.Request;
- Assert.Equal(client.RemoteEndPoint.ToString(), request.UserHostAddress);
+ Assert.Equal(Client.LocalEndPoint, request.RemoteEndPoint);
+ Assert.Same(request.RemoteEndPoint, request.RemoteEndPoint);
- Assert.Equal(client.RemoteEndPoint, request.LocalEndPoint);
- Assert.Same(request.LocalEndPoint, request.LocalEndPoint);
+ Assert.Equal(Factory.ListeningUrl, request.Url.ToString());
+ Assert.Same(request.Url, request.Url);
- Assert.Equal(client.LocalEndPoint, request.RemoteEndPoint);
- Assert.Same(request.RemoteEndPoint, request.RemoteEndPoint);
-
- Assert.Equal(factory.ListeningUrl, request.Url.ToString());
- Assert.Same(request.Url, request.Url);
-
- Assert.Equal($"/{factory.Path}/", request.RawUrl);
- }
+ Assert.Equal($"/{Factory.Path}/", request.RawUrl);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task ServiceName_GetNoSpn_ReturnsExpected()
{
- await GetRequest("POST", null, null, (_, request) =>
- {
- Assert.Null(request.ServiceName);
- });
+ HttpListenerRequest request = await GetRequest("POST", null, null);
+ Assert.Null(request.ServiceName);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task RequestTraceIdentifier_GetWindows_ReturnsExpected()
{
- await GetRequest("POST", null, null, (_, request) =>
- {
- Assert.NotEqual(Guid.Empty, request.RequestTraceIdentifier);
- });
+ HttpListenerRequest request = await GetRequest("POST", null, null);
+ Assert.NotEqual(Guid.Empty, request.RequestTraceIdentifier);
}
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[Theory]
[InlineData("Connection: ", false)]
[InlineData("Connection: Connection\r\nUpgrade: ", false)]
@@ -263,13 +260,12 @@ namespace System.Net.Tests
return;
}
- await GetRequest("POST", "", new string[] { webSocketString }, (_, request) =>
- {
- Assert.Equal(expected, request.IsWebSocketRequest);
- });
+ HttpListenerRequest request = await GetRequest("POST", "", new string[] { webSocketString });
+ Assert.Equal(expected, request.IsWebSocketRequest);
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData("Accept-Language: Lang1,Lang2,Lang3", new string[] { "Lang1", "Lang2", "Lang3" })]
[InlineData("Accept-Language: Lang1, Lang2, Lang3", new string[] { "Lang1", "Lang2", "Lang3" })]
[InlineData("Accept-Language: Lang1,,Lang3", new string[] { "Lang1", "", "Lang3" })]
@@ -279,101 +275,92 @@ namespace System.Net.Tests
[InlineData("Unknown-Header: Test", null)]
public async Task UserLanguages_GetProperty_ReturnsExpected(string userLanguageString, string[] expected)
{
- await GetRequest("POST", "", new string[] { userLanguageString }, (_, request) =>
+ HttpListenerRequest request = await GetRequest("POST", "", new string[] { userLanguageString });
+ Assert.Equal(request.UserLanguages, request.UserLanguages);
+ if (expected != null)
{
- Assert.Equal(request.UserLanguages, request.UserLanguages);
- if (expected != null)
- {
- Assert.NotSame(request.UserLanguages, request.UserLanguages);
- }
- Assert.Equal(expected, request.UserLanguages);
- });
+ Assert.NotSame(request.UserLanguages, request.UserLanguages);
+ }
+ Assert.Equal(expected, request.UserLanguages);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task ClientCertificateError_GetNotInitialized_ThrowsInvalidOperationException()
{
- await GetRequest("POST", null, null, (_, request) =>
- {
- Assert.Throws<InvalidOperationException>(() => request.ClientCertificateError);
- });
+ HttpListenerRequest request = await GetRequest("POST", null, null);
+ Assert.Throws<InvalidOperationException>(() => request.ClientCertificateError);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task GetClientCertificate_NoCertificate_ReturnsNull()
{
- await GetRequest("POST", null, null, (_, request) =>
- {
- Assert.Null(request.GetClientCertificate());
- Assert.Equal(0, request.ClientCertificateError);
- });
+ HttpListenerRequest request = await GetRequest("POST", null, null);
+ Assert.Null(request.GetClientCertificate());
+ Assert.Equal(0, request.ClientCertificateError);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task GetClientCertificateAsync_NoCertificate_ReturnsNull()
{
- await GetRequest("POST", null, null, (_, request) =>
- {
- Assert.Null(request.GetClientCertificateAsync().Result);
- });
+ HttpListenerRequest request = await GetRequest("POST", null, null);
+ Assert.Null(request.GetClientCertificateAsync().Result);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task EndGetClientCertificate_NullAsyncResult_ThrowsArgumentException()
{
- await GetRequest("POST", null, null, (_, request) =>
- {
- AssertExtensions.Throws<ArgumentNullException>("asyncResult", () => request.EndGetClientCertificate(null));
- });
+ HttpListenerRequest request = await GetRequest("POST", null, null);
+ AssertExtensions.Throws<ArgumentNullException>("asyncResult", () => request.EndGetClientCertificate(null));
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task EndGetClientCertificate_InvalidAsyncResult_ThrowsArgumentException()
{
- await GetRequest("POST", null, null, (socket1, request1) =>
+ HttpListenerRequest request1 = await GetRequest("POST", null, null);
+ using (var requestTests = new HttpListenerRequestTests())
{
- GetRequest("POST", null, null, (socket2, request2) =>
- {
- IAsyncResult beginGetClientCertificateResult1 = request1.BeginGetClientCertificate(null, null);
+ HttpListenerRequest request2 = await requestTests.GetRequest("POST", null, null);
+ IAsyncResult beginGetClientCertificateResult1 = request1.BeginGetClientCertificate(null, null);
- AssertExtensions.Throws<ArgumentException>("asyncResult", () => request2.EndGetClientCertificate(new CustomAsyncResult()));
- AssertExtensions.Throws<ArgumentException>("asyncResult", () => request2.EndGetClientCertificate(beginGetClientCertificateResult1));
- }).Wait();
- });
+ AssertExtensions.Throws<ArgumentException>("asyncResult", () => request2.EndGetClientCertificate(new CustomAsyncResult()));
+ AssertExtensions.Throws<ArgumentException>("asyncResult", () => request2.EndGetClientCertificate(beginGetClientCertificateResult1));
+ }
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task EndGetClientCertificate_AlreadyCalled_ThrowsInvalidOperationException()
{
- await GetRequest("POST", null, null, (_, request) =>
- {
- IAsyncResult beginGetClientCertificateResult = request.BeginGetClientCertificate(null, null);
- request.EndGetClientCertificate(beginGetClientCertificateResult);
+ HttpListenerRequest request = await GetRequest("POST", null, null);
+ IAsyncResult beginGetClientCertificateResult = request.BeginGetClientCertificate(null, null);
+ request.EndGetClientCertificate(beginGetClientCertificateResult);
- Assert.Throws<InvalidOperationException>(() => request.EndGetClientCertificate(beginGetClientCertificateResult));
- });
+ Assert.Throws<InvalidOperationException>(() => request.EndGetClientCertificate(beginGetClientCertificateResult));
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task TransportContext_GetChannelBinding_ReturnsExpected()
{
// This might not work on other devices:
// "The Security Service Providers don't support extended protection. Please install the
// latest Security Service Providers update."
- await GetRequest("POST", null, null, (_, request) =>
- {
- Assert.Null(request.TransportContext.GetChannelBinding(ChannelBindingKind.Endpoint));
- });
+ HttpListenerRequest request = await GetRequest("POST", null, null);
+ Assert.Null(request.TransportContext.GetChannelBinding(ChannelBindingKind.Endpoint));
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(ChannelBindingKind.Unique)]
public async Task TransportContext_GetChannelBindingInvalid_ThrowsNotSupportedException(ChannelBindingKind kind)
{
- await GetRequest("POST", null, null, (_, request) =>
- {
- Assert.Throws<NotSupportedException>(() => request.TransportContext.GetChannelBinding(kind));
- });
+ HttpListenerRequest request = await GetRequest("POST", null, null);
+ Assert.Throws<NotSupportedException>(() => request.TransportContext.GetChannelBinding(kind));
}
public static IEnumerable<object[]> QueryString_TestData()
@@ -462,38 +449,37 @@ namespace System.Net.Tests
};
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[MemberData(nameof(QueryString_TestData))]
public async Task QueryString_GetProperty_ReturnsExpected(string query, NameValueCollection expected)
{
- await GetRequest("POST", query, null, (_, request) =>
- {
- NameValueCollection queryString = request.QueryString;
- Assert.Equal(expected.Count, queryString.Count);
+ HttpListenerRequest request = await GetRequest("POST", query, null);
+ NameValueCollection queryString = request.QueryString;
+ Assert.Equal(expected.Count, queryString.Count);
- for (int i = 0; i < expected.Count; i++)
- {
- Assert.Equal(expected.GetKey(i), queryString.GetKey(i));
- Assert.Equal(expected.GetValues(i), queryString.GetValues(i));
- }
- });
+ for (int i = 0; i < expected.Count; i++)
+ {
+ Assert.Equal(expected.GetKey(i), queryString.GetKey(i));
+ Assert.Equal(expected.GetValues(i), queryString.GetValues(i));
+ }
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData("POST")]
[InlineData("PATCH")]
[InlineData("get")]
[InlineData("NOSUCH")]
public async Task HttpMethod_GetProperty_ReturnsExpected(string httpMethod)
{
- await GetRequest(httpMethod, null, null, (_, request) =>
- {
- Assert.Equal(httpMethod, request.HttpMethod);
- Assert.Equal(request.HttpMethod, request.HttpMethod);
- });
+ HttpListenerRequest request = await GetRequest(httpMethod, null, null);
+ Assert.Equal(httpMethod, request.HttpMethod);
+ Assert.Equal(request.HttpMethod, request.HttpMethod);
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData("1.1", new string[] { "Proxy-Connection: random" }, true)]
[InlineData("1.1", new string[] { "Proxy-Connection: close" }, false)]
[InlineData("1.1", new string[] { "proxy-connection: CLOSE" }, false)]
@@ -514,13 +500,12 @@ namespace System.Net.Tests
[InlineData("1.0", new string[] { "UnknownHeader: random" }, false)]
public async Task KeepAlive_GetProperty_ReturnsExpected(string httpVersion, string[] headers, bool expected)
{
- await GetRequest("POST", "", headers, (_, request) =>
- {
- Assert.Equal(request.KeepAlive, request.KeepAlive);
- Assert.Equal(expected, request.KeepAlive);
- }, httpVersion: httpVersion);
+ HttpListenerRequest request = await GetRequest("POST", "", headers, httpVersion: httpVersion);
+ Assert.Equal(request.KeepAlive, request.KeepAlive);
+ Assert.Equal(expected, request.KeepAlive);
}
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[Theory]
[InlineData("1.0")]
[InlineData("1.1")]
@@ -536,10 +521,8 @@ namespace System.Net.Tests
{
var version = new Version(httpVersion);
- await GetRequest("POST", "", new string[0], (_, request) =>
- {
- Assert.Equal(version, request.ProtocolVersion);
- }, httpVersion: httpVersion);
+ HttpListenerRequest request = await GetRequest("POST", "", new string[0], httpVersion: httpVersion);
+ Assert.Equal(version, request.ProtocolVersion);
}
public static IEnumerable<object[]> Cookies_TestData()
@@ -632,22 +615,22 @@ namespace System.Net.Tests
yield return new object[] { "Unknown-Header: Test", new CookieCollection() };
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[MemberData(nameof(Cookies_TestData))]
public async Task Cookies_GetProperty_ReturnsExpected(string cookieString, CookieCollection expected)
{
- await GetRequest("POST", null, new[] { cookieString }, (_, request) =>
+ HttpListenerRequest request = await GetRequest("POST", null, new[] { cookieString });
+
+ Assert.Equal(expected.Count, request.Cookies.Count);
+ for (int i = 0; i < expected.Count; i++)
{
- Assert.Equal(expected.Count, request.Cookies.Count);
- for (int i = 0; i < expected.Count; i++)
- {
- Assert.Equal(expected[i].Name, request.Cookies[i].Name);
- Assert.Equal(expected[i].Value, request.Cookies[i].Value);
- Assert.Equal(expected[i].Port, request.Cookies[i].Port);
- Assert.Equal(expected[i].Path, request.Cookies[i].Path);
- Assert.Equal(expected[i].Domain, request.Cookies[i].Domain);
- }
- });
+ Assert.Equal(expected[i].Name, request.Cookies[i].Name);
+ Assert.Equal(expected[i].Value, request.Cookies[i].Value);
+ Assert.Equal(expected[i].Port, request.Cookies[i].Port);
+ Assert.Equal(expected[i].Path, request.Cookies[i].Path);
+ Assert.Equal(expected[i].Domain, request.Cookies[i].Domain);
+ }
}
public static IEnumerable<object[]> Headers_TestData()
@@ -656,33 +639,25 @@ namespace System.Net.Tests
yield return new object[] { new string[] { "name:val?ue" }, new WebHeaderCollection() { { "name", "val?ue" } } };
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[MemberData(nameof(Headers_TestData))]
public async Task Headers_Get_ReturnsExpected(string[] headers, WebHeaderCollection expected)
{
- await GetRequest("POST", null, headers, (_, request) =>
+ HttpListenerRequest request = await GetRequest("POST", null, headers);
+ foreach (string name in expected)
{
- foreach (string name in expected)
- {
- Assert.Equal(expected[name], request.Headers[name]);
- Assert.Same(request.Headers, request.Headers);
- }
- });
+ Assert.Equal(expected[name], request.Headers[name]);
+ Assert.Same(request.Headers, request.Headers);
+ }
}
- private async Task GetRequest(string requestType, string query, string[] headers, Action<Socket, HttpListenerRequest> requestAction, string content = "Text\r\n", string httpVersion = "1.1")
+ private async Task<HttpListenerRequest> GetRequest(string requestType, string query, string[] headers, string content = "Text\r\n", string httpVersion = "1.1")
{
- using (HttpListenerFactory factory = new HttpListenerFactory())
- using (Socket client = factory.GetConnectedSocket())
- {
- client.Send(factory.GetContent(httpVersion, requestType, query, content, headers, true));
+ Client.Send(Factory.GetContent(httpVersion, requestType, query, content, headers, true));
- HttpListener listener = factory.GetListener();
- HttpListenerContext context = await listener.GetContextAsync();
-
- HttpListenerRequest request = context.Request;
- requestAction(client, request);
- }
+ HttpListener listener = Factory.GetListener();
+ return (await listener.GetContextAsync()).Request;
}
}
}
diff --git a/src/System.Net.HttpListener/tests/HttpListenerResponseTests.Cookies.cs b/src/System.Net.HttpListener/tests/HttpListenerResponseTests.Cookies.cs
index 9fd819330c..fb1943619a 100644
--- a/src/System.Net.HttpListener/tests/HttpListenerResponseTests.Cookies.cs
+++ b/src/System.Net.HttpListener/tests/HttpListenerResponseTests.Cookies.cs
@@ -11,7 +11,8 @@ namespace System.Net.Tests
{
public class HttpListenerResponseCookiesTests : HttpListenerResponseTestBase
{
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task Cookies_GetSet_ReturnsExpected()
{
HttpListenerResponse response = await GetResponse();
@@ -87,7 +88,8 @@ namespace System.Net.Tests
};
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[MemberData(nameof(Cookies_TestData))]
public async Task Cookies_SetAndSend_ClientReceivesExpectedHeaders(CookieCollection cookies, int expectedBytes, string expectedSetCookie, string expectedSetCookie2)
{
@@ -119,7 +121,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task Cookies_SetInHeader_ClientReceivesExpectedHeaders()
{
HttpListenerResponse response = await GetResponse();
@@ -133,7 +136,8 @@ namespace System.Net.Tests
Assert.Contains($"\r\nSet-Cookie2: name2=value2\r\n", clientResponse);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task Cookies_SetCookie2InHeadersButNotInCookies_RemovesFromHeaders()
{
HttpListenerResponse response = await GetResponse();
@@ -152,7 +156,8 @@ namespace System.Net.Tests
Assert.Contains($"\r\nSet-Cookie2: name3=value3; Port=\"200\"; Version=1\r\n", clientResponse);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task Cookies_SetCookieInHeadersButNotInCookies_RemovesFromHeaders()
{
HttpListenerResponse response = await GetResponse();
@@ -171,7 +176,8 @@ namespace System.Net.Tests
Assert.DoesNotContain("Set-Cookie2", clientResponse);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task AppendCookie_ValidCookie_AddsCookieToCollection()
{
HttpListenerResponse response = await GetResponse();
@@ -192,14 +198,16 @@ namespace System.Net.Tests
Assert.Equal("value3", response.Cookies[0].Value);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task AppendCookie_NullCookie_ThrowsArgumentNullException()
{
HttpListenerResponse response = await GetResponse();
AssertExtensions.Throws<ArgumentNullException>("cookie", () => response.AppendCookie(null));
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task SetCookie_ValidCookie_AddsCookieToCollection()
{
HttpListenerResponse response = await GetResponse();
@@ -212,7 +220,8 @@ namespace System.Net.Tests
Assert.Equal(new Cookie[] { cookie1, cookie2 }, response.Cookies.Cast<Cookie>());
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task SetCookie_ValidCookie_ClonesCookie()
{
HttpListenerResponse response = await GetResponse();
@@ -224,14 +233,16 @@ namespace System.Net.Tests
Assert.Equal("value", response.Cookies[0].Value);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task SetCookie_NullCookie_ThrowsArgumentNullException()
{
HttpListenerResponse response = await GetResponse();
AssertExtensions.Throws<ArgumentNullException>("cookie", () => response.SetCookie(null));
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task SetCookie_CookieDoesntExist_ThrowsArgumentException()
{
HttpListenerResponse response = await GetResponse();
diff --git a/src/System.Net.HttpListener/tests/HttpListenerResponseTests.Headers.cs b/src/System.Net.HttpListener/tests/HttpListenerResponseTests.Headers.cs
index a9dea49a97..db28f319cf 100644
--- a/src/System.Net.HttpListener/tests/HttpListenerResponseTests.Headers.cs
+++ b/src/System.Net.HttpListener/tests/HttpListenerResponseTests.Headers.cs
@@ -11,7 +11,8 @@ namespace System.Net.Tests
{
public class HttpListenerResponseHeadersTests : HttpListenerResponseTestBase
{
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task AddHeader_ValidValue_ReplacesHeaderInCollection()
{
HttpListenerResponse response = await GetResponse();
@@ -23,7 +24,8 @@ namespace System.Net.Tests
Assert.Equal("value2", response.Headers["name"]);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task AddHeader_NullOrEmptyName_ThrowsArgumentNullException()
{
HttpListenerResponse response = await GetResponse();
@@ -31,7 +33,8 @@ namespace System.Net.Tests
AssertExtensions.Throws<ArgumentNullException>("name", () => response.AddHeader("", ""));
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task AddHeader_InvalidNameOrValue_ThrowsArgumentException()
{
HttpListenerResponse response = await GetResponse();
@@ -40,7 +43,8 @@ namespace System.Net.Tests
AssertExtensions.Throws<ArgumentException>("value", () => response.AddHeader("name", "value1\rvalue2\r"));
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task AppendHeader_ValidValue_AddsHeaderToCollection()
{
HttpListenerResponse response = await GetResponse();
@@ -52,7 +56,8 @@ namespace System.Net.Tests
Assert.Equal("value1,value2", response.Headers["name"]);
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(null)]
[InlineData("")]
public async Task AppendHeader_NullOrEmptyName_ThrowsArgumentNullException(string name)
@@ -61,7 +66,8 @@ namespace System.Net.Tests
AssertExtensions.Throws<ArgumentNullException>("name", () => response.AppendHeader(null, ""));
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task AppendHeader_InvalidNameOrValue_ThrowsArgumentException()
{
HttpListenerResponse response = await GetResponse();
@@ -70,7 +76,8 @@ namespace System.Net.Tests
AssertExtensions.Throws<ArgumentException>("value", () => response.AppendHeader("name", "value1\rvalue2\r"));
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task ContentEncoding_SetCustom_DoesNothing()
{
// Setting HttpListenerResponse.ContentEncoding does nothing - it is never used.
@@ -85,7 +92,8 @@ namespace System.Net.Tests
Assert.DoesNotContain("Content-Encoding", clientResponse);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task ContentEncoding_SetDisposed_DoesNothing()
{
HttpListenerResponse response = await GetResponse();
@@ -98,7 +106,8 @@ namespace System.Net.Tests
Assert.DoesNotContain("Content-Encoding", clientResponse);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task ContentEncoding_SetAfterHeadersSent_DoesNothing()
{
using (HttpListenerResponse response = await GetResponse())
@@ -114,7 +123,8 @@ namespace System.Net.Tests
Assert.DoesNotContain("Content-Encoding", clientResponse);
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData("application/json", 152)]
[InlineData(" applICATion/jSOn ", 152)]
[InlineData("garbage", 143)]
@@ -131,7 +141,8 @@ namespace System.Net.Tests
Assert.Contains($"\r\nContent-Type: {contentType.Trim()}\r\n", clientResponse);
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(null, null)]
[InlineData("", null)]
[InlineData("\r \t \n", "")]
@@ -151,7 +162,8 @@ namespace System.Net.Tests
Assert.DoesNotContain("Content-Encoding", clientResponse);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task ContentType_SetDisposed_ThrowsObjectDisposedException()
{
HttpListenerResponse response = await GetResponse();
@@ -161,7 +173,8 @@ namespace System.Net.Tests
Assert.Null(response.ContentType);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task ContentType_SetAfterHeadersSent_DoesNothing()
{
using (HttpListenerResponse response = await GetResponse())
@@ -177,7 +190,8 @@ namespace System.Net.Tests
Assert.DoesNotContain("Content-Type", clientResponse);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task OutputStream_GetDisposed_ThrowsObjectDisposedException()
{
HttpListenerResponse response = await GetResponse();
@@ -186,7 +200,8 @@ namespace System.Net.Tests
Assert.Throws<ObjectDisposedException>(() => response.OutputStream);
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData("http://microsoft.com", 152)]
[InlineData(" http://MICROSOFT.com ", 152)]
[InlineData("garbage", 139)]
@@ -204,7 +219,8 @@ namespace System.Net.Tests
Assert.Contains($"\r\nLocation: {redirectLocation.Trim()}\r\n", clientResponse);
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(null, null)]
[InlineData("", null)]
[InlineData("\r \t \n", "")]
@@ -227,7 +243,8 @@ namespace System.Net.Tests
Assert.DoesNotContain("Location", clientResponse);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task RedirectLocation_SetDisposed_ThrowsObjectDisposedException()
{
HttpListenerResponse response = await GetResponse();
@@ -237,7 +254,8 @@ namespace System.Net.Tests
Assert.Null(response.RedirectLocation);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task RedirectLocation_SetAfterHeadersSent_DoesNothing()
{
using (HttpListenerResponse response = await GetResponse())
@@ -253,7 +271,8 @@ namespace System.Net.Tests
Assert.DoesNotContain("Location", clientResponse);
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(100, "HTTP/1.1 100 Continue", 112)]
[InlineData(404, "HTTP/1.1 404 Not Found", 127)]
[InlineData(401, "HTTP/1.1 401 Unauthorized", 130)]
@@ -272,7 +291,8 @@ namespace System.Net.Tests
Assert.StartsWith($"{startLine}\r\n", clientResponse);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task StatusCode_SetDisposed_ThrowsObjectDisposedException()
{
HttpListenerResponse response = await GetResponse();
@@ -282,7 +302,8 @@ namespace System.Net.Tests
Assert.Equal(200, response.StatusCode);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task StatusCode_SetAfterHeadersSent_DoesNothing()
{
using (HttpListenerResponse response = await GetResponse())
@@ -298,7 +319,8 @@ namespace System.Net.Tests
Assert.StartsWith("HTTP/1.1 200 OK\r\n", clientResponse);
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(99)]
[InlineData(1000)]
public async Task StatusCode_SetInvalid_ThrowsProtocolViolationException(int statusCode)
@@ -310,7 +332,8 @@ namespace System.Net.Tests
}
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(100, "Continue")]
[InlineData(101, "Switching Protocols")]
[InlineData(102, "Processing")]
@@ -375,7 +398,8 @@ namespace System.Net.Tests
Assert.StartsWith($"HTTP/1.1 404 {expectedDescription}\r\n", clientResponse);
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData("", "", 118)]
[InlineData("A !#\t1\u1234", "A !#\t14", 125)] //
[InlineData("StatusDescription", "StatusDescription", 135)]
@@ -392,7 +416,8 @@ namespace System.Net.Tests
Assert.StartsWith($"HTTP/1.1 200 {expectedStatusDescription}\r\n", clientResponse);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task StatusDescription_SetNull_ThrowsArgumentNullException()
{
using (HttpListenerResponse response = await GetResponse())
@@ -402,7 +427,8 @@ namespace System.Net.Tests
}
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData("\0abc")]
[InlineData("\u007F")]
[InlineData("\r")]
@@ -416,7 +442,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task StatusDescription_SetDisposed_ThrowsObjectDisposedException()
{
HttpListenerResponse response = await GetResponse();
@@ -426,7 +453,8 @@ namespace System.Net.Tests
Assert.Equal("OK", response.StatusDescription);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task StatusDescription_SetAfterHeadersSent_DoesNothing()
{
using (HttpListenerResponse response = await GetResponse())
@@ -442,7 +470,8 @@ namespace System.Net.Tests
Assert.StartsWith("HTTP/1.1 200 OK\r\n", clientResponse);
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true, 120)]
[InlineData(false, 106)]
public async Task SendChunked_GetSet_ReturnsExpected(bool sendChunked, int expectedNumberOfBytes)
@@ -477,7 +506,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task SendChunked_SetDisposed_ThrowsObjectDisposedException()
{
HttpListenerResponse response = await GetResponse();
@@ -490,7 +520,8 @@ namespace System.Net.Tests
Assert.Contains("\r\nTransfer-Encoding: chunked\r\n", clientResponse);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task SendChunked_SetAfterHeadersSent_ThrowsInvalidOperationException()
{
using (HttpListenerResponse response = await GetResponse())
@@ -506,7 +537,8 @@ namespace System.Net.Tests
Assert.DoesNotContain("Transfer-Encoding", clientResponse);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task SendChunked_SetTrueAndRequestHttpVersionMinorIsZero_ThrowsInvalidOperationException()
{
using (HttpListenerResponse response = await GetResponse("1.0"))
@@ -522,7 +554,8 @@ namespace System.Net.Tests
Assert.DoesNotContain("Transfer-Encoding", clientResponse);
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true, 120)]
[InlineData(false, 139)]
public async Task KeepAlive_GetSet_ReturnsExpected(bool keepAlive, int expectedNumberOfBytes)
@@ -559,7 +592,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task KeepAlive_SetDisposed_ThrowsObjectDisposedException()
{
HttpListenerResponse response = await GetResponse();
@@ -575,7 +609,8 @@ namespace System.Net.Tests
Assert.DoesNotContain("Connection", clientResponse);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task KeepAlive_SetAfterHeadersSent_DoesNothing()
{
using (HttpListenerResponse response = await GetResponse())
@@ -591,7 +626,8 @@ namespace System.Net.Tests
Assert.DoesNotContain("Transfer-Encoding", clientResponse);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task KeepAlive_NoBoundaryAndRequestHttpRequestVersionMinorIsZero_SetsToFalseWhenSendingHeaders()
{
using (HttpListenerResponse response = await GetResponse("1.0"))
@@ -606,7 +642,8 @@ namespace System.Net.Tests
Assert.DoesNotContain("Transfer-Encoding", clientResponse);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task KeepAlive_ContentLengthBoundaryAndRequestHttpVersionMinorIsZero_DoesNotChangeWhenSendingHeaders()
{
using (HttpListenerResponse response = await GetResponse("1.0"))
@@ -624,7 +661,8 @@ namespace System.Net.Tests
Assert.DoesNotContain("Transfer-Encoding", clientResponse);
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(0, 106)]
[InlineData(10, 117)]
public async Task ContentLength64_GetSet_ReturnsExpected(int contentLength64, int expectedNumberOfBytes)
@@ -654,7 +692,8 @@ namespace System.Net.Tests
Assert.Contains($"\r\nContent-Length: {contentLength64}\r\n", clientResponse);
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(100, 0, 112)]
[InlineData(101, 0, 123)]
[InlineData(204, 0, 114)]
@@ -682,7 +721,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task ContentLength64_SetDisposed_ThrowsObjectDisposedException()
{
HttpListenerResponse response = await GetResponse();
@@ -696,7 +736,8 @@ namespace System.Net.Tests
Assert.DoesNotContain("Content-Length", clientResponse);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task ContentLength64_SetAfterHeadersSent_ThrowsInvalidOperationException()
{
using (HttpListenerResponse response = await GetResponse())
@@ -712,7 +753,8 @@ namespace System.Net.Tests
Assert.DoesNotContain("Transfer-Encoding", clientResponse);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task ContentLength64_SetNegative_ThrowsArgumentOutOfRangeException()
{
using (HttpListenerResponse response = await GetResponse())
@@ -736,7 +778,8 @@ namespace System.Net.Tests
yield return new object[] { new Version(1, 1, 2, 3) };
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[MemberData(nameof(ProtocolVersion_Set_TestData))]
public async Task ProtocolVersion_SetValid_ReturnsExpected(Version version)
{
@@ -752,7 +795,8 @@ namespace System.Net.Tests
Assert.StartsWith("HTTP/1.1 200 OK\r\n", clientResponse);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task ProtocolVersion_SetNull_ThrowsArgumentNullException()
{
using (HttpListenerResponse response = await GetResponse())
@@ -762,7 +806,8 @@ namespace System.Net.Tests
}
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(0, 0)]
[InlineData(1, 2)]
[InlineData(2, 0)]
@@ -775,7 +820,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task Headers_GetSet_ReturnsExpected()
{
using (HttpListenerResponse response = await GetResponse())
@@ -797,7 +843,8 @@ namespace System.Net.Tests
Assert.Contains("\r\nName1: Value1\r\nName2: Value2\r\nName3: \r\n", clientResponse);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task Headers_SetNull_ThrowsNullReferenceException()
{
using (HttpListenerResponse response = await GetResponse())
diff --git a/src/System.Net.HttpListener/tests/HttpListenerResponseTests.cs b/src/System.Net.HttpListener/tests/HttpListenerResponseTests.cs
index c20b68043d..593c8b363e 100644
--- a/src/System.Net.HttpListener/tests/HttpListenerResponseTests.cs
+++ b/src/System.Net.HttpListener/tests/HttpListenerResponseTests.cs
@@ -59,7 +59,8 @@ namespace System.Net.Tests
public class HttpListenerResponseTests : HttpListenerResponseTestBase
{
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task CopyFrom_AllValues_ReturnsClone()
{
using (HttpListenerResponse response1 = await GetResponse())
@@ -96,7 +97,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task CopyFrom_NullTemplateResponse_ThrowsNullReferenceException()
{
using (HttpListenerResponse response = await GetResponse())
@@ -105,7 +107,8 @@ namespace System.Net.Tests
}
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(null, 123)]
[InlineData("", 123)]
[InlineData(" \r \t \n", 123)]
@@ -137,7 +140,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task Redirect_Disposed_ThrowsObjectDisposedException()
{
HttpListenerResponse response = await GetResponse();
@@ -152,7 +156,8 @@ namespace System.Net.Tests
}
// The managed implementation should also dispose the OutputStream after calling Abort.
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))] // [ActiveIssue(19975, TestPlatforms.AnyUnix)]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))] // [ActiveIssue(19975, TestPlatforms.AnyUnix)]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task Abort_Invoke_ForciblyTerminatesConnection()
{
Client.Send(Factory.GetContent("1.1", "POST", null, "Give me a context, please", null, headerOnly: false));
@@ -187,7 +192,8 @@ namespace System.Net.Tests
((IDisposable)response).Dispose();
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task Close_Invoke_ClosesConnection()
{
using (HttpListenerResponse response = await GetResponse())
@@ -212,7 +218,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task Dispose_Invoke_ClosesConnection()
{
using (HttpListenerResponse response = await GetResponse())
@@ -237,7 +244,8 @@ namespace System.Net.Tests
}
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true)]
[InlineData(false)]
public async Task CloseResponseEntity_EmptyResponseEntity_Success(bool willBlock)
@@ -263,7 +271,8 @@ namespace System.Net.Tests
}
}
- [ConditionalTheory(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))] // [ActiveIssue(20201, TestPlatforms.AnyUnix)]
+ [ConditionalTheory(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))] // [ActiveIssue(20201, TestPlatforms.AnyUnix)]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true)]
[InlineData(false)]
public async Task CloseResponseEntity_AllContentLengthAlreadySent_DoesNotSendEntity(bool willBlock)
@@ -282,7 +291,8 @@ namespace System.Net.Tests
}
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true)]
[InlineData(false)]
public async Task CloseResponseEntity_NotChunkedSentHeaders_SendsEntityWithoutModifyingContentLength(bool willBlock)
@@ -313,7 +323,8 @@ namespace System.Net.Tests
}
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true)]
[InlineData(false)]
public async Task CloseResponseEntity_ChunkedNotSentHeaders_ModifiesContentLength(bool willBlock)
@@ -343,7 +354,8 @@ namespace System.Net.Tests
}
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true)]
[InlineData(false)]
public async Task CloseResponseEntity_ChunkedSentHeaders_DoesNotModifyContentLength(bool willBlock)
@@ -373,7 +385,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task CloseResponseEntity_AlreadyDisposed_ThrowsObjectDisposedException()
{
HttpListenerResponse response = await GetResponse();
@@ -382,7 +395,8 @@ namespace System.Net.Tests
Assert.Throws<ObjectDisposedException>(() => response.Close(new byte[10], true));
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task CloseResponseEntity_NullResponseEntity_ThrowsArgumentNullException()
{
using (HttpListenerResponse response = await GetResponse())
@@ -391,7 +405,8 @@ namespace System.Net.Tests
}
}
- [ConditionalTheory(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))] // [ActiveIssue(20201, TestPlatforms.AnyUnix)]
+ [ConditionalTheory(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))] // [ActiveIssue(20201, TestPlatforms.AnyUnix)]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true)]
[InlineData(false)]
public async Task CloseResponseEntity_SendMoreThanContentLength_ThrowsInvalidOperationException(bool willBlock)
@@ -436,8 +451,8 @@ namespace System.Net.Tests
}
}
- [ActiveIssue(20246)] // CI hanging frequently
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true)]
[InlineData(false)]
public async Task CloseResponseEntity_SendToClosedConnection_DoesNotThrow(bool willBlock)
diff --git a/src/System.Net.HttpListener/tests/HttpListenerTests.cs b/src/System.Net.HttpListener/tests/HttpListenerTests.cs
index 69ab193c8c..67783ce634 100644
--- a/src/System.Net.HttpListener/tests/HttpListenerTests.cs
+++ b/src/System.Net.HttpListener/tests/HttpListenerTests.cs
@@ -13,7 +13,8 @@ namespace System.Net.Tests
{
public class HttpListenerTests
{
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void IgnoreWriteExceptions_SetDisposed_ThrowsObjectDisposedException()
{
var listener = new HttpListener();
@@ -22,7 +23,8 @@ namespace System.Net.Tests
Assert.Throws<ObjectDisposedException>(() => listener.IgnoreWriteExceptions = false);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void Stop_Disposed_ThrowsObjectDisposedException()
{
var listener = new HttpListener();
@@ -31,7 +33,8 @@ namespace System.Net.Tests
Assert.Throws<ObjectDisposedException>(() => listener.Stop());
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void IsListening_NotStarted_ReturnsFalse()
{
using (var listener = new HttpListener())
@@ -40,7 +43,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void IsListening_Disposed_ReturnsFalse()
{
var listener = new HttpListener();
@@ -51,7 +55,8 @@ namespace System.Net.Tests
Assert.False(listener.IsListening);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void IsListening_Aborted_ReturnsFalse()
{
var listener = new HttpListener();
@@ -62,7 +67,8 @@ namespace System.Net.Tests
Assert.False(listener.IsListening);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void IsListening_Stopped_ReturnsFalse()
{
var listener = new HttpListener();
@@ -73,7 +79,8 @@ namespace System.Net.Tests
Assert.False(listener.IsListening);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void Start_Disposed_ThrowsObjectDisposedException()
{
var listener = new HttpListener();
@@ -82,7 +89,8 @@ namespace System.Net.Tests
Assert.Throws<ObjectDisposedException>(() => listener.Start());
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void GetContext_Disposed_ThrowsObjectDisposedException()
{
var listener = new HttpListener();
@@ -92,7 +100,8 @@ namespace System.Net.Tests
Assert.Throws<ObjectDisposedException>(() => listener.BeginGetContext(null, null));
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void GetContext_NotStarted_ThrowsInvalidOperationException()
{
using (var listener = new HttpListener())
@@ -102,7 +111,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void GetContext_NoPrefixes_ThrowsInvalidOperationException()
{
using (var listener = new HttpListener())
@@ -113,7 +123,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void EndGetContext_NullAsyncResult_ThrowsArgumentNullException()
{
using (var listener = new HttpListener())
@@ -122,7 +133,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void EndGetContext_InvalidAsyncResult_ThrowsArgumentException()
{
using (var listener1 = new HttpListener())
@@ -137,7 +149,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void EndGetContext_AlreadyCalled_ThrowsInvalidOperationException()
{
using (var listenerFactory = new HttpListenerFactory())
diff --git a/src/System.Net.HttpListener/tests/HttpListenerTimeoutManagerTests.cs b/src/System.Net.HttpListener/tests/HttpListenerTimeoutManagerTests.cs
index bd84e394e2..8e5f0714d9 100644
--- a/src/System.Net.HttpListener/tests/HttpListenerTimeoutManagerTests.cs
+++ b/src/System.Net.HttpListener/tests/HttpListenerTimeoutManagerTests.cs
@@ -10,7 +10,8 @@ namespace System.Net.Tests
{
public class HttpListenerTimeoutManagerTests
{
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(-1)]
[InlineData((long)uint.MaxValue + 1)]
public void MinSendBytesPerSecond_NotUInt_ThrowsArgumentOutOfRangeException(long value)
@@ -21,7 +22,8 @@ namespace System.Net.Tests
}
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(-1)]
[InlineData((uint)ushort.MaxValue + 1)]
public void TimeoutValue_NotUShort_ThrowsArgumentOutOfRangeException(long totalSeconds)
@@ -37,7 +39,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void Get_Disposed_ThrowsObjectDisposedException()
{
var listener = new HttpListener();
@@ -123,7 +126,8 @@ namespace System.Net.Tests
public void Dispose() => _listener.Close();
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void TimeoutManager_AccessNoStart_Success()
{
// Access the TimeoutManager without calling Start and make sure it is initialized.
@@ -134,7 +138,8 @@ namespace System.Net.Tests
Assert.Equal(rate, timeoutManager.MinSendBytesPerSecond);
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void TimeoutManager_AccessAfterStart_Success()
{
// Access the TimeoutManager after calling Start and make sure it is initialized.
@@ -146,7 +151,8 @@ namespace System.Net.Tests
Assert.Equal(rate, timeoutManager.MinSendBytesPerSecond);
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void TimeoutManager_AccessAfterClose_GetObjectDisposedException()
{
// Access the TimeoutManager after calling Close and make sure it is not accessible.
@@ -155,7 +161,8 @@ namespace System.Net.Tests
Assert.Throws<ObjectDisposedException>(() => _listener.TimeoutManager);
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void TimeoutManager_AccessBeforeAndAfterClose_GetObjectDisposedException()
{
// Access the TimeoutManager after calling Close and make sure it is not accessible.
@@ -166,7 +173,8 @@ namespace System.Net.Tests
Assert.Throws<ObjectDisposedException>(() => timeoutManager.MinSendBytesPerSecond = 10);
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void TimeoutManager_AccessAfterStop_Success()
{
// Access the TimeoutManager after calling Stop and make sure it is accessible.
@@ -180,7 +188,8 @@ namespace System.Net.Tests
Assert.Equal(rate, timeoutManager.MinSendBytesPerSecond);
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void DrainEntityBody_SetTimeoutNoStart_GetReturnsNewValue()
{
// Set the DrainEntityBody timeout without calling Start and make sure that native layer return new value.
@@ -190,7 +199,8 @@ namespace System.Net.Tests
Assert.Equal(seconds, _listener.TimeoutManager.DrainEntityBody.TotalSeconds);
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void DrainEntityBody_SetTimeoutAfterStart_GetReturnsNewValue()
{
// Set the DrainEntityBody timeout after calling Start and make sure that native layer return new value.
@@ -201,7 +211,8 @@ namespace System.Net.Tests
Assert.Equal(seconds, _listener.TimeoutManager.DrainEntityBody.TotalSeconds);
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void EntityBody_SetTimeoutNoStart_GetReturnsNewValue()
{
// Set the DrainEntityBody timeout without calling Start and make sure that native layer return new value.
@@ -211,7 +222,8 @@ namespace System.Net.Tests
Assert.Equal(seconds, _listener.TimeoutManager.EntityBody.TotalSeconds);
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void EntityBody_SetTimeoutAfterStart_GetReturnsNewValue()
{
// Set the EntityBody timeout after calling Start and make sure that native layer return new value.
@@ -222,7 +234,8 @@ namespace System.Net.Tests
Assert.Equal(seconds, _listener.TimeoutManager.EntityBody.TotalSeconds);
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void HeaderWait_SetTimeoutNoStart_GetReturnsNewValue()
{
// Set the HeaderWait timeout without calling Start and make sure that native layer return new value.
@@ -232,7 +245,8 @@ namespace System.Net.Tests
Assert.Equal(seconds, _listener.TimeoutManager.HeaderWait.TotalSeconds);
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void HeaderWait_SetTimeoutAfterStart_GetReturnsNewValue()
{
// Set the HeaderWait timeout after calling Start and make sure that native layer return new value.
@@ -243,7 +257,8 @@ namespace System.Net.Tests
Assert.Equal(seconds, _listener.TimeoutManager.HeaderWait.TotalSeconds);
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void RequestQueue_SetTimeoutNoStart_GetReturnsNewValue()
{
// Set the DrainEntityBody timeout without calling Start and make sure that native layer return new value.
@@ -253,7 +268,8 @@ namespace System.Net.Tests
Assert.Equal(seconds, _listener.TimeoutManager.RequestQueue.TotalSeconds);
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void RequestQueue_SetTimeoutAfterStart_GetReturnsNewValue()
{
// Set the RequestQueue timeout after calling Start and make sure that native layer return new value.
@@ -264,7 +280,8 @@ namespace System.Net.Tests
Assert.Equal(seconds, _listener.TimeoutManager.RequestQueue.TotalSeconds);
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void IdleConnection_SetTimeoutNoStart_GetReturnsNewValue()
{
// Set the IdleConnection timeout without calling Start and make sure that native layer return new value.
@@ -274,7 +291,8 @@ namespace System.Net.Tests
Assert.Equal(seconds, _listener.TimeoutManager.IdleConnection.TotalSeconds);
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void IdleConnection_SetTimeoutAfterStart_GetReturnsNewValue()
{
// Set the IdleConnection timeout after calling Start and make sure that native layer return new value.
@@ -285,7 +303,8 @@ namespace System.Net.Tests
Assert.Equal(seconds, _listener.TimeoutManager.IdleConnection.TotalSeconds);
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void MinSendBytesPerSecond_SetNoStart_GetReturnsNewValue()
{
// Set the MinSendBytesPerSecond timeout without calling Start and make sure that native layer
@@ -296,7 +315,8 @@ namespace System.Net.Tests
Assert.Equal(rate, _listener.TimeoutManager.MinSendBytesPerSecond);
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void MinSendBytesPerSecond_SetAfterStart_GetReturnsNewValue()
{
// Set the MinSendBytesPerSecond timeout after calling Start and make sure that native
@@ -308,7 +328,8 @@ namespace System.Net.Tests
Assert.Equal(rate, _listener.TimeoutManager.MinSendBytesPerSecond);
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void MinSendBytesPerSecond_SetAfterClose_GetObjectDisposedException()
{
// Set the MinSendBytesPerSecond timeout after calling Close and make sure that we get the exception.
@@ -317,7 +338,8 @@ namespace System.Net.Tests
Assert.Throws<ObjectDisposedException>(() => _listener.TimeoutManager.MinSendBytesPerSecond = 10 * 1024 * 1024);
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void MinSendBytesPerSecond_SetAfterStop_GetReturnsNewValue()
{
// Set the MinSendBytesPerSecond timeout after calling Stop and make sure that native
@@ -378,7 +400,8 @@ namespace System.Net.Tests
}
- [ConditionalTheory(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))]
+ [ConditionalTheory(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(1.3, 1)]
[InlineData(1.6, 2)]
public void TimeoutValue_Double_Truncates(double seconds, int expected)
@@ -394,7 +417,8 @@ namespace System.Net.Tests
public class HttpListenerTimeoutManagerUnixTests
{
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsManagedImplementationAndNotUap))] // [PlatformSpecific(TestPlatforms.AnyUnix)] // managed implementation doesn't support all members
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsManagedImplementation))] // [PlatformSpecific(TestPlatforms.AnyUnix)] // managed implementation doesn't support all members
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void Properties_DefaultValues()
{
using (var listener = new HttpListener())
@@ -410,7 +434,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsManagedImplementationAndNotUap))] // [PlatformSpecific(TestPlatforms.AnyUnix)] // managed implementation doesn't support all members
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsManagedImplementation))] // [PlatformSpecific(TestPlatforms.AnyUnix)] // managed implementation doesn't support all members
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void UnsupportedProperties_Throw()
{
using (var listener = new HttpListener())
@@ -423,7 +448,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsManagedImplementationAndNotUap))] // [PlatformSpecific(TestPlatforms.AnyUnix)] // managed implementation doesn't support all members
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsManagedImplementation))] // [PlatformSpecific(TestPlatforms.AnyUnix)] // managed implementation doesn't support all members
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void DrainEntityBody_Roundtrips()
{
using (var listener = new HttpListener())
@@ -437,7 +463,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsManagedImplementationAndNotUap))] // [PlatformSpecific(TestPlatforms.AnyUnix)] // managed implementation doesn't support all members
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsManagedImplementation))] // [PlatformSpecific(TestPlatforms.AnyUnix)] // managed implementation doesn't support all members
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void IdleConnection_Roundtrips()
{
using (var listener = new HttpListener())
diff --git a/src/System.Net.HttpListener/tests/HttpListenerWebSocketTests.cs b/src/System.Net.HttpListener/tests/HttpListenerWebSocketTests.cs
index 81074ac5e8..9ea4d936cb 100644
--- a/src/System.Net.HttpListener/tests/HttpListenerWebSocketTests.cs
+++ b/src/System.Net.HttpListener/tests/HttpListenerWebSocketTests.cs
@@ -13,8 +13,8 @@ namespace System.Net.Tests
{
public class HttpListenerWebSocketTests : IDisposable
{
- public static bool IsNotWindows7OrUapCore { get; } = !PlatformDetection.IsWindows7 && PlatformDetection.IsNotOneCoreUAP;
- public static bool IsNotWindows7OrUapCoreAndIsWindowsImplementation { get; } = IsNotWindows7OrUapCore && Helpers.IsWindowsImplementationAndNotUap;
+ public static bool IsNotWindows7 { get; } = !PlatformDetection.IsWindows7;
+ public static bool IsNotWindows7AndIsWindowsImplementation { get; } = IsNotWindows7 && Helpers.IsWindowsImplementation;
private HttpListenerFactory Factory { get; }
private HttpListener Listener { get; }
@@ -34,7 +34,8 @@ namespace System.Net.Tests
Client.Dispose();
}
- [ConditionalTheory(nameof(IsNotWindows7OrUapCore))]
+ [ConditionalTheory(nameof(IsNotWindows7))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(WebSocketMessageType.Text, false)]
[InlineData(WebSocketMessageType.Binary, false)]
[InlineData(WebSocketMessageType.Text, true)]
@@ -59,14 +60,16 @@ namespace System.Net.Tests
Assert.Equal(Text, Encoding.ASCII.GetString(receivedBytes));
}
- [ConditionalFact(nameof(IsNotWindows7OrUapCore))]
+ [ConditionalFact(nameof(IsNotWindows7))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task SendAsync_NoInnerBuffer_ThrowsArgumentNullException()
{
HttpListenerWebSocketContext context = await GetWebSocketContext();
await Assert.ThrowsAsync<ArgumentNullException>("buffer.Array", () => context.WebSocket.SendAsync(new ArraySegment<byte>(), WebSocketMessageType.Text, false, new CancellationToken()));
}
- [ConditionalTheory(nameof(IsNotWindows7OrUapCore))]
+ [ConditionalTheory(nameof(IsNotWindows7))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(WebSocketMessageType.Close)]
[InlineData(WebSocketMessageType.Text - 1)]
[InlineData(WebSocketMessageType.Binary + 1)]
@@ -76,7 +79,8 @@ namespace System.Net.Tests
await Assert.ThrowsAsync<ArgumentException>("messageType", () => context.WebSocket.SendAsync(new ArraySegment<byte>(), messageType, false, new CancellationToken()));
}
- [ConditionalFact(nameof(IsNotWindows7OrUapCoreAndIsWindowsImplementation))] // [ActiveIssue(20395, TestPlatforms.AnyUnix)]
+ [ConditionalFact(nameof(IsNotWindows7AndIsWindowsImplementation))] // [ActiveIssue(20395, TestPlatforms.AnyUnix)]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task SendAsync_Disposed_ThrowsObjectDisposedException()
{
HttpListenerWebSocketContext context = await GetWebSocketContext();
@@ -85,7 +89,8 @@ namespace System.Net.Tests
await Assert.ThrowsAsync<ObjectDisposedException>(() => context.WebSocket.SendAsync(new ArraySegment<byte>(new byte[10]), WebSocketMessageType.Text, false, new CancellationToken()));
}
- [ConditionalTheory(nameof(IsNotWindows7OrUapCore))]
+ [ConditionalTheory(nameof(IsNotWindows7))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(WebSocketMessageType.Text, false)]
[InlineData(WebSocketMessageType.Binary, false)]
[InlineData(WebSocketMessageType.Text, true)]
@@ -110,7 +115,8 @@ namespace System.Net.Tests
Assert.Equal(Text, Encoding.ASCII.GetString(receivedBytes));
}
- [ConditionalFact(nameof(IsNotWindows7OrUapCore))]
+ [ConditionalFact(nameof(IsNotWindows7))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task ReceiveAsync_NoInnerBuffer_ThrowsArgumentNullException()
{
HttpListenerWebSocketContext context = await GetWebSocketContext();
@@ -119,7 +125,8 @@ namespace System.Net.Tests
await Assert.ThrowsAsync<ArgumentNullException>("buffer.Array", () => context.WebSocket.ReceiveAsync(new ArraySegment<byte>(), new CancellationToken()));
}
- [ConditionalFact(nameof(IsNotWindows7OrUapCoreAndIsWindowsImplementation))] // [ActiveIssue(20395, TestPlatforms.AnyUnix)]
+ [ConditionalFact(nameof(IsNotWindows7AndIsWindowsImplementation))] // [ActiveIssue(20395, TestPlatforms.AnyUnix)]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task ReceiveAsync_Disposed_ThrowsObjectDisposedException()
{
HttpListenerWebSocketContext context = await GetWebSocketContext();
@@ -137,7 +144,8 @@ namespace System.Net.Tests
yield return new object[] { WebSocketCloseStatus.MandatoryExtension, "StatusDescription", WebSocketCloseStatus.MandatoryExtension };
}
- [ConditionalTheory(nameof(IsNotWindows7OrUapCoreAndIsWindowsImplementation))] // [ActiveIssue(20396, TestPlatforms.AnyUnix)]
+ [ConditionalTheory(nameof(IsNotWindows7AndIsWindowsImplementation))] // [ActiveIssue(20396, TestPlatforms.AnyUnix)]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[MemberData(nameof(CloseStatus_Valid_TestData))]
public async Task CloseOutputAsync_HandshakeStartedFromClient_Success(WebSocketCloseStatus status, string statusDescription, WebSocketCloseStatus expectedCloseStatus)
{
@@ -200,7 +208,8 @@ namespace System.Net.Tests
await context.WebSocket.CloseOutputAsync(WebSocketCloseStatus.Empty, null, new CancellationToken());
}
- [ConditionalTheory(nameof(IsNotWindows7OrUapCoreAndIsWindowsImplementation))] // [ActiveIssue(20396, TestPlatforms.AnyUnix)]
+ [ConditionalTheory(nameof(IsNotWindows7AndIsWindowsImplementation))] // [ActiveIssue(20396, TestPlatforms.AnyUnix)]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[MemberData(nameof(CloseStatus_Valid_TestData))]
public async Task CloseAsync_HandshakeStartedFromClient_Success(WebSocketCloseStatus status, string statusDescription, WebSocketCloseStatus expectedCloseStatus)
{
@@ -273,7 +282,8 @@ namespace System.Net.Tests
yield return new object[] { (WebSocketCloseStatus)1015, null, "closeStatus" };
}
- [ConditionalTheory(nameof(IsNotWindows7OrUapCore))]
+ [ConditionalTheory(nameof(IsNotWindows7))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[MemberData(nameof(CloseStatus_Invalid_TestData))]
public async Task CloseAsync_InvalidCloseStatus_ThrowsArgumentException(WebSocketCloseStatus status, string statusDescription, string paramName)
{
@@ -283,7 +293,8 @@ namespace System.Net.Tests
await Assert.ThrowsAsync<ArgumentException>(paramName, () => context.WebSocket.CloseOutputAsync(status, statusDescription, new CancellationToken()));
}
- [ConditionalFact(nameof(IsNotWindows7OrUapCoreAndIsWindowsImplementation))] // [ActiveIssue(20394, TestPlatforms.AnyUnix)]
+ [ConditionalFact(nameof(IsNotWindows7AndIsWindowsImplementation))] // [ActiveIssue(20394, TestPlatforms.AnyUnix)]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task CloseAsync_AfterDisposed_Nop()
{
HttpListenerWebSocketContext context = await GetWebSocketContext();
@@ -293,7 +304,8 @@ namespace System.Net.Tests
await context.WebSocket.CloseAsync(WebSocketCloseStatus.Empty, null, new CancellationToken());
}
- [ConditionalFact(nameof(IsNotWindows7OrUapCoreAndIsWindowsImplementation))] // [ActiveIssue(20394, TestPlatforms.AnyUnix)]
+ [ConditionalFact(nameof(IsNotWindows7AndIsWindowsImplementation))] // [ActiveIssue(20394, TestPlatforms.AnyUnix)]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task CloseAsync_AfterAborted_Nop()
{
HttpListenerWebSocketContext context = await GetWebSocketContext();
@@ -303,7 +315,8 @@ namespace System.Net.Tests
await context.WebSocket.CloseAsync(WebSocketCloseStatus.Empty, null, new CancellationToken());
}
- [ConditionalFact(nameof(IsNotWindows7OrUapCoreAndIsWindowsImplementation))] // [ActiveIssue(20397, TestPlatforms.AnyUnix)]
+ [ConditionalFact(nameof(IsNotWindows7AndIsWindowsImplementation))] // [ActiveIssue(20397, TestPlatforms.AnyUnix)]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task Dispose_CallAfterDisposed_Nop()
{
HttpListenerWebSocketContext context = await GetWebSocketContext();
@@ -317,7 +330,8 @@ namespace System.Net.Tests
Assert.Equal(WebSocketState.Aborted, context.WebSocket.State);
}
- [ConditionalFact(nameof(IsNotWindows7OrUapCore))]
+ [ConditionalFact(nameof(IsNotWindows7))]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task Abort_CallAfterAborted_Nop()
{
HttpListenerWebSocketContext context = await GetWebSocketContext();
diff --git a/src/System.Net.HttpListener/tests/HttpRequestStreamTests.cs b/src/System.Net.HttpListener/tests/HttpRequestStreamTests.cs
index 6fdd56f6ed..403c56c789 100644
--- a/src/System.Net.HttpListener/tests/HttpRequestStreamTests.cs
+++ b/src/System.Net.HttpListener/tests/HttpRequestStreamTests.cs
@@ -32,7 +32,8 @@ namespace System.Net.Tests
_helper.Dispose();
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true, "")]
[InlineData(false, "")]
[InlineData(true, "Non-Empty")]
@@ -76,8 +77,9 @@ namespace System.Net.Tests
}
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
-// [InlineData(true, "")] Issue #20419 - HttpClient problem
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
+ [InlineData(true, "")]
[InlineData(false, "")]
[InlineData(true, "Non-Empty")]
[InlineData(false, "Non-Empty")]
@@ -122,7 +124,8 @@ namespace System.Net.Tests
}
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true, "")]
[InlineData(false, "")]
[InlineData(true, "Non-Empty")]
@@ -166,7 +169,8 @@ namespace System.Net.Tests
}
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true)]
[InlineData(false)]
public async Task Read_LargeLengthAsynchronous_Success(bool transferEncodingChunked)
@@ -205,7 +209,8 @@ namespace System.Net.Tests
}
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true)]
[InlineData(false)]
public async Task Read_LargeLengthSynchronous_Success(bool transferEncodingChunked)
@@ -244,7 +249,8 @@ namespace System.Net.Tests
}
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true)]
[InlineData(false)]
public async Task Read_TooMuchAsynchronous_Success(bool transferEncodingChunked)
@@ -269,7 +275,8 @@ namespace System.Net.Tests
}
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true)]
[InlineData(false)]
public async Task Read_TooMuchSynchronous_Success(bool transferEncodingChunked)
@@ -294,7 +301,8 @@ namespace System.Net.Tests
}
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true)]
[InlineData(false)]
public async Task Read_NotEnoughThenCloseAsynchronous_Success(bool transferEncodingChunked)
@@ -319,6 +327,7 @@ namespace System.Net.Tests
}
[Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true)]
[InlineData(false)]
public async Task Read_Disposed_ReturnsZero(bool transferEncodingChunked)
@@ -347,6 +356,7 @@ namespace System.Net.Tests
}
[Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task CanSeek_Get_ReturnsFalse()
{
HttpListenerRequest response = await _helper.GetRequest(chunked: true);
@@ -365,6 +375,7 @@ namespace System.Net.Tests
}
[Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task CanRead_Get_ReturnsTrue()
{
HttpListenerRequest request = await _helper.GetRequest(chunked: true);
@@ -375,6 +386,7 @@ namespace System.Net.Tests
}
[Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task CanWrite_Get_ReturnsFalse()
{
HttpListenerRequest request = await _helper.GetRequest(chunked: true);
@@ -393,6 +405,7 @@ namespace System.Net.Tests
}
[Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true)]
[InlineData(false)]
public async Task Read_NullBuffer_ThrowsArgumentNullException(bool chunked)
@@ -406,6 +419,7 @@ namespace System.Net.Tests
}
[Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(-1, true)]
[InlineData(3, true)]
[InlineData(-1, false)]
@@ -421,6 +435,7 @@ namespace System.Net.Tests
}
[Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(0, 3, true)]
[InlineData(1, 2, true)]
[InlineData(2, 1, true)]
@@ -438,6 +453,7 @@ namespace System.Net.Tests
}
[Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true)]
[InlineData(false)]
public async Task EndRead_NullAsyncResult_ThrowsArgumentNullException(bool chunked)
@@ -450,6 +466,7 @@ namespace System.Net.Tests
}
[Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true)]
[InlineData(false)]
public async Task EndRead_InvalidAsyncResult_ThrowsArgumentException(bool chunked)
@@ -468,6 +485,7 @@ namespace System.Net.Tests
}
[Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true)]
[InlineData(false)]
public async Task EndRead_CalledTwice_ThrowsInvalidOperationException(bool chunked)
@@ -482,7 +500,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))] // [ActiveIssue(20246, TestPlatforms.AnyUnix)] // CI hanging frequently, [ActiveIssue(19983, platforms: TestPlatforms.AnyUnix)] // No exception thrown
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task Read_FromClosedConnectionAsynchronously_ThrowsHttpListenerException()
{
const string Text = "Some-String";
@@ -505,13 +524,11 @@ namespace System.Net.Tests
byte[] buffer = new byte[expected.Length];
await Assert.ThrowsAsync<HttpListenerException>(() => context.Request.InputStream.ReadAsync(buffer, 0, buffer.Length));
await Assert.ThrowsAsync<HttpListenerException>(() => context.Request.InputStream.ReadAsync(buffer, 0, buffer.Length));
-
- // Closing a response from a closed client if no writing has failed should fail.
- Assert.Throws<HttpListenerException>(() => context.Response.Close());
}
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))] // [ActiveIssue(20246, TestPlatforms.AnyUnix)] // CI hanging frequently, [ActiveIssue(19983, platforms: TestPlatforms.AnyUnix)] // No exception thrown
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task Read_FromClosedConnectionSynchronously_ThrowsHttpListenerException()
{
const string Text = "Some-String";
@@ -534,9 +551,6 @@ namespace System.Net.Tests
byte[] buffer = new byte[expected.Length];
Assert.Throws<HttpListenerException>(() => context.Request.InputStream.Read(buffer, 0, buffer.Length));
Assert.Throws<HttpListenerException>(() => context.Request.InputStream.Read(buffer, 0, buffer.Length));
-
- // Closing a response from a closed client if no writing has occured should fail.
- Assert.Throws<HttpListenerException>(() => context.Response.Close());
}
}
}
diff --git a/src/System.Net.HttpListener/tests/HttpResponseStreamTests.cs b/src/System.Net.HttpListener/tests/HttpResponseStreamTests.cs
index e06bc2ee6a..03ee1d6125 100644
--- a/src/System.Net.HttpListener/tests/HttpResponseStreamTests.cs
+++ b/src/System.Net.HttpListener/tests/HttpResponseStreamTests.cs
@@ -32,7 +32,8 @@ namespace System.Net.Tests
_helper.Dispose();
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true)]
[InlineData(false)]
public async Task SimpleRequest_WriteAsynchronously_Succeeds(bool sendChunked)
@@ -70,7 +71,8 @@ namespace System.Net.Tests
}
}
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true)]
[InlineData(false)]
public async Task SimpleRequest_WriteSynchronouslyNonEmpty_Succeeds(bool sendChunked)
@@ -108,7 +110,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task SimpleRequest_WriteAsynchronouslyInParts_Succeeds()
{
const string expectedResponse = "hello from HttpListener";
@@ -137,7 +140,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task SimpleRequest_WriteSynchronouslyInParts_Succeeds()
{
const string expectedResponse = "hello from HttpListener";
@@ -166,7 +170,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task SimpleRequest_WriteAynchronouslyEmpty_Succeeds()
{
Task<HttpListenerContext> serverContextTask = _listener.GetContextAsync();
@@ -189,7 +194,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task SimpleRequest_WriteSynchronouslyEmpty_Succeeds()
{
Task<HttpListenerContext> serverContextTask = _listener.GetContextAsync();
@@ -213,6 +219,7 @@ namespace System.Net.Tests
}
[Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task CanSeek_Get_ReturnsFalse()
{
using (HttpListenerResponse response = await _helper.GetResponse())
@@ -231,6 +238,7 @@ namespace System.Net.Tests
}
[Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task CanRead_Get_ReturnsFalse()
{
using (HttpListenerResponse response = await _helper.GetResponse())
@@ -245,6 +253,7 @@ namespace System.Net.Tests
}
[Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task CanWrite_Get_ReturnsTrue()
{
using (HttpListenerResponse response = await _helper.GetResponse())
@@ -259,6 +268,7 @@ namespace System.Net.Tests
}
[Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task Write_NullBuffer_ThrowsArgumentNullException()
{
using (HttpListenerResponse response = await _helper.GetResponse())
@@ -269,6 +279,7 @@ namespace System.Net.Tests
}
}
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[Theory]
[InlineData(-1)]
[InlineData(3)]
@@ -282,6 +293,7 @@ namespace System.Net.Tests
}
}
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[Theory]
[InlineData(0, 3)]
[InlineData(1, 2)]
@@ -296,7 +308,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))] // [ActiveIssue(20201, TestPlatforms.AnyUnix)]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))] // [ActiveIssue(20201, TestPlatforms.AnyUnix)]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task Write_TooMuch_ThrowsProtocolViolationException()
{
using (HttpClient client = new HttpClient())
@@ -324,7 +337,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))] // [ActiveIssue(20201, TestPlatforms.AnyUnix)]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))] // [ActiveIssue(20201, TestPlatforms.AnyUnix)]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task Write_TooLittleAsynchronouslyAndClose_ThrowsInvalidOperationException()
{
using (HttpClient client = new HttpClient())
@@ -344,13 +358,14 @@ namespace System.Net.Tests
Assert.Throws<InvalidOperationException>(() => output.Close());
// Write the final byte and make sure we can close.
- await output.WriteAsync(new byte[1], 0, 1);
+ await output.WriteAsync(new byte[1],0, 1);
output.Close();
}
}
}
- [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementationAndNotUap))] // [ActiveIssue(20201, TestPlatforms.AnyUnix)]
+ [ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))] // [ActiveIssue(20201, TestPlatforms.AnyUnix)]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task Write_TooLittleSynchronouslyAndClose_ThrowsInvalidOperationException()
{
using (HttpClient client = new HttpClient())
@@ -378,7 +393,8 @@ namespace System.Net.Tests
[ActiveIssue(20246)] // CI hanging frequently
[ActiveIssue(19534, TestPlatforms.OSX)]
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true)]
[InlineData(false)]
public async Task Write_HeadersToClosedConnectionAsynchronously_ThrowsHttpListenerException(bool ignoreWriteExceptions)
@@ -417,7 +433,8 @@ namespace System.Net.Tests
[ActiveIssue(20246)] // CI hanging frequently
[ActiveIssue(19534, TestPlatforms.OSX)]
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true)]
[InlineData(false)]
public async Task Write_HeadersToClosedConnectionSynchronously_ThrowsHttpListenerException(bool ignoreWriteExceptions)
@@ -456,7 +473,8 @@ namespace System.Net.Tests
}
[ActiveIssue(19534, TestPlatforms.OSX)]
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true)]
[InlineData(false)]
[ActiveIssue(18188, platforms: TestPlatforms.Windows)] // Indeterminate failure - socket not always fully disconnected.
@@ -496,7 +514,8 @@ namespace System.Net.Tests
}
[ActiveIssue(19534, TestPlatforms.OSX)]
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(true)]
[InlineData(false)]
[ActiveIssue(18188, platforms: TestPlatforms.Windows)] // Indeterminate failure - socket not always fully disconnected.
@@ -535,6 +554,7 @@ namespace System.Net.Tests
}
}
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[Theory]
[InlineData(true)]
[InlineData(false)]
@@ -548,6 +568,7 @@ namespace System.Net.Tests
}
}
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[Fact]
public async Task EndWrite_InvalidAsyncResult_ThrowsArgumentException()
{
@@ -563,6 +584,7 @@ namespace System.Net.Tests
}
}
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[Fact]
public async Task EndWrite_CalledTwice_ThrowsInvalidOperationException()
{
diff --git a/src/System.Net.HttpListener/tests/InvalidClientRequestTests.cs b/src/System.Net.HttpListener/tests/InvalidClientRequestTests.cs
index be7e9068e0..48c784cf04 100644
--- a/src/System.Net.HttpListener/tests/InvalidClientRequestTests.cs
+++ b/src/System.Net.HttpListener/tests/InvalidClientRequestTests.cs
@@ -91,7 +91,8 @@ namespace System.Net.Tests
yield return new object[] { "PUT {path} HTTP/1.1", null, null, null, "Length Required" };
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task GetContext_InvalidRequest_DoesNotGetContext()
{
// These tests take upwards of 20s if this uses [Theory].
diff --git a/src/System.Net.HttpListener/tests/SimpleHttpTests.cs b/src/System.Net.HttpListener/tests/SimpleHttpTests.cs
index 8c332679d4..4d702a27ca 100644
--- a/src/System.Net.HttpListener/tests/SimpleHttpTests.cs
+++ b/src/System.Net.HttpListener/tests/SimpleHttpTests.cs
@@ -21,13 +21,15 @@ namespace System.Net.Tests
public void Dispose() => _factory.Dispose();
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public static void Supported_True()
{
Assert.True(HttpListener.IsSupported);
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void BasicTest_StartStop_NoException()
{
HttpListener listener = new HttpListener();
@@ -43,7 +45,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void BasicTest_StartCloseAbort_NoException()
{
HttpListener listener = new HttpListener();
@@ -59,7 +62,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void BasicTest_StartAbortClose_NoException()
{
HttpListener listener = new HttpListener();
@@ -75,7 +79,8 @@ namespace System.Net.Tests
}
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void BasicTest_StopNoStart_NoException()
{
HttpListener listener = new HttpListener();
@@ -83,21 +88,24 @@ namespace System.Net.Tests
listener.Close();
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void BasicTest_CloseNoStart_NoException()
{
HttpListener listener = new HttpListener();
listener.Close();
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void BasicTest_AbortNoStart_NoException()
{
HttpListener listener = new HttpListener();
listener.Abort();
}
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public void BasicTest_StartThrowsAbortCalledInFinally_AbortDoesntThrow()
{
HttpListener listener = new HttpListener();
@@ -118,10 +126,12 @@ namespace System.Net.Tests
}
[ActiveIssue(19754)] // Recombine into UnknownHeaders_Success when fixed
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public Task UnknownHeaders_Success_Large() => UnknownHeaders_Success(1000);
- [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Theory]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
[InlineData(100)]
public async Task UnknownHeaders_Success(int numHeaders)
{
diff --git a/src/System.Net.HttpListener/tests/WebSocketTests.cs b/src/System.Net.HttpListener/tests/WebSocketTests.cs
index f6bb8c26b1..c2d593d6ac 100644
--- a/src/System.Net.HttpListener/tests/WebSocketTests.cs
+++ b/src/System.Net.HttpListener/tests/WebSocketTests.cs
@@ -23,7 +23,8 @@ namespace System.Net.Tests
public void Dispose() => _factory.Dispose();
- [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
+ [Fact]
+ [ActiveIssue(17462, TargetFrameworkMonikers.Uap)]
public async Task AcceptWebSocketAsync_NullSubProtocol_Succeeds()
{
if (PlatformDetection.IsWindows7)
diff --git a/src/System.Net.Mail/tests/Functional/LoggingTest.cs b/src/System.Net.Mail/tests/Functional/LoggingTest.cs
index ffaaeee545..276b9e86c4 100644
--- a/src/System.Net.Mail/tests/Functional/LoggingTest.cs
+++ b/src/System.Net.Mail/tests/Functional/LoggingTest.cs
@@ -26,6 +26,7 @@ namespace System.Net.Mail.Tests
[Fact]
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "NetEventSource is only part of .NET Core")]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909 - RemoteInvoke() returns null Process", TargetFrameworkMonikers.UapAot)]
public void EventSource_EventsRaisedAsExpected()
{
RemoteInvoke(() =>
diff --git a/src/System.Net.Mail/tests/Functional/SmtpExceptionTest.cs b/src/System.Net.Mail/tests/Functional/SmtpExceptionTest.cs
index d343e0f28e..be4bccda56 100644
--- a/src/System.Net.Mail/tests/Functional/SmtpExceptionTest.cs
+++ b/src/System.Net.Mail/tests/Functional/SmtpExceptionTest.cs
@@ -86,6 +86,7 @@ namespace System.Net.Mail.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19585 - System.Exception not serializable - NotImplemented", TargetFrameworkMonikers.UapAot)]
public void TestConstructorThrowsNull()
{
Assert.Throws<ArgumentNullException>(() => new MySmtpException((SerializationInfo)null, new StreamingContext()));
diff --git a/src/System.Net.NetworkInformation/tests/UnitTests/NetworkInterfaceTest.cs b/src/System.Net.NetworkInformation/tests/UnitTests/NetworkInterfaceTest.cs
index 74c9888d0b..8ed90eff31 100644
--- a/src/System.Net.NetworkInformation/tests/UnitTests/NetworkInterfaceTest.cs
+++ b/src/System.Net.NetworkInformation/tests/UnitTests/NetworkInterfaceTest.cs
@@ -11,7 +11,7 @@ namespace System.Net.NetworkInformation.Unit.Tests
public class NetworkInterfaceTest
{
[Fact]
- [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "dotnet/corefx #17993")]
+ [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework | TargetFrameworkMonikers.UapAot, "dotnet/corefx #17993")]
public void GetIsNetworkAvailable_ConnectionProfileNotPresent_ReturnsFalse()
{
FakeNetwork.IsConnectionProfilePresent = false;
@@ -19,7 +19,7 @@ namespace System.Net.NetworkInformation.Unit.Tests
}
[Fact]
- [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "dotnet/corefx #17993")]
+ [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework | TargetFrameworkMonikers.UapAot, "dotnet/corefx #17993")]
public void GetIsNetworkAvailable_NetworkConnectivityLevelIsNone_ReturnsFalse()
{
FakeNetwork.IsConnectionProfilePresent = true;
diff --git a/src/System.Net.Ping/tests/FunctionalTests/PingTest.cs b/src/System.Net.Ping/tests/FunctionalTests/PingTest.cs
index 460dd5c859..bedf071bf5 100644
--- a/src/System.Net.Ping/tests/FunctionalTests/PingTest.cs
+++ b/src/System.Net.Ping/tests/FunctionalTests/PingTest.cs
@@ -81,6 +81,7 @@ namespace System.Net.NetworkInformation.Tests
}
[Fact]
+ [ActiveIssue(20130, TargetFrameworkMonikers.Uap)]
public async Task SendPingAsyncWithIPAddress()
{
IPAddress localIpAddress = await TestSettings.GetLocalIPAddress();
@@ -95,6 +96,7 @@ namespace System.Net.NetworkInformation.Tests
}
[Fact]
+ [ActiveIssue(20130, TargetFrameworkMonikers.Uap)]
public async Task SendPingAsyncWithIPAddress_AddressAsString()
{
IPAddress localIpAddress = await TestSettings.GetLocalIPAddress();
@@ -109,6 +111,7 @@ namespace System.Net.NetworkInformation.Tests
}
[Fact]
+ [ActiveIssue(20130, TargetFrameworkMonikers.Uap)]
public async Task SendPingAsyncWithIPAddressAndTimeout()
{
IPAddress localIpAddress = await TestSettings.GetLocalIPAddress();
@@ -123,6 +126,7 @@ namespace System.Net.NetworkInformation.Tests
}
[PlatformSpecific(TestPlatforms.Windows)] // On Unix, Non-root pings cannot send arbitrary data in the buffer, and do not receive it back in the PingReply.
+ [ActiveIssue(20130, TargetFrameworkMonikers.Uap)]
[Fact]
public async Task SendPingAsyncWithIPAddressAndTimeoutAndBuffer()
{
@@ -167,6 +171,7 @@ namespace System.Net.NetworkInformation.Tests
}
[PlatformSpecific(TestPlatforms.Windows)] // On Unix, Non-root pings cannot send arbitrary data in the buffer, and do not receive it back in the PingReply.
+ [ActiveIssue(20130, TargetFrameworkMonikers.Uap)]
[Fact]
public async Task SendPingAsyncWithIPAddressAndTimeoutAndBufferAndPingOptions()
{
@@ -212,6 +217,7 @@ namespace System.Net.NetworkInformation.Tests
}
[Fact]
+ [ActiveIssue(20130, TargetFrameworkMonikers.Uap)]
public async Task SendPingAsyncWithHost()
{
IPAddress localIpAddress = await TestSettings.GetLocalIPAddress();
@@ -226,6 +232,7 @@ namespace System.Net.NetworkInformation.Tests
}
[Fact]
+ [ActiveIssue(20130, TargetFrameworkMonikers.Uap)]
public async Task SendPingAsyncWithHostAndTimeout()
{
IPAddress localIpAddress = await TestSettings.GetLocalIPAddress();
@@ -240,6 +247,7 @@ namespace System.Net.NetworkInformation.Tests
}
[PlatformSpecific(TestPlatforms.Windows)] // On Unix, Non-root pings cannot send arbitrary data in the buffer, and do not receive it back in the PingReply.
+ [ActiveIssue(20130, TargetFrameworkMonikers.Uap)]
[Fact]
public async Task SendPingAsyncWithHostAndTimeoutAndBuffer()
{
@@ -284,6 +292,7 @@ namespace System.Net.NetworkInformation.Tests
}
[PlatformSpecific(TestPlatforms.Windows)] // On Unix, Non-root pings cannot send arbitrary data in the buffer, and do not receive it back in the PingReply.
+ [ActiveIssue(20130, TargetFrameworkMonikers.Uap)]
[Fact]
public async Task SendPingAsyncWithHostAndTimeoutAndBufferAndPingOptions()
{
@@ -328,6 +337,7 @@ namespace System.Net.NetworkInformation.Tests
}
[Fact]
+ [ActiveIssue(20130, TargetFrameworkMonikers.Uap)]
public static async Task SendPings_ReuseInstance_Hostname()
{
IPAddress localIpAddress = await TestSettings.GetLocalIPAddress();
@@ -344,6 +354,7 @@ namespace System.Net.NetworkInformation.Tests
}
[Fact]
+ [ActiveIssue(20130, TargetFrameworkMonikers.Uap)]
public static async Task Sends_ReuseInstance_Hostname()
{
IPAddress localIpAddress = await TestSettings.GetLocalIPAddress();
@@ -360,6 +371,7 @@ namespace System.Net.NetworkInformation.Tests
}
[Fact]
+ [ActiveIssue(20130, TargetFrameworkMonikers.Uap)]
public static async Task SendAsyncs_ReuseInstance_Hostname()
{
IPAddress localIpAddress = await TestSettings.GetLocalIPAddress();
@@ -411,6 +423,7 @@ namespace System.Net.NetworkInformation.Tests
}
[Fact]
+ [ActiveIssue(20130, TargetFrameworkMonikers.Uap)]
public static async Task Ping_DisposeAfterSend_Success()
{
Ping p = new Ping();
@@ -419,6 +432,7 @@ namespace System.Net.NetworkInformation.Tests
}
[Fact]
+ [ActiveIssue(20130, TargetFrameworkMonikers.Uap)]
public static void Ping_DisposeMultipletimes_Success()
{
Ping p = new Ping();
@@ -427,6 +441,7 @@ namespace System.Net.NetworkInformation.Tests
}
[Fact]
+ [ActiveIssue(20130, TargetFrameworkMonikers.Uap)]
public static void Ping_SendAfterDispose_ThrowsSynchronously()
{
Ping p = new Ping();
diff --git a/src/System.Net.Primitives/src/System/Net/Cookie.cs b/src/System.Net.Primitives/src/System/Net/Cookie.cs
index 4a778dac82..9f6babbd42 100644
--- a/src/System.Net.Primitives/src/System/Net/Cookie.cs
+++ b/src/System.Net.Primitives/src/System/Net/Cookie.cs
@@ -42,26 +42,26 @@ namespace System.Net
internal static readonly char[] ReservedToName = new char[] { ' ', '\t', '\r', '\n', '=', ';', ',' };
internal static readonly char[] ReservedToValue = new char[] { ';', ',' };
- private string _comment = string.Empty;
- private Uri _commentUri = null;
- private CookieVariant _cookieVariant = CookieVariant.Plain;
- private bool _discard = false;
- private string _domain = string.Empty;
- private bool _domainImplicit = true;
- private DateTime _expires = DateTime.MinValue;
- private string _name = string.Empty;
- private string _path = string.Empty;
- private bool _pathImplicit = true;
- private string _port = string.Empty;
- private bool _portImplicit = true;
- private int[] _portList = null;
- private bool _secure = false;
- private bool _httpOnly = false;
- private DateTime _timeStamp = DateTime.Now;
- private string _value = string.Empty;
- private int _version = 0;
-
- private string _domainKey = string.Empty;
+ private string m_comment = string.Empty; // Do not rename (binary serialization)
+ private Uri m_commentUri = null; // Do not rename (binary serialization)
+ private CookieVariant m_cookieVariant = CookieVariant.Plain; // Do not rename (binary serialization)
+ private bool m_discard = false; // Do not rename (binary serialization)
+ private string m_domain = string.Empty; // Do not rename (binary serialization)
+ private bool m_domainImplicit = true; // Do not rename (binary serialization)
+ private DateTime m_expires = DateTime.MinValue; // Do not rename (binary serialization)
+ private string m_name = string.Empty; // Do not rename (binary serialization)
+ private string m_path = string.Empty; // Do not rename (binary serialization)
+ private bool m_pathImplicit = true; // Do not rename (binary serialization)
+ private string m_port = string.Empty; // Do not rename (binary serialization)
+ private bool m_portImplicit = true; // Do not rename (binary serialization)
+ private int[] m_portList = null; // Do not rename (binary serialization)
+ private bool m_secure = false; // Do not rename (binary serialization)
+ private bool m_httpOnly = false; // Do not rename (binary serialization)
+ private DateTime m_timeStamp = DateTime.Now; // Do not rename (binary serialization)
+ private string m_value = string.Empty; // Do not rename (binary serialization)
+ private int m_version = 0; // Do not rename (binary serialization)
+
+ private string m_domainKey = string.Empty; // Do not rename (binary serialization)
internal bool IsQuotedVersion = false;
internal bool IsQuotedDomain = false;
@@ -98,11 +98,11 @@ namespace System.Net
{
get
{
- return _comment;
+ return m_comment;
}
set
{
- _comment = value ?? string.Empty;
+ m_comment = value ?? string.Empty;
}
}
@@ -110,11 +110,11 @@ namespace System.Net
{
get
{
- return _commentUri;
+ return m_commentUri;
}
set
{
- _commentUri = value;
+ m_commentUri = value;
}
}
@@ -123,11 +123,11 @@ namespace System.Net
{
get
{
- return _httpOnly;
+ return m_httpOnly;
}
set
{
- _httpOnly = value;
+ m_httpOnly = value;
}
}
@@ -136,11 +136,11 @@ namespace System.Net
{
get
{
- return _discard;
+ return m_discard;
}
set
{
- _discard = value;
+ m_discard = value;
}
}
@@ -148,13 +148,13 @@ namespace System.Net
{
get
{
- return _domain;
+ return m_domain;
}
set
{
- _domain = value ?? string.Empty;
- _domainImplicit = false;
- _domainKey = string.Empty; // _domainKey will be set when adding this cookie to a container.
+ m_domain = value ?? string.Empty;
+ m_domainImplicit = false;
+ m_domainKey = string.Empty; // _domainKey will be set when adding this cookie to a container.
}
}
@@ -162,11 +162,11 @@ namespace System.Net
{
get
{
- return _domainImplicit;
+ return m_domainImplicit;
}
set
{
- _domainImplicit = value;
+ m_domainImplicit = value;
}
}
@@ -174,13 +174,13 @@ namespace System.Net
{
get
{
- return (_expires != DateTime.MinValue) && (_expires.ToLocalTime() <= DateTime.Now);
+ return (m_expires != DateTime.MinValue) && (m_expires.ToLocalTime() <= DateTime.Now);
}
set
{
if (value == true)
{
- _expires = DateTime.Now;
+ m_expires = DateTime.Now;
}
}
}
@@ -189,11 +189,11 @@ namespace System.Net
{
get
{
- return _expires;
+ return m_expires;
}
set
{
- _expires = value;
+ m_expires = value;
}
}
@@ -201,7 +201,7 @@ namespace System.Net
{
get
{
- return _name;
+ return m_name;
}
set
{
@@ -216,10 +216,10 @@ namespace System.Net
{
if (String.IsNullOrEmpty(value) || value[0] == '$' || value.IndexOfAny(ReservedToName) != -1)
{
- _name = string.Empty;
+ m_name = string.Empty;
return false;
}
- _name = value;
+ m_name = value;
return true;
}
@@ -227,12 +227,12 @@ namespace System.Net
{
get
{
- return _path;
+ return m_path;
}
set
{
- _path = value ?? string.Empty;
- _pathImplicit = false;
+ m_path = value ?? string.Empty;
+ m_pathImplicit = false;
}
}
@@ -246,34 +246,34 @@ namespace System.Net
internal Cookie Clone()
{
- Cookie clonedCookie = new Cookie(_name, _value);
+ Cookie clonedCookie = new Cookie(m_name, m_value);
// Copy over all the properties from the original cookie
- if (!_portImplicit)
+ if (!m_portImplicit)
{
- clonedCookie.Port = _port;
+ clonedCookie.Port = m_port;
}
- if (!_pathImplicit)
+ if (!m_pathImplicit)
{
- clonedCookie.Path = _path;
+ clonedCookie.Path = m_path;
}
- clonedCookie.Domain = _domain;
+ clonedCookie.Domain = m_domain;
// If the domain in the original cookie was implicit, we should preserve that property
- clonedCookie.DomainImplicit = _domainImplicit;
- clonedCookie._timeStamp = _timeStamp;
- clonedCookie.Comment = _comment;
- clonedCookie.CommentUri = _commentUri;
- clonedCookie.HttpOnly = _httpOnly;
- clonedCookie.Discard = _discard;
- clonedCookie.Expires = _expires;
- clonedCookie.Version = _version;
- clonedCookie.Secure = _secure;
+ clonedCookie.DomainImplicit = m_domainImplicit;
+ clonedCookie.m_timeStamp = m_timeStamp;
+ clonedCookie.Comment = m_comment;
+ clonedCookie.CommentUri = m_commentUri;
+ clonedCookie.HttpOnly = m_httpOnly;
+ clonedCookie.Discard = m_discard;
+ clonedCookie.Expires = m_expires;
+ clonedCookie.Version = m_version;
+ clonedCookie.Secure = m_secure;
// The variant is set when we set properties like port/version. So,
// we should copy over the variant from the original cookie after
// we set all other properties
- clonedCookie._cookieVariant = _cookieVariant;
+ clonedCookie.m_cookieVariant = m_cookieVariant;
return clonedCookie;
}
@@ -313,26 +313,26 @@ namespace System.Net
// Since we don't expose Variant to an app, set it to Default
variant = CookieVariant.Default;
}
- _cookieVariant = variant;
+ m_cookieVariant = variant;
}
// Check the name
- if (_name == null || _name.Length == 0 || _name[0] == '$' || _name.IndexOfAny(ReservedToName) != -1)
+ if (m_name == null || m_name.Length == 0 || m_name[0] == '$' || m_name.IndexOfAny(ReservedToName) != -1)
{
if (shouldThrow)
{
- throw new CookieException(SR.Format(SR.net_cookie_attribute, "Name", _name == null ? "<null>" : _name));
+ throw new CookieException(SR.Format(SR.net_cookie_attribute, "Name", m_name == null ? "<null>" : m_name));
}
return false;
}
// Check the value
- if (_value == null ||
- (!(_value.Length > 2 && _value[0] == '\"' && _value[_value.Length - 1] == '\"') && _value.IndexOfAny(ReservedToValue) != -1))
+ if (m_value == null ||
+ (!(m_value.Length > 2 && m_value[0] == '\"' && m_value[m_value.Length - 1] == '\"') && m_value.IndexOfAny(ReservedToValue) != -1))
{
if (shouldThrow)
{
- throw new CookieException(SR.Format(SR.net_cookie_attribute, "Value", _value == null ? "<null>" : _value));
+ throw new CookieException(SR.Format(SR.net_cookie_attribute, "Value", m_value == null ? "<null>" : m_value));
}
return false;
}
@@ -362,13 +362,13 @@ namespace System.Net
// Check/set domain
//
// If domain is implicit => assume a) uri is valid, b) just set domain to uri hostname.
- if (setDefault && _domainImplicit == true)
+ if (setDefault && m_domainImplicit == true)
{
- _domain = host;
+ m_domain = host;
}
else
{
- if (!_domainImplicit)
+ if (!m_domainImplicit)
{
// Forwarding note: If Uri.Host is of IP address form then the only supported case
// is for IMPLICIT domain property of a cookie.
@@ -376,7 +376,7 @@ namespace System.Net
// as a fqdn and reject the cookie.
// Aliasing since we might need the KeyValue (but not the original one).
- string domain = _domain;
+ string domain = m_domain;
// Syntax check for Domain charset plus empty string.
if (!DomainCharsTest(domain))
@@ -395,7 +395,7 @@ namespace System.Net
{
if (shouldThrow)
{
- throw new CookieException(SR.Format(SR.net_cookie_attribute, CookieFields.DomainAttributeName, _domain));
+ throw new CookieException(SR.Format(SR.net_cookie_attribute, CookieFields.DomainAttributeName, m_domain));
}
return false;
}
@@ -446,14 +446,14 @@ namespace System.Net
if (valid)
{
- _domainKey = domain.ToLowerInvariant();
+ m_domainKey = domain.ToLowerInvariant();
}
}
else
{
// For implicitly set domain AND at the set_default == false time
// we simply need to match uri.Host against m_domain.
- if (!string.Equals(host, _domain, StringComparison.OrdinalIgnoreCase))
+ if (!string.Equals(host, m_domain, StringComparison.OrdinalIgnoreCase))
{
valid = false;
}
@@ -462,56 +462,56 @@ namespace System.Net
{
if (shouldThrow)
{
- throw new CookieException(SR.Format(SR.net_cookie_attribute, CookieFields.DomainAttributeName, _domain));
+ throw new CookieException(SR.Format(SR.net_cookie_attribute, CookieFields.DomainAttributeName, m_domain));
}
return false;
}
}
// Check/Set Path
- if (setDefault && _pathImplicit == true)
+ if (setDefault && m_pathImplicit == true)
{
// This code assumes that the URI path is always valid and contains at least one '/'.
- switch (_cookieVariant)
+ switch (m_cookieVariant)
{
case CookieVariant.Plain:
- _path = path;
+ m_path = path;
break;
case CookieVariant.Rfc2109:
- _path = path.Substring(0, path.LastIndexOf('/')); // May be empty
+ m_path = path.Substring(0, path.LastIndexOf('/')); // May be empty
break;
case CookieVariant.Rfc2965:
default:
// NOTE: this code is not resilient against future versions with different 'Path' semantics.
- _path = path.Substring(0, path.LastIndexOf('/') + 1);
+ m_path = path.Substring(0, path.LastIndexOf('/') + 1);
break;
}
}
else
{
// Check current path (implicit/explicit) against given URI.
- if (!path.StartsWith(CookieParser.CheckQuoted(_path)))
+ if (!path.StartsWith(CookieParser.CheckQuoted(m_path)))
{
if (shouldThrow)
{
- throw new CookieException(SR.Format(SR.net_cookie_attribute, CookieFields.PathAttributeName, _path));
+ throw new CookieException(SR.Format(SR.net_cookie_attribute, CookieFields.PathAttributeName, m_path));
}
return false;
}
}
// Set the default port if Port attribute was present but had no value.
- if (setDefault && (_portImplicit == false && _port.Length == 0))
+ if (setDefault && (m_portImplicit == false && m_port.Length == 0))
{
- _portList = new int[1] { port };
+ m_portList = new int[1] { port };
}
- if (_portImplicit == false)
+ if (m_portImplicit == false)
{
// Port must match against the one from the uri.
valid = false;
- foreach (int p in _portList)
+ foreach (int p in m_portList)
{
if (p == port)
{
@@ -523,7 +523,7 @@ namespace System.Net
{
if (shouldThrow)
{
- throw new CookieException(SR.Format(SR.net_cookie_attribute, CookieFields.PortAttributeName, _port));
+ throw new CookieException(SR.Format(SR.net_cookie_attribute, CookieFields.PortAttributeName, m_port));
}
return false;
}
@@ -558,15 +558,15 @@ namespace System.Net
{
get
{
- return _port;
+ return m_port;
}
set
{
- _portImplicit = false;
+ m_portImplicit = false;
if (string.IsNullOrEmpty(value))
{
// "Port" is present but has no value.
- _port = string.Empty;
+ m_port = string.Empty;
}
else
{
@@ -599,10 +599,10 @@ namespace System.Net
portList.Add(port);
}
}
- _portList = portList.ToArray();
- _port = value;
- _version = MaxSupportedVersion;
- _cookieVariant = CookieVariant.Rfc2965;
+ m_portList = portList.ToArray();
+ m_port = value;
+ m_version = MaxSupportedVersion;
+ m_cookieVariant = CookieVariant.Rfc2965;
}
}
}
@@ -613,7 +613,7 @@ namespace System.Net
get
{
// PortList will be null if Port Attribute was omitted in the response.
- return _portList;
+ return m_portList;
}
}
@@ -621,11 +621,11 @@ namespace System.Net
{
get
{
- return _secure;
+ return m_secure;
}
set
{
- _secure = value;
+ m_secure = value;
}
}
@@ -633,7 +633,7 @@ namespace System.Net
{
get
{
- return _timeStamp;
+ return m_timeStamp;
}
}
@@ -641,11 +641,11 @@ namespace System.Net
{
get
{
- return _value;
+ return m_value;
}
set
{
- _value = value ?? string.Empty;
+ m_value = value ?? string.Empty;
}
}
@@ -653,7 +653,7 @@ namespace System.Net
{
get
{
- return _cookieVariant;
+ return m_cookieVariant;
}
set
{
@@ -663,7 +663,7 @@ namespace System.Net
NetEventSource.Fail(this, $"value != Rfc2965:{value}");
}
- _cookieVariant = value;
+ m_cookieVariant = value;
}
}
@@ -674,7 +674,7 @@ namespace System.Net
{
get
{
- return _domainImplicit ? Domain : _domainKey;
+ return m_domainImplicit ? Domain : m_domainKey;
}
}
@@ -682,7 +682,7 @@ namespace System.Net
{
get
{
- return _version;
+ return m_version;
}
set
{
@@ -690,10 +690,10 @@ namespace System.Net
{
throw new ArgumentOutOfRangeException(nameof(value));
}
- _version = value;
- if (value > 0 && _cookieVariant < CookieVariant.Rfc2109)
+ m_version = value;
+ if (value > 0 && m_cookieVariant < CookieVariant.Rfc2109)
{
- _cookieVariant = CookieVariant.Rfc2109;
+ m_cookieVariant = CookieVariant.Rfc2109;
}
}
}
@@ -731,7 +731,7 @@ namespace System.Net
{
sb.Append(SpecialAttributeLiteral + CookieFields.VersionAttributeName + EqualsLiteral); // const strings
if (IsQuotedVersion) sb.Append('"');
- sb.Append(_version.ToString(NumberFormatInfo.InvariantInfo));
+ sb.Append(m_version.ToString(NumberFormatInfo.InvariantInfo));
if (IsQuotedVersion) sb.Append('"');
sb.Append(SeparatorLiteral);
}
@@ -742,30 +742,30 @@ namespace System.Net
if (!Plain)
{
// Add the Path if necessary.
- if (!_pathImplicit && _path.Length > 0)
+ if (!m_pathImplicit && m_path.Length > 0)
{
sb.Append(SeparatorLiteral + SpecialAttributeLiteral + CookieFields.PathAttributeName + EqualsLiteral); // const strings
- sb.Append(_path);
+ sb.Append(m_path);
}
// Add the Domain if necessary.
- if (!_domainImplicit && _domain.Length > 0)
+ if (!m_domainImplicit && m_domain.Length > 0)
{
sb.Append(SeparatorLiteral + SpecialAttributeLiteral + CookieFields.DomainAttributeName + EqualsLiteral); // const strings
if (IsQuotedDomain) sb.Append('"');
- sb.Append(_domain);
+ sb.Append(m_domain);
if (IsQuotedDomain) sb.Append('"');
}
}
// Add the Port if necessary.
- if (!_portImplicit)
+ if (!m_portImplicit)
{
sb.Append(SeparatorLiteral + SpecialAttributeLiteral + CookieFields.PortAttributeName); // const strings
- if (_port.Length > 0)
+ if (m_port.Length > 0)
{
sb.Append(EqualsLiteral);
- sb.Append(_port);
+ sb.Append(m_port);
}
}
@@ -781,21 +781,21 @@ namespace System.Net
internal string ToServerString()
{
string result = Name + EqualsLiteral + Value;
- if (_comment != null && _comment.Length > 0)
+ if (m_comment != null && m_comment.Length > 0)
{
- result += SeparatorLiteral + CookieFields.CommentAttributeName + EqualsLiteral + _comment;
+ result += SeparatorLiteral + CookieFields.CommentAttributeName + EqualsLiteral + m_comment;
}
- if (_commentUri != null)
+ if (m_commentUri != null)
{
- result += SeparatorLiteral + CookieFields.CommentUrlAttributeName + EqualsLiteral + QuotesLiteral + _commentUri.ToString() + QuotesLiteral;
+ result += SeparatorLiteral + CookieFields.CommentUrlAttributeName + EqualsLiteral + QuotesLiteral + m_commentUri.ToString() + QuotesLiteral;
}
- if (_discard)
+ if (m_discard)
{
result += SeparatorLiteral + CookieFields.DiscardAttributeName;
}
- if (!_domainImplicit && _domain != null && _domain.Length > 0)
+ if (!m_domainImplicit && m_domain != null && m_domain.Length > 0)
{
- result += SeparatorLiteral + CookieFields.DomainAttributeName + EqualsLiteral + _domain;
+ result += SeparatorLiteral + CookieFields.DomainAttributeName + EqualsLiteral + m_domain;
}
if (Expires != DateTime.MinValue)
{
@@ -808,18 +808,18 @@ namespace System.Net
}
result += SeparatorLiteral + CookieFields.MaxAgeAttributeName + EqualsLiteral + seconds.ToString(NumberFormatInfo.InvariantInfo);
}
- if (!_pathImplicit && _path != null && _path.Length > 0)
+ if (!m_pathImplicit && m_path != null && m_path.Length > 0)
{
- result += SeparatorLiteral + CookieFields.PathAttributeName + EqualsLiteral + _path;
+ result += SeparatorLiteral + CookieFields.PathAttributeName + EqualsLiteral + m_path;
}
- if (!Plain && !_portImplicit && _port != null && _port.Length > 0)
+ if (!Plain && !m_portImplicit && m_port != null && m_port.Length > 0)
{
// QuotesLiteral are included in _port.
- result += SeparatorLiteral + CookieFields.PortAttributeName + EqualsLiteral + _port;
+ result += SeparatorLiteral + CookieFields.PortAttributeName + EqualsLiteral + m_port;
}
- if (_version > 0)
+ if (m_version > 0)
{
- result += SeparatorLiteral + CookieFields.VersionAttributeName + EqualsLiteral + _version.ToString(NumberFormatInfo.InvariantInfo);
+ result += SeparatorLiteral + CookieFields.VersionAttributeName + EqualsLiteral + m_version.ToString(NumberFormatInfo.InvariantInfo);
}
return result == EqualsLiteral ? null : result;
}
diff --git a/src/System.Net.Primitives/src/System/Net/CookieCollection.cs b/src/System.Net.Primitives/src/System/Net/CookieCollection.cs
index 38ccf53507..5ba5febee2 100644
--- a/src/System.Net.Primitives/src/System/Net/CookieCollection.cs
+++ b/src/System.Net.Primitives/src/System/Net/CookieCollection.cs
@@ -21,10 +21,10 @@ namespace System.Net
SetToMaxUsed = 3,
}
- private readonly List<Cookie> _list = new List<Cookie>();
+ private readonly List<Cookie> m_list = new List<Cookie>();
- private DateTime _timeStamp = DateTime.MinValue;
- private bool _hasOtherVersions;
+ private DateTime m_timeStamp = DateTime.MinValue; // Do not rename (binary serialization)
+ private bool m_has_other_versions; // Do not rename (binary serialization)
public CookieCollection()
{
@@ -34,11 +34,11 @@ namespace System.Net
{
get
{
- if (index < 0 || index >= _list.Count)
+ if (index < 0 || index >= m_list.Count)
{
throw new ArgumentOutOfRangeException(nameof(index));
}
- return _list[index];
+ return m_list[index];
}
}
@@ -46,7 +46,7 @@ namespace System.Net
{
get
{
- foreach (Cookie c in _list)
+ foreach (Cookie c in m_list)
{
if (string.Equals(c.Name, name, StringComparison.OrdinalIgnoreCase))
{
@@ -66,11 +66,11 @@ namespace System.Net
int idx = IndexOf(cookie);
if (idx == -1)
{
- _list.Add(cookie);
+ m_list.Add(cookie);
}
else
{
- _list[idx] = cookie;
+ m_list[idx] = cookie;
}
}
@@ -80,7 +80,7 @@ namespace System.Net
{
throw new ArgumentNullException(nameof(cookies));
}
- foreach (Cookie cookie in cookies._list)
+ foreach (Cookie cookie in cookies.m_list)
{
Add(cookie);
}
@@ -98,7 +98,7 @@ namespace System.Net
{
get
{
- return _list.Count;
+ return m_list.Count;
}
}
@@ -120,12 +120,12 @@ namespace System.Net
public void CopyTo(Array array, int index)
{
- ((ICollection)_list).CopyTo(array, index);
+ ((ICollection)m_list).CopyTo(array, index);
}
public void CopyTo(Cookie[] array, int index)
{
- _list.CopyTo(array, index);
+ m_list.CopyTo(array, index);
}
internal DateTime TimeStamp(Stamp how)
@@ -133,19 +133,19 @@ namespace System.Net
switch (how)
{
case Stamp.Set:
- _timeStamp = DateTime.Now;
+ m_timeStamp = DateTime.Now;
break;
case Stamp.SetToMaxUsed:
- _timeStamp = DateTime.MaxValue;
+ m_timeStamp = DateTime.MaxValue;
break;
case Stamp.SetToUnused:
- _timeStamp = DateTime.MinValue;
+ m_timeStamp = DateTime.MinValue;
break;
case Stamp.Check:
default:
break;
}
- return _timeStamp;
+ return m_timeStamp;
}
@@ -155,7 +155,7 @@ namespace System.Net
{
get
{
- return _hasOtherVersions;
+ return m_has_other_versions;
}
}
@@ -168,7 +168,7 @@ namespace System.Net
if (isStrict)
{
int idx = 0;
- foreach (Cookie c in _list)
+ foreach (Cookie c in m_list)
{
if (CookieComparer.Compare(cookie, c) == 0)
{
@@ -177,24 +177,24 @@ namespace System.Net
// Cookie2 spec requires that new Variant cookie overwrite the old one.
if (c.Variant <= cookie.Variant)
{
- _list[idx] = cookie;
+ m_list[idx] = cookie;
}
break;
}
++idx;
}
- if (idx == _list.Count)
+ if (idx == m_list.Count)
{
- _list.Add(cookie);
+ m_list.Add(cookie);
}
}
else
{
- _list.Add(cookie);
+ m_list.Add(cookie);
}
if (cookie.Version != Cookie.MaxSupportedVersion)
{
- _hasOtherVersions = true;
+ m_has_other_versions = true;
}
return ret;
}
@@ -202,7 +202,7 @@ namespace System.Net
internal int IndexOf(Cookie cookie)
{
int idx = 0;
- foreach (Cookie c in _list)
+ foreach (Cookie c in m_list)
{
if (CookieComparer.Compare(cookie, c) == 0)
{
@@ -215,12 +215,12 @@ namespace System.Net
internal void RemoveAt(int idx)
{
- _list.RemoveAt(idx);
+ m_list.RemoveAt(idx);
}
public IEnumerator GetEnumerator()
{
- return _list.GetEnumerator();
+ return m_list.GetEnumerator();
}
#if DEBUG
diff --git a/src/System.Net.Primitives/src/System/Net/CookieContainer.cs b/src/System.Net.Primitives/src/System/Net/CookieContainer.cs
index f2ef66ebbc..cd65875ba3 100644
--- a/src/System.Net.Primitives/src/System/Net/CookieContainer.cs
+++ b/src/System.Net.Primitives/src/System/Net/CookieContainer.cs
@@ -100,19 +100,19 @@ namespace System.Net
};
// NOTE: all accesses of _domainTable must be performed with _domainTable locked.
- private readonly Dictionary<string, PathList> _domainTable = new Dictionary<string, PathList>();
- private int _maxCookieSize = DefaultCookieLengthLimit;
- private int _maxCookies = DefaultCookieLimit;
- private int _maxCookiesPerDomain = DefaultPerDomainCookieLimit;
- private int _count = 0;
- private string _fqdnMyDomain = string.Empty;
+ private readonly Dictionary<string, PathList> m_domainTable = new Dictionary<string, PathList>(); // Do not rename (binary serialization)
+ private int m_maxCookieSize = DefaultCookieLengthLimit; // Do not rename (binary serialization)
+ private int m_maxCookies = DefaultCookieLimit; // Do not rename (binary serialization)
+ private int m_maxCookiesPerDomain = DefaultPerDomainCookieLimit; // Do not rename (binary serialization)
+ private int m_count = 0; // Do not rename (binary serialization)
+ private string m_fqdnMyDomain = string.Empty; // Do not rename (binary serialization)
public CookieContainer()
{
string domain = HostInformation.DomainName;
if (domain != null && domain.Length > 1)
{
- _fqdnMyDomain = '.' + domain;
+ m_fqdnMyDomain = '.' + domain;
}
// Otherwise it will remain string.Empty.
}
@@ -123,7 +123,7 @@ namespace System.Net
{
throw new ArgumentException(SR.net_toosmall, "Capacity");
}
- _maxCookies = capacity;
+ m_maxCookies = capacity;
}
public CookieContainer(int capacity, int perDomainCapacity, int maxCookieSize) : this(capacity)
@@ -132,12 +132,12 @@ namespace System.Net
{
throw new ArgumentOutOfRangeException(nameof(perDomainCapacity), SR.Format(SR.net_cookie_capacity_range, "PerDomainCapacity", 0, capacity));
}
- _maxCookiesPerDomain = perDomainCapacity;
+ m_maxCookiesPerDomain = perDomainCapacity;
if (maxCookieSize <= 0)
{
throw new ArgumentException(SR.net_toosmall, "MaxCookieSize");
}
- _maxCookieSize = maxCookieSize;
+ m_maxCookieSize = maxCookieSize;
}
// NOTE: after shrinking the capacity, Count can become greater than Capacity.
@@ -145,20 +145,20 @@ namespace System.Net
{
get
{
- return _maxCookies;
+ return m_maxCookies;
}
set
{
- if (value <= 0 || (value < _maxCookiesPerDomain && _maxCookiesPerDomain != Int32.MaxValue))
+ if (value <= 0 || (value < m_maxCookiesPerDomain && m_maxCookiesPerDomain != Int32.MaxValue))
{
- throw new ArgumentOutOfRangeException(nameof(value), SR.Format(SR.net_cookie_capacity_range, "Capacity", 0, _maxCookiesPerDomain));
+ throw new ArgumentOutOfRangeException(nameof(value), SR.Format(SR.net_cookie_capacity_range, "Capacity", 0, m_maxCookiesPerDomain));
}
- if (value < _maxCookies)
+ if (value < m_maxCookies)
{
- _maxCookies = value;
+ m_maxCookies = value;
AgeCookies(null);
}
- _maxCookies = value;
+ m_maxCookies = value;
}
}
@@ -169,7 +169,7 @@ namespace System.Net
{
get
{
- return _count;
+ return m_count;
}
}
@@ -177,7 +177,7 @@ namespace System.Net
{
get
{
- return _maxCookieSize;
+ return m_maxCookieSize;
}
set
{
@@ -185,7 +185,7 @@ namespace System.Net
{
throw new ArgumentOutOfRangeException(nameof(value));
}
- _maxCookieSize = value;
+ m_maxCookieSize = value;
}
}
@@ -196,20 +196,20 @@ namespace System.Net
{
get
{
- return _maxCookiesPerDomain;
+ return m_maxCookiesPerDomain;
}
set
{
- if (value <= 0 || (value > _maxCookies && value != Int32.MaxValue))
+ if (value <= 0 || (value > m_maxCookies && value != Int32.MaxValue))
{
throw new ArgumentOutOfRangeException(nameof(value));
}
- if (value < _maxCookiesPerDomain)
+ if (value < m_maxCookiesPerDomain)
{
- _maxCookiesPerDomain = value;
+ m_maxCookiesPerDomain = value;
AgeCookies(null);
}
- _maxCookiesPerDomain = value;
+ m_maxCookiesPerDomain = value;
}
}
@@ -258,7 +258,7 @@ namespace System.Net
// We don't know cookie verification status, so re-create the cookie and verify it.
Cookie new_cookie = cookie.Clone();
- new_cookie.VerifySetDefaults(new_cookie.Variant, uri, IsLocalDomain(uri.Host), _fqdnMyDomain, true, true);
+ new_cookie.VerifySetDefaults(new_cookie.Variant, uri, IsLocalDomain(uri.Host), m_fqdnMyDomain, true, true);
Add(new_cookie, true);
}
@@ -269,22 +269,22 @@ namespace System.Net
{
PathList pathList;
- if (cookie.Value.Length > _maxCookieSize)
+ if (cookie.Value.Length > m_maxCookieSize)
{
if (throwOnError)
{
- throw new CookieException(SR.Format(SR.net_cookie_size, cookie.ToString(), _maxCookieSize));
+ throw new CookieException(SR.Format(SR.net_cookie_size, cookie.ToString(), m_maxCookieSize));
}
return;
}
try
{
- lock (_domainTable)
+ lock (m_domainTable)
{
- if (!_domainTable.TryGetValue(cookie.DomainKey, out pathList))
+ if (!m_domainTable.TryGetValue(cookie.DomainKey, out pathList))
{
- _domainTable[cookie.DomainKey] = (pathList = PathList.Create());
+ m_domainTable[cookie.DomainKey] = (pathList = PathList.Create());
}
}
int domain_count = pathList.GetCookiesCount();
@@ -310,18 +310,18 @@ namespace System.Net
if (idx != -1)
{
cookies.RemoveAt(idx);
- --_count;
+ --m_count;
}
}
}
else
{
// This is about real cookie adding, check Capacity first
- if (domain_count >= _maxCookiesPerDomain && !AgeCookies(cookie.DomainKey))
+ if (domain_count >= m_maxCookiesPerDomain && !AgeCookies(cookie.DomainKey))
{
return; // Cannot age: reject new cookie
}
- else if (_count >= _maxCookies && !AgeCookies(null))
+ else if (m_count >= m_maxCookies && !AgeCookies(null))
{
return; // Cannot age: reject new cookie
}
@@ -329,7 +329,7 @@ namespace System.Net
// About to change the collection
lock (cookies)
{
- _count += cookies.InternalAdd(cookie, true);
+ m_count += cookies.InternalAdd(cookie, true);
}
}
}
@@ -357,8 +357,8 @@ namespace System.Net
// Param. 'domain' == null means to age in the whole container.
private bool AgeCookies(string domain)
{
- Debug.Assert(_maxCookies != 0);
- Debug.Assert(_maxCookiesPerDomain != 0);
+ Debug.Assert(m_maxCookies != 0);
+ Debug.Assert(m_maxCookiesPerDomain != 0);
int removed = 0;
DateTime oldUsed = DateTime.MaxValue;
@@ -374,15 +374,15 @@ namespace System.Net
float remainingFraction = 1.0F;
// The container was shrunk, might need additional cleanup for each domain
- if (_count > _maxCookies)
+ if (m_count > m_maxCookies)
{
// Means the fraction of the container to be left.
// Each domain will be cut accordingly.
- remainingFraction = (float)_maxCookies / (float)_count;
+ remainingFraction = (float)m_maxCookies / (float)m_count;
}
- lock (_domainTable)
+ lock (m_domainTable)
{
- foreach (KeyValuePair<string, PathList> entry in _domainTable)
+ foreach (KeyValuePair<string, PathList> entry in m_domainTable)
{
if (domain == null)
{
@@ -392,7 +392,7 @@ namespace System.Net
else
{
tempDomain = domain;
- _domainTable.TryGetValue(domain, out pathList);
+ m_domainTable.TryGetValue(domain, out pathList);
}
domain_count = 0; // Cookies in the domain
@@ -403,7 +403,7 @@ namespace System.Net
CookieCollection cc = pair.Value;
itemp = ExpireCollection(cc);
removed += itemp;
- _count -= itemp; // Update this container's count
+ m_count -= itemp; // Update this container's count
domain_count += cc.Count;
// We also find the least used cookie collection in ENTIRE container.
@@ -418,7 +418,7 @@ namespace System.Net
}
// Check if we have reduced to the limit of the domain by expiration only.
- int min_count = Math.Min((int)(domain_count * remainingFraction), Math.Min(_maxCookiesPerDomain, _maxCookies) - 1);
+ int min_count = Math.Min((int)(domain_count * remainingFraction), Math.Min(m_maxCookiesPerDomain, m_maxCookies) - 1);
if (domain_count > min_count)
{
// This case requires sorting all domain collections by timestamp.
@@ -446,7 +446,7 @@ namespace System.Net
{
cc.RemoveAt(0);
--domain_count;
- --_count;
+ --m_count;
++removed;
}
}
@@ -489,10 +489,10 @@ namespace System.Net
// Remove oldest cookies from the least used collection.
lock (lruCc)
{
- while (_count >= _maxCookies && lruCc.Count > 0)
+ while (m_count >= m_maxCookies && lruCc.Count > 0)
{
lruCc.RemoveAt(0);
- --_count;
+ --m_count;
}
}
return true;
@@ -553,7 +553,7 @@ namespace System.Net
}
// Test domain membership.
- if (string.Compare(_fqdnMyDomain, 0, host, dot, _fqdnMyDomain.Length, StringComparison.OrdinalIgnoreCase) == 0)
+ if (string.Compare(m_fqdnMyDomain, 0, host, dot, m_fqdnMyDomain.Length, StringComparison.OrdinalIgnoreCase) == 0)
{
return true;
}
@@ -611,7 +611,7 @@ namespace System.Net
throw new ArgumentNullException(nameof(cookie));
}
Cookie new_cookie = cookie.Clone();
- new_cookie.VerifySetDefaults(new_cookie.Variant, uri, IsLocalDomain(uri.Host), _fqdnMyDomain, true, true);
+ new_cookie.VerifySetDefaults(new_cookie.Variant, uri, IsLocalDomain(uri.Host), m_fqdnMyDomain, true, true);
Add(new_cookie, true);
}
@@ -631,7 +631,7 @@ namespace System.Net
foreach (Cookie c in cookies)
{
Cookie new_cookie = c.Clone();
- new_cookie.VerifySetDefaults(new_cookie.Variant, uri, isLocalDomain, _fqdnMyDomain, true, true);
+ new_cookie.VerifySetDefaults(new_cookie.Variant, uri, isLocalDomain, m_fqdnMyDomain, true, true);
Add(new_cookie, true);
}
}
@@ -687,7 +687,7 @@ namespace System.Net
// This will set the default values from the response URI
// AND will check for cookie validity
- if (!cookie.VerifySetDefaults(variant, uri, isLocalDomain, _fqdnMyDomain, true, isThrow))
+ if (!cookie.VerifySetDefaults(variant, uri, isLocalDomain, m_fqdnMyDomain, true, isThrow))
{
continue;
}
@@ -727,7 +727,7 @@ namespace System.Net
internal CookieCollection InternalGetCookies(Uri uri)
{
- if (_count == 0)
+ if (m_count == 0)
{
return null;
}
@@ -752,11 +752,11 @@ namespace System.Net
// DNS.resolve may return short names even for other inet domains ;-(
// We _don't_ know what the exact domain is, so try also grab short hostname cookies.
// Grab long name from the local domain
- if (_fqdnMyDomain != null && _fqdnMyDomain.Length != 0)
+ if (m_fqdnMyDomain != null && m_fqdnMyDomain.Length != 0)
{
- domainAttributeMatchAnyCookieVariant.Add(fqdnRemote + _fqdnMyDomain);
+ domainAttributeMatchAnyCookieVariant.Add(fqdnRemote + m_fqdnMyDomain);
// Grab the local domain itself
- domainAttributeMatchAnyCookieVariant.Add(_fqdnMyDomain);
+ domainAttributeMatchAnyCookieVariant.Add(m_fqdnMyDomain);
}
}
else
@@ -807,9 +807,9 @@ namespace System.Net
bool found = false;
bool defaultAdded = false;
PathList pathList;
- lock (_domainTable)
+ lock (m_domainTable)
{
- if (!_domainTable.TryGetValue(domainAttribute[i], out pathList))
+ if (!m_domainTable.TryGetValue(domainAttribute[i], out pathList))
{
continue;
}
@@ -855,9 +855,9 @@ namespace System.Net
// (This is the only place that does domain removal)
if (pathList.Count == 0)
{
- lock (_domainTable)
+ lock (m_domainTable)
{
- _domainTable.Remove(domainAttribute[i]);
+ m_domainTable.Remove(domainAttribute[i]);
}
}
}
@@ -878,7 +878,7 @@ namespace System.Net
{
// If expired, remove from container and don't add to the destination
source.RemoveAt(idx);
- --_count;
+ --m_count;
--idx;
}
else
diff --git a/src/System.Net.Primitives/tests/FunctionalTests/CookieContainerTest.cs b/src/System.Net.Primitives/tests/FunctionalTests/CookieContainerTest.cs
index f0e2a351ef..8354ad83aa 100644
--- a/src/System.Net.Primitives/tests/FunctionalTests/CookieContainerTest.cs
+++ b/src/System.Net.Primitives/tests/FunctionalTests/CookieContainerTest.cs
@@ -151,6 +151,7 @@ namespace System.Net.Primitives.Functional.Tests
[Theory]
[MemberData(nameof(SetCookiesInvalidData))]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20482", TargetFrameworkMonikers.UapAot)]
public static void SetCookies_InvalidData_Throws(Uri uri, string cookieHeader)
{
CookieContainer cc = new CookieContainer();
diff --git a/src/System.Net.Security/tests/UnitTests/System.Net.Security.Unit.Tests.csproj b/src/System.Net.Security/tests/UnitTests/System.Net.Security.Unit.Tests.csproj
index 8a358032d2..c83e15d181 100644
--- a/src/System.Net.Security/tests/UnitTests/System.Net.Security.Unit.Tests.csproj
+++ b/src/System.Net.Security/tests/UnitTests/System.Net.Security.Unit.Tests.csproj
@@ -26,6 +26,9 @@
<Compile Include="Fakes\FakeAuthenticatedStream.cs" />
<Compile Include="Fakes\FakeLazyAsyncResult.cs" />
<!-- Common test files -->
+ <Compile Include="$(CommonTestPath)\System\AssertExtensions.cs">
+ <Link>Common\System\AssertExtensions.cs</Link>
+ </Compile>
<Compile Include="$(CommonTestPath)\System\Net\SslProtocolSupport.cs">
<Link>CommonTest\System\Net\SslProtocolSupport.cs</Link>
</Compile>
diff --git a/src/System.Net.Security/tests/UnitTests/System/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicyTest.cs b/src/System.Net.Security/tests/UnitTests/System/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicyTest.cs
index f0bfc051d5..b1e0817fcc 100644
--- a/src/System.Net.Security/tests/UnitTests/System/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicyTest.cs
+++ b/src/System.Net.Security/tests/UnitTests/System/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicyTest.cs
@@ -14,7 +14,7 @@ namespace System.Net.Security.Tests
[Fact]
public void Constructor_PolicyEnforcement_NeverParam()
{
- var ex = Assert.Throws<ArgumentException>("policyEnforcement", () => new ExtendedProtectionPolicy(PolicyEnforcement.Never, ProtectionScenario.TransportSelected, null));
+ var ex = AssertExtensions.Throws<ArgumentException>("policyEnforcement", () => new ExtendedProtectionPolicy(PolicyEnforcement.Never, ProtectionScenario.TransportSelected, null));
Assert.Equal(typeof(ArgumentException), ex.GetType());
}
@@ -22,14 +22,14 @@ namespace System.Net.Security.Tests
public void Constructor_ServiceNameCollection_ZeroElementsParam()
{
var paramValue = new ServiceNameCollection(new List<string>());
- var ex = Assert.Throws<ArgumentException>("customServiceNames", () => new ExtendedProtectionPolicy(PolicyEnforcement.Always, ProtectionScenario.TransportSelected, paramValue));
+ var ex = AssertExtensions.Throws<ArgumentException>("customServiceNames", () => new ExtendedProtectionPolicy(PolicyEnforcement.Always, ProtectionScenario.TransportSelected, paramValue));
Assert.Equal(typeof(ArgumentException), ex.GetType());
}
[Fact]
public void Constructor_ChannelBinding_NullParam()
{
- var ex = Assert.Throws<ArgumentNullException>("customChannelBinding", () => new ExtendedProtectionPolicy(PolicyEnforcement.Always, null));
+ var ex = AssertExtensions.Throws<ArgumentNullException>("customChannelBinding", () => new ExtendedProtectionPolicy(PolicyEnforcement.Always, null));
Assert.Equal(typeof(ArgumentNullException), ex.GetType());
}
diff --git a/src/System.Net.WebClient/tests/WebClientTest.cs b/src/System.Net.WebClient/tests/WebClientTest.cs
index da2897ad8b..b12ce47b30 100644
--- a/src/System.Net.WebClient/tests/WebClientTest.cs
+++ b/src/System.Net.WebClient/tests/WebClientTest.cs
@@ -364,6 +364,7 @@ namespace System.Net.Tests
}
}
+ [ActiveIssue(20141, TargetFrameworkMonikers.UapAot)]
[Fact]
public static async Task ResponseHeaders_ContainsHeadersAfterOperation()
{
@@ -387,6 +388,7 @@ namespace System.Net.Tests
Assert.Equal("ArbitraryValue", wc.ResponseHeaders["ArbitraryHeader"]);
}
+ [ActiveIssue(20141, TargetFrameworkMonikers.UapAot)]
[ActiveIssue(18680)]
[OuterLoop("Networking test talking to remote server: issue #11345")]
[Theory]
@@ -399,6 +401,7 @@ namespace System.Net.Tests
await Assert.ThrowsAsync<WebException>(() => wc.DownloadStringTaskAsync(System.Net.Test.Common.Configuration.Http.RemoteEchoServer));
}
+ [ActiveIssue(20141, TargetFrameworkMonikers.UapAot)]
[OuterLoop("Networking test talking to remote server: issue #11345")]
[Theory]
[InlineData("http://localhost", true)]
@@ -417,6 +420,7 @@ namespace System.Net.Tests
}
}
+ [ActiveIssue(20141, TargetFrameworkMonikers.UapAot)]
[Fact]
public static async Task RequestHeaders_SpecialHeaders_RequestSucceeds()
{
@@ -440,6 +444,7 @@ namespace System.Net.Tests
});
}
+ [ActiveIssue(20141, TargetFrameworkMonikers.UapAot)]
[Fact]
public static async Task ConcurrentOperations_Throw()
{
@@ -506,6 +511,7 @@ namespace System.Net.Tests
protected abstract Task<Stream> OpenReadAsync(WebClient wc, string address);
protected abstract Task<Stream> OpenWriteAsync(WebClient wc, string address);
+ [ActiveIssue(20141, TargetFrameworkMonikers.UapAot)]
[Theory]
[InlineData(null)]
[InlineData("text/html; charset=utf-8")]
@@ -531,6 +537,7 @@ namespace System.Net.Tests
});
}
+ [ActiveIssue(20141, TargetFrameworkMonikers.UapAot)]
[Fact]
public async Task DownloadData_Success()
{
@@ -553,6 +560,7 @@ namespace System.Net.Tests
});
}
+ [ActiveIssue(20141, TargetFrameworkMonikers.UapAot)]
[Fact]
public async Task DownloadData_LargeData_Success()
{
@@ -572,6 +580,7 @@ namespace System.Net.Tests
});
}
+ [ActiveIssue(20141, TargetFrameworkMonikers.UapAot)]
[Fact]
public async Task DownloadFile_Success()
{
@@ -599,6 +608,7 @@ namespace System.Net.Tests
});
}
+ [ActiveIssue(20141, TargetFrameworkMonikers.UapAot)]
[Fact]
public async Task OpenRead_Success()
{
@@ -620,6 +630,7 @@ namespace System.Net.Tests
});
}
+ [ActiveIssue(20141, TargetFrameworkMonikers.UapAot)]
[OuterLoop("Networking test talking to remote server: issue #11345")]
[Theory]
[MemberData(nameof(EchoServers))]
@@ -633,6 +644,7 @@ namespace System.Net.Tests
}
}
+ [ActiveIssue(20141, TargetFrameworkMonikers.UapAot)]
[OuterLoop("Networking test talking to remote server: issue #11345")]
[Theory]
[MemberData(nameof(EchoServers))]
@@ -648,6 +660,7 @@ namespace System.Net.Tests
Assert.True(!IsAsync || await uploadProgressInvoked.Task, "Expected upload progress callback to be invoked");
}
+ [ActiveIssue(20141, TargetFrameworkMonikers.UapAot)]
[OuterLoop("Networking test talking to remote server: issue #11345")]
[Theory]
[MemberData(nameof(EchoServers))]
@@ -665,6 +678,7 @@ namespace System.Net.Tests
return new string(Enumerable.Range(0, 512 * 1024).Select(_ => (char)('a' + rand.Next(0, 26))).ToArray());
}
+ [ActiveIssue(20141, TargetFrameworkMonikers.UapAot)]
[OuterLoop("Networking test talking to remote server: issue #11345")]
[Theory]
[MemberData(nameof(EchoServers))]
@@ -684,6 +698,7 @@ namespace System.Net.Tests
}
}
+ [ActiveIssue(20141, TargetFrameworkMonikers.UapAot)]
[OuterLoop("Networking test talking to remote server: issue #11345")]
[Theory]
[MemberData(nameof(EchoServers))]
@@ -694,6 +709,7 @@ namespace System.Net.Tests
Assert.Contains(ExpectedText, result);
}
+ [ActiveIssue(20141, TargetFrameworkMonikers.UapAot)]
[OuterLoop("Networking test talking to remote server: issue #11345")]
[Theory]
[MemberData(nameof(EchoServers))]
diff --git a/src/System.Net.WebHeaderCollection/tests/LoggingTest.cs b/src/System.Net.WebHeaderCollection/tests/LoggingTest.cs
index 76fb7f8967..2a005fcbf8 100644
--- a/src/System.Net.WebHeaderCollection/tests/LoggingTest.cs
+++ b/src/System.Net.WebHeaderCollection/tests/LoggingTest.cs
@@ -9,6 +9,7 @@ namespace System.Net.Tests
{
public class WebHeaderCollectionLoggingTest
{
+ [ActiveIssue(20470, TargetFrameworkMonikers.UapAot)]
[Fact]
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "NetEventSource is only part of .NET Core")]
public void EventSource_ExistsWithCorrectId()
diff --git a/src/System.Net.WebHeaderCollection/tests/WebHeaderCollectionTest.cs b/src/System.Net.WebHeaderCollection/tests/WebHeaderCollectionTest.cs
index fddda2fbe9..13108ca457 100644
--- a/src/System.Net.WebHeaderCollection/tests/WebHeaderCollectionTest.cs
+++ b/src/System.Net.WebHeaderCollection/tests/WebHeaderCollectionTest.cs
@@ -221,6 +221,7 @@ namespace System.Net.Tests
Assert.Empty(headers);
}
+ [ActiveIssue(20465, TargetFrameworkMonikers.UapAot)]
[Theory]
[InlineData(null)]
[InlineData("")]
@@ -230,6 +231,7 @@ namespace System.Net.Tests
AssertExtensions.Throws<ArgumentNullException>("name", () => headers.Remove(name));
}
+ [ActiveIssue(20465, TargetFrameworkMonikers.UapAot)]
[Theory]
[InlineData(" \r \t \n")]
[InlineData(" name ")]
@@ -468,6 +470,7 @@ namespace System.Net.Tests
Assert.Equal("value1,,value2,value3,", headers["name"]);
}
+ [ActiveIssue(20465, TargetFrameworkMonikers.UapAot)]
[Fact]
public void Add_NullName_ThrowsArgumentNullException()
{
@@ -475,6 +478,7 @@ namespace System.Net.Tests
Assert.Throws<ArgumentNullException>("name", () => headers.Add(null, "value"));
}
+ [ActiveIssue(20465, TargetFrameworkMonikers.UapAot)]
[Theory]
[InlineData("")]
[InlineData("(")]
@@ -487,6 +491,7 @@ namespace System.Net.Tests
Assert.Throws<ArgumentException>("name", () => headers.Add(name, "value"));
}
+ [ActiveIssue(20465, TargetFrameworkMonikers.UapAot)]
[Theory]
[MemberData(nameof(InvalidValues))]
public void Add_InvalidValue_ThrowsArgumentException(string value)
@@ -508,6 +513,7 @@ namespace System.Net.Tests
Assert.Equal("value1,,value2,", headers["name"]);
}
+ [ActiveIssue(20465, TargetFrameworkMonikers.UapAot)]
[Theory]
[InlineData(null)]
[InlineData("")]
@@ -517,6 +523,7 @@ namespace System.Net.Tests
Assert.Throws<ArgumentNullException>("header", () => headers.Add(header));
}
+ [ActiveIssue(20465, TargetFrameworkMonikers.UapAot)]
[Theory]
[InlineData(" \r \t \n", "header")]
[InlineData("nocolon", "header")]
diff --git a/src/System.Net.WebProxy/tests/WebProxyTest.cs b/src/System.Net.WebProxy/tests/WebProxyTest.cs
index 92c1dd58ab..e589f6b0ae 100644
--- a/src/System.Net.WebProxy/tests/WebProxyTest.cs
+++ b/src/System.Net.WebProxy/tests/WebProxyTest.cs
@@ -175,6 +175,7 @@ namespace System.Net.Tests
yield return new object[] { new Uri($"http://{IPAddress.None}"), false };
}
+ [ActiveIssue(20137, TargetFrameworkMonikers.Uap)]
[Theory]
[MemberData(nameof(BypassOnLocal_MemberData))]
public static void BypassOnLocal_MatchesExpected(Uri destination, bool isLocal)
diff --git a/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/ClientWebSocketOptions.cs b/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/ClientWebSocketOptions.cs
index 5f1616598b..c488277150 100644
--- a/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/ClientWebSocketOptions.cs
+++ b/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/ClientWebSocketOptions.cs
@@ -39,7 +39,7 @@ namespace System.Net.WebSockets
ThrowIfReadOnly();
// WebHeaderCollection performs validation of headerName/headerValue.
- _requestHeaders[headerName] = headerValue;
+ _requestHeaders.Set(headerName, headerValue);
}
internal WebHeaderCollection RequestHeaders { get { return _requestHeaders; } }
diff --git a/src/System.Net.WebSockets.Client/tests/CancelTest.cs b/src/System.Net.WebSockets.Client/tests/CancelTest.cs
index 2331437432..c6248addfa 100644
--- a/src/System.Net.WebSockets.Client/tests/CancelTest.cs
+++ b/src/System.Net.WebSockets.Client/tests/CancelTest.cs
@@ -10,6 +10,7 @@ using Xunit.Abstractions;
namespace System.Net.WebSockets.Client.Tests
{
+ [ActiveIssue(20132, TargetFrameworkMonikers.Uap)]
public class CancelTest : ClientWebSocketTestBase
{
public CancelTest(ITestOutputHelper output) : base(output) { }
@@ -150,7 +151,6 @@ namespace System.Net.WebSockets.Client.Tests
}
}
- [ActiveIssue(19967, TargetFrameworkMonikers.NetFramework)]
[OuterLoop] // TODO: Issue #11345
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task ReceiveAsync_AfterCancellationDoReceiveAsync_ThrowsWebSocketException(Uri server)
@@ -161,8 +161,9 @@ namespace System.Net.WebSockets.Client.Tests
var segment = new ArraySegment<byte>(recvBuffer);
var cts = new CancellationTokenSource();
- Task recieve = cws.ReceiveAsync(segment, cts.Token);
+ Task receive = cws.ReceiveAsync(segment, cts.Token);
cts.Cancel();
+ await Assert.ThrowsAnyAsync<OperationCanceledException>(() => receive);
WebSocketException ex = await Assert.ThrowsAsync<WebSocketException>(() =>
cws.ReceiveAsync(segment, CancellationToken.None));
diff --git a/src/System.Net.WebSockets.Client/tests/ClientWebSocketOptionsTests.cs b/src/System.Net.WebSockets.Client/tests/ClientWebSocketOptionsTests.cs
index 45b9111ab8..e96eda6da1 100644
--- a/src/System.Net.WebSockets.Client/tests/ClientWebSocketOptionsTests.cs
+++ b/src/System.Net.WebSockets.Client/tests/ClientWebSocketOptionsTests.cs
@@ -27,7 +27,7 @@ namespace System.Net.WebSockets.Client.Tests
Assert.False(cws.Options.UseDefaultCredentials);
}
- [ActiveIssue(19967, TargetFrameworkMonikers.NetFramework)]
+ [ActiveIssue(20358, TargetFrameworkMonikers.NetFramework)]
[ConditionalFact(nameof(WebSocketsSupported))]
public static void SetBuffer_InvalidArgs_Throws()
{
diff --git a/src/System.Net.WebSockets.Client/tests/ClientWebSocketUnitTest.cs b/src/System.Net.WebSockets.Client/tests/ClientWebSocketUnitTest.cs
index 7a0256925c..bf75a6aa0e 100644
--- a/src/System.Net.WebSockets.Client/tests/ClientWebSocketUnitTest.cs
+++ b/src/System.Net.WebSockets.Client/tests/ClientWebSocketUnitTest.cs
@@ -57,6 +57,7 @@ namespace System.Net.WebSockets.Client.Tests
}
}
+ [ActiveIssue(20132, TargetFrameworkMonikers.Uap)]
[OuterLoop] // TODO: Issue #11345
[ConditionalFact(nameof(WebSocketsSupported))]
public void CloseAsync_CreateAndCloseOutput_ThrowsInvalidOperationExceptionWithMessage()
@@ -89,6 +90,7 @@ namespace System.Net.WebSockets.Client.Tests
}
}
+ [ActiveIssue(20132, TargetFrameworkMonikers.Uap)]
[OuterLoop] // TODO: Issue #11345
[ConditionalFact(nameof(WebSocketsSupported))]
public void CloseAsync_CreateAndReceive_ThrowsInvalidOperationExceptionWithMessage()
@@ -124,6 +126,7 @@ namespace System.Net.WebSockets.Client.Tests
}
}
+ [ActiveIssue(20132, TargetFrameworkMonikers.Uap)]
[OuterLoop] // TODO: Issue #11345
[ConditionalFact(nameof(WebSocketsSupported))]
public void CloseAsync_CreateAndSend_ThrowsInvalidOperationExceptionWithMessage()
@@ -181,6 +184,7 @@ namespace System.Net.WebSockets.Client.Tests
Assert.Equal(WebSocketState.Closed, cws.State);
}
+ [ActiveIssue(20132, TargetFrameworkMonikers.Uap)]
[OuterLoop] // TODO: Issue #11345
[ConditionalFact(nameof(WebSocketsSupported))]
public void CloseAsync_DisposeAndCloseOutput_ThrowsObjectDisposedExceptionWithMessage()
@@ -198,6 +202,7 @@ namespace System.Net.WebSockets.Client.Tests
Assert.Equal(WebSocketState.Closed, cws.State);
}
+ [ActiveIssue(20132, TargetFrameworkMonikers.Uap)]
[OuterLoop] // TODO: Issue #11345
[ConditionalFact(nameof(WebSocketsSupported))]
public void ReceiveAsync_CreateAndDisposeAndReceive_ThrowsObjectDisposedExceptionWithMessage()
@@ -218,6 +223,7 @@ namespace System.Net.WebSockets.Client.Tests
Assert.Equal(WebSocketState.Closed, cws.State);
}
+ [ActiveIssue(20132, TargetFrameworkMonikers.Uap)]
[OuterLoop] // TODO: Issue #11345
[ConditionalFact(nameof(WebSocketsSupported))]
public void SendAsync_CreateAndDisposeAndSend_ThrowsObjectDisposedExceptionWithMessage()
diff --git a/src/System.Net.WebSockets.Client/tests/CloseTest.cs b/src/System.Net.WebSockets.Client/tests/CloseTest.cs
index ced87b4424..9a92892bcc 100644
--- a/src/System.Net.WebSockets.Client/tests/CloseTest.cs
+++ b/src/System.Net.WebSockets.Client/tests/CloseTest.cs
@@ -13,6 +13,7 @@ using Xunit.Abstractions;
namespace System.Net.WebSockets.Client.Tests
{
+ [ActiveIssue(20132, TargetFrameworkMonikers.Uap)]
public class CloseTest : ClientWebSocketTestBase
{
public CloseTest(ITestOutputHelper output) : base(output) { }
@@ -256,7 +257,7 @@ namespace System.Net.WebSockets.Client.Tests
}
}
- [ActiveIssue(19967, TargetFrameworkMonikers.NetFramework)]
+ [ActiveIssue(20362, TargetFrameworkMonikers.NetFramework)]
[OuterLoop] // TODO: Issue #11345
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task CloseOutputAsync_DuringConcurrentReceiveAsync_ExpectedStates(Uri server)
diff --git a/src/System.Net.WebSockets.Client/tests/ConnectTest.cs b/src/System.Net.WebSockets.Client/tests/ConnectTest.cs
index d67bab5466..bf68cb4084 100644
--- a/src/System.Net.WebSockets.Client/tests/ConnectTest.cs
+++ b/src/System.Net.WebSockets.Client/tests/ConnectTest.cs
@@ -16,7 +16,7 @@ namespace System.Net.WebSockets.Client.Tests
{
public ConnectTest(ITestOutputHelper output) : base(output) { }
- [ActiveIssue(19967, TargetFrameworkMonikers.NetFramework)]
+ [ActiveIssue(20360, TargetFrameworkMonikers.NetFramework)]
[OuterLoop] // TODO: Issue #11345
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(UnavailableWebSocketServers))]
public async Task ConnectAsync_NotWebSocketServer_ThrowsWebSocketExceptionWithMessage(Uri server)
@@ -85,7 +85,7 @@ namespace System.Net.WebSockets.Client.Tests
}
}
- [ActiveIssue(19967, TargetFrameworkMonikers.NetFramework)]
+ [ActiveIssue(18784, TargetFrameworkMonikers.NetFramework)]
[OuterLoop]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoHeadersServers))]
public async Task ConnectAsync_AddHostHeader_Success(Uri server)
diff --git a/src/System.Net.WebSockets.Client/tests/LoggingTest.cs b/src/System.Net.WebSockets.Client/tests/LoggingTest.cs
index bc46043e9d..ab5bf9c55e 100644
--- a/src/System.Net.WebSockets.Client/tests/LoggingTest.cs
+++ b/src/System.Net.WebSockets.Client/tests/LoggingTest.cs
@@ -10,6 +10,7 @@ namespace System.Net.WebSockets.Tests
{
public class LoggingTest
{
+ [ActiveIssue(20132, TargetFrameworkMonikers.Uap)]
[Fact]
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "NetEventSource is only part of .NET Core")]
public void EventSource_ExistsWithCorrectId()
diff --git a/src/System.Numerics.Vectors/tests/Vector2Tests.cs b/src/System.Numerics.Vectors/tests/Vector2Tests.cs
index c14299100d..18354e821f 100644
--- a/src/System.Numerics.Vectors/tests/Vector2Tests.cs
+++ b/src/System.Numerics.Vectors/tests/Vector2Tests.cs
@@ -18,6 +18,7 @@ namespace System.Numerics.Tests
}
[Fact]
+ [ActiveIssue("TFS 444567 - Codegen optimization issue", TargetFrameworkMonikers.UapAot)]
public void Vector2CopyToTest()
{
Vector2 v1 = new Vector2(2.0f, 3.0f);
diff --git a/src/System.ObjectModel/src/System/Collections/ObjectModel/KeyedCollection.cs b/src/System.ObjectModel/src/System/Collections/ObjectModel/KeyedCollection.cs
index 0fb979f1d3..d3640ad376 100644
--- a/src/System.ObjectModel/src/System/Collections/ObjectModel/KeyedCollection.cs
+++ b/src/System.ObjectModel/src/System/Collections/ObjectModel/KeyedCollection.cs
@@ -15,10 +15,10 @@ namespace System.Collections.ObjectModel
{
private const int defaultThreshold = 0;
- private readonly IEqualityComparer<TKey> _comparer;
- private Dictionary<TKey, TItem> _dict;
- private int _keyCount;
- private readonly int _threshold;
+ private readonly IEqualityComparer<TKey> comparer; // Do not rename (binary serialization)
+ private Dictionary<TKey, TItem> dict; // Do not rename (binary serialization)
+ private int keyCount; // Do not rename (binary serialization)
+ private readonly int threshold; // Do not rename (binary serialization)
protected KeyedCollection() : this(null, defaultThreshold) { }
@@ -44,8 +44,8 @@ namespace System.Collections.ObjectModel
throw new ArgumentOutOfRangeException(nameof(dictionaryCreationThreshold), SR.ArgumentOutOfRange_InvalidThreshold);
}
- _comparer = comparer;
- _threshold = dictionaryCreationThreshold;
+ this.comparer = comparer;
+ threshold = dictionaryCreationThreshold;
}
/// <summary>
@@ -65,7 +65,7 @@ namespace System.Collections.ObjectModel
{
get
{
- return _comparer;
+ return comparer;
}
}
@@ -90,14 +90,14 @@ namespace System.Collections.ObjectModel
throw new ArgumentNullException(nameof(key));
}
- if (_dict != null)
+ if (dict != null)
{
- return _dict.ContainsKey(key);
+ return dict.ContainsKey(key);
}
foreach (TItem item in Items)
{
- if (_comparer.Equals(GetKeyForItem(item), key)) return true;
+ if (comparer.Equals(GetKeyForItem(item), key)) return true;
}
return false;
}
@@ -109,15 +109,15 @@ namespace System.Collections.ObjectModel
throw new ArgumentNullException(nameof(key));
}
- if (_dict != null)
+ if (dict != null)
{
- return _dict.TryGetValue(key, out item);
+ return dict.TryGetValue(key, out item);
}
foreach (TItem itemInItems in Items)
{
TKey keyInItems = GetKeyForItem(itemInItems);
- if (keyInItems != null && _comparer.Equals(key, keyInItems))
+ if (keyInItems != null && comparer.Equals(key, keyInItems))
{
item = itemInItems;
return true;
@@ -131,13 +131,13 @@ namespace System.Collections.ObjectModel
private bool ContainsItem(TItem item)
{
TKey key;
- if ((_dict == null) || ((key = GetKeyForItem(item)) == null))
+ if ((dict == null) || ((key = GetKeyForItem(item)) == null))
{
return Items.Contains(item);
}
TItem itemInDict;
- bool exist = _dict.TryGetValue(key, out itemInDict);
+ bool exist = dict.TryGetValue(key, out itemInDict);
if (exist)
{
return EqualityComparer<TItem>.Default.Equals(itemInDict, item);
@@ -152,15 +152,15 @@ namespace System.Collections.ObjectModel
throw new ArgumentNullException(nameof(key));
}
- if (_dict != null)
+ if (dict != null)
{
TItem item;
- return _dict.TryGetValue(key, out item) && Remove(item);
+ return dict.TryGetValue(key, out item) && Remove(item);
}
for (int i = 0; i < Items.Count; i++)
{
- if (_comparer.Equals(GetKeyForItem(Items[i]), key))
+ if (comparer.Equals(GetKeyForItem(Items[i]), key))
{
RemoveItem(i);
return true;
@@ -171,7 +171,7 @@ namespace System.Collections.ObjectModel
protected IDictionary<TKey, TItem> Dictionary
{
- get { return _dict; }
+ get { return dict; }
}
protected void ChangeItemKey(TItem item, TKey newKey)
@@ -183,7 +183,7 @@ namespace System.Collections.ObjectModel
}
TKey oldKey = GetKeyForItem(item);
- if (!_comparer.Equals(oldKey, newKey))
+ if (!comparer.Equals(oldKey, newKey))
{
if (newKey != null)
{
@@ -200,12 +200,12 @@ namespace System.Collections.ObjectModel
protected override void ClearItems()
{
base.ClearItems();
- if (_dict != null)
+ if (dict != null)
{
- _dict.Clear();
+ dict.Clear();
}
- _keyCount = 0;
+ keyCount = 0;
}
protected abstract TKey GetKeyForItem(TItem item);
@@ -235,11 +235,11 @@ namespace System.Collections.ObjectModel
TKey newKey = GetKeyForItem(item);
TKey oldKey = GetKeyForItem(Items[index]);
- if (_comparer.Equals(oldKey, newKey))
+ if (comparer.Equals(oldKey, newKey))
{
- if (newKey != null && _dict != null)
+ if (newKey != null && dict != null)
{
- _dict[newKey] = item;
+ dict[newKey] = item;
}
}
else
@@ -259,14 +259,14 @@ namespace System.Collections.ObjectModel
private void AddKey(TKey key, TItem item)
{
- if (_dict != null)
+ if (dict != null)
{
- _dict.Add(key, item);
+ dict.Add(key, item);
}
- else if (_keyCount == _threshold)
+ else if (keyCount == threshold)
{
CreateDictionary();
- _dict.Add(key, item);
+ dict.Add(key, item);
}
else
{
@@ -275,19 +275,19 @@ namespace System.Collections.ObjectModel
throw new ArgumentException(SR.Format(SR.Argument_AddingDuplicate, key));
}
- _keyCount++;
+ keyCount++;
}
}
private void CreateDictionary()
{
- _dict = new Dictionary<TKey, TItem>(_comparer);
+ dict = new Dictionary<TKey, TItem>(comparer);
foreach (TItem item in Items)
{
TKey key = GetKeyForItem(item);
if (key != null)
{
- _dict.Add(key, item);
+ dict.Add(key, item);
}
}
}
@@ -295,13 +295,13 @@ namespace System.Collections.ObjectModel
private void RemoveKey(TKey key)
{
Debug.Assert(key != null, "key shouldn't be null!");
- if (_dict != null)
+ if (dict != null)
{
- _dict.Remove(key);
+ dict.Remove(key);
}
else
{
- _keyCount--;
+ keyCount--;
}
}
}
diff --git a/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs b/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs
index 91bccc06bd..f1c798db1c 100644
--- a/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs
+++ b/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs
@@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics;
+using System.Runtime.Serialization;
namespace System.Collections.ObjectModel
{
@@ -17,6 +18,7 @@ namespace System.Collections.ObjectModel
[Serializable]
[DebuggerTypeProxy(typeof(CollectionDebugView<>))]
[DebuggerDisplay("Count = {Count}")]
+ [System.Runtime.CompilerServices.TypeForwardedFrom("WindowsBase, Version=3.0.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
public class ObservableCollection<T> : Collection<T>, INotifyCollectionChanged, INotifyPropertyChanged
{
//------------------------------------------------------
@@ -238,12 +240,16 @@ namespace System.Collections.ObjectModel
NotifyCollectionChangedEventHandler handler = CollectionChanged;
if (handler != null)
{
- // Not calling BlockReentrancy() here to avoid the IDisposable box allocation.
+ // Not calling BlockReentrancy() here to avoid the SimpleMonitor allocation.
_blockReentrancyCount++;
- using (new BlockReentrancyDisposable(this))
+ try
{
handler(this, e);
}
+ finally
+ {
+ _blockReentrancyCount--;
+ }
}
}
@@ -263,8 +269,7 @@ namespace System.Collections.ObjectModel
protected IDisposable BlockReentrancy()
{
_blockReentrancyCount++;
- // Lazily box the struct as IDisposable once and reuse the same boxed instance with subsequent calls.
- return _boxedBlockReentrancyDisposable ?? (_boxedBlockReentrancyDisposable = new BlockReentrancyDisposable(this));
+ return EnsureMonitorInitialized();
}
/// <summary> Check and assert for reentrant attempts to change this collection. </summary>
@@ -340,6 +345,25 @@ namespace System.Collections.ObjectModel
{
OnCollectionChanged(EventArgsCache.ResetCollectionChanged);
}
+
+ private SimpleMonitor EnsureMonitorInitialized()
+ {
+ return _monitor ?? (_monitor = new SimpleMonitor(this));
+ }
+
+ [OnSerializing]
+ private void OnSerializing(StreamingContext context)
+ {
+ EnsureMonitorInitialized();
+ _monitor._busyCount = _blockReentrancyCount;
+ }
+
+ [OnDeserialized]
+ private void OnDeserialized(StreamingContext context)
+ {
+ _blockReentrancyCount = _monitor._busyCount;
+ _monitor._collection = this;
+ }
#endregion Private Methods
//------------------------------------------------------
@@ -351,17 +375,24 @@ namespace System.Collections.ObjectModel
#region Private Types
[Serializable]
- private struct BlockReentrancyDisposable : IDisposable
+ [System.Runtime.CompilerServices.TypeForwardedFrom("WindowsBase, Version=3.0.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
+ private sealed class SimpleMonitor : IDisposable
{
- private readonly ObservableCollection<T> _collection;
+ internal int _busyCount; // Only used during (de)serialization to maintain compatibility with desktop.
+
+ [NonSerialized]
+ internal ObservableCollection<T> _collection;
- public BlockReentrancyDisposable(ObservableCollection<T> collection)
+ public SimpleMonitor(ObservableCollection<T> collection)
{
Debug.Assert(collection != null);
_collection = collection;
}
- public void Dispose() => _collection._blockReentrancyCount--;
+ public void Dispose()
+ {
+ _collection._blockReentrancyCount--;
+ }
}
#endregion Private Types
@@ -374,8 +405,10 @@ namespace System.Collections.ObjectModel
#region Private Fields
+ private SimpleMonitor _monitor; // Lazily allocated only when a subclass calls BlockReentrancy() or during serialization.
+
+ [NonSerialized]
private int _blockReentrancyCount;
- private IDisposable _boxedBlockReentrancyDisposable; // Lazily allocated only when a subclass calls BlockReentrancy().
#endregion Private Fields
}
diff --git a/src/System.ObjectModel/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs b/src/System.ObjectModel/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs
index 5f20b400d4..7d8c9dfafa 100644
--- a/src/System.ObjectModel/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs
+++ b/src/System.ObjectModel/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs
@@ -15,7 +15,7 @@ namespace System.Collections.ObjectModel
[DebuggerDisplay("Count = {Count}")]
public class ReadOnlyDictionary<TKey, TValue> : IDictionary<TKey, TValue>, IDictionary, IReadOnlyDictionary<TKey, TValue>
{
- private readonly IDictionary<TKey, TValue> _dictionary;
+ private readonly IDictionary<TKey, TValue> m_dictionary; // Do not rename (binary serialization)
[NonSerialized]
private Object _syncRoot;
[NonSerialized]
@@ -30,12 +30,12 @@ namespace System.Collections.ObjectModel
throw new ArgumentNullException(nameof(dictionary));
}
Contract.EndContractBlock();
- _dictionary = dictionary;
+ m_dictionary = dictionary;
}
protected IDictionary<TKey, TValue> Dictionary
{
- get { return _dictionary; }
+ get { return m_dictionary; }
}
public KeyCollection Keys
@@ -45,7 +45,7 @@ namespace System.Collections.ObjectModel
Contract.Ensures(Contract.Result<KeyCollection>() != null);
if (_keys == null)
{
- _keys = new KeyCollection(_dictionary.Keys);
+ _keys = new KeyCollection(m_dictionary.Keys);
}
return _keys;
}
@@ -58,7 +58,7 @@ namespace System.Collections.ObjectModel
Contract.Ensures(Contract.Result<ValueCollection>() != null);
if (_values == null)
{
- _values = new ValueCollection(_dictionary.Values);
+ _values = new ValueCollection(m_dictionary.Values);
}
return _values;
}
@@ -68,7 +68,7 @@ namespace System.Collections.ObjectModel
public bool ContainsKey(TKey key)
{
- return _dictionary.ContainsKey(key);
+ return m_dictionary.ContainsKey(key);
}
ICollection<TKey> IDictionary<TKey, TValue>.Keys
@@ -81,7 +81,7 @@ namespace System.Collections.ObjectModel
public bool TryGetValue(TKey key, out TValue value)
{
- return _dictionary.TryGetValue(key, out value);
+ return m_dictionary.TryGetValue(key, out value);
}
ICollection<TValue> IDictionary<TKey, TValue>.Values
@@ -96,7 +96,7 @@ namespace System.Collections.ObjectModel
{
get
{
- return _dictionary[key];
+ return m_dictionary[key];
}
}
@@ -114,7 +114,7 @@ namespace System.Collections.ObjectModel
{
get
{
- return _dictionary[key];
+ return m_dictionary[key];
}
set
{
@@ -128,17 +128,17 @@ namespace System.Collections.ObjectModel
public int Count
{
- get { return _dictionary.Count; }
+ get { return m_dictionary.Count; }
}
bool ICollection<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKey, TValue> item)
{
- return _dictionary.Contains(item);
+ return m_dictionary.Contains(item);
}
void ICollection<KeyValuePair<TKey, TValue>>.CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
{
- _dictionary.CopyTo(array, arrayIndex);
+ m_dictionary.CopyTo(array, arrayIndex);
}
bool ICollection<KeyValuePair<TKey, TValue>>.IsReadOnly
@@ -167,7 +167,7 @@ namespace System.Collections.ObjectModel
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
{
- return _dictionary.GetEnumerator();
+ return m_dictionary.GetEnumerator();
}
#endregion
@@ -176,7 +176,7 @@ namespace System.Collections.ObjectModel
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
- return ((IEnumerable)_dictionary).GetEnumerator();
+ return ((IEnumerable)m_dictionary).GetEnumerator();
}
#endregion
@@ -209,12 +209,12 @@ namespace System.Collections.ObjectModel
IDictionaryEnumerator IDictionary.GetEnumerator()
{
- IDictionary d = _dictionary as IDictionary;
+ IDictionary d = m_dictionary as IDictionary;
if (d != null)
{
return d.GetEnumerator();
}
- return new DictionaryEnumerator(_dictionary);
+ return new DictionaryEnumerator(m_dictionary);
}
bool IDictionary.IsFixedSize
@@ -294,14 +294,14 @@ namespace System.Collections.ObjectModel
KeyValuePair<TKey, TValue>[] pairs = array as KeyValuePair<TKey, TValue>[];
if (pairs != null)
{
- _dictionary.CopyTo(pairs, index);
+ m_dictionary.CopyTo(pairs, index);
}
else
{
DictionaryEntry[] dictEntryArray = array as DictionaryEntry[];
if (dictEntryArray != null)
{
- foreach (var item in _dictionary)
+ foreach (var item in m_dictionary)
{
dictEntryArray[index++] = new DictionaryEntry(item.Key, item.Value);
}
@@ -316,7 +316,7 @@ namespace System.Collections.ObjectModel
try
{
- foreach (var item in _dictionary)
+ foreach (var item in m_dictionary)
{
objects[index++] = new KeyValuePair<TKey, TValue>(item.Key, item.Value);
}
@@ -340,7 +340,7 @@ namespace System.Collections.ObjectModel
{
if (_syncRoot == null)
{
- ICollection c = _dictionary as ICollection;
+ ICollection c = m_dictionary as ICollection;
if (c != null)
{
_syncRoot = c.SyncRoot;
diff --git a/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/ClassDataContract.cs b/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/ClassDataContract.cs
index 8e5c817da4..f29eba9209 100644
--- a/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/ClassDataContract.cs
+++ b/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/ClassDataContract.cs
@@ -459,8 +459,7 @@ namespace System.Runtime.Serialization
//
string typeFullName = GetGeneralTypeName(type);
- return s_knownSerializableTypeInfos.ContainsKey(typeFullName)
- || Globals.TypeOfException.IsAssignableFrom(type);
+ return s_knownSerializableTypeInfos.ContainsKey(typeFullName);
}
internal static bool IsNonSerializedMember(Type type, string memberName)
diff --git a/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Globals.cs b/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Globals.cs
index d23d54e5d4..7dfde5650b 100644
--- a/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Globals.cs
+++ b/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Globals.cs
@@ -78,17 +78,6 @@ namespace System.Runtime.Serialization
}
}
- private static Type s_typeOfException;
- internal static Type TypeOfException
- {
- get
- {
- if (s_typeOfException == null)
- s_typeOfException = typeof(Exception);
- return s_typeOfException;
- }
- }
-
private static Type s_typeOfString;
internal static Type TypeOfString
{
diff --git a/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonWriterDelegator.cs b/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonWriterDelegator.cs
index c66e8e238a..abb1e23dee 100644
--- a/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonWriterDelegator.cs
+++ b/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonWriterDelegator.cs
@@ -180,7 +180,7 @@ namespace System.Runtime.Serialization.Json
// Fetching the UtcOffset is expensive so we need to avoid it if possible. We can do a fast
// bounds check to decide if the more expensive bounds check is needed. The result from
// TimeZoneInfo.Local.GetUtcOffset(value) is bounded to +/- 24 hours. If
- // (DateTime.MinValue + 24 hours) < value < (DateTime.MaxValue – 24 hours), then we don't need
+ // (DateTime.MinValue + 24 hours) < value < (DateTime.MaxValue - 24 hours), then we don't need
// to check using the real UtcOffset as it doesn't matter what the offset is, it can't cause
// an overflow/underflow condition.
diff --git a/src/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs b/src/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs
index e336f71923..11988b9f4d 100644
--- a/src/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs
+++ b/src/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs
@@ -1817,6 +1817,7 @@ string.Format(@"<?xml version=""1.0"" encoding=""utf-8""?>
}
[Fact]
+ [ActiveIssue("dotnet/corefx #19897", TargetFrameworkMonikers.UapAot)]
public static void Xml_TypeWithTwoDimensionalArrayProperty1()
{
SimpleType[][] simpleType2D = GetObjectwith2DArrayOfSimpleType();
@@ -4323,6 +4324,63 @@ string.Format(@"<?xml version=""1.0"" encoding=""utf-8""?>
Assert.Throws<InvalidOperationException>(() => { SerializeAndDeserialize(myGroup4, null, null, true); });
}
+ [Fact]
+ public static void Xml_DefaultNamespaceChange_XmlAttributesTestAsRoot()
+ {
+ var value = new XmlSerializerAttributes();
+ var actual = SerializeAndDeserialize(value,
+@"<?xml version=""1.0""?>
+ <AttributeTesting xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" XmlAttributeName=""2"" xmlns=""MycustomDefaultNamespace"">
+ <Word>String choice value</Word>
+ <XmlIncludeProperty xsi:type=""ItemChoiceType"">DecimalNumber</XmlIncludeProperty>
+ <XmlEnumProperty>
+ <ItemChoiceType>DecimalNumber</ItemChoiceType>
+ <ItemChoiceType>Number</ItemChoiceType>
+ <ItemChoiceType>Word</ItemChoiceType>
+ <ItemChoiceType>None</ItemChoiceType>
+ </XmlEnumProperty>&lt;xml&gt;Hello XML&lt;/xml&gt;<XmlNamespaceDeclarationsProperty>XmlNamespaceDeclarationsPropertyValue</XmlNamespaceDeclarationsProperty><XmlElementPropertyNode xmlns=""http://element"">1</XmlElementPropertyNode><CustomXmlArrayProperty xmlns=""http://mynamespace""><string>one</string><string>two</string><string>three</string></CustomXmlArrayProperty></AttributeTesting>",
+ () => { return new XmlSerializer(typeof(XmlSerializerAttributes), "MycustomDefaultNamespace"); });
+
+ Assert.StrictEqual(value.EnumType, actual.EnumType);
+ Assert.StrictEqual(value.MyChoice, actual.MyChoice);
+ Assert.Equal(value.XmlArrayProperty[0], actual.XmlArrayProperty[0]);
+ Assert.Equal(value.XmlArrayProperty[1], actual.XmlArrayProperty[1]);
+ Assert.Equal(value.XmlArrayProperty[2], actual.XmlArrayProperty[2]);
+ Assert.StrictEqual(value.XmlAttributeProperty, actual.XmlAttributeProperty);
+ Assert.StrictEqual(value.XmlElementProperty, actual.XmlElementProperty);
+ Assert.Equal(value.XmlEnumProperty, actual.XmlEnumProperty);
+ Assert.StrictEqual(value.XmlIncludeProperty, actual.XmlIncludeProperty);
+ Assert.StrictEqual(value.XmlNamespaceDeclarationsProperty, actual.XmlNamespaceDeclarationsProperty);
+ Assert.StrictEqual(value.XmlTextProperty, actual.XmlTextProperty);
+ }
+
+ [Fact]
+ public static void Xml_TypeWithIndirectReferencedAssembly()
+ {
+ // TypeWithIndirectRef class has a dependency on Task, which is in System.Threading.Tasks, an assembly that's indirectly referenced.
+ var value = new DirectRef.TypeWithIndirectRef() { Name = "Foo" };
+ var actual = SerializeAndDeserialize(value, @"<?xml version=""1.0""?>
+ <TypeWithIndirectRef xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
+ <Name>Foo</Name>
+ </TypeWithIndirectRef>");
+ Assert.StrictEqual(value.Name, actual.Name);
+ }
+
+ [Fact]
+ public static void Xml_NookTypes()
+ {
+ NookAppLocalState value = new NookAppLocalState() { ArticleViewCount = 1, CurrentlyReadingProductEAN = "Current", CurrentPaymentType = NookAppLocalState.PaymentType.Microsoft, IsFirstRun = true, PreviousSearchQueries = new List<string>(new string[] { "one", "two" }), TextColor = System.Drawing.Color.FromArgb(3, 4, 5, 6) };
+ value.LocalReadingPositionState = new List<LocalReadingPosition>();
+ value.LocalReadingPositionState.Add(new LocalReadingPosition() { Ean = "Ean", LastReadTime = new DateTime(2013, 1, 2), PageCount = 1, PageNumber = "1", PlatformOffset = "offset" });
+
+ var deserializedValue = SerializeAndDeserialize<NookAppLocalState>(value, "<?xml version=\"1.0\"?>\r\n<NookAppLocalState xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n <TextColor>\r\n <A>3</A>\r\n <B>6</B>\r\n <G>5</G>\r\n <R>4</R>\r\n </TextColor>\r\n <ArticleViewCount>1</ArticleViewCount>\r\n <CurrentlyReadingProductEAN>Current</CurrentlyReadingProductEAN>\r\n <CurrentPaymentType>Microsoft</CurrentPaymentType>\r\n <IsFirstRun>true</IsFirstRun>\r\n <LocalReadingPositionState>\r\n <LocalReadingPosition>\r\n <Ean>Ean</Ean>\r\n <LastReadTime>2013-01-02T00:00:00</LastReadTime>\r\n <PageCount>1</PageCount>\r\n <PageNumber>1</PageNumber>\r\n <PlatformOffset>offset</PlatformOffset>\r\n </LocalReadingPosition>\r\n </LocalReadingPositionState>\r\n <PreviousSearchQueries>\r\n <string>one</string>\r\n <string>two</string>\r\n </PreviousSearchQueries>\r\n <IsFirstRunDuplicate>false</IsFirstRunDuplicate>\r\n</NookAppLocalState>", null, true);
+
+ Assert.StrictEqual(deserializedValue.ArticleViewCount, value.ArticleViewCount);
+ Assert.StrictEqual(deserializedValue.CurrentlyReadingProductEAN, value.CurrentlyReadingProductEAN);
+ Assert.StrictEqual(deserializedValue.CurrentPaymentType, value.CurrentPaymentType);
+ Assert.StrictEqual(deserializedValue.IsFirstRun, value.IsFirstRun);
+ }
+
private static readonly string s_defaultNs = "http://tempuri.org/";
private static T RoundTripWithXmlMembersMapping<T>(object requestBodyValue, string memberName, string baseline, bool skipStringCompare = false, string wrapperName = null)
{
diff --git a/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestCaseBase.cs b/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestCaseBase.cs
index 9614e46c0c..2a71fd80f8 100644
--- a/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestCaseBase.cs
+++ b/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestCaseBase.cs
@@ -73,6 +73,11 @@ namespace System.Xml.Tests
}
}
+ private static string NormalizeLineEndings(string s)
+ {
+ return s.Replace("\r\n", "\n").Replace("\r", "\n");
+ }
+
protected static void CompareOutput(Stream expectedStream, Stream actualStream, int count = 0)
{
actualStream.Seek(0, SeekOrigin.Begin);
@@ -86,8 +91,8 @@ namespace System.Xml.Tests
expectedReader.ReadLine();
}
- string actual = actualReader.ReadToEnd();
- string expected = expectedReader.ReadToEnd();
+ string actual = NormalizeLineEndings(actualReader.ReadToEnd());
+ string expected = NormalizeLineEndings(expectedReader.ReadToEnd());
if (actual.Equals(expected))
{
diff --git a/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestFile.cs b/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestFile.cs
index f02252f9e8..9ba53bd970 100644
--- a/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestFile.cs
+++ b/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestFile.cs
@@ -45,9 +45,9 @@ namespace System.Xml.Tests
[InlineData("@infft14.txt", "fft14.dll", "no", "fft14", "fft14.pdb", "no", "fft14.txt")]
//[Variation("15", Desc = "Test multiple config files with circular reference and case sensitive file names specified", Pri = 1, Params = new object[] { "@infft15.txt", "fft15.dll", "no", "fft15", "fft15.pdb", "no", "fft15.txt" })]
//[InlineData("@infft15.txt", "fft15.dll", "no", "fft15", "fft15.pdb", "no", "fft15.txt")] //Skipping this, it tries to load System.dll
- //[Variation("17", Desc = "Exercise comments(‘#’) within file", Pri = 1, Params = new object[] { "@infft17.txt", "fft17.dll", "yes", "fft17", "fft17.pdb", "no", "fft17.txt" })]
+ //[Variation("17", Desc = "Exercise comments(‘#’) within file", Pri = 1, Params = new object[] { "@infft17.txt", "fft17.dll", "yes", "fft17", "fft17.pdb", "no", "fft17.txt" })]
//[InlineData("@infft17.txt", "fft17.dll", "yes", "fft17", "fft17.pdb", "no", "fft17.txt")] //Skipping this, it tries to load System.dll
- //[Variation("18", Desc = "When loading from a file exercise commands and filenames with ‘#” in them", Pri = 1, Params = new object[] { "@infft18.txt", "fft18.dll", "yes", "AB#CD", "fft18.pdb", "no", "fft18.txt" })]
+ //[Variation("18", Desc = "When loading from a file exercise commands and filenames with ‘#” in them", Pri = 1, Params = new object[] { "@infft18.txt", "fft18.dll", "yes", "AB#CD", "fft18.pdb", "no", "fft18.txt" })]
//[InlineData("@infft18.txt", "fft18.dll", "yes", "AB#CD", "fft18.pdb", "no", "fft18.txt")] //Skipping this, it tries to load System.dll
//[Variation("19", Desc = "Exercise wildcards with @", Pri = 1, Params = new object[] { "@*.txt", "fft19.dll", "no", "fft19", "fft19.pdb", "no", "fft19.txt", "EnglishOnly" })]
[InlineData("@*.txt", "fft19.dll", "no", "fft19", "fft19.pdb", "no", "fft19.txt"/*, "EnglishOnly"*/)]
@@ -73,4 +73,4 @@ namespace System.Xml.Tests
VerifyTest(cmdLine, asmName, asmCreated, typeName, pdbName, pdbCreated, baselineFile, _createFromInputFile);
}
}
-} \ No newline at end of file
+}
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/Internal/Utilities/BlobUtilities.cs b/src/System.Reflection.Metadata/src/System/Reflection/Internal/Utilities/BlobUtilities.cs
index a05657132b..76f081cec1 100644
--- a/src/System.Reflection.Metadata/src/System/Reflection/Internal/Utilities/BlobUtilities.cs
+++ b/src/System.Reflection.Metadata/src/System/Reflection/Internal/Utilities/BlobUtilities.cs
@@ -339,7 +339,7 @@ namespace System.Reflection
// ECMA-335 II.24.2.4:
// This final byte holds the value 1 if and only if any UTF16 character within
// the string has any bit set in its top byte, or its low byte is any of the following:
- // 0x01–0x08, 0x0E–0x1F, 0x27, 0x2D, 0x7F. Otherwise, it holds 0.
+ // 0x01-0x08, 0x0E-0x1F, 0x27, 0x2D, 0x7F. Otherwise, it holds 0.
// The 1 signifies Unicode characters that require handling beyond that normally provided for 8-bit encoding sets.
foreach (char ch in str)
diff --git a/src/System.Reflection.TypeExtensions/tests/CoreCLR/ModuleTests.CoreCLR.cs b/src/System.Reflection.TypeExtensions/tests/CoreCLR/ModuleTests.CoreCLR.cs
index 8e2a09e4f8..73d0014d0e 100644
--- a/src/System.Reflection.TypeExtensions/tests/CoreCLR/ModuleTests.CoreCLR.cs
+++ b/src/System.Reflection.TypeExtensions/tests/CoreCLR/ModuleTests.CoreCLR.cs
@@ -9,7 +9,6 @@ namespace System.Reflection.Tests
public class ModuleTests
{
[Fact]
- [ActiveIssue("https://github.com/dotnet/corert/issues/3638 - HasMVID returns true but GetMVID violently disagrees.", TargetFrameworkMonikers.UapAot)]
public void GetModuleVersionId_KnownAssembly_ReturnsExpected()
{
Module module = Assembly.Load(new AssemblyName("TinyAssembly")).ManifestModule;
diff --git a/src/System.Reflection.TypeExtensions/tests/CoreCLR/Resources/System.Reflection.TypeExtensions.CoreCLR.Tests.rd.xml b/src/System.Reflection.TypeExtensions/tests/CoreCLR/Resources/System.Reflection.TypeExtensions.CoreCLR.Tests.rd.xml
new file mode 100644
index 0000000000..1564e22783
--- /dev/null
+++ b/src/System.Reflection.TypeExtensions/tests/CoreCLR/Resources/System.Reflection.TypeExtensions.CoreCLR.Tests.rd.xml
@@ -0,0 +1,7 @@
+<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
+ <Library>
+ <!-- Test loads TinyAssembly.dll dynamically - rooting a (useless) type just keeps ILC from throwing it out of the image. -->
+ <Type Name="TinyAssembly.TinyInterface" Dynamic="Required Public" />
+ </Library>
+</Directives>
+
diff --git a/src/System.Reflection.TypeExtensions/tests/CoreCLR/System.Reflection.TypeExtensions.CoreCLR.Tests.csproj b/src/System.Reflection.TypeExtensions/tests/CoreCLR/System.Reflection.TypeExtensions.CoreCLR.Tests.csproj
index bb63099e28..9382cbe54c 100644
--- a/src/System.Reflection.TypeExtensions/tests/CoreCLR/System.Reflection.TypeExtensions.CoreCLR.Tests.csproj
+++ b/src/System.Reflection.TypeExtensions/tests/CoreCLR/System.Reflection.TypeExtensions.CoreCLR.Tests.csproj
@@ -22,5 +22,8 @@
<Link>Common\System\PlatformDetection.cs</Link>
</Compile>
</ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Resources\$(AssemblyName).rd.xml" />
+ </ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
diff --git a/src/System.Runtime.Extensions/System.Runtime.Extensions.sln b/src/System.Runtime.Extensions/System.Runtime.Extensions.sln
index 1dc16ea74c..81b5e18926 100644
--- a/src/System.Runtime.Extensions/System.Runtime.Extensions.sln
+++ b/src/System.Runtime.Extensions/System.Runtime.Extensions.sln
@@ -1,13 +1,13 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.25420.1
+# Visual Studio 15
+VisualStudioVersion = 15.0.26228.9
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Runtime.Extensions.Tests", "tests\System.Runtime.Extensions.Tests.csproj", "{6C314C9B-3D28-4B05-9B4C-B57A00A9B3B9}"
ProjectSection(ProjectDependencies) = postProject
{845D2B72-D8A4-42E5-9BE9-17639EC4FC1A} = {845D2B72-D8A4-42E5-9BE9-17639EC4FC1A}
EndProjectSection
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyResolveTests", "tests\AssemblyResolveTests\AssemblyResolveTests.csproj", "ad83807c-8be5-4f27-85df-9793613233e1"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyResolveTests", "tests\AssemblyResolveTests\AssemblyResolveTests.csproj", "{E60AFAE8-2EA7-471C-9E24-52A99453B26B}"
ProjectSection(ProjectDependencies) = postProject
{845D2B72-D8A4-42E5-9BE9-17639EC4FC1A} = {845D2B72-D8A4-42E5-9BE9-17639EC4FC1A}
EndProjectSection
@@ -55,10 +55,10 @@ Global
{6C314C9B-3D28-4B05-9B4C-B57A00A9B3B9}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{6C314C9B-3D28-4B05-9B4C-B57A00A9B3B9}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{6C314C9B-3D28-4B05-9B4C-B57A00A9B3B9}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
- ad83807c-8be5-4f27-85df-9793613233e1.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU
- ad83807c-8be5-4f27-85df-9793613233e1.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU
- ad83807c-8be5-4f27-85df-9793613233e1.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU
- ad83807c-8be5-4f27-85df-9793613233e1.Release|Any CPU.Build.0 = netstandard-Release|Any CPU
+ {E60AFAE8-2EA7-471C-9E24-52A99453B26B}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU
+ {E60AFAE8-2EA7-471C-9E24-52A99453B26B}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU
+ {E60AFAE8-2EA7-471C-9E24-52A99453B26B}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU
+ {E60AFAE8-2EA7-471C-9E24-52A99453B26B}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU
{978FA427-F87B-46E2-B276-F5B727C50A01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{978FA427-F87B-46E2-B276-F5B727C50A01}.Debug|Any CPU.Build.0 = Debug|Any CPU
{978FA427-F87B-46E2-B276-F5B727C50A01}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -89,7 +89,6 @@ Global
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{6C314C9B-3D28-4B05-9B4C-B57A00A9B3B9} = {1A2F9F4A-A032-433E-B914-ADD5992BB178}
- ad83807c-8be5-4f27-85df-9793613233e1 = {1A2F9F4A-A032-433E-B914-ADD5992BB178}
{978FA427-F87B-46E2-B276-F5B727C50A01} = {1A2F9F4A-A032-433E-B914-ADD5992BB178}
{24BCEC6B-B9D2-47BC-9D66-725BD6B526FA} = {1A2F9F4A-A032-433E-B914-ADD5992BB178}
{C44B33E3-F89F-40B9-B353-D380C1524988} = {1A2F9F4A-A032-433E-B914-ADD5992BB178}
diff --git a/src/System.Runtime.Extensions/src/System.Runtime.Extensions.csproj b/src/System.Runtime.Extensions/src/System.Runtime.Extensions.csproj
index 69b10560a8..3ff71dbe1e 100644
--- a/src/System.Runtime.Extensions/src/System.Runtime.Extensions.csproj
+++ b/src/System.Runtime.Extensions/src/System.Runtime.Extensions.csproj
@@ -91,7 +91,7 @@
<!-- WINDOWS: Shared CoreCLR and .NET Native -->
<ItemGroup Condition="'$(TargetsWindows)' == 'true'">
<Compile Include="System\Environment.Windows.cs" />
- <Compile Include="System\Environment.Win32.cs" />
+ <Compile Include="System\Environment.Win32.cs" Condition="'$(TargetGroup)' != 'uapaot' and '$(TargetGroup)' != 'uap'" />
<Compile Include="System\Runtime\Versioning\VersioningHelper.Windows.cs" />
<Compile Include="System\Diagnostics\Stopwatch.Windows.cs" />
<Compile Include="$(CommonPath)\System\IO\Win32Marshal.cs">
diff --git a/src/System.Runtime.Extensions/src/System/Environment.Win32.cs b/src/System.Runtime.Extensions/src/System/Environment.Win32.cs
index ed0a0c8f8b..d190545bc3 100644
--- a/src/System.Runtime.Extensions/src/System/Environment.Win32.cs
+++ b/src/System.Runtime.Extensions/src/System/Environment.Win32.cs
@@ -12,366 +12,50 @@ namespace System
{
public static partial class Environment
{
- public static int ExitCode { get { return EnvironmentAugments.ExitCode; } set { EnvironmentAugments.ExitCode = value; } }
-
- private static string ExpandEnvironmentVariablesCore(string name)
- {
- int currentSize = 100;
- StringBuilder result = StringBuilderCache.Acquire(currentSize); // A somewhat reasonable default size
-
- result.Length = 0;
- int size = Interop.Kernel32.ExpandEnvironmentStringsW(name, result, currentSize);
- if (size == 0)
- {
- StringBuilderCache.Release(result);
- Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
- }
-
- while (size > currentSize)
- {
- currentSize = size;
- result.Length = 0;
- result.Capacity = currentSize;
-
- size = Interop.Kernel32.ExpandEnvironmentStringsW(name, result, currentSize);
- if (size == 0)
- {
- StringBuilderCache.Release(result);
- Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
- }
- }
-
- return StringBuilderCache.GetStringAndRelease(result);
- }
-
- private static string GetFolderPathCore(SpecialFolder folder, SpecialFolderOption option)
- {
- // We're using SHGetKnownFolderPath instead of SHGetFolderPath as SHGetFolderPath is
- // capped at MAX_PATH.
- //
- // Because we validate both of the input enums we shouldn't have to care about CSIDL and flag
- // definitions we haven't mapped. If we remove or loosen the checks we'd have to account
- // for mapping here (this includes tweaking as SHGetFolderPath would do).
- //
- // The only SpecialFolderOption defines we have are equivalent to KnownFolderFlags.
-
- string folderGuid;
-
- switch (folder)
- {
- case SpecialFolder.ApplicationData:
- folderGuid = Interop.Shell32.KnownFolders.RoamingAppData;
- break;
- case SpecialFolder.CommonApplicationData:
- folderGuid = Interop.Shell32.KnownFolders.ProgramData;
- break;
- case SpecialFolder.LocalApplicationData:
- folderGuid = Interop.Shell32.KnownFolders.LocalAppData;
- break;
- case SpecialFolder.Cookies:
- folderGuid = Interop.Shell32.KnownFolders.Cookies;
- break;
- case SpecialFolder.Desktop:
- folderGuid = Interop.Shell32.KnownFolders.Desktop;
- break;
- case SpecialFolder.Favorites:
- folderGuid = Interop.Shell32.KnownFolders.Favorites;
- break;
- case SpecialFolder.History:
- folderGuid = Interop.Shell32.KnownFolders.History;
- break;
- case SpecialFolder.InternetCache:
- folderGuid = Interop.Shell32.KnownFolders.InternetCache;
- break;
- case SpecialFolder.Programs:
- folderGuid = Interop.Shell32.KnownFolders.Programs;
- break;
- case SpecialFolder.MyComputer:
- folderGuid = Interop.Shell32.KnownFolders.ComputerFolder;
- break;
- case SpecialFolder.MyMusic:
- folderGuid = Interop.Shell32.KnownFolders.Music;
- break;
- case SpecialFolder.MyPictures:
- folderGuid = Interop.Shell32.KnownFolders.Pictures;
- break;
- case SpecialFolder.MyVideos:
- folderGuid = Interop.Shell32.KnownFolders.Videos;
- break;
- case SpecialFolder.Recent:
- folderGuid = Interop.Shell32.KnownFolders.Recent;
- break;
- case SpecialFolder.SendTo:
- folderGuid = Interop.Shell32.KnownFolders.SendTo;
- break;
- case SpecialFolder.StartMenu:
- folderGuid = Interop.Shell32.KnownFolders.StartMenu;
- break;
- case SpecialFolder.Startup:
- folderGuid = Interop.Shell32.KnownFolders.Startup;
- break;
- case SpecialFolder.System:
- folderGuid = Interop.Shell32.KnownFolders.System;
- break;
- case SpecialFolder.Templates:
- folderGuid = Interop.Shell32.KnownFolders.Templates;
- break;
- case SpecialFolder.DesktopDirectory:
- folderGuid = Interop.Shell32.KnownFolders.Desktop;
- break;
- case SpecialFolder.Personal:
- // Same as Personal
- // case SpecialFolder.MyDocuments:
- folderGuid = Interop.Shell32.KnownFolders.Documents;
- break;
- case SpecialFolder.ProgramFiles:
- folderGuid = Interop.Shell32.KnownFolders.ProgramFiles;
- break;
- case SpecialFolder.CommonProgramFiles:
- folderGuid = Interop.Shell32.KnownFolders.ProgramFilesCommon;
- break;
- case SpecialFolder.AdminTools:
- folderGuid = Interop.Shell32.KnownFolders.AdminTools;
- break;
- case SpecialFolder.CDBurning:
- folderGuid = Interop.Shell32.KnownFolders.CDBurning;
- break;
- case SpecialFolder.CommonAdminTools:
- folderGuid = Interop.Shell32.KnownFolders.CommonAdminTools;
- break;
- case SpecialFolder.CommonDocuments:
- folderGuid = Interop.Shell32.KnownFolders.PublicDocuments;
- break;
- case SpecialFolder.CommonMusic:
- folderGuid = Interop.Shell32.KnownFolders.PublicMusic;
- break;
- case SpecialFolder.CommonOemLinks:
- folderGuid = Interop.Shell32.KnownFolders.CommonOEMLinks;
- break;
- case SpecialFolder.CommonPictures:
- folderGuid = Interop.Shell32.KnownFolders.PublicPictures;
- break;
- case SpecialFolder.CommonStartMenu:
- folderGuid = Interop.Shell32.KnownFolders.CommonStartMenu;
- break;
- case SpecialFolder.CommonPrograms:
- folderGuid = Interop.Shell32.KnownFolders.CommonPrograms;
- break;
- case SpecialFolder.CommonStartup:
- folderGuid = Interop.Shell32.KnownFolders.CommonStartup;
- break;
- case SpecialFolder.CommonDesktopDirectory:
- folderGuid = Interop.Shell32.KnownFolders.PublicDesktop;
- break;
- case SpecialFolder.CommonTemplates:
- folderGuid = Interop.Shell32.KnownFolders.CommonTemplates;
- break;
- case SpecialFolder.CommonVideos:
- folderGuid = Interop.Shell32.KnownFolders.PublicVideos;
- break;
- case SpecialFolder.Fonts:
- folderGuid = Interop.Shell32.KnownFolders.Fonts;
- break;
- case SpecialFolder.NetworkShortcuts:
- folderGuid = Interop.Shell32.KnownFolders.NetHood;
- break;
- case SpecialFolder.PrinterShortcuts:
- folderGuid = Interop.Shell32.KnownFolders.PrintersFolder;
- break;
- case SpecialFolder.UserProfile:
- folderGuid = Interop.Shell32.KnownFolders.Profile;
- break;
- case SpecialFolder.CommonProgramFilesX86:
- folderGuid = Interop.Shell32.KnownFolders.ProgramFilesCommonX86;
- break;
- case SpecialFolder.ProgramFilesX86:
- folderGuid = Interop.Shell32.KnownFolders.ProgramFilesX86;
- break;
- case SpecialFolder.Resources:
- folderGuid = Interop.Shell32.KnownFolders.ResourceDir;
- break;
- case SpecialFolder.LocalizedResources:
- folderGuid = Interop.Shell32.KnownFolders.LocalizedResourcesDir;
- break;
- case SpecialFolder.SystemX86:
- folderGuid = Interop.Shell32.KnownFolders.SystemX86;
- break;
- case SpecialFolder.Windows:
- folderGuid = Interop.Shell32.KnownFolders.Windows;
- break;
- default:
- return string.Empty;
- }
-
- return GetKnownFolderPath(folderGuid, option);
- }
-
- private static string GetKnownFolderPath(string folderGuid, SpecialFolderOption option)
- {
- Guid folderId = new Guid(folderGuid);
-
- string path;
- int hr = Interop.Shell32.SHGetKnownFolderPath(folderId, (uint)option, IntPtr.Zero, out path);
- if (hr != 0) // Not S_OK
- {
- return string.Empty;
- }
-
- return path;
- }
-
- private static bool Is64BitOperatingSystemWhen32BitProcess
- {
- get
- {
- bool isWow64;
- return Interop.Kernel32.IsWow64Process(Interop.Kernel32.GetCurrentProcess(), out isWow64) && isWow64;
- }
- }
-
- public static string MachineName
+ static partial void GetUserName(ref string username)
{
- get
+ // Use GetUserNameExW, as GetUserNameW isn't available on all platforms, e.g. Win7
+ var domainName = new StringBuilder(1024);
+ uint domainNameLen = (uint)domainName.Capacity;
+ if (Interop.Secur32.GetUserNameExW(Interop.Secur32.NameSamCompatible, domainName, ref domainNameLen) == 1)
{
- string name = Interop.Kernel32.GetComputerName();
- if (name == null)
+ string samName = domainName.ToString();
+ int index = samName.IndexOf('\\');
+ if (index != -1)
{
- throw new InvalidOperationException(SR.InvalidOperation_ComputerName);
+ username = samName.Substring(index + 1);
+ return;
}
- return name;
}
- }
- private static unsafe Lazy<OperatingSystem> s_osVersion = new Lazy<OperatingSystem>(() =>
- {
- var version = new Interop.Kernel32.OSVERSIONINFOEX { dwOSVersionInfoSize = sizeof(Interop.Kernel32.OSVERSIONINFOEX) };
- if (!Interop.Kernel32.GetVersionExW(ref version))
- {
- throw new InvalidOperationException(SR.InvalidOperation_GetVersion);
- }
-
- return new OperatingSystem(
- PlatformID.Win32NT,
- new Version(version.dwMajorVersion, version.dwMinorVersion, version.dwBuildNumber, (version.wServicePackMajor << 16) | version.wServicePackMinor),
- Marshal.PtrToStringUni((IntPtr)version.szCSDVersion));
- });
-
- public static int ProcessorCount
- {
- get
- {
- // First try GetLogicalProcessorInformationEx, caching the result as desktop/coreclr does.
- // If that fails for some reason, fall back to a non-cached result from GetSystemInfo.
- // (See SystemNative::GetProcessorCount in coreclr for a comparison.)
- int pc = s_processorCountFromGetLogicalProcessorInformationEx.Value;
- return pc != 0 ? pc : ProcessorCountFromSystemInfo;
- }
+ username = string.Empty;
}
- private static readonly unsafe Lazy<int> s_processorCountFromGetLogicalProcessorInformationEx = new Lazy<int>(() =>
+ static partial void GetDomainName(ref string userDomainName)
{
- // Determine how much size we need for a call to GetLogicalProcessorInformationEx
- uint len = 0;
- if (!Interop.Kernel32.GetLogicalProcessorInformationEx(Interop.Kernel32.LOGICAL_PROCESSOR_RELATIONSHIP.RelationGroup, IntPtr.Zero, ref len) &&
- Marshal.GetLastWin32Error() == Interop.Errors.ERROR_INSUFFICIENT_BUFFER)
+ var domainName = new StringBuilder(1024);
+ uint domainNameLen = (uint)domainName.Capacity;
+ if (Interop.Secur32.GetUserNameExW(Interop.Secur32.NameSamCompatible, domainName, ref domainNameLen) == 1)
{
- // Allocate that much space
- Debug.Assert(len > 0);
- var buffer = new byte[len];
- fixed (byte* bufferPtr = buffer)
+ string samName = domainName.ToString();
+ int index = samName.IndexOf('\\');
+ if (index != -1)
{
- // Call GetLogicalProcessorInformationEx with the allocated buffer
- if (Interop.Kernel32.GetLogicalProcessorInformationEx(Interop.Kernel32.LOGICAL_PROCESSOR_RELATIONSHIP.RelationGroup, (IntPtr)bufferPtr, ref len))
- {
- // Walk each SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX in the buffer, where the Size of each dictates how
- // much space it's consuming. For each group relation, count the number of active processors in each of its group infos.
- int processorCount = 0;
- byte* ptr = bufferPtr, endPtr = bufferPtr + len;
- while (ptr < endPtr)
- {
- var current = (Interop.Kernel32.SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*)ptr;
- if (current->Relationship == Interop.Kernel32.LOGICAL_PROCESSOR_RELATIONSHIP.RelationGroup)
- {
- Interop.Kernel32.PROCESSOR_GROUP_INFO* groupInfo = &current->Group.GroupInfo;
- int groupCount = current->Group.ActiveGroupCount;
- for (int i = 0; i < groupCount; i++)
- {
- processorCount += (groupInfo + i)->ActiveProcessorCount;
- }
- }
- ptr += current->Size;
- }
- return processorCount;
- }
+ userDomainName = samName.Substring(0, index);
+ return;
}
}
+ domainNameLen = (uint)domainName.Capacity;
- return 0;
- });
-
- public static string SystemDirectory
- {
- get
+ byte[] sid = new byte[1024];
+ int sidLen = sid.Length;
+ int peUse;
+ if (!Interop.Advapi32.LookupAccountNameW(null, UserName, sid, ref sidLen, domainName, ref domainNameLen, out peUse))
{
- StringBuilder sb = StringBuilderCache.Acquire(PathInternal.MaxShortPath);
- if (Interop.Kernel32.GetSystemDirectoryW(sb, PathInternal.MaxShortPath) == 0)
- {
- StringBuilderCache.Release(sb);
- throw Win32Marshal.GetExceptionForLastWin32Error();
- }
- return StringBuilderCache.GetStringAndRelease(sb);
+ throw new InvalidOperationException(Win32Marshal.GetExceptionForLastWin32Error().Message);
}
- }
- public static string UserName
- {
- get
- {
- // Use GetUserNameExW, as GetUserNameW isn't available on all platforms, e.g. Win7
- var domainName = new StringBuilder(1024);
- uint domainNameLen = (uint)domainName.Capacity;
- if (Interop.Secur32.GetUserNameExW(Interop.Secur32.NameSamCompatible, domainName, ref domainNameLen) == 1)
- {
- string samName = domainName.ToString();
- int index = samName.IndexOf('\\');
- if (index != -1)
- {
- return samName.Substring(index + 1);
- }
- }
-
- return string.Empty;
- }
- }
-
- public static string UserDomainName
- {
- get
- {
- var domainName = new StringBuilder(1024);
- uint domainNameLen = (uint)domainName.Capacity;
- if (Interop.Secur32.GetUserNameExW(Interop.Secur32.NameSamCompatible, domainName, ref domainNameLen) == 1)
- {
- string samName = domainName.ToString();
- int index = samName.IndexOf('\\');
- if (index != -1)
- {
- return samName.Substring(0, index);
- }
- }
- domainNameLen = (uint)domainName.Capacity;
-
- byte[] sid = new byte[1024];
- int sidLen = sid.Length;
- int peUse;
- if (!Interop.Advapi32.LookupAccountNameW(null, UserName, sid, ref sidLen, domainName, ref domainNameLen, out peUse))
- {
- throw new InvalidOperationException(Win32Marshal.GetExceptionForLastWin32Error().Message);
- }
-
- return domainName.ToString();
- }
+ userDomainName = domainName.ToString();
}
-
}
}
diff --git a/src/System.Runtime.Extensions/src/System/Environment.Windows.cs b/src/System.Runtime.Extensions/src/System/Environment.Windows.cs
index eda4e92fff..c4781e2f14 100644
--- a/src/System.Runtime.Extensions/src/System/Environment.Windows.cs
+++ b/src/System.Runtime.Extensions/src/System/Environment.Windows.cs
@@ -2,9 +2,11 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
+using Internal.Runtime.Augments;
namespace System
{
@@ -85,5 +87,340 @@ namespace System
return info.dwPageSize;
}
}
+
+ public static int ExitCode { get { return EnvironmentAugments.ExitCode; } set { EnvironmentAugments.ExitCode = value; } }
+
+ private static string ExpandEnvironmentVariablesCore(string name)
+ {
+ int currentSize = 100;
+ StringBuilder result = StringBuilderCache.Acquire(currentSize); // A somewhat reasonable default size
+
+ result.Length = 0;
+ int size = Interop.Kernel32.ExpandEnvironmentStringsW(name, result, currentSize);
+ if (size == 0)
+ {
+ StringBuilderCache.Release(result);
+ Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
+ }
+
+ while (size > currentSize)
+ {
+ currentSize = size;
+ result.Length = 0;
+ result.Capacity = currentSize;
+
+ size = Interop.Kernel32.ExpandEnvironmentStringsW(name, result, currentSize);
+ if (size == 0)
+ {
+ StringBuilderCache.Release(result);
+ Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
+ }
+ }
+
+ return StringBuilderCache.GetStringAndRelease(result);
+ }
+
+ private static string GetFolderPathCore(SpecialFolder folder, SpecialFolderOption option)
+ {
+ // We're using SHGetKnownFolderPath instead of SHGetFolderPath as SHGetFolderPath is
+ // capped at MAX_PATH.
+ //
+ // Because we validate both of the input enums we shouldn't have to care about CSIDL and flag
+ // definitions we haven't mapped. If we remove or loosen the checks we'd have to account
+ // for mapping here (this includes tweaking as SHGetFolderPath would do).
+ //
+ // The only SpecialFolderOption defines we have are equivalent to KnownFolderFlags.
+
+ string folderGuid;
+
+ switch (folder)
+ {
+ case SpecialFolder.ApplicationData:
+ folderGuid = Interop.Shell32.KnownFolders.RoamingAppData;
+ break;
+ case SpecialFolder.CommonApplicationData:
+ folderGuid = Interop.Shell32.KnownFolders.ProgramData;
+ break;
+ case SpecialFolder.LocalApplicationData:
+ folderGuid = Interop.Shell32.KnownFolders.LocalAppData;
+ break;
+ case SpecialFolder.Cookies:
+ folderGuid = Interop.Shell32.KnownFolders.Cookies;
+ break;
+ case SpecialFolder.Desktop:
+ folderGuid = Interop.Shell32.KnownFolders.Desktop;
+ break;
+ case SpecialFolder.Favorites:
+ folderGuid = Interop.Shell32.KnownFolders.Favorites;
+ break;
+ case SpecialFolder.History:
+ folderGuid = Interop.Shell32.KnownFolders.History;
+ break;
+ case SpecialFolder.InternetCache:
+ folderGuid = Interop.Shell32.KnownFolders.InternetCache;
+ break;
+ case SpecialFolder.Programs:
+ folderGuid = Interop.Shell32.KnownFolders.Programs;
+ break;
+ case SpecialFolder.MyComputer:
+ folderGuid = Interop.Shell32.KnownFolders.ComputerFolder;
+ break;
+ case SpecialFolder.MyMusic:
+ folderGuid = Interop.Shell32.KnownFolders.Music;
+ break;
+ case SpecialFolder.MyPictures:
+ folderGuid = Interop.Shell32.KnownFolders.Pictures;
+ break;
+ case SpecialFolder.MyVideos:
+ folderGuid = Interop.Shell32.KnownFolders.Videos;
+ break;
+ case SpecialFolder.Recent:
+ folderGuid = Interop.Shell32.KnownFolders.Recent;
+ break;
+ case SpecialFolder.SendTo:
+ folderGuid = Interop.Shell32.KnownFolders.SendTo;
+ break;
+ case SpecialFolder.StartMenu:
+ folderGuid = Interop.Shell32.KnownFolders.StartMenu;
+ break;
+ case SpecialFolder.Startup:
+ folderGuid = Interop.Shell32.KnownFolders.Startup;
+ break;
+ case SpecialFolder.System:
+ folderGuid = Interop.Shell32.KnownFolders.System;
+ break;
+ case SpecialFolder.Templates:
+ folderGuid = Interop.Shell32.KnownFolders.Templates;
+ break;
+ case SpecialFolder.DesktopDirectory:
+ folderGuid = Interop.Shell32.KnownFolders.Desktop;
+ break;
+ case SpecialFolder.Personal:
+ // Same as Personal
+ // case SpecialFolder.MyDocuments:
+ folderGuid = Interop.Shell32.KnownFolders.Documents;
+ break;
+ case SpecialFolder.ProgramFiles:
+ folderGuid = Interop.Shell32.KnownFolders.ProgramFiles;
+ break;
+ case SpecialFolder.CommonProgramFiles:
+ folderGuid = Interop.Shell32.KnownFolders.ProgramFilesCommon;
+ break;
+ case SpecialFolder.AdminTools:
+ folderGuid = Interop.Shell32.KnownFolders.AdminTools;
+ break;
+ case SpecialFolder.CDBurning:
+ folderGuid = Interop.Shell32.KnownFolders.CDBurning;
+ break;
+ case SpecialFolder.CommonAdminTools:
+ folderGuid = Interop.Shell32.KnownFolders.CommonAdminTools;
+ break;
+ case SpecialFolder.CommonDocuments:
+ folderGuid = Interop.Shell32.KnownFolders.PublicDocuments;
+ break;
+ case SpecialFolder.CommonMusic:
+ folderGuid = Interop.Shell32.KnownFolders.PublicMusic;
+ break;
+ case SpecialFolder.CommonOemLinks:
+ folderGuid = Interop.Shell32.KnownFolders.CommonOEMLinks;
+ break;
+ case SpecialFolder.CommonPictures:
+ folderGuid = Interop.Shell32.KnownFolders.PublicPictures;
+ break;
+ case SpecialFolder.CommonStartMenu:
+ folderGuid = Interop.Shell32.KnownFolders.CommonStartMenu;
+ break;
+ case SpecialFolder.CommonPrograms:
+ folderGuid = Interop.Shell32.KnownFolders.CommonPrograms;
+ break;
+ case SpecialFolder.CommonStartup:
+ folderGuid = Interop.Shell32.KnownFolders.CommonStartup;
+ break;
+ case SpecialFolder.CommonDesktopDirectory:
+ folderGuid = Interop.Shell32.KnownFolders.PublicDesktop;
+ break;
+ case SpecialFolder.CommonTemplates:
+ folderGuid = Interop.Shell32.KnownFolders.CommonTemplates;
+ break;
+ case SpecialFolder.CommonVideos:
+ folderGuid = Interop.Shell32.KnownFolders.PublicVideos;
+ break;
+ case SpecialFolder.Fonts:
+ folderGuid = Interop.Shell32.KnownFolders.Fonts;
+ break;
+ case SpecialFolder.NetworkShortcuts:
+ folderGuid = Interop.Shell32.KnownFolders.NetHood;
+ break;
+ case SpecialFolder.PrinterShortcuts:
+ folderGuid = Interop.Shell32.KnownFolders.PrintersFolder;
+ break;
+ case SpecialFolder.UserProfile:
+ folderGuid = Interop.Shell32.KnownFolders.Profile;
+ break;
+ case SpecialFolder.CommonProgramFilesX86:
+ folderGuid = Interop.Shell32.KnownFolders.ProgramFilesCommonX86;
+ break;
+ case SpecialFolder.ProgramFilesX86:
+ folderGuid = Interop.Shell32.KnownFolders.ProgramFilesX86;
+ break;
+ case SpecialFolder.Resources:
+ folderGuid = Interop.Shell32.KnownFolders.ResourceDir;
+ break;
+ case SpecialFolder.LocalizedResources:
+ folderGuid = Interop.Shell32.KnownFolders.LocalizedResourcesDir;
+ break;
+ case SpecialFolder.SystemX86:
+ folderGuid = Interop.Shell32.KnownFolders.SystemX86;
+ break;
+ case SpecialFolder.Windows:
+ folderGuid = Interop.Shell32.KnownFolders.Windows;
+ break;
+ default:
+ return string.Empty;
+ }
+
+ return GetKnownFolderPath(folderGuid, option);
+ }
+
+ private static string GetKnownFolderPath(string folderGuid, SpecialFolderOption option)
+ {
+ Guid folderId = new Guid(folderGuid);
+
+ string path;
+ int hr = Interop.Shell32.SHGetKnownFolderPath(folderId, (uint)option, IntPtr.Zero, out path);
+ if (hr != 0) // Not S_OK
+ {
+ return string.Empty;
+ }
+
+ return path;
+ }
+
+ private static bool Is64BitOperatingSystemWhen32BitProcess
+ {
+ get
+ {
+ bool isWow64;
+ return Interop.Kernel32.IsWow64Process(Interop.Kernel32.GetCurrentProcess(), out isWow64) && isWow64;
+ }
+ }
+
+ public static string MachineName
+ {
+ get
+ {
+ string name = Interop.Kernel32.GetComputerName();
+ if (name == null)
+ {
+ throw new InvalidOperationException(SR.InvalidOperation_ComputerName);
+ }
+ return name;
+ }
+ }
+
+ private static unsafe Lazy<OperatingSystem> s_osVersion = new Lazy<OperatingSystem>(() =>
+ {
+ var version = new Interop.Kernel32.OSVERSIONINFOEX { dwOSVersionInfoSize = sizeof(Interop.Kernel32.OSVERSIONINFOEX) };
+ if (!Interop.Kernel32.GetVersionExW(ref version))
+ {
+ throw new InvalidOperationException(SR.InvalidOperation_GetVersion);
+ }
+
+ return new OperatingSystem(
+ PlatformID.Win32NT,
+ new Version(version.dwMajorVersion, version.dwMinorVersion, version.dwBuildNumber, (version.wServicePackMajor << 16) | version.wServicePackMinor),
+ Marshal.PtrToStringUni((IntPtr)version.szCSDVersion));
+ });
+
+ public static int ProcessorCount
+ {
+ get
+ {
+ // First try GetLogicalProcessorInformationEx, caching the result as desktop/coreclr does.
+ // If that fails for some reason, fall back to a non-cached result from GetSystemInfo.
+ // (See SystemNative::GetProcessorCount in coreclr for a comparison.)
+ int pc = s_processorCountFromGetLogicalProcessorInformationEx.Value;
+ return pc != 0 ? pc : ProcessorCountFromSystemInfo;
+ }
+ }
+
+ private static readonly unsafe Lazy<int> s_processorCountFromGetLogicalProcessorInformationEx = new Lazy<int>(() =>
+ {
+ // Determine how much size we need for a call to GetLogicalProcessorInformationEx
+ uint len = 0;
+ if (!Interop.Kernel32.GetLogicalProcessorInformationEx(Interop.Kernel32.LOGICAL_PROCESSOR_RELATIONSHIP.RelationGroup, IntPtr.Zero, ref len) &&
+ Marshal.GetLastWin32Error() == Interop.Errors.ERROR_INSUFFICIENT_BUFFER)
+ {
+ // Allocate that much space
+ Debug.Assert(len > 0);
+ var buffer = new byte[len];
+ fixed (byte* bufferPtr = buffer)
+ {
+ // Call GetLogicalProcessorInformationEx with the allocated buffer
+ if (Interop.Kernel32.GetLogicalProcessorInformationEx(Interop.Kernel32.LOGICAL_PROCESSOR_RELATIONSHIP.RelationGroup, (IntPtr)bufferPtr, ref len))
+ {
+ // Walk each SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX in the buffer, where the Size of each dictates how
+ // much space it's consuming. For each group relation, count the number of active processors in each of its group infos.
+ int processorCount = 0;
+ byte* ptr = bufferPtr, endPtr = bufferPtr + len;
+ while (ptr < endPtr)
+ {
+ var current = (Interop.Kernel32.SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*)ptr;
+ if (current->Relationship == Interop.Kernel32.LOGICAL_PROCESSOR_RELATIONSHIP.RelationGroup)
+ {
+ Interop.Kernel32.PROCESSOR_GROUP_INFO* groupInfo = &current->Group.GroupInfo;
+ int groupCount = current->Group.ActiveGroupCount;
+ for (int i = 0; i < groupCount; i++)
+ {
+ processorCount += (groupInfo + i)->ActiveProcessorCount;
+ }
+ }
+ ptr += current->Size;
+ }
+ return processorCount;
+ }
+ }
+ }
+
+ return 0;
+ });
+
+ public static string SystemDirectory
+ {
+ get
+ {
+ StringBuilder sb = StringBuilderCache.Acquire(PathInternal.MaxShortPath);
+ if (Interop.Kernel32.GetSystemDirectoryW(sb, PathInternal.MaxShortPath) == 0)
+ {
+ StringBuilderCache.Release(sb);
+ throw Win32Marshal.GetExceptionForLastWin32Error();
+ }
+ return StringBuilderCache.GetStringAndRelease(sb);
+ }
+ }
+
+ public static string UserName
+ {
+ get
+ {
+ string username = "Windows User";
+ GetUserName(ref username);
+ return username;
+ }
+ }
+
+ static partial void GetUserName(ref string username);
+
+ public static string UserDomainName
+ {
+ get
+ {
+ string userDomainName = "Windows Domain";
+ GetDomainName(ref userDomainName);
+ return userDomainName;
+ }
+ }
+
+ static partial void GetDomainName(ref string userDomainName);
}
}
diff --git a/src/System.Runtime.Extensions/src/System/Environment.cs b/src/System.Runtime.Extensions/src/System/Environment.cs
index 1634846cf9..ca2f9bfa49 100644
--- a/src/System.Runtime.Extensions/src/System/Environment.cs
+++ b/src/System.Runtime.Extensions/src/System/Environment.cs
@@ -4,6 +4,7 @@
using Internal.Runtime.Augments;
using System.Collections;
+using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
@@ -31,13 +32,23 @@ namespace System
//
// While we could pass Hashtable back from CoreCLR the type is also defined here. We only
// want to surface the local Hashtable.
- return new Hashtable(EnvironmentAugments.GetEnvironmentVariables());
+ return EnvironmentAugments.EnumerateEnvironmentVariables().ToHashtable();
}
public static IDictionary GetEnvironmentVariables(EnvironmentVariableTarget target)
{
// See comments in GetEnvironmentVariables()
- return new Hashtable(EnvironmentAugments.GetEnvironmentVariables(target));
+ return EnvironmentAugments.EnumerateEnvironmentVariables(target).ToHashtable();
+ }
+
+ private static Hashtable ToHashtable(this IEnumerable<KeyValuePair<string, string>> pairs)
+ {
+ Hashtable hashTable = new Hashtable();
+ foreach (KeyValuePair<string, string> pair in pairs)
+ {
+ hashTable.Add(pair.Key, pair.Value);
+ }
+ return hashTable;
}
public static void SetEnvironmentVariable(string variable, string value)
diff --git a/src/System.Runtime.Extensions/tests/AssemblyResolveTests/AssemblyResolveTests.csproj b/src/System.Runtime.Extensions/tests/AssemblyResolveTests/AssemblyResolveTests.csproj
index bca454c68a..93ad3ceb18 100644
--- a/src/System.Runtime.Extensions/tests/AssemblyResolveTests/AssemblyResolveTests.csproj
+++ b/src/System.Runtime.Extensions/tests/AssemblyResolveTests/AssemblyResolveTests.csproj
@@ -2,7 +2,7 @@
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <ProjectGuid>ad83807c-8be5-4f27-85df-9793613233e1</ProjectGuid>
+ <ProjectGuid>{E60AFAE8-2EA7-471C-9E24-52A99453B26B}</ProjectGuid>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.Runtime.Extensions/tests/System.Runtime.Extensions.Tests.csproj b/src/System.Runtime.Extensions/tests/System.Runtime.Extensions.Tests.csproj
index f5391806da..b6f2852073 100644
--- a/src/System.Runtime.Extensions/tests/System.Runtime.Extensions.Tests.csproj
+++ b/src/System.Runtime.Extensions/tests/System.Runtime.Extensions.Tests.csproj
@@ -4,7 +4,7 @@
<PropertyGroup>
<ProjectGuid>{6C314C9B-3D28-4B05-9B4C-B57A00A9B3B9}</ProjectGuid>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <DefineConstants Condition="'$(TargetsUnix)' == 'true'" >$(DefineConstants);Unix</DefineConstants>
+ <DefineConstants Condition="'$(TargetsUnix)' == 'true'">$(DefineConstants);Unix</DefineConstants>
<DefineConstants Condition="'$(TargetGroup)'=='netcoreapp'">$(DefineConstants);netcoreapp</DefineConstants>
<DefineConstants Condition="'$(TargetGroup)'=='uapaot'">$(DefineConstants);uapaot</DefineConstants>
</PropertyGroup>
@@ -39,6 +39,8 @@
<Compile Include="System\UnloadingAndProcessExitTests.netcoreapp.cs" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="System\Environment.UserDomainName.cs" />
+ <Compile Include="System\Environment.UserName.cs" />
<Compile Include="System\Diagnostics\Stopwatch.cs" />
<Compile Include="System\Environment.MachineName.cs" />
<Compile Include="System\IO\Path.Combine.cs" />
@@ -127,4 +129,4 @@
</ProjectReference>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
+</Project> \ No newline at end of file
diff --git a/src/System.Runtime.Extensions/tests/System/Environment.Exit.cs b/src/System.Runtime.Extensions/tests/System/Environment.Exit.cs
index caac4bd27b..20d029c9c5 100644
--- a/src/System.Runtime.Extensions/tests/System/Environment.Exit.cs
+++ b/src/System.Runtime.Extensions/tests/System/Environment.Exit.cs
@@ -23,6 +23,7 @@ namespace System.Tests
[Theory]
[MemberData(nameof(ExitCodeValues))]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/19909 - RemoteInvoke returns a null Process on UapAot.", TargetFrameworkMonikers.UapAot)]
public static void CheckExitCode(int expectedExitCode)
{
using (Process p = RemoteInvoke(s => int.Parse(s), expectedExitCode.ToString()).Process)
@@ -53,6 +54,7 @@ namespace System.Tests
[InlineData(1)] // setting ExitCode and exiting Main
[InlineData(2)] // setting ExitCode both from Main and from an Unloading event handler.
[InlineData(3)] // using Exit(exitCode)
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20387 - ILC test pipeline does not accomodate tests in child processes built into custom assemblies.", TargetFrameworkMonikers.UapAot)]
public static void ExitCode_VoidMainAppReturnsSetValue(int mode)
{
int expectedExitCode = 123;
diff --git a/src/System.Runtime.Extensions/tests/System/Environment.GetCommandLineArgs.cs b/src/System.Runtime.Extensions/tests/System/Environment.GetCommandLineArgs.cs
index 713555d0b2..014edab8d7 100644
--- a/src/System.Runtime.Extensions/tests/System/Environment.GetCommandLineArgs.cs
+++ b/src/System.Runtime.Extensions/tests/System/Environment.GetCommandLineArgs.cs
@@ -8,6 +8,7 @@ using Xunit;
namespace System.Tests
{
+ [ActiveIssue("https://github.com/dotnet/corert/issues/3743 - Environment.GetCommandLineArgs() returning null on .Net Native", TargetFrameworkMonikers.UapAot)]
public class GetCommandLineArgs : RemoteExecutorTestBase
{
[Fact]
diff --git a/src/System.Runtime.Extensions/tests/System/Environment.SetEnvironmentVariable.cs b/src/System.Runtime.Extensions/tests/System/Environment.SetEnvironmentVariable.cs
index 957a907fd0..8ef769d3bb 100644
--- a/src/System.Runtime.Extensions/tests/System/Environment.SetEnvironmentVariable.cs
+++ b/src/System.Runtime.Extensions/tests/System/Environment.SetEnvironmentVariable.cs
@@ -107,7 +107,7 @@ namespace System.Tests
() =>
{
// Clear the test variable
- Environment.SetEnvironmentVariable(varName, null);
+ Environment.SetEnvironmentVariable(varName, null, target);
});
}
@@ -142,7 +142,7 @@ namespace System.Tests
() =>
{
// Clear the test variable
- Environment.SetEnvironmentVariable(varName, null);
+ Environment.SetEnvironmentVariable(varName, null, target);
});
}
diff --git a/src/System.Runtime.Extensions/tests/System/Environment.StackTrace.cs b/src/System.Runtime.Extensions/tests/System/Environment.StackTrace.cs
index 05f592a22e..d332089775 100644
--- a/src/System.Runtime.Extensions/tests/System/Environment.StackTrace.cs
+++ b/src/System.Runtime.Extensions/tests/System/Environment.StackTrace.cs
@@ -16,6 +16,7 @@ namespace System.Tests
static string s_stackTrace;
[Fact]
+ [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "UapAot does not support nice stack traces. It's for people who like performance.")]
public void StackTraceTest()
{
//arrange
@@ -69,6 +70,7 @@ namespace System.Tests
[Fact]
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "On Desktop, Environment.StackTrace contains internal frames")]
+ [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "UapAot does not support nice stack traces. It's for people who like performance.")]
public void StackTraceDoesNotStartWithInternalFrame()
{
string stackTrace = Environment.StackTrace;
diff --git a/src/System.Runtime.Extensions/tests/System/Environment.UserDomainName.cs b/src/System.Runtime.Extensions/tests/System/Environment.UserDomainName.cs
new file mode 100644
index 0000000000..b879bf5fe1
--- /dev/null
+++ b/src/System.Runtime.Extensions/tests/System/Environment.UserDomainName.cs
@@ -0,0 +1,22 @@
+using Xunit;
+
+namespace System.Tests
+{
+ public class EnvironmentUserDomainName
+ {
+ [Fact]
+ [SkipOnTargetFramework(~TargetFrameworkMonikers.Uap)]
+ public void UserDomainNameIsHardCodedOnUap()
+ {
+ Assert.Equal("Windows Domain", Environment.UserDomainName);
+ }
+
+ [Fact]
+ [SkipOnTargetFramework(TargetFrameworkMonikers.Uap)]
+ public void UserDomainNameIsCorrectOnNonUap()
+ {
+ // Highly unlikely anyone is using domain with this name
+ Assert.NotEqual("Windows Domain", Environment.UserDomainName);
+ }
+ }
+}
diff --git a/src/System.Runtime.Extensions/tests/System/Environment.UserName.cs b/src/System.Runtime.Extensions/tests/System/Environment.UserName.cs
new file mode 100644
index 0000000000..bd7f7cc764
--- /dev/null
+++ b/src/System.Runtime.Extensions/tests/System/Environment.UserName.cs
@@ -0,0 +1,22 @@
+using Xunit;
+
+namespace System.Tests
+{
+ public class EnvironmentUserName
+ {
+ [Fact]
+ [SkipOnTargetFramework(~TargetFrameworkMonikers.Uap)]
+ public void UserNameIsHardCodedOnUap()
+ {
+ Assert.Equal("Windows User", Environment.UserName);
+ }
+
+ [Fact]
+ [SkipOnTargetFramework(TargetFrameworkMonikers.Uap)]
+ public void UserNameIsCorrectOnNonUap()
+ {
+ // Highly unlikely anyone is using user with this name
+ Assert.NotEqual("Windows User", Environment.UserName);
+ }
+ }
+}
diff --git a/src/System.Runtime.Extensions/tests/System/Math.cs b/src/System.Runtime.Extensions/tests/System/Math.cs
index 4a021d072c..8f3dc1bab5 100644
--- a/src/System.Runtime.Extensions/tests/System/Math.cs
+++ b/src/System.Runtime.Extensions/tests/System/Math.cs
@@ -4,6 +4,7 @@
using Xunit;
using Xunit.Sdk;
+using System.Collections.Generic;
namespace System.Tests
{
@@ -564,98 +565,106 @@ namespace System.Tests
AssertEqual(expectedResult, Math.Atan(value), allowedVariance);
}
+ public static IEnumerable<object[]> Atan2_TestData
+ {
+ get
+ {
+ yield return new object[] { double.NegativeInfinity, -1.0, -1.5707963267948966, CrossPlatformMachineEpsilon * 10 }; // expected: -(pi / 2)
+ yield return new object[] { double.NegativeInfinity, -0.0, -1.5707963267948966, CrossPlatformMachineEpsilon * 10 }; // expected: -(pi / 2)
+ yield return new object[] { double.NegativeInfinity, double.NaN, double.NaN, 0.0 };
+ yield return new object[] { double.NegativeInfinity, 0.0, -1.5707963267948966, CrossPlatformMachineEpsilon * 10 }; // expected: -(pi / 2)
+ yield return new object[] { double.NegativeInfinity, 1.0, -1.5707963267948966, CrossPlatformMachineEpsilon * 10 }; // expected: -(pi / 2)
+ yield return new object[] { -1.0, -1.0, -2.3561944901923449, CrossPlatformMachineEpsilon * 10 }; // expected: -(3 * pi / 4)
+ yield return new object[] { -1.0, -0.0, -1.5707963267948966, CrossPlatformMachineEpsilon * 10 }; // expected: -(pi / 2)
+ yield return new object[] { -1.0, double.NaN, double.NaN, 0.0 };
+ yield return new object[] { -1.0, 0.0, -1.5707963267948966, CrossPlatformMachineEpsilon * 10 }; // expected: -(pi / 2)
+ yield return new object[] { -1.0, 1.0, -0.78539816339744831, CrossPlatformMachineEpsilon }; // expected: -(pi / 4)
+ yield return new object[] { -1.0, double.PositiveInfinity, -0.0, 0.0 };
+ yield return new object[] { -0.99180624439366372, -0.12775121753523991, -1.6988976127008298, CrossPlatformMachineEpsilon * 10 }; // expected: -(pi - log2(e))
+ yield return new object[] { -0.99180624439366372, 0.12775121753523991, -1.4426950408889634, CrossPlatformMachineEpsilon * 10 }; // expected: -(log2(e))
+ yield return new object[] { -0.98776594599273553, -0.15594369476537447, -1.7273790912166982, CrossPlatformMachineEpsilon * 10 }; // expected: -(pi - sqrt(2))
+ yield return new object[] { -0.98776594599273553, 0.15594369476537447, -1.4142135623730950, CrossPlatformMachineEpsilon * 10 }; // expected: -(sqrt(2))
+ yield return new object[] { -0.90371945743584630, -0.42812514788535792, -2.0132134864942807, CrossPlatformMachineEpsilon * 10 }; // expected: -(pi - (2 / sqrt(pi))
+ yield return new object[] { -0.90371945743584630, 0.42812514788535792, -1.1283791670955126, CrossPlatformMachineEpsilon * 10 }; // expected: -(2 / sqrt(pi)
+ yield return new object[] { -0.84147098480789651, -0.54030230586813972, -2.1415926535897932, CrossPlatformMachineEpsilon * 10 }; // expected: -(pi - 1)
+ yield return new object[] { -0.84147098480789651, 0.54030230586813972, -1.0, CrossPlatformMachineEpsilon * 10 };
+ yield return new object[] { -0.74398033695749319, -0.66820151019031295, -2.3025850929940457, CrossPlatformMachineEpsilon * 10 }; // expected: -(ln(10))
+ yield return new object[] { -0.74398033695749319, 0.66820151019031295, -0.83900756059574755, CrossPlatformMachineEpsilon }; // expected: -(pi - ln(10))
+ yield return new object[] { -0.70710678118654752, -0.70710678118654752, -2.3561944901923449, CrossPlatformMachineEpsilon * 10 }; // expected: -(3 * pi / 4), y: -(1 / sqrt(2)) x: -(1 / sqrt(2))
+ yield return new object[] { -0.70710678118654752, 0.70710678118654752, -0.78539816339744831, CrossPlatformMachineEpsilon }; // expected: -(pi / 4), y: -(1 / sqrt(2)) x: (1 / sqrt(2))
+ yield return new object[] { -0.64963693908006244, -0.76024459707563015, -2.4344858724032457, CrossPlatformMachineEpsilon * 10 }; // expected: -(pi - (1 / sqrt(2))
+ yield return new object[] { -0.64963693908006244, 0.76024459707563015, -0.70710678118654752, CrossPlatformMachineEpsilon }; // expected: -(1 / sqrt(2))
+ yield return new object[] { -0.63896127631363480, -0.76923890136397213, -2.4484454730298479, CrossPlatformMachineEpsilon * 10 }; // expected: -(pi - ln(2))
+ yield return new object[] { -0.63896127631363480, 0.76923890136397213, -0.69314718055994531, CrossPlatformMachineEpsilon }; // expected: -(ln(2))
+ yield return new object[] { -0.59448076852482208, -0.80410982822879171, -2.5049728812222119, CrossPlatformMachineEpsilon * 10 }; // expected: -(pi - (2 / pi))
+ yield return new object[] { -0.59448076852482208, 0.80410982822879171, -0.63661977236758134, CrossPlatformMachineEpsilon }; // expected: -(2 / pi)
+ yield return new object[] { -0.42077048331375735, -0.90716712923909839, -2.7072981716865414, CrossPlatformMachineEpsilon * 10 }; // expected: -(pi - log10(e))
+ yield return new object[] { -0.42077048331375735, 0.90716712923909839, -0.43429448190325183, CrossPlatformMachineEpsilon }; // expected: -(log10(e))
+ yield return new object[] { -0.41078129050290870, -0.91173391478696510, -2.7182818284590452, CrossPlatformMachineEpsilon * 10 }; // expected: -(e)
+ yield return new object[] { -0.41078129050290870, 0.91173391478696510, -0.42331082513074800, CrossPlatformMachineEpsilon }; // expected: -(pi - e)
+ yield return new object[] { -0.31296179620778659, -0.94976571538163866, -2.8232827674060026, CrossPlatformMachineEpsilon * 10 }; // expected: -(pi - (1 / pi))
+ yield return new object[] { -0.31296179620778659, 0.94976571538163866, -0.31830988618379067, CrossPlatformMachineEpsilon }; // expected: -(1 / pi)
+ yield return new object[] { -0.0, double.NegativeInfinity, -3.1415926535897932, CrossPlatformMachineEpsilon * 10 }; // expected: -(pi)
+ yield return new object[] { -0.0, -1.0, -3.1415926535897932, CrossPlatformMachineEpsilon * 10 }; // expected: -(pi)
+ yield return new object[] { -0.0, -0.0, -3.1415926535897932, CrossPlatformMachineEpsilon * 10 }; // expected: -(pi)
+ yield return new object[] { -0.0, double.NaN, double.NaN, 0.0 };
+ yield return new object[] { -0.0, 0.0, -0.0, 0.0 };
+ yield return new object[] { -0.0, 1.0, -0.0, 0.0 };
+ yield return new object[] { -0.0, double.PositiveInfinity, -0.0, 0.0 };
+ yield return new object[] { double.NaN, double.NegativeInfinity, double.NaN, 0.0 };
+ yield return new object[] { double.NaN, -1.0, double.NaN, 0.0 };
+ yield return new object[] { double.NaN, -0.0, double.NaN, 0.0 };
+ yield return new object[] { double.NaN, double.NaN, double.NaN, 0.0 };
+ yield return new object[] { double.NaN, 0.0, double.NaN, 0.0 };
+ yield return new object[] { double.NaN, 1.0, double.NaN, 0.0 };
+ yield return new object[] { double.NaN, double.PositiveInfinity, double.NaN, 0.0 };
+ yield return new object[] { 0.0, double.NegativeInfinity, 3.1415926535897932, CrossPlatformMachineEpsilon * 10 }; // expected: (pi)
+ yield return new object[] { 0.0, -1.0, 3.1415926535897932, CrossPlatformMachineEpsilon * 10 }; // expected: (pi)
+ yield return new object[] { 0.0, -0.0, 3.1415926535897932, CrossPlatformMachineEpsilon * 10 }; // expected: (pi)
+ yield return new object[] { 0.0, double.NaN, double.NaN, 0.0 };
+ yield return new object[] { 0.0, 0.0, 0.0, 0.0 };
+ yield return new object[] { 0.0, 1.0, 0.0, 0.0 };
+ yield return new object[] { 0.0, double.PositiveInfinity, 0.0, 0.0 };
+ yield return new object[] { 0.31296179620778659, -0.94976571538163866, 2.8232827674060026, CrossPlatformMachineEpsilon * 10 }; // expected: (pi - (1 / pi))
+ yield return new object[] { 0.31296179620778659, 0.94976571538163866, 0.31830988618379067, CrossPlatformMachineEpsilon }; // expected: (1 / pi)
+ yield return new object[] { 0.41078129050290870, -0.91173391478696510, 2.7182818284590452, CrossPlatformMachineEpsilon * 10 }; // expected: (e)
+ yield return new object[] { 0.41078129050290870, 0.91173391478696510, 0.42331082513074800, CrossPlatformMachineEpsilon }; // expected: (pi - e)
+ yield return new object[] { 0.42077048331375735, -0.90716712923909839, 2.7072981716865414, CrossPlatformMachineEpsilon * 10 }; // expected: (pi - log10(e))
+ yield return new object[] { 0.42077048331375735, 0.90716712923909839, 0.43429448190325183, CrossPlatformMachineEpsilon }; // expected: (log10(e))
+ yield return new object[] { 0.59448076852482208, -0.80410982822879171, 2.5049728812222119, CrossPlatformMachineEpsilon * 10 }; // expected: (pi - (2 / pi))
+ yield return new object[] { 0.59448076852482208, 0.80410982822879171, 0.63661977236758134, CrossPlatformMachineEpsilon }; // expected: (2 / pi)
+ yield return new object[] { 0.63896127631363480, -0.76923890136397213, 2.4484454730298479, CrossPlatformMachineEpsilon * 10 }; // expected: (pi - ln(2))
+ yield return new object[] { 0.63896127631363480, 0.76923890136397213, 0.69314718055994531, CrossPlatformMachineEpsilon }; // expected: (ln(2))
+ yield return new object[] { 0.64963693908006244, -0.76024459707563015, 2.4344858724032457, CrossPlatformMachineEpsilon * 10 }; // expected: (pi - (1 / sqrt(2))
+ yield return new object[] { 0.64963693908006244, 0.76024459707563015, 0.70710678118654752, CrossPlatformMachineEpsilon }; // expected: (1 / sqrt(2))
+ yield return new object[] { 0.70710678118654752, -0.70710678118654752, 2.3561944901923449, CrossPlatformMachineEpsilon * 10 }; // expected: (3 * pi / 4), y: (1 / sqrt(2)) x: -(1 / sqrt(2))
+ yield return new object[] { 0.70710678118654752, 0.70710678118654752, 0.78539816339744831, CrossPlatformMachineEpsilon }; // expected: (pi / 4), y: (1 / sqrt(2)) x: (1 / sqrt(2))
+ yield return new object[] { 0.74398033695749319, -0.66820151019031295, 2.3025850929940457, CrossPlatformMachineEpsilon * 10 }; // expected: (ln(10))
+ yield return new object[] { 0.74398033695749319, 0.66820151019031295, 0.83900756059574755, CrossPlatformMachineEpsilon }; // expected: (pi - ln(10))
+ yield return new object[] { 0.84147098480789651, -0.54030230586813972, 2.1415926535897932, CrossPlatformMachineEpsilon * 10 }; // expected: (pi - 1)
+ yield return new object[] { 0.84147098480789651, 0.54030230586813972, 1.0, CrossPlatformMachineEpsilon * 10 };
+ yield return new object[] { 0.90371945743584630, -0.42812514788535792, 2.0132134864942807, CrossPlatformMachineEpsilon * 10 }; // expected: (pi - (2 / sqrt(pi))
+ yield return new object[] { 0.90371945743584630, 0.42812514788535792, 1.1283791670955126, CrossPlatformMachineEpsilon * 10 }; // expected: (2 / sqrt(pi))
+ yield return new object[] { 0.98776594599273553, -0.15594369476537447, 1.7273790912166982, CrossPlatformMachineEpsilon * 10 }; // expected: (pi - sqrt(2))
+ yield return new object[] { 0.98776594599273553, 0.15594369476537447, 1.4142135623730950, CrossPlatformMachineEpsilon * 10 }; // expected: (sqrt(2))
+ yield return new object[] { 0.99180624439366372, -0.12775121753523991, 1.6988976127008298, CrossPlatformMachineEpsilon * 10 }; // expected: (pi - log2(e))
+ yield return new object[] { 0.99180624439366372, 0.12775121753523991, 1.4426950408889634, CrossPlatformMachineEpsilon * 10 }; // expected: (log2(e))
+ yield return new object[] { 1.0, -1.0, 2.3561944901923449, CrossPlatformMachineEpsilon * 10 }; // expected: (3 * pi / 4)
+ yield return new object[] { 1.0, -0.0, 1.5707963267948966, CrossPlatformMachineEpsilon * 10 }; // expected: (pi / 2)
+ yield return new object[] { 1.0, double.NaN, double.NaN, 0.0 };
+ yield return new object[] { 1.0, 0.0, 1.5707963267948966, CrossPlatformMachineEpsilon * 10 }; // expected: (pi / 2)
+ yield return new object[] { 1.0, 1.0, 0.78539816339744831, CrossPlatformMachineEpsilon }; // expected: (pi / 4)
+ yield return new object[] { 1.0, double.PositiveInfinity, 0.0, 0.0 };
+ yield return new object[] { double.PositiveInfinity, -1.0, 1.5707963267948966, CrossPlatformMachineEpsilon * 10 }; // expected: (pi / 2)
+ yield return new object[] { double.PositiveInfinity, -0.0, 1.5707963267948966, CrossPlatformMachineEpsilon * 10 }; // expected: (pi / 2)
+ yield return new object[] { double.PositiveInfinity, double.NaN, double.NaN, 0.0 };
+ yield return new object[] { double.PositiveInfinity, 0.0, 1.5707963267948966, CrossPlatformMachineEpsilon * 10 }; // expected: (pi / 2)
+ yield return new object[] { double.PositiveInfinity, 1.0, 1.5707963267948966, CrossPlatformMachineEpsilon * 10 }; // expected: (pi / 2)
+ }
+ }
+
[Theory]
- [InlineData( double.NegativeInfinity, -1.0, -1.5707963267948966, CrossPlatformMachineEpsilon * 10)] // expected: -(pi / 2)
- [InlineData( double.NegativeInfinity, -0.0, -1.5707963267948966, CrossPlatformMachineEpsilon * 10)] // expected: -(pi / 2)
- [InlineData( double.NegativeInfinity, double.NaN, double.NaN, 0.0)]
- [InlineData( double.NegativeInfinity, 0.0, -1.5707963267948966, CrossPlatformMachineEpsilon * 10)] // expected: -(pi / 2)
- [InlineData( double.NegativeInfinity, 1.0, -1.5707963267948966, CrossPlatformMachineEpsilon * 10)] // expected: -(pi / 2)
- [InlineData(-1.0, -1.0, -2.3561944901923449, CrossPlatformMachineEpsilon * 10)] // expected: -(3 * pi / 4)
- [InlineData(-1.0, -0.0, -1.5707963267948966, CrossPlatformMachineEpsilon * 10)] // expected: -(pi / 2)
- [InlineData(-1.0, double.NaN, double.NaN, 0.0)]
- [InlineData(-1.0, 0.0, -1.5707963267948966, CrossPlatformMachineEpsilon * 10)] // expected: -(pi / 2)
- [InlineData(-1.0, 1.0, -0.78539816339744831, CrossPlatformMachineEpsilon)] // expected: -(pi / 4)
- [InlineData(-1.0, double.PositiveInfinity, -0.0, 0.0)]
- [InlineData(-0.99180624439366372, -0.12775121753523991, -1.6988976127008298, CrossPlatformMachineEpsilon * 10)] // expected: -(pi - log2(e))
- [InlineData(-0.99180624439366372, 0.12775121753523991, -1.4426950408889634, CrossPlatformMachineEpsilon * 10)] // expected: -(log2(e))
- [InlineData(-0.98776594599273553, -0.15594369476537447, -1.7273790912166982, CrossPlatformMachineEpsilon * 10)] // expected: -(pi - sqrt(2))
- [InlineData(-0.98776594599273553, 0.15594369476537447, -1.4142135623730950, CrossPlatformMachineEpsilon * 10)] // expected: -(sqrt(2))
- [InlineData(-0.90371945743584630, -0.42812514788535792, -2.0132134864942807, CrossPlatformMachineEpsilon * 10)] // expected: -(pi - (2 / sqrt(pi))
- [InlineData(-0.90371945743584630, 0.42812514788535792, -1.1283791670955126, CrossPlatformMachineEpsilon * 10)] // expected: -(2 / sqrt(pi)
- [InlineData(-0.84147098480789651, -0.54030230586813972, -2.1415926535897932, CrossPlatformMachineEpsilon * 10)] // expected: -(pi - 1)
- [InlineData(-0.84147098480789651, 0.54030230586813972, -1.0, CrossPlatformMachineEpsilon * 10)]
- [InlineData(-0.74398033695749319, -0.66820151019031295, -2.3025850929940457, CrossPlatformMachineEpsilon * 10)] // expected: -(ln(10))
- [InlineData(-0.74398033695749319, 0.66820151019031295, -0.83900756059574755, CrossPlatformMachineEpsilon)] // expected: -(pi - ln(10))
- [InlineData(-0.70710678118654752, -0.70710678118654752, -2.3561944901923449, CrossPlatformMachineEpsilon * 10)] // expected: -(3 * pi / 4), y: -(1 / sqrt(2)) x: -(1 / sqrt(2))
- [InlineData(-0.70710678118654752, 0.70710678118654752, -0.78539816339744831, CrossPlatformMachineEpsilon)] // expected: -(pi / 4), y: -(1 / sqrt(2)) x: (1 / sqrt(2))
- [InlineData(-0.64963693908006244, -0.76024459707563015, -2.4344858724032457, CrossPlatformMachineEpsilon * 10)] // expected: -(pi - (1 / sqrt(2))
- [InlineData(-0.64963693908006244, 0.76024459707563015, -0.70710678118654752, CrossPlatformMachineEpsilon)] // expected: -(1 / sqrt(2))
- [InlineData(-0.63896127631363480, -0.76923890136397213, -2.4484454730298479, CrossPlatformMachineEpsilon * 10)] // expected: -(pi - ln(2))
- [InlineData(-0.63896127631363480, 0.76923890136397213, -0.69314718055994531, CrossPlatformMachineEpsilon)] // expected: -(ln(2))
- [InlineData(-0.59448076852482208, -0.80410982822879171, -2.5049728812222119, CrossPlatformMachineEpsilon * 10)] // expected: -(pi - (2 / pi))
- [InlineData(-0.59448076852482208, 0.80410982822879171, -0.63661977236758134, CrossPlatformMachineEpsilon)] // expected: -(2 / pi)
- [InlineData(-0.42077048331375735, -0.90716712923909839, -2.7072981716865414, CrossPlatformMachineEpsilon * 10)] // expected: -(pi - log10(e))
- [InlineData(-0.42077048331375735, 0.90716712923909839, -0.43429448190325183, CrossPlatformMachineEpsilon)] // expected: -(log10(e))
- [InlineData(-0.41078129050290870, -0.91173391478696510, -2.7182818284590452, CrossPlatformMachineEpsilon * 10)] // expected: -(e)
- [InlineData(-0.41078129050290870, 0.91173391478696510, -0.42331082513074800, CrossPlatformMachineEpsilon)] // expected: -(pi - e)
- [InlineData(-0.31296179620778659, -0.94976571538163866, -2.8232827674060026, CrossPlatformMachineEpsilon * 10)] // expected: -(pi - (1 / pi))
- [InlineData(-0.31296179620778659, 0.94976571538163866, -0.31830988618379067, CrossPlatformMachineEpsilon)] // expected: -(1 / pi)
- [InlineData(-0.0, double.NegativeInfinity, -3.1415926535897932, CrossPlatformMachineEpsilon * 10)] // expected: -(pi)
- [InlineData(-0.0, -1.0, -3.1415926535897932, CrossPlatformMachineEpsilon * 10)] // expected: -(pi)
- [InlineData(-0.0, -0.0, -3.1415926535897932, CrossPlatformMachineEpsilon * 10)] // expected: -(pi)
- [InlineData(-0.0, double.NaN, double.NaN, 0.0)]
- [InlineData(-0.0, 0.0, -0.0, 0.0)]
- [InlineData(-0.0, 1.0, -0.0, 0.0)]
- [InlineData(-0.0, double.PositiveInfinity, -0.0, 0.0)]
- [InlineData( double.NaN, double.NegativeInfinity, double.NaN, 0.0)]
- [InlineData( double.NaN, -1.0, double.NaN, 0.0)]
- [InlineData( double.NaN, -0.0, double.NaN, 0.0)]
- [InlineData( double.NaN, double.NaN, double.NaN, 0.0)]
- [InlineData( double.NaN, 0.0, double.NaN, 0.0)]
- [InlineData( double.NaN, 1.0, double.NaN, 0.0)]
- [InlineData( double.NaN, double.PositiveInfinity, double.NaN, 0.0)]
- [InlineData( 0.0, double.NegativeInfinity, 3.1415926535897932, CrossPlatformMachineEpsilon * 10)] // expected: (pi)
- [InlineData( 0.0, -1.0, 3.1415926535897932, CrossPlatformMachineEpsilon * 10)] // expected: (pi)
- [InlineData( 0.0, -0.0, 3.1415926535897932, CrossPlatformMachineEpsilon * 10)] // expected: (pi)
- [InlineData( 0.0, double.NaN, double.NaN, 0.0)]
- [InlineData( 0.0, 0.0, 0.0, 0.0)]
- [InlineData( 0.0, 1.0, 0.0, 0.0)]
- [InlineData( 0.0, double.PositiveInfinity, 0.0, 0.0)]
- [InlineData( 0.31296179620778659, -0.94976571538163866, 2.8232827674060026, CrossPlatformMachineEpsilon * 10)] // expected: (pi - (1 / pi))
- [InlineData( 0.31296179620778659, 0.94976571538163866, 0.31830988618379067, CrossPlatformMachineEpsilon)] // expected: (1 / pi)
- [InlineData( 0.41078129050290870, -0.91173391478696510, 2.7182818284590452, CrossPlatformMachineEpsilon * 10)] // expected: (e)
- [InlineData( 0.41078129050290870, 0.91173391478696510, 0.42331082513074800, CrossPlatformMachineEpsilon)] // expected: (pi - e)
- [InlineData( 0.42077048331375735, -0.90716712923909839, 2.7072981716865414, CrossPlatformMachineEpsilon * 10)] // expected: (pi - log10(e))
- [InlineData( 0.42077048331375735, 0.90716712923909839, 0.43429448190325183, CrossPlatformMachineEpsilon)] // expected: (log10(e))
- [InlineData( 0.59448076852482208, -0.80410982822879171, 2.5049728812222119, CrossPlatformMachineEpsilon * 10)] // expected: (pi - (2 / pi))
- [InlineData( 0.59448076852482208, 0.80410982822879171, 0.63661977236758134, CrossPlatformMachineEpsilon)] // expected: (2 / pi)
- [InlineData( 0.63896127631363480, -0.76923890136397213, 2.4484454730298479, CrossPlatformMachineEpsilon * 10)] // expected: (pi - ln(2))
- [InlineData( 0.63896127631363480, 0.76923890136397213, 0.69314718055994531, CrossPlatformMachineEpsilon)] // expected: (ln(2))
- [InlineData( 0.64963693908006244, -0.76024459707563015, 2.4344858724032457, CrossPlatformMachineEpsilon * 10)] // expected: (pi - (1 / sqrt(2))
- [InlineData( 0.64963693908006244, 0.76024459707563015, 0.70710678118654752, CrossPlatformMachineEpsilon)] // expected: (1 / sqrt(2))
- [InlineData( 0.70710678118654752, -0.70710678118654752, 2.3561944901923449, CrossPlatformMachineEpsilon * 10)] // expected: (3 * pi / 4), y: (1 / sqrt(2)) x: -(1 / sqrt(2))
- [InlineData( 0.70710678118654752, 0.70710678118654752, 0.78539816339744831, CrossPlatformMachineEpsilon)] // expected: (pi / 4), y: (1 / sqrt(2)) x: (1 / sqrt(2))
- [InlineData( 0.74398033695749319, -0.66820151019031295, 2.3025850929940457, CrossPlatformMachineEpsilon * 10)] // expected: (ln(10))
- [InlineData( 0.74398033695749319, 0.66820151019031295, 0.83900756059574755, CrossPlatformMachineEpsilon)] // expected: (pi - ln(10))
- [InlineData( 0.84147098480789651, -0.54030230586813972, 2.1415926535897932, CrossPlatformMachineEpsilon * 10)] // expected: (pi - 1)
- [InlineData( 0.84147098480789651, 0.54030230586813972, 1.0, CrossPlatformMachineEpsilon * 10)]
- [InlineData( 0.90371945743584630, -0.42812514788535792, 2.0132134864942807, CrossPlatformMachineEpsilon * 10)] // expected: (pi - (2 / sqrt(pi))
- [InlineData( 0.90371945743584630, 0.42812514788535792, 1.1283791670955126, CrossPlatformMachineEpsilon * 10)] // expected: (2 / sqrt(pi))
- [InlineData( 0.98776594599273553, -0.15594369476537447, 1.7273790912166982, CrossPlatformMachineEpsilon * 10)] // expected: (pi - sqrt(2))
- [InlineData( 0.98776594599273553, 0.15594369476537447, 1.4142135623730950, CrossPlatformMachineEpsilon * 10)] // expected: (sqrt(2))
- [InlineData( 0.99180624439366372, -0.12775121753523991, 1.6988976127008298, CrossPlatformMachineEpsilon * 10)] // expected: (pi - log2(e))
- [InlineData( 0.99180624439366372, 0.12775121753523991, 1.4426950408889634, CrossPlatformMachineEpsilon * 10)] // expected: (log2(e))
- [InlineData( 1.0, -1.0, 2.3561944901923449, CrossPlatformMachineEpsilon * 10)] // expected: (3 * pi / 4)
- [InlineData( 1.0, -0.0, 1.5707963267948966, CrossPlatformMachineEpsilon * 10)] // expected: (pi / 2)
- [InlineData( 1.0, double.NaN, double.NaN, 0.0)]
- [InlineData( 1.0, 0.0, 1.5707963267948966, CrossPlatformMachineEpsilon * 10)] // expected: (pi / 2)
- [InlineData( 1.0, 1.0, 0.78539816339744831, CrossPlatformMachineEpsilon)] // expected: (pi / 4)
- [InlineData( 1.0, double.PositiveInfinity, 0.0, 0.0)]
- [InlineData( double.PositiveInfinity, -1.0, 1.5707963267948966, CrossPlatformMachineEpsilon * 10)] // expected: (pi / 2)
- [InlineData( double.PositiveInfinity, -0.0, 1.5707963267948966, CrossPlatformMachineEpsilon * 10)] // expected: (pi / 2)
- [InlineData( double.PositiveInfinity, double.NaN, double.NaN, 0.0)]
- [InlineData( double.PositiveInfinity, 0.0, 1.5707963267948966, CrossPlatformMachineEpsilon * 10)] // expected: (pi / 2)
- [InlineData( double.PositiveInfinity, 1.0, 1.5707963267948966, CrossPlatformMachineEpsilon * 10)] // expected: (pi / 2)
+ [MemberData(nameof(Atan2_TestData))]
public static void Atan2(double y, double x, double expectedResult, double allowedVariance)
{
AssertEqual(expectedResult, Math.Atan2(y, x), allowedVariance);
@@ -1167,151 +1176,159 @@ namespace System.Tests
Assert.Equal(ulong.MinValue, Math.Min(ulong.MinValue, ulong.MaxValue));
}
+ public static IEnumerable<object[]> Pow_TestData
+ {
+ get
+ {
+ yield return new object[] { double.NegativeInfinity, double.NegativeInfinity, 0.0, 0.0 };
+ yield return new object[] { double.NegativeInfinity, -1.0, -0.0, 0.0 };
+ yield return new object[] { double.NegativeInfinity, -0.0, 1.0, CrossPlatformMachineEpsilon * 10 };
+ yield return new object[] { double.NegativeInfinity, double.NaN, double.NaN, 0.0 };
+ yield return new object[] { double.NegativeInfinity, 0.0, 1.0, CrossPlatformMachineEpsilon * 10 };
+ yield return new object[] { double.NegativeInfinity, 1.0, double.NegativeInfinity, 0.0 };
+ yield return new object[] { double.NegativeInfinity, double.PositiveInfinity, double.PositiveInfinity, 0.0 };
+ yield return new object[] { -10.0, double.NegativeInfinity, 0.0, 0.0 };
+ yield return new object[] { -10.0, -1.5707963267948966, double.NaN, 0.0 }; // y: -(pi / 2)
+ yield return new object[] { -10.0, -1.0, -0.1, CrossPlatformMachineEpsilon };
+ yield return new object[] { -10.0, -0.78539816339744831, double.NaN, 0.0 }; // y: -(pi / 4)
+ yield return new object[] { -10.0, -0.0, 1.0, CrossPlatformMachineEpsilon * 10 };
+ yield return new object[] { -10.0, double.NaN, double.NaN, 0.0 };
+ yield return new object[] { -10.0, 0.0, 1.0, CrossPlatformMachineEpsilon * 10 };
+ yield return new object[] { -10.0, 0.78539816339744831, double.NaN, 0.0 }; // y: (pi / 4)
+ yield return new object[] { -10.0, 1.0, -10.0, CrossPlatformMachineEpsilon * 100 };
+ yield return new object[] { -10.0, 1.5707963267948966, double.NaN, 0.0 }; // y: (pi / 2)
+ yield return new object[] { -10.0, double.PositiveInfinity, double.PositiveInfinity, 0.0 };
+ yield return new object[] { -2.7182818284590452, double.NegativeInfinity, 0.0, 0.0 }; // x: -(e)
+ yield return new object[] { -2.7182818284590452, -1.5707963267948966, double.NaN, 0.0 }; // x: -(e) y: -(pi / 2)
+ yield return new object[] { -2.7182818284590452, -1.0, -0.36787944117144232, CrossPlatformMachineEpsilon }; // x: -(e)
+ yield return new object[] { -2.7182818284590452, -0.78539816339744831, double.NaN, 0.0 }; // x: -(e) y: -(pi / 4)
+ yield return new object[] { -2.7182818284590452, -0.0, 1.0, CrossPlatformMachineEpsilon * 10 }; // x: -(e)
+ yield return new object[] { -2.7182818284590452, double.NaN, double.NaN, 0.0 };
+ yield return new object[] { -2.7182818284590452, 0.0, 1.0, CrossPlatformMachineEpsilon * 10 }; // x: -(e)
+ yield return new object[] { -2.7182818284590452, 0.78539816339744831, double.NaN, 0.0 }; // x: -(e) y: (pi / 4)
+ yield return new object[] { -2.7182818284590452, 1.0, -2.7182818284590452, CrossPlatformMachineEpsilon * 10 }; // x: -(e) expected: (e)
+ yield return new object[] { -2.7182818284590452, 1.5707963267948966, double.NaN, 0.0 }; // x: -(e) y: (pi / 2)
+ yield return new object[] { -2.7182818284590452, double.PositiveInfinity, double.PositiveInfinity, 0.0 };
+ yield return new object[] { -1.0, -1.0, -1.0, CrossPlatformMachineEpsilon * 10 };
+ yield return new object[] { -1.0, -0.0, 1.0, CrossPlatformMachineEpsilon * 10 };
+ yield return new object[] { -1.0, double.NaN, double.NaN, 0.0 };
+ yield return new object[] { -1.0, 0.0, 1.0, CrossPlatformMachineEpsilon * 10 };
+ yield return new object[] { -1.0, 1.0, -1.0, CrossPlatformMachineEpsilon * 10 };
+ yield return new object[] { -0.0, double.NegativeInfinity, double.PositiveInfinity, 0.0 };
+ yield return new object[] { -0.0, -3.0, double.NegativeInfinity, 0.0 };
+ yield return new object[] { -0.0, -2.0, double.PositiveInfinity, 0.0 };
+ yield return new object[] { -0.0, -1.5707963267948966, double.PositiveInfinity, 0.0 }; // y: -(pi / 2)
+ yield return new object[] { -0.0, -1.0, double.NegativeInfinity, 0.0 };
+ yield return new object[] { -0.0, -0.0, 1.0, CrossPlatformMachineEpsilon * 10 };
+ yield return new object[] { -0.0, double.NaN, double.NaN, 0.0 };
+ yield return new object[] { -0.0, 0.0, 1.0, CrossPlatformMachineEpsilon * 10 };
+ yield return new object[] { -0.0, 1.0, -0.0, 0.0 };
+ yield return new object[] { -0.0, 1.5707963267948966, 0.0, 0.0 }; // y: -(pi / 2)
+ yield return new object[] { -0.0, 2.0, 0.0, 0.0 };
+ yield return new object[] { -0.0, 3.0, -0.0, 0.0 };
+ yield return new object[] { -0.0, double.PositiveInfinity, 0.0, 0.0 };
+ yield return new object[] { double.NaN, double.NegativeInfinity, double.NaN, 0.0 };
+ yield return new object[] { double.NaN, -1.0, double.NaN, 0.0 };
+ yield return new object[] { double.NaN, double.NaN, double.NaN, 0.0 };
+ yield return new object[] { double.NaN, 1.0, double.NaN, 0.0 };
+ yield return new object[] { double.NaN, double.PositiveInfinity, double.NaN, 0.0 };
+ yield return new object[] { 0.0, double.NegativeInfinity, double.PositiveInfinity, 0.0 };
+ yield return new object[] { 0.0, -3.0, double.PositiveInfinity, 0.0 };
+ yield return new object[] { 0.0, -2.0, double.PositiveInfinity, 0.0 };
+ yield return new object[] { 0.0, -1.5707963267948966, double.PositiveInfinity, 0.0 }; // y: -(pi / 2)
+ yield return new object[] { 0.0, -1.0, double.PositiveInfinity, 0.0 };
+ yield return new object[] { 0.0, -0.0, 1.0, CrossPlatformMachineEpsilon * 10 };
+ yield return new object[] { 0.0, double.NaN, double.NaN, 0.0 };
+ yield return new object[] { 0.0, 0.0, 1.0, CrossPlatformMachineEpsilon * 10 };
+ yield return new object[] { 0.0, 1.0, 0.0, 0.0 };
+ yield return new object[] { 0.0, 1.5707963267948966, 0.0, 0.0 }; // y: -(pi / 2)
+ yield return new object[] { 0.0, 2.0, 0.0, 0.0 };
+ yield return new object[] { 0.0, 3.0, 0.0, 0.0 };
+ yield return new object[] { 0.0, double.PositiveInfinity, 0.0, 0.0 };
+ yield return new object[] { 1.0, double.NegativeInfinity, 1.0, CrossPlatformMachineEpsilon * 10 };
+ yield return new object[] { 1.0, -1.0, 1.0, CrossPlatformMachineEpsilon * 10 };
+ yield return new object[] { 1.0, -0.0, 1.0, CrossPlatformMachineEpsilon * 10 };
+ yield return new object[] { 1.0, 0.0, 1.0, CrossPlatformMachineEpsilon * 10 };
+ yield return new object[] { 1.0, 1.0, 1.0, CrossPlatformMachineEpsilon * 10 };
+ yield return new object[] { 1.0, double.PositiveInfinity, 1.0, CrossPlatformMachineEpsilon * 10 };
+ yield return new object[] { 2.7182818284590452, double.NegativeInfinity, 0.0, 0.0 };
+ yield return new object[] { 2.7182818284590452, -3.1415926535897932, 0.043213918263772250, CrossPlatformMachineEpsilon / 10 }; // x: (e) y: -(pi)
+ yield return new object[] { 2.7182818284590452, -2.7182818284590452, 0.065988035845312537, CrossPlatformMachineEpsilon / 10 }; // x: (e) y: -(e)
+ yield return new object[] { 2.7182818284590452, -2.3025850929940457, 0.1, CrossPlatformMachineEpsilon }; // x: (e) y: -(ln(10))
+ yield return new object[] { 2.7182818284590452, -1.5707963267948966, 0.20787957635076191, CrossPlatformMachineEpsilon }; // x: (e) y: -(pi / 2)
+ yield return new object[] { 2.7182818284590452, -1.4426950408889634, 0.23629008834452270, CrossPlatformMachineEpsilon }; // x: (e) y: -(log2(e))
+ yield return new object[] { 2.7182818284590452, -1.4142135623730950, 0.24311673443421421, CrossPlatformMachineEpsilon }; // x: (e) y: -(sqrt(2))
+ yield return new object[] { 2.7182818284590452, -1.1283791670955126, 0.32355726390307110, CrossPlatformMachineEpsilon }; // x: (e) y: -(2 / sqrt(pi))
+ yield return new object[] { 2.7182818284590452, -1.0, 0.36787944117144232, CrossPlatformMachineEpsilon }; // x: (e)
+ yield return new object[] { 2.7182818284590452, -0.78539816339744831, 0.45593812776599624, CrossPlatformMachineEpsilon }; // x: (e) y: -(pi / 4)
+ yield return new object[] { 2.7182818284590452, -0.70710678118654752, 0.49306869139523979, CrossPlatformMachineEpsilon }; // x: (e) y: -(1 / sqrt(2))
+ yield return new object[] { 2.7182818284590452, -0.69314718055994531, 0.5, CrossPlatformMachineEpsilon }; // x: (e) y: -(ln(2))
+ yield return new object[] { 2.7182818284590452, -0.63661977236758134, 0.52907780826773535, CrossPlatformMachineEpsilon }; // x: (e) y: -(2 / pi)
+ yield return new object[] { 2.7182818284590452, -0.43429448190325183, 0.64772148514180065, CrossPlatformMachineEpsilon }; // x: (e) y: -(log10(e))
+ yield return new object[] { 2.7182818284590452, -0.31830988618379067, 0.72737734929521647, CrossPlatformMachineEpsilon }; // x: (e) y: -(1 / pi)
+ yield return new object[] { 2.7182818284590452, -0.0, 1.0, CrossPlatformMachineEpsilon * 10 }; // x: (e)
+ yield return new object[] { 2.7182818284590452, double.NaN, double.NaN, 0.0 };
+ yield return new object[] { 2.7182818284590452, 0.0, 1.0, CrossPlatformMachineEpsilon * 10 }; // x: (e)
+ yield return new object[] { 2.7182818284590452, 0.31830988618379067, 1.3748022274393586, CrossPlatformMachineEpsilon * 10 }; // x: (e) y: (1 / pi)
+ yield return new object[] { 2.7182818284590452, 0.43429448190325183, 1.5438734439711811, CrossPlatformMachineEpsilon * 10 }; // x: (e) y: (log10(e))
+ yield return new object[] { 2.7182818284590452, 0.63661977236758134, 1.8900811645722220, CrossPlatformMachineEpsilon * 10 }; // x: (e) y: (2 / pi)
+ yield return new object[] { 2.7182818284590452, 0.69314718055994531, 2.0, CrossPlatformMachineEpsilon * 10 }; // x: (e) y: (ln(2))
+ yield return new object[] { 2.7182818284590452, 0.70710678118654752, 2.0281149816474725, CrossPlatformMachineEpsilon * 10 }; // x: (e) y: (1 / sqrt(2))
+ yield return new object[] { 2.7182818284590452, 0.78539816339744831, 2.1932800507380155, CrossPlatformMachineEpsilon * 10 }; // x: (e) y: (pi / 4)
+ yield return new object[] { 2.7182818284590452, 1.0, 2.7182818284590452, CrossPlatformMachineEpsilon * 10 }; // x: (e) expected: (e)
+ yield return new object[] { 2.7182818284590452, 1.1283791670955126, 3.0906430223107976, CrossPlatformMachineEpsilon * 10 }; // x: (e) y: (2 / sqrt(pi))
+ yield return new object[] { 2.7182818284590452, 1.4142135623730950, 4.1132503787829275, CrossPlatformMachineEpsilon * 10 }; // x: (e) y: (sqrt(2))
+ yield return new object[] { 2.7182818284590452, 1.4426950408889634, 4.2320861065570819, CrossPlatformMachineEpsilon * 10 }; // x: (e) y: (log2(e))
+ yield return new object[] { 2.7182818284590452, 1.5707963267948966, 4.8104773809653517, CrossPlatformMachineEpsilon * 10 }; // x: (e) y: (pi / 2)
+ yield return new object[] { 2.7182818284590452, 2.3025850929940457, 10.0, CrossPlatformMachineEpsilon * 100 }; // x: (e) y: (ln(10))
+ yield return new object[] { 2.7182818284590452, 2.7182818284590452, 15.154262241479264, CrossPlatformMachineEpsilon * 100 }; // x: (e) y: (e)
+ yield return new object[] { 2.7182818284590452, 3.1415926535897932, 23.140692632779269, CrossPlatformMachineEpsilon * 100 }; // x: (e) y: (pi)
+ yield return new object[] { 2.7182818284590452, double.PositiveInfinity, double.PositiveInfinity, 0.0 }; // x: (e)
+ yield return new object[] { 10.0, double.NegativeInfinity, 0.0, 0.0 };
+ yield return new object[] { 10.0, -3.1415926535897932, 0.00072178415907472774, CrossPlatformMachineEpsilon / 1000 }; // y: -(pi)
+ yield return new object[] { 10.0, -2.7182818284590452, 0.0019130141022243176, CrossPlatformMachineEpsilon / 100 }; // y: -(e)
+ yield return new object[] { 10.0, -2.3025850929940457, 0.0049821282964407206, CrossPlatformMachineEpsilon / 100 }; // y: -(ln(10))
+ yield return new object[] { 10.0, -1.5707963267948966, 0.026866041001136132, CrossPlatformMachineEpsilon / 10 }; // y: -(pi / 2)
+ yield return new object[] { 10.0, -1.4426950408889634, 0.036083192820787210, CrossPlatformMachineEpsilon / 10 }; // y: -(log2(e))
+ yield return new object[] { 10.0, -1.4142135623730950, 0.038528884700322026, CrossPlatformMachineEpsilon / 10 }; // y: -(sqrt(2))
+ yield return new object[] { 10.0, -1.1283791670955126, 0.074408205860642723, CrossPlatformMachineEpsilon / 10 }; // y: -(2 / sqrt(pi))
+ yield return new object[] { 10.0, -1.0, 0.1, CrossPlatformMachineEpsilon };
+ yield return new object[] { 10.0, -0.78539816339744831, 0.16390863613957665, CrossPlatformMachineEpsilon }; // y: -(pi / 4)
+ yield return new object[] { 10.0, -0.70710678118654752, 0.19628775993505562, CrossPlatformMachineEpsilon }; // y: -(1 / sqrt(2))
+ yield return new object[] { 10.0, -0.69314718055994531, 0.20269956628651730, CrossPlatformMachineEpsilon }; // y: -(ln(2))
+ yield return new object[] { 10.0, -0.63661977236758134, 0.23087676451600055, CrossPlatformMachineEpsilon }; // y: -(2 / pi)
+ yield return new object[] { 10.0, -0.43429448190325183, 0.36787944117144232, CrossPlatformMachineEpsilon }; // y: -(log10(e))
+ yield return new object[] { 10.0, -0.31830988618379067, 0.48049637305186868, CrossPlatformMachineEpsilon }; // y: -(1 / pi)
+ yield return new object[] { 10.0, -0.0, 1.0, CrossPlatformMachineEpsilon * 10 };
+ yield return new object[] { 10.0, double.NaN, double.NaN, 0.0 };
+ yield return new object[] { 10.0, 0.0, 1.0, CrossPlatformMachineEpsilon * 10 };
+ yield return new object[] { 10.0, 0.31830988618379067, 2.0811811619898573, CrossPlatformMachineEpsilon * 10 }; // y: (1 / pi)
+ yield return new object[] { 10.0, 0.43429448190325183, 2.7182818284590452, CrossPlatformMachineEpsilon * 10 }; // y: (log10(e)) expected: (e)
+ yield return new object[] { 10.0, 0.63661977236758134, 4.3313150290214525, CrossPlatformMachineEpsilon * 10 }; // y: (2 / pi)
+ yield return new object[] { 10.0, 0.69314718055994531, 4.9334096679145963, CrossPlatformMachineEpsilon * 10 }; // y: (ln(2))
+ yield return new object[] { 10.0, 0.70710678118654752, 5.0945611704512962, CrossPlatformMachineEpsilon * 10 }; // y: (1 / sqrt(2))
+ yield return new object[] { 10.0, 0.78539816339744831, 6.1009598002416937, CrossPlatformMachineEpsilon * 10 }; // y: (pi / 4)
+ yield return new object[] { 10.0, 1.0, 10.0, CrossPlatformMachineEpsilon * 100 };
+ yield return new object[] { 10.0, 1.1283791670955126, 13.439377934644400, CrossPlatformMachineEpsilon * 100 }; // y: (2 / sqrt(pi))
+ yield return new object[] { 10.0, 1.4142135623730950, 25.954553519470081, CrossPlatformMachineEpsilon * 100 }; // y: (sqrt(2))
+ yield return new object[] { 10.0, 1.4426950408889634, 27.713733786437790, CrossPlatformMachineEpsilon * 100 }; // y: (log2(e))
+ yield return new object[] { 10.0, 1.5707963267948966, 37.221710484165167, CrossPlatformMachineEpsilon * 100 }; // y: (pi / 2)
+ yield return new object[] { 10.0, 2.3025850929940457, 200.71743249053009, CrossPlatformMachineEpsilon * 1000 }; // y: (ln(10))
+ yield return new object[] { 10.0, 2.7182818284590452, 522.73529967043665, CrossPlatformMachineEpsilon * 1000 }; // y: (e)
+ yield return new object[] { 10.0, 3.1415926535897932, 1385.4557313670111, CrossPlatformMachineEpsilon * 10000 }; // y: (pi)
+ yield return new object[] { 10.0, double.PositiveInfinity, double.PositiveInfinity, 0.0 };
+ yield return new object[] { double.PositiveInfinity, double.NegativeInfinity, 0.0, 0.0 };
+ yield return new object[] { double.PositiveInfinity, -1.0, 0.0, 0.0 };
+ yield return new object[] { double.PositiveInfinity, -0.0, 1.0, 0.0 };
+ yield return new object[] { double.PositiveInfinity, double.NaN, double.NaN, 0.0 };
+ yield return new object[] { double.PositiveInfinity, 0.0, 1.0, 0.0 };
+ yield return new object[] { double.PositiveInfinity, 1.0, double.PositiveInfinity, 0.0 };
+ yield return new object[] { double.PositiveInfinity, double.PositiveInfinity, double.PositiveInfinity, 0.0 };
+ }
+ }
+
[Theory]
- [InlineData( double.NegativeInfinity, double.NegativeInfinity, 0.0, 0.0)]
- [InlineData( double.NegativeInfinity, -1.0, -0.0, 0.0)]
- [InlineData( double.NegativeInfinity, -0.0, 1.0, CrossPlatformMachineEpsilon * 10)]
- [InlineData( double.NegativeInfinity, double.NaN, double.NaN, 0.0)]
- [InlineData( double.NegativeInfinity, 0.0, 1.0, CrossPlatformMachineEpsilon * 10)]
- [InlineData( double.NegativeInfinity, 1.0, double.NegativeInfinity, 0.0)]
- [InlineData( double.NegativeInfinity, double.PositiveInfinity, double.PositiveInfinity, 0.0)]
- [InlineData(-10.0, double.NegativeInfinity, 0.0, 0.0)]
- [InlineData(-10.0, -1.5707963267948966, double.NaN, 0.0)] // y: -(pi / 2)
- [InlineData(-10.0, -1.0, -0.1, CrossPlatformMachineEpsilon)]
- [InlineData(-10.0, -0.78539816339744831, double.NaN, 0.0)] // y: -(pi / 4)
- [InlineData(-10.0, -0.0, 1.0, CrossPlatformMachineEpsilon * 10)]
- [InlineData(-10.0, double.NaN, double.NaN, 0.0)]
- [InlineData(-10.0, 0.0, 1.0, CrossPlatformMachineEpsilon * 10)]
- [InlineData(-10.0, 0.78539816339744831, double.NaN, 0.0)] // y: (pi / 4)
- [InlineData(-10.0, 1.0, -10.0, CrossPlatformMachineEpsilon * 100)]
- [InlineData(-10.0, 1.5707963267948966, double.NaN, 0.0)] // y: (pi / 2)
- [InlineData(-10.0, double.PositiveInfinity, double.PositiveInfinity, 0.0)]
- [InlineData(-2.7182818284590452, double.NegativeInfinity, 0.0, 0.0)] // x: -(e)
- [InlineData(-2.7182818284590452, -1.5707963267948966, double.NaN, 0.0)] // x: -(e) y: -(pi / 2)
- [InlineData(-2.7182818284590452, -1.0, -0.36787944117144232, CrossPlatformMachineEpsilon)] // x: -(e)
- [InlineData(-2.7182818284590452, -0.78539816339744831, double.NaN, 0.0)] // x: -(e) y: -(pi / 4)
- [InlineData(-2.7182818284590452, -0.0, 1.0, CrossPlatformMachineEpsilon * 10)] // x: -(e)
- [InlineData(-2.7182818284590452, double.NaN, double.NaN, 0.0)]
- [InlineData(-2.7182818284590452, 0.0, 1.0, CrossPlatformMachineEpsilon * 10)] // x: -(e)
- [InlineData(-2.7182818284590452, 0.78539816339744831, double.NaN, 0.0)] // x: -(e) y: (pi / 4)
- [InlineData(-2.7182818284590452, 1.0, -2.7182818284590452, CrossPlatformMachineEpsilon * 10)] // x: -(e) expected: (e)
- [InlineData(-2.7182818284590452, 1.5707963267948966, double.NaN, 0.0)] // x: -(e) y: (pi / 2)
- [InlineData(-2.7182818284590452, double.PositiveInfinity, double.PositiveInfinity, 0.0)]
- [InlineData(-1.0, -1.0, -1.0, CrossPlatformMachineEpsilon * 10)]
- [InlineData(-1.0, -0.0, 1.0, CrossPlatformMachineEpsilon * 10)]
- [InlineData(-1.0, double.NaN, double.NaN, 0.0)]
- [InlineData(-1.0, 0.0, 1.0, CrossPlatformMachineEpsilon * 10)]
- [InlineData(-1.0, 1.0, -1.0, CrossPlatformMachineEpsilon * 10)]
- [InlineData(-0.0, double.NegativeInfinity, double.PositiveInfinity, 0.0)]
- [InlineData(-0.0, -3.0, double.NegativeInfinity, 0.0)]
- [InlineData(-0.0, -2.0, double.PositiveInfinity, 0.0)]
- [InlineData(-0.0, -1.5707963267948966, double.PositiveInfinity, 0.0)] // y: -(pi / 2)
- [InlineData(-0.0, -1.0, double.NegativeInfinity, 0.0)]
- [InlineData(-0.0, -0.0, 1.0, CrossPlatformMachineEpsilon * 10)]
- [InlineData(-0.0, double.NaN, double.NaN, 0.0)]
- [InlineData(-0.0, 0.0, 1.0, CrossPlatformMachineEpsilon * 10)]
- [InlineData(-0.0, 1.0, -0.0, 0.0)]
- [InlineData(-0.0, 1.5707963267948966, 0.0, 0.0)] // y: -(pi / 2)
- [InlineData(-0.0, 2.0, 0.0, 0.0)]
- [InlineData(-0.0, 3.0, -0.0, 0.0)]
- [InlineData(-0.0, double.PositiveInfinity, 0.0, 0.0)]
- [InlineData( double.NaN, double.NegativeInfinity, double.NaN, 0.0)]
- [InlineData( double.NaN, -1.0, double.NaN, 0.0)]
- [InlineData( double.NaN, double.NaN, double.NaN, 0.0)]
- [InlineData( double.NaN, 1.0, double.NaN, 0.0)]
- [InlineData( double.NaN, double.PositiveInfinity, double.NaN, 0.0)]
- [InlineData( 0.0, double.NegativeInfinity, double.PositiveInfinity, 0.0)]
- [InlineData( 0.0, -3.0, double.PositiveInfinity, 0.0)]
- [InlineData( 0.0, -2.0, double.PositiveInfinity, 0.0)]
- [InlineData( 0.0, -1.5707963267948966, double.PositiveInfinity, 0.0)] // y: -(pi / 2)
- [InlineData( 0.0, -1.0, double.PositiveInfinity, 0.0)]
- [InlineData( 0.0, -0.0, 1.0, CrossPlatformMachineEpsilon * 10)]
- [InlineData( 0.0, double.NaN, double.NaN, 0.0)]
- [InlineData( 0.0, 0.0, 1.0, CrossPlatformMachineEpsilon * 10)]
- [InlineData( 0.0, 1.0, 0.0, 0.0)]
- [InlineData( 0.0, 1.5707963267948966, 0.0, 0.0)] // y: -(pi / 2)
- [InlineData( 0.0, 2.0, 0.0, 0.0)]
- [InlineData( 0.0, 3.0, 0.0, 0.0)]
- [InlineData( 0.0, double.PositiveInfinity, 0.0, 0.0)]
- [InlineData( 1.0, double.NegativeInfinity, 1.0, CrossPlatformMachineEpsilon * 10)]
- [InlineData( 1.0, -1.0, 1.0, CrossPlatformMachineEpsilon * 10)]
- [InlineData( 1.0, -0.0, 1.0, CrossPlatformMachineEpsilon * 10)]
- [InlineData( 1.0, 0.0, 1.0, CrossPlatformMachineEpsilon * 10)]
- [InlineData( 1.0, 1.0, 1.0, CrossPlatformMachineEpsilon * 10)]
- [InlineData( 1.0, double.PositiveInfinity, 1.0, CrossPlatformMachineEpsilon * 10)]
- [InlineData( 2.7182818284590452, double.NegativeInfinity, 0.0, 0.0)]
- [InlineData( 2.7182818284590452, -3.1415926535897932, 0.043213918263772250, CrossPlatformMachineEpsilon / 10)] // x: (e) y: -(pi)
- [InlineData( 2.7182818284590452, -2.7182818284590452, 0.065988035845312537, CrossPlatformMachineEpsilon / 10)] // x: (e) y: -(e)
- [InlineData( 2.7182818284590452, -2.3025850929940457, 0.1, CrossPlatformMachineEpsilon)] // x: (e) y: -(ln(10))
- [InlineData( 2.7182818284590452, -1.5707963267948966, 0.20787957635076191, CrossPlatformMachineEpsilon)] // x: (e) y: -(pi / 2)
- [InlineData( 2.7182818284590452, -1.4426950408889634, 0.23629008834452270, CrossPlatformMachineEpsilon)] // x: (e) y: -(log2(e))
- [InlineData( 2.7182818284590452, -1.4142135623730950, 0.24311673443421421, CrossPlatformMachineEpsilon)] // x: (e) y: -(sqrt(2))
- [InlineData( 2.7182818284590452, -1.1283791670955126, 0.32355726390307110, CrossPlatformMachineEpsilon)] // x: (e) y: -(2 / sqrt(pi))
- [InlineData( 2.7182818284590452, -1.0, 0.36787944117144232, CrossPlatformMachineEpsilon)] // x: (e)
- [InlineData( 2.7182818284590452, -0.78539816339744831, 0.45593812776599624, CrossPlatformMachineEpsilon)] // x: (e) y: -(pi / 4)
- [InlineData( 2.7182818284590452, -0.70710678118654752, 0.49306869139523979, CrossPlatformMachineEpsilon)] // x: (e) y: -(1 / sqrt(2))
- [InlineData( 2.7182818284590452, -0.69314718055994531, 0.5, CrossPlatformMachineEpsilon)] // x: (e) y: -(ln(2))
- [InlineData( 2.7182818284590452, -0.63661977236758134, 0.52907780826773535, CrossPlatformMachineEpsilon)] // x: (e) y: -(2 / pi)
- [InlineData( 2.7182818284590452, -0.43429448190325183, 0.64772148514180065, CrossPlatformMachineEpsilon)] // x: (e) y: -(log10(e))
- [InlineData( 2.7182818284590452, -0.31830988618379067, 0.72737734929521647, CrossPlatformMachineEpsilon)] // x: (e) y: -(1 / pi)
- [InlineData( 2.7182818284590452, -0.0, 1.0, CrossPlatformMachineEpsilon * 10)] // x: (e)
- [InlineData( 2.7182818284590452, double.NaN, double.NaN, 0.0)]
- [InlineData( 2.7182818284590452, 0.0, 1.0, CrossPlatformMachineEpsilon * 10)] // x: (e)
- [InlineData( 2.7182818284590452, 0.31830988618379067, 1.3748022274393586, CrossPlatformMachineEpsilon * 10)] // x: (e) y: (1 / pi)
- [InlineData( 2.7182818284590452, 0.43429448190325183, 1.5438734439711811, CrossPlatformMachineEpsilon * 10)] // x: (e) y: (log10(e))
- [InlineData( 2.7182818284590452, 0.63661977236758134, 1.8900811645722220, CrossPlatformMachineEpsilon * 10)] // x: (e) y: (2 / pi)
- [InlineData( 2.7182818284590452, 0.69314718055994531, 2.0, CrossPlatformMachineEpsilon * 10)] // x: (e) y: (ln(2))
- [InlineData( 2.7182818284590452, 0.70710678118654752, 2.0281149816474725, CrossPlatformMachineEpsilon * 10)] // x: (e) y: (1 / sqrt(2))
- [InlineData( 2.7182818284590452, 0.78539816339744831, 2.1932800507380155, CrossPlatformMachineEpsilon * 10)] // x: (e) y: (pi / 4)
- [InlineData( 2.7182818284590452, 1.0, 2.7182818284590452, CrossPlatformMachineEpsilon * 10)] // x: (e) expected: (e)
- [InlineData( 2.7182818284590452, 1.1283791670955126, 3.0906430223107976, CrossPlatformMachineEpsilon * 10)] // x: (e) y: (2 / sqrt(pi))
- [InlineData( 2.7182818284590452, 1.4142135623730950, 4.1132503787829275, CrossPlatformMachineEpsilon * 10)] // x: (e) y: (sqrt(2))
- [InlineData( 2.7182818284590452, 1.4426950408889634, 4.2320861065570819, CrossPlatformMachineEpsilon * 10)] // x: (e) y: (log2(e))
- [InlineData( 2.7182818284590452, 1.5707963267948966, 4.8104773809653517, CrossPlatformMachineEpsilon * 10)] // x: (e) y: (pi / 2)
- [InlineData( 2.7182818284590452, 2.3025850929940457, 10.0, CrossPlatformMachineEpsilon * 100)] // x: (e) y: (ln(10))
- [InlineData( 2.7182818284590452, 2.7182818284590452, 15.154262241479264, CrossPlatformMachineEpsilon * 100)] // x: (e) y: (e)
- [InlineData( 2.7182818284590452, 3.1415926535897932, 23.140692632779269, CrossPlatformMachineEpsilon * 100)] // x: (e) y: (pi)
- [InlineData( 2.7182818284590452, double.PositiveInfinity, double.PositiveInfinity, 0.0)] // x: (e)
- [InlineData( 10.0, double.NegativeInfinity, 0.0, 0.0)]
- [InlineData( 10.0, -3.1415926535897932, 0.00072178415907472774, CrossPlatformMachineEpsilon / 1000)] // y: -(pi)
- [InlineData( 10.0, -2.7182818284590452, 0.0019130141022243176, CrossPlatformMachineEpsilon / 100)] // y: -(e)
- [InlineData( 10.0, -2.3025850929940457, 0.0049821282964407206, CrossPlatformMachineEpsilon / 100)] // y: -(ln(10))
- [InlineData( 10.0, -1.5707963267948966, 0.026866041001136132, CrossPlatformMachineEpsilon / 10)] // y: -(pi / 2)
- [InlineData( 10.0, -1.4426950408889634, 0.036083192820787210, CrossPlatformMachineEpsilon / 10)] // y: -(log2(e))
- [InlineData( 10.0, -1.4142135623730950, 0.038528884700322026, CrossPlatformMachineEpsilon / 10)] // y: -(sqrt(2))
- [InlineData( 10.0, -1.1283791670955126, 0.074408205860642723, CrossPlatformMachineEpsilon / 10)] // y: -(2 / sqrt(pi))
- [InlineData( 10.0, -1.0, 0.1, CrossPlatformMachineEpsilon)]
- [InlineData( 10.0, -0.78539816339744831, 0.16390863613957665, CrossPlatformMachineEpsilon)] // y: -(pi / 4)
- [InlineData( 10.0, -0.70710678118654752, 0.19628775993505562, CrossPlatformMachineEpsilon)] // y: -(1 / sqrt(2))
- [InlineData( 10.0, -0.69314718055994531, 0.20269956628651730, CrossPlatformMachineEpsilon)] // y: -(ln(2))
- [InlineData( 10.0, -0.63661977236758134, 0.23087676451600055, CrossPlatformMachineEpsilon)] // y: -(2 / pi)
- [InlineData( 10.0, -0.43429448190325183, 0.36787944117144232, CrossPlatformMachineEpsilon)] // y: -(log10(e))
- [InlineData( 10.0, -0.31830988618379067, 0.48049637305186868, CrossPlatformMachineEpsilon)] // y: -(1 / pi)
- [InlineData( 10.0, -0.0, 1.0, CrossPlatformMachineEpsilon * 10)]
- [InlineData( 10.0, double.NaN, double.NaN, 0.0)]
- [InlineData( 10.0, 0.0, 1.0, CrossPlatformMachineEpsilon * 10)]
- [InlineData( 10.0, 0.31830988618379067, 2.0811811619898573, CrossPlatformMachineEpsilon * 10)] // y: (1 / pi)
- [InlineData( 10.0, 0.43429448190325183, 2.7182818284590452, CrossPlatformMachineEpsilon * 10)] // y: (log10(e)) expected: (e)
- [InlineData( 10.0, 0.63661977236758134, 4.3313150290214525, CrossPlatformMachineEpsilon * 10)] // y: (2 / pi)
- [InlineData( 10.0, 0.69314718055994531, 4.9334096679145963, CrossPlatformMachineEpsilon * 10)] // y: (ln(2))
- [InlineData( 10.0, 0.70710678118654752, 5.0945611704512962, CrossPlatformMachineEpsilon * 10)] // y: (1 / sqrt(2))
- [InlineData( 10.0, 0.78539816339744831, 6.1009598002416937, CrossPlatformMachineEpsilon * 10)] // y: (pi / 4)
- [InlineData( 10.0, 1.0, 10.0, CrossPlatformMachineEpsilon * 100)]
- [InlineData( 10.0, 1.1283791670955126, 13.439377934644400, CrossPlatformMachineEpsilon * 100)] // y: (2 / sqrt(pi))
- [InlineData( 10.0, 1.4142135623730950, 25.954553519470081, CrossPlatformMachineEpsilon * 100)] // y: (sqrt(2))
- [InlineData( 10.0, 1.4426950408889634, 27.713733786437790, CrossPlatformMachineEpsilon * 100)] // y: (log2(e))
- [InlineData( 10.0, 1.5707963267948966, 37.221710484165167, CrossPlatformMachineEpsilon * 100)] // y: (pi / 2)
- [InlineData( 10.0, 2.3025850929940457, 200.71743249053009, CrossPlatformMachineEpsilon * 1000)] // y: (ln(10))
- [InlineData( 10.0, 2.7182818284590452, 522.73529967043665, CrossPlatformMachineEpsilon * 1000)] // y: (e)
- [InlineData( 10.0, 3.1415926535897932, 1385.4557313670111, CrossPlatformMachineEpsilon * 10000)] // y: (pi)
- [InlineData( 10.0, double.PositiveInfinity, double.PositiveInfinity, 0.0)]
- [InlineData( double.PositiveInfinity, double.NegativeInfinity, 0.0, 0.0)]
- [InlineData( double.PositiveInfinity, -1.0, 0.0, 0.0)]
- [InlineData( double.PositiveInfinity, -0.0, 1.0, 0.0)]
- [InlineData( double.PositiveInfinity, double.NaN, double.NaN, 0.0)]
- [InlineData( double.PositiveInfinity, 0.0, 1.0, 0.0)]
- [InlineData( double.PositiveInfinity, 1.0, double.PositiveInfinity, 0.0)]
- [InlineData( double.PositiveInfinity, double.PositiveInfinity, double.PositiveInfinity, 0.0)]
+ [MemberData(nameof(Pow_TestData))]
public static void Pow(double x, double y, double expectedResult, double allowedVariance)
{
AssertEqual(expectedResult, Math.Pow(x, y), allowedVariance);
diff --git a/src/System.Runtime.Extensions/tests/System/Reflection/AssemblyNameProxyTests.cs b/src/System.Runtime.Extensions/tests/System/Reflection/AssemblyNameProxyTests.cs
index b135e64a3f..0a2c9e50a0 100644
--- a/src/System.Runtime.Extensions/tests/System/Reflection/AssemblyNameProxyTests.cs
+++ b/src/System.Runtime.Extensions/tests/System/Reflection/AssemblyNameProxyTests.cs
@@ -14,6 +14,7 @@ namespace System.Reflection.Tests
public static class AssemblyNameProxyTests
{
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corert/issues/3253 - AssemblyName.GetAssemblyName(string file) not supported on UapAot", TargetFrameworkMonikers.UapAot)]
public static void GetAssemblyName_AssemblyNameProxy()
{
AssemblyNameProxy anp = new AssemblyNameProxy();
diff --git a/src/System.Runtime.InteropServices/src/System.Runtime.InteropServices.csproj b/src/System.Runtime.InteropServices/src/System.Runtime.InteropServices.csproj
index a7021a34d2..5825b2d597 100644
--- a/src/System.Runtime.InteropServices/src/System.Runtime.InteropServices.csproj
+++ b/src/System.Runtime.InteropServices/src/System.Runtime.InteropServices.csproj
@@ -44,15 +44,13 @@
</ItemGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
+ <ProjectReference Include="..\..\System.Runtime.Extensions\src\System.Runtime.Extensions.csproj"/>
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' == 'uapaot'">
<ReferenceFromRuntime Include="System.Private.Interop" />
<ProjectReference Include="..\..\System.Runtime\src\System.Runtime.csproj">
<TargetGroup>uapaot</TargetGroup>
- </ProjectReference>
- <ProjectReference Include="..\..\System.Runtime.Extensions\src\System.Runtime.Extensions.csproj">
- <TargetGroup>uapaot</TargetGroup>
- </ProjectReference>
+ </ProjectReference>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
diff --git a/src/System.Runtime.InteropServices/src/System/Runtime/InteropServices/RuntimeEnvironment.cs b/src/System.Runtime.InteropServices/src/System/Runtime/InteropServices/RuntimeEnvironment.cs
index 574dcb17ac..57f0837ee3 100644
--- a/src/System.Runtime.InteropServices/src/System/Runtime/InteropServices/RuntimeEnvironment.cs
+++ b/src/System.Runtime.InteropServices/src/System/Runtime/InteropServices/RuntimeEnvironment.cs
@@ -23,7 +23,12 @@ namespace System.Runtime.InteropServices
}
public static string GetRuntimeDirectory()
{
- return Path.GetDirectoryName(typeof(object).Assembly.Location) + Path.DirectorySeparatorChar;
+ string runtimeDirectory = typeof(object).Assembly.Location;
+ if (!Path.IsPathRooted(runtimeDirectory))
+ {
+ runtimeDirectory = AppDomain.CurrentDomain.BaseDirectory;
+ }
+ return Path.GetDirectoryName(runtimeDirectory) + Path.DirectorySeparatorChar;
}
public static System.IntPtr GetRuntimeInterfaceAsIntPtr(Guid clsid, Guid riid)
{
diff --git a/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/HandleCollectorTests.cs b/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/HandleCollectorTests.cs
index 7edb1795fa..4c73dd4244 100644
--- a/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/HandleCollectorTests.cs
+++ b/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/HandleCollectorTests.cs
@@ -60,6 +60,7 @@ namespace System.Runtime.InteropServices
}
[Fact]
+ [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot,"Reflects on private member handleCount")]
public static void CountOverflow()
{
HandleCollector collector = new HandleCollector("CountOverflow", int.MaxValue);
diff --git a/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/MarshalTests.cs b/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/MarshalTests.cs
index e74d4279f5..a7ccb59f8c 100644
--- a/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/MarshalTests.cs
+++ b/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/MarshalTests.cs
@@ -417,11 +417,11 @@ namespace System.Runtime.InteropServices
Marshal.FreeCoTaskMem(ptr);
}
- [Fact]
+ [Fact]
public static void BindToMoniker()
{
String monikerName = null;
- if(PlatformDetection.IsWindows)
+ if(PlatformDetection.IsWindows && !PlatformDetection.IsNetNative)
{
if (PlatformDetection.IsNotWindowsNanoServer)
{
@@ -434,10 +434,10 @@ namespace System.Runtime.InteropServices
}
}
- [Fact]
+ [Fact]
public static void ChangeWrapperHandleStrength()
{
- if(PlatformDetection.IsWindows)
+ if(PlatformDetection.IsWindows && !PlatformDetection.IsNetNative)
{
Assert.Throws<ArgumentNullException>(() => Marshal.ChangeWrapperHandleStrength(null, true));
}
diff --git a/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/RuntimeEnvironmentTest.cs b/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/RuntimeEnvironmentTest.cs
index 42c30f8721..b758813c4b 100644
--- a/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/RuntimeEnvironmentTest.cs
+++ b/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/RuntimeEnvironmentTest.cs
@@ -13,9 +13,15 @@ namespace System.Runtime.InteropServices
public static class RuntimeEnvironmentTest
{
[Fact]
- public static void RuntimeEnvironmentPosTest()
+ public static void RuntimeEnvironmentRuntimeDirectory()
{
Assert.True(Directory.Exists(RuntimeEnvironment.GetRuntimeDirectory()));
+ }
+
+ [Fact]
+ [ActiveIssue(20600, TargetFrameworkMonikers.UapAot)]
+ public static void RuntimeEnvironmentSysVersion()
+ {
Assert.True(!String.IsNullOrEmpty(RuntimeEnvironment.GetSystemVersion()));
}
diff --git a/src/System.Runtime.Loader/tests/AssemblyLoadContextTest.cs b/src/System.Runtime.Loader/tests/AssemblyLoadContextTest.cs
index 7d718c8f49..4279452ba5 100644
--- a/src/System.Runtime.Loader/tests/AssemblyLoadContextTest.cs
+++ b/src/System.Runtime.Loader/tests/AssemblyLoadContextTest.cs
@@ -12,6 +12,7 @@ using System.Threading.Tasks;
namespace System.Runtime.Loader.Tests
{
+ [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "AssemblyLoadContext not supported on .Net Native")]
public class AssemblyLoadContextTest
{
private const string TestAssembly = "System.Runtime.Loader.Test.Assembly";
diff --git a/src/System.Runtime.Loader/tests/DefaultContext/DefaultLoadContextTest.cs b/src/System.Runtime.Loader/tests/DefaultContext/DefaultLoadContextTest.cs
index de6c34b1c3..0356760c73 100644
--- a/src/System.Runtime.Loader/tests/DefaultContext/DefaultLoadContextTest.cs
+++ b/src/System.Runtime.Loader/tests/DefaultContext/DefaultLoadContextTest.cs
@@ -56,6 +56,7 @@ namespace System.Runtime.Loader.Tests
}
}
+ [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "AssemblyLoadContext not supported on .Net Native")]
public class DefaultLoadContextTests
{
private static string s_loadFromPath = null;
diff --git a/src/System.Runtime.Loader/tests/RefEmitLoadContext/RefEmitLoadContextTest.cs b/src/System.Runtime.Loader/tests/RefEmitLoadContext/RefEmitLoadContextTest.cs
index 82592964f7..16c2a83ac1 100644
--- a/src/System.Runtime.Loader/tests/RefEmitLoadContext/RefEmitLoadContextTest.cs
+++ b/src/System.Runtime.Loader/tests/RefEmitLoadContext/RefEmitLoadContextTest.cs
@@ -30,6 +30,7 @@ namespace System.Runtime.Loader.Tests
}
}
+ [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "AssemblyLoadContext not supported on .Net Native")]
public class RefEmitLoadContextTests
{
public static string s_loadFromPath = null;
diff --git a/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/Formatters/Binary/BinaryObjectReader.cs b/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/Formatters/Binary/BinaryObjectReader.cs
index f10cb12366..d38185ec57 100644
--- a/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/Formatters/Binary/BinaryObjectReader.cs
+++ b/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/Formatters/Binary/BinaryObjectReader.cs
@@ -942,12 +942,36 @@ namespace System.Runtime.Serialization.Formatters.Binary
if (entry == null || entry.AssemblyName != assemblyName)
{
+ // Check early to avoid throwing unnecessary exceptions
+ if (assemblyName == null)
+ {
+ return null;
+ }
+
Assembly assm = null;
+ AssemblyName assmName = null;
+
try
{
- assm = Assembly.Load(new AssemblyName(assemblyName));
+ assmName = new AssemblyName(assemblyName);
+ }
+ catch
+ {
+ return null;
+ }
+
+ if (_isSimpleAssembly)
+ {
+ assm = ResolveSimpleAssemblyName(assmName);
+ }
+ else
+ {
+ try
+ {
+ assm = Assembly.Load(assmName);
+ }
+ catch { }
}
- catch { }
if (assm == null)
{
@@ -979,6 +1003,26 @@ namespace System.Runtime.Serialization.Formatters.Binary
return entry.Type;
}
+ private static Assembly ResolveSimpleAssemblyName(AssemblyName assemblyName)
+ {
+ try
+ {
+ return Assembly.Load(assemblyName);
+ }
+ catch { }
+
+ if (assemblyName != null)
+ {
+ try
+ {
+ return Assembly.Load(assemblyName.Name);
+ }
+ catch { }
+ }
+
+ return null;
+ }
+
private static void GetSimplyNamedTypeFromAssembly(Assembly assm, string typeName, ref Type type)
{
// Catching any exceptions that could be thrown from a failure on assembly load
@@ -991,6 +1035,11 @@ namespace System.Runtime.Serialization.Formatters.Binary
catch (FileNotFoundException) { }
catch (FileLoadException) { }
catch (BadImageFormatException) { }
+
+ if (type == null)
+ {
+ type = Type.GetType(typeName, ResolveSimpleAssemblyName, new TopLevelAssemblyTypeResolver(assm).ResolveType, throwOnError: false);
+ }
}
private string _previousAssemblyString;
@@ -1040,5 +1089,25 @@ namespace System.Runtime.Serialization.Formatters.Binary
{
// nop on core
}
+
+ internal sealed class TopLevelAssemblyTypeResolver
+ {
+ private readonly Assembly _topLevelAssembly;
+
+ public TopLevelAssemblyTypeResolver(Assembly topLevelAssembly)
+ {
+ _topLevelAssembly = topLevelAssembly;
+ }
+
+ public Type ResolveType(Assembly assembly, string simpleTypeName, bool ignoreCase)
+ {
+ if (assembly == null)
+ {
+ assembly = _topLevelAssembly;
+ }
+
+ return assembly.GetType(simpleTypeName, throwOnError: false, ignoreCase: ignoreCase);
+ }
+ }
}
}
diff --git a/src/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTestData.cs b/src/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTestData.cs
new file mode 100644
index 0000000000..a33b5640df
--- /dev/null
+++ b/src/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTestData.cs
@@ -0,0 +1,390 @@
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlTypes;
+using System.Globalization;
+using System.Linq;
+using System.Net;
+using System.Numerics;
+using System.Text;
+
+namespace System.Runtime.Serialization.Formatters.Tests
+{
+ public partial class BinaryFormatterTests
+ {
+ /// <summary>
+ /// First: Object
+ /// Second: String Array with Base64 Object Hashes serialized in 1. netcoreapp and 2. netfx
+ /// If a new hash needs to be generated delete the string element in the array and you will get
+ /// the new one in the exception message when running the ValidateTfmHashes test.
+ /// </summary>
+ public static IEnumerable<object[]> SerializableObjects()
+ {
+ // Primitive types
+ yield return new object[] { byte.MinValue, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAAtTeXN0ZW0uQnl0ZQEAAAAHbV92YWx1ZQACAAs=", "AAEAAAD/////AQAAAAAAAAAEAQAAAAtTeXN0ZW0uQnl0ZQEAAAAHbV92YWx1ZQACAAs=" } };
+ yield return new object[] { byte.MaxValue, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAAtTeXN0ZW0uQnl0ZQEAAAAHbV92YWx1ZQAC/ws=", "AAEAAAD/////AQAAAAAAAAAEAQAAAAtTeXN0ZW0uQnl0ZQEAAAAHbV92YWx1ZQAC/ws=" } };
+ yield return new object[] { sbyte.MinValue, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAAxTeXN0ZW0uU0J5dGUBAAAAB21fdmFsdWUACoAL", "AAEAAAD/////AQAAAAAAAAAEAQAAAAxTeXN0ZW0uU0J5dGUBAAAAB21fdmFsdWUACoAL" } };
+ yield return new object[] { sbyte.MaxValue, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAAxTeXN0ZW0uU0J5dGUBAAAAB21fdmFsdWUACn8L", "AAEAAAD/////AQAAAAAAAAAEAQAAAAxTeXN0ZW0uU0J5dGUBAAAAB21fdmFsdWUACn8L" } };
+ yield return new object[] { short.MinValue, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAAxTeXN0ZW0uSW50MTYBAAAAB21fdmFsdWUABwCACw==", "AAEAAAD/////AQAAAAAAAAAEAQAAAAxTeXN0ZW0uSW50MTYBAAAAB21fdmFsdWUABwCACw==" } };
+ yield return new object[] { short.MaxValue, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAAxTeXN0ZW0uSW50MTYBAAAAB21fdmFsdWUAB/9/Cw==", "AAEAAAD/////AQAAAAAAAAAEAQAAAAxTeXN0ZW0uSW50MTYBAAAAB21fdmFsdWUAB/9/Cw==" } };
+ yield return new object[] { ushort.MinValue, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAA1TeXN0ZW0uVUludDE2AQAAAAdtX3ZhbHVlAA4AAAs=", "AAEAAAD/////AQAAAAAAAAAEAQAAAA1TeXN0ZW0uVUludDE2AQAAAAdtX3ZhbHVlAA4AAAs=" } };
+ yield return new object[] { ushort.MaxValue, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAA1TeXN0ZW0uVUludDE2AQAAAAdtX3ZhbHVlAA7//ws=", "AAEAAAD/////AQAAAAAAAAAEAQAAAA1TeXN0ZW0uVUludDE2AQAAAAdtX3ZhbHVlAA7//ws=" } };
+ yield return new object[] { int.MinValue, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAAxTeXN0ZW0uSW50MzIBAAAAB21fdmFsdWUACAAAAIAL", "AAEAAAD/////AQAAAAAAAAAEAQAAAAxTeXN0ZW0uSW50MzIBAAAAB21fdmFsdWUACAAAAIAL" } };
+ yield return new object[] { int.MaxValue, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAAxTeXN0ZW0uSW50MzIBAAAAB21fdmFsdWUACP///38L", "AAEAAAD/////AQAAAAAAAAAEAQAAAAxTeXN0ZW0uSW50MzIBAAAAB21fdmFsdWUACP///38L" } };
+ yield return new object[] { uint.MinValue, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAA1TeXN0ZW0uVUludDMyAQAAAAdtX3ZhbHVlAA8AAAAACw==", "AAEAAAD/////AQAAAAAAAAAEAQAAAA1TeXN0ZW0uVUludDMyAQAAAAdtX3ZhbHVlAA8AAAAACw==" } };
+ yield return new object[] { uint.MaxValue, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAA1TeXN0ZW0uVUludDMyAQAAAAdtX3ZhbHVlAA//////Cw==", "AAEAAAD/////AQAAAAAAAAAEAQAAAA1TeXN0ZW0uVUludDMyAQAAAAdtX3ZhbHVlAA//////Cw==" } };
+ yield return new object[] { long.MinValue, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAAxTeXN0ZW0uSW50NjQBAAAAB21fdmFsdWUACQAAAAAAAACACw==", "AAEAAAD/////AQAAAAAAAAAEAQAAAAxTeXN0ZW0uSW50NjQBAAAAB21fdmFsdWUACQAAAAAAAACACw==" } };
+ yield return new object[] { long.MaxValue, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAAxTeXN0ZW0uSW50NjQBAAAAB21fdmFsdWUACf////////9/Cw==", "AAEAAAD/////AQAAAAAAAAAEAQAAAAxTeXN0ZW0uSW50NjQBAAAAB21fdmFsdWUACf////////9/Cw==" } };
+ yield return new object[] { ulong.MinValue, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAA1TeXN0ZW0uVUludDY0AQAAAAdtX3ZhbHVlABAAAAAAAAAAAAs=", "AAEAAAD/////AQAAAAAAAAAEAQAAAA1TeXN0ZW0uVUludDY0AQAAAAdtX3ZhbHVlABAAAAAAAAAAAAs=" } };
+ yield return new object[] { ulong.MaxValue, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAA1TeXN0ZW0uVUludDY0AQAAAAdtX3ZhbHVlABD//////////ws=", "AAEAAAD/////AQAAAAAAAAAEAQAAAA1TeXN0ZW0uVUludDY0AQAAAAdtX3ZhbHVlABD//////////ws=" } };
+ yield return new object[] { char.MinValue, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAAtTeXN0ZW0uQ2hhcgEAAAAHbV92YWx1ZQADAAs=", "AAEAAAD/////AQAAAAAAAAAEAQAAAAtTeXN0ZW0uQ2hhcgEAAAAHbV92YWx1ZQADAAs=" } };
+ yield return new object[] { char.MaxValue, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAAtTeXN0ZW0uQ2hhcgEAAAAHbV92YWx1ZQAD77+/Cw==", "AAEAAAD/////AQAAAAAAAAAEAQAAAAtTeXN0ZW0uQ2hhcgEAAAAHbV92YWx1ZQAD77+/Cw==" } };
+ yield return new object[] { float.MinValue, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAA1TeXN0ZW0uU2luZ2xlAQAAAAdtX3ZhbHVlAAv//3//Cw==", "AAEAAAD/////AQAAAAAAAAAEAQAAAA1TeXN0ZW0uU2luZ2xlAQAAAAdtX3ZhbHVlAAv//3//Cw==" } };
+ yield return new object[] { float.MaxValue, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAA1TeXN0ZW0uU2luZ2xlAQAAAAdtX3ZhbHVlAAv//39/Cw==", "AAEAAAD/////AQAAAAAAAAAEAQAAAA1TeXN0ZW0uU2luZ2xlAQAAAAdtX3ZhbHVlAAv//39/Cw==" } };
+ yield return new object[] { double.MinValue, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAA1TeXN0ZW0uRG91YmxlAQAAAAdtX3ZhbHVlAAb////////v/ws=", "AAEAAAD/////AQAAAAAAAAAEAQAAAA1TeXN0ZW0uRG91YmxlAQAAAAdtX3ZhbHVlAAb////////v/ws=" } };
+ yield return new object[] { double.MaxValue, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAA1TeXN0ZW0uRG91YmxlAQAAAAdtX3ZhbHVlAAb////////vfws=", "AAEAAAD/////AQAAAAAAAAAEAQAAAA1TeXN0ZW0uRG91YmxlAQAAAAdtX3ZhbHVlAAb////////vfws=" } };
+ yield return new object[] { decimal.MinValue, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAA5TeXN0ZW0uRGVjaW1hbAQAAAAFZmxhZ3MCaGkCbG8DbWlkAAAAAAgICAgAAACA////////////////Cw==", "AAEAAAD/////AQAAAAAAAAAEAQAAAA5TeXN0ZW0uRGVjaW1hbAQAAAAFZmxhZ3MCaGkCbG8DbWlkAAAAAAgICAgAAACA////////////////Cw==" } };
+ yield return new object[] { decimal.MaxValue, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAA5TeXN0ZW0uRGVjaW1hbAQAAAAFZmxhZ3MCaGkCbG8DbWlkAAAAAAgICAgAAAAA////////////////Cw==", "AAEAAAD/////AQAAAAAAAAAEAQAAAA5TeXN0ZW0uRGVjaW1hbAQAAAAFZmxhZ3MCaGkCbG8DbWlkAAAAAAgICAgAAAAA////////////////Cw==" } };
+ yield return new object[] { decimal.MinusOne, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAA5TeXN0ZW0uRGVjaW1hbAQAAAAFZmxhZ3MCaGkCbG8DbWlkAAAAAAgICAgAAACAAAAAAAEAAAAAAAAACw==", "AAEAAAD/////AQAAAAAAAAAEAQAAAA5TeXN0ZW0uRGVjaW1hbAQAAAAFZmxhZ3MCaGkCbG8DbWlkAAAAAAgICAgAAACAAAAAAAEAAAAAAAAACw==" } };
+ yield return new object[] { true, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAA5TeXN0ZW0uQm9vbGVhbgEAAAAHbV92YWx1ZQABAQs=", "AAEAAAD/////AQAAAAAAAAAEAQAAAA5TeXN0ZW0uQm9vbGVhbgEAAAAHbV92YWx1ZQABAQs=" } };
+ yield return new object[] { false, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAA5TeXN0ZW0uQm9vbGVhbgEAAAAHbV92YWx1ZQABAAs=", "AAEAAAD/////AQAAAAAAAAAEAQAAAA5TeXN0ZW0uQm9vbGVhbgEAAAAHbV92YWx1ZQABAAs=" } };
+ yield return new object[] { "", new string[] { "AAEAAAD/////AQAAAAAAAAAGAQAAAAAL", "AAEAAAD/////AQAAAAAAAAAGAQAAAAAL" } };
+ yield return new object[] { "c", new string[] { "AAEAAAD/////AQAAAAAAAAAGAQAAAAFjCw==", "AAEAAAD/////AQAAAAAAAAAGAQAAAAFjCw==" } };
+ yield return new object[] { "\u4F60\u597D", new string[] { "AAEAAAD/////AQAAAAAAAAAGAQAAAAbkvaDlpb0L", "AAEAAAD/////AQAAAAAAAAAGAQAAAAbkvaDlpb0L" } };
+ yield return new object[] { "some\0data\0with\0null\0chars", new string[] { "AAEAAAD/////AQAAAAAAAAAGAQAAABlzb21lAGRhdGEAd2l0aABudWxsAGNoYXJzCw==", "AAEAAAD/////AQAAAAAAAAAGAQAAABlzb21lAGRhdGEAd2l0aABudWxsAGNoYXJzCw==" } };
+ yield return new object[] { "<>&\"\'", new string[] { "AAEAAAD/////AQAAAAAAAAAGAQAAAAU8PiYiJws=", "AAEAAAD/////AQAAAAAAAAAGAQAAAAU8PiYiJws=" } };
+ yield return new object[] { " < ", new string[] { "AAEAAAD/////AQAAAAAAAAAGAQAAAAMgPCAL", "AAEAAAD/////AQAAAAAAAAAGAQAAAAMgPCAL" } };
+ yield return new object[] { "minchar" + char.MinValue + "minchar", new string[] { "AAEAAAD/////AQAAAAAAAAAGAQAAAA9taW5jaGFyAG1pbmNoYXIL", "AAEAAAD/////AQAAAAAAAAAGAQAAAA9taW5jaGFyAG1pbmNoYXIL" } };
+
+ // Enum values
+ yield return new object[] { DayOfWeek.Monday, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAABBTeXN0ZW0uRGF5T2ZXZWVrAQAAAAd2YWx1ZV9fAAgBAAAACw==", "AAEAAAD/////AQAAAAAAAAAEAQAAABBTeXN0ZW0uRGF5T2ZXZWVrAQAAAAd2YWx1ZV9fAAgBAAAACw==" } };
+ yield return new object[] { DateTimeKind.Local, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAABNTeXN0ZW0uRGF0ZVRpbWVLaW5kAQAAAAd2YWx1ZV9fAAgCAAAACw==", "AAEAAAD/////AQAAAAAAAAAEAQAAABNTeXN0ZW0uRGF0ZVRpbWVLaW5kAQAAAAd2YWx1ZV9fAAgCAAAACw==" } };
+
+ // Nullables
+ yield return new object[] { (int?)1, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAAxTeXN0ZW0uSW50MzIBAAAAB21fdmFsdWUACAEAAAAL", "AAEAAAD/////AQAAAAAAAAAEAQAAAAxTeXN0ZW0uSW50MzIBAAAAB21fdmFsdWUACAEAAAAL" } };
+ yield return new object[] { (StructWithIntField?)new StructWithIntField() { X = 42 }, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAABAU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlN0cnVjdFdpdGhJbnRGaWVsZAEAAAABWAAIAgAAACoAAAAL", "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAABAU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlN0cnVjdFdpdGhJbnRGaWVsZAEAAAABWAAIAgAAACoAAAAL" } };
+
+ // Nullable equality comparer roundtrips as opposed to other equality comparers which serialize to ObjectEqualityComparer
+ yield return new object[] { EqualityComparer<int>.Default, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAJ8BU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuR2VuZXJpY0VxdWFsaXR5Q29tcGFyZXJgMVtbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dAAAAAAs=", "AAEAAAD/////AQAAAAAAAAAEAQAAAJEBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuR2VuZXJpY0VxdWFsaXR5Q29tcGFyZXJgMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQAAAAAL" } };
+ yield return new object[] { EqualityComparer<long>.Default, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAJ8BU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuR2VuZXJpY0VxdWFsaXR5Q29tcGFyZXJgMVtbU3lzdGVtLkludDY0LCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dAAAAAAs=", "AAEAAAD/////AQAAAAAAAAAEAQAAAJEBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuR2VuZXJpY0VxdWFsaXR5Q29tcGFyZXJgMVtbU3lzdGVtLkludDY0LCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQAAAAAL" } };
+ yield return new object[] { EqualityComparer<string>.Default, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAKABU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuR2VuZXJpY0VxdWFsaXR5Q29tcGFyZXJgMVtbU3lzdGVtLlN0cmluZywgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQAAAAAL", "AAEAAAD/////AQAAAAAAAAAEAQAAAJIBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuR2VuZXJpY0VxdWFsaXR5Q29tcGFyZXJgMVtbU3lzdGVtLlN0cmluZywgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0AAAAACw==" } };
+ yield return new object[] { EqualityComparer<object>.Default, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAJ8BU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuT2JqZWN0RXF1YWxpdHlDb21wYXJlcmAxW1tTeXN0ZW0uT2JqZWN0LCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dAAAAAAs=", "AAEAAAD/////AQAAAAAAAAAEAQAAAJEBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuT2JqZWN0RXF1YWxpdHlDb21wYXJlcmAxW1tTeXN0ZW0uT2JqZWN0LCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQAAAAAL" } };
+ yield return new object[] { EqualityComparer<int?>.Default, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAKABU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTnVsbGFibGVFcXVhbGl0eUNvbXBhcmVyYDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQAAAAAL", "AAEAAAD/////AQAAAAAAAAAEAQAAAJIBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTnVsbGFibGVFcXVhbGl0eUNvbXBhcmVyYDFbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0AAAAACw==" } };
+ yield return new object[] { EqualityComparer<double?>.Default, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAKEBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTnVsbGFibGVFcXVhbGl0eUNvbXBhcmVyYDFbW1N5c3RlbS5Eb3VibGUsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0AAAAACw==", "AAEAAAD/////AQAAAAAAAAAEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTnVsbGFibGVFcXVhbGl0eUNvbXBhcmVyYDFbW1N5c3RlbS5Eb3VibGUsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dAAAAAAs=" } };
+
+ // Equality comparers which can roundtrip
+ yield return new object[] { EqualityComparer<byte>.Default, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAC9TeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5CeXRlRXF1YWxpdHlDb21wYXJlcgAAAAAL", "AAEAAAD/////AQAAAAAAAAAEAQAAAC9TeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5CeXRlRXF1YWxpdHlDb21wYXJlcgAAAAAL" } };
+ yield return new object[] { EqualityComparer<Int32Enum>.Default, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAN4BU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuRW51bUVxdWFsaXR5Q29tcGFyZXJgMVtbU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLkludDMyRW51bSwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dAAAAAAs=", "AAEAAAD/////AQAAAAAAAAAEAQAAAN4BU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuRW51bUVxdWFsaXR5Q29tcGFyZXJgMVtbU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLkludDMyRW51bSwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dAAAAAAs=" } };
+
+ // Other core serializable types
+ yield return new object[] { IntPtr.Zero, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAA1TeXN0ZW0uSW50UHRyAQAAAAV2YWx1ZQAJAAAAAAAAAAAL", "AAEAAAD/////AQAAAAAAAAAEAQAAAA1TeXN0ZW0uSW50UHRyAQAAAAV2YWx1ZQAJAAAAAAAAAAAL" } };
+ yield return new object[] { UIntPtr.Zero, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAA5TeXN0ZW0uVUludFB0cgEAAAAFdmFsdWUAEAAAAAAAAAAACw==", "AAEAAAD/////AQAAAAAAAAAEAQAAAA5TeXN0ZW0uVUludFB0cgEAAAAFdmFsdWUAEAAAAAAAAAAACw==" } };
+ yield return new object[] { new DateTime(1990, 11, 23), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAA9TeXN0ZW0uRGF0ZVRpbWUCAAAABXRpY2tzCV9kYXRlRGF0YQAACRAAwPc9bey2CADA9z1t7LYICw==", "AAEAAAD/////AQAAAAAAAAAEAQAAAA9TeXN0ZW0uRGF0ZVRpbWUCAAAABXRpY2tzCGRhdGVEYXRhAAAJEADA9z1t7LYIAMD3PW3stggL" } };
+ yield return new object[] { new DateTimeOffset(1990, 11, 23, 03, 30, 00, 00, TimeSpan.FromMinutes(30)), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAABVTeXN0ZW0uRGF0ZVRpbWVPZmZzZXQCAAAACERhdGVUaW1lDU9mZnNldE1pbnV0ZXMAAA0HAPhEY4bstggeAAs=", "AAEAAAD/////AQAAAAAAAAAEAQAAABVTeXN0ZW0uRGF0ZVRpbWVPZmZzZXQCAAAACERhdGVUaW1lDU9mZnNldE1pbnV0ZXMAAA0HAPhEY4bstggeAAs=" } };
+ yield return new object[] { TimeZoneInfo.Utc, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAABNTeXN0ZW0uVGltZVpvbmVJbmZvBwAAAAJJZAtEaXNwbGF5TmFtZQxTdGFuZGFyZE5hbWUMRGF5bGlnaHROYW1lDUJhc2VVdGNPZmZzZXQPQWRqdXN0bWVudFJ1bGVzGlN1cHBvcnRzRGF5bGlnaHRTYXZpbmdUaW1lAQEBAQACAAwBBgIAAAADVVRDCQIAAAAJAgAAAAkCAAAAAAAAAAAAAAAKAAs=", "AAEAAAD/////AQAAAAAAAAAMAgAAAE5TeXN0ZW0uQ29yZSwgVmVyc2lvbj0zLjUuMC4wLCBDdWx0dXJlPU5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAABNTeXN0ZW0uVGltZVpvbmVJbmZvBwAAAAJJZAtEaXNwbGF5TmFtZQxTdGFuZGFyZE5hbWUMRGF5bGlnaHROYW1lDUJhc2VVdGNPZmZzZXQPQWRqdXN0bWVudFJ1bGVzGlN1cHBvcnRzRGF5bGlnaHRTYXZpbmdUaW1lAQEBAQACAAwBAgAAAAYDAAAAA1VUQwkDAAAACQMAAAAJAwAAAAAAAAAAAAAACgAL" } };
+ yield return new object[] { TimeZoneInfo.TransitionTime.CreateFixedDateRule(new DateTime(1, 1, 1, 2, 0, 0), 3, 15), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAACJTeXN0ZW0uVGltZVpvbmVJbmZvK1RyYW5zaXRpb25UaW1lBgAAAAlUaW1lT2ZEYXkFTW9udGgEV2VlawNEYXkJRGF5T2ZXZWVrD0lzRml4ZWREYXRlUnVsZQAAAAADAA0CAgIQU3lzdGVtLkRheU9mV2VlawEA0IjDEAAAAAMBDwT+////EFN5c3RlbS5EYXlPZldlZWsBAAAAB3ZhbHVlX18ACAAAAAABCw==", "AAEAAAD/////AQAAAAAAAAAMAgAAAE5TeXN0ZW0uQ29yZSwgVmVyc2lvbj0zLjUuMC4wLCBDdWx0dXJlPU5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACJTeXN0ZW0uVGltZVpvbmVJbmZvK1RyYW5zaXRpb25UaW1lBgAAAAlUaW1lT2ZEYXkFTW9udGgEV2VlawNEYXkJRGF5T2ZXZWVrD0lzRml4ZWREYXRlUnVsZQAAAAADAA0CAgIQU3lzdGVtLkRheU9mV2VlawECAAAAANCIwxAAAAADAQ8E/f///xBTeXN0ZW0uRGF5T2ZXZWVrAQAAAAd2YWx1ZV9fAAgAAAAAAQs=" } };
+ yield return new object[] { TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new DateTime(1900, 1, 1),
+ new DateTime(1955, 12, 31),
+ TimeSpan.FromHours(2),
+ TimeZoneInfo.TransitionTime.CreateFixedDateRule(new DateTime(1, 1, 1, 2, 0, 0), 2, 3),
+ TimeZoneInfo.TransitionTime.CreateFixedDateRule(new DateTime(1, 1, 1, 2, 0, 0), 3, 4)), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAACJTeXN0ZW0uVGltZVpvbmVJbmZvK0FkanVzdG1lbnRSdWxlBwAAAAlEYXRlU3RhcnQHRGF0ZUVuZA1EYXlsaWdodERlbHRhF0RheWxpZ2h0VHJhbnNpdGlvblN0YXJ0FURheWxpZ2h0VHJhbnNpdGlvbkVuZBJCYXNlVXRjT2Zmc2V0RGVsdGEVTm9EYXlsaWdodFRyYW5zaXRpb25zAAAAAwMAAA0NDCJTeXN0ZW0uVGltZVpvbmVJbmZvK1RyYW5zaXRpb25UaW1lIlN5c3RlbS5UaW1lWm9uZUluZm8rVHJhbnNpdGlvblRpbWUMAQBAVyBTBVEIAEDGiJPMjwgA0IjDEAAAAAT+////IlN5c3RlbS5UaW1lWm9uZUluZm8rVHJhbnNpdGlvblRpbWUGAAAACVRpbWVPZkRheQVNb250aARXZWVrA0RheQlEYXlPZldlZWsPSXNGaXhlZERhdGVSdWxlAAAAAAMADQICAhBTeXN0ZW0uRGF5T2ZXZWVrAQDQiMMQAAAAAgEDBP3///8QU3lzdGVtLkRheU9mV2VlawEAAAAHdmFsdWVfXwAIAAAAAAEB/P////7///8A0IjDEAAAAAMBBAH7/////f///wAAAAABAAAAAAAAAAAACw==", "AAEAAAD/////AQAAAAAAAAAMAgAAAE5TeXN0ZW0uQ29yZSwgVmVyc2lvbj0zLjUuMC4wLCBDdWx0dXJlPU5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACJTeXN0ZW0uVGltZVpvbmVJbmZvK0FkanVzdG1lbnRSdWxlBgAAAAlEYXRlU3RhcnQHRGF0ZUVuZA1EYXlsaWdodERlbHRhF0RheWxpZ2h0VHJhbnNpdGlvblN0YXJ0FURheWxpZ2h0VHJhbnNpdGlvbkVuZBJCYXNlVXRjT2Zmc2V0RGVsdGEAAAAEBAANDQwiU3lzdGVtLlRpbWVab25lSW5mbytUcmFuc2l0aW9uVGltZQIAAAAiU3lzdGVtLlRpbWVab25lSW5mbytUcmFuc2l0aW9uVGltZQIAAAAMAgAAAABAVyBTBVEIAEDGiJPMjwgA0IjDEAAAAAX9////IlN5c3RlbS5UaW1lWm9uZUluZm8rVHJhbnNpdGlvblRpbWUGAAAACVRpbWVPZkRheQVNb250aARXZWVrA0RheQlEYXlPZldlZWsPSXNGaXhlZERhdGVSdWxlAAAAAAMADQICAhBTeXN0ZW0uRGF5T2ZXZWVrAQIAAAAA0IjDEAAAAAIBAwT8////EFN5c3RlbS5EYXlPZldlZWsBAAAAB3ZhbHVlX18ACAAAAAABAfv////9////ANCIwxAAAAADAQQB+v////z///8AAAAAAQAAAAAAAAAACw==" } };
+ yield return new object[] { TimeSpan.FromDays(7), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAA9TeXN0ZW0uVGltZVNwYW4BAAAABl90aWNrcwAJAEDkKIAFAAAL", "AAEAAAD/////AQAAAAAAAAAEAQAAAA9TeXN0ZW0uVGltZVNwYW4BAAAABl90aWNrcwAJAEDkKIAFAAAL" } };
+ yield return new object[] { new Version(1, 2, 3, 4), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAA5TeXN0ZW0uVmVyc2lvbgQAAAAGX01ham9yBl9NaW5vcgZfQnVpbGQJX1JldmlzaW9uAAAAAAgICAgBAAAAAgAAAAMAAAAEAAAACw==", "AAEAAAD/////AQAAAAAAAAAEAQAAAA5TeXN0ZW0uVmVyc2lvbgQAAAAGX01ham9yBl9NaW5vcgZfQnVpbGQJX1JldmlzaW9uAAAAAAgICAgBAAAAAgAAAAMAAAAEAAAACw==" } };
+ yield return new object[] { new Guid("0CACAA4D-C6BD-420A-B660-2F557337CA89"), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAAtTeXN0ZW0uR3VpZAsAAAACX2ECX2ICX2MCX2QCX2UCX2YCX2cCX2gCX2kCX2oCX2sAAAAAAAAAAAAAAAgHBwICAgICAgICTaqsDL3GCkK2YC9VczfKiQs=", "AAEAAAD/////AQAAAAAAAAAEAQAAAAtTeXN0ZW0uR3VpZAsAAAACX2ECX2ICX2MCX2QCX2UCX2YCX2cCX2gCX2kCX2oCX2sAAAAAAAAAAAAAAAgHBwICAgICAgICTaqsDL3GCkK2YC9VczfKiQs=" } };
+ yield return new object[] { new List<int>(), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAIwBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0DAAAABl9pdGVtcwVfc2l6ZQhfdmVyc2lvbgcAAAgICAkCAAAAAAAAAAAAAAAPAgAAAAAAAAAICw==", "AAEAAAD/////AQAAAAAAAAAEAQAAAH5TeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5MaXN0YDFbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0DAAAABl9pdGVtcwVfc2l6ZQhfdmVyc2lvbgcAAAgICAkCAAAAAAAAAAAAAAAPAgAAAAAAAAAICw==" } };
+ yield return new object[] { new List<int>() { 1, 2, 3, 4, 5 }, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAIwBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0DAAAABl9pdGVtcwVfc2l6ZQhfdmVyc2lvbgcAAAgICAkCAAAABQAAAAUAAAAPAgAAAAgAAAAIAQAAAAIAAAADAAAABAAAAAUAAAAAAAAAAAAAAAAAAAAL", "AAEAAAD/////AQAAAAAAAAAEAQAAAH5TeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5MaXN0YDFbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0DAAAABl9pdGVtcwVfc2l6ZQhfdmVyc2lvbgcAAAgICAkCAAAABQAAAAUAAAAPAgAAAAgAAAAIAQAAAAIAAAADAAAABAAAAAUAAAAAAAAAAAAAAAAAAAAL" } };
+ var dictionary = new Dictionary<int, string>() { { 1, "test" }, { 2, "another test" } };
+ yield return new object[] { dictionary, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAP0BU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuRGljdGlvbmFyeWAyW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLlN0cmluZywgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQQAAAAHVmVyc2lvbghDb21wYXJlcghIYXNoU2l6ZQ1LZXlWYWx1ZVBhaXJzAAMAAwifAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkdlbmVyaWNFcXVhbGl0eUNvbXBhcmVyYDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQiBAlN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLktleVZhbHVlUGFpcmAyW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLlN0cmluZywgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXVtdAgAAAAkCAAAAAwAAAAkDAAAABAIAAACfAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkdlbmVyaWNFcXVhbGl0eUNvbXBhcmVyYDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQAAAAAHAwAAAAABAAAAAgAAAAP/AVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLktleVZhbHVlUGFpcmAyW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLlN0cmluZywgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQT8/////wFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5LZXlWYWx1ZVBhaXJgMltbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5TdHJpbmcsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0CAAAAA2tleQV2YWx1ZQABCAEAAAAGBQAAAAR0ZXN0Afr////8////AgAAAAYHAAAADGFub3RoZXIgdGVzdAs=", "AAEAAAD/////AQAAAAAAAAAEAQAAAOEBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuRGljdGlvbmFyeWAyW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV0sW1N5c3RlbS5TdHJpbmcsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dBAAAAAdWZXJzaW9uCENvbXBhcmVyCEhhc2hTaXplDUtleVZhbHVlUGFpcnMAAwADCJEBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuR2VuZXJpY0VxdWFsaXR5Q29tcGFyZXJgMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQjlAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLktleVZhbHVlUGFpcmAyW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV0sW1N5c3RlbS5TdHJpbmcsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dW10CAAAACQIAAAADAAAACQMAAAAEAgAAAJEBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuR2VuZXJpY0VxdWFsaXR5Q29tcGFyZXJgMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQAAAAAHAwAAAAABAAAAAgAAAAPjAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLktleVZhbHVlUGFpcmAyW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV0sW1N5c3RlbS5TdHJpbmcsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dBPz////jAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLktleVZhbHVlUGFpcmAyW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV0sW1N5c3RlbS5TdHJpbmcsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dAgAAAANrZXkFdmFsdWUAAQgBAAAABgUAAAAEdGVzdAH6/////P///wIAAAAGBwAAAAxhbm90aGVyIHRlc3QL" } };
+ var pointDictionary = new Dictionary<int, Point>()
+ {
+ { 1, new Point(1, 1) },
+ { 2, new Point(2, 2) }
+ };
+ yield return new object[] { Tuple.Create(1), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAHlTeXN0ZW0uVHVwbGVgMVtbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dAQAAAAdtX0l0ZW0xAAgBAAAACw==", "AAEAAAD/////AQAAAAAAAAAEAQAAAGtTeXN0ZW0uVHVwbGVgMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQEAAAAHbV9JdGVtMQAIAQAAAAs=" } };
+ yield return new object[] { Tuple.Create(1, "2"), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAOQBU3lzdGVtLlR1cGxlYDJbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdLFtTeXN0ZW0uU3RyaW5nLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dAgAAAAdtX0l0ZW0xB21fSXRlbTIAAQgBAAAABgIAAAABMgs=", "AAEAAAD/////AQAAAAAAAAAEAQAAAMgBU3lzdGVtLlR1cGxlYDJbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlN0cmluZywgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0CAAAAB21fSXRlbTEHbV9JdGVtMgABCAEAAAAGAgAAAAEyCw==" } };
+ yield return new object[] { Tuple.Create(1, "2", 3u), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAM8CU3lzdGVtLlR1cGxlYDNbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdLFtTeXN0ZW0uU3RyaW5nLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5VSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0DAAAAB21fSXRlbTEHbV9JdGVtMgdtX0l0ZW0zAAEACA8BAAAABgIAAAABMgMAAAAL", "AAEAAAD/////AQAAAAAAAAAEAQAAAKUCU3lzdGVtLlR1cGxlYDNbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlN0cmluZywgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlVJbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0DAAAAB21fSXRlbTEHbV9JdGVtMgdtX0l0ZW0zAAEACA8BAAAABgIAAAABMgMAAAAL" } };
+ yield return new object[] { Tuple.Create(1, "2", 3u, 4L), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAALkDU3lzdGVtLlR1cGxlYDRbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdLFtTeXN0ZW0uU3RyaW5nLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5VSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLkludDY0LCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dBAAAAAdtX0l0ZW0xB21fSXRlbTIHbV9JdGVtMwdtX0l0ZW00AAEAAAgPCQEAAAAGAgAAAAEyAwAAAAQAAAAAAAAACw==", "AAEAAAD/////AQAAAAAAAAAEAQAAAIEDU3lzdGVtLlR1cGxlYDRbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlN0cmluZywgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlVJbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLkludDY0LCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQQAAAAHbV9JdGVtMQdtX0l0ZW0yB21fSXRlbTMHbV9JdGVtNAABAAAIDwkBAAAABgIAAAABMgMAAAAEAAAAAAAAAAs=" } };
+ yield return new object[] { Tuple.Create(1, "2", 3u, 4L, 5.6), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAKQEU3lzdGVtLlR1cGxlYDVbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdLFtTeXN0ZW0uU3RyaW5nLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5VSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLkludDY0LCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5Eb3VibGUsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0FAAAAB21fSXRlbTEHbV9JdGVtMgdtX0l0ZW0zB21fSXRlbTQHbV9JdGVtNQABAAAACA8JBgEAAAAGAgAAAAEyAwAAAAQAAAAAAAAAZmZmZmZmFkAL", "AAEAAAD/////AQAAAAAAAAAEAQAAAN4DU3lzdGVtLlR1cGxlYDVbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlN0cmluZywgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlVJbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLkludDY0LCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldLFtTeXN0ZW0uRG91YmxlLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQUAAAAHbV9JdGVtMQdtX0l0ZW0yB21fSXRlbTMHbV9JdGVtNAdtX0l0ZW01AAEAAAAIDwkGAQAAAAYCAAAAATIDAAAABAAAAAAAAABmZmZmZmYWQAs=" } };
+ yield return new object[] { Tuple.Create(1, "2", 3u, 4L, 5.6, 7.8f), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAI8FU3lzdGVtLlR1cGxlYDZbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdLFtTeXN0ZW0uU3RyaW5nLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5VSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLkludDY0LCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5Eb3VibGUsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLlNpbmdsZSwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQYAAAAHbV9JdGVtMQdtX0l0ZW0yB21fSXRlbTMHbV9JdGVtNAdtX0l0ZW01B21fSXRlbTYAAQAAAAAIDwkGCwEAAAAGAgAAAAEyAwAAAAQAAAAAAAAAZmZmZmZmFkCamflACw==", "AAEAAAD/////AQAAAAAAAAAEAQAAALsEU3lzdGVtLlR1cGxlYDZbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlN0cmluZywgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlVJbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLkludDY0LCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldLFtTeXN0ZW0uRG91YmxlLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldLFtTeXN0ZW0uU2luZ2xlLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQYAAAAHbV9JdGVtMQdtX0l0ZW0yB21fSXRlbTMHbV9JdGVtNAdtX0l0ZW01B21fSXRlbTYAAQAAAAAIDwkGCwEAAAAGAgAAAAEyAwAAAAQAAAAAAAAAZmZmZmZmFkCamflACw==" } };
+ yield return new object[] { Tuple.Create(1, "2", 3u, 4L, 5.6, 7.8f, 9m), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAPsFU3lzdGVtLlR1cGxlYDdbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdLFtTeXN0ZW0uU3RyaW5nLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5VSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLkludDY0LCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5Eb3VibGUsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLlNpbmdsZSwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdLFtTeXN0ZW0uRGVjaW1hbCwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQcAAAAHbV9JdGVtMQdtX0l0ZW0yB21fSXRlbTMHbV9JdGVtNAdtX0l0ZW01B21fSXRlbTYHbV9JdGVtNwABAAAAAAAIDwkGCwUBAAAABgIAAAABMgMAAAAEAAAAAAAAAGZmZmZmZhZAmpn5QAE5Cw==", "AAEAAAD/////AQAAAAAAAAAEAQAAAJkFU3lzdGVtLlR1cGxlYDdbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlN0cmluZywgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlVJbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLkludDY0LCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldLFtTeXN0ZW0uRG91YmxlLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldLFtTeXN0ZW0uU2luZ2xlLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldLFtTeXN0ZW0uRGVjaW1hbCwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0HAAAAB21fSXRlbTEHbV9JdGVtMgdtX0l0ZW0zB21fSXRlbTQHbV9JdGVtNQdtX0l0ZW02B21fSXRlbTcAAQAAAAAACA8JBgsFAQAAAAYCAAAAATIDAAAABAAAAAAAAABmZmZmZmYWQJqZ+UABOQs=" } };
+ yield return new object[] { Tuple.Create(1, "2", 3u, 4L, 5.6, 7.8f, 9m, Tuple.Create(10)), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAL8IU3lzdGVtLlR1cGxlYDhbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdLFtTeXN0ZW0uU3RyaW5nLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5VSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLkludDY0LCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5Eb3VibGUsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLlNpbmdsZSwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdLFtTeXN0ZW0uRGVjaW1hbCwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdLFtTeXN0ZW0uVHVwbGVgMVtbU3lzdGVtLlR1cGxlYDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXSwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXSwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQgAAAAHbV9JdGVtMQdtX0l0ZW0yB21fSXRlbTMHbV9JdGVtNAdtX0l0ZW01B21fSXRlbTYHbV9JdGVtNwZtX1Jlc3QAAQAAAAAAAwgPCQYLBeYBU3lzdGVtLlR1cGxlYDFbW1N5c3RlbS5UdXBsZWAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0sIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0BAAAABgIAAAABMgMAAAAEAAAAAAAAAGZmZmZmZhZAmpn5QAE5CQMAAAAEAwAAAOYBU3lzdGVtLlR1cGxlYDFbW1N5c3RlbS5UdXBsZWAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0sIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0BAAAAB21fSXRlbTEDeVN5c3RlbS5UdXBsZWAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0JBAAAAAQEAAAAeVN5c3RlbS5UdXBsZWAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0BAAAAB21fSXRlbTEACAoAAAAL", "AAEAAAD/////AQAAAAAAAAAEAQAAALMHU3lzdGVtLlR1cGxlYDhbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlN0cmluZywgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlVJbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLkludDY0LCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldLFtTeXN0ZW0uRG91YmxlLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldLFtTeXN0ZW0uU2luZ2xlLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldLFtTeXN0ZW0uRGVjaW1hbCwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlR1cGxlYDFbW1N5c3RlbS5UdXBsZWAxW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXSwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0IAAAAB21fSXRlbTEHbV9JdGVtMgdtX0l0ZW0zB21fSXRlbTQHbV9JdGVtNQdtX0l0ZW02B21fSXRlbTcGbV9SZXN0AAEAAAAAAAMIDwkGCwXKAVN5c3RlbS5UdXBsZWAxW1tTeXN0ZW0uVHVwbGVgMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXSwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0BAAAABgIAAAABMgMAAAAEAAAAAAAAAGZmZmZmZhZAmpn5QAE5CQMAAAAEAwAAAMoBU3lzdGVtLlR1cGxlYDFbW1N5c3RlbS5UdXBsZWAxW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQEAAAAHbV9JdGVtMQNrU3lzdGVtLlR1cGxlYDFbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0JBAAAAAQEAAAAa1N5c3RlbS5UdXBsZWAxW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dAQAAAAdtX0l0ZW0xAAgKAAAACw==" } };
+ yield return new object[] { new KeyValuePair<int, byte>(42, 84), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAP0BU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuS2V5VmFsdWVQYWlyYDJbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdLFtTeXN0ZW0uQnl0ZSwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQIAAAADa2V5BXZhbHVlAAAIAioAAABUCw==", "AAEAAAD/////AQAAAAAAAAAEAQAAAOEBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuS2V5VmFsdWVQYWlyYDJbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLkJ5dGUsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dAgAAAANrZXkFdmFsdWUAAAgCKgAAAFQL" } };
+ var dotnetUri = new Uri("https://dot.net");
+ yield return new object[] { dotnetUri, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uUHJpdmF0ZS5VcmksIFZlcnNpb249NC4wLjUuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAAAKU3lzdGVtLlVyaQEAAAALQWJzb2x1dGVVcmkBAgAAAAYDAAAAEGh0dHBzOi8vZG90Lm5ldC8L", "AAEAAAD/////AQAAAAAAAAAMAgAAAElTeXN0ZW0sIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAKU3lzdGVtLlVyaQEAAAALQWJzb2x1dGVVcmkBAgAAAAYDAAAAEGh0dHBzOi8vZG90Lm5ldC8L" } };
+ yield return new object[] { new Uri(dotnetUri, "articles/info.html"), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uUHJpdmF0ZS5VcmksIFZlcnNpb249NC4wLjUuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAAAKU3lzdGVtLlVyaQEAAAALQWJzb2x1dGVVcmkBAgAAAAYDAAAAImh0dHBzOi8vZG90Lm5ldC9hcnRpY2xlcy9pbmZvLmh0bWwL", "AAEAAAD/////AQAAAAAAAAAMAgAAAElTeXN0ZW0sIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAKU3lzdGVtLlVyaQEAAAALQWJzb2x1dGVVcmkBAgAAAAYDAAAAImh0dHBzOi8vZG90Lm5ldC9hcnRpY2xlcy9pbmZvLmh0bWwL" } };
+ yield return new object[] { new WeakReference(dotnetUri, false), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uUHJpdmF0ZS5VcmksIFZlcnNpb249NC4wLjUuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBAEAAAAUU3lzdGVtLldlYWtSZWZlcmVuY2UCAAAADVRyYWNrZWRPYmplY3QRVHJhY2tSZXN1cnJlY3Rpb24EAApTeXN0ZW0uVXJpAgAAAAEJAwAAAAAFAwAAAApTeXN0ZW0uVXJpAQAAAAtBYnNvbHV0ZVVyaQECAAAABgQAAAAQaHR0cHM6Ly9kb3QubmV0Lws=", "AAEAAAD/////AQAAAAAAAAAMAgAAAElTeXN0ZW0sIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BAEAAAAUU3lzdGVtLldlYWtSZWZlcmVuY2UCAAAADVRyYWNrZWRPYmplY3QRVHJhY2tSZXN1cnJlY3Rpb24EAApTeXN0ZW0uVXJpAgAAAAEJAwAAAAAFAwAAAApTeXN0ZW0uVXJpAQAAAAtBYnNvbHV0ZVVyaQECAAAABgQAAAAQaHR0cHM6Ly9kb3QubmV0Lws=" } };
+ var trackingPoint = new Point(2, 3);
+ yield return new object[] { new WeakReference<Point>(trackingPoint, false), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBAEAAAC/AVN5c3RlbS5XZWFrUmVmZXJlbmNlYDFbW1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludCwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dAgAAAA1UcmFja2VkT2JqZWN0EVRyYWNrUmVzdXJyZWN0aW9uBAAzU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50AgAAAAEJAwAAAAAFAwAAADNTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQCAAAAAVgBWQAACAgCAAAAAgAAAAMAAAAL", "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBAEAAAC/AVN5c3RlbS5XZWFrUmVmZXJlbmNlYDFbW1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludCwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dAgAAAA1UcmFja2VkT2JqZWN0EVRyYWNrUmVzdXJyZWN0aW9uBAAzU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50AgAAAAEJAwAAAAAFAwAAADNTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQCAAAAAVgBWQAACAgCAAAAAgAAAAMAAAAL" } };
+ yield return new object[] { new StringBuilder(), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAABlTeXN0ZW0uVGV4dC5TdHJpbmdCdWlsZGVyBAAAAA1tX01heENhcGFjaXR5CENhcGFjaXR5DW1fU3RyaW5nVmFsdWUPbV9jdXJyZW50VGhyZWFkAAABAAgICP///38QAAAABgIAAAAAAAAAAAs=", "AAEAAAD/////AQAAAAAAAAAEAQAAABlTeXN0ZW0uVGV4dC5TdHJpbmdCdWlsZGVyBAAAAA1tX01heENhcGFjaXR5CENhcGFjaXR5DW1fU3RyaW5nVmFsdWUPbV9jdXJyZW50VGhyZWFkAAABAAgICP///38QAAAABgIAAAAAAAAAAAs=" } };
+ yield return new object[] { new StringBuilder("starting", 0, 5, 10), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAABlTeXN0ZW0uVGV4dC5TdHJpbmdCdWlsZGVyBAAAAA1tX01heENhcGFjaXR5CENhcGFjaXR5DW1fU3RyaW5nVmFsdWUPbV9jdXJyZW50VGhyZWFkAAABAAgICP///38KAAAABgIAAAAFc3RhcnQAAAAACw==", "AAEAAAD/////AQAAAAAAAAAEAQAAABlTeXN0ZW0uVGV4dC5TdHJpbmdCdWlsZGVyBAAAAA1tX01heENhcGFjaXR5CENhcGFjaXR5DW1fU3RyaW5nVmFsdWUPbV9jdXJyZW50VGhyZWFkAAABAAgICP///38KAAAABgIAAAAFc3RhcnQAAAAACw==" } };
+ var cookie = new Cookie("host", "edge", "auth", "dot.net");
+ yield return new object[] { cookie, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFhTeXN0ZW0uTmV0LlByaW1pdGl2ZXMsIFZlcnNpb249NC4xLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhDAMAAABVU3lzdGVtLlByaXZhdGUuVXJpLCBWZXJzaW9uPTQuMC41LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49YjAzZjVmN2YxMWQ1MGEzYQUBAAAAEVN5c3RlbS5OZXQuQ29va2llFQAAAAltX2NvbW1lbnQMbV9jb21tZW50VXJpD21fY29va2llVmFyaWFudAltX2Rpc2NhcmQIbV9kb21haW4QbV9kb21haW5JbXBsaWNpdAltX2V4cGlyZXMGbV9uYW1lBm1fcGF0aA5tX3BhdGhJbXBsaWNpdAZtX3BvcnQObV9wb3J0SW1wbGljaXQKbV9wb3J0TGlzdAhtX3NlY3VyZQptX2h0dHBPbmx5C21fdGltZVN0YW1wB21fdmFsdWUJbV92ZXJzaW9uC21fZG9tYWluS2V5D0lzUXVvdGVkVmVyc2lvbg5Jc1F1b3RlZERvbWFpbgEEBAABAAABAQABAAcAAAABAAEAAApTeXN0ZW0uVXJpAwAAABhTeXN0ZW0uTmV0LkNvb2tpZVZhcmlhbnQCAAAAAQENAQEIAQENCAEBAgAAAAYEAAAAAAoF+////xhTeXN0ZW0uTmV0LkNvb2tpZVZhcmlhbnQBAAAAB3ZhbHVlX18ACAIAAAABAAAAAAYGAAAAB2RvdC5uZXQAAAAAAAAAAAAGBwAAAARob3N0BggAAAAEYXV0aAAJBAAAAAEKAABfHM/eP6jUCAYKAAAABGVkZ2UAAAAACQQAAAAAAAs=", "AAEAAAD/////AQAAAAAAAAAMAgAAAElTeXN0ZW0sIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAARU3lzdGVtLk5ldC5Db29raWUVAAAACW1fY29tbWVudAxtX2NvbW1lbnRVcmkPbV9jb29raWVWYXJpYW50CW1fZGlzY2FyZAhtX2RvbWFpbhFtX2RvbWFpbl9pbXBsaWNpdAltX2V4cGlyZXMGbV9uYW1lBm1fcGF0aA9tX3BhdGhfaW1wbGljaXQGbV9wb3J0D21fcG9ydF9pbXBsaWNpdAttX3BvcnRfbGlzdAhtX3NlY3VyZQptX2h0dHBPbmx5C21fdGltZVN0YW1wB21fdmFsdWUJbV92ZXJzaW9uC21fZG9tYWluS2V5D0lzUXVvdGVkVmVyc2lvbg5Jc1F1b3RlZERvbWFpbgEEBAABAAABAQABAAcAAAABAAEAAApTeXN0ZW0uVXJpAgAAABhTeXN0ZW0uTmV0LkNvb2tpZVZhcmlhbnQCAAAAAQENAQEIAQENCAEBAgAAAAYDAAAAAAoF/P///xhTeXN0ZW0uTmV0LkNvb2tpZVZhcmlhbnQBAAAAB3ZhbHVlX18ACAIAAAABAAAAAAYFAAAAB2RvdC5uZXQAAAAAAAAAAAAGBgAAAARob3N0BgcAAAAEYXV0aAAJAwAAAAEKAAAsrl5tgKfUiAYJAAAABGVkZ2UAAAAACQMAAAAAAAs=" } };
+ var cookieCollection = new CookieCollection();
+ cookieCollection.Add(cookie);
+ yield return new object[] { cookieCollection, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFhTeXN0ZW0uTmV0LlByaW1pdGl2ZXMsIFZlcnNpb249NC4xLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAAAbU3lzdGVtLk5ldC5Db29raWVDb2xsZWN0aW9uAwAAAAZtX2xpc3QLbV90aW1lU3RhbXAUbV9oYXNfb3RoZXJfdmVyc2lvbnMDAACQAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLk5ldC5Db29raWUsIFN5c3RlbS5OZXQuUHJpbWl0aXZlcywgVmVyc2lvbj00LjEuMS4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2FdXQ0BAgAAAAkDAAAAAAAAAAAAAAAABAMAAACQAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLk5ldC5Db29raWUsIFN5c3RlbS5OZXQuUHJpbWl0aXZlcywgVmVyc2lvbj00LjEuMS4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2FdXQMAAAAGX2l0ZW1zBV9zaXplCF92ZXJzaW9uBAAAE1N5c3RlbS5OZXQuQ29va2llW10CAAAACAgJBAAAAAEAAAABAAAABwQAAAAAAQAAAAQAAAAEEVN5c3RlbS5OZXQuQ29va2llAgAAAAkFAAAADQMMBgAAAFVTeXN0ZW0uUHJpdmF0ZS5VcmksIFZlcnNpb249NC4wLjUuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQUAAAARU3lzdGVtLk5ldC5Db29raWUVAAAACW1fY29tbWVudAxtX2NvbW1lbnRVcmkPbV9jb29raWVWYXJpYW50CW1fZGlzY2FyZAhtX2RvbWFpbhBtX2RvbWFpbkltcGxpY2l0CW1fZXhwaXJlcwZtX25hbWUGbV9wYXRoDm1fcGF0aEltcGxpY2l0Bm1fcG9ydA5tX3BvcnRJbXBsaWNpdAptX3BvcnRMaXN0CG1fc2VjdXJlCm1faHR0cE9ubHkLbV90aW1lU3RhbXAHbV92YWx1ZQltX3ZlcnNpb24LbV9kb21haW5LZXkPSXNRdW90ZWRWZXJzaW9uDklzUXVvdGVkRG9tYWluAQQEAAEAAAEBAAEABwAAAAEAAQAAClN5c3RlbS5VcmkGAAAAGFN5c3RlbS5OZXQuQ29va2llVmFyaWFudAIAAAABAQ0BAQgBAQ0IAQECAAAABgcAAAAACgX4////GFN5c3RlbS5OZXQuQ29va2llVmFyaWFudAEAAAAHdmFsdWVfXwAIAgAAAAEAAAAABgkAAAAHZG90Lm5ldAAAAAAAAAAAAAYKAAAABGhvc3QGCwAAAARhdXRoAAkHAAAAAQoAAF8cz94/qNQIBg0AAAAEZWRnZQAAAAAJBwAAAAAACw==", "AAEAAAD/////AQAAAAAAAAAMAgAAAElTeXN0ZW0sIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAbU3lzdGVtLk5ldC5Db29raWVDb2xsZWN0aW9uBQAAAAltX3ZlcnNpb24GbV9saXN0C21fVGltZVN0YW1wFG1faGFzX290aGVyX3ZlcnNpb25zDG1fSXNSZWFkT25seQADAAAACBxTeXN0ZW0uQ29sbGVjdGlvbnMuQXJyYXlMaXN0DQEBAgAAAAEAAAAJAwAAAAAAAAAAAAAAAAEEAwAAABxTeXN0ZW0uQ29sbGVjdGlvbnMuQXJyYXlMaXN0AwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24FAAAICAkEAAAAAQAAAAEAAAAQBAAAAAQAAAAJBQAAAA0DBQUAAAARU3lzdGVtLk5ldC5Db29raWUVAAAACW1fY29tbWVudAxtX2NvbW1lbnRVcmkPbV9jb29raWVWYXJpYW50CW1fZGlzY2FyZAhtX2RvbWFpbhFtX2RvbWFpbl9pbXBsaWNpdAltX2V4cGlyZXMGbV9uYW1lBm1fcGF0aA9tX3BhdGhfaW1wbGljaXQGbV9wb3J0D21fcG9ydF9pbXBsaWNpdAttX3BvcnRfbGlzdAhtX3NlY3VyZQptX2h0dHBPbmx5C21fdGltZVN0YW1wB21fdmFsdWUJbV92ZXJzaW9uC21fZG9tYWluS2V5D0lzUXVvdGVkVmVyc2lvbg5Jc1F1b3RlZERvbWFpbgEEBAABAAABAQABAAcAAAABAAEAAApTeXN0ZW0uVXJpAgAAABhTeXN0ZW0uTmV0LkNvb2tpZVZhcmlhbnQCAAAAAQENAQEIAQENCAEBAgAAAAYGAAAAAAoF+f///xhTeXN0ZW0uTmV0LkNvb2tpZVZhcmlhbnQBAAAAB3ZhbHVlX18ACAIAAAABAAAAAAYIAAAAB2RvdC5uZXQAAAAAAAAAAAAGCQAAAARob3N0BgoAAAAEYXV0aAAJBgAAAAEKAAAsrl5tgKfUiAYMAAAABGVkZ2UAAAAACQYAAAAAAAs=" } };
+ var cookieContainer = new CookieContainer(10, 5, 1024);
+ cookieCollection.Add(cookie);
+ yield return new object[] { cookieContainer, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFhTeXN0ZW0uTmV0LlByaW1pdGl2ZXMsIFZlcnNpb249NC4xLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAAAaU3lzdGVtLk5ldC5Db29raWVDb250YWluZXIGAAAADW1fZG9tYWluVGFibGUPbV9tYXhDb29raWVTaXplDG1fbWF4Q29va2llcxVtX21heENvb2tpZXNQZXJEb21haW4HbV9jb3VudA5tX2ZxZG5NeURvbWFpbgMAAAAAAYMCU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuRGljdGlvbmFyeWAyW1tTeXN0ZW0uU3RyaW5nLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5OZXQuUGF0aExpc3QsIFN5c3RlbS5OZXQuUHJpbWl0aXZlcywgVmVyc2lvbj00LjEuMS4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2FdXQgICAgCAAAACQMAAAAABAAACgAAAAUAAAAAAAAABgQAAAAbLnJlZG1vbmQuY29ycC5taWNyb3NvZnQuY29tBAMAAACDAlN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkRpY3Rpb25hcnlgMltbU3lzdGVtLlN0cmluZywgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdLFtTeXN0ZW0uTmV0LlBhdGhMaXN0LCBTeXN0ZW0uTmV0LlByaW1pdGl2ZXMsIFZlcnNpb249NC4xLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhXV0DAAAAB1ZlcnNpb24IQ29tcGFyZXIISGFzaFNpemUAAwAIPlN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLk5vblJhbmRvbWl6ZWRTdHJpbmdFcXVhbGl0eUNvbXBhcmVyCAAAAAAJBQAAAAAAAAAEBQAAAD5TeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5Ob25SYW5kb21pemVkU3RyaW5nRXF1YWxpdHlDb21wYXJlcgAAAAAL", "AAEAAAD/////AQAAAAAAAAAMAgAAAElTeXN0ZW0sIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAaU3lzdGVtLk5ldC5Db29raWVDb250YWluZXIGAAAADW1fZG9tYWluVGFibGUPbV9tYXhDb29raWVTaXplDG1fbWF4Q29va2llcxVtX21heENvb2tpZXNQZXJEb21haW4HbV9jb3VudA5tX2ZxZG5NeURvbWFpbgMAAAAAARxTeXN0ZW0uQ29sbGVjdGlvbnMuSGFzaHRhYmxlCAgICAIAAAAJAwAAAAAEAAAKAAAABQAAAAAAAAAGBAAAABsucmVkbW9uZC5jb3JwLm1pY3Jvc29mdC5jb20EAwAAABxTeXN0ZW0uQ29sbGVjdGlvbnMuSGFzaHRhYmxlBwAAAApMb2FkRmFjdG9yB1ZlcnNpb24IQ29tcGFyZXIQSGFzaENvZGVQcm92aWRlcghIYXNoU2l6ZQRLZXlzBlZhbHVlcwAAAwMABQULCBxTeXN0ZW0uQ29sbGVjdGlvbnMuSUNvbXBhcmVyJFN5c3RlbS5Db2xsZWN0aW9ucy5JSGFzaENvZGVQcm92aWRlcgjsUTg/AAAAAAoKAwAAAAkFAAAACQYAAAAQBQAAAAAAAAAQBgAAAAAAAAAL" } };
+ yield return new object[] { new DataSet("Dataset") { Locale = CultureInfo.InvariantCulture }, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uRGF0YS5Db21tb24sIFZlcnNpb249NC4yLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAAATU3lzdGVtLkRhdGEuRGF0YVNldAMAAAAXRGF0YVNldC5SZW1vdGluZ1ZlcnNpb24JWG1sU2NoZW1hC1htbERpZmZHcmFtAwEBDlN5c3RlbS5WZXJzaW9uAgAAAAkDAAAABgQAAAD3Ajw/eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9InV0Zi0xNiI/Pg0KPHhzOnNjaGVtYSBpZD0iRGF0YXNldCIgeG1sbnM9IiIgeG1sbnM6eHM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hIiB4bWxuczptc2RhdGE9InVybjpzY2hlbWFzLW1pY3Jvc29mdC1jb206eG1sLW1zZGF0YSI+DQogIDx4czplbGVtZW50IG5hbWU9IkRhdGFzZXQiIG1zZGF0YTpJc0RhdGFTZXQ9InRydWUiIG1zZGF0YTpMb2NhbGU9IiI+DQogICAgPHhzOmNvbXBsZXhUeXBlPg0KICAgICAgPHhzOmNob2ljZSBtaW5PY2N1cnM9IjAiIG1heE9jY3Vycz0idW5ib3VuZGVkIiAvPg0KICAgIDwveHM6Y29tcGxleFR5cGU+DQogIDwveHM6ZWxlbWVudD4NCjwveHM6c2NoZW1hPgYFAAAAgAE8ZGlmZmdyOmRpZmZncmFtIHhtbG5zOm1zZGF0YT0idXJuOnNjaGVtYXMtbWljcm9zb2Z0LWNvbTp4bWwtbXNkYXRhIiB4bWxuczpkaWZmZ3I9InVybjpzY2hlbWFzLW1pY3Jvc29mdC1jb206eG1sLWRpZmZncmFtLXYxIiAvPgQDAAAADlN5c3RlbS5WZXJzaW9uBAAAAAZfTWFqb3IGX01pbm9yBl9CdWlsZAlfUmV2aXNpb24AAAAACAgICAIAAAAAAAAA//////////8L", "AAEAAAD/////AQAAAAAAAAAMAgAAAE5TeXN0ZW0uRGF0YSwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAABNTeXN0ZW0uRGF0YS5EYXRhU2V0AwAAABdEYXRhU2V0LlJlbW90aW5nVmVyc2lvbglYbWxTY2hlbWELWG1sRGlmZkdyYW0DAQEOU3lzdGVtLlZlcnNpb24CAAAACQMAAAAGBAAAAIUDPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTE2Ij8+DQo8eHM6c2NoZW1hIGlkPSJEYXRhc2V0IiB4bWxucz0iIiB4bWxuczp4cz0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zOm1zZGF0YT0idXJuOnNjaGVtYXMtbWljcm9zb2Z0LWNvbTp4bWwtbXNkYXRhIj4NCiAgPHhzOmVsZW1lbnQgbmFtZT0iRGF0YXNldCIgbXNkYXRhOklzRGF0YVNldD0idHJ1ZSIgbXNkYXRhOlVzZUN1cnJlbnRMb2NhbGU9InRydWUiPg0KICAgIDx4czpjb21wbGV4VHlwZT4NCiAgICAgIDx4czpjaG9pY2UgbWluT2NjdXJzPSIwIiBtYXhPY2N1cnM9InVuYm91bmRlZCIgLz4NCiAgICA8L3hzOmNvbXBsZXhUeXBlPg0KICA8L3hzOmVsZW1lbnQ+DQo8L3hzOnNjaGVtYT4GBQAAAIABPGRpZmZncjpkaWZmZ3JhbSB4bWxuczptc2RhdGE9InVybjpzY2hlbWFzLW1pY3Jvc29mdC1jb206eG1sLW1zZGF0YSIgeG1sbnM6ZGlmZmdyPSJ1cm46c2NoZW1hcy1taWNyb3NvZnQtY29tOnhtbC1kaWZmZ3JhbS12MSIgLz4EAwAAAA5TeXN0ZW0uVmVyc2lvbgQAAAAGX01ham9yBl9NaW5vcgZfQnVpbGQJX1JldmlzaW9uAAAAAAgICAgCAAAAAAAAAP//////////Cw==" } };
+ yield return new object[] { new DataTable("Datatable", "corens") { Locale = CultureInfo.InvariantCulture }, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uRGF0YS5Db21tb24sIFZlcnNpb249NC4yLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAAAVU3lzdGVtLkRhdGEuRGF0YVRhYmxlAwAAABlEYXRhVGFibGUuUmVtb3RpbmdWZXJzaW9uCVhtbFNjaGVtYQtYbWxEaWZmR3JhbQMBAQ5TeXN0ZW0uVmVyc2lvbgIAAAAJAwAAAAYEAAAA/wQ8P3htbCB2ZXJzaW9uPSIxLjAiIGVuY29kaW5nPSJ1dGYtMTYiPz4NCjx4czpzY2hlbWEgdGFyZ2V0TmFtZXNwYWNlPSJjb3JlbnMiIHhtbG5zOm1zdG5zPSJjb3JlbnMiIHhtbG5zPSJjb3JlbnMiIHhtbG5zOnhzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYSIgeG1sbnM6bXNkYXRhPSJ1cm46c2NoZW1hcy1taWNyb3NvZnQtY29tOnhtbC1tc2RhdGEiIGF0dHJpYnV0ZUZvcm1EZWZhdWx0PSJxdWFsaWZpZWQiIGVsZW1lbnRGb3JtRGVmYXVsdD0icXVhbGlmaWVkIj4NCiAgPHhzOmVsZW1lbnQgbmFtZT0iRGF0YXRhYmxlIiBtc2RhdGE6TG9jYWxlPSIiPg0KICAgIDx4czpjb21wbGV4VHlwZT4NCiAgICA8L3hzOmNvbXBsZXhUeXBlPg0KICA8L3hzOmVsZW1lbnQ+DQogIDx4czplbGVtZW50IG5hbWU9InRtcERhdGFTZXQiIG1zZGF0YTpJc0RhdGFTZXQ9InRydWUiIG1zZGF0YTpNYWluRGF0YVRhYmxlPSJjb3JlbnNfeDAwM0FfRGF0YXRhYmxlIiBtc2RhdGE6TG9jYWxlPSIiPg0KICAgIDx4czpjb21wbGV4VHlwZT4NCiAgICAgIDx4czpjaG9pY2UgbWluT2NjdXJzPSIwIiBtYXhPY2N1cnM9InVuYm91bmRlZCIgLz4NCiAgICA8L3hzOmNvbXBsZXhUeXBlPg0KICA8L3hzOmVsZW1lbnQ+DQo8L3hzOnNjaGVtYT4GBQAAAIABPGRpZmZncjpkaWZmZ3JhbSB4bWxuczptc2RhdGE9InVybjpzY2hlbWFzLW1pY3Jvc29mdC1jb206eG1sLW1zZGF0YSIgeG1sbnM6ZGlmZmdyPSJ1cm46c2NoZW1hcy1taWNyb3NvZnQtY29tOnhtbC1kaWZmZ3JhbS12MSIgLz4EAwAAAA5TeXN0ZW0uVmVyc2lvbgQAAAAGX01ham9yBl9NaW5vcgZfQnVpbGQJX1JldmlzaW9uAAAAAAgICAgCAAAAAAAAAP//////////Cw==", "AAEAAAD/////AQAAAAAAAAAMAgAAAE5TeXN0ZW0uRGF0YSwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAABVTeXN0ZW0uRGF0YS5EYXRhVGFibGUDAAAAGURhdGFUYWJsZS5SZW1vdGluZ1ZlcnNpb24JWG1sU2NoZW1hC1htbERpZmZHcmFtAwEBDlN5c3RlbS5WZXJzaW9uAgAAAAkDAAAABgQAAAD8BDw/eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9InV0Zi0xNiI/Pg0KPHhzOnNjaGVtYSB0YXJnZXROYW1lc3BhY2U9ImNvcmVucyIgeG1sbnM6bXN0bnM9ImNvcmVucyIgeG1sbnM9ImNvcmVucyIgeG1sbnM6eHM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hIiB4bWxuczptc2RhdGE9InVybjpzY2hlbWFzLW1pY3Jvc29mdC1jb206eG1sLW1zZGF0YSIgYXR0cmlidXRlRm9ybURlZmF1bHQ9InF1YWxpZmllZCIgZWxlbWVudEZvcm1EZWZhdWx0PSJxdWFsaWZpZWQiPg0KICA8eHM6ZWxlbWVudCBuYW1lPSJEYXRhdGFibGUiPg0KICAgIDx4czpjb21wbGV4VHlwZT4NCiAgICA8L3hzOmNvbXBsZXhUeXBlPg0KICA8L3hzOmVsZW1lbnQ+DQogIDx4czplbGVtZW50IG5hbWU9InRtcERhdGFTZXQiIG1zZGF0YTpJc0RhdGFTZXQ9InRydWUiIG1zZGF0YTpNYWluRGF0YVRhYmxlPSJjb3JlbnNfeDAwM0FfRGF0YXRhYmxlIiBtc2RhdGE6VXNlQ3VycmVudExvY2FsZT0idHJ1ZSI+DQogICAgPHhzOmNvbXBsZXhUeXBlPg0KICAgICAgPHhzOmNob2ljZSBtaW5PY2N1cnM9IjAiIG1heE9jY3Vycz0idW5ib3VuZGVkIiAvPg0KICAgIDwveHM6Y29tcGxleFR5cGU+DQogIDwveHM6ZWxlbWVudD4NCjwveHM6c2NoZW1hPgYFAAAAgAE8ZGlmZmdyOmRpZmZncmFtIHhtbG5zOm1zZGF0YT0idXJuOnNjaGVtYXMtbWljcm9zb2Z0LWNvbTp4bWwtbXNkYXRhIiB4bWxuczpkaWZmZ3I9InVybjpzY2hlbWFzLW1pY3Jvc29mdC1jb206eG1sLWRpZmZncmFtLXYxIiAvPgQDAAAADlN5c3RlbS5WZXJzaW9uBAAAAAZfTWFqb3IGX01pbm9yBl9CdWlsZAlfUmV2aXNpb24AAAAACAgICAIAAAAAAAAA//////////8L" } };
+ var propertyCollection = new PropertyCollection
+ {
+ { "p1", "v1" },
+ { "px", "vx" }
+ };
+ yield return new object[] { propertyCollection, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uRGF0YS5Db21tb24sIFZlcnNpb249NC4yLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhDAMAAABcU3lzdGVtLlJ1bnRpbWUuRXh0ZW5zaW9ucywgVmVyc2lvbj00LjIuMS4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAAB5TeXN0ZW0uRGF0YS5Qcm9wZXJ0eUNvbGxlY3Rpb24HAAAACkxvYWRGYWN0b3IHVmVyc2lvbghDb21wYXJlchBIYXNoQ29kZVByb3ZpZGVyCEhhc2hTaXplBEtleXMGVmFsdWVzAAADBAAFBQsIHFN5c3RlbS5Db2xsZWN0aW9ucy5JQ29tcGFyZXIkU3lzdGVtLkNvbGxlY3Rpb25zLklIYXNoQ29kZVByb3ZpZGVyAwAAAAgCAAAA7FE4PwIAAAAKCgMAAAAJBAAAAAkFAAAAEAQAAAACAAAABgYAAAACcHgGBwAAAAJwMRAFAAAAAgAAAAYIAAAAAnZ4BgkAAAACdjEL", "AAEAAAD/////AQAAAAAAAAAMAgAAAE5TeXN0ZW0uRGF0YSwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAAB5TeXN0ZW0uRGF0YS5Qcm9wZXJ0eUNvbGxlY3Rpb24HAAAACkxvYWRGYWN0b3IHVmVyc2lvbghDb21wYXJlchBIYXNoQ29kZVByb3ZpZGVyCEhhc2hTaXplBEtleXMGVmFsdWVzAAADAwAFBQsIHFN5c3RlbS5Db2xsZWN0aW9ucy5JQ29tcGFyZXIkU3lzdGVtLkNvbGxlY3Rpb25zLklIYXNoQ29kZVByb3ZpZGVyCAIAAADsUTg/AgAAAAoKAwAAAAkDAAAACQQAAAAQAwAAAAIAAAAGBQAAAAJweAYGAAAAAnAxEAQAAAACAAAABgcAAAACdngGCAAAAAJ2MQs=" } };
+ yield return new object[] { new SqlBoolean(true), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uRGF0YS5Db21tb24sIFZlcnNpb249NC4yLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAAAfU3lzdGVtLkRhdGEuU3FsVHlwZXMuU3FsQm9vbGVhbgEAAAAHbV92YWx1ZQACAgAAAAIL", "AAEAAAD/////AQAAAAAAAAAMAgAAAE5TeXN0ZW0uRGF0YSwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAAB9TeXN0ZW0uRGF0YS5TcWxUeXBlcy5TcWxCb29sZWFuAQAAAAdtX3ZhbHVlAAICAAAAAgs=" } };
+ yield return new object[] { new SqlByte(255), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uRGF0YS5Db21tb24sIFZlcnNpb249NC4yLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAAAcU3lzdGVtLkRhdGEuU3FsVHlwZXMuU3FsQnl0ZQIAAAAKbV9mTm90TnVsbAdtX3ZhbHVlAAABAgIAAAAB/ws=", "AAEAAAD/////AQAAAAAAAAAMAgAAAE5TeXN0ZW0uRGF0YSwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAABxTeXN0ZW0uRGF0YS5TcWxUeXBlcy5TcWxCeXRlAgAAAAptX2ZOb3ROdWxsB21fdmFsdWUAAAECAgAAAAH/Cw==" } };
+ yield return new object[] { new SqlDateTime(new DateTime(1990, 11, 23, 03, 30, 00, 00, DateTimeKind.Utc)), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uRGF0YS5Db21tb24sIFZlcnNpb249NC4yLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAAAgU3lzdGVtLkRhdGEuU3FsVHlwZXMuU3FsRGF0ZVRpbWUDAAAACm1fZk5vdE51bGwFbV9kYXkGbV90aW1lAAAAAQgIAgAAAAGugQAAoK05AAs=", "AAEAAAD/////AQAAAAAAAAAMAgAAAE5TeXN0ZW0uRGF0YSwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACBTeXN0ZW0uRGF0YS5TcWxUeXBlcy5TcWxEYXRlVGltZQMAAAAKbV9mTm90TnVsbAVtX2RheQZtX3RpbWUAAAABCAgCAAAAAa6BAACgrTkACw==" } };
+ yield return new object[] { new SqlDouble(34.5), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uRGF0YS5Db21tb24sIFZlcnNpb249NC4yLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAAAeU3lzdGVtLkRhdGEuU3FsVHlwZXMuU3FsRG91YmxlAgAAAAptX2ZOb3ROdWxsB21fdmFsdWUAAAEGAgAAAAEAAAAAAEBBQAs=", "AAEAAAD/////AQAAAAAAAAAMAgAAAE5TeXN0ZW0uRGF0YSwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAAB5TeXN0ZW0uRGF0YS5TcWxUeXBlcy5TcWxEb3VibGUCAAAACm1fZk5vdE51bGwHbV92YWx1ZQAAAQYCAAAAAQAAAAAAQEFACw==" } };
+ yield return new object[] { new SqlInt16(256), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uRGF0YS5Db21tb24sIFZlcnNpb249NC4yLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAAAdU3lzdGVtLkRhdGEuU3FsVHlwZXMuU3FsSW50MTYCAAAACm1fZk5vdE51bGwHbV92YWx1ZQAAAQcCAAAAAQABCw==", "AAEAAAD/////AQAAAAAAAAAMAgAAAE5TeXN0ZW0uRGF0YSwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAAB1TeXN0ZW0uRGF0YS5TcWxUeXBlcy5TcWxJbnQxNgIAAAAKbV9mTm90TnVsbAdtX3ZhbHVlAAABBwIAAAABAAEL" } };
+ yield return new object[] { new SqlInt32(4096314), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uRGF0YS5Db21tb24sIFZlcnNpb249NC4yLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAAAdU3lzdGVtLkRhdGEuU3FsVHlwZXMuU3FsSW50MzICAAAACm1fZk5vdE51bGwHbV92YWx1ZQAAAQgCAAAAATqBPgAL", "AAEAAAD/////AQAAAAAAAAAMAgAAAE5TeXN0ZW0uRGF0YSwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAAB1TeXN0ZW0uRGF0YS5TcWxUeXBlcy5TcWxJbnQzMgIAAAAKbV9mTm90TnVsbAdtX3ZhbHVlAAABCAIAAAABOoE+AAs=" } };
+ yield return new object[] { new SqlInt64(3492867384596), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uRGF0YS5Db21tb24sIFZlcnNpb249NC4yLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAAAdU3lzdGVtLkRhdGEuU3FsVHlwZXMuU3FsSW50NjQCAAAACm1fZk5vdE51bGwHbV92YWx1ZQAAAQkCAAAAARSlHj8tAwAACw==", "AAEAAAD/////AQAAAAAAAAAMAgAAAE5TeXN0ZW0uRGF0YSwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAAB1TeXN0ZW0uRGF0YS5TcWxUeXBlcy5TcWxJbnQ2NAIAAAAKbV9mTm90TnVsbAdtX3ZhbHVlAAABCQIAAAABFKUePy0DAAAL" } };
+ yield return new object[] { new SqlString("abc", CultureInfo.InvariantCulture.LCID, SqlCompareOptions.BinarySort), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uRGF0YS5Db21tb24sIFZlcnNpb249NC4yLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAAAeU3lzdGVtLkRhdGEuU3FsVHlwZXMuU3FsU3RyaW5nBQAAAAdtX3ZhbHVlCW1fY21wSW5mbwZtX2xjaWQGbV9mbGFnCm1fZk5vdE51bGwBAwAEACBTeXN0ZW0uR2xvYmFsaXphdGlvbi5Db21wYXJlSW5mbwgmU3lzdGVtLkRhdGEuU3FsVHlwZXMuU3FsQ29tcGFyZU9wdGlvbnMCAAAAAQIAAAAGAwAAAANhYmMKfwAAAAX8////JlN5c3RlbS5EYXRhLlNxbFR5cGVzLlNxbENvbXBhcmVPcHRpb25zAQAAAAd2YWx1ZV9fAAgCAAAAAIAAAAEL", "AAEAAAD/////AQAAAAAAAAAMAgAAAE5TeXN0ZW0uRGF0YSwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAAB5TeXN0ZW0uRGF0YS5TcWxUeXBlcy5TcWxTdHJpbmcFAAAAB21fdmFsdWUJbV9jbXBJbmZvBm1fbGNpZAZtX2ZsYWcKbV9mTm90TnVsbAEDAAQAIFN5c3RlbS5HbG9iYWxpemF0aW9uLkNvbXBhcmVJbmZvCCZTeXN0ZW0uRGF0YS5TcWxUeXBlcy5TcWxDb21wYXJlT3B0aW9ucwIAAAABAgAAAAYDAAAAA2FiYwoJBAAABfz///8mU3lzdGVtLkRhdGEuU3FsVHlwZXMuU3FsQ29tcGFyZU9wdGlvbnMBAAAAB3ZhbHVlX18ACAIAAAAAgAAAAQs=" } };
+
+ yield return new object[] { new BigInteger(), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFpTeXN0ZW0uUnVudGltZS5OdW1lcmljcywgVmVyc2lvbj00LjEuMS4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABpTeXN0ZW0uTnVtZXJpY3MuQmlnSW50ZWdlcgIAAAAFX3NpZ24FX2JpdHMABwgPAgAAAAAAAAAKCw==", "AAEAAAD/////AQAAAAAAAAAMAgAAAFJTeXN0ZW0uTnVtZXJpY3MsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAaU3lzdGVtLk51bWVyaWNzLkJpZ0ludGVnZXICAAAABV9zaWduBV9iaXRzAAcIDwIAAAAAAAAACgs=" } };
+ yield return new object[] { new BigInteger(10324176), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFpTeXN0ZW0uUnVudGltZS5OdW1lcmljcywgVmVyc2lvbj00LjEuMS4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABpTeXN0ZW0uTnVtZXJpY3MuQmlnSW50ZWdlcgIAAAAFX3NpZ24FX2JpdHMABwgPAgAAANCInQAKCw==", "AAEAAAD/////AQAAAAAAAAAMAgAAAFJTeXN0ZW0uTnVtZXJpY3MsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAaU3lzdGVtLk51bWVyaWNzLkJpZ0ludGVnZXICAAAABV9zaWduBV9iaXRzAAcIDwIAAADQiJ0ACgs=" } };
+ yield return new object[] { new Complex(12, 6), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFpTeXN0ZW0uUnVudGltZS5OdW1lcmljcywgVmVyc2lvbj00LjEuMS4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABdTeXN0ZW0uTnVtZXJpY3MuQ29tcGxleAIAAAAGbV9yZWFsC21faW1hZ2luYXJ5AAAGBgIAAAAAAAAAAAAoQAAAAAAAABhACw==", "AAEAAAD/////AQAAAAAAAAAMAgAAAFJTeXN0ZW0uTnVtZXJpY3MsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAXU3lzdGVtLk51bWVyaWNzLkNvbXBsZXgCAAAABm1fcmVhbAttX2ltYWdpbmFyeQAABgYCAAAAAAAAAAAAKEAAAAAAAAAYQAs=" } };
+
+ // Arrays of primitive types
+ yield return new object[] { Enumerable.Range(0, 256).Select(i => (byte)i).ToArray(), new string[] { "AAEAAAD/////AQAAAAAAAAAPAQAAAAABAAACAAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/ws=", "AAEAAAD/////AQAAAAAAAAAPAQAAAAABAAACAAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/ws=" } };
+ yield return new object[] { new int[] { }, new string[] { "AAEAAAD/////AQAAAAAAAAAPAQAAAAAAAAAICw==", "AAEAAAD/////AQAAAAAAAAAPAQAAAAAAAAAICw==" } };
+ yield return new object[] { new int[] { 1 }, new string[] { "AAEAAAD/////AQAAAAAAAAAPAQAAAAEAAAAIAQAAAAs=", "AAEAAAD/////AQAAAAAAAAAPAQAAAAEAAAAIAQAAAAs=" } };
+ yield return new object[] { new int[] { 1, 2, 3, 4, 5 }, new string[] { "AAEAAAD/////AQAAAAAAAAAPAQAAAAUAAAAIAQAAAAIAAAADAAAABAAAAAUAAAAL", "AAEAAAD/////AQAAAAAAAAAPAQAAAAUAAAAIAQAAAAIAAAADAAAABAAAAAUAAAAL" } };
+ yield return new object[] { new char[] { 'a', 'b', 'c', 'd', 'e' }, new string[] { "AAEAAAD/////AQAAAAAAAAAPAQAAAAUAAAADYWJjZGUL", "AAEAAAD/////AQAAAAAAAAAPAQAAAAUAAAADYWJjZGUL" } };
+ yield return new object[] { new string[] { }, new string[] { "AAEAAAD/////AQAAAAAAAAARAQAAAAAAAAAL", "AAEAAAD/////AQAAAAAAAAARAQAAAAAAAAAL" } };
+ yield return new object[] { new string[] { "hello", "world" }, new string[] { "AAEAAAD/////AQAAAAAAAAARAQAAAAIAAAAGAgAAAAVoZWxsbwYDAAAABXdvcmxkCw==", "AAEAAAD/////AQAAAAAAAAARAQAAAAIAAAAGAgAAAAVoZWxsbwYDAAAABXdvcmxkCw==" } };
+ yield return new object[] { new short[] { short.MaxValue }, new string[] { "AAEAAAD/////AQAAAAAAAAAPAQAAAAEAAAAH/38L", "AAEAAAD/////AQAAAAAAAAAPAQAAAAEAAAAH/38L" } };
+ yield return new object[] { new long[] { long.MaxValue }, new string[] { "AAEAAAD/////AQAAAAAAAAAPAQAAAAEAAAAJ/////////38L", "AAEAAAD/////AQAAAAAAAAAPAQAAAAEAAAAJ/////////38L" } };
+ yield return new object[] { new ushort[] { ushort.MaxValue }, new string[] { "AAEAAAD/////AQAAAAAAAAAPAQAAAAEAAAAO//8L", "AAEAAAD/////AQAAAAAAAAAPAQAAAAEAAAAO//8L" } };
+ yield return new object[] { new uint[] { uint.MaxValue }, new string[] { "AAEAAAD/////AQAAAAAAAAAPAQAAAAEAAAAP/////ws=", "AAEAAAD/////AQAAAAAAAAAPAQAAAAEAAAAP/////ws=" } };
+ yield return new object[] { new ulong[] { ulong.MaxValue }, new string[] { "AAEAAAD/////AQAAAAAAAAAPAQAAAAEAAAAQ//////////8L", "AAEAAAD/////AQAAAAAAAAAPAQAAAAEAAAAQ//////////8L" } };
+ yield return new object[] { new bool[] { true, false }, new string[] { "AAEAAAD/////AQAAAAAAAAAPAQAAAAIAAAABAQAL", "AAEAAAD/////AQAAAAAAAAAPAQAAAAIAAAABAQAL" } };
+ yield return new object[] { new double[] { 1.2 }, new string[] { "AAEAAAD/////AQAAAAAAAAAPAQAAAAEAAAAGMzMzMzMz8z8L", "AAEAAAD/////AQAAAAAAAAAPAQAAAAEAAAAGMzMzMzMz8z8L" } };
+ yield return new object[] { new float[] { 1.2f, 3.4f }, new string[] { "AAEAAAD/////AQAAAAAAAAAPAQAAAAIAAAALmpmZP5qZWUAL", "AAEAAAD/////AQAAAAAAAAAPAQAAAAIAAAALmpmZP5qZWUAL" } };
+
+ // Arrays of other types
+ yield return new object[] { new object[] { }, new string[] { "AAEAAAD/////AQAAAAAAAAAQAQAAAAAAAAAL", "AAEAAAD/////AQAAAAAAAAAQAQAAAAAAAAAL" } };
+ yield return new object[] { new Guid[] { new Guid("0CACAA4D-C6BD-420A-B660-2F557337CA89"), new Guid("BE4E9FF4-82D9-4B54-85EA-0957E21DE0E2") }, new string[] { "AAEAAAD/////AQAAAAAAAAAHAQAAAAABAAAAAgAAAAMLU3lzdGVtLkd1aWQE/v///wtTeXN0ZW0uR3VpZAsAAAACX2ECX2ICX2MCX2QCX2UCX2YCX2cCX2gCX2kCX2oCX2sAAAAAAAAAAAAAAAgHBwICAgICAgICTaqsDL3GCkK2YC9VczfKiQH9/////v////SfTr7ZglRLheoJV+Id4OIL", "AAEAAAD/////AQAAAAAAAAAHAQAAAAABAAAAAgAAAAMLU3lzdGVtLkd1aWQE/v///wtTeXN0ZW0uR3VpZAsAAAACX2ECX2ICX2MCX2QCX2UCX2YCX2cCX2gCX2kCX2oCX2sAAAAAAAAAAAAAAAgHBwICAgICAgICTaqsDL3GCkK2YC9VczfKiQH9/////v////SfTr7ZglRLheoJV+Id4OIL" } };
+ yield return new object[] { new DayOfWeek[] { DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday }, new string[] { "AAEAAAD/////AQAAAAAAAAAHAQAAAAABAAAABQAAAAMQU3lzdGVtLkRheU9mV2VlawT+////EFN5c3RlbS5EYXlPZldlZWsBAAAAB3ZhbHVlX18ACAEAAAAB/f////7///8CAAAAAfz////+////AwAAAAH7/////v///wQAAAAB+v////7///8FAAAACw==", "AAEAAAD/////AQAAAAAAAAAHAQAAAAABAAAABQAAAAMQU3lzdGVtLkRheU9mV2VlawT+////EFN5c3RlbS5EYXlPZldlZWsBAAAAB3ZhbHVlX18ACAEAAAAB/f////7///8CAAAAAfz////+////AwAAAAH7/////v///wQAAAAB+v////7///8FAAAACw==" } };
+ yield return new object[] { new Point[] { new Point(1, 2), new Point(3, 4) }, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBwEAAAAAAQAAAAIAAAAEM1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludAIAAAAJAwAAAAkEAAAABQMAAAAzU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50AgAAAAFYAVkAAAgIAgAAAAEAAAACAAAAAQQAAAADAAAAAwAAAAQAAAAL", "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBwEAAAAAAQAAAAIAAAAEM1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludAIAAAAJAwAAAAkEAAAABQMAAAAzU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50AgAAAAFYAVkAAAgIAgAAAAEAAAACAAAAAQQAAAADAAAAAwAAAAQAAAAL" } };
+ yield return new object[] { new ObjectWithArrays
+ {
+ IntArray = new int[0],
+ StringArray = new string[] { "hello", "world" },
+ ByteArray = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 },
+ JaggedArray = new int[][] { new int[] { 1, 2, 3 }, new int[] { 4, 5, 6, 7 } },
+ MultiDimensionalArray = new int[,] { { 1, 2 }, { 3, 4 }, { 5, 6 } },
+ TreeArray = new Tree<int>[] { new Tree<int>(1, new Tree<int>(2, null, null), new Tree<int>(3, null, null)) }
+ }, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjIuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAAA+U3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLk9iamVjdFdpdGhBcnJheXMGAAAACEludEFycmF5C1N0cmluZ0FycmF5CVRyZWVBcnJheQlCeXRlQXJyYXkLSmFnZ2VkQXJyYXkVTXVsdGlEaW1lbnNpb25hbEFycmF5BwYEBwMDCKEBU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlRyZWVgMVtbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dW10CAAAAAhBTeXN0ZW0uSW50MzJbXVtdD1N5c3RlbS5JbnQzMlssXQIAAAAJAwAAAAkEAAAACQUAAAAJBgAAAAkHAAAACQgAAAAPAwAAAAAAAAAIEQQAAAACAAAABgkAAAAFaGVsbG8GCgAAAAV3b3JsZAcFAAAAAAEAAAABAAAABJ8BU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlRyZWVgMVtbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dAgAAAAkLAAAADwYAAAAUAAAAAgABAgMEBQYHCAkKCwwNDg8QERITBwcAAAABAQAAAAIAAAAHCAkMAAAACQ0AAAAHCAAAAAICAAAAAwAAAAIAAAAACAEAAAACAAAAAwAAAAQAAAAFAAAABgAAAAULAAAAnwFTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuVHJlZWAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0DAAAAFjxWYWx1ZT5rX19CYWNraW5nRmllbGQVPExlZnQ+a19fQmFja2luZ0ZpZWxkFjxSaWdodD5rX19CYWNraW5nRmllbGQABAQInwFTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuVHJlZWAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0CAAAAnwFTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuVHJlZWAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0CAAAAAgAAAAEAAAAJDgAAAAkPAAAADwwAAAADAAAACAEAAAACAAAAAwAAAA8NAAAABAAAAAgEAAAABQAAAAYAAAAHAAAAAQ4AAAALAAAAAgAAAAoKAQ8AAAALAAAAAwAAAAoKCw==", "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjIuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAAA+U3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLk9iamVjdFdpdGhBcnJheXMGAAAACEludEFycmF5C1N0cmluZ0FycmF5CVRyZWVBcnJheQlCeXRlQXJyYXkLSmFnZ2VkQXJyYXkVTXVsdGlEaW1lbnNpb25hbEFycmF5BwYEBwMDCJMBU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlRyZWVgMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXVtdAgAAAAIQU3lzdGVtLkludDMyW11bXQ9TeXN0ZW0uSW50MzJbLF0CAAAACQMAAAAJBAAAAAkFAAAACQYAAAAJBwAAAAkIAAAADwMAAAAAAAAACBEEAAAAAgAAAAYJAAAABWhlbGxvBgoAAAAFd29ybGQHBQAAAAABAAAAAQAAAASRAVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5UcmVlYDFbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0CAAAACQsAAAAPBgAAABQAAAACAAECAwQFBgcICQoLDA0ODxAREhMHBwAAAAEBAAAAAgAAAAcICQwAAAAJDQAAAAcIAAAAAgIAAAADAAAAAgAAAAAIAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABQsAAACRAVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5UcmVlYDFbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0DAAAAFjxWYWx1ZT5rX19CYWNraW5nRmllbGQVPExlZnQ+a19fQmFja2luZ0ZpZWxkFjxSaWdodD5rX19CYWNraW5nRmllbGQABAQIkQFTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuVHJlZWAxW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dAgAAAJEBU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlRyZWVgMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQIAAAACAAAAAQAAAAkOAAAACQ8AAAAPDAAAAAMAAAAIAQAAAAIAAAADAAAADw0AAAAEAAAACAQAAAAFAAAABgAAAAcAAAABDgAAAAsAAAACAAAACgoBDwAAAAsAAAADAAAACgoL" } };
+ yield return new object[] { new object[] { new int[,] { { 1, 2, 3, 4, 5 }, { 6, 7, 8, 9, 10 }, { 11, 12, 13, 14, 15 } } }, new string[] { "AAEAAAD/////AQAAAAAAAAAQAQAAAAEAAAAJAgAAAAcCAAAAAgIAAAADAAAABQAAAAAIAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAACw==", "AAEAAAD/////AQAAAAAAAAAQAQAAAAEAAAAJAgAAAAcCAAAAAgIAAAADAAAABQAAAAAIAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAACw==" } };
+ yield return new object[] { new object[] { new int[,,] { { { 1, 2, 3, 4, 5 }, { 6, 7, 8, 9, 10 }, { 11, 12, 13, 14, 15 } } } }, new string[] { "AAEAAAD/////AQAAAAAAAAAQAQAAAAEAAAAJAgAAAAcCAAAAAgMAAAABAAAAAwAAAAUAAAAACAEAAAACAAAAAwAAAAQAAAAFAAAABgAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAAAs=", "AAEAAAD/////AQAAAAAAAAAQAQAAAAEAAAAJAgAAAAcCAAAAAgMAAAABAAAAAwAAAAUAAAAACAEAAAACAAAAAwAAAAQAAAAFAAAABgAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAAAs=" } };
+ yield return new object[] { new object[] { new int[,,,] { { { { 1 } } } } }, new string[] { "AAEAAAD/////AQAAAAAAAAAQAQAAAAEAAAAJAgAAAAcCAAAAAgQAAAABAAAAAQAAAAEAAAABAAAAAAgBAAAACw==", "AAEAAAD/////AQAAAAAAAAAQAQAAAAEAAAAJAgAAAAcCAAAAAgQAAAABAAAAAQAAAAEAAAABAAAAAAgBAAAACw==" } };
+ yield return new object[] { new ArraySegment<int>(new int[] { 1, 2, 3, 4, 5 }, 1, 2), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAIABU3lzdGVtLkFycmF5U2VnbWVudGAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0DAAAABl9hcnJheQdfb2Zmc2V0Bl9jb3VudAcAAAgICAkCAAAAAQAAAAIAAAAPAgAAAAUAAAAIAQAAAAIAAAADAAAABAAAAAUAAAAL", "AAEAAAD/////AQAAAAAAAAAEAQAAAHJTeXN0ZW0uQXJyYXlTZWdtZW50YDFbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0DAAAABl9hcnJheQdfb2Zmc2V0Bl9jb3VudAcAAAgICAkCAAAAAQAAAAIAAAAPAgAAAAUAAAAIAQAAAAIAAAADAAAABAAAAAUAAAAL" } };
+ yield return new object[] { Enumerable.Range(0, 10000).Select(i => (object)i).ToArray(), new string[] { "AAEAAAD/////AQAAAAAAAAAQAQAAABAnAAAICAAAAAAICAEAAAAICAIAAAAICAMAAAAICAQAAAAICAUAAAAICAYAAAAICAcAAAAICAgAAAAICAkAAAAICAoAAAAICAsAAAAICAwAAAAICA0AAAAICA4AAAAICA8AAAAICBAAAAAICBEAAAAICBIAAAAICBMAAAAICBQAAAAICBUAAAAICBYAAAAICBcAAAAICBgAAAAICBkAAAAICBoAAAAICBsAAAAICBwAAAAICB0AAAAICB4AAAAICB8AAAAICCAAAAAICCEAAAAICCIAAAAICCMAAAAICCQAAAAICCUAAAAICCYAAAAICCcAAAAICCgAAAAICCkAAAAICCoAAAAICCsAAAAICCwAAAAICC0AAAAICC4AAAAICC8AAAAICDAAAAAICDEAAAAICDIAAAAICDMAAAAICDQAAAAICDUAAAAICDYAAAAICDcAAAAICDgAAAAICDkAAAAICDoAAAAICDsAAAAICDwAAAAICD0AAAAICD4AAAAICD8AAAAICEAAAAAICEEAAAAICEIAAAAICEMAAAAICEQAAAAICEUAAAAICEYAAAAICEcAAAAICEgAAAAICEkAAAAICEoAAAAICEsAAAAICEwAAAAICE0AAAAICE4AAAAICE8AAAAICFAAAAAICFEAAAAICFIAAAAICFMAAAAICFQAAAAICFUAAAAICFYAAAAICFcAAAAICFgAAAAICFkAAAAICFoAAAAICFsAAAAICFwAAAAICF0AAAAICF4AAAAICF8AAAAICGAAAAAICGEAAAAICGIAAAAICGMAAAAICGQAAAAICGUAAAAICGYAAAAICGcAAAAICGgAAAAICGkAAAAICGoAAAAICGsAAAAICGwAAAAICG0AAAAICG4AAAAICG8AAAAICHAAAAAICHEAAAAICHIAAAAICHMAAAAICHQAAAAICHUAAAAICHYAAAAICHcAAAAICHgAAAAICHkAAAAICHoAAAAICHsAAAAICHwAAAAICH0AAAAICH4AAAAICH8AAAAICIAAAAAICIEAAAAICIIAAAAICIMAAAAICIQAAAAICIUAAAAICIYAAAAICIcAAAAICIgAAAAICIkAAAAICIoAAAAICIsAAAAICIwAAAAICI0AAAAICI4AAAAICI8AAAAICJAAAAAICJEAAAAICJIAAAAICJMAAAAICJQAAAAICJUAAAAICJYAAAAICJcAAAAICJgAAAAICJkAAAAICJoAAAAICJsAAAAICJwAAAAICJ0AAAAICJ4AAAAICJ8AAAAICKAAAAAICKEAAAAICKIAAAAICKMAAAAICKQAAAAICKUAAAAICKYAAAAICKcAAAAICKgAAAAICKkAAAAICKoAAAAICKsAAAAICKwAAAAICK0AAAAICK4AAAAICK8AAAAICLAAAAAICLEAAAAICLIAAAAICLMAAAAICLQAAAAICLUAAAAICLYAAAAICLcAAAAICLgAAAAICLkAAAAICLoAAAAICLsAAAAICLwAAAAICL0AAAAICL4AAAAICL8AAAAICMAAAAAICMEAAAAICMIAAAAICMMAAAAICMQAAAAICMUAAAAICMYAAAAICMcAAAAICMgAAAAICMkAAAAICMoAAAAICMsAAAAICMwAAAAICM0AAAAICM4AAAAICM8AAAAICNAAAAAICNEAAAAICNIAAAAICNMAAAAICNQAAAAICNUAAAAICNYAAAAICNcAAAAICNgAAAAICNkAAAAICNoAAAAICNsAAAAICNwAAAAICN0AAAAICN4AAAAICN8AAAAICOAAAAAICOEAAAAICOIAAAAICOMAAAAICOQAAAAICOUAAAAICOYAAAAICOcAAAAICOgAAAAICOkAAAAICOoAAAAICOsAAAAICOwAAAAICO0AAAAICO4AAAAICO8AAAAICPAAAAAICPEAAAAICPIAAAAICPMAAAAICPQAAAAICPUAAAAICPYAAAAICPcAAAAICPgAAAAICPkAAAAICPoAAAAICPsAAAAICPwAAAAICP0AAAAICP4AAAAICP8AAAAICAABAAAICAEBAAAICAIBAAAICAMBAAAICAQBAAAICAUBAAAICAYBAAAICAcBAAAICAgBAAAICAkBAAAICAoBAAAICAsBAAAICAwBAAAICA0BAAAICA4BAAAICA8BAAAICBABAAAICBEBAAAICBIBAAAICBMBAAAICBQBAAAICBUBAAAICBYBAAAICBcBAAAICBgBAAAICBkBAAAICBoBAAAICBsBAAAICBwBAAAICB0BAAAICB4BAAAICB8BAAAICCABAAAICCEBAAAICCIBAAAICCMBAAAICCQBAAAICCUBAAAICCYBAAAICCcBAAAICCgBAAAICCkBAAAICCoBAAAICCsBAAAICCwBAAAICC0BAAAICC4BAAAICC8BAAAICDABAAAICDEBAAAICDIBAAAICDMBAAAICDQBAAAICDUBAAAICDYBAAAICDcBAAAICDgBAAAICDkBAAAICDoBAAAICDsBAAAICDwBAAAICD0BAAAICD4BAAAICD8BAAAICEABAAAICEEBAAAICEIBAAAICEMBAAAICEQBAAAICEUBAAAICEYBAAAICEcBAAAICEgBAAAICEkBAAAICEoBAAAICEsBAAAICEwBAAAICE0BAAAICE4BAAAICE8BAAAICFABAAAICFEBAAAICFIBAAAICFMBAAAICFQBAAAICFUBAAAICFYBAAAICFcBAAAICFgBAAAICFkBAAAICFoBAAAICFsBAAAICFwBAAAICF0BAAAICF4BAAAICF8BAAAICGABAAAICGEBAAAICGIBAAAICGMBAAAICGQBAAAICGUBAAAICGYBAAAICGcBAAAICGgBAAAICGkBAAAICGoBAAAICGsBAAAICGwBAAAICG0BAAAICG4BAAAICG8BAAAICHABAAAICHEBAAAICHIBAAAICHMBAAAICHQBAAAICHUBAAAICHYBAAAICHcBAAAICHgBAAAICHkBAAAICHoBAAAICHsBAAAICHwBAAAICH0BAAAICH4BAAAICH8BAAAICIABAAAICIEBAAAICIIBAAAICIMBAAAICIQBAAAICIUBAAAICIYBAAAICIcBAAAICIgBAAAICIkBAAAICIoBAAAICIsBAAAICIwBAAAICI0BAAAICI4BAAAICI8BAAAICJABAAAICJEBAAAICJIBAAAICJMBAAAICJQBAAAICJUBAAAICJYBAAAICJcBAAAICJgBAAAICJkBAAAICJoBAAAICJsBAAAICJwBAAAICJ0BAAAICJ4BAAAICJ8BAAAICKABAAAICKEBAAAICKIBAAAICKMBAAAICKQBAAAICKUBAAAICKYBAAAICKcBAAAICKgBAAAICKkBAAAICKoBAAAICKsBAAAICKwBAAAICK0BAAAICK4BAAAICK8BAAAICLABAAAICLEBAAAICLIBAAAICLMBAAAICLQBAAAICLUBAAAICLYBAAAICLcBAAAICLgBAAAICLkBAAAICLoBAAAICLsBAAAICLwBAAAICL0BAAAICL4BAAAICL8BAAAICMABAAAICMEBAAAICMIBAAAICMMBAAAICMQBAAAICMUBAAAICMYBAAAICMcBAAAICMgBAAAICMkBAAAICMoBAAAICMsBAAAICMwBAAAICM0BAAAICM4BAAAICM8BAAAICNABAAAICNEBAAAICNIBAAAICNMBAAAICNQBAAAICNUBAAAICNYBAAAICNcBAAAICNgBAAAICNkBAAAICNoBAAAICNsBAAAICNwBAAAICN0BAAAICN4BAAAICN8BAAAICOABAAAICOEBAAAICOIBAAAICOMBAAAICOQBAAAICOUBAAAICOYBAAAICOcBAAAICOgBAAAICOkBAAAICOoBAAAICOsBAAAICOwBAAAICO0BAAAICO4BAAAICO8BAAAICPABAAAICPEBAAAICPIBAAAICPMBAAAICPQBAAAICPUBAAAICPYBAAAICPcBAAAICPgBAAAICPkBAAAICPoBAAAICPsBAAAICPwBAAAICP0BAAAICP4BAAAICP8BAAAICAACAAAICAECAAAICAICAAAICAMCAAAICAQCAAAICAUCAAAICAYCAAAICAcCAAAICAgCAAAICAkCAAAICAoCAAAICAsCAAAICAwCAAAICA0CAAAICA4CAAAICA8CAAAICBACAAAICBECAAAICBICAAAICBMCAAAICBQCAAAICBUCAAAICBYCAAAICBcCAAAICBgCAAAICBkCAAAICBoCAAAICBsCAAAICBwCAAAICB0CAAAICB4CAAAICB8CAAAICCACAAAICCECAAAICCICAAAICCMCAAAICCQCAAAICCUCAAAICCYCAAAICCcCAAAICCgCAAAICCkCAAAICCoCAAAICCsCAAAICCwCAAAICC0CAAAICC4CAAAICC8CAAAICDACAAAICDECAAAICDICAAAICDMCAAAICDQCAAAICDUCAAAICDYCAAAICDcCAAAICDgCAAAICDkCAAAICDoCAAAICDsCAAAICDwCAAAICD0CAAAICD4CAAAICD8CAAAICEACAAAICEECAAAICEICAAAICEMCAAAICEQCAAAICEUCAAAICEYCAAAICEcCAAAICEgCAAAICEkCAAAICEoCAAAICEsCAAAICEwCAAAICE0CAAAICE4CAAAICE8CAAAICFACAAAICFECAAAICFICAAAICFMCAAAICFQCAAAICFUCAAAICFYCAAAICFcCAAAICFgCAAAICFkCAAAICFoCAAAICFsCAAAICFwCAAAICF0CAAAICF4CAAAICF8CAAAICGACAAAICGECAAAICGICAAAICGMCAAAICGQCAAAICGUCAAAICGYCAAAICGcCAAAICGgCAAAICGkCAAAICGoCAAAICGsCAAAICGwCAAAICG0CAAAICG4CAAAICG8CAAAICHACAAAICHECAAAICHICAAAICHMCAAAICHQCAAAICHUCAAAICHYCAAAICHcCAAAICHgCAAAICHkCAAAICHoCAAAICHsCAAAICHwCAAAICH0CAAAICH4CAAAICH8CAAAICIACAAAICIECAAAICIICAAAICIMCAAAICIQCAAAICIUCAAAICIYCAAAICIcCAAAICIgCAAAICIkCAAAICIoCAAAICIsCAAAICIwCAAAICI0CAAAICI4CAAAICI8CAAAICJACAAAICJECAAAICJICAAAICJMCAAAICJQCAAAICJUCAAAICJYCAAAICJcCAAAICJgCAAAICJkCAAAICJoCAAAICJsCAAAICJwCAAAICJ0CAAAICJ4CAAAICJ8CAAAICKACAAAICKECAAAICKICAAAICKMCAAAICKQCAAAICKUCAAAICKYCAAAICKcCAAAICKgCAAAICKkCAAAICKoCAAAICKsCAAAICKwCAAAICK0CAAAICK4CAAAICK8CAAAICLACAAAICLECAAAICLICAAAICLMCAAAICLQCAAAICLUCAAAICLYCAAAICLcCAAAICLgCAAAICLkCAAAICLoCAAAICLsCAAAICLwCAAAICL0CAAAICL4CAAAICL8CAAAICMACAAAICMECAAAICMICAAAICMMCAAAICMQCAAAICMUCAAAICMYCAAAICMcCAAAICMgCAAAICMkCAAAICMoCAAAICMsCAAAICMwCAAAICM0CAAAICM4CAAAICM8CAAAICNACAAAICNECAAAICNICAAAICNMCAAAICNQCAAAICNUCAAAICNYCAAAICNcCAAAICNgCAAAICNkCAAAICNoCAAAICNsCAAAICNwCAAAICN0CAAAICN4CAAAICN8CAAAICOACAAAICOECAAAICOICAAAICOMCAAAICOQCAAAICOUCAAAICOYCAAAICOcCAAAICOgCAAAICOkCAAAICOoCAAAICOsCAAAICOwCAAAICO0CAAAICO4CAAAICO8CAAAICPACAAAICPECAAAICPICAAAICPMCAAAICPQCAAAICPUCAAAICPYCAAAICPcCAAAICPgCAAAICPkCAAAICPoCAAAICPsCAAAICPwCAAAICP0CAAAICP4CAAAICP8CAAAICAADAAAICAEDAAAICAIDAAAICAMDAAAICAQDAAAICAUDAAAICAYDAAAICAcDAAAICAgDAAAICAkDAAAICAoDAAAICAsDAAAICAwDAAAICA0DAAAICA4DAAAICA8DAAAICBADAAAICBEDAAAICBIDAAAICBMDAAAICBQDAAAICBUDAAAICBYDAAAICBcDAAAICBgDAAAICBkDAAAICBoDAAAICBsDAAAICBwDAAAICB0DAAAICB4DAAAICB8DAAAICCADAAAICCEDAAAICCIDAAAICCMDAAAICCQDAAAICCUDAAAICCYDAAAICCcDAAAICCgDAAAICCkDAAAICCoDAAAICCsDAAAICCwDAAAICC0DAAAICC4DAAAICC8DAAAICDADAAAICDEDAAAICDIDAAAICDMDAAAICDQDAAAICDUDAAAICDYDAAAICDcDAAAICDgDAAAICDkDAAAICDoDAAAICDsDAAAICDwDAAAICD0DAAAICD4DAAAICD8DAAAICEADAAAICEEDAAAICEIDAAAICEMDAAAICEQDAAAICEUDAAAICEYDAAAICEcDAAAICEgDAAAICEkDAAAICEoDAAAICEsDAAAICEwDAAAICE0DAAAICE4DAAAICE8DAAAICFADAAAICFEDAAAICFIDAAAICFMDAAAICFQDAAAICFUDAAAICFYDAAAICFcDAAAICFgDAAAICFkDAAAICFoDAAAICFsDAAAICFwDAAAICF0DAAAICF4DAAAICF8DAAAICGADAAAICGEDAAAICGIDAAAICGMDAAAICGQDAAAICGUDAAAICGYDAAAICGcDAAAICGgDAAAICGkDAAAICGoDAAAICGsDAAAICGwDAAAICG0DAAAICG4DAAAICG8DAAAICHADAAAICHEDAAAICHIDAAAICHMDAAAICHQDAAAICHUDAAAICHYDAAAICHcDAAAICHgDAAAICHkDAAAICHoDAAAICHsDAAAICHwDAAAICH0DAAAICH4DAAAICH8DAAAICIADAAAICIEDAAAICIIDAAAICIMDAAAICIQDAAAICIUDAAAICIYDAAAICIcDAAAICIgDAAAICIkDAAAICIoDAAAICIsDAAAICIwDAAAICI0DAAAICI4DAAAICI8DAAAICJADAAAICJEDAAAICJIDAAAICJMDAAAICJQDAAAICJUDAAAICJYDAAAICJcDAAAICJgDAAAICJkDAAAICJoDAAAICJsDAAAICJwDAAAICJ0DAAAICJ4DAAAICJ8DAAAICKADAAAICKEDAAAICKIDAAAICKMDAAAICKQDAAAICKUDAAAICKYDAAAICKcDAAAICKgDAAAICKkDAAAICKoDAAAICKsDAAAICKwDAAAICK0DAAAICK4DAAAICK8DAAAICLADAAAICLEDAAAICLIDAAAICLMDAAAICLQDAAAICLUDAAAICLYDAAAICLcDAAAICLgDAAAICLkDAAAICLoDAAAICLsDAAAICLwDAAAICL0DAAAICL4DAAAICL8DAAAICMADAAAICMEDAAAICMIDAAAICMMDAAAICMQDAAAICMUDAAAICMYDAAAICMcDAAAICMgDAAAICMkDAAAICMoDAAAICMsDAAAICMwDAAAICM0DAAAICM4DAAAICM8DAAAICNADAAAICNEDAAAICNIDAAAICNMDAAAICNQDAAAICNUDAAAICNYDAAAICNcDAAAICNgDAAAICNkDAAAICNoDAAAICNsDAAAICNwDAAAICN0DAAAICN4DAAAICN8DAAAICOADAAAICOEDAAAICOIDAAAICOMDAAAICOQDAAAICOUDAAAICOYDAAAICOcDAAAICOgDAAAICOkDAAAICOoDAAAICOsDAAAICOwDAAAICO0DAAAICO4DAAAICO8DAAAICPADAAAICPEDAAAICPIDAAAICPMDAAAICPQDAAAICPUDAAAICPYDAAAICPcDAAAICPgDAAAICPkDAAAICPoDAAAICPsDAAAICPwDAAAICP0DAAAICP4DAAAICP8DAAAICAAEAAAICAEEAAAICAIEAAAICAMEAAAICAQEAAAICAUEAAAICAYEAAAICAcEAAAICAgEAAAICAkEAAAICAoEAAAICAsEAAAICAwEAAAICA0EAAAICA4EAAAICA8EAAAICBAEAAAICBEEAAAICBIEAAAICBMEAAAICBQEAAAICBUEAAAICBYEAAAICBcEAAAICBgEAAAICBkEAAAICBoEAAAICBsEAAAICBwEAAAICB0EAAAICB4EAAAICB8EAAAICCAEAAAICCEEAAAICCIEAAAICCMEAAAICCQEAAAICCUEAAAICCYEAAAICCcEAAAICCgEAAAICCkEAAAICCoEAAAICCsEAAAICCwEAAAICC0EAAAICC4EAAAICC8EAAAICDAEAAAICDEEAAAICDIEAAAICDMEAAAICDQEAAAICDUEAAAICDYEAAAICDcEAAAICDgEAAAICDkEAAAICDoEAAAICDsEAAAICDwEAAAICD0EAAAICD4EAAAICD8EAAAICEAEAAAICEEEAAAICEIEAAAICEMEAAAICEQEAAAICEUEAAAICEYEAAAICEcEAAAICEgEAAAICEkEAAAICEoEAAAICEsEAAAICEwEAAAICE0EAAAICE4EAAAICE8EAAAICFAEAAAICFEEAAAICFIEAAAICFMEAAAICFQEAAAICFUEAAAICFYEAAAICFcEAAAICFgEAAAICFkEAAAICFoEAAAICFsEAAAICFwEAAAICF0EAAAICF4EAAAICF8EAAAICGAEAAAICGEEAAAICGIEAAAICGMEAAAICGQEAAAICGUEAAAICGYEAAAICGcEAAAICGgEAAAICGkEAAAICGoEAAAICGsEAAAICGwEAAAICG0EAAAICG4EAAAICG8EAAAICHAEAAAICHEEAAAICHIEAAAICHMEAAAICHQEAAAICHUEAAAICHYEAAAICHcEAAAICHgEAAAICHkEAAAICHoEAAAICHsEAAAICHwEAAAICH0EAAAICH4EAAAICH8EAAAICIAEAAAICIEEAAAICIIEAAAICIMEAAAICIQEAAAICIUEAAAICIYEAAAICIcEAAAICIgEAAAICIkEAAAICIoEAAAICIsEAAAICIwEAAAICI0EAAAICI4EAAAICI8EAAAICJAEAAAICJEEAAAICJIEAAAICJMEAAAICJQEAAAICJUEAAAICJYEAAAICJcEAAAICJgEAAAICJkEAAAICJoEAAAICJsEAAAICJwEAAAICJ0EAAAICJ4EAAAICJ8EAAAICKAEAAAICKEEAAAICKIEAAAICKMEAAAICKQEAAAICKUEAAAICKYEAAAICKcEAAAICKgEAAAICKkEAAAICKoEAAAICKsEAAAICKwEAAAICK0EAAAICK4EAAAICK8EAAAICLAEAAAICLEEAAAICLIEAAAICLMEAAAICLQEAAAICLUEAAAICLYEAAAICLcEAAAICLgEAAAICLkEAAAICLoEAAAICLsEAAAICLwEAAAICL0EAAAICL4EAAAICL8EAAAICMAEAAAICMEEAAAICMIEAAAICMMEAAAICMQEAAAICMUEAAAICMYEAAAICMcEAAAICMgEAAAICMkEAAAICMoEAAAICMsEAAAICMwEAAAICM0EAAAICM4EAAAICM8EAAAICNAEAAAICNEEAAAICNIEAAAICNMEAAAICNQEAAAICNUEAAAICNYEAAAICNcEAAAICNgEAAAICNkEAAAICNoEAAAICNsEAAAICNwEAAAICN0EAAAICN4EAAAICN8EAAAICOAEAAAICOEEAAAICOIEAAAICOMEAAAICOQEAAAICOUEAAAICOYEAAAICOcEAAAICOgEAAAICOkEAAAICOoEAAAICOsEAAAICOwEAAAICO0EAAAICO4EAAAICO8EAAAICPAEAAAICPEEAAAICPIEAAAICPMEAAAICPQEAAAICPUEAAAICPYEAAAICPcEAAAICPgEAAAICPkEAAAICPoEAAAICPsEAAAICPwEAAAICP0EAAAICP4EAAAICP8EAAAICAAFAAAICAEFAAAICAIFAAAICAMFAAAICAQFAAAICAUFAAAICAYFAAAICAcFAAAICAgFAAAICAkFAAAICAoFAAAICAsFAAAICAwFAAAICA0FAAAICA4FAAAICA8FAAAICBAFAAAICBEFAAAICBIFAAAICBMFAAAICBQFAAAICBUFAAAICBYFAAAICBcFAAAICBgFAAAICBkFAAAICBoFAAAICBsFAAAICBwFAAAICB0FAAAICB4FAAAICB8FAAAICCAFAAAICCEFAAAICCIFAAAICCMFAAAICCQFAAAICCUFAAAICCYFAAAICCcFAAAICCgFAAAICCkFAAAICCoFAAAICCsFAAAICCwFAAAICC0FAAAICC4FAAAICC8FAAAICDAFAAAICDEFAAAICDIFAAAICDMFAAAICDQFAAAICDUFAAAICDYFAAAICDcFAAAICDgFAAAICDkFAAAICDoFAAAICDsFAAAICDwFAAAICD0FAAAICD4FAAAICD8FAAAICEAFAAAICEEFAAAICEIFAAAICEMFAAAICEQFAAAICEUFAAAICEYFAAAICEcFAAAICEgFAAAICEkFAAAICEoFAAAICEsFAAAICEwFAAAICE0FAAAICE4FAAAICE8FAAAICFAFAAAICFEFAAAICFIFAAAICFMFAAAICFQFAAAICFUFAAAICFYFAAAICFcFAAAICFgFAAAICFkFAAAICFoFAAAICFsFAAAICFwFAAAICF0FAAAICF4FAAAICF8FAAAICGAFAAAICGEFAAAICGIFAAAICGMFAAAICGQFAAAICGUFAAAICGYFAAAICGcFAAAICGgFAAAICGkFAAAICGoFAAAICGsFAAAICGwFAAAICG0FAAAICG4FAAAICG8FAAAICHAFAAAICHEFAAAICHIFAAAICHMFAAAICHQFAAAICHUFAAAICHYFAAAICHcFAAAICHgFAAAICHkFAAAICHoFAAAICHsFAAAICHwFAAAICH0FAAAICH4FAAAICH8FAAAICIAFAAAICIEFAAAICIIFAAAICIMFAAAICIQFAAAICIUFAAAICIYFAAAICIcFAAAICIgFAAAICIkFAAAICIoFAAAICIsFAAAICIwFAAAICI0FAAAICI4FAAAICI8FAAAICJAFAAAICJEFAAAICJIFAAAICJMFAAAICJQFAAAICJUFAAAICJYFAAAICJcFAAAICJgFAAAICJkFAAAICJoFAAAICJsFAAAICJwFAAAICJ0FAAAICJ4FAAAICJ8FAAAICKAFAAAICKEFAAAICKIFAAAICKMFAAAICKQFAAAICKUFAAAICKYFAAAICKcFAAAICKgFAAAICKkFAAAICKoFAAAICKsFAAAICKwFAAAICK0FAAAICK4FAAAICK8FAAAICLAFAAAICLEFAAAICLIFAAAICLMFAAAICLQFAAAICLUFAAAICLYFAAAICLcFAAAICLgFAAAICLkFAAAICLoFAAAICLsFAAAICLwFAAAICL0FAAAICL4FAAAICL8FAAAICMAFAAAICMEFAAAICMIFAAAICMMFAAAICMQFAAAICMUFAAAICMYFAAAICMcFAAAICMgFAAAICMkFAAAICMoFAAAICMsFAAAICMwFAAAICM0FAAAICM4FAAAICM8FAAAICNAFAAAICNEFAAAICNIFAAAICNMFAAAICNQFAAAICNUFAAAICNYFAAAICNcFAAAICNgFAAAICNkFAAAICNoFAAAICNsFAAAICNwFAAAICN0FAAAICN4FAAAICN8FAAAICOAFAAAICOEFAAAICOIFAAAICOMFAAAICOQFAAAICOUFAAAICOYFAAAICOcFAAAICOgFAAAICOkFAAAICOoFAAAICOsFAAAICOwFAAAICO0FAAAICO4FAAAICO8FAAAICPAFAAAICPEFAAAICPIFAAAICPMFAAAICPQFAAAICPUFAAAICPYFAAAICPcFAAAICPgFAAAICPkFAAAICPoFAAAICPsFAAAICPwFAAAICP0FAAAICP4FAAAICP8FAAAICAAGAAAICAEGAAAICAIGAAAICAMGAAAICAQGAAAICAUGAAAICAYGAAAICAcGAAAICAgGAAAICAkGAAAICAoGAAAICAsGAAAICAwGAAAICA0GAAAICA4GAAAICA8GAAAICBAGAAAICBEGAAAICBIGAAAICBMGAAAICBQGAAAICBUGAAAICBYGAAAICBcGAAAICBgGAAAICBkGAAAICBoGAAAICBsGAAAICBwGAAAICB0GAAAICB4GAAAICB8GAAAICCAGAAAICCEGAAAICCIGAAAICCMGAAAICCQGAAAICCUGAAAICCYGAAAICCcGAAAICCgGAAAICCkGAAAICCoGAAAICCsGAAAICCwGAAAICC0GAAAICC4GAAAICC8GAAAICDAGAAAICDEGAAAICDIGAAAICDMGAAAICDQGAAAICDUGAAAICDYGAAAICDcGAAAICDgGAAAICDkGAAAICDoGAAAICDsGAAAICDwGAAAICD0GAAAICD4GAAAICD8GAAAICEAGAAAICEEGAAAICEIGAAAICEMGAAAICEQGAAAICEUGAAAICEYGAAAICEcGAAAICEgGAAAICEkGAAAICEoGAAAICEsGAAAICEwGAAAICE0GAAAICE4GAAAICE8GAAAICFAGAAAICFEGAAAICFIGAAAICFMGAAAICFQGAAAICFUGAAAICFYGAAAICFcGAAAICFgGAAAICFkGAAAICFoGAAAICFsGAAAICFwGAAAICF0GAAAICF4GAAAICF8GAAAICGAGAAAICGEGAAAICGIGAAAICGMGAAAICGQGAAAICGUGAAAICGYGAAAICGcGAAAICGgGAAAICGkGAAAICGoGAAAICGsGAAAICGwGAAAICG0GAAAICG4GAAAICG8GAAAICHAGAAAICHEGAAAICHIGAAAICHMGAAAICHQGAAAICHUGAAAICHYGAAAICHcGAAAICHgGAAAICHkGAAAICHoGAAAICHsGAAAICHwGAAAICH0GAAAICH4GAAAICH8GAAAICIAGAAAICIEGAAAICIIGAAAICIMGAAAICIQGAAAICIUGAAAICIYGAAAICIcGAAAICIgGAAAICIkGAAAICIoGAAAICIsGAAAICIwGAAAICI0GAAAICI4GAAAICI8GAAAICJAGAAAICJEGAAAICJIGAAAICJMGAAAICJQGAAAICJUGAAAICJYGAAAICJcGAAAICJgGAAAICJkGAAAICJoGAAAICJsGAAAICJwGAAAICJ0GAAAICJ4GAAAICJ8GAAAICKAGAAAICKEGAAAICKIGAAAICKMGAAAICKQGAAAICKUGAAAICKYGAAAICKcGAAAICKgGAAAICKkGAAAICKoGAAAICKsGAAAICKwGAAAICK0GAAAICK4GAAAICK8GAAAICLAGAAAICLEGAAAICLIGAAAICLMGAAAICLQGAAAICLUGAAAICLYGAAAICLcGAAAICLgGAAAICLkGAAAICLoGAAAICLsGAAAICLwGAAAICL0GAAAICL4GAAAICL8GAAAICMAGAAAICMEGAAAICMIGAAAICMMGAAAICMQGAAAICMUGAAAICMYGAAAICMcGAAAICMgGAAAICMkGAAAICMoGAAAICMsGAAAICMwGAAAICM0GAAAICM4GAAAICM8GAAAICNAGAAAICNEGAAAICNIGAAAICNMGAAAICNQGAAAICNUGAAAICNYGAAAICNcGAAAICNgGAAAICNkGAAAICNoGAAAICNsGAAAICNwGAAAICN0GAAAICN4GAAAICN8GAAAICOAGAAAICOEGAAAICOIGAAAICOMGAAAICOQGAAAICOUGAAAICOYGAAAICOcGAAAICOgGAAAICOkGAAAICOoGAAAICOsGAAAICOwGAAAICO0GAAAICO4GAAAICO8GAAAICPAGAAAICPEGAAAICPIGAAAICPMGAAAICPQGAAAICPUGAAAICPYGAAAICPcGAAAICPgGAAAICPkGAAAICPoGAAAICPsGAAAICPwGAAAICP0GAAAICP4GAAAICP8GAAAICAAHAAAICAEHAAAICAIHAAAICAMHAAAICAQHAAAICAUHAAAICAYHAAAICAcHAAAICAgHAAAICAkHAAAICAoHAAAICAsHAAAICAwHAAAICA0HAAAICA4HAAAICA8HAAAICBAHAAAICBEHAAAICBIHAAAICBMHAAAICBQHAAAICBUHAAAICBYHAAAICBcHAAAICBgHAAAICBkHAAAICBoHAAAICBsHAAAICBwHAAAICB0HAAAICB4HAAAICB8HAAAICCAHAAAICCEHAAAICCIHAAAICCMHAAAICCQHAAAICCUHAAAICCYHAAAICCcHAAAICCgHAAAICCkHAAAICCoHAAAICCsHAAAICCwHAAAICC0HAAAICC4HAAAICC8HAAAICDAHAAAICDEHAAAICDIHAAAICDMHAAAICDQHAAAICDUHAAAICDYHAAAICDcHAAAICDgHAAAICDkHAAAICDoHAAAICDsHAAAICDwHAAAICD0HAAAICD4HAAAICD8HAAAICEAHAAAICEEHAAAICEIHAAAICEMHAAAICEQHAAAICEUHAAAICEYHAAAICEcHAAAICEgHAAAICEkHAAAICEoHAAAICEsHAAAICEwHAAAICE0HAAAICE4HAAAICE8HAAAICFAHAAAICFEHAAAICFIHAAAICFMHAAAICFQHAAAICFUHAAAICFYHAAAICFcHAAAICFgHAAAICFkHAAAICFoHAAAICFsHAAAICFwHAAAICF0HAAAICF4HAAAICF8HAAAICGAHAAAICGEHAAAICGIHAAAICGMHAAAICGQHAAAICGUHAAAICGYHAAAICGcHAAAICGgHAAAICGkHAAAICGoHAAAICGsHAAAICGwHAAAICG0HAAAICG4HAAAICG8HAAAICHAHAAAICHEHAAAICHIHAAAICHMHAAAICHQHAAAICHUHAAAICHYHAAAICHcHAAAICHgHAAAICHkHAAAICHoHAAAICHsHAAAICHwHAAAICH0HAAAICH4HAAAICH8HAAAICIAHAAAICIEHAAAICIIHAAAICIMHAAAICIQHAAAICIUHAAAICIYHAAAICIcHAAAICIgHAAAICIkHAAAICIoHAAAICIsHAAAICIwHAAAICI0HAAAICI4HAAAICI8HAAAICJAHAAAICJEHAAAICJIHAAAICJMHAAAICJQHAAAICJUHAAAICJYHAAAICJcHAAAICJgHAAAICJkHAAAICJoHAAAICJsHAAAICJwHAAAICJ0HAAAICJ4HAAAICJ8HAAAICKAHAAAICKEHAAAICKIHAAAICKMHAAAICKQHAAAICKUHAAAICKYHAAAICKcHAAAICKgHAAAICKkHAAAICKoHAAAICKsHAAAICKwHAAAICK0HAAAICK4HAAAICK8HAAAICLAHAAAICLEHAAAICLIHAAAICLMHAAAICLQHAAAICLUHAAAICLYHAAAICLcHAAAICLgHAAAICLkHAAAICLoHAAAICLsHAAAICLwHAAAICL0HAAAICL4HAAAICL8HAAAICMAHAAAICMEHAAAICMIHAAAICMMHAAAICMQHAAAICMUHAAAICMYHAAAICMcHAAAICMgHAAAICMkHAAAICMoHAAAICMsHAAAICMwHAAAICM0HAAAICM4HAAAICM8HAAAICNAHAAAICNEHAAAICNIHAAAICNMHAAAICNQHAAAICNUHAAAICNYHAAAICNcHAAAICNgHAAAICNkHAAAICNoHAAAICNsHAAAICNwHAAAICN0HAAAICN4HAAAICN8HAAAICOAHAAAICOEHAAAICOIHAAAICOMHAAAICOQHAAAICOUHAAAICOYHAAAICOcHAAAICOgHAAAICOkHAAAICOoHAAAICOsHAAAICOwHAAAICO0HAAAICO4HAAAICO8HAAAICPAHAAAICPEHAAAICPIHAAAICPMHAAAICPQHAAAICPUHAAAICPYHAAAICPcHAAAICPgHAAAICPkHAAAICPoHAAAICPsHAAAICPwHAAAICP0HAAAICP4HAAAICP8HAAAICAAIAAAICAEIAAAICAIIAAAICAMIAAAICAQIAAAICAUIAAAICAYIAAAICAcIAAAICAgIAAAICAkIAAAICAoIAAAICAsIAAAICAwIAAAICA0IAAAICA4IAAAICA8IAAAICBAIAAAICBEIAAAICBIIAAAICBMIAAAICBQIAAAICBUIAAAICBYIAAAICBcIAAAICBgIAAAICBkIAAAICBoIAAAICBsIAAAICBwIAAAICB0IAAAICB4IAAAICB8IAAAICCAIAAAICCEIAAAICCIIAAAICCMIAAAICCQIAAAICCUIAAAICCYIAAAICCcIAAAICCgIAAAICCkIAAAICCoIAAAICCsIAAAICCwIAAAICC0IAAAICC4IAAAICC8IAAAICDAIAAAICDEIAAAICDIIAAAICDMIAAAICDQIAAAICDUIAAAICDYIAAAICDcIAAAICDgIAAAICDkIAAAICDoIAAAICDsIAAAICDwIAAAICD0IAAAICD4IAAAICD8IAAAICEAIAAAICEEIAAAICEIIAAAICEMIAAAICEQIAAAICEUIAAAICEYIAAAICEcIAAAICEgIAAAICEkIAAAICEoIAAAICEsIAAAICEwIAAAICE0IAAAICE4IAAAICE8IAAAICFAIAAAICFEIAAAICFIIAAAICFMIAAAICFQIAAAICFUIAAAICFYIAAAICFcIAAAICFgIAAAICFkIAAAICFoIAAAICFsIAAAICFwIAAAICF0IAAAICF4IAAAICF8IAAAICGAIAAAICGEIAAAICGIIAAAICGMIAAAICGQIAAAICGUIAAAICGYIAAAICGcIAAAICGgIAAAICGkIAAAICGoIAAAICGsIAAAICGwIAAAICG0IAAAICG4IAAAICG8IAAAICHAIAAAICHEIAAAICHIIAAAICHMIAAAICHQIAAAICHUIAAAICHYIAAAICHcIAAAICHgIAAAICHkIAAAICHoIAAAICHsIAAAICHwIAAAICH0IAAAICH4IAAAICH8IAAAICIAIAAAICIEIAAAICIIIAAAICIMIAAAICIQIAAAICIUIAAAICIYIAAAICIcIAAAICIgIAAAICIkIAAAICIoIAAAICIsIAAAICIwIAAAICI0IAAAICI4IAAAICI8IAAAICJAIAAAICJEIAAAICJIIAAAICJMIAAAICJQIAAAICJUIAAAICJYIAAAICJcIAAAICJgIAAAICJkIAAAICJoIAAAICJsIAAAICJwIAAAICJ0IAAAICJ4IAAAICJ8IAAAICKAIAAAICKEIAAAICKIIAAAICKMIAAAICKQIAAAICKUIAAAICKYIAAAICKcIAAAICKgIAAAICKkIAAAICKoIAAAICKsIAAAICKwIAAAICK0IAAAICK4IAAAICK8IAAAICLAIAAAICLEIAAAICLIIAAAICLMIAAAICLQIAAAICLUIAAAICLYIAAAICLcIAAAICLgIAAAICLkIAAAICLoIAAAICLsIAAAICLwIAAAICL0IAAAICL4IAAAICL8IAAAICMAIAAAICMEIAAAICMIIAAAICMMIAAAICMQIAAAICMUIAAAICMYIAAAICMcIAAAICMgIAAAICMkIAAAICMoIAAAICMsIAAAICMwIAAAICM0IAAAICM4IAAAICM8IAAAICNAIAAAICNEIAAAICNIIAAAICNMIAAAICNQIAAAICNUIAAAICNYIAAAICNcIAAAICNgIAAAICNkIAAAICNoIAAAICNsIAAAICNwIAAAICN0IAAAICN4IAAAICN8IAAAICOAIAAAICOEIAAAICOIIAAAICOMIAAAICOQIAAAICOUIAAAICOYIAAAICOcIAAAICOgIAAAICOkIAAAICOoIAAAICOsIAAAICOwIAAAICO0IAAAICO4IAAAICO8IAAAICPAIAAAICPEIAAAICPIIAAAICPMIAAAICPQIAAAICPUIAAAICPYIAAAICPcIAAAICPgIAAAICPkIAAAICPoIAAAICPsIAAAICPwIAAAICP0IAAAICP4IAAAICP8IAAAICAAJAAAICAEJAAAICAIJAAAICAMJAAAICAQJAAAICAUJAAAICAYJAAAICAcJAAAICAgJAAAICAkJAAAICAoJAAAICAsJAAAICAwJAAAICA0JAAAICA4JAAAICA8JAAAICBAJAAAICBEJAAAICBIJAAAICBMJAAAICBQJAAAICBUJAAAICBYJAAAICBcJAAAICBgJAAAICBkJAAAICBoJAAAICBsJAAAICBwJAAAICB0JAAAICB4JAAAICB8JAAAICCAJAAAICCEJAAAICCIJAAAICCMJAAAICCQJAAAICCUJAAAICCYJAAAICCcJAAAICCgJAAAICCkJAAAICCoJAAAICCsJAAAICCwJAAAICC0JAAAICC4JAAAICC8JAAAICDAJAAAICDEJAAAICDIJAAAICDMJAAAICDQJAAAICDUJAAAICDYJAAAICDcJAAAICDgJAAAICDkJAAAICDoJAAAICDsJAAAICDwJAAAICD0JAAAICD4JAAAICD8JAAAICEAJAAAICEEJAAAICEIJAAAICEMJAAAICEQJAAAICEUJAAAICEYJAAAICEcJAAAICEgJAAAICEkJAAAICEoJAAAICEsJAAAICEwJAAAICE0JAAAICE4JAAAICE8JAAAICFAJAAAICFEJAAAICFIJAAAICFMJAAAICFQJAAAICFUJAAAICFYJAAAICFcJAAAICFgJAAAICFkJAAAICFoJAAAICFsJAAAICFwJAAAICF0JAAAICF4JAAAICF8JAAAICGAJAAAICGEJAAAICGIJAAAICGMJAAAICGQJAAAICGUJAAAICGYJAAAICGcJAAAICGgJAAAICGkJAAAICGoJAAAICGsJAAAICGwJAAAICG0JAAAICG4JAAAICG8JAAAICHAJAAAICHEJAAAICHIJAAAICHMJAAAICHQJAAAICHUJAAAICHYJAAAICHcJAAAICHgJAAAICHkJAAAICHoJAAAICHsJAAAICHwJAAAICH0JAAAICH4JAAAICH8JAAAICIAJAAAICIEJAAAICIIJAAAICIMJAAAICIQJAAAICIUJAAAICIYJAAAICIcJAAAICIgJAAAICIkJAAAICIoJAAAICIsJAAAICIwJAAAICI0JAAAICI4JAAAICI8JAAAICJAJAAAICJEJAAAICJIJAAAICJMJAAAICJQJAAAICJUJAAAICJYJAAAICJcJAAAICJgJAAAICJkJAAAICJoJAAAICJsJAAAICJwJAAAICJ0JAAAICJ4JAAAICJ8JAAAICKAJAAAICKEJAAAICKIJAAAICKMJAAAICKQJAAAICKUJAAAICKYJAAAICKcJAAAICKgJAAAICKkJAAAICKoJAAAICKsJAAAICKwJAAAICK0JAAAICK4JAAAICK8JAAAICLAJAAAICLEJAAAICLIJAAAICLMJAAAICLQJAAAICLUJAAAICLYJAAAICLcJAAAICLgJAAAICLkJAAAICLoJAAAICLsJAAAICLwJAAAICL0JAAAICL4JAAAICL8JAAAICMAJAAAICMEJAAAICMIJAAAICMMJAAAICMQJAAAICMUJAAAICMYJAAAICMcJAAAICMgJAAAICMkJAAAICMoJAAAICMsJAAAICMwJAAAICM0JAAAICM4JAAAICM8JAAAICNAJAAAICNEJAAAICNIJAAAICNMJAAAICNQJAAAICNUJAAAICNYJAAAICNcJAAAICNgJAAAICNkJAAAICNoJAAAICNsJAAAICNwJAAAICN0JAAAICN4JAAAICN8JAAAICOAJAAAICOEJAAAICOIJAAAICOMJAAAICOQJAAAICOUJAAAICOYJAAAICOcJAAAICOgJAAAICOkJAAAICOoJAAAICOsJAAAICOwJAAAICO0JAAAICO4JAAAICO8JAAAICPAJAAAICPEJAAAICPIJAAAICPMJAAAICPQJAAAICPUJAAAICPYJAAAICPcJAAAICPgJAAAICPkJAAAICPoJAAAICPsJAAAICPwJAAAICP0JAAAICP4JAAAICP8JAAAICAAKAAAICAEKAAAICAIKAAAICAMKAAAICAQKAAAICAUKAAAICAYKAAAICAcKAAAICAgKAAAICAkKAAAICAoKAAAICAsKAAAICAwKAAAICA0KAAAICA4KAAAICA8KAAAICBAKAAAICBEKAAAICBIKAAAICBMKAAAICBQKAAAICBUKAAAICBYKAAAICBcKAAAICBgKAAAICBkKAAAICBoKAAAICBsKAAAICBwKAAAICB0KAAAICB4KAAAICB8KAAAICCAKAAAICCEKAAAICCIKAAAICCMKAAAICCQKAAAICCUKAAAICCYKAAAICCcKAAAICCgKAAAICCkKAAAICCoKAAAICCsKAAAICCwKAAAICC0KAAAICC4KAAAICC8KAAAICDAKAAAICDEKAAAICDIKAAAICDMKAAAICDQKAAAICDUKAAAICDYKAAAICDcKAAAICDgKAAAICDkKAAAICDoKAAAICDsKAAAICDwKAAAICD0KAAAICD4KAAAICD8KAAAICEAKAAAICEEKAAAICEIKAAAICEMKAAAICEQKAAAICEUKAAAICEYKAAAICEcKAAAICEgKAAAICEkKAAAICEoKAAAICEsKAAAICEwKAAAICE0KAAAICE4KAAAICE8KAAAICFAKAAAICFEKAAAICFIKAAAICFMKAAAICFQKAAAICFUKAAAICFYKAAAICFcKAAAICFgKAAAICFkKAAAICFoKAAAICFsKAAAICFwKAAAICF0KAAAICF4KAAAICF8KAAAICGAKAAAICGEKAAAICGIKAAAICGMKAAAICGQKAAAICGUKAAAICGYKAAAICGcKAAAICGgKAAAICGkKAAAICGoKAAAICGsKAAAICGwKAAAICG0KAAAICG4KAAAICG8KAAAICHAKAAAICHEKAAAICHIKAAAICHMKAAAICHQKAAAICHUKAAAICHYKAAAICHcKAAAICHgKAAAICHkKAAAICHoKAAAICHsKAAAICHwKAAAICH0KAAAICH4KAAAICH8KAAAICIAKAAAICIEKAAAICIIKAAAICIMKAAAICIQKAAAICIUKAAAICIYKAAAICIcKAAAICIgKAAAICIkKAAAICIoKAAAICIsKAAAICIwKAAAICI0KAAAICI4KAAAICI8KAAAICJAKAAAICJEKAAAICJIKAAAICJMKAAAICJQKAAAICJUKAAAICJYKAAAICJcKAAAICJgKAAAICJkKAAAICJoKAAAICJsKAAAICJwKAAAICJ0KAAAICJ4KAAAICJ8KAAAICKAKAAAICKEKAAAICKIKAAAICKMKAAAICKQKAAAICKUKAAAICKYKAAAICKcKAAAICKgKAAAICKkKAAAICKoKAAAICKsKAAAICKwKAAAICK0KAAAICK4KAAAICK8KAAAICLAKAAAICLEKAAAICLIKAAAICLMKAAAICLQKAAAICLUKAAAICLYKAAAICLcKAAAICLgKAAAICLkKAAAICLoKAAAICLsKAAAICLwKAAAICL0KAAAICL4KAAAICL8KAAAICMAKAAAICMEKAAAICMIKAAAICMMKAAAICMQKAAAICMUKAAAICMYKAAAICMcKAAAICMgKAAAICMkKAAAICMoKAAAICMsKAAAICMwKAAAICM0KAAAICM4KAAAICM8KAAAICNAKAAAICNEKAAAICNIKAAAICNMKAAAICNQKAAAICNUKAAAICNYKAAAICNcKAAAICNgKAAAICNkKAAAICNoKAAAICNsKAAAICNwKAAAICN0KAAAICN4KAAAICN8KAAAICOAKAAAICOEKAAAICOIKAAAICOMKAAAICOQKAAAICOUKAAAICOYKAAAICOcKAAAICOgKAAAICOkKAAAICOoKAAAICOsKAAAICOwKAAAICO0KAAAICO4KAAAICO8KAAAICPAKAAAICPEKAAAICPIKAAAICPMKAAAICPQKAAAICPUKAAAICPYKAAAICPcKAAAICPgKAAAICPkKAAAICPoKAAAICPsKAAAICPwKAAAICP0KAAAICP4KAAAICP8KAAAICAALAAAICAELAAAICAILAAAICAMLAAAICAQLAAAICAULAAAICAYLAAAICAcLAAAICAgLAAAICAkLAAAICAoLAAAICAsLAAAICAwLAAAICA0LAAAICA4LAAAICA8LAAAICBALAAAICBELAAAICBILAAAICBMLAAAICBQLAAAICBULAAAICBYLAAAICBcLAAAICBgLAAAICBkLAAAICBoLAAAICBsLAAAICBwLAAAICB0LAAAICB4LAAAICB8LAAAICCALAAAICCELAAAICCILAAAICCMLAAAICCQLAAAICCULAAAICCYLAAAICCcLAAAICCgLAAAICCkLAAAICCoLAAAICCsLAAAICCwLAAAICC0LAAAICC4LAAAICC8LAAAICDALAAAICDELAAAICDILAAAICDMLAAAICDQLAAAICDULAAAICDYLAAAICDcLAAAICDgLAAAICDkLAAAICDoLAAAICDsLAAAICDwLAAAICD0LAAAICD4LAAAICD8LAAAICEALAAAICEELAAAICEILAAAICEMLAAAICEQLAAAICEULAAAICEYLAAAICEcLAAAICEgLAAAICEkLAAAICEoLAAAICEsLAAAICEwLAAAICE0LAAAICE4LAAAICE8LAAAICFALAAAICFELAAAICFILAAAICFMLAAAICFQLAAAICFULAAAICFYLAAAICFcLAAAICFgLAAAICFkLAAAICFoLAAAICFsLAAAICFwLAAAICF0LAAAICF4LAAAICF8LAAAICGALAAAICGELAAAICGILAAAICGMLAAAICGQLAAAICGULAAAICGYLAAAICGcLAAAICGgLAAAICGkLAAAICGoLAAAICGsLAAAICGwLAAAICG0LAAAICG4LAAAICG8LAAAICHALAAAICHELAAAICHILAAAICHMLAAAICHQLAAAICHULAAAICHYLAAAICHcLAAAICHgLAAAICHkLAAAICHoLAAAICHsLAAAICHwLAAAICH0LAAAICH4LAAAICH8LAAAICIALAAAICIELAAAICIILAAAICIMLAAAICIQLAAAICIULAAAICIYLAAAICIcLAAAICIgLAAAICIkLAAAICIoLAAAICIsLAAAICIwLAAAICI0LAAAICI4LAAAICI8LAAAICJALAAAICJELAAAICJILAAAICJMLAAAICJQLAAAICJULAAAICJYLAAAICJcLAAAICJgLAAAICJkLAAAICJoLAAAICJsLAAAICJwLAAAICJ0LAAAICJ4LAAAICJ8LAAAICKALAAAICKELAAAICKILAAAICKMLAAAICKQLAAAICKULAAAICKYLAAAICKcLAAAICKgLAAAICKkLAAAICKoLAAAICKsLAAAICKwLAAAICK0LAAAICK4LAAAICK8LAAAICLALAAAICLELAAAICLILAAAICLMLAAAICLQLAAAICLULAAAICLYLAAAICLcLAAAICLgLAAAICLkLAAAICLoLAAAICLsLAAAICLwLAAAICL0LAAAICL4LAAAICL8LAAAICMALAAAICMELAAAICMILAAAICMMLAAAICMQLAAAICMULAAAICMYLAAAICMcLAAAICMgLAAAICMkLAAAICMoLAAAICMsLAAAICMwLAAAICM0LAAAICM4LAAAICM8LAAAICNALAAAICNELAAAICNILAAAICNMLAAAICNQLAAAICNULAAAICNYLAAAICNcLAAAICNgLAAAICNkLAAAICNoLAAAICNsLAAAICNwLAAAICN0LAAAICN4LAAAICN8LAAAICOALAAAICOELAAAICOILAAAICOMLAAAICOQLAAAICOULAAAICOYLAAAICOcLAAAICOgLAAAICOkLAAAICOoLAAAICOsLAAAICOwLAAAICO0LAAAICO4LAAAICO8LAAAICPALAAAICPELAAAICPILAAAICPMLAAAICPQLAAAICPULAAAICPYLAAAICPcLAAAICPgLAAAICPkLAAAICPoLAAAICPsLAAAICPwLAAAICP0LAAAICP4LAAAICP8LAAAICAAMAAAICAEMAAAICAIMAAAICAMMAAAICAQMAAAICAUMAAAICAYMAAAICAcMAAAICAgMAAAICAkMAAAICAoMAAAICAsMAAAICAwMAAAICA0MAAAICA4MAAAICA8MAAAICBAMAAAICBEMAAAICBIMAAAICBMMAAAICBQMAAAICBUMAAAICBYMAAAICBcMAAAICBgMAAAICBkMAAAICBoMAAAICBsMAAAICBwMAAAICB0MAAAICB4MAAAICB8MAAAICCAMAAAICCEMAAAICCIMAAAICCMMAAAICCQMAAAICCUMAAAICCYMAAAICCcMAAAICCgMAAAICCkMAAAICCoMAAAICCsMAAAICCwMAAAICC0MAAAICC4MAAAICC8MAAAICDAMAAAICDEMAAAICDIMAAAICDMMAAAICDQMAAAICDUMAAAICDYMAAAICDcMAAAICDgMAAAICDkMAAAICDoMAAAICDsMAAAICDwMAAAICD0MAAAICD4MAAAICD8MAAAICEAMAAAICEEMAAAICEIMAAAICEMMAAAICEQMAAAICEUMAAAICEYMAAAICEcMAAAICEgMAAAICEkMAAAICEoMAAAICEsMAAAICEwMAAAICE0MAAAICE4MAAAICE8MAAAICFAMAAAICFEMAAAICFIMAAAICFMMAAAICFQMAAAICFUMAAAICFYMAAAICFcMAAAICFgMAAAICFkMAAAICFoMAAAICFsMAAAICFwMAAAICF0MAAAICF4MAAAICF8MAAAICGAMAAAICGEMAAAICGIMAAAICGMMAAAICGQMAAAICGUMAAAICGYMAAAICGcMAAAICGgMAAAICGkMAAAICGoMAAAICGsMAAAICGwMAAAICG0MAAAICG4MAAAICG8MAAAICHAMAAAICHEMAAAICHIMAAAICHMMAAAICHQMAAAICHUMAAAICHYMAAAICHcMAAAICHgMAAAICHkMAAAICHoMAAAICHsMAAAICHwMAAAICH0MAAAICH4MAAAICH8MAAAICIAMAAAICIEMAAAICIIMAAAICIMMAAAICIQMAAAICIUMAAAICIYMAAAICIcMAAAICIgMAAAICIkMAAAICIoMAAAICIsMAAAICIwMAAAICI0MAAAICI4MAAAICI8MAAAICJAMAAAICJEMAAAICJIMAAAICJMMAAAICJQMAAAICJUMAAAICJYMAAAICJcMAAAICJgMAAAICJkMAAAICJoMAAAICJsMAAAICJwMAAAICJ0MAAAICJ4MAAAICJ8MAAAICKAMAAAICKEMAAAICKIMAAAICKMMAAAICKQMAAAICKUMAAAICKYMAAAICKcMAAAICKgMAAAICKkMAAAICKoMAAAICKsMAAAICKwMAAAICK0MAAAICK4MAAAICK8MAAAICLAMAAAICLEMAAAICLIMAAAICLMMAAAICLQMAAAICLUMAAAICLYMAAAICLcMAAAICLgMAAAICLkMAAAICLoMAAAICLsMAAAICLwMAAAICL0MAAAICL4MAAAICL8MAAAICMAMAAAICMEMAAAICMIMAAAICMMMAAAICMQMAAAICMUMAAAICMYMAAAICMcMAAAICMgMAAAICMkMAAAICMoMAAAICMsMAAAICMwMAAAICM0MAAAICM4MAAAICM8MAAAICNAMAAAICNEMAAAICNIMAAAICNMMAAAICNQMAAAICNUMAAAICNYMAAAICNcMAAAICNgMAAAICNkMAAAICNoMAAAICNsMAAAICNwMAAAICN0MAAAICN4MAAAICN8MAAAICOAMAAAICOEMAAAICOIMAAAICOMMAAAICOQMAAAICOUMAAAICOYMAAAICOcMAAAICOgMAAAICOkMAAAICOoMAAAICOsMAAAICOwMAAAICO0MAAAICO4MAAAICO8MAAAICPAMAAAICPEMAAAICPIMAAAICPMMAAAICPQMAAAICPUMAAAICPYMAAAICPcMAAAICPgMAAAICPkMAAAICPoMAAAICPsMAAAICPwMAAAICP0MAAAICP4MAAAICP8MAAAICAANAAAICAENAAAICAINAAAICAMNAAAICAQNAAAICAUNAAAICAYNAAAICAcNAAAICAgNAAAICAkNAAAICAoNAAAICAsNAAAICAwNAAAICA0NAAAICA4NAAAICA8NAAAICBANAAAICBENAAAICBINAAAICBMNAAAICBQNAAAICBUNAAAICBYNAAAICBcNAAAICBgNAAAICBkNAAAICBoNAAAICBsNAAAICBwNAAAICB0NAAAICB4NAAAICB8NAAAICCANAAAICCENAAAICCINAAAICCMNAAAICCQNAAAICCUNAAAICCYNAAAICCcNAAAICCgNAAAICCkNAAAICCoNAAAICCsNAAAICCwNAAAICC0NAAAICC4NAAAICC8NAAAICDANAAAICDENAAAICDINAAAICDMNAAAICDQNAAAICDUNAAAICDYNAAAICDcNAAAICDgNAAAICDkNAAAICDoNAAAICDsNAAAICDwNAAAICD0NAAAICD4NAAAICD8NAAAICEANAAAICEENAAAICEINAAAICEMNAAAICEQNAAAICEUNAAAICEYNAAAICEcNAAAICEgNAAAICEkNAAAICEoNAAAICEsNAAAICEwNAAAICE0NAAAICE4NAAAICE8NAAAICFANAAAICFENAAAICFINAAAICFMNAAAICFQNAAAICFUNAAAICFYNAAAICFcNAAAICFgNAAAICFkNAAAICFoNAAAICFsNAAAICFwNAAAICF0NAAAICF4NAAAICF8NAAAICGANAAAICGENAAAICGINAAAICGMNAAAICGQNAAAICGUNAAAICGYNAAAICGcNAAAICGgNAAAICGkNAAAICGoNAAAICGsNAAAICGwNAAAICG0NAAAICG4NAAAICG8NAAAICHANAAAICHENAAAICHINAAAICHMNAAAICHQNAAAICHUNAAAICHYNAAAICHcNAAAICHgNAAAICHkNAAAICHoNAAAICHsNAAAICHwNAAAICH0NAAAICH4NAAAICH8NAAAICIANAAAICIENAAAICIINAAAICIMNAAAICIQNAAAICIUNAAAICIYNAAAICIcNAAAICIgNAAAICIkNAAAICIoNAAAICIsNAAAICIwNAAAICI0NAAAICI4NAAAICI8NAAAICJANAAAICJENAAAICJINAAAICJMNAAAICJQNAAAICJUNAAAICJYNAAAICJcNAAAICJgNAAAICJkNAAAICJoNAAAICJsNAAAICJwNAAAICJ0NAAAICJ4NAAAICJ8NAAAICKANAAAICKENAAAICKINAAAICKMNAAAICKQNAAAICKUNAAAICKYNAAAICKcNAAAICKgNAAAICKkNAAAICKoNAAAICKsNAAAICKwNAAAICK0NAAAICK4NAAAICK8NAAAICLANAAAICLENAAAICLINAAAICLMNAAAICLQNAAAICLUNAAAICLYNAAAICLcNAAAICLgNAAAICLkNAAAICLoNAAAICLsNAAAICLwNAAAICL0NAAAICL4NAAAICL8NAAAICMANAAAICMENAAAICMINAAAICMMNAAAICMQNAAAICMUNAAAICMYNAAAICMcNAAAICMgNAAAICMkNAAAICMoNAAAICMsNAAAICMwNAAAICM0NAAAICM4NAAAICM8NAAAICNANAAAICNENAAAICNINAAAICNMNAAAICNQNAAAICNUNAAAICNYNAAAICNcNAAAICNgNAAAICNkNAAAICNoNAAAICNsNAAAICNwNAAAICN0NAAAICN4NAAAICN8NAAAICOANAAAICOENAAAICOINAAAICOMNAAAICOQNAAAICOUNAAAICOYNAAAICOcNAAAICOgNAAAICOkNAAAICOoNAAAICOsNAAAICOwNAAAICO0NAAAICO4NAAAICO8NAAAICPANAAAICPENAAAICPINAAAICPMNAAAICPQNAAAICPUNAAAICPYNAAAICPcNAAAICPgNAAAICPkNAAAICPoNAAAICPsNAAAICPwNAAAICP0NAAAICP4NAAAICP8NAAAICAAOAAAICAEOAAAICAIOAAAICAMOAAAICAQOAAAICAUOAAAICAYOAAAICAcOAAAICAgOAAAICAkOAAAICAoOAAAICAsOAAAICAwOAAAICA0OAAAICA4OAAAICA8OAAAICBAOAAAICBEOAAAICBIOAAAICBMOAAAICBQOAAAICBUOAAAICBYOAAAICBcOAAAICBgOAAAICBkOAAAICBoOAAAICBsOAAAICBwOAAAICB0OAAAICB4OAAAICB8OAAAICCAOAAAICCEOAAAICCIOAAAICCMOAAAICCQOAAAICCUOAAAICCYOAAAICCcOAAAICCgOAAAICCkOAAAICCoOAAAICCsOAAAICCwOAAAICC0OAAAICC4OAAAICC8OAAAICDAOAAAICDEOAAAICDIOAAAICDMOAAAICDQOAAAICDUOAAAICDYOAAAICDcOAAAICDgOAAAICDkOAAAICDoOAAAICDsOAAAICDwOAAAICD0OAAAICD4OAAAICD8OAAAICEAOAAAICEEOAAAICEIOAAAICEMOAAAICEQOAAAICEUOAAAICEYOAAAICEcOAAAICEgOAAAICEkOAAAICEoOAAAICEsOAAAICEwOAAAICE0OAAAICE4OAAAICE8OAAAICFAOAAAICFEOAAAICFIOAAAICFMOAAAICFQOAAAICFUOAAAICFYOAAAICFcOAAAICFgOAAAICFkOAAAICFoOAAAICFsOAAAICFwOAAAICF0OAAAICF4OAAAICF8OAAAICGAOAAAICGEOAAAICGIOAAAICGMOAAAICGQOAAAICGUOAAAICGYOAAAICGcOAAAICGgOAAAICGkOAAAICGoOAAAICGsOAAAICGwOAAAICG0OAAAICG4OAAAICG8OAAAICHAOAAAICHEOAAAICHIOAAAICHMOAAAICHQOAAAICHUOAAAICHYOAAAICHcOAAAICHgOAAAICHkOAAAICHoOAAAICHsOAAAICHwOAAAICH0OAAAICH4OAAAICH8OAAAICIAOAAAICIEOAAAICIIOAAAICIMOAAAICIQOAAAICIUOAAAICIYOAAAICIcOAAAICIgOAAAICIkOAAAICIoOAAAICIsOAAAICIwOAAAICI0OAAAICI4OAAAICI8OAAAICJAOAAAICJEOAAAICJIOAAAICJMOAAAICJQOAAAICJUOAAAICJYOAAAICJcOAAAICJgOAAAICJkOAAAICJoOAAAICJsOAAAICJwOAAAICJ0OAAAICJ4OAAAICJ8OAAAICKAOAAAICKEOAAAICKIOAAAICKMOAAAICKQOAAAICKUOAAAICKYOAAAICKcOAAAICKgOAAAICKkOAAAICKoOAAAICKsOAAAICKwOAAAICK0OAAAICK4OAAAICK8OAAAICLAOAAAICLEOAAAICLIOAAAICLMOAAAICLQOAAAICLUOAAAICLYOAAAICLcOAAAICLgOAAAICLkOAAAICLoOAAAICLsOAAAICLwOAAAICL0OAAAICL4OAAAICL8OAAAICMAOAAAICMEOAAAICMIOAAAICMMOAAAICMQOAAAICMUOAAAICMYOAAAICMcOAAAICMgOAAAICMkOAAAICMoOAAAICMsOAAAICMwOAAAICM0OAAAICM4OAAAICM8OAAAICNAOAAAICNEOAAAICNIOAAAICNMOAAAICNQOAAAICNUOAAAICNYOAAAICNcOAAAICNgOAAAICNkOAAAICNoOAAAICNsOAAAICNwOAAAICN0OAAAICN4OAAAICN8OAAAICOAOAAAICOEOAAAICOIOAAAICOMOAAAICOQOAAAICOUOAAAICOYOAAAICOcOAAAICOgOAAAICOkOAAAICOoOAAAICOsOAAAICOwOAAAICO0OAAAICO4OAAAICO8OAAAICPAOAAAICPEOAAAICPIOAAAICPMOAAAICPQOAAAICPUOAAAICPYOAAAICPcOAAAICPgOAAAICPkOAAAICPoOAAAICPsOAAAICPwOAAAICP0OAAAICP4OAAAICP8OAAAICAAPAAAICAEPAAAICAIPAAAICAMPAAAICAQPAAAICAUPAAAICAYPAAAICAcPAAAICAgPAAAICAkPAAAICAoPAAAICAsPAAAICAwPAAAICA0PAAAICA4PAAAICA8PAAAICBAPAAAICBEPAAAICBIPAAAICBMPAAAICBQPAAAICBUPAAAICBYPAAAICBcPAAAICBgPAAAICBkPAAAICBoPAAAICBsPAAAICBwPAAAICB0PAAAICB4PAAAICB8PAAAICCAPAAAICCEPAAAICCIPAAAICCMPAAAICCQPAAAICCUPAAAICCYPAAAICCcPAAAICCgPAAAICCkPAAAICCoPAAAICCsPAAAICCwPAAAICC0PAAAICC4PAAAICC8PAAAICDAPAAAICDEPAAAICDIPAAAICDMPAAAICDQPAAAICDUPAAAICDYPAAAICDcPAAAICDgPAAAICDkPAAAICDoPAAAICDsPAAAICDwPAAAICD0PAAAICD4PAAAICD8PAAAICEAPAAAICEEPAAAICEIPAAAICEMPAAAICEQPAAAICEUPAAAICEYPAAAICEcPAAAICEgPAAAICEkPAAAICEoPAAAICEsPAAAICEwPAAAICE0PAAAICE4PAAAICE8PAAAICFAPAAAICFEPAAAICFIPAAAICFMPAAAICFQPAAAICFUPAAAICFYPAAAICFcPAAAICFgPAAAICFkPAAAICFoPAAAICFsPAAAICFwPAAAICF0PAAAICF4PAAAICF8PAAAICGAPAAAICGEPAAAICGIPAAAICGMPAAAICGQPAAAICGUPAAAICGYPAAAICGcPAAAICGgPAAAICGkPAAAICGoPAAAICGsPAAAICGwPAAAICG0PAAAICG4PAAAICG8PAAAICHAPAAAICHEPAAAICHIPAAAICHMPAAAICHQPAAAICHUPAAAICHYPAAAICHcPAAAICHgPAAAICHkPAAAICHoPAAAICHsPAAAICHwPAAAICH0PAAAICH4PAAAICH8PAAAICIAPAAAICIEPAAAICIIPAAAICIMPAAAICIQPAAAICIUPAAAICIYPAAAICIcPAAAICIgPAAAICIkPAAAICIoPAAAICIsPAAAICIwPAAAICI0PAAAICI4PAAAICI8PAAAICJAPAAAICJEPAAAICJIPAAAICJMPAAAICJQPAAAICJUPAAAICJYPAAAICJcPAAAICJgPAAAICJkPAAAICJoPAAAICJsPAAAICJwPAAAICJ0PAAAICJ4PAAAICJ8PAAAICKAPAAAICKEPAAAICKIPAAAICKMPAAAICKQPAAAICKUPAAAICKYPAAAICKcPAAAICKgPAAAICKkPAAAICKoPAAAICKsPAAAICKwPAAAICK0PAAAICK4PAAAICK8PAAAICLAPAAAICLEPAAAICLIPAAAICLMPAAAICLQPAAAICLUPAAAICLYPAAAICLcPAAAICLgPAAAICLkPAAAICLoPAAAICLsPAAAICLwPAAAICL0PAAAICL4PAAAICL8PAAAICMAPAAAICMEPAAAICMIPAAAICMMPAAAICMQPAAAICMUPAAAICMYPAAAICMcPAAAICMgPAAAICMkPAAAICMoPAAAICMsPAAAICMwPAAAICM0PAAAICM4PAAAICM8PAAAICNAPAAAICNEPAAAICNIPAAAICNMPAAAICNQPAAAICNUPAAAICNYPAAAICNcPAAAICNgPAAAICNkPAAAICNoPAAAICNsPAAAICNwPAAAICN0PAAAICN4PAAAICN8PAAAICOAPAAAICOEPAAAICOIPAAAICOMPAAAICOQPAAAICOUPAAAICOYPAAAICOcPAAAICOgPAAAICOkPAAAICOoPAAAICOsPAAAICOwPAAAICO0PAAAICO4PAAAICO8PAAAICPAPAAAICPEPAAAICPIPAAAICPMPAAAICPQPAAAICPUPAAAICPYPAAAICPcPAAAICPgPAAAICPkPAAAICPoPAAAICPsPAAAICPwPAAAICP0PAAAICP4PAAAICP8PAAAICAAQAAAICAEQAAAICAIQAAAICAMQAAAICAQQAAAICAUQAAAICAYQAAAICAcQAAAICAgQAAAICAkQAAAICAoQAAAICAsQAAAICAwQAAAICA0QAAAICA4QAAAICA8QAAAICBAQAAAICBEQAAAICBIQAAAICBMQAAAICBQQAAAICBUQAAAICBYQAAAICBcQAAAICBgQAAAICBkQAAAICBoQAAAICBsQAAAICBwQAAAICB0QAAAICB4QAAAICB8QAAAICCAQAAAICCEQAAAICCIQAAAICCMQAAAICCQQAAAICCUQAAAICCYQAAAICCcQAAAICCgQAAAICCkQAAAICCoQAAAICCsQAAAICCwQAAAICC0QAAAICC4QAAAICC8QAAAICDAQAAAICDEQAAAICDIQAAAICDMQAAAICDQQAAAICDUQAAAICDYQAAAICDcQAAAICDgQAAAICDkQAAAICDoQAAAICDsQAAAICDwQAAAICD0QAAAICD4QAAAICD8QAAAICEAQAAAICEEQAAAICEIQAAAICEMQAAAICEQQAAAICEUQAAAICEYQAAAICEcQAAAICEgQAAAICEkQAAAICEoQAAAICEsQAAAICEwQAAAICE0QAAAICE4QAAAICE8QAAAICFAQAAAICFEQAAAICFIQAAAICFMQAAAICFQQAAAICFUQAAAICFYQAAAICFcQAAAICFgQAAAICFkQAAAICFoQAAAICFsQAAAICFwQAAAICF0QAAAICF4QAAAICF8QAAAICGAQAAAICGEQAAAICGIQAAAICGMQAAAICGQQAAAICGUQAAAICGYQAAAICGcQAAAICGgQAAAICGkQAAAICGoQAAAICGsQAAAICGwQAAAICG0QAAAICG4QAAAICG8QAAAICHAQAAAICHEQAAAICHIQAAAICHMQAAAICHQQAAAICHUQAAAICHYQAAAICHcQAAAICHgQAAAICHkQAAAICHoQAAAICHsQAAAICHwQAAAICH0QAAAICH4QAAAICH8QAAAICIAQAAAICIEQAAAICIIQAAAICIMQAAAICIQQAAAICIUQAAAICIYQAAAICIcQAAAICIgQAAAICIkQAAAICIoQAAAICIsQAAAICIwQAAAICI0QAAAICI4QAAAICI8QAAAICJAQAAAICJEQAAAICJIQAAAICJMQAAAICJQQAAAICJUQAAAICJYQAAAICJcQAAAICJgQAAAICJkQAAAICJoQAAAICJsQAAAICJwQAAAICJ0QAAAICJ4QAAAICJ8QAAAICKAQAAAICKEQAAAICKIQAAAICKMQAAAICKQQAAAICKUQAAAICKYQAAAICKcQAAAICKgQAAAICKkQAAAICKoQAAAICKsQAAAICKwQAAAICK0QAAAICK4QAAAICK8QAAAICLAQAAAICLEQAAAICLIQAAAICLMQAAAICLQQAAAICLUQAAAICLYQAAAICLcQAAAICLgQAAAICLkQAAAICLoQAAAICLsQAAAICLwQAAAICL0QAAAICL4QAAAICL8QAAAICMAQAAAICMEQAAAICMIQAAAICMMQAAAICMQQAAAICMUQAAAICMYQAAAICMcQAAAICMgQAAAICMkQAAAICMoQAAAICMsQAAAICMwQAAAICM0QAAAICM4QAAAICM8QAAAICNAQAAAICNEQAAAICNIQAAAICNMQAAAICNQQAAAICNUQAAAICNYQAAAICNcQAAAICNgQAAAICNkQAAAICNoQAAAICNsQAAAICNwQAAAICN0QAAAICN4QAAAICN8QAAAICOAQAAAICOEQAAAICOIQAAAICOMQAAAICOQQAAAICOUQAAAICOYQAAAICOcQAAAICOgQAAAICOkQAAAICOoQAAAICOsQAAAICOwQAAAICO0QAAAICO4QAAAICO8QAAAICPAQAAAICPEQAAAICPIQAAAICPMQAAAICPQQAAAICPUQAAAICPYQAAAICPcQAAAICPgQAAAICPkQAAAICPoQAAAICPsQAAAICPwQAAAICP0QAAAICP4QAAAICP8QAAAICAARAAAICAERAAAICAIRAAAICAMRAAAICAQRAAAICAURAAAICAYRAAAICAcRAAAICAgRAAAICAkRAAAICAoRAAAICAsRAAAICAwRAAAICA0RAAAICA4RAAAICA8RAAAICBARAAAICBERAAAICBIRAAAICBMRAAAICBQRAAAICBURAAAICBYRAAAICBcRAAAICBgRAAAICBkRAAAICBoRAAAICBsRAAAICBwRAAAICB0RAAAICB4RAAAICB8RAAAICCARAAAICCERAAAICCIRAAAICCMRAAAICCQRAAAICCURAAAICCYRAAAICCcRAAAICCgRAAAICCkRAAAICCoRAAAICCsRAAAICCwRAAAICC0RAAAICC4RAAAICC8RAAAICDARAAAICDERAAAICDIRAAAICDMRAAAICDQRAAAICDURAAAICDYRAAAICDcRAAAICDgRAAAICDkRAAAICDoRAAAICDsRAAAICDwRAAAICD0RAAAICD4RAAAICD8RAAAICEARAAAICEERAAAICEIRAAAICEMRAAAICEQRAAAICEURAAAICEYRAAAICEcRAAAICEgRAAAICEkRAAAICEoRAAAICEsRAAAICEwRAAAICE0RAAAICE4RAAAICE8RAAAICFARAAAICFERAAAICFIRAAAICFMRAAAICFQRAAAICFURAAAICFYRAAAICFcRAAAICFgRAAAICFkRAAAICFoRAAAICFsRAAAICFwRAAAICF0RAAAICF4RAAAICF8RAAAICGARAAAICGERAAAICGIRAAAICGMRAAAICGQRAAAICGURAAAICGYRAAAICGcRAAAICGgRAAAICGkRAAAICGoRAAAICGsRAAAICGwRAAAICG0RAAAICG4RAAAICG8RAAAICHARAAAICHERAAAICHIRAAAICHMRAAAICHQRAAAICHURAAAICHYRAAAICHcRAAAICHgRAAAICHkRAAAICHoRAAAICHsRAAAICHwRAAAICH0RAAAICH4RAAAICH8RAAAICIARAAAICIERAAAICIIRAAAICIMRAAAICIQRAAAICIURAAAICIYRAAAICIcRAAAICIgRAAAICIkRAAAICIoRAAAICIsRAAAICIwRAAAICI0RAAAICI4RAAAICI8RAAAICJARAAAICJERAAAICJIRAAAICJMRAAAICJQRAAAICJURAAAICJYRAAAICJcRAAAICJgRAAAICJkRAAAICJoRAAAICJsRAAAICJwRAAAICJ0RAAAICJ4RAAAICJ8RAAAICKARAAAICKERAAAICKIRAAAICKMRAAAICKQRAAAICKURAAAICKYRAAAICKcRAAAICKgRAAAICKkRAAAICKoRAAAICKsRAAAICKwRAAAICK0RAAAICK4RAAAICK8RAAAICLARAAAICLERAAAICLIRAAAICLMRAAAICLQRAAAICLURAAAICLYRAAAICLcRAAAICLgRAAAICLkRAAAICLoRAAAICLsRAAAICLwRAAAICL0RAAAICL4RAAAICL8RAAAICMARAAAICMERAAAICMIRAAAICMMRAAAICMQRAAAICMURAAAICMYRAAAICMcRAAAICMgRAAAICMkRAAAICMoRAAAICMsRAAAICMwRAAAICM0RAAAICM4RAAAICM8RAAAICNARAAAICNERAAAICNIRAAAICNMRAAAICNQRAAAICNURAAAICNYRAAAICNcRAAAICNgRAAAICNkRAAAICNoRAAAICNsRAAAICNwRAAAICN0RAAAICN4RAAAICN8RAAAICOARAAAICOERAAAICOIRAAAICOMRAAAICOQRAAAICOURAAAICOYRAAAICOcRAAAICOgRAAAICOkRAAAICOoRAAAICOsRAAAICOwRAAAICO0RAAAICO4RAAAICO8RAAAICPARAAAICPERAAAICPIRAAAICPMRAAAICPQRAAAICPURAAAICPYRAAAICPcRAAAICPgRAAAICPkRAAAICPoRAAAICPsRAAAICPwRAAAICP0RAAAICP4RAAAICP8RAAAICAASAAAICAESAAAICAISAAAICAMSAAAICAQSAAAICAUSAAAICAYSAAAICAcSAAAICAgSAAAICAkSAAAICAoSAAAICAsSAAAICAwSAAAICA0SAAAICA4SAAAICA8SAAAICBASAAAICBESAAAICBISAAAICBMSAAAICBQSAAAICBUSAAAICBYSAAAICBcSAAAICBgSAAAICBkSAAAICBoSAAAICBsSAAAICBwSAAAICB0SAAAICB4SAAAICB8SAAAICCASAAAICCESAAAICCISAAAICCMSAAAICCQSAAAICCUSAAAICCYSAAAICCcSAAAICCgSAAAICCkSAAAICCoSAAAICCsSAAAICCwSAAAICC0SAAAICC4SAAAICC8SAAAICDASAAAICDESAAAICDISAAAICDMSAAAICDQSAAAICDUSAAAICDYSAAAICDcSAAAICDgSAAAICDkSAAAICDoSAAAICDsSAAAICDwSAAAICD0SAAAICD4SAAAICD8SAAAICEASAAAICEESAAAICEISAAAICEMSAAAICEQSAAAICEUSAAAICEYSAAAICEcSAAAICEgSAAAICEkSAAAICEoSAAAICEsSAAAICEwSAAAICE0SAAAICE4SAAAICE8SAAAICFASAAAICFESAAAICFISAAAICFMSAAAICFQSAAAICFUSAAAICFYSAAAICFcSAAAICFgSAAAICFkSAAAICFoSAAAICFsSAAAICFwSAAAICF0SAAAICF4SAAAICF8SAAAICGASAAAICGESAAAICGISAAAICGMSAAAICGQSAAAICGUSAAAICGYSAAAICGcSAAAICGgSAAAICGkSAAAICGoSAAAICGsSAAAICGwSAAAICG0SAAAICG4SAAAICG8SAAAICHASAAAICHESAAAICHISAAAICHMSAAAICHQSAAAICHUSAAAICHYSAAAICHcSAAAICHgSAAAICHkSAAAICHoSAAAICHsSAAAICHwSAAAICH0SAAAICH4SAAAICH8SAAAICIASAAAICIESAAAICIISAAAICIMSAAAICIQSAAAICIUSAAAICIYSAAAICIcSAAAICIgSAAAICIkSAAAICIoSAAAICIsSAAAICIwSAAAICI0SAAAICI4SAAAICI8SAAAICJASAAAICJESAAAICJISAAAICJMSAAAICJQSAAAICJUSAAAICJYSAAAICJcSAAAICJgSAAAICJkSAAAICJoSAAAICJsSAAAICJwSAAAICJ0SAAAICJ4SAAAICJ8SAAAICKASAAAICKESAAAICKISAAAICKMSAAAICKQSAAAICKUSAAAICKYSAAAICKcSAAAICKgSAAAICKkSAAAICKoSAAAICKsSAAAICKwSAAAICK0SAAAICK4SAAAICK8SAAAICLASAAAICLESAAAICLISAAAICLMSAAAICLQSAAAICLUSAAAICLYSAAAICLcSAAAICLgSAAAICLkSAAAICLoSAAAICLsSAAAICLwSAAAICL0SAAAICL4SAAAICL8SAAAICMASAAAICMESAAAICMISAAAICMMSAAAICMQSAAAICMUSAAAICMYSAAAICMcSAAAICMgSAAAICMkSAAAICMoSAAAICMsSAAAICMwSAAAICM0SAAAICM4SAAAICM8SAAAICNASAAAICNESAAAICNISAAAICNMSAAAICNQSAAAICNUSAAAICNYSAAAICNcSAAAICNgSAAAICNkSAAAICNoSAAAICNsSAAAICNwSAAAICN0SAAAICN4SAAAICN8SAAAICOASAAAICOESAAAICOISAAAICOMSAAAICOQSAAAICOUSAAAICOYSAAAICOcSAAAICOgSAAAICOkSAAAICOoSAAAICOsSAAAICOwSAAAICO0SAAAICO4SAAAICO8SAAAICPASAAAICPESAAAICPISAAAICPMSAAAICPQSAAAICPUSAAAICPYSAAAICPcSAAAICPgSAAAICPkSAAAICPoSAAAICPsSAAAICPwSAAAICP0SAAAICP4SAAAICP8SAAAICAATAAAICAETAAAICAITAAAICAMTAAAICAQTAAAICAUTAAAICAYTAAAICAcTAAAICAgTAAAICAkTAAAICAoTAAAICAsTAAAICAwTAAAICA0TAAAICA4TAAAICA8TAAAICBATAAAICBETAAAICBITAAAICBMTAAAICBQTAAAICBUTAAAICBYTAAAICBcTAAAICBgTAAAICBkTAAAICBoTAAAICBsTAAAICBwTAAAICB0TAAAICB4TAAAICB8TAAAICCATAAAICCETAAAICCITAAAICCMTAAAICCQTAAAICCUTAAAICCYTAAAICCcTAAAICCgTAAAICCkTAAAICCoTAAAICCsTAAAICCwTAAAICC0TAAAICC4TAAAICC8TAAAICDATAAAICDETAAAICDITAAAICDMTAAAICDQTAAAICDUTAAAICDYTAAAICDcTAAAICDgTAAAICDkTAAAICDoTAAAICDsTAAAICDwTAAAICD0TAAAICD4TAAAICD8TAAAICEATAAAICEETAAAICEITAAAICEMTAAAICEQTAAAICEUTAAAICEYTAAAICEcTAAAICEgTAAAICEkTAAAICEoTAAAICEsTAAAICEwTAAAICE0TAAAICE4TAAAICE8TAAAICFATAAAICFETAAAICFITAAAICFMTAAAICFQTAAAICFUTAAAICFYTAAAICFcTAAAICFgTAAAICFkTAAAICFoTAAAICFsTAAAICFwTAAAICF0TAAAICF4TAAAICF8TAAAICGATAAAICGETAAAICGITAAAICGMTAAAICGQTAAAICGUTAAAICGYTAAAICGcTAAAICGgTAAAICGkTAAAICGoTAAAICGsTAAAICGwTAAAICG0TAAAICG4TAAAICG8TAAAICHATAAAICHETAAAICHITAAAICHMTAAAICHQTAAAICHUTAAAICHYTAAAICHcTAAAICHgTAAAICHkTAAAICHoTAAAICHsTAAAICHwTAAAICH0TAAAICH4TAAAICH8TAAAICIATAAAICIETAAAICIITAAAICIMTAAAICIQTAAAICIUTAAAICIYTAAAICIcTAAAICIgTAAAICIkTAAAICIoTAAAICIsTAAAICIwTAAAICI0TAAAICI4TAAAICI8TAAAICJATAAAICJETAAAICJITAAAICJMTAAAICJQTAAAICJUTAAAICJYTAAAICJcTAAAICJgTAAAICJkTAAAICJoTAAAICJsTAAAICJwTAAAICJ0TAAAICJ4TAAAICJ8TAAAICKATAAAICKETAAAICKITAAAICKMTAAAICKQTAAAICKUTAAAICKYTAAAICKcTAAAICKgTAAAICKkTAAAICKoTAAAICKsTAAAICKwTAAAICK0TAAAICK4TAAAICK8TAAAICLATAAAICLETAAAICLITAAAICLMTAAAICLQTAAAICLUTAAAICLYTAAAICLcTAAAICLgTAAAICLkTAAAICLoTAAAICLsTAAAICLwTAAAICL0TAAAICL4TAAAICL8TAAAICMATAAAICMETAAAICMITAAAICMMTAAAICMQTAAAICMUTAAAICMYTAAAICMcTAAAICMgTAAAICMkTAAAICMoTAAAICMsTAAAICMwTAAAICM0TAAAICM4TAAAICM8TAAAICNATAAAICNETAAAICNITAAAICNMTAAAICNQTAAAICNUTAAAICNYTAAAICNcTAAAICNgTAAAICNkTAAAICNoTAAAICNsTAAAICNwTAAAICN0TAAAICN4TAAAICN8TAAAICOATAAAICOETAAAICOITAAAICOMTAAAICOQTAAAICOUTAAAICOYTAAAICOcTAAAICOgTAAAICOkTAAAICOoTAAAICOsTAAAICOwTAAAICO0TAAAICO4TAAAICO8TAAAICPATAAAICPETAAAICPITAAAICPMTAAAICPQTAAAICPUTAAAICPYTAAAICPcTAAAICPgTAAAICPkTAAAICPoTAAAICPsTAAAICPwTAAAICP0TAAAICP4TAAAICP8TAAAICAAUAAAICAEUAAAICAIUAAAICAMUAAAICAQUAAAICAUUAAAICAYUAAAICAcUAAAICAgUAAAICAkUAAAICAoUAAAICAsUAAAICAwUAAAICA0UAAAICA4UAAAICA8UAAAICBAUAAAICBEUAAAICBIUAAAICBMUAAAICBQUAAAICBUUAAAICBYUAAAICBcUAAAICBgUAAAICBkUAAAICBoUAAAICBsUAAAICBwUAAAICB0UAAAICB4UAAAICB8UAAAICCAUAAAICCEUAAAICCIUAAAICCMUAAAICCQUAAAICCUUAAAICCYUAAAICCcUAAAICCgUAAAICCkUAAAICCoUAAAICCsUAAAICCwUAAAICC0UAAAICC4UAAAICC8UAAAICDAUAAAICDEUAAAICDIUAAAICDMUAAAICDQUAAAICDUUAAAICDYUAAAICDcUAAAICDgUAAAICDkUAAAICDoUAAAICDsUAAAICDwUAAAICD0UAAAICD4UAAAICD8UAAAICEAUAAAICEEUAAAICEIUAAAICEMUAAAICEQUAAAICEUUAAAICEYUAAAICEcUAAAICEgUAAAICEkUAAAICEoUAAAICEsUAAAICEwUAAAICE0UAAAICE4UAAAICE8UAAAICFAUAAAICFEUAAAICFIUAAAICFMUAAAICFQUAAAICFUUAAAICFYUAAAICFcUAAAICFgUAAAICFkUAAAICFoUAAAICFsUAAAICFwUAAAICF0UAAAICF4UAAAICF8UAAAICGAUAAAICGEUAAAICGIUAAAICGMUAAAICGQUAAAICGUUAAAICGYUAAAICGcUAAAICGgUAAAICGkUAAAICGoUAAAICGsUAAAICGwUAAAICG0UAAAICG4UAAAICG8UAAAICHAUAAAICHEUAAAICHIUAAAICHMUAAAICHQUAAAICHUUAAAICHYUAAAICHcUAAAICHgUAAAICHkUAAAICHoUAAAICHsUAAAICHwUAAAICH0UAAAICH4UAAAICH8UAAAICIAUAAAICIEUAAAICIIUAAAICIMUAAAICIQUAAAICIUUAAAICIYUAAAICIcUAAAICIgUAAAICIkUAAAICIoUAAAICIsUAAAICIwUAAAICI0UAAAICI4UAAAICI8UAAAICJAUAAAICJEUAAAICJIUAAAICJMUAAAICJQUAAAICJUUAAAICJYUAAAICJcUAAAICJgUAAAICJkUAAAICJoUAAAICJsUAAAICJwUAAAICJ0UAAAICJ4UAAAICJ8UAAAICKAUAAAICKEUAAAICKIUAAAICKMUAAAICKQUAAAICKUUAAAICKYUAAAICKcUAAAICKgUAAAICKkUAAAICKoUAAAICKsUAAAICKwUAAAICK0UAAAICK4UAAAICK8UAAAICLAUAAAICLEUAAAICLIUAAAICLMUAAAICLQUAAAICLUUAAAICLYUAAAICLcUAAAICLgUAAAICLkUAAAICLoUAAAICLsUAAAICLwUAAAICL0UAAAICL4UAAAICL8UAAAICMAUAAAICMEUAAAICMIUAAAICMMUAAAICMQUAAAICMUUAAAICMYUAAAICMcUAAAICMgUAAAICMkUAAAICMoUAAAICMsUAAAICMwUAAAICM0UAAAICM4UAAAICM8UAAAICNAUAAAICNEUAAAICNIUAAAICNMUAAAICNQUAAAICNUUAAAICNYUAAAICNcUAAAICNgUAAAICNkUAAAICNoUAAAICNsUAAAICNwUAAAICN0UAAAICN4UAAAICN8UAAAICOAUAAAICOEUAAAICOIUAAAICOMUAAAICOQUAAAICOUUAAAICOYUAAAICOcUAAAICOgUAAAICOkUAAAICOoUAAAICOsUAAAICOwUAAAICO0UAAAICO4UAAAICO8UAAAICPAUAAAICPEUAAAICPIUAAAICPMUAAAICPQUAAAICPUUAAAICPYUAAAICPcUAAAICPgUAAAICPkUAAAICPoUAAAICPsUAAAICPwUAAAICP0UAAAICP4UAAAICP8UAAAICAAVAAAICAEVAAAICAIVAAAICAMVAAAICAQVAAAICAUVAAAICAYVAAAICAcVAAAICAgVAAAICAkVAAAICAoVAAAICAsVAAAICAwVAAAICA0VAAAICA4VAAAICA8VAAAICBAVAAAICBEVAAAICBIVAAAICBMVAAAICBQVAAAICBUVAAAICBYVAAAICBcVAAAICBgVAAAICBkVAAAICBoVAAAICBsVAAAICBwVAAAICB0VAAAICB4VAAAICB8VAAAICCAVAAAICCEVAAAICCIVAAAICCMVAAAICCQVAAAICCUVAAAICCYVAAAICCcVAAAICCgVAAAICCkVAAAICCoVAAAICCsVAAAICCwVAAAICC0VAAAICC4VAAAICC8VAAAICDAVAAAICDEVAAAICDIVAAAICDMVAAAICDQVAAAICDUVAAAICDYVAAAICDcVAAAICDgVAAAICDkVAAAICDoVAAAICDsVAAAICDwVAAAICD0VAAAICD4VAAAICD8VAAAICEAVAAAICEEVAAAICEIVAAAICEMVAAAICEQVAAAICEUVAAAICEYVAAAICEcVAAAICEgVAAAICEkVAAAICEoVAAAICEsVAAAICEwVAAAICE0VAAAICE4VAAAICE8VAAAICFAVAAAICFEVAAAICFIVAAAICFMVAAAICFQVAAAICFUVAAAICFYVAAAICFcVAAAICFgVAAAICFkVAAAICFoVAAAICFsVAAAICFwVAAAICF0VAAAICF4VAAAICF8VAAAICGAVAAAICGEVAAAICGIVAAAICGMVAAAICGQVAAAICGUVAAAICGYVAAAICGcVAAAICGgVAAAICGkVAAAICGoVAAAICGsVAAAICGwVAAAICG0VAAAICG4VAAAICG8VAAAICHAVAAAICHEVAAAICHIVAAAICHMVAAAICHQVAAAICHUVAAAICHYVAAAICHcVAAAICHgVAAAICHkVAAAICHoVAAAICHsVAAAICHwVAAAICH0VAAAICH4VAAAICH8VAAAICIAVAAAICIEVAAAICIIVAAAICIMVAAAICIQVAAAICIUVAAAICIYVAAAICIcVAAAICIgVAAAICIkVAAAICIoVAAAICIsVAAAICIwVAAAICI0VAAAICI4VAAAICI8VAAAICJAVAAAICJEVAAAICJIVAAAICJMVAAAICJQVAAAICJUVAAAICJYVAAAICJcVAAAICJgVAAAICJkVAAAICJoVAAAICJsVAAAICJwVAAAICJ0VAAAICJ4VAAAICJ8VAAAICKAVAAAICKEVAAAICKIVAAAICKMVAAAICKQVAAAICKUVAAAICKYVAAAICKcVAAAICKgVAAAICKkVAAAICKoVAAAICKsVAAAICKwVAAAICK0VAAAICK4VAAAICK8VAAAICLAVAAAICLEVAAAICLIVAAAICLMVAAAICLQVAAAICLUVAAAICLYVAAAICLcVAAAICLgVAAAICLkVAAAICLoVAAAICLsVAAAICLwVAAAICL0VAAAICL4VAAAICL8VAAAICMAVAAAICMEVAAAICMIVAAAICMMVAAAICMQVAAAICMUVAAAICMYVAAAICMcVAAAICMgVAAAICMkVAAAICMoVAAAICMsVAAAICMwVAAAICM0VAAAICM4VAAAICM8VAAAICNAVAAAICNEVAAAICNIVAAAICNMVAAAICNQVAAAICNUVAAAICNYVAAAICNcVAAAICNgVAAAICNkVAAAICNoVAAAICNsVAAAICNwVAAAICN0VAAAICN4VAAAICN8VAAAICOAVAAAICOEVAAAICOIVAAAICOMVAAAICOQVAAAICOUVAAAICOYVAAAICOcVAAAICOgVAAAICOkVAAAICOoVAAAICOsVAAAICOwVAAAICO0VAAAICO4VAAAICO8VAAAICPAVAAAICPEVAAAICPIVAAAICPMVAAAICPQVAAAICPUVAAAICPYVAAAICPcVAAAICPgVAAAICPkVAAAICPoVAAAICPsVAAAICPwVAAAICP0VAAAICP4VAAAICP8VAAAICAAWAAAICAEWAAAICAIWAAAICAMWAAAICAQWAAAICAUWAAAICAYWAAAICAcWAAAICAgWAAAICAkWAAAICAoWAAAICAsWAAAICAwWAAAICA0WAAAICA4WAAAICA8WAAAICBAWAAAICBEWAAAICBIWAAAICBMWAAAICBQWAAAICBUWAAAICBYWAAAICBcWAAAICBgWAAAICBkWAAAICBoWAAAICBsWAAAICBwWAAAICB0WAAAICB4WAAAICB8WAAAICCAWAAAICCEWAAAICCIWAAAICCMWAAAICCQWAAAICCUWAAAICCYWAAAICCcWAAAICCgWAAAICCkWAAAICCoWAAAICCsWAAAICCwWAAAICC0WAAAICC4WAAAICC8WAAAICDAWAAAICDEWAAAICDIWAAAICDMWAAAICDQWAAAICDUWAAAICDYWAAAICDcWAAAICDgWAAAICDkWAAAICDoWAAAICDsWAAAICDwWAAAICD0WAAAICD4WAAAICD8WAAAICEAWAAAICEEWAAAICEIWAAAICEMWAAAICEQWAAAICEUWAAAICEYWAAAICEcWAAAICEgWAAAICEkWAAAICEoWAAAICEsWAAAICEwWAAAICE0WAAAICE4WAAAICE8WAAAICFAWAAAICFEWAAAICFIWAAAICFMWAAAICFQWAAAICFUWAAAICFYWAAAICFcWAAAICFgWAAAICFkWAAAICFoWAAAICFsWAAAICFwWAAAICF0WAAAICF4WAAAICF8WAAAICGAWAAAICGEWAAAICGIWAAAICGMWAAAICGQWAAAICGUWAAAICGYWAAAICGcWAAAICGgWAAAICGkWAAAICGoWAAAICGsWAAAICGwWAAAICG0WAAAICG4WAAAICG8WAAAICHAWAAAICHEWAAAICHIWAAAICHMWAAAICHQWAAAICHUWAAAICHYWAAAICHcWAAAICHgWAAAICHkWAAAICHoWAAAICHsWAAAICHwWAAAICH0WAAAICH4WAAAICH8WAAAICIAWAAAICIEWAAAICIIWAAAICIMWAAAICIQWAAAICIUWAAAICIYWAAAICIcWAAAICIgWAAAICIkWAAAICIoWAAAICIsWAAAICIwWAAAICI0WAAAICI4WAAAICI8WAAAICJAWAAAICJEWAAAICJIWAAAICJMWAAAICJQWAAAICJUWAAAICJYWAAAICJcWAAAICJgWAAAICJkWAAAICJoWAAAICJsWAAAICJwWAAAICJ0WAAAICJ4WAAAICJ8WAAAICKAWAAAICKEWAAAICKIWAAAICKMWAAAICKQWAAAICKUWAAAICKYWAAAICKcWAAAICKgWAAAICKkWAAAICKoWAAAICKsWAAAICKwWAAAICK0WAAAICK4WAAAICK8WAAAICLAWAAAICLEWAAAICLIWAAAICLMWAAAICLQWAAAICLUWAAAICLYWAAAICLcWAAAICLgWAAAICLkWAAAICLoWAAAICLsWAAAICLwWAAAICL0WAAAICL4WAAAICL8WAAAICMAWAAAICMEWAAAICMIWAAAICMMWAAAICMQWAAAICMUWAAAICMYWAAAICMcWAAAICMgWAAAICMkWAAAICMoWAAAICMsWAAAICMwWAAAICM0WAAAICM4WAAAICM8WAAAICNAWAAAICNEWAAAICNIWAAAICNMWAAAICNQWAAAICNUWAAAICNYWAAAICNcWAAAICNgWAAAICNkWAAAICNoWAAAICNsWAAAICNwWAAAICN0WAAAICN4WAAAICN8WAAAICOAWAAAICOEWAAAICOIWAAAICOMWAAAICOQWAAAICOUWAAAICOYWAAAICOcWAAAICOgWAAAICOkWAAAICOoWAAAICOsWAAAICOwWAAAICO0WAAAICO4WAAAICO8WAAAICPAWAAAICPEWAAAICPIWAAAICPMWAAAICPQWAAAICPUWAAAICPYWAAAICPcWAAAICPgWAAAICPkWAAAICPoWAAAICPsWAAAICPwWAAAICP0WAAAICP4WAAAICP8WAAAICAAXAAAICAEXAAAICAIXAAAICAMXAAAICAQXAAAICAUXAAAICAYXAAAICAcXAAAICAgXAAAICAkXAAAICAoXAAAICAsXAAAICAwXAAAICA0XAAAICA4XAAAICA8XAAAICBAXAAAICBEXAAAICBIXAAAICBMXAAAICBQXAAAICBUXAAAICBYXAAAICBcXAAAICBgXAAAICBkXAAAICBoXAAAICBsXAAAICBwXAAAICB0XAAAICB4XAAAICB8XAAAICCAXAAAICCEXAAAICCIXAAAICCMXAAAICCQXAAAICCUXAAAICCYXAAAICCcXAAAICCgXAAAICCkXAAAICCoXAAAICCsXAAAICCwXAAAICC0XAAAICC4XAAAICC8XAAAICDAXAAAICDEXAAAICDIXAAAICDMXAAAICDQXAAAICDUXAAAICDYXAAAICDcXAAAICDgXAAAICDkXAAAICDoXAAAICDsXAAAICDwXAAAICD0XAAAICD4XAAAICD8XAAAICEAXAAAICEEXAAAICEIXAAAICEMXAAAICEQXAAAICEUXAAAICEYXAAAICEcXAAAICEgXAAAICEkXAAAICEoXAAAICEsXAAAICEwXAAAICE0XAAAICE4XAAAICE8XAAAICFAXAAAICFEXAAAICFIXAAAICFMXAAAICFQXAAAICFUXAAAICFYXAAAICFcXAAAICFgXAAAICFkXAAAICFoXAAAICFsXAAAICFwXAAAICF0XAAAICF4XAAAICF8XAAAICGAXAAAICGEXAAAICGIXAAAICGMXAAAICGQXAAAICGUXAAAICGYXAAAICGcXAAAICGgXAAAICGkXAAAICGoXAAAICGsXAAAICGwXAAAICG0XAAAICG4XAAAICG8XAAAICHAXAAAICHEXAAAICHIXAAAICHMXAAAICHQXAAAICHUXAAAICHYXAAAICHcXAAAICHgXAAAICHkXAAAICHoXAAAICHsXAAAICHwXAAAICH0XAAAICH4XAAAICH8XAAAICIAXAAAICIEXAAAICIIXAAAICIMXAAAICIQXAAAICIUXAAAICIYXAAAICIcXAAAICIgXAAAICIkXAAAICIoXAAAICIsXAAAICIwXAAAICI0XAAAICI4XAAAICI8XAAAICJAXAAAICJEXAAAICJIXAAAICJMXAAAICJQXAAAICJUXAAAICJYXAAAICJcXAAAICJgXAAAICJkXAAAICJoXAAAICJsXAAAICJwXAAAICJ0XAAAICJ4XAAAICJ8XAAAICKAXAAAICKEXAAAICKIXAAAICKMXAAAICKQXAAAICKUXAAAICKYXAAAICKcXAAAICKgXAAAICKkXAAAICKoXAAAICKsXAAAICKwXAAAICK0XAAAICK4XAAAICK8XAAAICLAXAAAICLEXAAAICLIXAAAICLMXAAAICLQXAAAICLUXAAAICLYXAAAICLcXAAAICLgXAAAICLkXAAAICLoXAAAICLsXAAAICLwXAAAICL0XAAAICL4XAAAICL8XAAAICMAXAAAICMEXAAAICMIXAAAICMMXAAAICMQXAAAICMUXAAAICMYXAAAICMcXAAAICMgXAAAICMkXAAAICMoXAAAICMsXAAAICMwXAAAICM0XAAAICM4XAAAICM8XAAAICNAXAAAICNEXAAAICNIXAAAICNMXAAAICNQXAAAICNUXAAAICNYXAAAICNcXAAAICNgXAAAICNkXAAAICNoXAAAICNsXAAAICNwXAAAICN0XAAAICN4XAAAICN8XAAAICOAXAAAICOEXAAAICOIXAAAICOMXAAAICOQXAAAICOUXAAAICOYXAAAICOcXAAAICOgXAAAICOkXAAAICOoXAAAICOsXAAAICOwXAAAICO0XAAAICO4XAAAICO8XAAAICPAXAAAICPEXAAAICPIXAAAICPMXAAAICPQXAAAICPUXAAAICPYXAAAICPcXAAAICPgXAAAICPkXAAAICPoXAAAICPsXAAAICPwXAAAICP0XAAAICP4XAAAICP8XAAAICAAYAAAICAEYAAAICAIYAAAICAMYAAAICAQYAAAICAUYAAAICAYYAAAICAcYAAAICAgYAAAICAkYAAAICAoYAAAICAsYAAAICAwYAAAICA0YAAAICA4YAAAICA8YAAAICBAYAAAICBEYAAAICBIYAAAICBMYAAAICBQYAAAICBUYAAAICBYYAAAICBcYAAAICBgYAAAICBkYAAAICBoYAAAICBsYAAAICBwYAAAICB0YAAAICB4YAAAICB8YAAAICCAYAAAICCEYAAAICCIYAAAICCMYAAAICCQYAAAICCUYAAAICCYYAAAICCcYAAAICCgYAAAICCkYAAAICCoYAAAICCsYAAAICCwYAAAICC0YAAAICC4YAAAICC8YAAAICDAYAAAICDEYAAAICDIYAAAICDMYAAAICDQYAAAICDUYAAAICDYYAAAICDcYAAAICDgYAAAICDkYAAAICDoYAAAICDsYAAAICDwYAAAICD0YAAAICD4YAAAICD8YAAAICEAYAAAICEEYAAAICEIYAAAICEMYAAAICEQYAAAICEUYAAAICEYYAAAICEcYAAAICEgYAAAICEkYAAAICEoYAAAICEsYAAAICEwYAAAICE0YAAAICE4YAAAICE8YAAAICFAYAAAICFEYAAAICFIYAAAICFMYAAAICFQYAAAICFUYAAAICFYYAAAICFcYAAAICFgYAAAICFkYAAAICFoYAAAICFsYAAAICFwYAAAICF0YAAAICF4YAAAICF8YAAAICGAYAAAICGEYAAAICGIYAAAICGMYAAAICGQYAAAICGUYAAAICGYYAAAICGcYAAAICGgYAAAICGkYAAAICGoYAAAICGsYAAAICGwYAAAICG0YAAAICG4YAAAICG8YAAAICHAYAAAICHEYAAAICHIYAAAICHMYAAAICHQYAAAICHUYAAAICHYYAAAICHcYAAAICHgYAAAICHkYAAAICHoYAAAICHsYAAAICHwYAAAICH0YAAAICH4YAAAICH8YAAAICIAYAAAICIEYAAAICIIYAAAICIMYAAAICIQYAAAICIUYAAAICIYYAAAICIcYAAAICIgYAAAICIkYAAAICIoYAAAICIsYAAAICIwYAAAICI0YAAAICI4YAAAICI8YAAAICJAYAAAICJEYAAAICJIYAAAICJMYAAAICJQYAAAICJUYAAAICJYYAAAICJcYAAAICJgYAAAICJkYAAAICJoYAAAICJsYAAAICJwYAAAICJ0YAAAICJ4YAAAICJ8YAAAICKAYAAAICKEYAAAICKIYAAAICKMYAAAICKQYAAAICKUYAAAICKYYAAAICKcYAAAICKgYAAAICKkYAAAICKoYAAAICKsYAAAICKwYAAAICK0YAAAICK4YAAAICK8YAAAICLAYAAAICLEYAAAICLIYAAAICLMYAAAICLQYAAAICLUYAAAICLYYAAAICLcYAAAICLgYAAAICLkYAAAICLoYAAAICLsYAAAICLwYAAAICL0YAAAICL4YAAAICL8YAAAICMAYAAAICMEYAAAICMIYAAAICMMYAAAICMQYAAAICMUYAAAICMYYAAAICMcYAAAICMgYAAAICMkYAAAICMoYAAAICMsYAAAICMwYAAAICM0YAAAICM4YAAAICM8YAAAICNAYAAAICNEYAAAICNIYAAAICNMYAAAICNQYAAAICNUYAAAICNYYAAAICNcYAAAICNgYAAAICNkYAAAICNoYAAAICNsYAAAICNwYAAAICN0YAAAICN4YAAAICN8YAAAICOAYAAAICOEYAAAICOIYAAAICOMYAAAICOQYAAAICOUYAAAICOYYAAAICOcYAAAICOgYAAAICOkYAAAICOoYAAAICOsYAAAICOwYAAAICO0YAAAICO4YAAAICO8YAAAICPAYAAAICPEYAAAICPIYAAAICPMYAAAICPQYAAAICPUYAAAICPYYAAAICPcYAAAICPgYAAAICPkYAAAICPoYAAAICPsYAAAICPwYAAAICP0YAAAICP4YAAAICP8YAAAICAAZAAAICAEZAAAICAIZAAAICAMZAAAICAQZAAAICAUZAAAICAYZAAAICAcZAAAICAgZAAAICAkZAAAICAoZAAAICAsZAAAICAwZAAAICA0ZAAAICA4ZAAAICA8ZAAAICBAZAAAICBEZAAAICBIZAAAICBMZAAAICBQZAAAICBUZAAAICBYZAAAICBcZAAAICBgZAAAICBkZAAAICBoZAAAICBsZAAAICBwZAAAICB0ZAAAICB4ZAAAICB8ZAAAICCAZAAAICCEZAAAICCIZAAAICCMZAAAICCQZAAAICCUZAAAICCYZAAAICCcZAAAICCgZAAAICCkZAAAICCoZAAAICCsZAAAICCwZAAAICC0ZAAAICC4ZAAAICC8ZAAAICDAZAAAICDEZAAAICDIZAAAICDMZAAAICDQZAAAICDUZAAAICDYZAAAICDcZAAAICDgZAAAICDkZAAAICDoZAAAICDsZAAAICDwZAAAICD0ZAAAICD4ZAAAICD8ZAAAICEAZAAAICEEZAAAICEIZAAAICEMZAAAICEQZAAAICEUZAAAICEYZAAAICEcZAAAICEgZAAAICEkZAAAICEoZAAAICEsZAAAICEwZAAAICE0ZAAAICE4ZAAAICE8ZAAAICFAZAAAICFEZAAAICFIZAAAICFMZAAAICFQZAAAICFUZAAAICFYZAAAICFcZAAAICFgZAAAICFkZAAAICFoZAAAICFsZAAAICFwZAAAICF0ZAAAICF4ZAAAICF8ZAAAICGAZAAAICGEZAAAICGIZAAAICGMZAAAICGQZAAAICGUZAAAICGYZAAAICGcZAAAICGgZAAAICGkZAAAICGoZAAAICGsZAAAICGwZAAAICG0ZAAAICG4ZAAAICG8ZAAAICHAZAAAICHEZAAAICHIZAAAICHMZAAAICHQZAAAICHUZAAAICHYZAAAICHcZAAAICHgZAAAICHkZAAAICHoZAAAICHsZAAAICHwZAAAICH0ZAAAICH4ZAAAICH8ZAAAICIAZAAAICIEZAAAICIIZAAAICIMZAAAICIQZAAAICIUZAAAICIYZAAAICIcZAAAICIgZAAAICIkZAAAICIoZAAAICIsZAAAICIwZAAAICI0ZAAAICI4ZAAAICI8ZAAAICJAZAAAICJEZAAAICJIZAAAICJMZAAAICJQZAAAICJUZAAAICJYZAAAICJcZAAAICJgZAAAICJkZAAAICJoZAAAICJsZAAAICJwZAAAICJ0ZAAAICJ4ZAAAICJ8ZAAAICKAZAAAICKEZAAAICKIZAAAICKMZAAAICKQZAAAICKUZAAAICKYZAAAICKcZAAAICKgZAAAICKkZAAAICKoZAAAICKsZAAAICKwZAAAICK0ZAAAICK4ZAAAICK8ZAAAICLAZAAAICLEZAAAICLIZAAAICLMZAAAICLQZAAAICLUZAAAICLYZAAAICLcZAAAICLgZAAAICLkZAAAICLoZAAAICLsZAAAICLwZAAAICL0ZAAAICL4ZAAAICL8ZAAAICMAZAAAICMEZAAAICMIZAAAICMMZAAAICMQZAAAICMUZAAAICMYZAAAICMcZAAAICMgZAAAICMkZAAAICMoZAAAICMsZAAAICMwZAAAICM0ZAAAICM4ZAAAICM8ZAAAICNAZAAAICNEZAAAICNIZAAAICNMZAAAICNQZAAAICNUZAAAICNYZAAAICNcZAAAICNgZAAAICNkZAAAICNoZAAAICNsZAAAICNwZAAAICN0ZAAAICN4ZAAAICN8ZAAAICOAZAAAICOEZAAAICOIZAAAICOMZAAAICOQZAAAICOUZAAAICOYZAAAICOcZAAAICOgZAAAICOkZAAAICOoZAAAICOsZAAAICOwZAAAICO0ZAAAICO4ZAAAICO8ZAAAICPAZAAAICPEZAAAICPIZAAAICPMZAAAICPQZAAAICPUZAAAICPYZAAAICPcZAAAICPgZAAAICPkZAAAICPoZAAAICPsZAAAICPwZAAAICP0ZAAAICP4ZAAAICP8ZAAAICAAaAAAICAEaAAAICAIaAAAICAMaAAAICAQaAAAICAUaAAAICAYaAAAICAcaAAAICAgaAAAICAkaAAAICAoaAAAICAsaAAAICAwaAAAICA0aAAAICA4aAAAICA8aAAAICBAaAAAICBEaAAAICBIaAAAICBMaAAAICBQaAAAICBUaAAAICBYaAAAICBcaAAAICBgaAAAICBkaAAAICBoaAAAICBsaAAAICBwaAAAICB0aAAAICB4aAAAICB8aAAAICCAaAAAICCEaAAAICCIaAAAICCMaAAAICCQaAAAICCUaAAAICCYaAAAICCcaAAAICCgaAAAICCkaAAAICCoaAAAICCsaAAAICCwaAAAICC0aAAAICC4aAAAICC8aAAAICDAaAAAICDEaAAAICDIaAAAICDMaAAAICDQaAAAICDUaAAAICDYaAAAICDcaAAAICDgaAAAICDkaAAAICDoaAAAICDsaAAAICDwaAAAICD0aAAAICD4aAAAICD8aAAAICEAaAAAICEEaAAAICEIaAAAICEMaAAAICEQaAAAICEUaAAAICEYaAAAICEcaAAAICEgaAAAICEkaAAAICEoaAAAICEsaAAAICEwaAAAICE0aAAAICE4aAAAICE8aAAAICFAaAAAICFEaAAAICFIaAAAICFMaAAAICFQaAAAICFUaAAAICFYaAAAICFcaAAAICFgaAAAICFkaAAAICFoaAAAICFsaAAAICFwaAAAICF0aAAAICF4aAAAICF8aAAAICGAaAAAICGEaAAAICGIaAAAICGMaAAAICGQaAAAICGUaAAAICGYaAAAICGcaAAAICGgaAAAICGkaAAAICGoaAAAICGsaAAAICGwaAAAICG0aAAAICG4aAAAICG8aAAAICHAaAAAICHEaAAAICHIaAAAICHMaAAAICHQaAAAICHUaAAAICHYaAAAICHcaAAAICHgaAAAICHkaAAAICHoaAAAICHsaAAAICHwaAAAICH0aAAAICH4aAAAICH8aAAAICIAaAAAICIEaAAAICIIaAAAICIMaAAAICIQaAAAICIUaAAAICIYaAAAICIcaAAAICIgaAAAICIkaAAAICIoaAAAICIsaAAAICIwaAAAICI0aAAAICI4aAAAICI8aAAAICJAaAAAICJEaAAAICJIaAAAICJMaAAAICJQaAAAICJUaAAAICJYaAAAICJcaAAAICJgaAAAICJkaAAAICJoaAAAICJsaAAAICJwaAAAICJ0aAAAICJ4aAAAICJ8aAAAICKAaAAAICKEaAAAICKIaAAAICKMaAAAICKQaAAAICKUaAAAICKYaAAAICKcaAAAICKgaAAAICKkaAAAICKoaAAAICKsaAAAICKwaAAAICK0aAAAICK4aAAAICK8aAAAICLAaAAAICLEaAAAICLIaAAAICLMaAAAICLQaAAAICLUaAAAICLYaAAAICLcaAAAICLgaAAAICLkaAAAICLoaAAAICLsaAAAICLwaAAAICL0aAAAICL4aAAAICL8aAAAICMAaAAAICMEaAAAICMIaAAAICMMaAAAICMQaAAAICMUaAAAICMYaAAAICMcaAAAICMgaAAAICMkaAAAICMoaAAAICMsaAAAICMwaAAAICM0aAAAICM4aAAAICM8aAAAICNAaAAAICNEaAAAICNIaAAAICNMaAAAICNQaAAAICNUaAAAICNYaAAAICNcaAAAICNgaAAAICNkaAAAICNoaAAAICNsaAAAICNwaAAAICN0aAAAICN4aAAAICN8aAAAICOAaAAAICOEaAAAICOIaAAAICOMaAAAICOQaAAAICOUaAAAICOYaAAAICOcaAAAICOgaAAAICOkaAAAICOoaAAAICOsaAAAICOwaAAAICO0aAAAICO4aAAAICO8aAAAICPAaAAAICPEaAAAICPIaAAAICPMaAAAICPQaAAAICPUaAAAICPYaAAAICPcaAAAICPgaAAAICPkaAAAICPoaAAAICPsaAAAICPwaAAAICP0aAAAICP4aAAAICP8aAAAICAAbAAAICAEbAAAICAIbAAAICAMbAAAICAQbAAAICAUbAAAICAYbAAAICAcbAAAICAgbAAAICAkbAAAICAobAAAICAsbAAAICAwbAAAICA0bAAAICA4bAAAICA8bAAAICBAbAAAICBEbAAAICBIbAAAICBMbAAAICBQbAAAICBUbAAAICBYbAAAICBcbAAAICBgbAAAICBkbAAAICBobAAAICBsbAAAICBwbAAAICB0bAAAICB4bAAAICB8bAAAICCAbAAAICCEbAAAICCIbAAAICCMbAAAICCQbAAAICCUbAAAICCYbAAAICCcbAAAICCgbAAAICCkbAAAICCobAAAICCsbAAAICCwbAAAICC0bAAAICC4bAAAICC8bAAAICDAbAAAICDEbAAAICDIbAAAICDMbAAAICDQbAAAICDUbAAAICDYbAAAICDcbAAAICDgbAAAICDkbAAAICDobAAAICDsbAAAICDwbAAAICD0bAAAICD4bAAAICD8bAAAICEAbAAAICEEbAAAICEIbAAAICEMbAAAICEQbAAAICEUbAAAICEYbAAAICEcbAAAICEgbAAAICEkbAAAICEobAAAICEsbAAAICEwbAAAICE0bAAAICE4bAAAICE8bAAAICFAbAAAICFEbAAAICFIbAAAICFMbAAAICFQbAAAICFUbAAAICFYbAAAICFcbAAAICFgbAAAICFkbAAAICFobAAAICFsbAAAICFwbAAAICF0bAAAICF4bAAAICF8bAAAICGAbAAAICGEbAAAICGIbAAAICGMbAAAICGQbAAAICGUbAAAICGYbAAAICGcbAAAICGgbAAAICGkbAAAICGobAAAICGsbAAAICGwbAAAICG0bAAAICG4bAAAICG8bAAAICHAbAAAICHEbAAAICHIbAAAICHMbAAAICHQbAAAICHUbAAAICHYbAAAICHcbAAAICHgbAAAICHkbAAAICHobAAAICHsbAAAICHwbAAAICH0bAAAICH4bAAAICH8bAAAICIAbAAAICIEbAAAICIIbAAAICIMbAAAICIQbAAAICIUbAAAICIYbAAAICIcbAAAICIgbAAAICIkbAAAICIobAAAICIsbAAAICIwbAAAICI0bAAAICI4bAAAICI8bAAAICJAbAAAICJEbAAAICJIbAAAICJMbAAAICJQbAAAICJUbAAAICJYbAAAICJcbAAAICJgbAAAICJkbAAAICJobAAAICJsbAAAICJwbAAAICJ0bAAAICJ4bAAAICJ8bAAAICKAbAAAICKEbAAAICKIbAAAICKMbAAAICKQbAAAICKUbAAAICKYbAAAICKcbAAAICKgbAAAICKkbAAAICKobAAAICKsbAAAICKwbAAAICK0bAAAICK4bAAAICK8bAAAICLAbAAAICLEbAAAICLIbAAAICLMbAAAICLQbAAAICLUbAAAICLYbAAAICLcbAAAICLgbAAAICLkbAAAICLobAAAICLsbAAAICLwbAAAICL0bAAAICL4bAAAICL8bAAAICMAbAAAICMEbAAAICMIbAAAICMMbAAAICMQbAAAICMUbAAAICMYbAAAICMcbAAAICMgbAAAICMkbAAAICMobAAAICMsbAAAICMwbAAAICM0bAAAICM4bAAAICM8bAAAICNAbAAAICNEbAAAICNIbAAAICNMbAAAICNQbAAAICNUbAAAICNYbAAAICNcbAAAICNgbAAAICNkbAAAICNobAAAICNsbAAAICNwbAAAICN0bAAAICN4bAAAICN8bAAAICOAbAAAICOEbAAAICOIbAAAICOMbAAAICOQbAAAICOUbAAAICOYbAAAICOcbAAAICOgbAAAICOkbAAAICOobAAAICOsbAAAICOwbAAAICO0bAAAICO4bAAAICO8bAAAICPAbAAAICPEbAAAICPIbAAAICPMbAAAICPQbAAAICPUbAAAICPYbAAAICPcbAAAICPgbAAAICPkbAAAICPobAAAICPsbAAAICPwbAAAICP0bAAAICP4bAAAICP8bAAAICAAcAAAICAEcAAAICAIcAAAICAMcAAAICAQcAAAICAUcAAAICAYcAAAICAccAAAICAgcAAAICAkcAAAICAocAAAICAscAAAICAwcAAAICA0cAAAICA4cAAAICA8cAAAICBAcAAAICBEcAAAICBIcAAAICBMcAAAICBQcAAAICBUcAAAICBYcAAAICBccAAAICBgcAAAICBkcAAAICBocAAAICBscAAAICBwcAAAICB0cAAAICB4cAAAICB8cAAAICCAcAAAICCEcAAAICCIcAAAICCMcAAAICCQcAAAICCUcAAAICCYcAAAICCccAAAICCgcAAAICCkcAAAICCocAAAICCscAAAICCwcAAAICC0cAAAICC4cAAAICC8cAAAICDAcAAAICDEcAAAICDIcAAAICDMcAAAICDQcAAAICDUcAAAICDYcAAAICDccAAAICDgcAAAICDkcAAAICDocAAAICDscAAAICDwcAAAICD0cAAAICD4cAAAICD8cAAAICEAcAAAICEEcAAAICEIcAAAICEMcAAAICEQcAAAICEUcAAAICEYcAAAICEccAAAICEgcAAAICEkcAAAICEocAAAICEscAAAICEwcAAAICE0cAAAICE4cAAAICE8cAAAICFAcAAAICFEcAAAICFIcAAAICFMcAAAICFQcAAAICFUcAAAICFYcAAAICFccAAAICFgcAAAICFkcAAAICFocAAAICFscAAAICFwcAAAICF0cAAAICF4cAAAICF8cAAAICGAcAAAICGEcAAAICGIcAAAICGMcAAAICGQcAAAICGUcAAAICGYcAAAICGccAAAICGgcAAAICGkcAAAICGocAAAICGscAAAICGwcAAAICG0cAAAICG4cAAAICG8cAAAICHAcAAAICHEcAAAICHIcAAAICHMcAAAICHQcAAAICHUcAAAICHYcAAAICHccAAAICHgcAAAICHkcAAAICHocAAAICHscAAAICHwcAAAICH0cAAAICH4cAAAICH8cAAAICIAcAAAICIEcAAAICIIcAAAICIMcAAAICIQcAAAICIUcAAAICIYcAAAICIccAAAICIgcAAAICIkcAAAICIocAAAICIscAAAICIwcAAAICI0cAAAICI4cAAAICI8cAAAICJAcAAAICJEcAAAICJIcAAAICJMcAAAICJQcAAAICJUcAAAICJYcAAAICJccAAAICJgcAAAICJkcAAAICJocAAAICJscAAAICJwcAAAICJ0cAAAICJ4cAAAICJ8cAAAICKAcAAAICKEcAAAICKIcAAAICKMcAAAICKQcAAAICKUcAAAICKYcAAAICKccAAAICKgcAAAICKkcAAAICKocAAAICKscAAAICKwcAAAICK0cAAAICK4cAAAICK8cAAAICLAcAAAICLEcAAAICLIcAAAICLMcAAAICLQcAAAICLUcAAAICLYcAAAICLccAAAICLgcAAAICLkcAAAICLocAAAICLscAAAICLwcAAAICL0cAAAICL4cAAAICL8cAAAICMAcAAAICMEcAAAICMIcAAAICMMcAAAICMQcAAAICMUcAAAICMYcAAAICMccAAAICMgcAAAICMkcAAAICMocAAAICMscAAAICMwcAAAICM0cAAAICM4cAAAICM8cAAAICNAcAAAICNEcAAAICNIcAAAICNMcAAAICNQcAAAICNUcAAAICNYcAAAICNccAAAICNgcAAAICNkcAAAICNocAAAICNscAAAICNwcAAAICN0cAAAICN4cAAAICN8cAAAICOAcAAAICOEcAAAICOIcAAAICOMcAAAICOQcAAAICOUcAAAICOYcAAAICOccAAAICOgcAAAICOkcAAAICOocAAAICOscAAAICOwcAAAICO0cAAAICO4cAAAICO8cAAAICPAcAAAICPEcAAAICPIcAAAICPMcAAAICPQcAAAICPUcAAAICPYcAAAICPccAAAICPgcAAAICPkcAAAICPocAAAICPscAAAICPwcAAAICP0cAAAICP4cAAAICP8cAAAICAAdAAAICAEdAAAICAIdAAAICAMdAAAICAQdAAAICAUdAAAICAYdAAAICAcdAAAICAgdAAAICAkdAAAICAodAAAICAsdAAAICAwdAAAICA0dAAAICA4dAAAICA8dAAAICBAdAAAICBEdAAAICBIdAAAICBMdAAAICBQdAAAICBUdAAAICBYdAAAICBcdAAAICBgdAAAICBkdAAAICBodAAAICBsdAAAICBwdAAAICB0dAAAICB4dAAAICB8dAAAICCAdAAAICCEdAAAICCIdAAAICCMdAAAICCQdAAAICCUdAAAICCYdAAAICCcdAAAICCgdAAAICCkdAAAICCodAAAICCsdAAAICCwdAAAICC0dAAAICC4dAAAICC8dAAAICDAdAAAICDEdAAAICDIdAAAICDMdAAAICDQdAAAICDUdAAAICDYdAAAICDcdAAAICDgdAAAICDkdAAAICDodAAAICDsdAAAICDwdAAAICD0dAAAICD4dAAAICD8dAAAICEAdAAAICEEdAAAICEIdAAAICEMdAAAICEQdAAAICEUdAAAICEYdAAAICEcdAAAICEgdAAAICEkdAAAICEodAAAICEsdAAAICEwdAAAICE0dAAAICE4dAAAICE8dAAAICFAdAAAICFEdAAAICFIdAAAICFMdAAAICFQdAAAICFUdAAAICFYdAAAICFcdAAAICFgdAAAICFkdAAAICFodAAAICFsdAAAICFwdAAAICF0dAAAICF4dAAAICF8dAAAICGAdAAAICGEdAAAICGIdAAAICGMdAAAICGQdAAAICGUdAAAICGYdAAAICGcdAAAICGgdAAAICGkdAAAICGodAAAICGsdAAAICGwdAAAICG0dAAAICG4dAAAICG8dAAAICHAdAAAICHEdAAAICHIdAAAICHMdAAAICHQdAAAICHUdAAAICHYdAAAICHcdAAAICHgdAAAICHkdAAAICHodAAAICHsdAAAICHwdAAAICH0dAAAICH4dAAAICH8dAAAICIAdAAAICIEdAAAICIIdAAAICIMdAAAICIQdAAAICIUdAAAICIYdAAAICIcdAAAICIgdAAAICIkdAAAICIodAAAICIsdAAAICIwdAAAICI0dAAAICI4dAAAICI8dAAAICJAdAAAICJEdAAAICJIdAAAICJMdAAAICJQdAAAICJUdAAAICJYdAAAICJcdAAAICJgdAAAICJkdAAAICJodAAAICJsdAAAICJwdAAAICJ0dAAAICJ4dAAAICJ8dAAAICKAdAAAICKEdAAAICKIdAAAICKMdAAAICKQdAAAICKUdAAAICKYdAAAICKcdAAAICKgdAAAICKkdAAAICKodAAAICKsdAAAICKwdAAAICK0dAAAICK4dAAAICK8dAAAICLAdAAAICLEdAAAICLIdAAAICLMdAAAICLQdAAAICLUdAAAICLYdAAAICLcdAAAICLgdAAAICLkdAAAICLodAAAICLsdAAAICLwdAAAICL0dAAAICL4dAAAICL8dAAAICMAdAAAICMEdAAAICMIdAAAICMMdAAAICMQdAAAICMUdAAAICMYdAAAICMcdAAAICMgdAAAICMkdAAAICModAAAICMsdAAAICMwdAAAICM0dAAAICM4dAAAICM8dAAAICNAdAAAICNEdAAAICNIdAAAICNMdAAAICNQdAAAICNUdAAAICNYdAAAICNcdAAAICNgdAAAICNkdAAAICNodAAAICNsdAAAICNwdAAAICN0dAAAICN4dAAAICN8dAAAICOAdAAAICOEdAAAICOIdAAAICOMdAAAICOQdAAAICOUdAAAICOYdAAAICOcdAAAICOgdAAAICOkdAAAICOodAAAICOsdAAAICOwdAAAICO0dAAAICO4dAAAICO8dAAAICPAdAAAICPEdAAAICPIdAAAICPMdAAAICPQdAAAICPUdAAAICPYdAAAICPcdAAAICPgdAAAICPkdAAAICPodAAAICPsdAAAICPwdAAAICP0dAAAICP4dAAAICP8dAAAICAAeAAAICAEeAAAICAIeAAAICAMeAAAICAQeAAAICAUeAAAICAYeAAAICAceAAAICAgeAAAICAkeAAAICAoeAAAICAseAAAICAweAAAICA0eAAAICA4eAAAICA8eAAAICBAeAAAICBEeAAAICBIeAAAICBMeAAAICBQeAAAICBUeAAAICBYeAAAICBceAAAICBgeAAAICBkeAAAICBoeAAAICBseAAAICBweAAAICB0eAAAICB4eAAAICB8eAAAICCAeAAAICCEeAAAICCIeAAAICCMeAAAICCQeAAAICCUeAAAICCYeAAAICCceAAAICCgeAAAICCkeAAAICCoeAAAICCseAAAICCweAAAICC0eAAAICC4eAAAICC8eAAAICDAeAAAICDEeAAAICDIeAAAICDMeAAAICDQeAAAICDUeAAAICDYeAAAICDceAAAICDgeAAAICDkeAAAICDoeAAAICDseAAAICDweAAAICD0eAAAICD4eAAAICD8eAAAICEAeAAAICEEeAAAICEIeAAAICEMeAAAICEQeAAAICEUeAAAICEYeAAAICEceAAAICEgeAAAICEkeAAAICEoeAAAICEseAAAICEweAAAICE0eAAAICE4eAAAICE8eAAAICFAeAAAICFEeAAAICFIeAAAICFMeAAAICFQeAAAICFUeAAAICFYeAAAICFceAAAICFgeAAAICFkeAAAICFoeAAAICFseAAAICFweAAAICF0eAAAICF4eAAAICF8eAAAICGAeAAAICGEeAAAICGIeAAAICGMeAAAICGQeAAAICGUeAAAICGYeAAAICGceAAAICGgeAAAICGkeAAAICGoeAAAICGseAAAICGweAAAICG0eAAAICG4eAAAICG8eAAAICHAeAAAICHEeAAAICHIeAAAICHMeAAAICHQeAAAICHUeAAAICHYeAAAICHceAAAICHgeAAAICHkeAAAICHoeAAAICHseAAAICHweAAAICH0eAAAICH4eAAAICH8eAAAICIAeAAAICIEeAAAICIIeAAAICIMeAAAICIQeAAAICIUeAAAICIYeAAAICIceAAAICIgeAAAICIkeAAAICIoeAAAICIseAAAICIweAAAICI0eAAAICI4eAAAICI8eAAAICJAeAAAICJEeAAAICJIeAAAICJMeAAAICJQeAAAICJUeAAAICJYeAAAICJceAAAICJgeAAAICJkeAAAICJoeAAAICJseAAAICJweAAAICJ0eAAAICJ4eAAAICJ8eAAAICKAeAAAICKEeAAAICKIeAAAICKMeAAAICKQeAAAICKUeAAAICKYeAAAICKceAAAICKgeAAAICKkeAAAICKoeAAAICKseAAAICKweAAAICK0eAAAICK4eAAAICK8eAAAICLAeAAAICLEeAAAICLIeAAAICLMeAAAICLQeAAAICLUeAAAICLYeAAAICLceAAAICLgeAAAICLkeAAAICLoeAAAICLseAAAICLweAAAICL0eAAAICL4eAAAICL8eAAAICMAeAAAICMEeAAAICMIeAAAICMMeAAAICMQeAAAICMUeAAAICMYeAAAICMceAAAICMgeAAAICMkeAAAICMoeAAAICMseAAAICMweAAAICM0eAAAICM4eAAAICM8eAAAICNAeAAAICNEeAAAICNIeAAAICNMeAAAICNQeAAAICNUeAAAICNYeAAAICNceAAAICNgeAAAICNkeAAAICNoeAAAICNseAAAICNweAAAICN0eAAAICN4eAAAICN8eAAAICOAeAAAICOEeAAAICOIeAAAICOMeAAAICOQeAAAICOUeAAAICOYeAAAICOceAAAICOgeAAAICOkeAAAICOoeAAAICOseAAAICOweAAAICO0eAAAICO4eAAAICO8eAAAICPAeAAAICPEeAAAICPIeAAAICPMeAAAICPQeAAAICPUeAAAICPYeAAAICPceAAAICPgeAAAICPkeAAAICPoeAAAICPseAAAICPweAAAICP0eAAAICP4eAAAICP8eAAAICAAfAAAICAEfAAAICAIfAAAICAMfAAAICAQfAAAICAUfAAAICAYfAAAICAcfAAAICAgfAAAICAkfAAAICAofAAAICAsfAAAICAwfAAAICA0fAAAICA4fAAAICA8fAAAICBAfAAAICBEfAAAICBIfAAAICBMfAAAICBQfAAAICBUfAAAICBYfAAAICBcfAAAICBgfAAAICBkfAAAICBofAAAICBsfAAAICBwfAAAICB0fAAAICB4fAAAICB8fAAAICCAfAAAICCEfAAAICCIfAAAICCMfAAAICCQfAAAICCUfAAAICCYfAAAICCcfAAAICCgfAAAICCkfAAAICCofAAAICCsfAAAICCwfAAAICC0fAAAICC4fAAAICC8fAAAICDAfAAAICDEfAAAICDIfAAAICDMfAAAICDQfAAAICDUfAAAICDYfAAAICDcfAAAICDgfAAAICDkfAAAICDofAAAICDsfAAAICDwfAAAICD0fAAAICD4fAAAICD8fAAAICEAfAAAICEEfAAAICEIfAAAICEMfAAAICEQfAAAICEUfAAAICEYfAAAICEcfAAAICEgfAAAICEkfAAAICEofAAAICEsfAAAICEwfAAAICE0fAAAICE4fAAAICE8fAAAICFAfAAAICFEfAAAICFIfAAAICFMfAAAICFQfAAAICFUfAAAICFYfAAAICFcfAAAICFgfAAAICFkfAAAICFofAAAICFsfAAAICFwfAAAICF0fAAAICF4fAAAICF8fAAAICGAfAAAICGEfAAAICGIfAAAICGMfAAAICGQfAAAICGUfAAAICGYfAAAICGcfAAAICGgfAAAICGkfAAAICGofAAAICGsfAAAICGwfAAAICG0fAAAICG4fAAAICG8fAAAICHAfAAAICHEfAAAICHIfAAAICHMfAAAICHQfAAAICHUfAAAICHYfAAAICHcfAAAICHgfAAAICHkfAAAICHofAAAICHsfAAAICHwfAAAICH0fAAAICH4fAAAICH8fAAAICIAfAAAICIEfAAAICIIfAAAICIMfAAAICIQfAAAICIUfAAAICIYfAAAICIcfAAAICIgfAAAICIkfAAAICIofAAAICIsfAAAICIwfAAAICI0fAAAICI4fAAAICI8fAAAICJAfAAAICJEfAAAICJIfAAAICJMfAAAICJQfAAAICJUfAAAICJYfAAAICJcfAAAICJgfAAAICJkfAAAICJofAAAICJsfAAAICJwfAAAICJ0fAAAICJ4fAAAICJ8fAAAICKAfAAAICKEfAAAICKIfAAAICKMfAAAICKQfAAAICKUfAAAICKYfAAAICKcfAAAICKgfAAAICKkfAAAICKofAAAICKsfAAAICKwfAAAICK0fAAAICK4fAAAICK8fAAAICLAfAAAICLEfAAAICLIfAAAICLMfAAAICLQfAAAICLUfAAAICLYfAAAICLcfAAAICLgfAAAICLkfAAAICLofAAAICLsfAAAICLwfAAAICL0fAAAICL4fAAAICL8fAAAICMAfAAAICMEfAAAICMIfAAAICMMfAAAICMQfAAAICMUfAAAICMYfAAAICMcfAAAICMgfAAAICMkfAAAICMofAAAICMsfAAAICMwfAAAICM0fAAAICM4fAAAICM8fAAAICNAfAAAICNEfAAAICNIfAAAICNMfAAAICNQfAAAICNUfAAAICNYfAAAICNcfAAAICNgfAAAICNkfAAAICNofAAAICNsfAAAICNwfAAAICN0fAAAICN4fAAAICN8fAAAICOAfAAAICOEfAAAICOIfAAAICOMfAAAICOQfAAAICOUfAAAICOYfAAAICOcfAAAICOgfAAAICOkfAAAICOofAAAICOsfAAAICOwfAAAICO0fAAAICO4fAAAICO8fAAAICPAfAAAICPEfAAAICPIfAAAICPMfAAAICPQfAAAICPUfAAAICPYfAAAICPcfAAAICPgfAAAICPkfAAAICPofAAAICPsfAAAICPwfAAAICP0fAAAICP4fAAAICP8fAAAICAAgAAAICAEgAAAICAIgAAAICAMgAAAICAQgAAAICAUgAAAICAYgAAAICAcgAAAICAggAAAICAkgAAAICAogAAAICAsgAAAICAwgAAAICA0gAAAICA4gAAAICA8gAAAICBAgAAAICBEgAAAICBIgAAAICBMgAAAICBQgAAAICBUgAAAICBYgAAAICBcgAAAICBggAAAICBkgAAAICBogAAAICBsgAAAICBwgAAAICB0gAAAICB4gAAAICB8gAAAICCAgAAAICCEgAAAICCIgAAAICCMgAAAICCQgAAAICCUgAAAICCYgAAAICCcgAAAICCggAAAICCkgAAAICCogAAAICCsgAAAICCwgAAAICC0gAAAICC4gAAAICC8gAAAICDAgAAAICDEgAAAICDIgAAAICDMgAAAICDQgAAAICDUgAAAICDYgAAAICDcgAAAICDggAAAICDkgAAAICDogAAAICDsgAAAICDwgAAAICD0gAAAICD4gAAAICD8gAAAICEAgAAAICEEgAAAICEIgAAAICEMgAAAICEQgAAAICEUgAAAICEYgAAAICEcgAAAICEggAAAICEkgAAAICEogAAAICEsgAAAICEwgAAAICE0gAAAICE4gAAAICE8gAAAICFAgAAAICFEgAAAICFIgAAAICFMgAAAICFQgAAAICFUgAAAICFYgAAAICFcgAAAICFggAAAICFkgAAAICFogAAAICFsgAAAICFwgAAAICF0gAAAICF4gAAAICF8gAAAICGAgAAAICGEgAAAICGIgAAAICGMgAAAICGQgAAAICGUgAAAICGYgAAAICGcgAAAICGggAAAICGkgAAAICGogAAAICGsgAAAICGwgAAAICG0gAAAICG4gAAAICG8gAAAICHAgAAAICHEgAAAICHIgAAAICHMgAAAICHQgAAAICHUgAAAICHYgAAAICHcgAAAICHggAAAICHkgAAAICHogAAAICHsgAAAICHwgAAAICH0gAAAICH4gAAAICH8gAAAICIAgAAAICIEgAAAICIIgAAAICIMgAAAICIQgAAAICIUgAAAICIYgAAAICIcgAAAICIggAAAICIkgAAAICIogAAAICIsgAAAICIwgAAAICI0gAAAICI4gAAAICI8gAAAICJAgAAAICJEgAAAICJIgAAAICJMgAAAICJQgAAAICJUgAAAICJYgAAAICJcgAAAICJggAAAICJkgAAAICJogAAAICJsgAAAICJwgAAAICJ0gAAAICJ4gAAAICJ8gAAAICKAgAAAICKEgAAAICKIgAAAICKMgAAAICKQgAAAICKUgAAAICKYgAAAICKcgAAAICKggAAAICKkgAAAICKogAAAICKsgAAAICKwgAAAICK0gAAAICK4gAAAICK8gAAAICLAgAAAICLEgAAAICLIgAAAICLMgAAAICLQgAAAICLUgAAAICLYgAAAICLcgAAAICLggAAAICLkgAAAICLogAAAICLsgAAAICLwgAAAICL0gAAAICL4gAAAICL8gAAAICMAgAAAICMEgAAAICMIgAAAICMMgAAAICMQgAAAICMUgAAAICMYgAAAICMcgAAAICMggAAAICMkgAAAICMogAAAICMsgAAAICMwgAAAICM0gAAAICM4gAAAICM8gAAAICNAgAAAICNEgAAAICNIgAAAICNMgAAAICNQgAAAICNUgAAAICNYgAAAICNcgAAAICNggAAAICNkgAAAICNogAAAICNsgAAAICNwgAAAICN0gAAAICN4gAAAICN8gAAAICOAgAAAICOEgAAAICOIgAAAICOMgAAAICOQgAAAICOUgAAAICOYgAAAICOcgAAAICOggAAAICOkgAAAICOogAAAICOsgAAAICOwgAAAICO0gAAAICO4gAAAICO8gAAAICPAgAAAICPEgAAAICPIgAAAICPMgAAAICPQgAAAICPUgAAAICPYgAAAICPcgAAAICPggAAAICPkgAAAICPogAAAICPsgAAAICPwgAAAICP0gAAAICP4gAAAICP8gAAAICAAhAAAICAEhAAAICAIhAAAICAMhAAAICAQhAAAICAUhAAAICAYhAAAICAchAAAICAghAAAICAkhAAAICAohAAAICAshAAAICAwhAAAICA0hAAAICA4hAAAICA8hAAAICBAhAAAICBEhAAAICBIhAAAICBMhAAAICBQhAAAICBUhAAAICBYhAAAICBchAAAICBghAAAICBkhAAAICBohAAAICBshAAAICBwhAAAICB0hAAAICB4hAAAICB8hAAAICCAhAAAICCEhAAAICCIhAAAICCMhAAAICCQhAAAICCUhAAAICCYhAAAICCchAAAICCghAAAICCkhAAAICCohAAAICCshAAAICCwhAAAICC0hAAAICC4hAAAICC8hAAAICDAhAAAICDEhAAAICDIhAAAICDMhAAAICDQhAAAICDUhAAAICDYhAAAICDchAAAICDghAAAICDkhAAAICDohAAAICDshAAAICDwhAAAICD0hAAAICD4hAAAICD8hAAAICEAhAAAICEEhAAAICEIhAAAICEMhAAAICEQhAAAICEUhAAAICEYhAAAICEchAAAICEghAAAICEkhAAAICEohAAAICEshAAAICEwhAAAICE0hAAAICE4hAAAICE8hAAAICFAhAAAICFEhAAAICFIhAAAICFMhAAAICFQhAAAICFUhAAAICFYhAAAICFchAAAICFghAAAICFkhAAAICFohAAAICFshAAAICFwhAAAICF0hAAAICF4hAAAICF8hAAAICGAhAAAICGEhAAAICGIhAAAICGMhAAAICGQhAAAICGUhAAAICGYhAAAICGchAAAICGghAAAICGkhAAAICGohAAAICGshAAAICGwhAAAICG0hAAAICG4hAAAICG8hAAAICHAhAAAICHEhAAAICHIhAAAICHMhAAAICHQhAAAICHUhAAAICHYhAAAICHchAAAICHghAAAICHkhAAAICHohAAAICHshAAAICHwhAAAICH0hAAAICH4hAAAICH8hAAAICIAhAAAICIEhAAAICIIhAAAICIMhAAAICIQhAAAICIUhAAAICIYhAAAICIchAAAICIghAAAICIkhAAAICIohAAAICIshAAAICIwhAAAICI0hAAAICI4hAAAICI8hAAAICJAhAAAICJEhAAAICJIhAAAICJMhAAAICJQhAAAICJUhAAAICJYhAAAICJchAAAICJghAAAICJkhAAAICJohAAAICJshAAAICJwhAAAICJ0hAAAICJ4hAAAICJ8hAAAICKAhAAAICKEhAAAICKIhAAAICKMhAAAICKQhAAAICKUhAAAICKYhAAAICKchAAAICKghAAAICKkhAAAICKohAAAICKshAAAICKwhAAAICK0hAAAICK4hAAAICK8hAAAICLAhAAAICLEhAAAICLIhAAAICLMhAAAICLQhAAAICLUhAAAICLYhAAAICLchAAAICLghAAAICLkhAAAICLohAAAICLshAAAICLwhAAAICL0hAAAICL4hAAAICL8hAAAICMAhAAAICMEhAAAICMIhAAAICMMhAAAICMQhAAAICMUhAAAICMYhAAAICMchAAAICMghAAAICMkhAAAICMohAAAICMshAAAICMwhAAAICM0hAAAICM4hAAAICM8hAAAICNAhAAAICNEhAAAICNIhAAAICNMhAAAICNQhAAAICNUhAAAICNYhAAAICNchAAAICNghAAAICNkhAAAICNohAAAICNshAAAICNwhAAAICN0hAAAICN4hAAAICN8hAAAICOAhAAAICOEhAAAICOIhAAAICOMhAAAICOQhAAAICOUhAAAICOYhAAAICOchAAAICOghAAAICOkhAAAICOohAAAICOshAAAICOwhAAAICO0hAAAICO4hAAAICO8hAAAICPAhAAAICPEhAAAICPIhAAAICPMhAAAICPQhAAAICPUhAAAICPYhAAAICPchAAAICPghAAAICPkhAAAICPohAAAICPshAAAICPwhAAAICP0hAAAICP4hAAAICP8hAAAICAAiAAAICAEiAAAICAIiAAAICAMiAAAICAQiAAAICAUiAAAICAYiAAAICAciAAAICAgiAAAICAkiAAAICAoiAAAICAsiAAAICAwiAAAICA0iAAAICA4iAAAICA8iAAAICBAiAAAICBEiAAAICBIiAAAICBMiAAAICBQiAAAICBUiAAAICBYiAAAICBciAAAICBgiAAAICBkiAAAICBoiAAAICBsiAAAICBwiAAAICB0iAAAICB4iAAAICB8iAAAICCAiAAAICCEiAAAICCIiAAAICCMiAAAICCQiAAAICCUiAAAICCYiAAAICCciAAAICCgiAAAICCkiAAAICCoiAAAICCsiAAAICCwiAAAICC0iAAAICC4iAAAICC8iAAAICDAiAAAICDEiAAAICDIiAAAICDMiAAAICDQiAAAICDUiAAAICDYiAAAICDciAAAICDgiAAAICDkiAAAICDoiAAAICDsiAAAICDwiAAAICD0iAAAICD4iAAAICD8iAAAICEAiAAAICEEiAAAICEIiAAAICEMiAAAICEQiAAAICEUiAAAICEYiAAAICEciAAAICEgiAAAICEkiAAAICEoiAAAICEsiAAAICEwiAAAICE0iAAAICE4iAAAICE8iAAAICFAiAAAICFEiAAAICFIiAAAICFMiAAAICFQiAAAICFUiAAAICFYiAAAICFciAAAICFgiAAAICFkiAAAICFoiAAAICFsiAAAICFwiAAAICF0iAAAICF4iAAAICF8iAAAICGAiAAAICGEiAAAICGIiAAAICGMiAAAICGQiAAAICGUiAAAICGYiAAAICGciAAAICGgiAAAICGkiAAAICGoiAAAICGsiAAAICGwiAAAICG0iAAAICG4iAAAICG8iAAAICHAiAAAICHEiAAAICHIiAAAICHMiAAAICHQiAAAICHUiAAAICHYiAAAICHciAAAICHgiAAAICHkiAAAICHoiAAAICHsiAAAICHwiAAAICH0iAAAICH4iAAAICH8iAAAICIAiAAAICIEiAAAICIIiAAAICIMiAAAICIQiAAAICIUiAAAICIYiAAAICIciAAAICIgiAAAICIkiAAAICIoiAAAICIsiAAAICIwiAAAICI0iAAAICI4iAAAICI8iAAAICJAiAAAICJEiAAAICJIiAAAICJMiAAAICJQiAAAICJUiAAAICJYiAAAICJciAAAICJgiAAAICJkiAAAICJoiAAAICJsiAAAICJwiAAAICJ0iAAAICJ4iAAAICJ8iAAAICKAiAAAICKEiAAAICKIiAAAICKMiAAAICKQiAAAICKUiAAAICKYiAAAICKciAAAICKgiAAAICKkiAAAICKoiAAAICKsiAAAICKwiAAAICK0iAAAICK4iAAAICK8iAAAICLAiAAAICLEiAAAICLIiAAAICLMiAAAICLQiAAAICLUiAAAICLYiAAAICLciAAAICLgiAAAICLkiAAAICLoiAAAICLsiAAAICLwiAAAICL0iAAAICL4iAAAICL8iAAAICMAiAAAICMEiAAAICMIiAAAICMMiAAAICMQiAAAICMUiAAAICMYiAAAICMciAAAICMgiAAAICMkiAAAICMoiAAAICMsiAAAICMwiAAAICM0iAAAICM4iAAAICM8iAAAICNAiAAAICNEiAAAICNIiAAAICNMiAAAICNQiAAAICNUiAAAICNYiAAAICNciAAAICNgiAAAICNkiAAAICNoiAAAICNsiAAAICNwiAAAICN0iAAAICN4iAAAICN8iAAAICOAiAAAICOEiAAAICOIiAAAICOMiAAAICOQiAAAICOUiAAAICOYiAAAICOciAAAICOgiAAAICOkiAAAICOoiAAAICOsiAAAICOwiAAAICO0iAAAICO4iAAAICO8iAAAICPAiAAAICPEiAAAICPIiAAAICPMiAAAICPQiAAAICPUiAAAICPYiAAAICPciAAAICPgiAAAICPkiAAAICPoiAAAICPsiAAAICPwiAAAICP0iAAAICP4iAAAICP8iAAAICAAjAAAICAEjAAAICAIjAAAICAMjAAAICAQjAAAICAUjAAAICAYjAAAICAcjAAAICAgjAAAICAkjAAAICAojAAAICAsjAAAICAwjAAAICA0jAAAICA4jAAAICA8jAAAICBAjAAAICBEjAAAICBIjAAAICBMjAAAICBQjAAAICBUjAAAICBYjAAAICBcjAAAICBgjAAAICBkjAAAICBojAAAICBsjAAAICBwjAAAICB0jAAAICB4jAAAICB8jAAAICCAjAAAICCEjAAAICCIjAAAICCMjAAAICCQjAAAICCUjAAAICCYjAAAICCcjAAAICCgjAAAICCkjAAAICCojAAAICCsjAAAICCwjAAAICC0jAAAICC4jAAAICC8jAAAICDAjAAAICDEjAAAICDIjAAAICDMjAAAICDQjAAAICDUjAAAICDYjAAAICDcjAAAICDgjAAAICDkjAAAICDojAAAICDsjAAAICDwjAAAICD0jAAAICD4jAAAICD8jAAAICEAjAAAICEEjAAAICEIjAAAICEMjAAAICEQjAAAICEUjAAAICEYjAAAICEcjAAAICEgjAAAICEkjAAAICEojAAAICEsjAAAICEwjAAAICE0jAAAICE4jAAAICE8jAAAICFAjAAAICFEjAAAICFIjAAAICFMjAAAICFQjAAAICFUjAAAICFYjAAAICFcjAAAICFgjAAAICFkjAAAICFojAAAICFsjAAAICFwjAAAICF0jAAAICF4jAAAICF8jAAAICGAjAAAICGEjAAAICGIjAAAICGMjAAAICGQjAAAICGUjAAAICGYjAAAICGcjAAAICGgjAAAICGkjAAAICGojAAAICGsjAAAICGwjAAAICG0jAAAICG4jAAAICG8jAAAICHAjAAAICHEjAAAICHIjAAAICHMjAAAICHQjAAAICHUjAAAICHYjAAAICHcjAAAICHgjAAAICHkjAAAICHojAAAICHsjAAAICHwjAAAICH0jAAAICH4jAAAICH8jAAAICIAjAAAICIEjAAAICIIjAAAICIMjAAAICIQjAAAICIUjAAAICIYjAAAICIcjAAAICIgjAAAICIkjAAAICIojAAAICIsjAAAICIwjAAAICI0jAAAICI4jAAAICI8jAAAICJAjAAAICJEjAAAICJIjAAAICJMjAAAICJQjAAAICJUjAAAICJYjAAAICJcjAAAICJgjAAAICJkjAAAICJojAAAICJsjAAAICJwjAAAICJ0jAAAICJ4jAAAICJ8jAAAICKAjAAAICKEjAAAICKIjAAAICKMjAAAICKQjAAAICKUjAAAICKYjAAAICKcjAAAICKgjAAAICKkjAAAICKojAAAICKsjAAAICKwjAAAICK0jAAAICK4jAAAICK8jAAAICLAjAAAICLEjAAAICLIjAAAICLMjAAAICLQjAAAICLUjAAAICLYjAAAICLcjAAAICLgjAAAICLkjAAAICLojAAAICLsjAAAICLwjAAAICL0jAAAICL4jAAAICL8jAAAICMAjAAAICMEjAAAICMIjAAAICMMjAAAICMQjAAAICMUjAAAICMYjAAAICMcjAAAICMgjAAAICMkjAAAICMojAAAICMsjAAAICMwjAAAICM0jAAAICM4jAAAICM8jAAAICNAjAAAICNEjAAAICNIjAAAICNMjAAAICNQjAAAICNUjAAAICNYjAAAICNcjAAAICNgjAAAICNkjAAAICNojAAAICNsjAAAICNwjAAAICN0jAAAICN4jAAAICN8jAAAICOAjAAAICOEjAAAICOIjAAAICOMjAAAICOQjAAAICOUjAAAICOYjAAAICOcjAAAICOgjAAAICOkjAAAICOojAAAICOsjAAAICOwjAAAICO0jAAAICO4jAAAICO8jAAAICPAjAAAICPEjAAAICPIjAAAICPMjAAAICPQjAAAICPUjAAAICPYjAAAICPcjAAAICPgjAAAICPkjAAAICPojAAAICPsjAAAICPwjAAAICP0jAAAICP4jAAAICP8jAAAICAAkAAAICAEkAAAICAIkAAAICAMkAAAICAQkAAAICAUkAAAICAYkAAAICAckAAAICAgkAAAICAkkAAAICAokAAAICAskAAAICAwkAAAICA0kAAAICA4kAAAICA8kAAAICBAkAAAICBEkAAAICBIkAAAICBMkAAAICBQkAAAICBUkAAAICBYkAAAICBckAAAICBgkAAAICBkkAAAICBokAAAICBskAAAICBwkAAAICB0kAAAICB4kAAAICB8kAAAICCAkAAAICCEkAAAICCIkAAAICCMkAAAICCQkAAAICCUkAAAICCYkAAAICCckAAAICCgkAAAICCkkAAAICCokAAAICCskAAAICCwkAAAICC0kAAAICC4kAAAICC8kAAAICDAkAAAICDEkAAAICDIkAAAICDMkAAAICDQkAAAICDUkAAAICDYkAAAICDckAAAICDgkAAAICDkkAAAICDokAAAICDskAAAICDwkAAAICD0kAAAICD4kAAAICD8kAAAICEAkAAAICEEkAAAICEIkAAAICEMkAAAICEQkAAAICEUkAAAICEYkAAAICEckAAAICEgkAAAICEkkAAAICEokAAAICEskAAAICEwkAAAICE0kAAAICE4kAAAICE8kAAAICFAkAAAICFEkAAAICFIkAAAICFMkAAAICFQkAAAICFUkAAAICFYkAAAICFckAAAICFgkAAAICFkkAAAICFokAAAICFskAAAICFwkAAAICF0kAAAICF4kAAAICF8kAAAICGAkAAAICGEkAAAICGIkAAAICGMkAAAICGQkAAAICGUkAAAICGYkAAAICGckAAAICGgkAAAICGkkAAAICGokAAAICGskAAAICGwkAAAICG0kAAAICG4kAAAICG8kAAAICHAkAAAICHEkAAAICHIkAAAICHMkAAAICHQkAAAICHUkAAAICHYkAAAICHckAAAICHgkAAAICHkkAAAICHokAAAICHskAAAICHwkAAAICH0kAAAICH4kAAAICH8kAAAICIAkAAAICIEkAAAICIIkAAAICIMkAAAICIQkAAAICIUkAAAICIYkAAAICIckAAAICIgkAAAICIkkAAAICIokAAAICIskAAAICIwkAAAICI0kAAAICI4kAAAICI8kAAAICJAkAAAICJEkAAAICJIkAAAICJMkAAAICJQkAAAICJUkAAAICJYkAAAICJckAAAICJgkAAAICJkkAAAICJokAAAICJskAAAICJwkAAAICJ0kAAAICJ4kAAAICJ8kAAAICKAkAAAICKEkAAAICKIkAAAICKMkAAAICKQkAAAICKUkAAAICKYkAAAICKckAAAICKgkAAAICKkkAAAICKokAAAICKskAAAICKwkAAAICK0kAAAICK4kAAAICK8kAAAICLAkAAAICLEkAAAICLIkAAAICLMkAAAICLQkAAAICLUkAAAICLYkAAAICLckAAAICLgkAAAICLkkAAAICLokAAAICLskAAAICLwkAAAICL0kAAAICL4kAAAICL8kAAAICMAkAAAICMEkAAAICMIkAAAICMMkAAAICMQkAAAICMUkAAAICMYkAAAICMckAAAICMgkAAAICMkkAAAICMokAAAICMskAAAICMwkAAAICM0kAAAICM4kAAAICM8kAAAICNAkAAAICNEkAAAICNIkAAAICNMkAAAICNQkAAAICNUkAAAICNYkAAAICNckAAAICNgkAAAICNkkAAAICNokAAAICNskAAAICNwkAAAICN0kAAAICN4kAAAICN8kAAAICOAkAAAICOEkAAAICOIkAAAICOMkAAAICOQkAAAICOUkAAAICOYkAAAICOckAAAICOgkAAAICOkkAAAICOokAAAICOskAAAICOwkAAAICO0kAAAICO4kAAAICO8kAAAICPAkAAAICPEkAAAICPIkAAAICPMkAAAICPQkAAAICPUkAAAICPYkAAAICPckAAAICPgkAAAICPkkAAAICPokAAAICPskAAAICPwkAAAICP0kAAAICP4kAAAICP8kAAAICAAlAAAICAElAAAICAIlAAAICAMlAAAICAQlAAAICAUlAAAICAYlAAAICAclAAAICAglAAAICAklAAAICAolAAAICAslAAAICAwlAAAICA0lAAAICA4lAAAICA8lAAAICBAlAAAICBElAAAICBIlAAAICBMlAAAICBQlAAAICBUlAAAICBYlAAAICBclAAAICBglAAAICBklAAAICBolAAAICBslAAAICBwlAAAICB0lAAAICB4lAAAICB8lAAAICCAlAAAICCElAAAICCIlAAAICCMlAAAICCQlAAAICCUlAAAICCYlAAAICCclAAAICCglAAAICCklAAAICColAAAICCslAAAICCwlAAAICC0lAAAICC4lAAAICC8lAAAICDAlAAAICDElAAAICDIlAAAICDMlAAAICDQlAAAICDUlAAAICDYlAAAICDclAAAICDglAAAICDklAAAICDolAAAICDslAAAICDwlAAAICD0lAAAICD4lAAAICD8lAAAICEAlAAAICEElAAAICEIlAAAICEMlAAAICEQlAAAICEUlAAAICEYlAAAICEclAAAICEglAAAICEklAAAICEolAAAICEslAAAICEwlAAAICE0lAAAICE4lAAAICE8lAAAICFAlAAAICFElAAAICFIlAAAICFMlAAAICFQlAAAICFUlAAAICFYlAAAICFclAAAICFglAAAICFklAAAICFolAAAICFslAAAICFwlAAAICF0lAAAICF4lAAAICF8lAAAICGAlAAAICGElAAAICGIlAAAICGMlAAAICGQlAAAICGUlAAAICGYlAAAICGclAAAICGglAAAICGklAAAICGolAAAICGslAAAICGwlAAAICG0lAAAICG4lAAAICG8lAAAICHAlAAAICHElAAAICHIlAAAICHMlAAAICHQlAAAICHUlAAAICHYlAAAICHclAAAICHglAAAICHklAAAICHolAAAICHslAAAICHwlAAAICH0lAAAICH4lAAAICH8lAAAICIAlAAAICIElAAAICIIlAAAICIMlAAAICIQlAAAICIUlAAAICIYlAAAICIclAAAICIglAAAICIklAAAICIolAAAICIslAAAICIwlAAAICI0lAAAICI4lAAAICI8lAAAICJAlAAAICJElAAAICJIlAAAICJMlAAAICJQlAAAICJUlAAAICJYlAAAICJclAAAICJglAAAICJklAAAICJolAAAICJslAAAICJwlAAAICJ0lAAAICJ4lAAAICJ8lAAAICKAlAAAICKElAAAICKIlAAAICKMlAAAICKQlAAAICKUlAAAICKYlAAAICKclAAAICKglAAAICKklAAAICKolAAAICKslAAAICKwlAAAICK0lAAAICK4lAAAICK8lAAAICLAlAAAICLElAAAICLIlAAAICLMlAAAICLQlAAAICLUlAAAICLYlAAAICLclAAAICLglAAAICLklAAAICLolAAAICLslAAAICLwlAAAICL0lAAAICL4lAAAICL8lAAAICMAlAAAICMElAAAICMIlAAAICMMlAAAICMQlAAAICMUlAAAICMYlAAAICMclAAAICMglAAAICMklAAAICMolAAAICMslAAAICMwlAAAICM0lAAAICM4lAAAICM8lAAAICNAlAAAICNElAAAICNIlAAAICNMlAAAICNQlAAAICNUlAAAICNYlAAAICNclAAAICNglAAAICNklAAAICNolAAAICNslAAAICNwlAAAICN0lAAAICN4lAAAICN8lAAAICOAlAAAICOElAAAICOIlAAAICOMlAAAICOQlAAAICOUlAAAICOYlAAAICOclAAAICOglAAAICOklAAAICOolAAAICOslAAAICOwlAAAICO0lAAAICO4lAAAICO8lAAAICPAlAAAICPElAAAICPIlAAAICPMlAAAICPQlAAAICPUlAAAICPYlAAAICPclAAAICPglAAAICPklAAAICPolAAAICPslAAAICPwlAAAICP0lAAAICP4lAAAICP8lAAAICAAmAAAICAEmAAAICAImAAAICAMmAAAICAQmAAAICAUmAAAICAYmAAAICAcmAAAICAgmAAAICAkmAAAICAomAAAICAsmAAAICAwmAAAICA0mAAAICA4mAAAICA8mAAAICBAmAAAICBEmAAAICBImAAAICBMmAAAICBQmAAAICBUmAAAICBYmAAAICBcmAAAICBgmAAAICBkmAAAICBomAAAICBsmAAAICBwmAAAICB0mAAAICB4mAAAICB8mAAAICCAmAAAICCEmAAAICCImAAAICCMmAAAICCQmAAAICCUmAAAICCYmAAAICCcmAAAICCgmAAAICCkmAAAICComAAAICCsmAAAICCwmAAAICC0mAAAICC4mAAAICC8mAAAICDAmAAAICDEmAAAICDImAAAICDMmAAAICDQmAAAICDUmAAAICDYmAAAICDcmAAAICDgmAAAICDkmAAAICDomAAAICDsmAAAICDwmAAAICD0mAAAICD4mAAAICD8mAAAICEAmAAAICEEmAAAICEImAAAICEMmAAAICEQmAAAICEUmAAAICEYmAAAICEcmAAAICEgmAAAICEkmAAAICEomAAAICEsmAAAICEwmAAAICE0mAAAICE4mAAAICE8mAAAICFAmAAAICFEmAAAICFImAAAICFMmAAAICFQmAAAICFUmAAAICFYmAAAICFcmAAAICFgmAAAICFkmAAAICFomAAAICFsmAAAICFwmAAAICF0mAAAICF4mAAAICF8mAAAICGAmAAAICGEmAAAICGImAAAICGMmAAAICGQmAAAICGUmAAAICGYmAAAICGcmAAAICGgmAAAICGkmAAAICGomAAAICGsmAAAICGwmAAAICG0mAAAICG4mAAAICG8mAAAICHAmAAAICHEmAAAICHImAAAICHMmAAAICHQmAAAICHUmAAAICHYmAAAICHcmAAAICHgmAAAICHkmAAAICHomAAAICHsmAAAICHwmAAAICH0mAAAICH4mAAAICH8mAAAICIAmAAAICIEmAAAICIImAAAICIMmAAAICIQmAAAICIUmAAAICIYmAAAICIcmAAAICIgmAAAICIkmAAAICIomAAAICIsmAAAICIwmAAAICI0mAAAICI4mAAAICI8mAAAICJAmAAAICJEmAAAICJImAAAICJMmAAAICJQmAAAICJUmAAAICJYmAAAICJcmAAAICJgmAAAICJkmAAAICJomAAAICJsmAAAICJwmAAAICJ0mAAAICJ4mAAAICJ8mAAAICKAmAAAICKEmAAAICKImAAAICKMmAAAICKQmAAAICKUmAAAICKYmAAAICKcmAAAICKgmAAAICKkmAAAICKomAAAICKsmAAAICKwmAAAICK0mAAAICK4mAAAICK8mAAAICLAmAAAICLEmAAAICLImAAAICLMmAAAICLQmAAAICLUmAAAICLYmAAAICLcmAAAICLgmAAAICLkmAAAICLomAAAICLsmAAAICLwmAAAICL0mAAAICL4mAAAICL8mAAAICMAmAAAICMEmAAAICMImAAAICMMmAAAICMQmAAAICMUmAAAICMYmAAAICMcmAAAICMgmAAAICMkmAAAICMomAAAICMsmAAAICMwmAAAICM0mAAAICM4mAAAICM8mAAAICNAmAAAICNEmAAAICNImAAAICNMmAAAICNQmAAAICNUmAAAICNYmAAAICNcmAAAICNgmAAAICNkmAAAICNomAAAICNsmAAAICNwmAAAICN0mAAAICN4mAAAICN8mAAAICOAmAAAICOEmAAAICOImAAAICOMmAAAICOQmAAAICOUmAAAICOYmAAAICOcmAAAICOgmAAAICOkmAAAICOomAAAICOsmAAAICOwmAAAICO0mAAAICO4mAAAICO8mAAAICPAmAAAICPEmAAAICPImAAAICPMmAAAICPQmAAAICPUmAAAICPYmAAAICPcmAAAICPgmAAAICPkmAAAICPomAAAICPsmAAAICPwmAAAICP0mAAAICP4mAAAICP8mAAAICAAnAAAICAEnAAAICAInAAAICAMnAAAICAQnAAAICAUnAAAICAYnAAAICAcnAAAICAgnAAAICAknAAAICAonAAAICAsnAAAICAwnAAAICA0nAAAICA4nAAAICA8nAAAL", "AAEAAAD/////AQAAAAAAAAAQAQAAABAnAAAICAAAAAAICAEAAAAICAIAAAAICAMAAAAICAQAAAAICAUAAAAICAYAAAAICAcAAAAICAgAAAAICAkAAAAICAoAAAAICAsAAAAICAwAAAAICA0AAAAICA4AAAAICA8AAAAICBAAAAAICBEAAAAICBIAAAAICBMAAAAICBQAAAAICBUAAAAICBYAAAAICBcAAAAICBgAAAAICBkAAAAICBoAAAAICBsAAAAICBwAAAAICB0AAAAICB4AAAAICB8AAAAICCAAAAAICCEAAAAICCIAAAAICCMAAAAICCQAAAAICCUAAAAICCYAAAAICCcAAAAICCgAAAAICCkAAAAICCoAAAAICCsAAAAICCwAAAAICC0AAAAICC4AAAAICC8AAAAICDAAAAAICDEAAAAICDIAAAAICDMAAAAICDQAAAAICDUAAAAICDYAAAAICDcAAAAICDgAAAAICDkAAAAICDoAAAAICDsAAAAICDwAAAAICD0AAAAICD4AAAAICD8AAAAICEAAAAAICEEAAAAICEIAAAAICEMAAAAICEQAAAAICEUAAAAICEYAAAAICEcAAAAICEgAAAAICEkAAAAICEoAAAAICEsAAAAICEwAAAAICE0AAAAICE4AAAAICE8AAAAICFAAAAAICFEAAAAICFIAAAAICFMAAAAICFQAAAAICFUAAAAICFYAAAAICFcAAAAICFgAAAAICFkAAAAICFoAAAAICFsAAAAICFwAAAAICF0AAAAICF4AAAAICF8AAAAICGAAAAAICGEAAAAICGIAAAAICGMAAAAICGQAAAAICGUAAAAICGYAAAAICGcAAAAICGgAAAAICGkAAAAICGoAAAAICGsAAAAICGwAAAAICG0AAAAICG4AAAAICG8AAAAICHAAAAAICHEAAAAICHIAAAAICHMAAAAICHQAAAAICHUAAAAICHYAAAAICHcAAAAICHgAAAAICHkAAAAICHoAAAAICHsAAAAICHwAAAAICH0AAAAICH4AAAAICH8AAAAICIAAAAAICIEAAAAICIIAAAAICIMAAAAICIQAAAAICIUAAAAICIYAAAAICIcAAAAICIgAAAAICIkAAAAICIoAAAAICIsAAAAICIwAAAAICI0AAAAICI4AAAAICI8AAAAICJAAAAAICJEAAAAICJIAAAAICJMAAAAICJQAAAAICJUAAAAICJYAAAAICJcAAAAICJgAAAAICJkAAAAICJoAAAAICJsAAAAICJwAAAAICJ0AAAAICJ4AAAAICJ8AAAAICKAAAAAICKEAAAAICKIAAAAICKMAAAAICKQAAAAICKUAAAAICKYAAAAICKcAAAAICKgAAAAICKkAAAAICKoAAAAICKsAAAAICKwAAAAICK0AAAAICK4AAAAICK8AAAAICLAAAAAICLEAAAAICLIAAAAICLMAAAAICLQAAAAICLUAAAAICLYAAAAICLcAAAAICLgAAAAICLkAAAAICLoAAAAICLsAAAAICLwAAAAICL0AAAAICL4AAAAICL8AAAAICMAAAAAICMEAAAAICMIAAAAICMMAAAAICMQAAAAICMUAAAAICMYAAAAICMcAAAAICMgAAAAICMkAAAAICMoAAAAICMsAAAAICMwAAAAICM0AAAAICM4AAAAICM8AAAAICNAAAAAICNEAAAAICNIAAAAICNMAAAAICNQAAAAICNUAAAAICNYAAAAICNcAAAAICNgAAAAICNkAAAAICNoAAAAICNsAAAAICNwAAAAICN0AAAAICN4AAAAICN8AAAAICOAAAAAICOEAAAAICOIAAAAICOMAAAAICOQAAAAICOUAAAAICOYAAAAICOcAAAAICOgAAAAICOkAAAAICOoAAAAICOsAAAAICOwAAAAICO0AAAAICO4AAAAICO8AAAAICPAAAAAICPEAAAAICPIAAAAICPMAAAAICPQAAAAICPUAAAAICPYAAAAICPcAAAAICPgAAAAICPkAAAAICPoAAAAICPsAAAAICPwAAAAICP0AAAAICP4AAAAICP8AAAAICAABAAAICAEBAAAICAIBAAAICAMBAAAICAQBAAAICAUBAAAICAYBAAAICAcBAAAICAgBAAAICAkBAAAICAoBAAAICAsBAAAICAwBAAAICA0BAAAICA4BAAAICA8BAAAICBABAAAICBEBAAAICBIBAAAICBMBAAAICBQBAAAICBUBAAAICBYBAAAICBcBAAAICBgBAAAICBkBAAAICBoBAAAICBsBAAAICBwBAAAICB0BAAAICB4BAAAICB8BAAAICCABAAAICCEBAAAICCIBAAAICCMBAAAICCQBAAAICCUBAAAICCYBAAAICCcBAAAICCgBAAAICCkBAAAICCoBAAAICCsBAAAICCwBAAAICC0BAAAICC4BAAAICC8BAAAICDABAAAICDEBAAAICDIBAAAICDMBAAAICDQBAAAICDUBAAAICDYBAAAICDcBAAAICDgBAAAICDkBAAAICDoBAAAICDsBAAAICDwBAAAICD0BAAAICD4BAAAICD8BAAAICEABAAAICEEBAAAICEIBAAAICEMBAAAICEQBAAAICEUBAAAICEYBAAAICEcBAAAICEgBAAAICEkBAAAICEoBAAAICEsBAAAICEwBAAAICE0BAAAICE4BAAAICE8BAAAICFABAAAICFEBAAAICFIBAAAICFMBAAAICFQBAAAICFUBAAAICFYBAAAICFcBAAAICFgBAAAICFkBAAAICFoBAAAICFsBAAAICFwBAAAICF0BAAAICF4BAAAICF8BAAAICGABAAAICGEBAAAICGIBAAAICGMBAAAICGQBAAAICGUBAAAICGYBAAAICGcBAAAICGgBAAAICGkBAAAICGoBAAAICGsBAAAICGwBAAAICG0BAAAICG4BAAAICG8BAAAICHABAAAICHEBAAAICHIBAAAICHMBAAAICHQBAAAICHUBAAAICHYBAAAICHcBAAAICHgBAAAICHkBAAAICHoBAAAICHsBAAAICHwBAAAICH0BAAAICH4BAAAICH8BAAAICIABAAAICIEBAAAICIIBAAAICIMBAAAICIQBAAAICIUBAAAICIYBAAAICIcBAAAICIgBAAAICIkBAAAICIoBAAAICIsBAAAICIwBAAAICI0BAAAICI4BAAAICI8BAAAICJABAAAICJEBAAAICJIBAAAICJMBAAAICJQBAAAICJUBAAAICJYBAAAICJcBAAAICJgBAAAICJkBAAAICJoBAAAICJsBAAAICJwBAAAICJ0BAAAICJ4BAAAICJ8BAAAICKABAAAICKEBAAAICKIBAAAICKMBAAAICKQBAAAICKUBAAAICKYBAAAICKcBAAAICKgBAAAICKkBAAAICKoBAAAICKsBAAAICKwBAAAICK0BAAAICK4BAAAICK8BAAAICLABAAAICLEBAAAICLIBAAAICLMBAAAICLQBAAAICLUBAAAICLYBAAAICLcBAAAICLgBAAAICLkBAAAICLoBAAAICLsBAAAICLwBAAAICL0BAAAICL4BAAAICL8BAAAICMABAAAICMEBAAAICMIBAAAICMMBAAAICMQBAAAICMUBAAAICMYBAAAICMcBAAAICMgBAAAICMkBAAAICMoBAAAICMsBAAAICMwBAAAICM0BAAAICM4BAAAICM8BAAAICNABAAAICNEBAAAICNIBAAAICNMBAAAICNQBAAAICNUBAAAICNYBAAAICNcBAAAICNgBAAAICNkBAAAICNoBAAAICNsBAAAICNwBAAAICN0BAAAICN4BAAAICN8BAAAICOABAAAICOEBAAAICOIBAAAICOMBAAAICOQBAAAICOUBAAAICOYBAAAICOcBAAAICOgBAAAICOkBAAAICOoBAAAICOsBAAAICOwBAAAICO0BAAAICO4BAAAICO8BAAAICPABAAAICPEBAAAICPIBAAAICPMBAAAICPQBAAAICPUBAAAICPYBAAAICPcBAAAICPgBAAAICPkBAAAICPoBAAAICPsBAAAICPwBAAAICP0BAAAICP4BAAAICP8BAAAICAACAAAICAECAAAICAICAAAICAMCAAAICAQCAAAICAUCAAAICAYCAAAICAcCAAAICAgCAAAICAkCAAAICAoCAAAICAsCAAAICAwCAAAICA0CAAAICA4CAAAICA8CAAAICBACAAAICBECAAAICBICAAAICBMCAAAICBQCAAAICBUCAAAICBYCAAAICBcCAAAICBgCAAAICBkCAAAICBoCAAAICBsCAAAICBwCAAAICB0CAAAICB4CAAAICB8CAAAICCACAAAICCECAAAICCICAAAICCMCAAAICCQCAAAICCUCAAAICCYCAAAICCcCAAAICCgCAAAICCkCAAAICCoCAAAICCsCAAAICCwCAAAICC0CAAAICC4CAAAICC8CAAAICDACAAAICDECAAAICDICAAAICDMCAAAICDQCAAAICDUCAAAICDYCAAAICDcCAAAICDgCAAAICDkCAAAICDoCAAAICDsCAAAICDwCAAAICD0CAAAICD4CAAAICD8CAAAICEACAAAICEECAAAICEICAAAICEMCAAAICEQCAAAICEUCAAAICEYCAAAICEcCAAAICEgCAAAICEkCAAAICEoCAAAICEsCAAAICEwCAAAICE0CAAAICE4CAAAICE8CAAAICFACAAAICFECAAAICFICAAAICFMCAAAICFQCAAAICFUCAAAICFYCAAAICFcCAAAICFgCAAAICFkCAAAICFoCAAAICFsCAAAICFwCAAAICF0CAAAICF4CAAAICF8CAAAICGACAAAICGECAAAICGICAAAICGMCAAAICGQCAAAICGUCAAAICGYCAAAICGcCAAAICGgCAAAICGkCAAAICGoCAAAICGsCAAAICGwCAAAICG0CAAAICG4CAAAICG8CAAAICHACAAAICHECAAAICHICAAAICHMCAAAICHQCAAAICHUCAAAICHYCAAAICHcCAAAICHgCAAAICHkCAAAICHoCAAAICHsCAAAICHwCAAAICH0CAAAICH4CAAAICH8CAAAICIACAAAICIECAAAICIICAAAICIMCAAAICIQCAAAICIUCAAAICIYCAAAICIcCAAAICIgCAAAICIkCAAAICIoCAAAICIsCAAAICIwCAAAICI0CAAAICI4CAAAICI8CAAAICJACAAAICJECAAAICJICAAAICJMCAAAICJQCAAAICJUCAAAICJYCAAAICJcCAAAICJgCAAAICJkCAAAICJoCAAAICJsCAAAICJwCAAAICJ0CAAAICJ4CAAAICJ8CAAAICKACAAAICKECAAAICKICAAAICKMCAAAICKQCAAAICKUCAAAICKYCAAAICKcCAAAICKgCAAAICKkCAAAICKoCAAAICKsCAAAICKwCAAAICK0CAAAICK4CAAAICK8CAAAICLACAAAICLECAAAICLICAAAICLMCAAAICLQCAAAICLUCAAAICLYCAAAICLcCAAAICLgCAAAICLkCAAAICLoCAAAICLsCAAAICLwCAAAICL0CAAAICL4CAAAICL8CAAAICMACAAAICMECAAAICMICAAAICMMCAAAICMQCAAAICMUCAAAICMYCAAAICMcCAAAICMgCAAAICMkCAAAICMoCAAAICMsCAAAICMwCAAAICM0CAAAICM4CAAAICM8CAAAICNACAAAICNECAAAICNICAAAICNMCAAAICNQCAAAICNUCAAAICNYCAAAICNcCAAAICNgCAAAICNkCAAAICNoCAAAICNsCAAAICNwCAAAICN0CAAAICN4CAAAICN8CAAAICOACAAAICOECAAAICOICAAAICOMCAAAICOQCAAAICOUCAAAICOYCAAAICOcCAAAICOgCAAAICOkCAAAICOoCAAAICOsCAAAICOwCAAAICO0CAAAICO4CAAAICO8CAAAICPACAAAICPECAAAICPICAAAICPMCAAAICPQCAAAICPUCAAAICPYCAAAICPcCAAAICPgCAAAICPkCAAAICPoCAAAICPsCAAAICPwCAAAICP0CAAAICP4CAAAICP8CAAAICAADAAAICAEDAAAICAIDAAAICAMDAAAICAQDAAAICAUDAAAICAYDAAAICAcDAAAICAgDAAAICAkDAAAICAoDAAAICAsDAAAICAwDAAAICA0DAAAICA4DAAAICA8DAAAICBADAAAICBEDAAAICBIDAAAICBMDAAAICBQDAAAICBUDAAAICBYDAAAICBcDAAAICBgDAAAICBkDAAAICBoDAAAICBsDAAAICBwDAAAICB0DAAAICB4DAAAICB8DAAAICCADAAAICCEDAAAICCIDAAAICCMDAAAICCQDAAAICCUDAAAICCYDAAAICCcDAAAICCgDAAAICCkDAAAICCoDAAAICCsDAAAICCwDAAAICC0DAAAICC4DAAAICC8DAAAICDADAAAICDEDAAAICDIDAAAICDMDAAAICDQDAAAICDUDAAAICDYDAAAICDcDAAAICDgDAAAICDkDAAAICDoDAAAICDsDAAAICDwDAAAICD0DAAAICD4DAAAICD8DAAAICEADAAAICEEDAAAICEIDAAAICEMDAAAICEQDAAAICEUDAAAICEYDAAAICEcDAAAICEgDAAAICEkDAAAICEoDAAAICEsDAAAICEwDAAAICE0DAAAICE4DAAAICE8DAAAICFADAAAICFEDAAAICFIDAAAICFMDAAAICFQDAAAICFUDAAAICFYDAAAICFcDAAAICFgDAAAICFkDAAAICFoDAAAICFsDAAAICFwDAAAICF0DAAAICF4DAAAICF8DAAAICGADAAAICGEDAAAICGIDAAAICGMDAAAICGQDAAAICGUDAAAICGYDAAAICGcDAAAICGgDAAAICGkDAAAICGoDAAAICGsDAAAICGwDAAAICG0DAAAICG4DAAAICG8DAAAICHADAAAICHEDAAAICHIDAAAICHMDAAAICHQDAAAICHUDAAAICHYDAAAICHcDAAAICHgDAAAICHkDAAAICHoDAAAICHsDAAAICHwDAAAICH0DAAAICH4DAAAICH8DAAAICIADAAAICIEDAAAICIIDAAAICIMDAAAICIQDAAAICIUDAAAICIYDAAAICIcDAAAICIgDAAAICIkDAAAICIoDAAAICIsDAAAICIwDAAAICI0DAAAICI4DAAAICI8DAAAICJADAAAICJEDAAAICJIDAAAICJMDAAAICJQDAAAICJUDAAAICJYDAAAICJcDAAAICJgDAAAICJkDAAAICJoDAAAICJsDAAAICJwDAAAICJ0DAAAICJ4DAAAICJ8DAAAICKADAAAICKEDAAAICKIDAAAICKMDAAAICKQDAAAICKUDAAAICKYDAAAICKcDAAAICKgDAAAICKkDAAAICKoDAAAICKsDAAAICKwDAAAICK0DAAAICK4DAAAICK8DAAAICLADAAAICLEDAAAICLIDAAAICLMDAAAICLQDAAAICLUDAAAICLYDAAAICLcDAAAICLgDAAAICLkDAAAICLoDAAAICLsDAAAICLwDAAAICL0DAAAICL4DAAAICL8DAAAICMADAAAICMEDAAAICMIDAAAICMMDAAAICMQDAAAICMUDAAAICMYDAAAICMcDAAAICMgDAAAICMkDAAAICMoDAAAICMsDAAAICMwDAAAICM0DAAAICM4DAAAICM8DAAAICNADAAAICNEDAAAICNIDAAAICNMDAAAICNQDAAAICNUDAAAICNYDAAAICNcDAAAICNgDAAAICNkDAAAICNoDAAAICNsDAAAICNwDAAAICN0DAAAICN4DAAAICN8DAAAICOADAAAICOEDAAAICOIDAAAICOMDAAAICOQDAAAICOUDAAAICOYDAAAICOcDAAAICOgDAAAICOkDAAAICOoDAAAICOsDAAAICOwDAAAICO0DAAAICO4DAAAICO8DAAAICPADAAAICPEDAAAICPIDAAAICPMDAAAICPQDAAAICPUDAAAICPYDAAAICPcDAAAICPgDAAAICPkDAAAICPoDAAAICPsDAAAICPwDAAAICP0DAAAICP4DAAAICP8DAAAICAAEAAAICAEEAAAICAIEAAAICAMEAAAICAQEAAAICAUEAAAICAYEAAAICAcEAAAICAgEAAAICAkEAAAICAoEAAAICAsEAAAICAwEAAAICA0EAAAICA4EAAAICA8EAAAICBAEAAAICBEEAAAICBIEAAAICBMEAAAICBQEAAAICBUEAAAICBYEAAAICBcEAAAICBgEAAAICBkEAAAICBoEAAAICBsEAAAICBwEAAAICB0EAAAICB4EAAAICB8EAAAICCAEAAAICCEEAAAICCIEAAAICCMEAAAICCQEAAAICCUEAAAICCYEAAAICCcEAAAICCgEAAAICCkEAAAICCoEAAAICCsEAAAICCwEAAAICC0EAAAICC4EAAAICC8EAAAICDAEAAAICDEEAAAICDIEAAAICDMEAAAICDQEAAAICDUEAAAICDYEAAAICDcEAAAICDgEAAAICDkEAAAICDoEAAAICDsEAAAICDwEAAAICD0EAAAICD4EAAAICD8EAAAICEAEAAAICEEEAAAICEIEAAAICEMEAAAICEQEAAAICEUEAAAICEYEAAAICEcEAAAICEgEAAAICEkEAAAICEoEAAAICEsEAAAICEwEAAAICE0EAAAICE4EAAAICE8EAAAICFAEAAAICFEEAAAICFIEAAAICFMEAAAICFQEAAAICFUEAAAICFYEAAAICFcEAAAICFgEAAAICFkEAAAICFoEAAAICFsEAAAICFwEAAAICF0EAAAICF4EAAAICF8EAAAICGAEAAAICGEEAAAICGIEAAAICGMEAAAICGQEAAAICGUEAAAICGYEAAAICGcEAAAICGgEAAAICGkEAAAICGoEAAAICGsEAAAICGwEAAAICG0EAAAICG4EAAAICG8EAAAICHAEAAAICHEEAAAICHIEAAAICHMEAAAICHQEAAAICHUEAAAICHYEAAAICHcEAAAICHgEAAAICHkEAAAICHoEAAAICHsEAAAICHwEAAAICH0EAAAICH4EAAAICH8EAAAICIAEAAAICIEEAAAICIIEAAAICIMEAAAICIQEAAAICIUEAAAICIYEAAAICIcEAAAICIgEAAAICIkEAAAICIoEAAAICIsEAAAICIwEAAAICI0EAAAICI4EAAAICI8EAAAICJAEAAAICJEEAAAICJIEAAAICJMEAAAICJQEAAAICJUEAAAICJYEAAAICJcEAAAICJgEAAAICJkEAAAICJoEAAAICJsEAAAICJwEAAAICJ0EAAAICJ4EAAAICJ8EAAAICKAEAAAICKEEAAAICKIEAAAICKMEAAAICKQEAAAICKUEAAAICKYEAAAICKcEAAAICKgEAAAICKkEAAAICKoEAAAICKsEAAAICKwEAAAICK0EAAAICK4EAAAICK8EAAAICLAEAAAICLEEAAAICLIEAAAICLMEAAAICLQEAAAICLUEAAAICLYEAAAICLcEAAAICLgEAAAICLkEAAAICLoEAAAICLsEAAAICLwEAAAICL0EAAAICL4EAAAICL8EAAAICMAEAAAICMEEAAAICMIEAAAICMMEAAAICMQEAAAICMUEAAAICMYEAAAICMcEAAAICMgEAAAICMkEAAAICMoEAAAICMsEAAAICMwEAAAICM0EAAAICM4EAAAICM8EAAAICNAEAAAICNEEAAAICNIEAAAICNMEAAAICNQEAAAICNUEAAAICNYEAAAICNcEAAAICNgEAAAICNkEAAAICNoEAAAICNsEAAAICNwEAAAICN0EAAAICN4EAAAICN8EAAAICOAEAAAICOEEAAAICOIEAAAICOMEAAAICOQEAAAICOUEAAAICOYEAAAICOcEAAAICOgEAAAICOkEAAAICOoEAAAICOsEAAAICOwEAAAICO0EAAAICO4EAAAICO8EAAAICPAEAAAICPEEAAAICPIEAAAICPMEAAAICPQEAAAICPUEAAAICPYEAAAICPcEAAAICPgEAAAICPkEAAAICPoEAAAICPsEAAAICPwEAAAICP0EAAAICP4EAAAICP8EAAAICAAFAAAICAEFAAAICAIFAAAICAMFAAAICAQFAAAICAUFAAAICAYFAAAICAcFAAAICAgFAAAICAkFAAAICAoFAAAICAsFAAAICAwFAAAICA0FAAAICA4FAAAICA8FAAAICBAFAAAICBEFAAAICBIFAAAICBMFAAAICBQFAAAICBUFAAAICBYFAAAICBcFAAAICBgFAAAICBkFAAAICBoFAAAICBsFAAAICBwFAAAICB0FAAAICB4FAAAICB8FAAAICCAFAAAICCEFAAAICCIFAAAICCMFAAAICCQFAAAICCUFAAAICCYFAAAICCcFAAAICCgFAAAICCkFAAAICCoFAAAICCsFAAAICCwFAAAICC0FAAAICC4FAAAICC8FAAAICDAFAAAICDEFAAAICDIFAAAICDMFAAAICDQFAAAICDUFAAAICDYFAAAICDcFAAAICDgFAAAICDkFAAAICDoFAAAICDsFAAAICDwFAAAICD0FAAAICD4FAAAICD8FAAAICEAFAAAICEEFAAAICEIFAAAICEMFAAAICEQFAAAICEUFAAAICEYFAAAICEcFAAAICEgFAAAICEkFAAAICEoFAAAICEsFAAAICEwFAAAICE0FAAAICE4FAAAICE8FAAAICFAFAAAICFEFAAAICFIFAAAICFMFAAAICFQFAAAICFUFAAAICFYFAAAICFcFAAAICFgFAAAICFkFAAAICFoFAAAICFsFAAAICFwFAAAICF0FAAAICF4FAAAICF8FAAAICGAFAAAICGEFAAAICGIFAAAICGMFAAAICGQFAAAICGUFAAAICGYFAAAICGcFAAAICGgFAAAICGkFAAAICGoFAAAICGsFAAAICGwFAAAICG0FAAAICG4FAAAICG8FAAAICHAFAAAICHEFAAAICHIFAAAICHMFAAAICHQFAAAICHUFAAAICHYFAAAICHcFAAAICHgFAAAICHkFAAAICHoFAAAICHsFAAAICHwFAAAICH0FAAAICH4FAAAICH8FAAAICIAFAAAICIEFAAAICIIFAAAICIMFAAAICIQFAAAICIUFAAAICIYFAAAICIcFAAAICIgFAAAICIkFAAAICIoFAAAICIsFAAAICIwFAAAICI0FAAAICI4FAAAICI8FAAAICJAFAAAICJEFAAAICJIFAAAICJMFAAAICJQFAAAICJUFAAAICJYFAAAICJcFAAAICJgFAAAICJkFAAAICJoFAAAICJsFAAAICJwFAAAICJ0FAAAICJ4FAAAICJ8FAAAICKAFAAAICKEFAAAICKIFAAAICKMFAAAICKQFAAAICKUFAAAICKYFAAAICKcFAAAICKgFAAAICKkFAAAICKoFAAAICKsFAAAICKwFAAAICK0FAAAICK4FAAAICK8FAAAICLAFAAAICLEFAAAICLIFAAAICLMFAAAICLQFAAAICLUFAAAICLYFAAAICLcFAAAICLgFAAAICLkFAAAICLoFAAAICLsFAAAICLwFAAAICL0FAAAICL4FAAAICL8FAAAICMAFAAAICMEFAAAICMIFAAAICMMFAAAICMQFAAAICMUFAAAICMYFAAAICMcFAAAICMgFAAAICMkFAAAICMoFAAAICMsFAAAICMwFAAAICM0FAAAICM4FAAAICM8FAAAICNAFAAAICNEFAAAICNIFAAAICNMFAAAICNQFAAAICNUFAAAICNYFAAAICNcFAAAICNgFAAAICNkFAAAICNoFAAAICNsFAAAICNwFAAAICN0FAAAICN4FAAAICN8FAAAICOAFAAAICOEFAAAICOIFAAAICOMFAAAICOQFAAAICOUFAAAICOYFAAAICOcFAAAICOgFAAAICOkFAAAICOoFAAAICOsFAAAICOwFAAAICO0FAAAICO4FAAAICO8FAAAICPAFAAAICPEFAAAICPIFAAAICPMFAAAICPQFAAAICPUFAAAICPYFAAAICPcFAAAICPgFAAAICPkFAAAICPoFAAAICPsFAAAICPwFAAAICP0FAAAICP4FAAAICP8FAAAICAAGAAAICAEGAAAICAIGAAAICAMGAAAICAQGAAAICAUGAAAICAYGAAAICAcGAAAICAgGAAAICAkGAAAICAoGAAAICAsGAAAICAwGAAAICA0GAAAICA4GAAAICA8GAAAICBAGAAAICBEGAAAICBIGAAAICBMGAAAICBQGAAAICBUGAAAICBYGAAAICBcGAAAICBgGAAAICBkGAAAICBoGAAAICBsGAAAICBwGAAAICB0GAAAICB4GAAAICB8GAAAICCAGAAAICCEGAAAICCIGAAAICCMGAAAICCQGAAAICCUGAAAICCYGAAAICCcGAAAICCgGAAAICCkGAAAICCoGAAAICCsGAAAICCwGAAAICC0GAAAICC4GAAAICC8GAAAICDAGAAAICDEGAAAICDIGAAAICDMGAAAICDQGAAAICDUGAAAICDYGAAAICDcGAAAICDgGAAAICDkGAAAICDoGAAAICDsGAAAICDwGAAAICD0GAAAICD4GAAAICD8GAAAICEAGAAAICEEGAAAICEIGAAAICEMGAAAICEQGAAAICEUGAAAICEYGAAAICEcGAAAICEgGAAAICEkGAAAICEoGAAAICEsGAAAICEwGAAAICE0GAAAICE4GAAAICE8GAAAICFAGAAAICFEGAAAICFIGAAAICFMGAAAICFQGAAAICFUGAAAICFYGAAAICFcGAAAICFgGAAAICFkGAAAICFoGAAAICFsGAAAICFwGAAAICF0GAAAICF4GAAAICF8GAAAICGAGAAAICGEGAAAICGIGAAAICGMGAAAICGQGAAAICGUGAAAICGYGAAAICGcGAAAICGgGAAAICGkGAAAICGoGAAAICGsGAAAICGwGAAAICG0GAAAICG4GAAAICG8GAAAICHAGAAAICHEGAAAICHIGAAAICHMGAAAICHQGAAAICHUGAAAICHYGAAAICHcGAAAICHgGAAAICHkGAAAICHoGAAAICHsGAAAICHwGAAAICH0GAAAICH4GAAAICH8GAAAICIAGAAAICIEGAAAICIIGAAAICIMGAAAICIQGAAAICIUGAAAICIYGAAAICIcGAAAICIgGAAAICIkGAAAICIoGAAAICIsGAAAICIwGAAAICI0GAAAICI4GAAAICI8GAAAICJAGAAAICJEGAAAICJIGAAAICJMGAAAICJQGAAAICJUGAAAICJYGAAAICJcGAAAICJgGAAAICJkGAAAICJoGAAAICJsGAAAICJwGAAAICJ0GAAAICJ4GAAAICJ8GAAAICKAGAAAICKEGAAAICKIGAAAICKMGAAAICKQGAAAICKUGAAAICKYGAAAICKcGAAAICKgGAAAICKkGAAAICKoGAAAICKsGAAAICKwGAAAICK0GAAAICK4GAAAICK8GAAAICLAGAAAICLEGAAAICLIGAAAICLMGAAAICLQGAAAICLUGAAAICLYGAAAICLcGAAAICLgGAAAICLkGAAAICLoGAAAICLsGAAAICLwGAAAICL0GAAAICL4GAAAICL8GAAAICMAGAAAICMEGAAAICMIGAAAICMMGAAAICMQGAAAICMUGAAAICMYGAAAICMcGAAAICMgGAAAICMkGAAAICMoGAAAICMsGAAAICMwGAAAICM0GAAAICM4GAAAICM8GAAAICNAGAAAICNEGAAAICNIGAAAICNMGAAAICNQGAAAICNUGAAAICNYGAAAICNcGAAAICNgGAAAICNkGAAAICNoGAAAICNsGAAAICNwGAAAICN0GAAAICN4GAAAICN8GAAAICOAGAAAICOEGAAAICOIGAAAICOMGAAAICOQGAAAICOUGAAAICOYGAAAICOcGAAAICOgGAAAICOkGAAAICOoGAAAICOsGAAAICOwGAAAICO0GAAAICO4GAAAICO8GAAAICPAGAAAICPEGAAAICPIGAAAICPMGAAAICPQGAAAICPUGAAAICPYGAAAICPcGAAAICPgGAAAICPkGAAAICPoGAAAICPsGAAAICPwGAAAICP0GAAAICP4GAAAICP8GAAAICAAHAAAICAEHAAAICAIHAAAICAMHAAAICAQHAAAICAUHAAAICAYHAAAICAcHAAAICAgHAAAICAkHAAAICAoHAAAICAsHAAAICAwHAAAICA0HAAAICA4HAAAICA8HAAAICBAHAAAICBEHAAAICBIHAAAICBMHAAAICBQHAAAICBUHAAAICBYHAAAICBcHAAAICBgHAAAICBkHAAAICBoHAAAICBsHAAAICBwHAAAICB0HAAAICB4HAAAICB8HAAAICCAHAAAICCEHAAAICCIHAAAICCMHAAAICCQHAAAICCUHAAAICCYHAAAICCcHAAAICCgHAAAICCkHAAAICCoHAAAICCsHAAAICCwHAAAICC0HAAAICC4HAAAICC8HAAAICDAHAAAICDEHAAAICDIHAAAICDMHAAAICDQHAAAICDUHAAAICDYHAAAICDcHAAAICDgHAAAICDkHAAAICDoHAAAICDsHAAAICDwHAAAICD0HAAAICD4HAAAICD8HAAAICEAHAAAICEEHAAAICEIHAAAICEMHAAAICEQHAAAICEUHAAAICEYHAAAICEcHAAAICEgHAAAICEkHAAAICEoHAAAICEsHAAAICEwHAAAICE0HAAAICE4HAAAICE8HAAAICFAHAAAICFEHAAAICFIHAAAICFMHAAAICFQHAAAICFUHAAAICFYHAAAICFcHAAAICFgHAAAICFkHAAAICFoHAAAICFsHAAAICFwHAAAICF0HAAAICF4HAAAICF8HAAAICGAHAAAICGEHAAAICGIHAAAICGMHAAAICGQHAAAICGUHAAAICGYHAAAICGcHAAAICGgHAAAICGkHAAAICGoHAAAICGsHAAAICGwHAAAICG0HAAAICG4HAAAICG8HAAAICHAHAAAICHEHAAAICHIHAAAICHMHAAAICHQHAAAICHUHAAAICHYHAAAICHcHAAAICHgHAAAICHkHAAAICHoHAAAICHsHAAAICHwHAAAICH0HAAAICH4HAAAICH8HAAAICIAHAAAICIEHAAAICIIHAAAICIMHAAAICIQHAAAICIUHAAAICIYHAAAICIcHAAAICIgHAAAICIkHAAAICIoHAAAICIsHAAAICIwHAAAICI0HAAAICI4HAAAICI8HAAAICJAHAAAICJEHAAAICJIHAAAICJMHAAAICJQHAAAICJUHAAAICJYHAAAICJcHAAAICJgHAAAICJkHAAAICJoHAAAICJsHAAAICJwHAAAICJ0HAAAICJ4HAAAICJ8HAAAICKAHAAAICKEHAAAICKIHAAAICKMHAAAICKQHAAAICKUHAAAICKYHAAAICKcHAAAICKgHAAAICKkHAAAICKoHAAAICKsHAAAICKwHAAAICK0HAAAICK4HAAAICK8HAAAICLAHAAAICLEHAAAICLIHAAAICLMHAAAICLQHAAAICLUHAAAICLYHAAAICLcHAAAICLgHAAAICLkHAAAICLoHAAAICLsHAAAICLwHAAAICL0HAAAICL4HAAAICL8HAAAICMAHAAAICMEHAAAICMIHAAAICMMHAAAICMQHAAAICMUHAAAICMYHAAAICMcHAAAICMgHAAAICMkHAAAICMoHAAAICMsHAAAICMwHAAAICM0HAAAICM4HAAAICM8HAAAICNAHAAAICNEHAAAICNIHAAAICNMHAAAICNQHAAAICNUHAAAICNYHAAAICNcHAAAICNgHAAAICNkHAAAICNoHAAAICNsHAAAICNwHAAAICN0HAAAICN4HAAAICN8HAAAICOAHAAAICOEHAAAICOIHAAAICOMHAAAICOQHAAAICOUHAAAICOYHAAAICOcHAAAICOgHAAAICOkHAAAICOoHAAAICOsHAAAICOwHAAAICO0HAAAICO4HAAAICO8HAAAICPAHAAAICPEHAAAICPIHAAAICPMHAAAICPQHAAAICPUHAAAICPYHAAAICPcHAAAICPgHAAAICPkHAAAICPoHAAAICPsHAAAICPwHAAAICP0HAAAICP4HAAAICP8HAAAICAAIAAAICAEIAAAICAIIAAAICAMIAAAICAQIAAAICAUIAAAICAYIAAAICAcIAAAICAgIAAAICAkIAAAICAoIAAAICAsIAAAICAwIAAAICA0IAAAICA4IAAAICA8IAAAICBAIAAAICBEIAAAICBIIAAAICBMIAAAICBQIAAAICBUIAAAICBYIAAAICBcIAAAICBgIAAAICBkIAAAICBoIAAAICBsIAAAICBwIAAAICB0IAAAICB4IAAAICB8IAAAICCAIAAAICCEIAAAICCIIAAAICCMIAAAICCQIAAAICCUIAAAICCYIAAAICCcIAAAICCgIAAAICCkIAAAICCoIAAAICCsIAAAICCwIAAAICC0IAAAICC4IAAAICC8IAAAICDAIAAAICDEIAAAICDIIAAAICDMIAAAICDQIAAAICDUIAAAICDYIAAAICDcIAAAICDgIAAAICDkIAAAICDoIAAAICDsIAAAICDwIAAAICD0IAAAICD4IAAAICD8IAAAICEAIAAAICEEIAAAICEIIAAAICEMIAAAICEQIAAAICEUIAAAICEYIAAAICEcIAAAICEgIAAAICEkIAAAICEoIAAAICEsIAAAICEwIAAAICE0IAAAICE4IAAAICE8IAAAICFAIAAAICFEIAAAICFIIAAAICFMIAAAICFQIAAAICFUIAAAICFYIAAAICFcIAAAICFgIAAAICFkIAAAICFoIAAAICFsIAAAICFwIAAAICF0IAAAICF4IAAAICF8IAAAICGAIAAAICGEIAAAICGIIAAAICGMIAAAICGQIAAAICGUIAAAICGYIAAAICGcIAAAICGgIAAAICGkIAAAICGoIAAAICGsIAAAICGwIAAAICG0IAAAICG4IAAAICG8IAAAICHAIAAAICHEIAAAICHIIAAAICHMIAAAICHQIAAAICHUIAAAICHYIAAAICHcIAAAICHgIAAAICHkIAAAICHoIAAAICHsIAAAICHwIAAAICH0IAAAICH4IAAAICH8IAAAICIAIAAAICIEIAAAICIIIAAAICIMIAAAICIQIAAAICIUIAAAICIYIAAAICIcIAAAICIgIAAAICIkIAAAICIoIAAAICIsIAAAICIwIAAAICI0IAAAICI4IAAAICI8IAAAICJAIAAAICJEIAAAICJIIAAAICJMIAAAICJQIAAAICJUIAAAICJYIAAAICJcIAAAICJgIAAAICJkIAAAICJoIAAAICJsIAAAICJwIAAAICJ0IAAAICJ4IAAAICJ8IAAAICKAIAAAICKEIAAAICKIIAAAICKMIAAAICKQIAAAICKUIAAAICKYIAAAICKcIAAAICKgIAAAICKkIAAAICKoIAAAICKsIAAAICKwIAAAICK0IAAAICK4IAAAICK8IAAAICLAIAAAICLEIAAAICLIIAAAICLMIAAAICLQIAAAICLUIAAAICLYIAAAICLcIAAAICLgIAAAICLkIAAAICLoIAAAICLsIAAAICLwIAAAICL0IAAAICL4IAAAICL8IAAAICMAIAAAICMEIAAAICMIIAAAICMMIAAAICMQIAAAICMUIAAAICMYIAAAICMcIAAAICMgIAAAICMkIAAAICMoIAAAICMsIAAAICMwIAAAICM0IAAAICM4IAAAICM8IAAAICNAIAAAICNEIAAAICNIIAAAICNMIAAAICNQIAAAICNUIAAAICNYIAAAICNcIAAAICNgIAAAICNkIAAAICNoIAAAICNsIAAAICNwIAAAICN0IAAAICN4IAAAICN8IAAAICOAIAAAICOEIAAAICOIIAAAICOMIAAAICOQIAAAICOUIAAAICOYIAAAICOcIAAAICOgIAAAICOkIAAAICOoIAAAICOsIAAAICOwIAAAICO0IAAAICO4IAAAICO8IAAAICPAIAAAICPEIAAAICPIIAAAICPMIAAAICPQIAAAICPUIAAAICPYIAAAICPcIAAAICPgIAAAICPkIAAAICPoIAAAICPsIAAAICPwIAAAICP0IAAAICP4IAAAICP8IAAAICAAJAAAICAEJAAAICAIJAAAICAMJAAAICAQJAAAICAUJAAAICAYJAAAICAcJAAAICAgJAAAICAkJAAAICAoJAAAICAsJAAAICAwJAAAICA0JAAAICA4JAAAICA8JAAAICBAJAAAICBEJAAAICBIJAAAICBMJAAAICBQJAAAICBUJAAAICBYJAAAICBcJAAAICBgJAAAICBkJAAAICBoJAAAICBsJAAAICBwJAAAICB0JAAAICB4JAAAICB8JAAAICCAJAAAICCEJAAAICCIJAAAICCMJAAAICCQJAAAICCUJAAAICCYJAAAICCcJAAAICCgJAAAICCkJAAAICCoJAAAICCsJAAAICCwJAAAICC0JAAAICC4JAAAICC8JAAAICDAJAAAICDEJAAAICDIJAAAICDMJAAAICDQJAAAICDUJAAAICDYJAAAICDcJAAAICDgJAAAICDkJAAAICDoJAAAICDsJAAAICDwJAAAICD0JAAAICD4JAAAICD8JAAAICEAJAAAICEEJAAAICEIJAAAICEMJAAAICEQJAAAICEUJAAAICEYJAAAICEcJAAAICEgJAAAICEkJAAAICEoJAAAICEsJAAAICEwJAAAICE0JAAAICE4JAAAICE8JAAAICFAJAAAICFEJAAAICFIJAAAICFMJAAAICFQJAAAICFUJAAAICFYJAAAICFcJAAAICFgJAAAICFkJAAAICFoJAAAICFsJAAAICFwJAAAICF0JAAAICF4JAAAICF8JAAAICGAJAAAICGEJAAAICGIJAAAICGMJAAAICGQJAAAICGUJAAAICGYJAAAICGcJAAAICGgJAAAICGkJAAAICGoJAAAICGsJAAAICGwJAAAICG0JAAAICG4JAAAICG8JAAAICHAJAAAICHEJAAAICHIJAAAICHMJAAAICHQJAAAICHUJAAAICHYJAAAICHcJAAAICHgJAAAICHkJAAAICHoJAAAICHsJAAAICHwJAAAICH0JAAAICH4JAAAICH8JAAAICIAJAAAICIEJAAAICIIJAAAICIMJAAAICIQJAAAICIUJAAAICIYJAAAICIcJAAAICIgJAAAICIkJAAAICIoJAAAICIsJAAAICIwJAAAICI0JAAAICI4JAAAICI8JAAAICJAJAAAICJEJAAAICJIJAAAICJMJAAAICJQJAAAICJUJAAAICJYJAAAICJcJAAAICJgJAAAICJkJAAAICJoJAAAICJsJAAAICJwJAAAICJ0JAAAICJ4JAAAICJ8JAAAICKAJAAAICKEJAAAICKIJAAAICKMJAAAICKQJAAAICKUJAAAICKYJAAAICKcJAAAICKgJAAAICKkJAAAICKoJAAAICKsJAAAICKwJAAAICK0JAAAICK4JAAAICK8JAAAICLAJAAAICLEJAAAICLIJAAAICLMJAAAICLQJAAAICLUJAAAICLYJAAAICLcJAAAICLgJAAAICLkJAAAICLoJAAAICLsJAAAICLwJAAAICL0JAAAICL4JAAAICL8JAAAICMAJAAAICMEJAAAICMIJAAAICMMJAAAICMQJAAAICMUJAAAICMYJAAAICMcJAAAICMgJAAAICMkJAAAICMoJAAAICMsJAAAICMwJAAAICM0JAAAICM4JAAAICM8JAAAICNAJAAAICNEJAAAICNIJAAAICNMJAAAICNQJAAAICNUJAAAICNYJAAAICNcJAAAICNgJAAAICNkJAAAICNoJAAAICNsJAAAICNwJAAAICN0JAAAICN4JAAAICN8JAAAICOAJAAAICOEJAAAICOIJAAAICOMJAAAICOQJAAAICOUJAAAICOYJAAAICOcJAAAICOgJAAAICOkJAAAICOoJAAAICOsJAAAICOwJAAAICO0JAAAICO4JAAAICO8JAAAICPAJAAAICPEJAAAICPIJAAAICPMJAAAICPQJAAAICPUJAAAICPYJAAAICPcJAAAICPgJAAAICPkJAAAICPoJAAAICPsJAAAICPwJAAAICP0JAAAICP4JAAAICP8JAAAICAAKAAAICAEKAAAICAIKAAAICAMKAAAICAQKAAAICAUKAAAICAYKAAAICAcKAAAICAgKAAAICAkKAAAICAoKAAAICAsKAAAICAwKAAAICA0KAAAICA4KAAAICA8KAAAICBAKAAAICBEKAAAICBIKAAAICBMKAAAICBQKAAAICBUKAAAICBYKAAAICBcKAAAICBgKAAAICBkKAAAICBoKAAAICBsKAAAICBwKAAAICB0KAAAICB4KAAAICB8KAAAICCAKAAAICCEKAAAICCIKAAAICCMKAAAICCQKAAAICCUKAAAICCYKAAAICCcKAAAICCgKAAAICCkKAAAICCoKAAAICCsKAAAICCwKAAAICC0KAAAICC4KAAAICC8KAAAICDAKAAAICDEKAAAICDIKAAAICDMKAAAICDQKAAAICDUKAAAICDYKAAAICDcKAAAICDgKAAAICDkKAAAICDoKAAAICDsKAAAICDwKAAAICD0KAAAICD4KAAAICD8KAAAICEAKAAAICEEKAAAICEIKAAAICEMKAAAICEQKAAAICEUKAAAICEYKAAAICEcKAAAICEgKAAAICEkKAAAICEoKAAAICEsKAAAICEwKAAAICE0KAAAICE4KAAAICE8KAAAICFAKAAAICFEKAAAICFIKAAAICFMKAAAICFQKAAAICFUKAAAICFYKAAAICFcKAAAICFgKAAAICFkKAAAICFoKAAAICFsKAAAICFwKAAAICF0KAAAICF4KAAAICF8KAAAICGAKAAAICGEKAAAICGIKAAAICGMKAAAICGQKAAAICGUKAAAICGYKAAAICGcKAAAICGgKAAAICGkKAAAICGoKAAAICGsKAAAICGwKAAAICG0KAAAICG4KAAAICG8KAAAICHAKAAAICHEKAAAICHIKAAAICHMKAAAICHQKAAAICHUKAAAICHYKAAAICHcKAAAICHgKAAAICHkKAAAICHoKAAAICHsKAAAICHwKAAAICH0KAAAICH4KAAAICH8KAAAICIAKAAAICIEKAAAICIIKAAAICIMKAAAICIQKAAAICIUKAAAICIYKAAAICIcKAAAICIgKAAAICIkKAAAICIoKAAAICIsKAAAICIwKAAAICI0KAAAICI4KAAAICI8KAAAICJAKAAAICJEKAAAICJIKAAAICJMKAAAICJQKAAAICJUKAAAICJYKAAAICJcKAAAICJgKAAAICJkKAAAICJoKAAAICJsKAAAICJwKAAAICJ0KAAAICJ4KAAAICJ8KAAAICKAKAAAICKEKAAAICKIKAAAICKMKAAAICKQKAAAICKUKAAAICKYKAAAICKcKAAAICKgKAAAICKkKAAAICKoKAAAICKsKAAAICKwKAAAICK0KAAAICK4KAAAICK8KAAAICLAKAAAICLEKAAAICLIKAAAICLMKAAAICLQKAAAICLUKAAAICLYKAAAICLcKAAAICLgKAAAICLkKAAAICLoKAAAICLsKAAAICLwKAAAICL0KAAAICL4KAAAICL8KAAAICMAKAAAICMEKAAAICMIKAAAICMMKAAAICMQKAAAICMUKAAAICMYKAAAICMcKAAAICMgKAAAICMkKAAAICMoKAAAICMsKAAAICMwKAAAICM0KAAAICM4KAAAICM8KAAAICNAKAAAICNEKAAAICNIKAAAICNMKAAAICNQKAAAICNUKAAAICNYKAAAICNcKAAAICNgKAAAICNkKAAAICNoKAAAICNsKAAAICNwKAAAICN0KAAAICN4KAAAICN8KAAAICOAKAAAICOEKAAAICOIKAAAICOMKAAAICOQKAAAICOUKAAAICOYKAAAICOcKAAAICOgKAAAICOkKAAAICOoKAAAICOsKAAAICOwKAAAICO0KAAAICO4KAAAICO8KAAAICPAKAAAICPEKAAAICPIKAAAICPMKAAAICPQKAAAICPUKAAAICPYKAAAICPcKAAAICPgKAAAICPkKAAAICPoKAAAICPsKAAAICPwKAAAICP0KAAAICP4KAAAICP8KAAAICAALAAAICAELAAAICAILAAAICAMLAAAICAQLAAAICAULAAAICAYLAAAICAcLAAAICAgLAAAICAkLAAAICAoLAAAICAsLAAAICAwLAAAICA0LAAAICA4LAAAICA8LAAAICBALAAAICBELAAAICBILAAAICBMLAAAICBQLAAAICBULAAAICBYLAAAICBcLAAAICBgLAAAICBkLAAAICBoLAAAICBsLAAAICBwLAAAICB0LAAAICB4LAAAICB8LAAAICCALAAAICCELAAAICCILAAAICCMLAAAICCQLAAAICCULAAAICCYLAAAICCcLAAAICCgLAAAICCkLAAAICCoLAAAICCsLAAAICCwLAAAICC0LAAAICC4LAAAICC8LAAAICDALAAAICDELAAAICDILAAAICDMLAAAICDQLAAAICDULAAAICDYLAAAICDcLAAAICDgLAAAICDkLAAAICDoLAAAICDsLAAAICDwLAAAICD0LAAAICD4LAAAICD8LAAAICEALAAAICEELAAAICEILAAAICEMLAAAICEQLAAAICEULAAAICEYLAAAICEcLAAAICEgLAAAICEkLAAAICEoLAAAICEsLAAAICEwLAAAICE0LAAAICE4LAAAICE8LAAAICFALAAAICFELAAAICFILAAAICFMLAAAICFQLAAAICFULAAAICFYLAAAICFcLAAAICFgLAAAICFkLAAAICFoLAAAICFsLAAAICFwLAAAICF0LAAAICF4LAAAICF8LAAAICGALAAAICGELAAAICGILAAAICGMLAAAICGQLAAAICGULAAAICGYLAAAICGcLAAAICGgLAAAICGkLAAAICGoLAAAICGsLAAAICGwLAAAICG0LAAAICG4LAAAICG8LAAAICHALAAAICHELAAAICHILAAAICHMLAAAICHQLAAAICHULAAAICHYLAAAICHcLAAAICHgLAAAICHkLAAAICHoLAAAICHsLAAAICHwLAAAICH0LAAAICH4LAAAICH8LAAAICIALAAAICIELAAAICIILAAAICIMLAAAICIQLAAAICIULAAAICIYLAAAICIcLAAAICIgLAAAICIkLAAAICIoLAAAICIsLAAAICIwLAAAICI0LAAAICI4LAAAICI8LAAAICJALAAAICJELAAAICJILAAAICJMLAAAICJQLAAAICJULAAAICJYLAAAICJcLAAAICJgLAAAICJkLAAAICJoLAAAICJsLAAAICJwLAAAICJ0LAAAICJ4LAAAICJ8LAAAICKALAAAICKELAAAICKILAAAICKMLAAAICKQLAAAICKULAAAICKYLAAAICKcLAAAICKgLAAAICKkLAAAICKoLAAAICKsLAAAICKwLAAAICK0LAAAICK4LAAAICK8LAAAICLALAAAICLELAAAICLILAAAICLMLAAAICLQLAAAICLULAAAICLYLAAAICLcLAAAICLgLAAAICLkLAAAICLoLAAAICLsLAAAICLwLAAAICL0LAAAICL4LAAAICL8LAAAICMALAAAICMELAAAICMILAAAICMMLAAAICMQLAAAICMULAAAICMYLAAAICMcLAAAICMgLAAAICMkLAAAICMoLAAAICMsLAAAICMwLAAAICM0LAAAICM4LAAAICM8LAAAICNALAAAICNELAAAICNILAAAICNMLAAAICNQLAAAICNULAAAICNYLAAAICNcLAAAICNgLAAAICNkLAAAICNoLAAAICNsLAAAICNwLAAAICN0LAAAICN4LAAAICN8LAAAICOALAAAICOELAAAICOILAAAICOMLAAAICOQLAAAICOULAAAICOYLAAAICOcLAAAICOgLAAAICOkLAAAICOoLAAAICOsLAAAICOwLAAAICO0LAAAICO4LAAAICO8LAAAICPALAAAICPELAAAICPILAAAICPMLAAAICPQLAAAICPULAAAICPYLAAAICPcLAAAICPgLAAAICPkLAAAICPoLAAAICPsLAAAICPwLAAAICP0LAAAICP4LAAAICP8LAAAICAAMAAAICAEMAAAICAIMAAAICAMMAAAICAQMAAAICAUMAAAICAYMAAAICAcMAAAICAgMAAAICAkMAAAICAoMAAAICAsMAAAICAwMAAAICA0MAAAICA4MAAAICA8MAAAICBAMAAAICBEMAAAICBIMAAAICBMMAAAICBQMAAAICBUMAAAICBYMAAAICBcMAAAICBgMAAAICBkMAAAICBoMAAAICBsMAAAICBwMAAAICB0MAAAICB4MAAAICB8MAAAICCAMAAAICCEMAAAICCIMAAAICCMMAAAICCQMAAAICCUMAAAICCYMAAAICCcMAAAICCgMAAAICCkMAAAICCoMAAAICCsMAAAICCwMAAAICC0MAAAICC4MAAAICC8MAAAICDAMAAAICDEMAAAICDIMAAAICDMMAAAICDQMAAAICDUMAAAICDYMAAAICDcMAAAICDgMAAAICDkMAAAICDoMAAAICDsMAAAICDwMAAAICD0MAAAICD4MAAAICD8MAAAICEAMAAAICEEMAAAICEIMAAAICEMMAAAICEQMAAAICEUMAAAICEYMAAAICEcMAAAICEgMAAAICEkMAAAICEoMAAAICEsMAAAICEwMAAAICE0MAAAICE4MAAAICE8MAAAICFAMAAAICFEMAAAICFIMAAAICFMMAAAICFQMAAAICFUMAAAICFYMAAAICFcMAAAICFgMAAAICFkMAAAICFoMAAAICFsMAAAICFwMAAAICF0MAAAICF4MAAAICF8MAAAICGAMAAAICGEMAAAICGIMAAAICGMMAAAICGQMAAAICGUMAAAICGYMAAAICGcMAAAICGgMAAAICGkMAAAICGoMAAAICGsMAAAICGwMAAAICG0MAAAICG4MAAAICG8MAAAICHAMAAAICHEMAAAICHIMAAAICHMMAAAICHQMAAAICHUMAAAICHYMAAAICHcMAAAICHgMAAAICHkMAAAICHoMAAAICHsMAAAICHwMAAAICH0MAAAICH4MAAAICH8MAAAICIAMAAAICIEMAAAICIIMAAAICIMMAAAICIQMAAAICIUMAAAICIYMAAAICIcMAAAICIgMAAAICIkMAAAICIoMAAAICIsMAAAICIwMAAAICI0MAAAICI4MAAAICI8MAAAICJAMAAAICJEMAAAICJIMAAAICJMMAAAICJQMAAAICJUMAAAICJYMAAAICJcMAAAICJgMAAAICJkMAAAICJoMAAAICJsMAAAICJwMAAAICJ0MAAAICJ4MAAAICJ8MAAAICKAMAAAICKEMAAAICKIMAAAICKMMAAAICKQMAAAICKUMAAAICKYMAAAICKcMAAAICKgMAAAICKkMAAAICKoMAAAICKsMAAAICKwMAAAICK0MAAAICK4MAAAICK8MAAAICLAMAAAICLEMAAAICLIMAAAICLMMAAAICLQMAAAICLUMAAAICLYMAAAICLcMAAAICLgMAAAICLkMAAAICLoMAAAICLsMAAAICLwMAAAICL0MAAAICL4MAAAICL8MAAAICMAMAAAICMEMAAAICMIMAAAICMMMAAAICMQMAAAICMUMAAAICMYMAAAICMcMAAAICMgMAAAICMkMAAAICMoMAAAICMsMAAAICMwMAAAICM0MAAAICM4MAAAICM8MAAAICNAMAAAICNEMAAAICNIMAAAICNMMAAAICNQMAAAICNUMAAAICNYMAAAICNcMAAAICNgMAAAICNkMAAAICNoMAAAICNsMAAAICNwMAAAICN0MAAAICN4MAAAICN8MAAAICOAMAAAICOEMAAAICOIMAAAICOMMAAAICOQMAAAICOUMAAAICOYMAAAICOcMAAAICOgMAAAICOkMAAAICOoMAAAICOsMAAAICOwMAAAICO0MAAAICO4MAAAICO8MAAAICPAMAAAICPEMAAAICPIMAAAICPMMAAAICPQMAAAICPUMAAAICPYMAAAICPcMAAAICPgMAAAICPkMAAAICPoMAAAICPsMAAAICPwMAAAICP0MAAAICP4MAAAICP8MAAAICAANAAAICAENAAAICAINAAAICAMNAAAICAQNAAAICAUNAAAICAYNAAAICAcNAAAICAgNAAAICAkNAAAICAoNAAAICAsNAAAICAwNAAAICA0NAAAICA4NAAAICA8NAAAICBANAAAICBENAAAICBINAAAICBMNAAAICBQNAAAICBUNAAAICBYNAAAICBcNAAAICBgNAAAICBkNAAAICBoNAAAICBsNAAAICBwNAAAICB0NAAAICB4NAAAICB8NAAAICCANAAAICCENAAAICCINAAAICCMNAAAICCQNAAAICCUNAAAICCYNAAAICCcNAAAICCgNAAAICCkNAAAICCoNAAAICCsNAAAICCwNAAAICC0NAAAICC4NAAAICC8NAAAICDANAAAICDENAAAICDINAAAICDMNAAAICDQNAAAICDUNAAAICDYNAAAICDcNAAAICDgNAAAICDkNAAAICDoNAAAICDsNAAAICDwNAAAICD0NAAAICD4NAAAICD8NAAAICEANAAAICEENAAAICEINAAAICEMNAAAICEQNAAAICEUNAAAICEYNAAAICEcNAAAICEgNAAAICEkNAAAICEoNAAAICEsNAAAICEwNAAAICE0NAAAICE4NAAAICE8NAAAICFANAAAICFENAAAICFINAAAICFMNAAAICFQNAAAICFUNAAAICFYNAAAICFcNAAAICFgNAAAICFkNAAAICFoNAAAICFsNAAAICFwNAAAICF0NAAAICF4NAAAICF8NAAAICGANAAAICGENAAAICGINAAAICGMNAAAICGQNAAAICGUNAAAICGYNAAAICGcNAAAICGgNAAAICGkNAAAICGoNAAAICGsNAAAICGwNAAAICG0NAAAICG4NAAAICG8NAAAICHANAAAICHENAAAICHINAAAICHMNAAAICHQNAAAICHUNAAAICHYNAAAICHcNAAAICHgNAAAICHkNAAAICHoNAAAICHsNAAAICHwNAAAICH0NAAAICH4NAAAICH8NAAAICIANAAAICIENAAAICIINAAAICIMNAAAICIQNAAAICIUNAAAICIYNAAAICIcNAAAICIgNAAAICIkNAAAICIoNAAAICIsNAAAICIwNAAAICI0NAAAICI4NAAAICI8NAAAICJANAAAICJENAAAICJINAAAICJMNAAAICJQNAAAICJUNAAAICJYNAAAICJcNAAAICJgNAAAICJkNAAAICJoNAAAICJsNAAAICJwNAAAICJ0NAAAICJ4NAAAICJ8NAAAICKANAAAICKENAAAICKINAAAICKMNAAAICKQNAAAICKUNAAAICKYNAAAICKcNAAAICKgNAAAICKkNAAAICKoNAAAICKsNAAAICKwNAAAICK0NAAAICK4NAAAICK8NAAAICLANAAAICLENAAAICLINAAAICLMNAAAICLQNAAAICLUNAAAICLYNAAAICLcNAAAICLgNAAAICLkNAAAICLoNAAAICLsNAAAICLwNAAAICL0NAAAICL4NAAAICL8NAAAICMANAAAICMENAAAICMINAAAICMMNAAAICMQNAAAICMUNAAAICMYNAAAICMcNAAAICMgNAAAICMkNAAAICMoNAAAICMsNAAAICMwNAAAICM0NAAAICM4NAAAICM8NAAAICNANAAAICNENAAAICNINAAAICNMNAAAICNQNAAAICNUNAAAICNYNAAAICNcNAAAICNgNAAAICNkNAAAICNoNAAAICNsNAAAICNwNAAAICN0NAAAICN4NAAAICN8NAAAICOANAAAICOENAAAICOINAAAICOMNAAAICOQNAAAICOUNAAAICOYNAAAICOcNAAAICOgNAAAICOkNAAAICOoNAAAICOsNAAAICOwNAAAICO0NAAAICO4NAAAICO8NAAAICPANAAAICPENAAAICPINAAAICPMNAAAICPQNAAAICPUNAAAICPYNAAAICPcNAAAICPgNAAAICPkNAAAICPoNAAAICPsNAAAICPwNAAAICP0NAAAICP4NAAAICP8NAAAICAAOAAAICAEOAAAICAIOAAAICAMOAAAICAQOAAAICAUOAAAICAYOAAAICAcOAAAICAgOAAAICAkOAAAICAoOAAAICAsOAAAICAwOAAAICA0OAAAICA4OAAAICA8OAAAICBAOAAAICBEOAAAICBIOAAAICBMOAAAICBQOAAAICBUOAAAICBYOAAAICBcOAAAICBgOAAAICBkOAAAICBoOAAAICBsOAAAICBwOAAAICB0OAAAICB4OAAAICB8OAAAICCAOAAAICCEOAAAICCIOAAAICCMOAAAICCQOAAAICCUOAAAICCYOAAAICCcOAAAICCgOAAAICCkOAAAICCoOAAAICCsOAAAICCwOAAAICC0OAAAICC4OAAAICC8OAAAICDAOAAAICDEOAAAICDIOAAAICDMOAAAICDQOAAAICDUOAAAICDYOAAAICDcOAAAICDgOAAAICDkOAAAICDoOAAAICDsOAAAICDwOAAAICD0OAAAICD4OAAAICD8OAAAICEAOAAAICEEOAAAICEIOAAAICEMOAAAICEQOAAAICEUOAAAICEYOAAAICEcOAAAICEgOAAAICEkOAAAICEoOAAAICEsOAAAICEwOAAAICE0OAAAICE4OAAAICE8OAAAICFAOAAAICFEOAAAICFIOAAAICFMOAAAICFQOAAAICFUOAAAICFYOAAAICFcOAAAICFgOAAAICFkOAAAICFoOAAAICFsOAAAICFwOAAAICF0OAAAICF4OAAAICF8OAAAICGAOAAAICGEOAAAICGIOAAAICGMOAAAICGQOAAAICGUOAAAICGYOAAAICGcOAAAICGgOAAAICGkOAAAICGoOAAAICGsOAAAICGwOAAAICG0OAAAICG4OAAAICG8OAAAICHAOAAAICHEOAAAICHIOAAAICHMOAAAICHQOAAAICHUOAAAICHYOAAAICHcOAAAICHgOAAAICHkOAAAICHoOAAAICHsOAAAICHwOAAAICH0OAAAICH4OAAAICH8OAAAICIAOAAAICIEOAAAICIIOAAAICIMOAAAICIQOAAAICIUOAAAICIYOAAAICIcOAAAICIgOAAAICIkOAAAICIoOAAAICIsOAAAICIwOAAAICI0OAAAICI4OAAAICI8OAAAICJAOAAAICJEOAAAICJIOAAAICJMOAAAICJQOAAAICJUOAAAICJYOAAAICJcOAAAICJgOAAAICJkOAAAICJoOAAAICJsOAAAICJwOAAAICJ0OAAAICJ4OAAAICJ8OAAAICKAOAAAICKEOAAAICKIOAAAICKMOAAAICKQOAAAICKUOAAAICKYOAAAICKcOAAAICKgOAAAICKkOAAAICKoOAAAICKsOAAAICKwOAAAICK0OAAAICK4OAAAICK8OAAAICLAOAAAICLEOAAAICLIOAAAICLMOAAAICLQOAAAICLUOAAAICLYOAAAICLcOAAAICLgOAAAICLkOAAAICLoOAAAICLsOAAAICLwOAAAICL0OAAAICL4OAAAICL8OAAAICMAOAAAICMEOAAAICMIOAAAICMMOAAAICMQOAAAICMUOAAAICMYOAAAICMcOAAAICMgOAAAICMkOAAAICMoOAAAICMsOAAAICMwOAAAICM0OAAAICM4OAAAICM8OAAAICNAOAAAICNEOAAAICNIOAAAICNMOAAAICNQOAAAICNUOAAAICNYOAAAICNcOAAAICNgOAAAICNkOAAAICNoOAAAICNsOAAAICNwOAAAICN0OAAAICN4OAAAICN8OAAAICOAOAAAICOEOAAAICOIOAAAICOMOAAAICOQOAAAICOUOAAAICOYOAAAICOcOAAAICOgOAAAICOkOAAAICOoOAAAICOsOAAAICOwOAAAICO0OAAAICO4OAAAICO8OAAAICPAOAAAICPEOAAAICPIOAAAICPMOAAAICPQOAAAICPUOAAAICPYOAAAICPcOAAAICPgOAAAICPkOAAAICPoOAAAICPsOAAAICPwOAAAICP0OAAAICP4OAAAICP8OAAAICAAPAAAICAEPAAAICAIPAAAICAMPAAAICAQPAAAICAUPAAAICAYPAAAICAcPAAAICAgPAAAICAkPAAAICAoPAAAICAsPAAAICAwPAAAICA0PAAAICA4PAAAICA8PAAAICBAPAAAICBEPAAAICBIPAAAICBMPAAAICBQPAAAICBUPAAAICBYPAAAICBcPAAAICBgPAAAICBkPAAAICBoPAAAICBsPAAAICBwPAAAICB0PAAAICB4PAAAICB8PAAAICCAPAAAICCEPAAAICCIPAAAICCMPAAAICCQPAAAICCUPAAAICCYPAAAICCcPAAAICCgPAAAICCkPAAAICCoPAAAICCsPAAAICCwPAAAICC0PAAAICC4PAAAICC8PAAAICDAPAAAICDEPAAAICDIPAAAICDMPAAAICDQPAAAICDUPAAAICDYPAAAICDcPAAAICDgPAAAICDkPAAAICDoPAAAICDsPAAAICDwPAAAICD0PAAAICD4PAAAICD8PAAAICEAPAAAICEEPAAAICEIPAAAICEMPAAAICEQPAAAICEUPAAAICEYPAAAICEcPAAAICEgPAAAICEkPAAAICEoPAAAICEsPAAAICEwPAAAICE0PAAAICE4PAAAICE8PAAAICFAPAAAICFEPAAAICFIPAAAICFMPAAAICFQPAAAICFUPAAAICFYPAAAICFcPAAAICFgPAAAICFkPAAAICFoPAAAICFsPAAAICFwPAAAICF0PAAAICF4PAAAICF8PAAAICGAPAAAICGEPAAAICGIPAAAICGMPAAAICGQPAAAICGUPAAAICGYPAAAICGcPAAAICGgPAAAICGkPAAAICGoPAAAICGsPAAAICGwPAAAICG0PAAAICG4PAAAICG8PAAAICHAPAAAICHEPAAAICHIPAAAICHMPAAAICHQPAAAICHUPAAAICHYPAAAICHcPAAAICHgPAAAICHkPAAAICHoPAAAICHsPAAAICHwPAAAICH0PAAAICH4PAAAICH8PAAAICIAPAAAICIEPAAAICIIPAAAICIMPAAAICIQPAAAICIUPAAAICIYPAAAICIcPAAAICIgPAAAICIkPAAAICIoPAAAICIsPAAAICIwPAAAICI0PAAAICI4PAAAICI8PAAAICJAPAAAICJEPAAAICJIPAAAICJMPAAAICJQPAAAICJUPAAAICJYPAAAICJcPAAAICJgPAAAICJkPAAAICJoPAAAICJsPAAAICJwPAAAICJ0PAAAICJ4PAAAICJ8PAAAICKAPAAAICKEPAAAICKIPAAAICKMPAAAICKQPAAAICKUPAAAICKYPAAAICKcPAAAICKgPAAAICKkPAAAICKoPAAAICKsPAAAICKwPAAAICK0PAAAICK4PAAAICK8PAAAICLAPAAAICLEPAAAICLIPAAAICLMPAAAICLQPAAAICLUPAAAICLYPAAAICLcPAAAICLgPAAAICLkPAAAICLoPAAAICLsPAAAICLwPAAAICL0PAAAICL4PAAAICL8PAAAICMAPAAAICMEPAAAICMIPAAAICMMPAAAICMQPAAAICMUPAAAICMYPAAAICMcPAAAICMgPAAAICMkPAAAICMoPAAAICMsPAAAICMwPAAAICM0PAAAICM4PAAAICM8PAAAICNAPAAAICNEPAAAICNIPAAAICNMPAAAICNQPAAAICNUPAAAICNYPAAAICNcPAAAICNgPAAAICNkPAAAICNoPAAAICNsPAAAICNwPAAAICN0PAAAICN4PAAAICN8PAAAICOAPAAAICOEPAAAICOIPAAAICOMPAAAICOQPAAAICOUPAAAICOYPAAAICOcPAAAICOgPAAAICOkPAAAICOoPAAAICOsPAAAICOwPAAAICO0PAAAICO4PAAAICO8PAAAICPAPAAAICPEPAAAICPIPAAAICPMPAAAICPQPAAAICPUPAAAICPYPAAAICPcPAAAICPgPAAAICPkPAAAICPoPAAAICPsPAAAICPwPAAAICP0PAAAICP4PAAAICP8PAAAICAAQAAAICAEQAAAICAIQAAAICAMQAAAICAQQAAAICAUQAAAICAYQAAAICAcQAAAICAgQAAAICAkQAAAICAoQAAAICAsQAAAICAwQAAAICA0QAAAICA4QAAAICA8QAAAICBAQAAAICBEQAAAICBIQAAAICBMQAAAICBQQAAAICBUQAAAICBYQAAAICBcQAAAICBgQAAAICBkQAAAICBoQAAAICBsQAAAICBwQAAAICB0QAAAICB4QAAAICB8QAAAICCAQAAAICCEQAAAICCIQAAAICCMQAAAICCQQAAAICCUQAAAICCYQAAAICCcQAAAICCgQAAAICCkQAAAICCoQAAAICCsQAAAICCwQAAAICC0QAAAICC4QAAAICC8QAAAICDAQAAAICDEQAAAICDIQAAAICDMQAAAICDQQAAAICDUQAAAICDYQAAAICDcQAAAICDgQAAAICDkQAAAICDoQAAAICDsQAAAICDwQAAAICD0QAAAICD4QAAAICD8QAAAICEAQAAAICEEQAAAICEIQAAAICEMQAAAICEQQAAAICEUQAAAICEYQAAAICEcQAAAICEgQAAAICEkQAAAICEoQAAAICEsQAAAICEwQAAAICE0QAAAICE4QAAAICE8QAAAICFAQAAAICFEQAAAICFIQAAAICFMQAAAICFQQAAAICFUQAAAICFYQAAAICFcQAAAICFgQAAAICFkQAAAICFoQAAAICFsQAAAICFwQAAAICF0QAAAICF4QAAAICF8QAAAICGAQAAAICGEQAAAICGIQAAAICGMQAAAICGQQAAAICGUQAAAICGYQAAAICGcQAAAICGgQAAAICGkQAAAICGoQAAAICGsQAAAICGwQAAAICG0QAAAICG4QAAAICG8QAAAICHAQAAAICHEQAAAICHIQAAAICHMQAAAICHQQAAAICHUQAAAICHYQAAAICHcQAAAICHgQAAAICHkQAAAICHoQAAAICHsQAAAICHwQAAAICH0QAAAICH4QAAAICH8QAAAICIAQAAAICIEQAAAICIIQAAAICIMQAAAICIQQAAAICIUQAAAICIYQAAAICIcQAAAICIgQAAAICIkQAAAICIoQAAAICIsQAAAICIwQAAAICI0QAAAICI4QAAAICI8QAAAICJAQAAAICJEQAAAICJIQAAAICJMQAAAICJQQAAAICJUQAAAICJYQAAAICJcQAAAICJgQAAAICJkQAAAICJoQAAAICJsQAAAICJwQAAAICJ0QAAAICJ4QAAAICJ8QAAAICKAQAAAICKEQAAAICKIQAAAICKMQAAAICKQQAAAICKUQAAAICKYQAAAICKcQAAAICKgQAAAICKkQAAAICKoQAAAICKsQAAAICKwQAAAICK0QAAAICK4QAAAICK8QAAAICLAQAAAICLEQAAAICLIQAAAICLMQAAAICLQQAAAICLUQAAAICLYQAAAICLcQAAAICLgQAAAICLkQAAAICLoQAAAICLsQAAAICLwQAAAICL0QAAAICL4QAAAICL8QAAAICMAQAAAICMEQAAAICMIQAAAICMMQAAAICMQQAAAICMUQAAAICMYQAAAICMcQAAAICMgQAAAICMkQAAAICMoQAAAICMsQAAAICMwQAAAICM0QAAAICM4QAAAICM8QAAAICNAQAAAICNEQAAAICNIQAAAICNMQAAAICNQQAAAICNUQAAAICNYQAAAICNcQAAAICNgQAAAICNkQAAAICNoQAAAICNsQAAAICNwQAAAICN0QAAAICN4QAAAICN8QAAAICOAQAAAICOEQAAAICOIQAAAICOMQAAAICOQQAAAICOUQAAAICOYQAAAICOcQAAAICOgQAAAICOkQAAAICOoQAAAICOsQAAAICOwQAAAICO0QAAAICO4QAAAICO8QAAAICPAQAAAICPEQAAAICPIQAAAICPMQAAAICPQQAAAICPUQAAAICPYQAAAICPcQAAAICPgQAAAICPkQAAAICPoQAAAICPsQAAAICPwQAAAICP0QAAAICP4QAAAICP8QAAAICAARAAAICAERAAAICAIRAAAICAMRAAAICAQRAAAICAURAAAICAYRAAAICAcRAAAICAgRAAAICAkRAAAICAoRAAAICAsRAAAICAwRAAAICA0RAAAICA4RAAAICA8RAAAICBARAAAICBERAAAICBIRAAAICBMRAAAICBQRAAAICBURAAAICBYRAAAICBcRAAAICBgRAAAICBkRAAAICBoRAAAICBsRAAAICBwRAAAICB0RAAAICB4RAAAICB8RAAAICCARAAAICCERAAAICCIRAAAICCMRAAAICCQRAAAICCURAAAICCYRAAAICCcRAAAICCgRAAAICCkRAAAICCoRAAAICCsRAAAICCwRAAAICC0RAAAICC4RAAAICC8RAAAICDARAAAICDERAAAICDIRAAAICDMRAAAICDQRAAAICDURAAAICDYRAAAICDcRAAAICDgRAAAICDkRAAAICDoRAAAICDsRAAAICDwRAAAICD0RAAAICD4RAAAICD8RAAAICEARAAAICEERAAAICEIRAAAICEMRAAAICEQRAAAICEURAAAICEYRAAAICEcRAAAICEgRAAAICEkRAAAICEoRAAAICEsRAAAICEwRAAAICE0RAAAICE4RAAAICE8RAAAICFARAAAICFERAAAICFIRAAAICFMRAAAICFQRAAAICFURAAAICFYRAAAICFcRAAAICFgRAAAICFkRAAAICFoRAAAICFsRAAAICFwRAAAICF0RAAAICF4RAAAICF8RAAAICGARAAAICGERAAAICGIRAAAICGMRAAAICGQRAAAICGURAAAICGYRAAAICGcRAAAICGgRAAAICGkRAAAICGoRAAAICGsRAAAICGwRAAAICG0RAAAICG4RAAAICG8RAAAICHARAAAICHERAAAICHIRAAAICHMRAAAICHQRAAAICHURAAAICHYRAAAICHcRAAAICHgRAAAICHkRAAAICHoRAAAICHsRAAAICHwRAAAICH0RAAAICH4RAAAICH8RAAAICIARAAAICIERAAAICIIRAAAICIMRAAAICIQRAAAICIURAAAICIYRAAAICIcRAAAICIgRAAAICIkRAAAICIoRAAAICIsRAAAICIwRAAAICI0RAAAICI4RAAAICI8RAAAICJARAAAICJERAAAICJIRAAAICJMRAAAICJQRAAAICJURAAAICJYRAAAICJcRAAAICJgRAAAICJkRAAAICJoRAAAICJsRAAAICJwRAAAICJ0RAAAICJ4RAAAICJ8RAAAICKARAAAICKERAAAICKIRAAAICKMRAAAICKQRAAAICKURAAAICKYRAAAICKcRAAAICKgRAAAICKkRAAAICKoRAAAICKsRAAAICKwRAAAICK0RAAAICK4RAAAICK8RAAAICLARAAAICLERAAAICLIRAAAICLMRAAAICLQRAAAICLURAAAICLYRAAAICLcRAAAICLgRAAAICLkRAAAICLoRAAAICLsRAAAICLwRAAAICL0RAAAICL4RAAAICL8RAAAICMARAAAICMERAAAICMIRAAAICMMRAAAICMQRAAAICMURAAAICMYRAAAICMcRAAAICMgRAAAICMkRAAAICMoRAAAICMsRAAAICMwRAAAICM0RAAAICM4RAAAICM8RAAAICNARAAAICNERAAAICNIRAAAICNMRAAAICNQRAAAICNURAAAICNYRAAAICNcRAAAICNgRAAAICNkRAAAICNoRAAAICNsRAAAICNwRAAAICN0RAAAICN4RAAAICN8RAAAICOARAAAICOERAAAICOIRAAAICOMRAAAICOQRAAAICOURAAAICOYRAAAICOcRAAAICOgRAAAICOkRAAAICOoRAAAICOsRAAAICOwRAAAICO0RAAAICO4RAAAICO8RAAAICPARAAAICPERAAAICPIRAAAICPMRAAAICPQRAAAICPURAAAICPYRAAAICPcRAAAICPgRAAAICPkRAAAICPoRAAAICPsRAAAICPwRAAAICP0RAAAICP4RAAAICP8RAAAICAASAAAICAESAAAICAISAAAICAMSAAAICAQSAAAICAUSAAAICAYSAAAICAcSAAAICAgSAAAICAkSAAAICAoSAAAICAsSAAAICAwSAAAICA0SAAAICA4SAAAICA8SAAAICBASAAAICBESAAAICBISAAAICBMSAAAICBQSAAAICBUSAAAICBYSAAAICBcSAAAICBgSAAAICBkSAAAICBoSAAAICBsSAAAICBwSAAAICB0SAAAICB4SAAAICB8SAAAICCASAAAICCESAAAICCISAAAICCMSAAAICCQSAAAICCUSAAAICCYSAAAICCcSAAAICCgSAAAICCkSAAAICCoSAAAICCsSAAAICCwSAAAICC0SAAAICC4SAAAICC8SAAAICDASAAAICDESAAAICDISAAAICDMSAAAICDQSAAAICDUSAAAICDYSAAAICDcSAAAICDgSAAAICDkSAAAICDoSAAAICDsSAAAICDwSAAAICD0SAAAICD4SAAAICD8SAAAICEASAAAICEESAAAICEISAAAICEMSAAAICEQSAAAICEUSAAAICEYSAAAICEcSAAAICEgSAAAICEkSAAAICEoSAAAICEsSAAAICEwSAAAICE0SAAAICE4SAAAICE8SAAAICFASAAAICFESAAAICFISAAAICFMSAAAICFQSAAAICFUSAAAICFYSAAAICFcSAAAICFgSAAAICFkSAAAICFoSAAAICFsSAAAICFwSAAAICF0SAAAICF4SAAAICF8SAAAICGASAAAICGESAAAICGISAAAICGMSAAAICGQSAAAICGUSAAAICGYSAAAICGcSAAAICGgSAAAICGkSAAAICGoSAAAICGsSAAAICGwSAAAICG0SAAAICG4SAAAICG8SAAAICHASAAAICHESAAAICHISAAAICHMSAAAICHQSAAAICHUSAAAICHYSAAAICHcSAAAICHgSAAAICHkSAAAICHoSAAAICHsSAAAICHwSAAAICH0SAAAICH4SAAAICH8SAAAICIASAAAICIESAAAICIISAAAICIMSAAAICIQSAAAICIUSAAAICIYSAAAICIcSAAAICIgSAAAICIkSAAAICIoSAAAICIsSAAAICIwSAAAICI0SAAAICI4SAAAICI8SAAAICJASAAAICJESAAAICJISAAAICJMSAAAICJQSAAAICJUSAAAICJYSAAAICJcSAAAICJgSAAAICJkSAAAICJoSAAAICJsSAAAICJwSAAAICJ0SAAAICJ4SAAAICJ8SAAAICKASAAAICKESAAAICKISAAAICKMSAAAICKQSAAAICKUSAAAICKYSAAAICKcSAAAICKgSAAAICKkSAAAICKoSAAAICKsSAAAICKwSAAAICK0SAAAICK4SAAAICK8SAAAICLASAAAICLESAAAICLISAAAICLMSAAAICLQSAAAICLUSAAAICLYSAAAICLcSAAAICLgSAAAICLkSAAAICLoSAAAICLsSAAAICLwSAAAICL0SAAAICL4SAAAICL8SAAAICMASAAAICMESAAAICMISAAAICMMSAAAICMQSAAAICMUSAAAICMYSAAAICMcSAAAICMgSAAAICMkSAAAICMoSAAAICMsSAAAICMwSAAAICM0SAAAICM4SAAAICM8SAAAICNASAAAICNESAAAICNISAAAICNMSAAAICNQSAAAICNUSAAAICNYSAAAICNcSAAAICNgSAAAICNkSAAAICNoSAAAICNsSAAAICNwSAAAICN0SAAAICN4SAAAICN8SAAAICOASAAAICOESAAAICOISAAAICOMSAAAICOQSAAAICOUSAAAICOYSAAAICOcSAAAICOgSAAAICOkSAAAICOoSAAAICOsSAAAICOwSAAAICO0SAAAICO4SAAAICO8SAAAICPASAAAICPESAAAICPISAAAICPMSAAAICPQSAAAICPUSAAAICPYSAAAICPcSAAAICPgSAAAICPkSAAAICPoSAAAICPsSAAAICPwSAAAICP0SAAAICP4SAAAICP8SAAAICAATAAAICAETAAAICAITAAAICAMTAAAICAQTAAAICAUTAAAICAYTAAAICAcTAAAICAgTAAAICAkTAAAICAoTAAAICAsTAAAICAwTAAAICA0TAAAICA4TAAAICA8TAAAICBATAAAICBETAAAICBITAAAICBMTAAAICBQTAAAICBUTAAAICBYTAAAICBcTAAAICBgTAAAICBkTAAAICBoTAAAICBsTAAAICBwTAAAICB0TAAAICB4TAAAICB8TAAAICCATAAAICCETAAAICCITAAAICCMTAAAICCQTAAAICCUTAAAICCYTAAAICCcTAAAICCgTAAAICCkTAAAICCoTAAAICCsTAAAICCwTAAAICC0TAAAICC4TAAAICC8TAAAICDATAAAICDETAAAICDITAAAICDMTAAAICDQTAAAICDUTAAAICDYTAAAICDcTAAAICDgTAAAICDkTAAAICDoTAAAICDsTAAAICDwTAAAICD0TAAAICD4TAAAICD8TAAAICEATAAAICEETAAAICEITAAAICEMTAAAICEQTAAAICEUTAAAICEYTAAAICEcTAAAICEgTAAAICEkTAAAICEoTAAAICEsTAAAICEwTAAAICE0TAAAICE4TAAAICE8TAAAICFATAAAICFETAAAICFITAAAICFMTAAAICFQTAAAICFUTAAAICFYTAAAICFcTAAAICFgTAAAICFkTAAAICFoTAAAICFsTAAAICFwTAAAICF0TAAAICF4TAAAICF8TAAAICGATAAAICGETAAAICGITAAAICGMTAAAICGQTAAAICGUTAAAICGYTAAAICGcTAAAICGgTAAAICGkTAAAICGoTAAAICGsTAAAICGwTAAAICG0TAAAICG4TAAAICG8TAAAICHATAAAICHETAAAICHITAAAICHMTAAAICHQTAAAICHUTAAAICHYTAAAICHcTAAAICHgTAAAICHkTAAAICHoTAAAICHsTAAAICHwTAAAICH0TAAAICH4TAAAICH8TAAAICIATAAAICIETAAAICIITAAAICIMTAAAICIQTAAAICIUTAAAICIYTAAAICIcTAAAICIgTAAAICIkTAAAICIoTAAAICIsTAAAICIwTAAAICI0TAAAICI4TAAAICI8TAAAICJATAAAICJETAAAICJITAAAICJMTAAAICJQTAAAICJUTAAAICJYTAAAICJcTAAAICJgTAAAICJkTAAAICJoTAAAICJsTAAAICJwTAAAICJ0TAAAICJ4TAAAICJ8TAAAICKATAAAICKETAAAICKITAAAICKMTAAAICKQTAAAICKUTAAAICKYTAAAICKcTAAAICKgTAAAICKkTAAAICKoTAAAICKsTAAAICKwTAAAICK0TAAAICK4TAAAICK8TAAAICLATAAAICLETAAAICLITAAAICLMTAAAICLQTAAAICLUTAAAICLYTAAAICLcTAAAICLgTAAAICLkTAAAICLoTAAAICLsTAAAICLwTAAAICL0TAAAICL4TAAAICL8TAAAICMATAAAICMETAAAICMITAAAICMMTAAAICMQTAAAICMUTAAAICMYTAAAICMcTAAAICMgTAAAICMkTAAAICMoTAAAICMsTAAAICMwTAAAICM0TAAAICM4TAAAICM8TAAAICNATAAAICNETAAAICNITAAAICNMTAAAICNQTAAAICNUTAAAICNYTAAAICNcTAAAICNgTAAAICNkTAAAICNoTAAAICNsTAAAICNwTAAAICN0TAAAICN4TAAAICN8TAAAICOATAAAICOETAAAICOITAAAICOMTAAAICOQTAAAICOUTAAAICOYTAAAICOcTAAAICOgTAAAICOkTAAAICOoTAAAICOsTAAAICOwTAAAICO0TAAAICO4TAAAICO8TAAAICPATAAAICPETAAAICPITAAAICPMTAAAICPQTAAAICPUTAAAICPYTAAAICPcTAAAICPgTAAAICPkTAAAICPoTAAAICPsTAAAICPwTAAAICP0TAAAICP4TAAAICP8TAAAICAAUAAAICAEUAAAICAIUAAAICAMUAAAICAQUAAAICAUUAAAICAYUAAAICAcUAAAICAgUAAAICAkUAAAICAoUAAAICAsUAAAICAwUAAAICA0UAAAICA4UAAAICA8UAAAICBAUAAAICBEUAAAICBIUAAAICBMUAAAICBQUAAAICBUUAAAICBYUAAAICBcUAAAICBgUAAAICBkUAAAICBoUAAAICBsUAAAICBwUAAAICB0UAAAICB4UAAAICB8UAAAICCAUAAAICCEUAAAICCIUAAAICCMUAAAICCQUAAAICCUUAAAICCYUAAAICCcUAAAICCgUAAAICCkUAAAICCoUAAAICCsUAAAICCwUAAAICC0UAAAICC4UAAAICC8UAAAICDAUAAAICDEUAAAICDIUAAAICDMUAAAICDQUAAAICDUUAAAICDYUAAAICDcUAAAICDgUAAAICDkUAAAICDoUAAAICDsUAAAICDwUAAAICD0UAAAICD4UAAAICD8UAAAICEAUAAAICEEUAAAICEIUAAAICEMUAAAICEQUAAAICEUUAAAICEYUAAAICEcUAAAICEgUAAAICEkUAAAICEoUAAAICEsUAAAICEwUAAAICE0UAAAICE4UAAAICE8UAAAICFAUAAAICFEUAAAICFIUAAAICFMUAAAICFQUAAAICFUUAAAICFYUAAAICFcUAAAICFgUAAAICFkUAAAICFoUAAAICFsUAAAICFwUAAAICF0UAAAICF4UAAAICF8UAAAICGAUAAAICGEUAAAICGIUAAAICGMUAAAICGQUAAAICGUUAAAICGYUAAAICGcUAAAICGgUAAAICGkUAAAICGoUAAAICGsUAAAICGwUAAAICG0UAAAICG4UAAAICG8UAAAICHAUAAAICHEUAAAICHIUAAAICHMUAAAICHQUAAAICHUUAAAICHYUAAAICHcUAAAICHgUAAAICHkUAAAICHoUAAAICHsUAAAICHwUAAAICH0UAAAICH4UAAAICH8UAAAICIAUAAAICIEUAAAICIIUAAAICIMUAAAICIQUAAAICIUUAAAICIYUAAAICIcUAAAICIgUAAAICIkUAAAICIoUAAAICIsUAAAICIwUAAAICI0UAAAICI4UAAAICI8UAAAICJAUAAAICJEUAAAICJIUAAAICJMUAAAICJQUAAAICJUUAAAICJYUAAAICJcUAAAICJgUAAAICJkUAAAICJoUAAAICJsUAAAICJwUAAAICJ0UAAAICJ4UAAAICJ8UAAAICKAUAAAICKEUAAAICKIUAAAICKMUAAAICKQUAAAICKUUAAAICKYUAAAICKcUAAAICKgUAAAICKkUAAAICKoUAAAICKsUAAAICKwUAAAICK0UAAAICK4UAAAICK8UAAAICLAUAAAICLEUAAAICLIUAAAICLMUAAAICLQUAAAICLUUAAAICLYUAAAICLcUAAAICLgUAAAICLkUAAAICLoUAAAICLsUAAAICLwUAAAICL0UAAAICL4UAAAICL8UAAAICMAUAAAICMEUAAAICMIUAAAICMMUAAAICMQUAAAICMUUAAAICMYUAAAICMcUAAAICMgUAAAICMkUAAAICMoUAAAICMsUAAAICMwUAAAICM0UAAAICM4UAAAICM8UAAAICNAUAAAICNEUAAAICNIUAAAICNMUAAAICNQUAAAICNUUAAAICNYUAAAICNcUAAAICNgUAAAICNkUAAAICNoUAAAICNsUAAAICNwUAAAICN0UAAAICN4UAAAICN8UAAAICOAUAAAICOEUAAAICOIUAAAICOMUAAAICOQUAAAICOUUAAAICOYUAAAICOcUAAAICOgUAAAICOkUAAAICOoUAAAICOsUAAAICOwUAAAICO0UAAAICO4UAAAICO8UAAAICPAUAAAICPEUAAAICPIUAAAICPMUAAAICPQUAAAICPUUAAAICPYUAAAICPcUAAAICPgUAAAICPkUAAAICPoUAAAICPsUAAAICPwUAAAICP0UAAAICP4UAAAICP8UAAAICAAVAAAICAEVAAAICAIVAAAICAMVAAAICAQVAAAICAUVAAAICAYVAAAICAcVAAAICAgVAAAICAkVAAAICAoVAAAICAsVAAAICAwVAAAICA0VAAAICA4VAAAICA8VAAAICBAVAAAICBEVAAAICBIVAAAICBMVAAAICBQVAAAICBUVAAAICBYVAAAICBcVAAAICBgVAAAICBkVAAAICBoVAAAICBsVAAAICBwVAAAICB0VAAAICB4VAAAICB8VAAAICCAVAAAICCEVAAAICCIVAAAICCMVAAAICCQVAAAICCUVAAAICCYVAAAICCcVAAAICCgVAAAICCkVAAAICCoVAAAICCsVAAAICCwVAAAICC0VAAAICC4VAAAICC8VAAAICDAVAAAICDEVAAAICDIVAAAICDMVAAAICDQVAAAICDUVAAAICDYVAAAICDcVAAAICDgVAAAICDkVAAAICDoVAAAICDsVAAAICDwVAAAICD0VAAAICD4VAAAICD8VAAAICEAVAAAICEEVAAAICEIVAAAICEMVAAAICEQVAAAICEUVAAAICEYVAAAICEcVAAAICEgVAAAICEkVAAAICEoVAAAICEsVAAAICEwVAAAICE0VAAAICE4VAAAICE8VAAAICFAVAAAICFEVAAAICFIVAAAICFMVAAAICFQVAAAICFUVAAAICFYVAAAICFcVAAAICFgVAAAICFkVAAAICFoVAAAICFsVAAAICFwVAAAICF0VAAAICF4VAAAICF8VAAAICGAVAAAICGEVAAAICGIVAAAICGMVAAAICGQVAAAICGUVAAAICGYVAAAICGcVAAAICGgVAAAICGkVAAAICGoVAAAICGsVAAAICGwVAAAICG0VAAAICG4VAAAICG8VAAAICHAVAAAICHEVAAAICHIVAAAICHMVAAAICHQVAAAICHUVAAAICHYVAAAICHcVAAAICHgVAAAICHkVAAAICHoVAAAICHsVAAAICHwVAAAICH0VAAAICH4VAAAICH8VAAAICIAVAAAICIEVAAAICIIVAAAICIMVAAAICIQVAAAICIUVAAAICIYVAAAICIcVAAAICIgVAAAICIkVAAAICIoVAAAICIsVAAAICIwVAAAICI0VAAAICI4VAAAICI8VAAAICJAVAAAICJEVAAAICJIVAAAICJMVAAAICJQVAAAICJUVAAAICJYVAAAICJcVAAAICJgVAAAICJkVAAAICJoVAAAICJsVAAAICJwVAAAICJ0VAAAICJ4VAAAICJ8VAAAICKAVAAAICKEVAAAICKIVAAAICKMVAAAICKQVAAAICKUVAAAICKYVAAAICKcVAAAICKgVAAAICKkVAAAICKoVAAAICKsVAAAICKwVAAAICK0VAAAICK4VAAAICK8VAAAICLAVAAAICLEVAAAICLIVAAAICLMVAAAICLQVAAAICLUVAAAICLYVAAAICLcVAAAICLgVAAAICLkVAAAICLoVAAAICLsVAAAICLwVAAAICL0VAAAICL4VAAAICL8VAAAICMAVAAAICMEVAAAICMIVAAAICMMVAAAICMQVAAAICMUVAAAICMYVAAAICMcVAAAICMgVAAAICMkVAAAICMoVAAAICMsVAAAICMwVAAAICM0VAAAICM4VAAAICM8VAAAICNAVAAAICNEVAAAICNIVAAAICNMVAAAICNQVAAAICNUVAAAICNYVAAAICNcVAAAICNgVAAAICNkVAAAICNoVAAAICNsVAAAICNwVAAAICN0VAAAICN4VAAAICN8VAAAICOAVAAAICOEVAAAICOIVAAAICOMVAAAICOQVAAAICOUVAAAICOYVAAAICOcVAAAICOgVAAAICOkVAAAICOoVAAAICOsVAAAICOwVAAAICO0VAAAICO4VAAAICO8VAAAICPAVAAAICPEVAAAICPIVAAAICPMVAAAICPQVAAAICPUVAAAICPYVAAAICPcVAAAICPgVAAAICPkVAAAICPoVAAAICPsVAAAICPwVAAAICP0VAAAICP4VAAAICP8VAAAICAAWAAAICAEWAAAICAIWAAAICAMWAAAICAQWAAAICAUWAAAICAYWAAAICAcWAAAICAgWAAAICAkWAAAICAoWAAAICAsWAAAICAwWAAAICA0WAAAICA4WAAAICA8WAAAICBAWAAAICBEWAAAICBIWAAAICBMWAAAICBQWAAAICBUWAAAICBYWAAAICBcWAAAICBgWAAAICBkWAAAICBoWAAAICBsWAAAICBwWAAAICB0WAAAICB4WAAAICB8WAAAICCAWAAAICCEWAAAICCIWAAAICCMWAAAICCQWAAAICCUWAAAICCYWAAAICCcWAAAICCgWAAAICCkWAAAICCoWAAAICCsWAAAICCwWAAAICC0WAAAICC4WAAAICC8WAAAICDAWAAAICDEWAAAICDIWAAAICDMWAAAICDQWAAAICDUWAAAICDYWAAAICDcWAAAICDgWAAAICDkWAAAICDoWAAAICDsWAAAICDwWAAAICD0WAAAICD4WAAAICD8WAAAICEAWAAAICEEWAAAICEIWAAAICEMWAAAICEQWAAAICEUWAAAICEYWAAAICEcWAAAICEgWAAAICEkWAAAICEoWAAAICEsWAAAICEwWAAAICE0WAAAICE4WAAAICE8WAAAICFAWAAAICFEWAAAICFIWAAAICFMWAAAICFQWAAAICFUWAAAICFYWAAAICFcWAAAICFgWAAAICFkWAAAICFoWAAAICFsWAAAICFwWAAAICF0WAAAICF4WAAAICF8WAAAICGAWAAAICGEWAAAICGIWAAAICGMWAAAICGQWAAAICGUWAAAICGYWAAAICGcWAAAICGgWAAAICGkWAAAICGoWAAAICGsWAAAICGwWAAAICG0WAAAICG4WAAAICG8WAAAICHAWAAAICHEWAAAICHIWAAAICHMWAAAICHQWAAAICHUWAAAICHYWAAAICHcWAAAICHgWAAAICHkWAAAICHoWAAAICHsWAAAICHwWAAAICH0WAAAICH4WAAAICH8WAAAICIAWAAAICIEWAAAICIIWAAAICIMWAAAICIQWAAAICIUWAAAICIYWAAAICIcWAAAICIgWAAAICIkWAAAICIoWAAAICIsWAAAICIwWAAAICI0WAAAICI4WAAAICI8WAAAICJAWAAAICJEWAAAICJIWAAAICJMWAAAICJQWAAAICJUWAAAICJYWAAAICJcWAAAICJgWAAAICJkWAAAICJoWAAAICJsWAAAICJwWAAAICJ0WAAAICJ4WAAAICJ8WAAAICKAWAAAICKEWAAAICKIWAAAICKMWAAAICKQWAAAICKUWAAAICKYWAAAICKcWAAAICKgWAAAICKkWAAAICKoWAAAICKsWAAAICKwWAAAICK0WAAAICK4WAAAICK8WAAAICLAWAAAICLEWAAAICLIWAAAICLMWAAAICLQWAAAICLUWAAAICLYWAAAICLcWAAAICLgWAAAICLkWAAAICLoWAAAICLsWAAAICLwWAAAICL0WAAAICL4WAAAICL8WAAAICMAWAAAICMEWAAAICMIWAAAICMMWAAAICMQWAAAICMUWAAAICMYWAAAICMcWAAAICMgWAAAICMkWAAAICMoWAAAICMsWAAAICMwWAAAICM0WAAAICM4WAAAICM8WAAAICNAWAAAICNEWAAAICNIWAAAICNMWAAAICNQWAAAICNUWAAAICNYWAAAICNcWAAAICNgWAAAICNkWAAAICNoWAAAICNsWAAAICNwWAAAICN0WAAAICN4WAAAICN8WAAAICOAWAAAICOEWAAAICOIWAAAICOMWAAAICOQWAAAICOUWAAAICOYWAAAICOcWAAAICOgWAAAICOkWAAAICOoWAAAICOsWAAAICOwWAAAICO0WAAAICO4WAAAICO8WAAAICPAWAAAICPEWAAAICPIWAAAICPMWAAAICPQWAAAICPUWAAAICPYWAAAICPcWAAAICPgWAAAICPkWAAAICPoWAAAICPsWAAAICPwWAAAICP0WAAAICP4WAAAICP8WAAAICAAXAAAICAEXAAAICAIXAAAICAMXAAAICAQXAAAICAUXAAAICAYXAAAICAcXAAAICAgXAAAICAkXAAAICAoXAAAICAsXAAAICAwXAAAICA0XAAAICA4XAAAICA8XAAAICBAXAAAICBEXAAAICBIXAAAICBMXAAAICBQXAAAICBUXAAAICBYXAAAICBcXAAAICBgXAAAICBkXAAAICBoXAAAICBsXAAAICBwXAAAICB0XAAAICB4XAAAICB8XAAAICCAXAAAICCEXAAAICCIXAAAICCMXAAAICCQXAAAICCUXAAAICCYXAAAICCcXAAAICCgXAAAICCkXAAAICCoXAAAICCsXAAAICCwXAAAICC0XAAAICC4XAAAICC8XAAAICDAXAAAICDEXAAAICDIXAAAICDMXAAAICDQXAAAICDUXAAAICDYXAAAICDcXAAAICDgXAAAICDkXAAAICDoXAAAICDsXAAAICDwXAAAICD0XAAAICD4XAAAICD8XAAAICEAXAAAICEEXAAAICEIXAAAICEMXAAAICEQXAAAICEUXAAAICEYXAAAICEcXAAAICEgXAAAICEkXAAAICEoXAAAICEsXAAAICEwXAAAICE0XAAAICE4XAAAICE8XAAAICFAXAAAICFEXAAAICFIXAAAICFMXAAAICFQXAAAICFUXAAAICFYXAAAICFcXAAAICFgXAAAICFkXAAAICFoXAAAICFsXAAAICFwXAAAICF0XAAAICF4XAAAICF8XAAAICGAXAAAICGEXAAAICGIXAAAICGMXAAAICGQXAAAICGUXAAAICGYXAAAICGcXAAAICGgXAAAICGkXAAAICGoXAAAICGsXAAAICGwXAAAICG0XAAAICG4XAAAICG8XAAAICHAXAAAICHEXAAAICHIXAAAICHMXAAAICHQXAAAICHUXAAAICHYXAAAICHcXAAAICHgXAAAICHkXAAAICHoXAAAICHsXAAAICHwXAAAICH0XAAAICH4XAAAICH8XAAAICIAXAAAICIEXAAAICIIXAAAICIMXAAAICIQXAAAICIUXAAAICIYXAAAICIcXAAAICIgXAAAICIkXAAAICIoXAAAICIsXAAAICIwXAAAICI0XAAAICI4XAAAICI8XAAAICJAXAAAICJEXAAAICJIXAAAICJMXAAAICJQXAAAICJUXAAAICJYXAAAICJcXAAAICJgXAAAICJkXAAAICJoXAAAICJsXAAAICJwXAAAICJ0XAAAICJ4XAAAICJ8XAAAICKAXAAAICKEXAAAICKIXAAAICKMXAAAICKQXAAAICKUXAAAICKYXAAAICKcXAAAICKgXAAAICKkXAAAICKoXAAAICKsXAAAICKwXAAAICK0XAAAICK4XAAAICK8XAAAICLAXAAAICLEXAAAICLIXAAAICLMXAAAICLQXAAAICLUXAAAICLYXAAAICLcXAAAICLgXAAAICLkXAAAICLoXAAAICLsXAAAICLwXAAAICL0XAAAICL4XAAAICL8XAAAICMAXAAAICMEXAAAICMIXAAAICMMXAAAICMQXAAAICMUXAAAICMYXAAAICMcXAAAICMgXAAAICMkXAAAICMoXAAAICMsXAAAICMwXAAAICM0XAAAICM4XAAAICM8XAAAICNAXAAAICNEXAAAICNIXAAAICNMXAAAICNQXAAAICNUXAAAICNYXAAAICNcXAAAICNgXAAAICNkXAAAICNoXAAAICNsXAAAICNwXAAAICN0XAAAICN4XAAAICN8XAAAICOAXAAAICOEXAAAICOIXAAAICOMXAAAICOQXAAAICOUXAAAICOYXAAAICOcXAAAICOgXAAAICOkXAAAICOoXAAAICOsXAAAICOwXAAAICO0XAAAICO4XAAAICO8XAAAICPAXAAAICPEXAAAICPIXAAAICPMXAAAICPQXAAAICPUXAAAICPYXAAAICPcXAAAICPgXAAAICPkXAAAICPoXAAAICPsXAAAICPwXAAAICP0XAAAICP4XAAAICP8XAAAICAAYAAAICAEYAAAICAIYAAAICAMYAAAICAQYAAAICAUYAAAICAYYAAAICAcYAAAICAgYAAAICAkYAAAICAoYAAAICAsYAAAICAwYAAAICA0YAAAICA4YAAAICA8YAAAICBAYAAAICBEYAAAICBIYAAAICBMYAAAICBQYAAAICBUYAAAICBYYAAAICBcYAAAICBgYAAAICBkYAAAICBoYAAAICBsYAAAICBwYAAAICB0YAAAICB4YAAAICB8YAAAICCAYAAAICCEYAAAICCIYAAAICCMYAAAICCQYAAAICCUYAAAICCYYAAAICCcYAAAICCgYAAAICCkYAAAICCoYAAAICCsYAAAICCwYAAAICC0YAAAICC4YAAAICC8YAAAICDAYAAAICDEYAAAICDIYAAAICDMYAAAICDQYAAAICDUYAAAICDYYAAAICDcYAAAICDgYAAAICDkYAAAICDoYAAAICDsYAAAICDwYAAAICD0YAAAICD4YAAAICD8YAAAICEAYAAAICEEYAAAICEIYAAAICEMYAAAICEQYAAAICEUYAAAICEYYAAAICEcYAAAICEgYAAAICEkYAAAICEoYAAAICEsYAAAICEwYAAAICE0YAAAICE4YAAAICE8YAAAICFAYAAAICFEYAAAICFIYAAAICFMYAAAICFQYAAAICFUYAAAICFYYAAAICFcYAAAICFgYAAAICFkYAAAICFoYAAAICFsYAAAICFwYAAAICF0YAAAICF4YAAAICF8YAAAICGAYAAAICGEYAAAICGIYAAAICGMYAAAICGQYAAAICGUYAAAICGYYAAAICGcYAAAICGgYAAAICGkYAAAICGoYAAAICGsYAAAICGwYAAAICG0YAAAICG4YAAAICG8YAAAICHAYAAAICHEYAAAICHIYAAAICHMYAAAICHQYAAAICHUYAAAICHYYAAAICHcYAAAICHgYAAAICHkYAAAICHoYAAAICHsYAAAICHwYAAAICH0YAAAICH4YAAAICH8YAAAICIAYAAAICIEYAAAICIIYAAAICIMYAAAICIQYAAAICIUYAAAICIYYAAAICIcYAAAICIgYAAAICIkYAAAICIoYAAAICIsYAAAICIwYAAAICI0YAAAICI4YAAAICI8YAAAICJAYAAAICJEYAAAICJIYAAAICJMYAAAICJQYAAAICJUYAAAICJYYAAAICJcYAAAICJgYAAAICJkYAAAICJoYAAAICJsYAAAICJwYAAAICJ0YAAAICJ4YAAAICJ8YAAAICKAYAAAICKEYAAAICKIYAAAICKMYAAAICKQYAAAICKUYAAAICKYYAAAICKcYAAAICKgYAAAICKkYAAAICKoYAAAICKsYAAAICKwYAAAICK0YAAAICK4YAAAICK8YAAAICLAYAAAICLEYAAAICLIYAAAICLMYAAAICLQYAAAICLUYAAAICLYYAAAICLcYAAAICLgYAAAICLkYAAAICLoYAAAICLsYAAAICLwYAAAICL0YAAAICL4YAAAICL8YAAAICMAYAAAICMEYAAAICMIYAAAICMMYAAAICMQYAAAICMUYAAAICMYYAAAICMcYAAAICMgYAAAICMkYAAAICMoYAAAICMsYAAAICMwYAAAICM0YAAAICM4YAAAICM8YAAAICNAYAAAICNEYAAAICNIYAAAICNMYAAAICNQYAAAICNUYAAAICNYYAAAICNcYAAAICNgYAAAICNkYAAAICNoYAAAICNsYAAAICNwYAAAICN0YAAAICN4YAAAICN8YAAAICOAYAAAICOEYAAAICOIYAAAICOMYAAAICOQYAAAICOUYAAAICOYYAAAICOcYAAAICOgYAAAICOkYAAAICOoYAAAICOsYAAAICOwYAAAICO0YAAAICO4YAAAICO8YAAAICPAYAAAICPEYAAAICPIYAAAICPMYAAAICPQYAAAICPUYAAAICPYYAAAICPcYAAAICPgYAAAICPkYAAAICPoYAAAICPsYAAAICPwYAAAICP0YAAAICP4YAAAICP8YAAAICAAZAAAICAEZAAAICAIZAAAICAMZAAAICAQZAAAICAUZAAAICAYZAAAICAcZAAAICAgZAAAICAkZAAAICAoZAAAICAsZAAAICAwZAAAICA0ZAAAICA4ZAAAICA8ZAAAICBAZAAAICBEZAAAICBIZAAAICBMZAAAICBQZAAAICBUZAAAICBYZAAAICBcZAAAICBgZAAAICBkZAAAICBoZAAAICBsZAAAICBwZAAAICB0ZAAAICB4ZAAAICB8ZAAAICCAZAAAICCEZAAAICCIZAAAICCMZAAAICCQZAAAICCUZAAAICCYZAAAICCcZAAAICCgZAAAICCkZAAAICCoZAAAICCsZAAAICCwZAAAICC0ZAAAICC4ZAAAICC8ZAAAICDAZAAAICDEZAAAICDIZAAAICDMZAAAICDQZAAAICDUZAAAICDYZAAAICDcZAAAICDgZAAAICDkZAAAICDoZAAAICDsZAAAICDwZAAAICD0ZAAAICD4ZAAAICD8ZAAAICEAZAAAICEEZAAAICEIZAAAICEMZAAAICEQZAAAICEUZAAAICEYZAAAICEcZAAAICEgZAAAICEkZAAAICEoZAAAICEsZAAAICEwZAAAICE0ZAAAICE4ZAAAICE8ZAAAICFAZAAAICFEZAAAICFIZAAAICFMZAAAICFQZAAAICFUZAAAICFYZAAAICFcZAAAICFgZAAAICFkZAAAICFoZAAAICFsZAAAICFwZAAAICF0ZAAAICF4ZAAAICF8ZAAAICGAZAAAICGEZAAAICGIZAAAICGMZAAAICGQZAAAICGUZAAAICGYZAAAICGcZAAAICGgZAAAICGkZAAAICGoZAAAICGsZAAAICGwZAAAICG0ZAAAICG4ZAAAICG8ZAAAICHAZAAAICHEZAAAICHIZAAAICHMZAAAICHQZAAAICHUZAAAICHYZAAAICHcZAAAICHgZAAAICHkZAAAICHoZAAAICHsZAAAICHwZAAAICH0ZAAAICH4ZAAAICH8ZAAAICIAZAAAICIEZAAAICIIZAAAICIMZAAAICIQZAAAICIUZAAAICIYZAAAICIcZAAAICIgZAAAICIkZAAAICIoZAAAICIsZAAAICIwZAAAICI0ZAAAICI4ZAAAICI8ZAAAICJAZAAAICJEZAAAICJIZAAAICJMZAAAICJQZAAAICJUZAAAICJYZAAAICJcZAAAICJgZAAAICJkZAAAICJoZAAAICJsZAAAICJwZAAAICJ0ZAAAICJ4ZAAAICJ8ZAAAICKAZAAAICKEZAAAICKIZAAAICKMZAAAICKQZAAAICKUZAAAICKYZAAAICKcZAAAICKgZAAAICKkZAAAICKoZAAAICKsZAAAICKwZAAAICK0ZAAAICK4ZAAAICK8ZAAAICLAZAAAICLEZAAAICLIZAAAICLMZAAAICLQZAAAICLUZAAAICLYZAAAICLcZAAAICLgZAAAICLkZAAAICLoZAAAICLsZAAAICLwZAAAICL0ZAAAICL4ZAAAICL8ZAAAICMAZAAAICMEZAAAICMIZAAAICMMZAAAICMQZAAAICMUZAAAICMYZAAAICMcZAAAICMgZAAAICMkZAAAICMoZAAAICMsZAAAICMwZAAAICM0ZAAAICM4ZAAAICM8ZAAAICNAZAAAICNEZAAAICNIZAAAICNMZAAAICNQZAAAICNUZAAAICNYZAAAICNcZAAAICNgZAAAICNkZAAAICNoZAAAICNsZAAAICNwZAAAICN0ZAAAICN4ZAAAICN8ZAAAICOAZAAAICOEZAAAICOIZAAAICOMZAAAICOQZAAAICOUZAAAICOYZAAAICOcZAAAICOgZAAAICOkZAAAICOoZAAAICOsZAAAICOwZAAAICO0ZAAAICO4ZAAAICO8ZAAAICPAZAAAICPEZAAAICPIZAAAICPMZAAAICPQZAAAICPUZAAAICPYZAAAICPcZAAAICPgZAAAICPkZAAAICPoZAAAICPsZAAAICPwZAAAICP0ZAAAICP4ZAAAICP8ZAAAICAAaAAAICAEaAAAICAIaAAAICAMaAAAICAQaAAAICAUaAAAICAYaAAAICAcaAAAICAgaAAAICAkaAAAICAoaAAAICAsaAAAICAwaAAAICA0aAAAICA4aAAAICA8aAAAICBAaAAAICBEaAAAICBIaAAAICBMaAAAICBQaAAAICBUaAAAICBYaAAAICBcaAAAICBgaAAAICBkaAAAICBoaAAAICBsaAAAICBwaAAAICB0aAAAICB4aAAAICB8aAAAICCAaAAAICCEaAAAICCIaAAAICCMaAAAICCQaAAAICCUaAAAICCYaAAAICCcaAAAICCgaAAAICCkaAAAICCoaAAAICCsaAAAICCwaAAAICC0aAAAICC4aAAAICC8aAAAICDAaAAAICDEaAAAICDIaAAAICDMaAAAICDQaAAAICDUaAAAICDYaAAAICDcaAAAICDgaAAAICDkaAAAICDoaAAAICDsaAAAICDwaAAAICD0aAAAICD4aAAAICD8aAAAICEAaAAAICEEaAAAICEIaAAAICEMaAAAICEQaAAAICEUaAAAICEYaAAAICEcaAAAICEgaAAAICEkaAAAICEoaAAAICEsaAAAICEwaAAAICE0aAAAICE4aAAAICE8aAAAICFAaAAAICFEaAAAICFIaAAAICFMaAAAICFQaAAAICFUaAAAICFYaAAAICFcaAAAICFgaAAAICFkaAAAICFoaAAAICFsaAAAICFwaAAAICF0aAAAICF4aAAAICF8aAAAICGAaAAAICGEaAAAICGIaAAAICGMaAAAICGQaAAAICGUaAAAICGYaAAAICGcaAAAICGgaAAAICGkaAAAICGoaAAAICGsaAAAICGwaAAAICG0aAAAICG4aAAAICG8aAAAICHAaAAAICHEaAAAICHIaAAAICHMaAAAICHQaAAAICHUaAAAICHYaAAAICHcaAAAICHgaAAAICHkaAAAICHoaAAAICHsaAAAICHwaAAAICH0aAAAICH4aAAAICH8aAAAICIAaAAAICIEaAAAICIIaAAAICIMaAAAICIQaAAAICIUaAAAICIYaAAAICIcaAAAICIgaAAAICIkaAAAICIoaAAAICIsaAAAICIwaAAAICI0aAAAICI4aAAAICI8aAAAICJAaAAAICJEaAAAICJIaAAAICJMaAAAICJQaAAAICJUaAAAICJYaAAAICJcaAAAICJgaAAAICJkaAAAICJoaAAAICJsaAAAICJwaAAAICJ0aAAAICJ4aAAAICJ8aAAAICKAaAAAICKEaAAAICKIaAAAICKMaAAAICKQaAAAICKUaAAAICKYaAAAICKcaAAAICKgaAAAICKkaAAAICKoaAAAICKsaAAAICKwaAAAICK0aAAAICK4aAAAICK8aAAAICLAaAAAICLEaAAAICLIaAAAICLMaAAAICLQaAAAICLUaAAAICLYaAAAICLcaAAAICLgaAAAICLkaAAAICLoaAAAICLsaAAAICLwaAAAICL0aAAAICL4aAAAICL8aAAAICMAaAAAICMEaAAAICMIaAAAICMMaAAAICMQaAAAICMUaAAAICMYaAAAICMcaAAAICMgaAAAICMkaAAAICMoaAAAICMsaAAAICMwaAAAICM0aAAAICM4aAAAICM8aAAAICNAaAAAICNEaAAAICNIaAAAICNMaAAAICNQaAAAICNUaAAAICNYaAAAICNcaAAAICNgaAAAICNkaAAAICNoaAAAICNsaAAAICNwaAAAICN0aAAAICN4aAAAICN8aAAAICOAaAAAICOEaAAAICOIaAAAICOMaAAAICOQaAAAICOUaAAAICOYaAAAICOcaAAAICOgaAAAICOkaAAAICOoaAAAICOsaAAAICOwaAAAICO0aAAAICO4aAAAICO8aAAAICPAaAAAICPEaAAAICPIaAAAICPMaAAAICPQaAAAICPUaAAAICPYaAAAICPcaAAAICPgaAAAICPkaAAAICPoaAAAICPsaAAAICPwaAAAICP0aAAAICP4aAAAICP8aAAAICAAbAAAICAEbAAAICAIbAAAICAMbAAAICAQbAAAICAUbAAAICAYbAAAICAcbAAAICAgbAAAICAkbAAAICAobAAAICAsbAAAICAwbAAAICA0bAAAICA4bAAAICA8bAAAICBAbAAAICBEbAAAICBIbAAAICBMbAAAICBQbAAAICBUbAAAICBYbAAAICBcbAAAICBgbAAAICBkbAAAICBobAAAICBsbAAAICBwbAAAICB0bAAAICB4bAAAICB8bAAAICCAbAAAICCEbAAAICCIbAAAICCMbAAAICCQbAAAICCUbAAAICCYbAAAICCcbAAAICCgbAAAICCkbAAAICCobAAAICCsbAAAICCwbAAAICC0bAAAICC4bAAAICC8bAAAICDAbAAAICDEbAAAICDIbAAAICDMbAAAICDQbAAAICDUbAAAICDYbAAAICDcbAAAICDgbAAAICDkbAAAICDobAAAICDsbAAAICDwbAAAICD0bAAAICD4bAAAICD8bAAAICEAbAAAICEEbAAAICEIbAAAICEMbAAAICEQbAAAICEUbAAAICEYbAAAICEcbAAAICEgbAAAICEkbAAAICEobAAAICEsbAAAICEwbAAAICE0bAAAICE4bAAAICE8bAAAICFAbAAAICFEbAAAICFIbAAAICFMbAAAICFQbAAAICFUbAAAICFYbAAAICFcbAAAICFgbAAAICFkbAAAICFobAAAICFsbAAAICFwbAAAICF0bAAAICF4bAAAICF8bAAAICGAbAAAICGEbAAAICGIbAAAICGMbAAAICGQbAAAICGUbAAAICGYbAAAICGcbAAAICGgbAAAICGkbAAAICGobAAAICGsbAAAICGwbAAAICG0bAAAICG4bAAAICG8bAAAICHAbAAAICHEbAAAICHIbAAAICHMbAAAICHQbAAAICHUbAAAICHYbAAAICHcbAAAICHgbAAAICHkbAAAICHobAAAICHsbAAAICHwbAAAICH0bAAAICH4bAAAICH8bAAAICIAbAAAICIEbAAAICIIbAAAICIMbAAAICIQbAAAICIUbAAAICIYbAAAICIcbAAAICIgbAAAICIkbAAAICIobAAAICIsbAAAICIwbAAAICI0bAAAICI4bAAAICI8bAAAICJAbAAAICJEbAAAICJIbAAAICJMbAAAICJQbAAAICJUbAAAICJYbAAAICJcbAAAICJgbAAAICJkbAAAICJobAAAICJsbAAAICJwbAAAICJ0bAAAICJ4bAAAICJ8bAAAICKAbAAAICKEbAAAICKIbAAAICKMbAAAICKQbAAAICKUbAAAICKYbAAAICKcbAAAICKgbAAAICKkbAAAICKobAAAICKsbAAAICKwbAAAICK0bAAAICK4bAAAICK8bAAAICLAbAAAICLEbAAAICLIbAAAICLMbAAAICLQbAAAICLUbAAAICLYbAAAICLcbAAAICLgbAAAICLkbAAAICLobAAAICLsbAAAICLwbAAAICL0bAAAICL4bAAAICL8bAAAICMAbAAAICMEbAAAICMIbAAAICMMbAAAICMQbAAAICMUbAAAICMYbAAAICMcbAAAICMgbAAAICMkbAAAICMobAAAICMsbAAAICMwbAAAICM0bAAAICM4bAAAICM8bAAAICNAbAAAICNEbAAAICNIbAAAICNMbAAAICNQbAAAICNUbAAAICNYbAAAICNcbAAAICNgbAAAICNkbAAAICNobAAAICNsbAAAICNwbAAAICN0bAAAICN4bAAAICN8bAAAICOAbAAAICOEbAAAICOIbAAAICOMbAAAICOQbAAAICOUbAAAICOYbAAAICOcbAAAICOgbAAAICOkbAAAICOobAAAICOsbAAAICOwbAAAICO0bAAAICO4bAAAICO8bAAAICPAbAAAICPEbAAAICPIbAAAICPMbAAAICPQbAAAICPUbAAAICPYbAAAICPcbAAAICPgbAAAICPkbAAAICPobAAAICPsbAAAICPwbAAAICP0bAAAICP4bAAAICP8bAAAICAAcAAAICAEcAAAICAIcAAAICAMcAAAICAQcAAAICAUcAAAICAYcAAAICAccAAAICAgcAAAICAkcAAAICAocAAAICAscAAAICAwcAAAICA0cAAAICA4cAAAICA8cAAAICBAcAAAICBEcAAAICBIcAAAICBMcAAAICBQcAAAICBUcAAAICBYcAAAICBccAAAICBgcAAAICBkcAAAICBocAAAICBscAAAICBwcAAAICB0cAAAICB4cAAAICB8cAAAICCAcAAAICCEcAAAICCIcAAAICCMcAAAICCQcAAAICCUcAAAICCYcAAAICCccAAAICCgcAAAICCkcAAAICCocAAAICCscAAAICCwcAAAICC0cAAAICC4cAAAICC8cAAAICDAcAAAICDEcAAAICDIcAAAICDMcAAAICDQcAAAICDUcAAAICDYcAAAICDccAAAICDgcAAAICDkcAAAICDocAAAICDscAAAICDwcAAAICD0cAAAICD4cAAAICD8cAAAICEAcAAAICEEcAAAICEIcAAAICEMcAAAICEQcAAAICEUcAAAICEYcAAAICEccAAAICEgcAAAICEkcAAAICEocAAAICEscAAAICEwcAAAICE0cAAAICE4cAAAICE8cAAAICFAcAAAICFEcAAAICFIcAAAICFMcAAAICFQcAAAICFUcAAAICFYcAAAICFccAAAICFgcAAAICFkcAAAICFocAAAICFscAAAICFwcAAAICF0cAAAICF4cAAAICF8cAAAICGAcAAAICGEcAAAICGIcAAAICGMcAAAICGQcAAAICGUcAAAICGYcAAAICGccAAAICGgcAAAICGkcAAAICGocAAAICGscAAAICGwcAAAICG0cAAAICG4cAAAICG8cAAAICHAcAAAICHEcAAAICHIcAAAICHMcAAAICHQcAAAICHUcAAAICHYcAAAICHccAAAICHgcAAAICHkcAAAICHocAAAICHscAAAICHwcAAAICH0cAAAICH4cAAAICH8cAAAICIAcAAAICIEcAAAICIIcAAAICIMcAAAICIQcAAAICIUcAAAICIYcAAAICIccAAAICIgcAAAICIkcAAAICIocAAAICIscAAAICIwcAAAICI0cAAAICI4cAAAICI8cAAAICJAcAAAICJEcAAAICJIcAAAICJMcAAAICJQcAAAICJUcAAAICJYcAAAICJccAAAICJgcAAAICJkcAAAICJocAAAICJscAAAICJwcAAAICJ0cAAAICJ4cAAAICJ8cAAAICKAcAAAICKEcAAAICKIcAAAICKMcAAAICKQcAAAICKUcAAAICKYcAAAICKccAAAICKgcAAAICKkcAAAICKocAAAICKscAAAICKwcAAAICK0cAAAICK4cAAAICK8cAAAICLAcAAAICLEcAAAICLIcAAAICLMcAAAICLQcAAAICLUcAAAICLYcAAAICLccAAAICLgcAAAICLkcAAAICLocAAAICLscAAAICLwcAAAICL0cAAAICL4cAAAICL8cAAAICMAcAAAICMEcAAAICMIcAAAICMMcAAAICMQcAAAICMUcAAAICMYcAAAICMccAAAICMgcAAAICMkcAAAICMocAAAICMscAAAICMwcAAAICM0cAAAICM4cAAAICM8cAAAICNAcAAAICNEcAAAICNIcAAAICNMcAAAICNQcAAAICNUcAAAICNYcAAAICNccAAAICNgcAAAICNkcAAAICNocAAAICNscAAAICNwcAAAICN0cAAAICN4cAAAICN8cAAAICOAcAAAICOEcAAAICOIcAAAICOMcAAAICOQcAAAICOUcAAAICOYcAAAICOccAAAICOgcAAAICOkcAAAICOocAAAICOscAAAICOwcAAAICO0cAAAICO4cAAAICO8cAAAICPAcAAAICPEcAAAICPIcAAAICPMcAAAICPQcAAAICPUcAAAICPYcAAAICPccAAAICPgcAAAICPkcAAAICPocAAAICPscAAAICPwcAAAICP0cAAAICP4cAAAICP8cAAAICAAdAAAICAEdAAAICAIdAAAICAMdAAAICAQdAAAICAUdAAAICAYdAAAICAcdAAAICAgdAAAICAkdAAAICAodAAAICAsdAAAICAwdAAAICA0dAAAICA4dAAAICA8dAAAICBAdAAAICBEdAAAICBIdAAAICBMdAAAICBQdAAAICBUdAAAICBYdAAAICBcdAAAICBgdAAAICBkdAAAICBodAAAICBsdAAAICBwdAAAICB0dAAAICB4dAAAICB8dAAAICCAdAAAICCEdAAAICCIdAAAICCMdAAAICCQdAAAICCUdAAAICCYdAAAICCcdAAAICCgdAAAICCkdAAAICCodAAAICCsdAAAICCwdAAAICC0dAAAICC4dAAAICC8dAAAICDAdAAAICDEdAAAICDIdAAAICDMdAAAICDQdAAAICDUdAAAICDYdAAAICDcdAAAICDgdAAAICDkdAAAICDodAAAICDsdAAAICDwdAAAICD0dAAAICD4dAAAICD8dAAAICEAdAAAICEEdAAAICEIdAAAICEMdAAAICEQdAAAICEUdAAAICEYdAAAICEcdAAAICEgdAAAICEkdAAAICEodAAAICEsdAAAICEwdAAAICE0dAAAICE4dAAAICE8dAAAICFAdAAAICFEdAAAICFIdAAAICFMdAAAICFQdAAAICFUdAAAICFYdAAAICFcdAAAICFgdAAAICFkdAAAICFodAAAICFsdAAAICFwdAAAICF0dAAAICF4dAAAICF8dAAAICGAdAAAICGEdAAAICGIdAAAICGMdAAAICGQdAAAICGUdAAAICGYdAAAICGcdAAAICGgdAAAICGkdAAAICGodAAAICGsdAAAICGwdAAAICG0dAAAICG4dAAAICG8dAAAICHAdAAAICHEdAAAICHIdAAAICHMdAAAICHQdAAAICHUdAAAICHYdAAAICHcdAAAICHgdAAAICHkdAAAICHodAAAICHsdAAAICHwdAAAICH0dAAAICH4dAAAICH8dAAAICIAdAAAICIEdAAAICIIdAAAICIMdAAAICIQdAAAICIUdAAAICIYdAAAICIcdAAAICIgdAAAICIkdAAAICIodAAAICIsdAAAICIwdAAAICI0dAAAICI4dAAAICI8dAAAICJAdAAAICJEdAAAICJIdAAAICJMdAAAICJQdAAAICJUdAAAICJYdAAAICJcdAAAICJgdAAAICJkdAAAICJodAAAICJsdAAAICJwdAAAICJ0dAAAICJ4dAAAICJ8dAAAICKAdAAAICKEdAAAICKIdAAAICKMdAAAICKQdAAAICKUdAAAICKYdAAAICKcdAAAICKgdAAAICKkdAAAICKodAAAICKsdAAAICKwdAAAICK0dAAAICK4dAAAICK8dAAAICLAdAAAICLEdAAAICLIdAAAICLMdAAAICLQdAAAICLUdAAAICLYdAAAICLcdAAAICLgdAAAICLkdAAAICLodAAAICLsdAAAICLwdAAAICL0dAAAICL4dAAAICL8dAAAICMAdAAAICMEdAAAICMIdAAAICMMdAAAICMQdAAAICMUdAAAICMYdAAAICMcdAAAICMgdAAAICMkdAAAICModAAAICMsdAAAICMwdAAAICM0dAAAICM4dAAAICM8dAAAICNAdAAAICNEdAAAICNIdAAAICNMdAAAICNQdAAAICNUdAAAICNYdAAAICNcdAAAICNgdAAAICNkdAAAICNodAAAICNsdAAAICNwdAAAICN0dAAAICN4dAAAICN8dAAAICOAdAAAICOEdAAAICOIdAAAICOMdAAAICOQdAAAICOUdAAAICOYdAAAICOcdAAAICOgdAAAICOkdAAAICOodAAAICOsdAAAICOwdAAAICO0dAAAICO4dAAAICO8dAAAICPAdAAAICPEdAAAICPIdAAAICPMdAAAICPQdAAAICPUdAAAICPYdAAAICPcdAAAICPgdAAAICPkdAAAICPodAAAICPsdAAAICPwdAAAICP0dAAAICP4dAAAICP8dAAAICAAeAAAICAEeAAAICAIeAAAICAMeAAAICAQeAAAICAUeAAAICAYeAAAICAceAAAICAgeAAAICAkeAAAICAoeAAAICAseAAAICAweAAAICA0eAAAICA4eAAAICA8eAAAICBAeAAAICBEeAAAICBIeAAAICBMeAAAICBQeAAAICBUeAAAICBYeAAAICBceAAAICBgeAAAICBkeAAAICBoeAAAICBseAAAICBweAAAICB0eAAAICB4eAAAICB8eAAAICCAeAAAICCEeAAAICCIeAAAICCMeAAAICCQeAAAICCUeAAAICCYeAAAICCceAAAICCgeAAAICCkeAAAICCoeAAAICCseAAAICCweAAAICC0eAAAICC4eAAAICC8eAAAICDAeAAAICDEeAAAICDIeAAAICDMeAAAICDQeAAAICDUeAAAICDYeAAAICDceAAAICDgeAAAICDkeAAAICDoeAAAICDseAAAICDweAAAICD0eAAAICD4eAAAICD8eAAAICEAeAAAICEEeAAAICEIeAAAICEMeAAAICEQeAAAICEUeAAAICEYeAAAICEceAAAICEgeAAAICEkeAAAICEoeAAAICEseAAAICEweAAAICE0eAAAICE4eAAAICE8eAAAICFAeAAAICFEeAAAICFIeAAAICFMeAAAICFQeAAAICFUeAAAICFYeAAAICFceAAAICFgeAAAICFkeAAAICFoeAAAICFseAAAICFweAAAICF0eAAAICF4eAAAICF8eAAAICGAeAAAICGEeAAAICGIeAAAICGMeAAAICGQeAAAICGUeAAAICGYeAAAICGceAAAICGgeAAAICGkeAAAICGoeAAAICGseAAAICGweAAAICG0eAAAICG4eAAAICG8eAAAICHAeAAAICHEeAAAICHIeAAAICHMeAAAICHQeAAAICHUeAAAICHYeAAAICHceAAAICHgeAAAICHkeAAAICHoeAAAICHseAAAICHweAAAICH0eAAAICH4eAAAICH8eAAAICIAeAAAICIEeAAAICIIeAAAICIMeAAAICIQeAAAICIUeAAAICIYeAAAICIceAAAICIgeAAAICIkeAAAICIoeAAAICIseAAAICIweAAAICI0eAAAICI4eAAAICI8eAAAICJAeAAAICJEeAAAICJIeAAAICJMeAAAICJQeAAAICJUeAAAICJYeAAAICJceAAAICJgeAAAICJkeAAAICJoeAAAICJseAAAICJweAAAICJ0eAAAICJ4eAAAICJ8eAAAICKAeAAAICKEeAAAICKIeAAAICKMeAAAICKQeAAAICKUeAAAICKYeAAAICKceAAAICKgeAAAICKkeAAAICKoeAAAICKseAAAICKweAAAICK0eAAAICK4eAAAICK8eAAAICLAeAAAICLEeAAAICLIeAAAICLMeAAAICLQeAAAICLUeAAAICLYeAAAICLceAAAICLgeAAAICLkeAAAICLoeAAAICLseAAAICLweAAAICL0eAAAICL4eAAAICL8eAAAICMAeAAAICMEeAAAICMIeAAAICMMeAAAICMQeAAAICMUeAAAICMYeAAAICMceAAAICMgeAAAICMkeAAAICMoeAAAICMseAAAICMweAAAICM0eAAAICM4eAAAICM8eAAAICNAeAAAICNEeAAAICNIeAAAICNMeAAAICNQeAAAICNUeAAAICNYeAAAICNceAAAICNgeAAAICNkeAAAICNoeAAAICNseAAAICNweAAAICN0eAAAICN4eAAAICN8eAAAICOAeAAAICOEeAAAICOIeAAAICOMeAAAICOQeAAAICOUeAAAICOYeAAAICOceAAAICOgeAAAICOkeAAAICOoeAAAICOseAAAICOweAAAICO0eAAAICO4eAAAICO8eAAAICPAeAAAICPEeAAAICPIeAAAICPMeAAAICPQeAAAICPUeAAAICPYeAAAICPceAAAICPgeAAAICPkeAAAICPoeAAAICPseAAAICPweAAAICP0eAAAICP4eAAAICP8eAAAICAAfAAAICAEfAAAICAIfAAAICAMfAAAICAQfAAAICAUfAAAICAYfAAAICAcfAAAICAgfAAAICAkfAAAICAofAAAICAsfAAAICAwfAAAICA0fAAAICA4fAAAICA8fAAAICBAfAAAICBEfAAAICBIfAAAICBMfAAAICBQfAAAICBUfAAAICBYfAAAICBcfAAAICBgfAAAICBkfAAAICBofAAAICBsfAAAICBwfAAAICB0fAAAICB4fAAAICB8fAAAICCAfAAAICCEfAAAICCIfAAAICCMfAAAICCQfAAAICCUfAAAICCYfAAAICCcfAAAICCgfAAAICCkfAAAICCofAAAICCsfAAAICCwfAAAICC0fAAAICC4fAAAICC8fAAAICDAfAAAICDEfAAAICDIfAAAICDMfAAAICDQfAAAICDUfAAAICDYfAAAICDcfAAAICDgfAAAICDkfAAAICDofAAAICDsfAAAICDwfAAAICD0fAAAICD4fAAAICD8fAAAICEAfAAAICEEfAAAICEIfAAAICEMfAAAICEQfAAAICEUfAAAICEYfAAAICEcfAAAICEgfAAAICEkfAAAICEofAAAICEsfAAAICEwfAAAICE0fAAAICE4fAAAICE8fAAAICFAfAAAICFEfAAAICFIfAAAICFMfAAAICFQfAAAICFUfAAAICFYfAAAICFcfAAAICFgfAAAICFkfAAAICFofAAAICFsfAAAICFwfAAAICF0fAAAICF4fAAAICF8fAAAICGAfAAAICGEfAAAICGIfAAAICGMfAAAICGQfAAAICGUfAAAICGYfAAAICGcfAAAICGgfAAAICGkfAAAICGofAAAICGsfAAAICGwfAAAICG0fAAAICG4fAAAICG8fAAAICHAfAAAICHEfAAAICHIfAAAICHMfAAAICHQfAAAICHUfAAAICHYfAAAICHcfAAAICHgfAAAICHkfAAAICHofAAAICHsfAAAICHwfAAAICH0fAAAICH4fAAAICH8fAAAICIAfAAAICIEfAAAICIIfAAAICIMfAAAICIQfAAAICIUfAAAICIYfAAAICIcfAAAICIgfAAAICIkfAAAICIofAAAICIsfAAAICIwfAAAICI0fAAAICI4fAAAICI8fAAAICJAfAAAICJEfAAAICJIfAAAICJMfAAAICJQfAAAICJUfAAAICJYfAAAICJcfAAAICJgfAAAICJkfAAAICJofAAAICJsfAAAICJwfAAAICJ0fAAAICJ4fAAAICJ8fAAAICKAfAAAICKEfAAAICKIfAAAICKMfAAAICKQfAAAICKUfAAAICKYfAAAICKcfAAAICKgfAAAICKkfAAAICKofAAAICKsfAAAICKwfAAAICK0fAAAICK4fAAAICK8fAAAICLAfAAAICLEfAAAICLIfAAAICLMfAAAICLQfAAAICLUfAAAICLYfAAAICLcfAAAICLgfAAAICLkfAAAICLofAAAICLsfAAAICLwfAAAICL0fAAAICL4fAAAICL8fAAAICMAfAAAICMEfAAAICMIfAAAICMMfAAAICMQfAAAICMUfAAAICMYfAAAICMcfAAAICMgfAAAICMkfAAAICMofAAAICMsfAAAICMwfAAAICM0fAAAICM4fAAAICM8fAAAICNAfAAAICNEfAAAICNIfAAAICNMfAAAICNQfAAAICNUfAAAICNYfAAAICNcfAAAICNgfAAAICNkfAAAICNofAAAICNsfAAAICNwfAAAICN0fAAAICN4fAAAICN8fAAAICOAfAAAICOEfAAAICOIfAAAICOMfAAAICOQfAAAICOUfAAAICOYfAAAICOcfAAAICOgfAAAICOkfAAAICOofAAAICOsfAAAICOwfAAAICO0fAAAICO4fAAAICO8fAAAICPAfAAAICPEfAAAICPIfAAAICPMfAAAICPQfAAAICPUfAAAICPYfAAAICPcfAAAICPgfAAAICPkfAAAICPofAAAICPsfAAAICPwfAAAICP0fAAAICP4fAAAICP8fAAAICAAgAAAICAEgAAAICAIgAAAICAMgAAAICAQgAAAICAUgAAAICAYgAAAICAcgAAAICAggAAAICAkgAAAICAogAAAICAsgAAAICAwgAAAICA0gAAAICA4gAAAICA8gAAAICBAgAAAICBEgAAAICBIgAAAICBMgAAAICBQgAAAICBUgAAAICBYgAAAICBcgAAAICBggAAAICBkgAAAICBogAAAICBsgAAAICBwgAAAICB0gAAAICB4gAAAICB8gAAAICCAgAAAICCEgAAAICCIgAAAICCMgAAAICCQgAAAICCUgAAAICCYgAAAICCcgAAAICCggAAAICCkgAAAICCogAAAICCsgAAAICCwgAAAICC0gAAAICC4gAAAICC8gAAAICDAgAAAICDEgAAAICDIgAAAICDMgAAAICDQgAAAICDUgAAAICDYgAAAICDcgAAAICDggAAAICDkgAAAICDogAAAICDsgAAAICDwgAAAICD0gAAAICD4gAAAICD8gAAAICEAgAAAICEEgAAAICEIgAAAICEMgAAAICEQgAAAICEUgAAAICEYgAAAICEcgAAAICEggAAAICEkgAAAICEogAAAICEsgAAAICEwgAAAICE0gAAAICE4gAAAICE8gAAAICFAgAAAICFEgAAAICFIgAAAICFMgAAAICFQgAAAICFUgAAAICFYgAAAICFcgAAAICFggAAAICFkgAAAICFogAAAICFsgAAAICFwgAAAICF0gAAAICF4gAAAICF8gAAAICGAgAAAICGEgAAAICGIgAAAICGMgAAAICGQgAAAICGUgAAAICGYgAAAICGcgAAAICGggAAAICGkgAAAICGogAAAICGsgAAAICGwgAAAICG0gAAAICG4gAAAICG8gAAAICHAgAAAICHEgAAAICHIgAAAICHMgAAAICHQgAAAICHUgAAAICHYgAAAICHcgAAAICHggAAAICHkgAAAICHogAAAICHsgAAAICHwgAAAICH0gAAAICH4gAAAICH8gAAAICIAgAAAICIEgAAAICIIgAAAICIMgAAAICIQgAAAICIUgAAAICIYgAAAICIcgAAAICIggAAAICIkgAAAICIogAAAICIsgAAAICIwgAAAICI0gAAAICI4gAAAICI8gAAAICJAgAAAICJEgAAAICJIgAAAICJMgAAAICJQgAAAICJUgAAAICJYgAAAICJcgAAAICJggAAAICJkgAAAICJogAAAICJsgAAAICJwgAAAICJ0gAAAICJ4gAAAICJ8gAAAICKAgAAAICKEgAAAICKIgAAAICKMgAAAICKQgAAAICKUgAAAICKYgAAAICKcgAAAICKggAAAICKkgAAAICKogAAAICKsgAAAICKwgAAAICK0gAAAICK4gAAAICK8gAAAICLAgAAAICLEgAAAICLIgAAAICLMgAAAICLQgAAAICLUgAAAICLYgAAAICLcgAAAICLggAAAICLkgAAAICLogAAAICLsgAAAICLwgAAAICL0gAAAICL4gAAAICL8gAAAICMAgAAAICMEgAAAICMIgAAAICMMgAAAICMQgAAAICMUgAAAICMYgAAAICMcgAAAICMggAAAICMkgAAAICMogAAAICMsgAAAICMwgAAAICM0gAAAICM4gAAAICM8gAAAICNAgAAAICNEgAAAICNIgAAAICNMgAAAICNQgAAAICNUgAAAICNYgAAAICNcgAAAICNggAAAICNkgAAAICNogAAAICNsgAAAICNwgAAAICN0gAAAICN4gAAAICN8gAAAICOAgAAAICOEgAAAICOIgAAAICOMgAAAICOQgAAAICOUgAAAICOYgAAAICOcgAAAICOggAAAICOkgAAAICOogAAAICOsgAAAICOwgAAAICO0gAAAICO4gAAAICO8gAAAICPAgAAAICPEgAAAICPIgAAAICPMgAAAICPQgAAAICPUgAAAICPYgAAAICPcgAAAICPggAAAICPkgAAAICPogAAAICPsgAAAICPwgAAAICP0gAAAICP4gAAAICP8gAAAICAAhAAAICAEhAAAICAIhAAAICAMhAAAICAQhAAAICAUhAAAICAYhAAAICAchAAAICAghAAAICAkhAAAICAohAAAICAshAAAICAwhAAAICA0hAAAICA4hAAAICA8hAAAICBAhAAAICBEhAAAICBIhAAAICBMhAAAICBQhAAAICBUhAAAICBYhAAAICBchAAAICBghAAAICBkhAAAICBohAAAICBshAAAICBwhAAAICB0hAAAICB4hAAAICB8hAAAICCAhAAAICCEhAAAICCIhAAAICCMhAAAICCQhAAAICCUhAAAICCYhAAAICCchAAAICCghAAAICCkhAAAICCohAAAICCshAAAICCwhAAAICC0hAAAICC4hAAAICC8hAAAICDAhAAAICDEhAAAICDIhAAAICDMhAAAICDQhAAAICDUhAAAICDYhAAAICDchAAAICDghAAAICDkhAAAICDohAAAICDshAAAICDwhAAAICD0hAAAICD4hAAAICD8hAAAICEAhAAAICEEhAAAICEIhAAAICEMhAAAICEQhAAAICEUhAAAICEYhAAAICEchAAAICEghAAAICEkhAAAICEohAAAICEshAAAICEwhAAAICE0hAAAICE4hAAAICE8hAAAICFAhAAAICFEhAAAICFIhAAAICFMhAAAICFQhAAAICFUhAAAICFYhAAAICFchAAAICFghAAAICFkhAAAICFohAAAICFshAAAICFwhAAAICF0hAAAICF4hAAAICF8hAAAICGAhAAAICGEhAAAICGIhAAAICGMhAAAICGQhAAAICGUhAAAICGYhAAAICGchAAAICGghAAAICGkhAAAICGohAAAICGshAAAICGwhAAAICG0hAAAICG4hAAAICG8hAAAICHAhAAAICHEhAAAICHIhAAAICHMhAAAICHQhAAAICHUhAAAICHYhAAAICHchAAAICHghAAAICHkhAAAICHohAAAICHshAAAICHwhAAAICH0hAAAICH4hAAAICH8hAAAICIAhAAAICIEhAAAICIIhAAAICIMhAAAICIQhAAAICIUhAAAICIYhAAAICIchAAAICIghAAAICIkhAAAICIohAAAICIshAAAICIwhAAAICI0hAAAICI4hAAAICI8hAAAICJAhAAAICJEhAAAICJIhAAAICJMhAAAICJQhAAAICJUhAAAICJYhAAAICJchAAAICJghAAAICJkhAAAICJohAAAICJshAAAICJwhAAAICJ0hAAAICJ4hAAAICJ8hAAAICKAhAAAICKEhAAAICKIhAAAICKMhAAAICKQhAAAICKUhAAAICKYhAAAICKchAAAICKghAAAICKkhAAAICKohAAAICKshAAAICKwhAAAICK0hAAAICK4hAAAICK8hAAAICLAhAAAICLEhAAAICLIhAAAICLMhAAAICLQhAAAICLUhAAAICLYhAAAICLchAAAICLghAAAICLkhAAAICLohAAAICLshAAAICLwhAAAICL0hAAAICL4hAAAICL8hAAAICMAhAAAICMEhAAAICMIhAAAICMMhAAAICMQhAAAICMUhAAAICMYhAAAICMchAAAICMghAAAICMkhAAAICMohAAAICMshAAAICMwhAAAICM0hAAAICM4hAAAICM8hAAAICNAhAAAICNEhAAAICNIhAAAICNMhAAAICNQhAAAICNUhAAAICNYhAAAICNchAAAICNghAAAICNkhAAAICNohAAAICNshAAAICNwhAAAICN0hAAAICN4hAAAICN8hAAAICOAhAAAICOEhAAAICOIhAAAICOMhAAAICOQhAAAICOUhAAAICOYhAAAICOchAAAICOghAAAICOkhAAAICOohAAAICOshAAAICOwhAAAICO0hAAAICO4hAAAICO8hAAAICPAhAAAICPEhAAAICPIhAAAICPMhAAAICPQhAAAICPUhAAAICPYhAAAICPchAAAICPghAAAICPkhAAAICPohAAAICPshAAAICPwhAAAICP0hAAAICP4hAAAICP8hAAAICAAiAAAICAEiAAAICAIiAAAICAMiAAAICAQiAAAICAUiAAAICAYiAAAICAciAAAICAgiAAAICAkiAAAICAoiAAAICAsiAAAICAwiAAAICA0iAAAICA4iAAAICA8iAAAICBAiAAAICBEiAAAICBIiAAAICBMiAAAICBQiAAAICBUiAAAICBYiAAAICBciAAAICBgiAAAICBkiAAAICBoiAAAICBsiAAAICBwiAAAICB0iAAAICB4iAAAICB8iAAAICCAiAAAICCEiAAAICCIiAAAICCMiAAAICCQiAAAICCUiAAAICCYiAAAICCciAAAICCgiAAAICCkiAAAICCoiAAAICCsiAAAICCwiAAAICC0iAAAICC4iAAAICC8iAAAICDAiAAAICDEiAAAICDIiAAAICDMiAAAICDQiAAAICDUiAAAICDYiAAAICDciAAAICDgiAAAICDkiAAAICDoiAAAICDsiAAAICDwiAAAICD0iAAAICD4iAAAICD8iAAAICEAiAAAICEEiAAAICEIiAAAICEMiAAAICEQiAAAICEUiAAAICEYiAAAICEciAAAICEgiAAAICEkiAAAICEoiAAAICEsiAAAICEwiAAAICE0iAAAICE4iAAAICE8iAAAICFAiAAAICFEiAAAICFIiAAAICFMiAAAICFQiAAAICFUiAAAICFYiAAAICFciAAAICFgiAAAICFkiAAAICFoiAAAICFsiAAAICFwiAAAICF0iAAAICF4iAAAICF8iAAAICGAiAAAICGEiAAAICGIiAAAICGMiAAAICGQiAAAICGUiAAAICGYiAAAICGciAAAICGgiAAAICGkiAAAICGoiAAAICGsiAAAICGwiAAAICG0iAAAICG4iAAAICG8iAAAICHAiAAAICHEiAAAICHIiAAAICHMiAAAICHQiAAAICHUiAAAICHYiAAAICHciAAAICHgiAAAICHkiAAAICHoiAAAICHsiAAAICHwiAAAICH0iAAAICH4iAAAICH8iAAAICIAiAAAICIEiAAAICIIiAAAICIMiAAAICIQiAAAICIUiAAAICIYiAAAICIciAAAICIgiAAAICIkiAAAICIoiAAAICIsiAAAICIwiAAAICI0iAAAICI4iAAAICI8iAAAICJAiAAAICJEiAAAICJIiAAAICJMiAAAICJQiAAAICJUiAAAICJYiAAAICJciAAAICJgiAAAICJkiAAAICJoiAAAICJsiAAAICJwiAAAICJ0iAAAICJ4iAAAICJ8iAAAICKAiAAAICKEiAAAICKIiAAAICKMiAAAICKQiAAAICKUiAAAICKYiAAAICKciAAAICKgiAAAICKkiAAAICKoiAAAICKsiAAAICKwiAAAICK0iAAAICK4iAAAICK8iAAAICLAiAAAICLEiAAAICLIiAAAICLMiAAAICLQiAAAICLUiAAAICLYiAAAICLciAAAICLgiAAAICLkiAAAICLoiAAAICLsiAAAICLwiAAAICL0iAAAICL4iAAAICL8iAAAICMAiAAAICMEiAAAICMIiAAAICMMiAAAICMQiAAAICMUiAAAICMYiAAAICMciAAAICMgiAAAICMkiAAAICMoiAAAICMsiAAAICMwiAAAICM0iAAAICM4iAAAICM8iAAAICNAiAAAICNEiAAAICNIiAAAICNMiAAAICNQiAAAICNUiAAAICNYiAAAICNciAAAICNgiAAAICNkiAAAICNoiAAAICNsiAAAICNwiAAAICN0iAAAICN4iAAAICN8iAAAICOAiAAAICOEiAAAICOIiAAAICOMiAAAICOQiAAAICOUiAAAICOYiAAAICOciAAAICOgiAAAICOkiAAAICOoiAAAICOsiAAAICOwiAAAICO0iAAAICO4iAAAICO8iAAAICPAiAAAICPEiAAAICPIiAAAICPMiAAAICPQiAAAICPUiAAAICPYiAAAICPciAAAICPgiAAAICPkiAAAICPoiAAAICPsiAAAICPwiAAAICP0iAAAICP4iAAAICP8iAAAICAAjAAAICAEjAAAICAIjAAAICAMjAAAICAQjAAAICAUjAAAICAYjAAAICAcjAAAICAgjAAAICAkjAAAICAojAAAICAsjAAAICAwjAAAICA0jAAAICA4jAAAICA8jAAAICBAjAAAICBEjAAAICBIjAAAICBMjAAAICBQjAAAICBUjAAAICBYjAAAICBcjAAAICBgjAAAICBkjAAAICBojAAAICBsjAAAICBwjAAAICB0jAAAICB4jAAAICB8jAAAICCAjAAAICCEjAAAICCIjAAAICCMjAAAICCQjAAAICCUjAAAICCYjAAAICCcjAAAICCgjAAAICCkjAAAICCojAAAICCsjAAAICCwjAAAICC0jAAAICC4jAAAICC8jAAAICDAjAAAICDEjAAAICDIjAAAICDMjAAAICDQjAAAICDUjAAAICDYjAAAICDcjAAAICDgjAAAICDkjAAAICDojAAAICDsjAAAICDwjAAAICD0jAAAICD4jAAAICD8jAAAICEAjAAAICEEjAAAICEIjAAAICEMjAAAICEQjAAAICEUjAAAICEYjAAAICEcjAAAICEgjAAAICEkjAAAICEojAAAICEsjAAAICEwjAAAICE0jAAAICE4jAAAICE8jAAAICFAjAAAICFEjAAAICFIjAAAICFMjAAAICFQjAAAICFUjAAAICFYjAAAICFcjAAAICFgjAAAICFkjAAAICFojAAAICFsjAAAICFwjAAAICF0jAAAICF4jAAAICF8jAAAICGAjAAAICGEjAAAICGIjAAAICGMjAAAICGQjAAAICGUjAAAICGYjAAAICGcjAAAICGgjAAAICGkjAAAICGojAAAICGsjAAAICGwjAAAICG0jAAAICG4jAAAICG8jAAAICHAjAAAICHEjAAAICHIjAAAICHMjAAAICHQjAAAICHUjAAAICHYjAAAICHcjAAAICHgjAAAICHkjAAAICHojAAAICHsjAAAICHwjAAAICH0jAAAICH4jAAAICH8jAAAICIAjAAAICIEjAAAICIIjAAAICIMjAAAICIQjAAAICIUjAAAICIYjAAAICIcjAAAICIgjAAAICIkjAAAICIojAAAICIsjAAAICIwjAAAICI0jAAAICI4jAAAICI8jAAAICJAjAAAICJEjAAAICJIjAAAICJMjAAAICJQjAAAICJUjAAAICJYjAAAICJcjAAAICJgjAAAICJkjAAAICJojAAAICJsjAAAICJwjAAAICJ0jAAAICJ4jAAAICJ8jAAAICKAjAAAICKEjAAAICKIjAAAICKMjAAAICKQjAAAICKUjAAAICKYjAAAICKcjAAAICKgjAAAICKkjAAAICKojAAAICKsjAAAICKwjAAAICK0jAAAICK4jAAAICK8jAAAICLAjAAAICLEjAAAICLIjAAAICLMjAAAICLQjAAAICLUjAAAICLYjAAAICLcjAAAICLgjAAAICLkjAAAICLojAAAICLsjAAAICLwjAAAICL0jAAAICL4jAAAICL8jAAAICMAjAAAICMEjAAAICMIjAAAICMMjAAAICMQjAAAICMUjAAAICMYjAAAICMcjAAAICMgjAAAICMkjAAAICMojAAAICMsjAAAICMwjAAAICM0jAAAICM4jAAAICM8jAAAICNAjAAAICNEjAAAICNIjAAAICNMjAAAICNQjAAAICNUjAAAICNYjAAAICNcjAAAICNgjAAAICNkjAAAICNojAAAICNsjAAAICNwjAAAICN0jAAAICN4jAAAICN8jAAAICOAjAAAICOEjAAAICOIjAAAICOMjAAAICOQjAAAICOUjAAAICOYjAAAICOcjAAAICOgjAAAICOkjAAAICOojAAAICOsjAAAICOwjAAAICO0jAAAICO4jAAAICO8jAAAICPAjAAAICPEjAAAICPIjAAAICPMjAAAICPQjAAAICPUjAAAICPYjAAAICPcjAAAICPgjAAAICPkjAAAICPojAAAICPsjAAAICPwjAAAICP0jAAAICP4jAAAICP8jAAAICAAkAAAICAEkAAAICAIkAAAICAMkAAAICAQkAAAICAUkAAAICAYkAAAICAckAAAICAgkAAAICAkkAAAICAokAAAICAskAAAICAwkAAAICA0kAAAICA4kAAAICA8kAAAICBAkAAAICBEkAAAICBIkAAAICBMkAAAICBQkAAAICBUkAAAICBYkAAAICBckAAAICBgkAAAICBkkAAAICBokAAAICBskAAAICBwkAAAICB0kAAAICB4kAAAICB8kAAAICCAkAAAICCEkAAAICCIkAAAICCMkAAAICCQkAAAICCUkAAAICCYkAAAICCckAAAICCgkAAAICCkkAAAICCokAAAICCskAAAICCwkAAAICC0kAAAICC4kAAAICC8kAAAICDAkAAAICDEkAAAICDIkAAAICDMkAAAICDQkAAAICDUkAAAICDYkAAAICDckAAAICDgkAAAICDkkAAAICDokAAAICDskAAAICDwkAAAICD0kAAAICD4kAAAICD8kAAAICEAkAAAICEEkAAAICEIkAAAICEMkAAAICEQkAAAICEUkAAAICEYkAAAICEckAAAICEgkAAAICEkkAAAICEokAAAICEskAAAICEwkAAAICE0kAAAICE4kAAAICE8kAAAICFAkAAAICFEkAAAICFIkAAAICFMkAAAICFQkAAAICFUkAAAICFYkAAAICFckAAAICFgkAAAICFkkAAAICFokAAAICFskAAAICFwkAAAICF0kAAAICF4kAAAICF8kAAAICGAkAAAICGEkAAAICGIkAAAICGMkAAAICGQkAAAICGUkAAAICGYkAAAICGckAAAICGgkAAAICGkkAAAICGokAAAICGskAAAICGwkAAAICG0kAAAICG4kAAAICG8kAAAICHAkAAAICHEkAAAICHIkAAAICHMkAAAICHQkAAAICHUkAAAICHYkAAAICHckAAAICHgkAAAICHkkAAAICHokAAAICHskAAAICHwkAAAICH0kAAAICH4kAAAICH8kAAAICIAkAAAICIEkAAAICIIkAAAICIMkAAAICIQkAAAICIUkAAAICIYkAAAICIckAAAICIgkAAAICIkkAAAICIokAAAICIskAAAICIwkAAAICI0kAAAICI4kAAAICI8kAAAICJAkAAAICJEkAAAICJIkAAAICJMkAAAICJQkAAAICJUkAAAICJYkAAAICJckAAAICJgkAAAICJkkAAAICJokAAAICJskAAAICJwkAAAICJ0kAAAICJ4kAAAICJ8kAAAICKAkAAAICKEkAAAICKIkAAAICKMkAAAICKQkAAAICKUkAAAICKYkAAAICKckAAAICKgkAAAICKkkAAAICKokAAAICKskAAAICKwkAAAICK0kAAAICK4kAAAICK8kAAAICLAkAAAICLEkAAAICLIkAAAICLMkAAAICLQkAAAICLUkAAAICLYkAAAICLckAAAICLgkAAAICLkkAAAICLokAAAICLskAAAICLwkAAAICL0kAAAICL4kAAAICL8kAAAICMAkAAAICMEkAAAICMIkAAAICMMkAAAICMQkAAAICMUkAAAICMYkAAAICMckAAAICMgkAAAICMkkAAAICMokAAAICMskAAAICMwkAAAICM0kAAAICM4kAAAICM8kAAAICNAkAAAICNEkAAAICNIkAAAICNMkAAAICNQkAAAICNUkAAAICNYkAAAICNckAAAICNgkAAAICNkkAAAICNokAAAICNskAAAICNwkAAAICN0kAAAICN4kAAAICN8kAAAICOAkAAAICOEkAAAICOIkAAAICOMkAAAICOQkAAAICOUkAAAICOYkAAAICOckAAAICOgkAAAICOkkAAAICOokAAAICOskAAAICOwkAAAICO0kAAAICO4kAAAICO8kAAAICPAkAAAICPEkAAAICPIkAAAICPMkAAAICPQkAAAICPUkAAAICPYkAAAICPckAAAICPgkAAAICPkkAAAICPokAAAICPskAAAICPwkAAAICP0kAAAICP4kAAAICP8kAAAICAAlAAAICAElAAAICAIlAAAICAMlAAAICAQlAAAICAUlAAAICAYlAAAICAclAAAICAglAAAICAklAAAICAolAAAICAslAAAICAwlAAAICA0lAAAICA4lAAAICA8lAAAICBAlAAAICBElAAAICBIlAAAICBMlAAAICBQlAAAICBUlAAAICBYlAAAICBclAAAICBglAAAICBklAAAICBolAAAICBslAAAICBwlAAAICB0lAAAICB4lAAAICB8lAAAICCAlAAAICCElAAAICCIlAAAICCMlAAAICCQlAAAICCUlAAAICCYlAAAICCclAAAICCglAAAICCklAAAICColAAAICCslAAAICCwlAAAICC0lAAAICC4lAAAICC8lAAAICDAlAAAICDElAAAICDIlAAAICDMlAAAICDQlAAAICDUlAAAICDYlAAAICDclAAAICDglAAAICDklAAAICDolAAAICDslAAAICDwlAAAICD0lAAAICD4lAAAICD8lAAAICEAlAAAICEElAAAICEIlAAAICEMlAAAICEQlAAAICEUlAAAICEYlAAAICEclAAAICEglAAAICEklAAAICEolAAAICEslAAAICEwlAAAICE0lAAAICE4lAAAICE8lAAAICFAlAAAICFElAAAICFIlAAAICFMlAAAICFQlAAAICFUlAAAICFYlAAAICFclAAAICFglAAAICFklAAAICFolAAAICFslAAAICFwlAAAICF0lAAAICF4lAAAICF8lAAAICGAlAAAICGElAAAICGIlAAAICGMlAAAICGQlAAAICGUlAAAICGYlAAAICGclAAAICGglAAAICGklAAAICGolAAAICGslAAAICGwlAAAICG0lAAAICG4lAAAICG8lAAAICHAlAAAICHElAAAICHIlAAAICHMlAAAICHQlAAAICHUlAAAICHYlAAAICHclAAAICHglAAAICHklAAAICHolAAAICHslAAAICHwlAAAICH0lAAAICH4lAAAICH8lAAAICIAlAAAICIElAAAICIIlAAAICIMlAAAICIQlAAAICIUlAAAICIYlAAAICIclAAAICIglAAAICIklAAAICIolAAAICIslAAAICIwlAAAICI0lAAAICI4lAAAICI8lAAAICJAlAAAICJElAAAICJIlAAAICJMlAAAICJQlAAAICJUlAAAICJYlAAAICJclAAAICJglAAAICJklAAAICJolAAAICJslAAAICJwlAAAICJ0lAAAICJ4lAAAICJ8lAAAICKAlAAAICKElAAAICKIlAAAICKMlAAAICKQlAAAICKUlAAAICKYlAAAICKclAAAICKglAAAICKklAAAICKolAAAICKslAAAICKwlAAAICK0lAAAICK4lAAAICK8lAAAICLAlAAAICLElAAAICLIlAAAICLMlAAAICLQlAAAICLUlAAAICLYlAAAICLclAAAICLglAAAICLklAAAICLolAAAICLslAAAICLwlAAAICL0lAAAICL4lAAAICL8lAAAICMAlAAAICMElAAAICMIlAAAICMMlAAAICMQlAAAICMUlAAAICMYlAAAICMclAAAICMglAAAICMklAAAICMolAAAICMslAAAICMwlAAAICM0lAAAICM4lAAAICM8lAAAICNAlAAAICNElAAAICNIlAAAICNMlAAAICNQlAAAICNUlAAAICNYlAAAICNclAAAICNglAAAICNklAAAICNolAAAICNslAAAICNwlAAAICN0lAAAICN4lAAAICN8lAAAICOAlAAAICOElAAAICOIlAAAICOMlAAAICOQlAAAICOUlAAAICOYlAAAICOclAAAICOglAAAICOklAAAICOolAAAICOslAAAICOwlAAAICO0lAAAICO4lAAAICO8lAAAICPAlAAAICPElAAAICPIlAAAICPMlAAAICPQlAAAICPUlAAAICPYlAAAICPclAAAICPglAAAICPklAAAICPolAAAICPslAAAICPwlAAAICP0lAAAICP4lAAAICP8lAAAICAAmAAAICAEmAAAICAImAAAICAMmAAAICAQmAAAICAUmAAAICAYmAAAICAcmAAAICAgmAAAICAkmAAAICAomAAAICAsmAAAICAwmAAAICA0mAAAICA4mAAAICA8mAAAICBAmAAAICBEmAAAICBImAAAICBMmAAAICBQmAAAICBUmAAAICBYmAAAICBcmAAAICBgmAAAICBkmAAAICBomAAAICBsmAAAICBwmAAAICB0mAAAICB4mAAAICB8mAAAICCAmAAAICCEmAAAICCImAAAICCMmAAAICCQmAAAICCUmAAAICCYmAAAICCcmAAAICCgmAAAICCkmAAAICComAAAICCsmAAAICCwmAAAICC0mAAAICC4mAAAICC8mAAAICDAmAAAICDEmAAAICDImAAAICDMmAAAICDQmAAAICDUmAAAICDYmAAAICDcmAAAICDgmAAAICDkmAAAICDomAAAICDsmAAAICDwmAAAICD0mAAAICD4mAAAICD8mAAAICEAmAAAICEEmAAAICEImAAAICEMmAAAICEQmAAAICEUmAAAICEYmAAAICEcmAAAICEgmAAAICEkmAAAICEomAAAICEsmAAAICEwmAAAICE0mAAAICE4mAAAICE8mAAAICFAmAAAICFEmAAAICFImAAAICFMmAAAICFQmAAAICFUmAAAICFYmAAAICFcmAAAICFgmAAAICFkmAAAICFomAAAICFsmAAAICFwmAAAICF0mAAAICF4mAAAICF8mAAAICGAmAAAICGEmAAAICGImAAAICGMmAAAICGQmAAAICGUmAAAICGYmAAAICGcmAAAICGgmAAAICGkmAAAICGomAAAICGsmAAAICGwmAAAICG0mAAAICG4mAAAICG8mAAAICHAmAAAICHEmAAAICHImAAAICHMmAAAICHQmAAAICHUmAAAICHYmAAAICHcmAAAICHgmAAAICHkmAAAICHomAAAICHsmAAAICHwmAAAICH0mAAAICH4mAAAICH8mAAAICIAmAAAICIEmAAAICIImAAAICIMmAAAICIQmAAAICIUmAAAICIYmAAAICIcmAAAICIgmAAAICIkmAAAICIomAAAICIsmAAAICIwmAAAICI0mAAAICI4mAAAICI8mAAAICJAmAAAICJEmAAAICJImAAAICJMmAAAICJQmAAAICJUmAAAICJYmAAAICJcmAAAICJgmAAAICJkmAAAICJomAAAICJsmAAAICJwmAAAICJ0mAAAICJ4mAAAICJ8mAAAICKAmAAAICKEmAAAICKImAAAICKMmAAAICKQmAAAICKUmAAAICKYmAAAICKcmAAAICKgmAAAICKkmAAAICKomAAAICKsmAAAICKwmAAAICK0mAAAICK4mAAAICK8mAAAICLAmAAAICLEmAAAICLImAAAICLMmAAAICLQmAAAICLUmAAAICLYmAAAICLcmAAAICLgmAAAICLkmAAAICLomAAAICLsmAAAICLwmAAAICL0mAAAICL4mAAAICL8mAAAICMAmAAAICMEmAAAICMImAAAICMMmAAAICMQmAAAICMUmAAAICMYmAAAICMcmAAAICMgmAAAICMkmAAAICMomAAAICMsmAAAICMwmAAAICM0mAAAICM4mAAAICM8mAAAICNAmAAAICNEmAAAICNImAAAICNMmAAAICNQmAAAICNUmAAAICNYmAAAICNcmAAAICNgmAAAICNkmAAAICNomAAAICNsmAAAICNwmAAAICN0mAAAICN4mAAAICN8mAAAICOAmAAAICOEmAAAICOImAAAICOMmAAAICOQmAAAICOUmAAAICOYmAAAICOcmAAAICOgmAAAICOkmAAAICOomAAAICOsmAAAICOwmAAAICO0mAAAICO4mAAAICO8mAAAICPAmAAAICPEmAAAICPImAAAICPMmAAAICPQmAAAICPUmAAAICPYmAAAICPcmAAAICPgmAAAICPkmAAAICPomAAAICPsmAAAICPwmAAAICP0mAAAICP4mAAAICP8mAAAICAAnAAAICAEnAAAICAInAAAICAMnAAAICAQnAAAICAUnAAAICAYnAAAICAcnAAAICAgnAAAICAknAAAICAonAAAICAsnAAAICAwnAAAICA0nAAAICA4nAAAICA8nAAAL" } };
+ // fewer than 256 nulls
+ yield return new object[] { new object[200], new string[] { "AAEAAAD/////AQAAAAAAAAAQAQAAAMgAAAANyAs=", "AAEAAAD/////AQAAAAAAAAAQAQAAAMgAAAANyAs=" } };
+ // more than 256 nulls
+ yield return new object[] { new object[300], new string[] { "AAEAAAD/////AQAAAAAAAAAQAQAAACwBAAAOLAEAAAs=", "AAEAAAD/////AQAAAAAAAAAQAQAAACwBAAAOLAEAAAs=" } };
+
+ // Non-vector arrays
+ yield return new object[] { Array.CreateInstance(typeof(uint), new[] { 5 }, new[] { 1 }), new string[] { "AAEAAAD/////AQAAAAAAAAAHAQAAAAMBAAAABQAAAAEAAAAADwAAAAAAAAAAAAAAAAAAAAAAAAAACw==", "AAEAAAD/////AQAAAAAAAAAHAQAAAAMBAAAABQAAAAEAAAAADwAAAAAAAAAAAAAAAAAAAAAAAAAACw==" } };
+ yield return new object[] { Array.CreateInstance(typeof(int), new[] { 0, 0, 0 }, new[] { 0, 0, 0 }), new string[] { "AAEAAAD/////AQAAAAAAAAAHAQAAAAIDAAAAAAAAAAAAAAAAAAAAAAgL", "AAEAAAD/////AQAAAAAAAAAHAQAAAAIDAAAAAAAAAAAAAAAAAAAAAAgL" } };
+ var arr = Array.CreateInstance(typeof(string), new[] { 1, 2 }, new[] { 3, 4 });
+ arr.SetValue("hello", new[] { 3, 5 });
+ yield return new object[] { arr, new string[] { "AAEAAAD/////AQAAAAAAAAAHAQAAAAUCAAAAAQAAAAIAAAADAAAABAAAAAEKBgIAAAAFaGVsbG8L", "AAEAAAD/////AQAAAAAAAAAHAQAAAAUCAAAAAQAAAAIAAAADAAAABAAAAAEKBgIAAAAFaGVsbG8L" } };
+
+ // Globalization types
+ yield return new object[] { CultureInfo.InvariantCulture.CompareInfo, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAACBTeXN0ZW0uR2xvYmFsaXphdGlvbi5Db21wYXJlSW5mbwIAAAAGbV9uYW1lDW1fc29ydFZlcnNpb24BAyBTeXN0ZW0uR2xvYmFsaXphdGlvbi5Tb3J0VmVyc2lvbgYCAAAAAAoL", "AAEAAAD/////AQAAAAAAAAAEAQAAACBTeXN0ZW0uR2xvYmFsaXphdGlvbi5Db21wYXJlSW5mbwQAAAAGbV9uYW1lCXdpbjMyTENJRAdjdWx0dXJlDW1fU29ydFZlcnNpb24BAAADCAggU3lzdGVtLkdsb2JhbGl6YXRpb24uU29ydFZlcnNpb24GAgAAAAVlbi1VUwAAAAAJBAAACgs=" } };
+ yield return new object[] { new SortVersion(12345, Guid.Parse("9fac6fbb-f683-42f5-a593-0d4a5e34b257")), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAACBTeXN0ZW0uR2xvYmFsaXphdGlvbi5Tb3J0VmVyc2lvbgIAAAAMbV9ObHNWZXJzaW9uCG1fU29ydElkAAMIC1N5c3RlbS5HdWlkOTAAAAT+////C1N5c3RlbS5HdWlkCwAAAAJfYQJfYgJfYwJfZAJfZQJfZgJfZwJfaAJfaQJfagJfawAAAAAAAAAAAAAACAcHAgICAgICAgK7b6yfg/b1QqWTDUpeNLJXCw==", "AAEAAAD/////AQAAAAAAAAAEAQAAACBTeXN0ZW0uR2xvYmFsaXphdGlvbi5Tb3J0VmVyc2lvbgIAAAAMbV9ObHNWZXJzaW9uCG1fU29ydElkAAMIC1N5c3RlbS5HdWlkOTAAAAT+////C1N5c3RlbS5HdWlkCwAAAAJfYQJfYgJfYwJfZAJfZQJfZgJfZwJfaAJfaQJfagJfawAAAAAAAAAAAAAACAcHAgICAgICAgK7b6yfg/b1QqWTDUpeNLJXCw==" } };
+
+ // Drawing types
+ yield return new object[] { new System.Drawing.Point(10, 10), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFxTeXN0ZW0uRHJhd2luZy5QcmltaXRpdmVzLCBWZXJzaW9uPTQuMS4xLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49YjAzZjVmN2YxMWQ1MGEzYQUBAAAAFFN5c3RlbS5EcmF3aW5nLlBvaW50AgAAAAF4AXkAAAgIAgAAAAoAAAAKAAAACw==", "AAEAAAD/////AQAAAAAAAAAMAgAAAFFTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABRTeXN0ZW0uRHJhd2luZy5Qb2ludAIAAAABeAF5AAAICAIAAAAKAAAACgAAAAs=" } };
+ yield return new object[] { System.Drawing.Color.FromArgb(255, 100, 55, 255), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFxTeXN0ZW0uRHJhd2luZy5QcmltaXRpdmVzLCBWZXJzaW9uPTQuMS4xLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49YjAzZjVmN2YxMWQ1MGEzYQUBAAAAFFN5c3RlbS5EcmF3aW5nLkNvbG9yBAAAAARuYW1lBXZhbHVlCmtub3duQ29sb3IFc3RhdGUBAAAACQcHAgAAAAr/N2T/AAAAAAAAAgAL", "AAEAAAD/////AQAAAAAAAAAMAgAAAFFTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABRTeXN0ZW0uRHJhd2luZy5Db2xvcgQAAAAEbmFtZQV2YWx1ZQprbm93bkNvbG9yBXN0YXRlAQAAAAkHBwIAAAAK/zdk/wAAAAAAAAIACw==" } };
+ yield return new object[] { new System.Drawing.PointF(10.5f, 10.25f), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFxTeXN0ZW0uRHJhd2luZy5QcmltaXRpdmVzLCBWZXJzaW9uPTQuMS4xLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49YjAzZjVmN2YxMWQ1MGEzYQUBAAAAFVN5c3RlbS5EcmF3aW5nLlBvaW50RgIAAAABeAF5AAALCwIAAAAAAChBAAAkQQs=", "AAEAAAD/////AQAAAAAAAAAMAgAAAFFTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABVTeXN0ZW0uRHJhd2luZy5Qb2ludEYCAAAAAXgBeQAACwsCAAAAAAAoQQAAJEEL" } };
+ yield return new object[] { new System.Drawing.Rectangle(10, 10, 100, 50), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFxTeXN0ZW0uRHJhd2luZy5QcmltaXRpdmVzLCBWZXJzaW9uPTQuMS4xLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49YjAzZjVmN2YxMWQ1MGEzYQUBAAAAGFN5c3RlbS5EcmF3aW5nLlJlY3RhbmdsZQQAAAABeAF5BXdpZHRoBmhlaWdodAAAAAAICAgIAgAAAAoAAAAKAAAAZAAAADIAAAAL", "AAEAAAD/////AQAAAAAAAAAMAgAAAFFTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABhTeXN0ZW0uRHJhd2luZy5SZWN0YW5nbGUEAAAAAXgBeQV3aWR0aAZoZWlnaHQAAAAACAgICAIAAAAKAAAACgAAAGQAAAAyAAAACw==" } };
+ yield return new object[] { new System.Drawing.RectangleF(10.5f, 10.5f, 52.3f, 69.4f), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFxTeXN0ZW0uRHJhd2luZy5QcmltaXRpdmVzLCBWZXJzaW9uPTQuMS4xLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49YjAzZjVmN2YxMWQ1MGEzYQUBAAAAGVN5c3RlbS5EcmF3aW5nLlJlY3RhbmdsZUYEAAAAAXgBeQV3aWR0aAZoZWlnaHQAAAAACwsLCwIAAAAAAChBAAAoQTMzUULNzIpCCw==", "AAEAAAD/////AQAAAAAAAAAMAgAAAFFTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABlTeXN0ZW0uRHJhd2luZy5SZWN0YW5nbGVGBAAAAAF4AXkFd2lkdGgGaGVpZ2h0AAAAAAsLCwsCAAAAAAAoQQAAKEEzM1FCzcyKQgs=" } };
+ yield return new object[] { new System.Drawing.Size(10, 45), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFxTeXN0ZW0uRHJhd2luZy5QcmltaXRpdmVzLCBWZXJzaW9uPTQuMS4xLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49YjAzZjVmN2YxMWQ1MGEzYQUBAAAAE1N5c3RlbS5EcmF3aW5nLlNpemUCAAAABXdpZHRoBmhlaWdodAAACAgCAAAACgAAAC0AAAAL", "AAEAAAD/////AQAAAAAAAAAMAgAAAFFTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABNTeXN0ZW0uRHJhd2luZy5TaXplAgAAAAV3aWR0aAZoZWlnaHQAAAgIAgAAAAoAAAAtAAAACw==" } };
+ yield return new object[] { new System.Drawing.SizeF(10.2f, 45.8f), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFxTeXN0ZW0uRHJhd2luZy5QcmltaXRpdmVzLCBWZXJzaW9uPTQuMS4xLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49YjAzZjVmN2YxMWQ1MGEzYQUBAAAAFFN5c3RlbS5EcmF3aW5nLlNpemVGAgAAAAV3aWR0aAZoZWlnaHQAAAsLAgAAADMzI0EzMzdCCw==", "AAEAAAD/////AQAAAAAAAAAMAgAAAFFTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABRTeXN0ZW0uRHJhd2luZy5TaXplRgIAAAAFd2lkdGgGaGVpZ2h0AAALCwIAAAAzMyNBMzM3Qgs=" } };
+
+ // Custom object
+ var sealedObjectWithIntStringFields = new SealedObjectWithIntStringFields();
+ yield return new object[] { sealedObjectWithIntStringFields, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAABNU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlNlYWxlZE9iamVjdFdpdGhJbnRTdHJpbmdGaWVsZHMDAAAAB01lbWJlcjEHTWVtYmVyMgdNZW1iZXIzAAEBCAIAAAAAAAAACgoL", "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAABNU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlNlYWxlZE9iamVjdFdpdGhJbnRTdHJpbmdGaWVsZHMDAAAAB01lbWJlcjEHTWVtYmVyMgdNZW1iZXIzAAEBCAIAAAAAAAAACgoL" } };
+ yield return new object[] { new SealedObjectWithIntStringFields() { Member1 = 42, Member2 = null, Member3 = "84" }, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAABNU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlNlYWxlZE9iamVjdFdpdGhJbnRTdHJpbmdGaWVsZHMDAAAAB01lbWJlcjEHTWVtYmVyMgdNZW1iZXIzAAEBCAIAAAAqAAAACgYDAAAAAjg0Cw==", "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAABNU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlNlYWxlZE9iamVjdFdpdGhJbnRTdHJpbmdGaWVsZHMDAAAAB01lbWJlcjEHTWVtYmVyMgdNZW1iZXIzAAEBCAIAAAAqAAAACgYDAAAAAjg0Cw==" } };
+
+ // Custom object with fields pointing to the same object
+ yield return new object[] { new ObjectWithIntStringUShortUIntULongAndCustomObjectFields
+ {
+ Member1 = 10,
+ Member2 = "hello",
+ _member3 = "hello",
+ Member4 = sealedObjectWithIntStringFields,
+ Member4shared = sealedObjectWithIntStringFields,
+ Member5 = new SealedObjectWithIntStringFields(),
+ Member6 = "Hello World",
+ str1 = "hello < world",
+ str2 = "<",
+ str3 = "< world",
+ str4 = "hello < world",
+ u16 = ushort.MaxValue,
+ u32 = uint.MaxValue,
+ u64 = ulong.MaxValue,
+ }, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjIuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAABlU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLk9iamVjdFdpdGhJbnRTdHJpbmdVU2hvcnRVSW50VUxvbmdBbmRDdXN0b21PYmplY3RGaWVsZHMOAAAAB01lbWJlcjEHTWVtYmVyMghfbWVtYmVyMwdNZW1iZXI0DU1lbWJlcjRzaGFyZWQHTWVtYmVyNQdNZW1iZXI2BHN0cjEEc3RyMgRzdHIzBHN0cjQDdTE2A3UzMgN1NjQAAQEEBAQBAQEBAQAAAAhNU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlNlYWxlZE9iamVjdFdpdGhJbnRTdHJpbmdGaWVsZHMCAAAATVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5TZWFsZWRPYmplY3RXaXRoSW50U3RyaW5nRmllbGRzAgAAAE1TeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU2VhbGVkT2JqZWN0V2l0aEludFN0cmluZ0ZpZWxkcwIAAAAODxACAAAACgAAAAYDAAAABWhlbGxvCQMAAAAJBAAAAAkEAAAACQUAAAAGBgAAAAtIZWxsbyBXb3JsZAYHAAAADWhlbGxvIDwgd29ybGQGCAAAAAE8BgkAAAAHPCB3b3JsZAkHAAAA//////////////////8FBAAAAE1TeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU2VhbGVkT2JqZWN0V2l0aEludFN0cmluZ0ZpZWxkcwMAAAAHTWVtYmVyMQdNZW1iZXIyB01lbWJlcjMAAQEIAgAAAAAAAAAKCgEFAAAABAAAAAAAAAAKCgs=", "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjIuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAABlU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLk9iamVjdFdpdGhJbnRTdHJpbmdVU2hvcnRVSW50VUxvbmdBbmRDdXN0b21PYmplY3RGaWVsZHMOAAAAB01lbWJlcjEHTWVtYmVyMghfbWVtYmVyMwdNZW1iZXI0DU1lbWJlcjRzaGFyZWQHTWVtYmVyNQdNZW1iZXI2BHN0cjEEc3RyMgRzdHIzBHN0cjQDdTE2A3UzMgN1NjQAAQEEBAQBAQEBAQAAAAhNU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlNlYWxlZE9iamVjdFdpdGhJbnRTdHJpbmdGaWVsZHMCAAAATVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5TZWFsZWRPYmplY3RXaXRoSW50U3RyaW5nRmllbGRzAgAAAE1TeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU2VhbGVkT2JqZWN0V2l0aEludFN0cmluZ0ZpZWxkcwIAAAAODxACAAAACgAAAAYDAAAABWhlbGxvCQMAAAAJBAAAAAkEAAAACQUAAAAGBgAAAAtIZWxsbyBXb3JsZAYHAAAADWhlbGxvIDwgd29ybGQGCAAAAAE8BgkAAAAHPCB3b3JsZAkHAAAA//////////////////8FBAAAAE1TeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU2VhbGVkT2JqZWN0V2l0aEludFN0cmluZ0ZpZWxkcwMAAAAHTWVtYmVyMQdNZW1iZXIyB01lbWJlcjMAAQEIAgAAAAAAAAAKCgEFAAAABAAAAAAAAAAKCgs=" } };
+
+ // Simple type without a default ctor
+ var point = new Point(1, 2);
+ yield return new object[] { point, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAAAzU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50AgAAAAFYAVkAAAgIAgAAAAEAAAACAAAACw==", "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAAAzU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50AgAAAAFYAVkAAAgIAgAAAAEAAAACAAAACw==" } };
+
+ // Collections
+ yield return new object[] { new System.Collections.BitArray(5, true), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uQ29sbGVjdGlvbnMsIFZlcnNpb249NC4xLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAAAbU3lzdGVtLkNvbGxlY3Rpb25zLkJpdEFycmF5AwAAAAdtX2FycmF5CG1fbGVuZ3RoCF92ZXJzaW9uBwAACAgIAgAAAAkDAAAABQAAAAAAAAAPAwAAAAEAAAAI/////ws=", "AAEAAAD/////AQAAAAAAAAAEAQAAABtTeXN0ZW0uQ29sbGVjdGlvbnMuQml0QXJyYXkDAAAAB21fYXJyYXkIbV9sZW5ndGgIX3ZlcnNpb24HAAAICAgJAgAAAAUAAAAAAAAADwIAAAABAAAACP////8L" } };
+ yield return new object[] { new System.Collections.ArrayList(Enumerable.Range(1, 40).ToList()), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFxTeXN0ZW0uUnVudGltZS5FeHRlbnNpb25zLCBWZXJzaW9uPTQuMi4xLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49YjAzZjVmN2YxMWQ1MGEzYQUBAAAAHFN5c3RlbS5Db2xsZWN0aW9ucy5BcnJheUxpc3QDAAAABl9pdGVtcwVfc2l6ZQhfdmVyc2lvbgUAAAgIAgAAAAkDAAAAKAAAAAEAAAAQAwAAACgAAAAICAEAAAAICAIAAAAICAMAAAAICAQAAAAICAUAAAAICAYAAAAICAcAAAAICAgAAAAICAkAAAAICAoAAAAICAsAAAAICAwAAAAICA0AAAAICA4AAAAICA8AAAAICBAAAAAICBEAAAAICBIAAAAICBMAAAAICBQAAAAICBUAAAAICBYAAAAICBcAAAAICBgAAAAICBkAAAAICBoAAAAICBsAAAAICBwAAAAICB0AAAAICB4AAAAICB8AAAAICCAAAAAICCEAAAAICCIAAAAICCMAAAAICCQAAAAICCUAAAAICCYAAAAICCcAAAAICCgAAAAL", "AAEAAAD/////AQAAAAAAAAAEAQAAABxTeXN0ZW0uQ29sbGVjdGlvbnMuQXJyYXlMaXN0AwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24FAAAICAkCAAAAKAAAAAEAAAAQAgAAACgAAAAICAEAAAAICAIAAAAICAMAAAAICAQAAAAICAUAAAAICAYAAAAICAcAAAAICAgAAAAICAkAAAAICAoAAAAICAsAAAAICAwAAAAICA0AAAAICA4AAAAICA8AAAAICBAAAAAICBEAAAAICBIAAAAICBMAAAAICBQAAAAICBUAAAAICBYAAAAICBcAAAAICBgAAAAICBkAAAAICBoAAAAICBsAAAAICBwAAAAICB0AAAAICB4AAAAICB8AAAAICCAAAAAICCEAAAAICCIAAAAICCMAAAAICCQAAAAICCUAAAAICCYAAAAICCcAAAAICCgAAAAL" } };
+ yield return new object[] { new System.Collections.ArrayList(10), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFxTeXN0ZW0uUnVudGltZS5FeHRlbnNpb25zLCBWZXJzaW9uPTQuMi4xLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49YjAzZjVmN2YxMWQ1MGEzYQUBAAAAHFN5c3RlbS5Db2xsZWN0aW9ucy5BcnJheUxpc3QDAAAABl9pdGVtcwVfc2l6ZQhfdmVyc2lvbgUAAAgIAgAAAAkDAAAAAAAAAAAAAAAQAwAAAAoAAAANCgs=", "AAEAAAD/////AQAAAAAAAAAEAQAAABxTeXN0ZW0uQ29sbGVjdGlvbnMuQXJyYXlMaXN0AwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24FAAAICAkCAAAAAAAAAAAAAAAQAgAAAAoAAAANCgs=" } };
+ yield return new object[] { new System.Collections.Comparer(CultureInfo.InvariantCulture), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFxTeXN0ZW0uUnVudGltZS5FeHRlbnNpb25zLCBWZXJzaW9uPTQuMi4xLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49YjAzZjVmN2YxMWQ1MGEzYQUBAAAAG1N5c3RlbS5Db2xsZWN0aW9ucy5Db21wYXJlcgEAAAALQ29tcGFyZUluZm8DIFN5c3RlbS5HbG9iYWxpemF0aW9uLkNvbXBhcmVJbmZvAgAAAAkDAAAABAMAAAAgU3lzdGVtLkdsb2JhbGl6YXRpb24uQ29tcGFyZUluZm8CAAAABm1fbmFtZQ1tX3NvcnRWZXJzaW9uAQMgU3lzdGVtLkdsb2JhbGl6YXRpb24uU29ydFZlcnNpb24GBAAAAAAKCw==", "AAEAAAD/////AQAAAAAAAAAEAQAAABtTeXN0ZW0uQ29sbGVjdGlvbnMuQ29tcGFyZXIBAAAAC0NvbXBhcmVJbmZvAyBTeXN0ZW0uR2xvYmFsaXphdGlvbi5Db21wYXJlSW5mbwkCAAAABAIAAAAgU3lzdGVtLkdsb2JhbGl6YXRpb24uQ29tcGFyZUluZm8EAAAABm1fbmFtZQl3aW4zMkxDSUQHY3VsdHVyZQ1tX1NvcnRWZXJzaW9uAQAAAwgIIFN5c3RlbS5HbG9iYWxpemF0aW9uLlNvcnRWZXJzaW9uBgMAAAAFZW4tVVMAAAAACQQAAAoL" } };
+ yield return new object[] { new System.Collections.DictionaryEntry("key", 5), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAACJTeXN0ZW0uQ29sbGVjdGlvbnMuRGljdGlvbmFyeUVudHJ5AgAAAARfa2V5Bl92YWx1ZQICBgIAAAADa2V5CAgFAAAACw==", "AAEAAAD/////AQAAAAAAAAAEAQAAACJTeXN0ZW0uQ29sbGVjdGlvbnMuRGljdGlvbmFyeUVudHJ5AgAAAARfa2V5Bl92YWx1ZQICBgIAAAADa2V5CAgFAAAACw==" } };
+ yield return new object[] { Comparer<int>.Default, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAJcBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuR2VuZXJpY0NvbXBhcmVyYDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQAAAAAL", "AAEAAAD/////AQAAAAAAAAAEAQAAAIkBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuR2VuZXJpY0NvbXBhcmVyYDFbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0AAAAACw==" } };
+ yield return new object[] { new HashSet<Point>(new[] { point }, new PointEqualityComparer()), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uQ29sbGVjdGlvbnMsIFZlcnNpb249NC4xLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhDAMAAABwU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYgUBAAAAzQFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5IYXNoU2V0YDFbW1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludCwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dBAAAAAdWZXJzaW9uCENvbXBhcmVyCENhcGFjaXR5CEVsZW1lbnRzAAQABAhDU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50RXF1YWxpdHlDb21wYXJlcgMAAAAINVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludFtdAwAAAAIAAAABAAAACQQAAAADAAAACQUAAAAFBAAAAENTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnRFcXVhbGl0eUNvbXBhcmVyAAAAAAMAAAAHBQAAAAABAAAAAQAAAAQzU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50AwAAAAkGAAAABQYAAAAzU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50AgAAAAFYAVkAAAgIAwAAAAEAAAACAAAACw==", "AAEAAAD/////AQAAAAAAAAAMAgAAAE5TeXN0ZW0uQ29yZSwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkMAwAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAADNAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkhhc2hTZXRgMVtbU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50LCBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViXV0EAAAAB1ZlcnNpb24IQ29tcGFyZXIIQ2FwYWNpdHkIRWxlbWVudHMABAAECENTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnRFcXVhbGl0eUNvbXBhcmVyAwAAAAg1U3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50W10DAAAAAgAAAAEAAAAJBAAAAAMAAAAJBQAAAAUEAAAAQ1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludEVxdWFsaXR5Q29tcGFyZXIAAAAAAwAAAAcFAAAAAAEAAAABAAAABDNTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQDAAAACQYAAAAFBgAAADNTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQCAAAAAVgBWQAACAgDAAAAAQAAAAIAAAAL" } };
+ yield return new object[] { new KeyValuePair<int, string>(5, "five"), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAP8BU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuS2V5VmFsdWVQYWlyYDJbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdLFtTeXN0ZW0uU3RyaW5nLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dAgAAAANrZXkFdmFsdWUAAQgFAAAABgIAAAAEZml2ZQs=", "AAEAAAD/////AQAAAAAAAAAEAQAAAOMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuS2V5VmFsdWVQYWlyYDJbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlN0cmluZywgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0CAAAAA2tleQV2YWx1ZQABCAUAAAAGAgAAAARmaXZlCw==" } };
+ yield return new object[] { new LinkedList<Point>(new[] { point }), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uQ29sbGVjdGlvbnMsIFZlcnNpb249NC4xLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhDAMAAABwU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYgUBAAAA0AFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5MaW5rZWRMaXN0YDFbW1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludCwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dAwAAAAdWZXJzaW9uBUNvdW50BERhdGEAAAQICDVTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnRbXQMAAAACAAAAAQAAAAEAAAAJBAAAAAcEAAAAAAEAAAABAAAABDNTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQDAAAACQUAAAAFBQAAADNTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQCAAAAAVgBWQAACAgDAAAAAQAAAAIAAAAL", "AAEAAAD/////AQAAAAAAAAAMAgAAAElTeXN0ZW0sIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5DAMAAABwU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYgUBAAAA0AFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5MaW5rZWRMaXN0YDFbW1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludCwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dAwAAAAdWZXJzaW9uBUNvdW50BERhdGEAAAQICDVTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnRbXQMAAAACAAAAAQAAAAEAAAAJBAAAAAcEAAAAAAEAAAABAAAABDNTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQDAAAACQUAAAAFBQAAADNTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQCAAAAAVgBWQAACAgDAAAAAQAAAAIAAAAL" } };
+ yield return new object[] { new Queue<int>(Enumerable.Range(1, 25)), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uQ29sbGVjdGlvbnMsIFZlcnNpb249NC4xLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAACNAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLlF1ZXVlYDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQUAAAAGX2FycmF5BV9oZWFkBV90YWlsBV9zaXplCF92ZXJzaW9uBwAAAAAICAgICAIAAAAJAwAAAAAAAAAZAAAAGQAAAAAAAAAPAwAAACAAAAAIAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAL", "AAEAAAD/////AQAAAAAAAAAMAgAAAElTeXN0ZW0sIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAB/U3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuUXVldWVgMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQUAAAAGX2FycmF5BV9oZWFkBV90YWlsBV9zaXplCF92ZXJzaW9uBwAAAAAICAgICAIAAAAJAwAAAAAAAAAZAAAAGQAAABwAAAAPAwAAACAAAAAIAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAL" } };
+ yield return new object[] { new Collections.Queue(50, 5.6f), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAGBTeXN0ZW0uQ29sbGVjdGlvbnMuTm9uR2VuZXJpYywgVmVyc2lvbj00LjEuMS4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABhTeXN0ZW0uQ29sbGVjdGlvbnMuUXVldWUGAAAABl9hcnJheQVfaGVhZAVfdGFpbAVfc2l6ZQtfZ3Jvd0ZhY3RvcghfdmVyc2lvbgUAAAAAAAgICAgIAgAAAAkDAAAAAAAAAAAAAAAAAAAAMAIAAAAAAAAQAwAAADIAAAANMgs=", "AAEAAAD/////AQAAAAAAAAAEAQAAABhTeXN0ZW0uQ29sbGVjdGlvbnMuUXVldWUGAAAABl9hcnJheQVfaGVhZAVfdGFpbAVfc2l6ZQtfZ3Jvd0ZhY3RvcghfdmVyc2lvbgUAAAAAAAgICAgICQIAAAAAAAAAAAAAAAAAAAAwAgAAAAAAABACAAAAMgAAAA0yCw==" } };
+ yield return new object[] { new SortedDictionary<int, Point>(pointDictionary, Comparer<int>.Default), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uQ29sbGVjdGlvbnMsIFZlcnNpb249NC4xLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAADAAlN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLlNvcnRlZERpY3Rpb25hcnlgMltbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludCwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dAQAAAARfc2V0BL8DU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuVHJlZVNldGAxW1tTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5LZXlWYWx1ZVBhaXJgMltbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludCwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dAgAAAAIAAAAJAwAAAAUDAAAAvwNTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5UcmVlU2V0YDFbW1N5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLktleVZhbHVlUGFpcmAyW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50LCBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViXV0sIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0EAAAABUNvdW50CENvbXBhcmVyB1ZlcnNpb24FSXRlbXMABAADCNUCU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuU29ydGVkRGljdGlvbmFyeWAyK0tleVZhbHVlUGFpckNvbXBhcmVyW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50LCBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViXV0CAAAACL4CU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuS2V5VmFsdWVQYWlyYDJbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdLFtTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQsIFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cywgVmVyc2lvbj00LjAuMy4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTlkNzdjYzdhZDM5YjY4ZWJdXVtdAgAAAAIAAAAJBAAAAAIAAAAJBQAAAAUEAAAA1QJTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5Tb3J0ZWREaWN0aW9uYXJ5YDIrS2V5VmFsdWVQYWlyQ29tcGFyZXJbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdLFtTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQsIFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cywgVmVyc2lvbj00LjAuMy4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTlkNzdjYzdhZDM5YjY4ZWJdXQEAAAALa2V5Q29tcGFyZXIDlwFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5HZW5lcmljQ29tcGFyZXJgMVtbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dAgAAAAkGAAAABwUAAAAAAQAAAAIAAAADvAJTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5LZXlWYWx1ZVBhaXJgMltbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludCwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dDAgAAABwU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYgT5////vAJTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5LZXlWYWx1ZVBhaXJgMltbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludCwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dAgAAAANrZXkFdmFsdWUABAgzU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50CAAAAAEAAAAJCQAAAAH2////+f///wIAAAAJCwAAAAQGAAAAlwFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5HZW5lcmljQ29tcGFyZXJgMVtbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dAAAAAAUJAAAAM1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludAIAAAABWAFZAAAICAgAAAABAAAAAQAAAAELAAAACQAAAAIAAAACAAAACw==", "AAEAAAD/////AQAAAAAAAAAMAgAAAElTeXN0ZW0sIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAACyAlN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLlNvcnRlZERpY3Rpb25hcnlgMltbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldLFtTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQsIFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cywgVmVyc2lvbj00LjAuMy4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTlkNzdjYzdhZDM5YjY4ZWJdXQEAAAAEX3NldASjA1N5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLlRyZWVTZXRgMVtbU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuS2V5VmFsdWVQYWlyYDJbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50LCBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViXV0sIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dAgAAAAIAAAAJAwAAAAUDAAAAowNTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5UcmVlU2V0YDFbW1N5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLktleVZhbHVlUGFpcmAyW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV0sW1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludCwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQQAAAAFQ291bnQIQ29tcGFyZXIHVmVyc2lvbgVJdGVtcwAEAAMIxwJTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5Tb3J0ZWREaWN0aW9uYXJ5YDIrS2V5VmFsdWVQYWlyQ29tcGFyZXJbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50LCBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViXV0CAAAACLACU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuS2V5VmFsdWVQYWlyYDJbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50LCBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViXV1bXQIAAAACAAAACQQAAAACAAAACQUAAAAFBAAAAMcCU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuU29ydGVkRGljdGlvbmFyeWAyK0tleVZhbHVlUGFpckNvbXBhcmVyW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV0sW1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludCwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dAQAAAAtrZXlDb21wYXJlcgOJAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkdlbmVyaWNDb21wYXJlcmAxW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dAgAAAAkGAAAABwUAAAAAAQAAAAIAAAADrgJTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5LZXlWYWx1ZVBhaXJgMltbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldLFtTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQsIFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cywgVmVyc2lvbj00LjAuMy4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTlkNzdjYzdhZDM5YjY4ZWJdXQwIAAAAcFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cywgVmVyc2lvbj00LjAuMy4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTlkNzdjYzdhZDM5YjY4ZWIE+f///64CU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuS2V5VmFsdWVQYWlyYDJbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50LCBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViXV0CAAAAA2tleQV2YWx1ZQAECDNTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQIAAAAAQAAAAkJAAAAAfb////5////AgAAAAkLAAAABAYAAACJAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkdlbmVyaWNDb21wYXJlcmAxW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dAAAAAAUJAAAAM1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludAIAAAABWAFZAAAICAgAAAABAAAAAQAAAAELAAAACQAAAAIAAAACAAAACw==" } };
+ yield return new object[] { new SortedList<int, Point>(pointDictionary, Comparer<int>.Default), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uQ29sbGVjdGlvbnMsIFZlcnNpb249NC4xLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhDAMAAABwU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYgUBAAAAugJTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5Tb3J0ZWRMaXN0YDJbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdLFtTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQsIFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cywgVmVyc2lvbj00LjAuMy4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTlkNzdjYzdhZDM5YjY4ZWJdXQcAAAAEa2V5cwZ2YWx1ZXMFX3NpemUHdmVyc2lvbghjb21wYXJlcgdrZXlMaXN0CXZhbHVlTGlzdAcEAAADBAQINVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludFtdAwAAAAgIlwFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5HZW5lcmljQ29tcGFyZXJgMVtbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dwgJTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5Tb3J0ZWRMaXN0YDIrS2V5TGlzdFtbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludCwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dAgAAAMQCU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuU29ydGVkTGlzdGAyK1ZhbHVlTGlzdFtbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludCwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dAgAAAAIAAAAJBAAAAAkFAAAAAgAAAAAAAAAJBgAAAAoKDwQAAAACAAAACAEAAAACAAAABwUAAAAAAQAAAAIAAAAEM1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludAMAAAAJBwAAAAkIAAAABAYAAACXAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkdlbmVyaWNDb21wYXJlcmAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0AAAAABQcAAAAzU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50AgAAAAFYAVkAAAgIAwAAAAEAAAABAAAAAQgAAAAHAAAAAgAAAAIAAAAL", "AAEAAAD/////AQAAAAAAAAAMAgAAAElTeXN0ZW0sIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5DAMAAABwU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYgUBAAAArAJTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5Tb3J0ZWRMaXN0YDJbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50LCBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViXV0HAAAABGtleXMGdmFsdWVzBV9zaXplB3ZlcnNpb24IY29tcGFyZXIHa2V5TGlzdAl2YWx1ZUxpc3QHBAAAAwQECDVTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnRbXQMAAAAICIkBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuR2VuZXJpY0NvbXBhcmVyYDFbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV20AlN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLlNvcnRlZExpc3RgMitLZXlMaXN0W1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV0sW1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludCwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dAgAAALYCU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuU29ydGVkTGlzdGAyK1ZhbHVlTGlzdFtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldLFtTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQsIFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cywgVmVyc2lvbj00LjAuMy4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTlkNzdjYzdhZDM5YjY4ZWJdXQIAAAACAAAACQQAAAAJBQAAAAIAAAAAAAAACQYAAAAKCg8EAAAAAgAAAAgBAAAAAgAAAAcFAAAAAAEAAAACAAAABDNTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQDAAAACQcAAAAJCAAAAAQGAAAAiQFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5HZW5lcmljQ29tcGFyZXJgMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQAAAAAFBwAAADNTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQCAAAAAVgBWQAACAgDAAAAAQAAAAEAAAABCAAAAAcAAAACAAAAAgAAAAs=" } };
+ yield return new object[] { new Collections.SortedList(pointDictionary, Comparer<int>.Default), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAGBTeXN0ZW0uQ29sbGVjdGlvbnMuTm9uR2VuZXJpYywgVmVyc2lvbj00LjEuMS4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAAB1TeXN0ZW0uQ29sbGVjdGlvbnMuU29ydGVkTGlzdAcAAAAFX2tleXMHX3ZhbHVlcwVfc2l6ZQhfdmVyc2lvbglfY29tcGFyZXIIX2tleUxpc3QKX3ZhbHVlTGlzdAUFAAADBAQICJcBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuR2VuZXJpY0NvbXBhcmVyYDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXSVTeXN0ZW0uQ29sbGVjdGlvbnMuU29ydGVkTGlzdCtLZXlMaXN0AgAAACdTeXN0ZW0uQ29sbGVjdGlvbnMuU29ydGVkTGlzdCtWYWx1ZUxpc3QCAAAAAgAAAAkDAAAACQQAAAACAAAAAAAAAAkFAAAACgoQAwAAAAIAAAAICAEAAAAICAIAAAAQBAAAAAIAAAAJBgAAAAkHAAAABAUAAACXAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkdlbmVyaWNDb21wYXJlcmAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0AAAAADAgAAABwU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYgUGAAAAM1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludAIAAAABWAFZAAAICAgAAAABAAAAAQAAAAEHAAAABgAAAAIAAAACAAAACw==", "AAEAAAD/////AQAAAAAAAAAEAQAAAB1TeXN0ZW0uQ29sbGVjdGlvbnMuU29ydGVkTGlzdAcAAAAEa2V5cwZ2YWx1ZXMFX3NpemUHdmVyc2lvbghjb21wYXJlcgdrZXlMaXN0CXZhbHVlTGlzdAUFAAADAwMICIkBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuR2VuZXJpY0NvbXBhcmVyYDFbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0lU3lzdGVtLkNvbGxlY3Rpb25zLlNvcnRlZExpc3QrS2V5TGlzdCdTeXN0ZW0uQ29sbGVjdGlvbnMuU29ydGVkTGlzdCtWYWx1ZUxpc3QJAgAAAAkDAAAAAgAAAAAAAAAJBAAAAAoKEAIAAAACAAAACAgBAAAACAgCAAAAEAMAAAACAAAACQUAAAAJBgAAAAQEAAAAiQFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5HZW5lcmljQ29tcGFyZXJgMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQAAAAAMBwAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQUAAAAzU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50AgAAAAFYAVkAAAgIBwAAAAEAAAABAAAAAQYAAAAFAAAAAgAAAAIAAAAL" } };
+ yield return new object[] { new SortedSet<Point>(new[] { point, new Point(3, 5) }), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uQ29sbGVjdGlvbnMsIFZlcnNpb249NC4xLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhDAMAAABwU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYgUBAAAAzwFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5Tb3J0ZWRTZXRgMVtbU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50LCBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViXV0EAAAABUNvdW50CENvbXBhcmVyB1ZlcnNpb24FSXRlbXMAAwAECNUBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuR2VuZXJpY0NvbXBhcmVyYDFbW1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludCwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dCDVTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnRbXQMAAAACAAAAAQAAAAkEAAAAAAAAAAkFAAAABAQAAADVAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkdlbmVyaWNDb21wYXJlcmAxW1tTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQsIFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cywgVmVyc2lvbj00LjAuMy4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTlkNzdjYzdhZDM5YjY4ZWJdXQAAAAAHBQAAAAABAAAAAQAAAAQzU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50AwAAAAkGAAAABQYAAAAzU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50AgAAAAFYAVkAAAgIAwAAAAEAAAACAAAACw==", "AAEAAAD/////AQAAAAAAAAAMAgAAAElTeXN0ZW0sIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5DAMAAABwU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYgUBAAAAzwFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5Tb3J0ZWRTZXRgMVtbU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50LCBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViXV0EAAAABUNvdW50CENvbXBhcmVyB1ZlcnNpb24FSXRlbXMAAwAECNUBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuR2VuZXJpY0NvbXBhcmVyYDFbW1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludCwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dCDVTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnRbXQMAAAACAAAAAQAAAAkEAAAAAAAAAAkFAAAABAQAAADVAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkdlbmVyaWNDb21wYXJlcmAxW1tTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQsIFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cywgVmVyc2lvbj00LjAuMy4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTlkNzdjYzdhZDM5YjY4ZWJdXQAAAAAHBQAAAAABAAAAAQAAAAQzU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50AwAAAAkGAAAABQYAAAAzU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50AgAAAAFYAVkAAAgIAwAAAAEAAAACAAAACw==" } };
+ yield return new object[] { new SortedSet<int?>(new int?[] { 2, 4, 6, null }, Comparer<int?>.Default), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uQ29sbGVjdGlvbnMsIFZlcnNpb249NC4xLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAACBAlN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLlNvcnRlZFNldGAxW1tTeXN0ZW0uTnVsbGFibGVgMVtbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dBAAAAAVDb3VudAhDb21wYXJlcgdWZXJzaW9uBUl0ZW1zAAMAAwiYAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLk51bGxhYmxlQ29tcGFyZXJgMVtbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dCH5TeXN0ZW0uTnVsbGFibGVgMVtbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dW10CAAAABAAAAAkDAAAAAAAAAAkEAAAABAMAAACYAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLk51bGxhYmxlQ29tcGFyZXJgMVtbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dAAAAAAcEAAAAAAEAAAAEAAAAA3xTeXN0ZW0uTnVsbGFibGVgMVtbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dCggIAgAAAAgIBAAAAAgIBgAAAAs=", "AAEAAAD/////AQAAAAAAAAAMAgAAAElTeXN0ZW0sIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAADlAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLlNvcnRlZFNldGAxW1tTeXN0ZW0uTnVsbGFibGVgMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXSwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0EAAAABUNvdW50CENvbXBhcmVyB1ZlcnNpb24FSXRlbXMAAwADCIoBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTnVsbGFibGVDb21wYXJlcmAxW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dCHBTeXN0ZW0uTnVsbGFibGVgMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXVtdAgAAAAQAAAAJAwAAAAAAAAAJBAAAAAQDAAAAigFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5OdWxsYWJsZUNvbXBhcmVyYDFbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0AAAAABwQAAAAAAQAAAAQAAAADblN5c3RlbS5OdWxsYWJsZWAxW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dCggIAgAAAAgIBAAAAAgIBgAAAAs=" } };
+ yield return new object[] { new Stack<Point>(new[] { point, new Point(2, 2) }), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uQ29sbGVjdGlvbnMsIFZlcnNpb249NC4xLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhDAMAAABwU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYgUBAAAAywFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5TdGFja2AxW1tTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQsIFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cywgVmVyc2lvbj00LjAuMy4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTlkNzdjYzdhZDM5YjY4ZWJdXQMAAAAGX2FycmF5BV9zaXplCF92ZXJzaW9uBAAANVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludFtdAwAAAAgIAgAAAAkEAAAAAgAAAAAAAAAHBAAAAAABAAAAAgAAAAQzU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50AwAAAAkFAAAACQYAAAAFBQAAADNTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQCAAAAAVgBWQAACAgDAAAAAQAAAAIAAAABBgAAAAUAAAACAAAAAgAAAAs=", "AAEAAAD/////AQAAAAAAAAAMAgAAAElTeXN0ZW0sIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5DAMAAABwU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYgUBAAAAywFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5TdGFja2AxW1tTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQsIFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cywgVmVyc2lvbj00LjAuMy4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTlkNzdjYzdhZDM5YjY4ZWJdXQMAAAAGX2FycmF5BV9zaXplCF92ZXJzaW9uBAAANVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludFtdAwAAAAgIAgAAAAkEAAAAAgAAAAAAAAAHBAAAAAABAAAAAgAAAAQzU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50AwAAAAkFAAAACQYAAAAFBQAAADNTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQCAAAAAVgBWQAACAgDAAAAAQAAAAIAAAABBgAAAAUAAAACAAAAAgAAAAs=" } };
+ yield return new object[] { new System.Collections.Hashtable(pointDictionary, 0.3f, EqualityComparer<int>.Default), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFxTeXN0ZW0uUnVudGltZS5FeHRlbnNpb25zLCBWZXJzaW9uPTQuMi4xLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49YjAzZjVmN2YxMWQ1MGEzYQUBAAAAHFN5c3RlbS5Db2xsZWN0aW9ucy5IYXNodGFibGUGAAAACkxvYWRGYWN0b3IHVmVyc2lvbgtLZXlDb21wYXJlcghIYXNoU2l6ZQRLZXlzBlZhbHVlcwAAAwAFBQsInwFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5HZW5lcmljRXF1YWxpdHlDb21wYXJlcmAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0IAgAAABwvXT4CAAAACQMAAAALAAAACQQAAAAJBQAAAAQDAAAAnwFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5HZW5lcmljRXF1YWxpdHlDb21wYXJlcmAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0AAAAAEAQAAAACAAAACAgCAAAACAgBAAAAEAUAAAACAAAACQYAAAAJBwAAAAwIAAAAcFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cywgVmVyc2lvbj00LjAuMy4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTlkNzdjYzdhZDM5YjY4ZWIFBgAAADNTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQCAAAAAVgBWQAACAgIAAAAAgAAAAIAAAABBwAAAAYAAAABAAAAAQAAAAs=", "AAEAAAD/////AQAAAAAAAAAEAQAAABxTeXN0ZW0uQ29sbGVjdGlvbnMuSGFzaHRhYmxlBgAAAApMb2FkRmFjdG9yB1ZlcnNpb24LS2V5Q29tcGFyZXIISGFzaFNpemUES2V5cwZWYWx1ZXMAAAMABQULCJEBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuR2VuZXJpY0VxdWFsaXR5Q29tcGFyZXJgMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQgcL10+AgAAAAkCAAAACwAAAAkDAAAACQQAAAAEAgAAAJEBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuR2VuZXJpY0VxdWFsaXR5Q29tcGFyZXJgMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQAAAAAQAwAAAAIAAAAICAIAAAAICAEAAAAQBAAAAAIAAAAJBQAAAAkGAAAADAcAAABwU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYgUFAAAAM1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludAIAAAABWAFZAAAICAcAAAACAAAAAgAAAAEGAAAABQAAAAEAAAABAAAACw==" } };
+ yield return new object[] { new System.ComponentModel.BindingList<int>(new[] { 34, 52 }), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAGZTeXN0ZW0uQ29tcG9uZW50TW9kZWwuVHlwZUNvbnZlcnRlciwgVmVyc2lvbj00LjIuMS4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAAI4BU3lzdGVtLkNvbXBvbmVudE1vZGVsLkJpbmRpbmdMaXN0YDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQgAAAAJYWRkTmV3UG9zFnJhaXNlTGlzdENoYW5nZWRFdmVudHMWcmFpc2VJdGVtQ2hhbmdlZEV2ZW50cwhhbGxvd05ldwlhbGxvd0VkaXQLYWxsb3dSZW1vdmUPdXNlclNldEFsbG93TmV3BWl0ZW1zAAAAAAAAAAMIAQEBAQEBDlN5c3RlbS5JbnQzMltdAgAAAP////8BAAEBAQAJAwAAAA8DAAAAAgAAAAgiAAAANAAAAAs=", "AAEAAAD/////AQAAAAAAAAAMAgAAAElTeXN0ZW0sIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAACAAVN5c3RlbS5Db21wb25lbnRNb2RlbC5CaW5kaW5nTGlzdGAxW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dCAAAAAlhZGROZXdQb3MWcmFpc2VMaXN0Q2hhbmdlZEV2ZW50cxZyYWlzZUl0ZW1DaGFuZ2VkRXZlbnRzCGFsbG93TmV3CWFsbG93RWRpdAthbGxvd1JlbW92ZQ91c2VyU2V0QWxsb3dOZXcSQ29sbGVjdGlvbmAxK2l0ZW1zAAAAAAAAAAMIAQEBAQEBDlN5c3RlbS5JbnQzMltdAgAAAP////8BAAEBAQAJAwAAAA8DAAAAAgAAAAgiAAAANAAAAAs=" } };
+ yield return new object[] { new System.ComponentModel.BindingList<Point>(new[] { point }), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAGZTeXN0ZW0uQ29tcG9uZW50TW9kZWwuVHlwZUNvbnZlcnRlciwgVmVyc2lvbj00LjIuMS4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EMAwAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAADMAVN5c3RlbS5Db21wb25lbnRNb2RlbC5CaW5kaW5nTGlzdGAxW1tTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQsIFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cywgVmVyc2lvbj00LjAuMy4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTlkNzdjYzdhZDM5YjY4ZWJdXQgAAAAJYWRkTmV3UG9zFnJhaXNlTGlzdENoYW5nZWRFdmVudHMWcmFpc2VJdGVtQ2hhbmdlZEV2ZW50cwhhbGxvd05ldwlhbGxvd0VkaXQLYWxsb3dSZW1vdmUPdXNlclNldEFsbG93TmV3BWl0ZW1zAAAAAAAAAAQIAQEBAQEBNVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludFtdAwAAAAIAAAD/////AQAAAQEACQQAAAAHBAAAAAABAAAAAQAAAAQzU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50AwAAAAkFAAAABQUAAAAzU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50AgAAAAFYAVkAAAgIAwAAAAEAAAACAAAACw==", "AAEAAAD/////AQAAAAAAAAAMAgAAAElTeXN0ZW0sIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5DAMAAABwU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYgUBAAAAzAFTeXN0ZW0uQ29tcG9uZW50TW9kZWwuQmluZGluZ0xpc3RgMVtbU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50LCBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViXV0IAAAACWFkZE5ld1BvcxZyYWlzZUxpc3RDaGFuZ2VkRXZlbnRzFnJhaXNlSXRlbUNoYW5nZWRFdmVudHMIYWxsb3dOZXcJYWxsb3dFZGl0C2FsbG93UmVtb3ZlD3VzZXJTZXRBbGxvd05ldxJDb2xsZWN0aW9uYDEraXRlbXMAAAAAAAAABAgBAQEBAQE1U3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50W10DAAAAAgAAAP////8BAAEBAQAJBAAAAAcEAAAAAAEAAAABAAAABDNTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQDAAAACQUAAAAFBQAAADNTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQCAAAAAVgBWQAACAgDAAAAAQAAAAIAAAAL" } };
+ yield return new object[] { new Collections.Stack(new[] { point }), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAGBTeXN0ZW0uQ29sbGVjdGlvbnMuTm9uR2VuZXJpYywgVmVyc2lvbj00LjEuMS4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABhTeXN0ZW0uQ29sbGVjdGlvbnMuU3RhY2sDAAAABl9hcnJheQVfc2l6ZQhfdmVyc2lvbgUAAAgIAgAAAAkDAAAAAQAAAAEAAAAQAwAAAAoAAAAJBAAAAA0JDAUAAABwU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYgUEAAAAM1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludAIAAAABWAFZAAAICAUAAAABAAAAAgAAAAs=", "AAEAAAD/////AQAAAAAAAAAEAQAAABhTeXN0ZW0uQ29sbGVjdGlvbnMuU3RhY2sDAAAABl9hcnJheQVfc2l6ZQhfdmVyc2lvbgUAAAgICQIAAAABAAAAAQAAABACAAAACgAAAAkDAAAADQkMBAAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQMAAAAzU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50AgAAAAFYAVkAAAgIBAAAAAEAAAACAAAACw==" } };
+ yield return new object[] { new System.Collections.Specialized.StringDictionary
+ {
+ { "key1", "val1" },
+ { "keyx", "valx" }
+ }, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAGFTeXN0ZW0uQ29sbGVjdGlvbnMuU3BlY2lhbGl6ZWQsIFZlcnNpb249NC4xLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhDAMAAABcU3lzdGVtLlJ1bnRpbWUuRXh0ZW5zaW9ucywgVmVyc2lvbj00LjIuMS4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAAC9TeXN0ZW0uQ29sbGVjdGlvbnMuU3BlY2lhbGl6ZWQuU3RyaW5nRGljdGlvbmFyeQEAAAAJX2NvbnRlbnRzBBxTeXN0ZW0uQ29sbGVjdGlvbnMuSGFzaHRhYmxlAwAAAAIAAAAJBAAAAAUEAAAAHFN5c3RlbS5Db2xsZWN0aW9ucy5IYXNodGFibGUHAAAACkxvYWRGYWN0b3IHVmVyc2lvbghDb21wYXJlchBIYXNoQ29kZVByb3ZpZGVyCEhhc2hTaXplBEtleXMGVmFsdWVzAAADBAAFBQsIHFN5c3RlbS5Db2xsZWN0aW9ucy5JQ29tcGFyZXIkU3lzdGVtLkNvbGxlY3Rpb25zLklIYXNoQ29kZVByb3ZpZGVyAwAAAAgDAAAA7FE4PwIAAAAKCgMAAAAJBQAAAAkGAAAAEAUAAAACAAAABgcAAAAEa2V5eAYIAAAABGtleTEQBgAAAAIAAAAGCQAAAAR2YWx4BgoAAAAEdmFsMQs=", "AAEAAAD/////AQAAAAAAAAAMAgAAAElTeXN0ZW0sIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAvU3lzdGVtLkNvbGxlY3Rpb25zLlNwZWNpYWxpemVkLlN0cmluZ0RpY3Rpb25hcnkBAAAACGNvbnRlbnRzAxxTeXN0ZW0uQ29sbGVjdGlvbnMuSGFzaHRhYmxlAgAAAAkDAAAABAMAAAAcU3lzdGVtLkNvbGxlY3Rpb25zLkhhc2h0YWJsZQcAAAAKTG9hZEZhY3RvcgdWZXJzaW9uCENvbXBhcmVyEEhhc2hDb2RlUHJvdmlkZXIISGFzaFNpemUES2V5cwZWYWx1ZXMAAAMDAAUFCwgcU3lzdGVtLkNvbGxlY3Rpb25zLklDb21wYXJlciRTeXN0ZW0uQ29sbGVjdGlvbnMuSUhhc2hDb2RlUHJvdmlkZXII7FE4PwIAAAAKCgMAAAAJBAAAAAkFAAAAEAQAAAACAAAABgYAAAAEa2V5MQYHAAAABGtleXgQBQAAAAIAAAAGCAAAAAR2YWwxBgkAAAAEdmFseAs=" } };
+ yield return new object[] { new System.Collections.Specialized.StringCollection()
+ {
+ "asdf",
+ "bdes",
+ "Abd"
+ }, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAGFTeXN0ZW0uQ29sbGVjdGlvbnMuU3BlY2lhbGl6ZWQsIFZlcnNpb249NC4xLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhDAMAAABcU3lzdGVtLlJ1bnRpbWUuRXh0ZW5zaW9ucywgVmVyc2lvbj00LjIuMS4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAAC9TeXN0ZW0uQ29sbGVjdGlvbnMuU3BlY2lhbGl6ZWQuU3RyaW5nQ29sbGVjdGlvbgEAAAAEZGF0YQQcU3lzdGVtLkNvbGxlY3Rpb25zLkFycmF5TGlzdAMAAAACAAAACQQAAAAFBAAAABxTeXN0ZW0uQ29sbGVjdGlvbnMuQXJyYXlMaXN0AwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24FAAAICAMAAAAJBQAAAAMAAAADAAAAEAUAAAAEAAAABgYAAAAEYXNkZgYHAAAABGJkZXMGCAAAAANBYmQKCw==", "AAEAAAD/////AQAAAAAAAAAMAgAAAElTeXN0ZW0sIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAvU3lzdGVtLkNvbGxlY3Rpb25zLlNwZWNpYWxpemVkLlN0cmluZ0NvbGxlY3Rpb24BAAAABGRhdGEDHFN5c3RlbS5Db2xsZWN0aW9ucy5BcnJheUxpc3QCAAAACQMAAAAEAwAAABxTeXN0ZW0uQ29sbGVjdGlvbnMuQXJyYXlMaXN0AwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24FAAAICAkEAAAAAwAAAAMAAAAQBAAAAAQAAAAGBQAAAARhc2RmBgYAAAAEYmRlcwYHAAAAA0FiZAoL" } };
+ yield return new object[] { new System.Collections.Specialized.OrderedDictionary(7)
+ {
+ { "key1", 34 },
+ { "keyx", "s2" },
+ { 22, "sample" }
+ }, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAGFTeXN0ZW0uQ29sbGVjdGlvbnMuU3BlY2lhbGl6ZWQsIFZlcnNpb249NC4xLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAAAwU3lzdGVtLkNvbGxlY3Rpb25zLlNwZWNpYWxpemVkLk9yZGVyZWREaWN0aW9uYXJ5BAAAAAtLZXlDb21wYXJlcghSZWFkT25seQ9Jbml0aWFsQ2FwYWNpdHkJQXJyYXlMaXN0AwAABSRTeXN0ZW0uQ29sbGVjdGlvbnMuSUVxdWFsaXR5Q29tcGFyZXIBCAIAAAAKAAcAAAAJAwAAABADAAAAAwAAAAkEAAAACQUAAAAJBgAAAAQEAAAAIlN5c3RlbS5Db2xsZWN0aW9ucy5EaWN0aW9uYXJ5RW50cnkCAAAABF9rZXkGX3ZhbHVlAgIGBwAAAARrZXkxCAgiAAAAAQUAAAAEAAAABggAAAAEa2V5eAYJAAAAAnMyAQYAAAAEAAAACAgWAAAABgoAAAAGc2FtcGxlCw==", "AAEAAAD/////AQAAAAAAAAAMAgAAAElTeXN0ZW0sIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAwU3lzdGVtLkNvbGxlY3Rpb25zLlNwZWNpYWxpemVkLk9yZGVyZWREaWN0aW9uYXJ5BAAAAAtLZXlDb21wYXJlcghSZWFkT25seQ9Jbml0aWFsQ2FwYWNpdHkJQXJyYXlMaXN0AwAABSRTeXN0ZW0uQ29sbGVjdGlvbnMuSUVxdWFsaXR5Q29tcGFyZXIBCAIAAAAKAAcAAAAJAwAAABADAAAAAwAAAAkEAAAACQUAAAAJBgAAAAQEAAAAIlN5c3RlbS5Db2xsZWN0aW9ucy5EaWN0aW9uYXJ5RW50cnkCAAAABF9rZXkGX3ZhbHVlAgIGBwAAAARrZXkxCAgiAAAAAQUAAAAEAAAABggAAAAEa2V5eAYJAAAAAnMyAQYAAAAEAAAACAgWAAAABgoAAAAGc2FtcGxlCw==" } };
+
+ var nvCollectionIgnoreCase = new System.Collections.Specialized.NameValueCollection(10, StringComparer.Create(CultureInfo.InvariantCulture, true))
+ {
+ { "name1", "value1" },
+ { "name2", "value2" }
+ };
+ yield return new object[] { nvCollectionIgnoreCase, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAGFTeXN0ZW0uQ29sbGVjdGlvbnMuU3BlY2lhbGl6ZWQsIFZlcnNpb249NC4xLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAAAyU3lzdGVtLkNvbGxlY3Rpb25zLlNwZWNpYWxpemVkLk5hbWVWYWx1ZUNvbGxlY3Rpb24GAAAACFJlYWRPbmx5C0tleUNvbXBhcmVyBUNvdW50BEtleXMGVmFsdWVzB1ZlcnNpb24AAwAGBQABG1N5c3RlbS5DdWx0dXJlQXdhcmVDb21wYXJlcggIAgAAAAAJAwAAAAIAAAAJBAAAAAkFAAAABAAAAAQDAAAAG1N5c3RlbS5DdWx0dXJlQXdhcmVDb21wYXJlcgIAAAAMX2NvbXBhcmVJbmZvCF9vcHRpb25zAwMgU3lzdGVtLkdsb2JhbGl6YXRpb24uQ29tcGFyZUluZm8jU3lzdGVtLkdsb2JhbGl6YXRpb24uQ29tcGFyZU9wdGlvbnMJBgAAAAT5////I1N5c3RlbS5HbG9iYWxpemF0aW9uLkNvbXBhcmVPcHRpb25zAQAAAAd2YWx1ZV9fAAgBAAAAEQQAAAACAAAABggAAAAFbmFtZTEGCQAAAAVuYW1lMhAFAAAAAgAAAAkKAAAACQsAAAAEBgAAACBTeXN0ZW0uR2xvYmFsaXphdGlvbi5Db21wYXJlSW5mbwIAAAAGbV9uYW1lDW1fc29ydFZlcnNpb24BAyBTeXN0ZW0uR2xvYmFsaXphdGlvbi5Tb3J0VmVyc2lvbgYMAAAAAAoMDQAAAFxTeXN0ZW0uUnVudGltZS5FeHRlbnNpb25zLCBWZXJzaW9uPTQuMi4xLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49YjAzZjVmN2YxMWQ1MGEzYQUKAAAAHFN5c3RlbS5Db2xsZWN0aW9ucy5BcnJheUxpc3QDAAAABl9pdGVtcwVfc2l6ZQhfdmVyc2lvbgUAAAgIDQAAAAkOAAAAAQAAAAEAAAABCwAAAAoAAAAJDwAAAAEAAAABAAAAEA4AAAABAAAABhAAAAAGdmFsdWUxEA8AAAABAAAABhEAAAAGdmFsdWUyCw==", "AAEAAAD/////AQAAAAAAAAAMAgAAAElTeXN0ZW0sIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAyU3lzdGVtLkNvbGxlY3Rpb25zLlNwZWNpYWxpemVkLk5hbWVWYWx1ZUNvbGxlY3Rpb24GAAAACFJlYWRPbmx5C0tleUNvbXBhcmVyBUNvdW50BEtleXMGVmFsdWVzB1ZlcnNpb24AAwAGBQABG1N5c3RlbS5DdWx0dXJlQXdhcmVDb21wYXJlcggIAgAAAAAJAwAAAAIAAAAJBAAAAAkFAAAABAAAAAQDAAAAG1N5c3RlbS5DdWx0dXJlQXdhcmVDb21wYXJlcgIAAAAMX2NvbXBhcmVJbmZvC19pZ25vcmVDYXNlAwAgU3lzdGVtLkdsb2JhbGl6YXRpb24uQ29tcGFyZUluZm8BCQYAAAABEQQAAAACAAAABgcAAAAFbmFtZTEGCAAAAAVuYW1lMhAFAAAAAgAAAAkJAAAACQoAAAAEBgAAACBTeXN0ZW0uR2xvYmFsaXphdGlvbi5Db21wYXJlSW5mbwQAAAAGbV9uYW1lCXdpbjMyTENJRAdjdWx0dXJlDW1fU29ydFZlcnNpb24BAAADCAggU3lzdGVtLkdsb2JhbGl6YXRpb24uU29ydFZlcnNpb24GCwAAAAVlbi1VUwAAAAAJBAAACQwAAAAECQAAABxTeXN0ZW0uQ29sbGVjdGlvbnMuQXJyYXlMaXN0AwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24FAAAICAkNAAAAAQAAAAEAAAABCgAAAAkAAAAJDgAAAAEAAAABAAAABAwAAAAgU3lzdGVtLkdsb2JhbGl6YXRpb24uU29ydFZlcnNpb24CAAAADG1fTmxzVmVyc2lvbghtX1NvcnRJZAADCAtTeXN0ZW0uR3VpZA4CBgAE8f///wtTeXN0ZW0uR3VpZAsAAAACX2ECX2ICX2MCX2QCX2UCX2YCX2cCX2gCX2kCX2oCX2sAAAAAAAAAAAAAAAgHBwICAgICAgICAQAAAO5XXB4AtNAAC7HhHhANAAAAAQAAAAYQAAAABnZhbHVlMRAOAAAAAQAAAAYRAAAABnZhbHVlMgs=" } };
+
+ var listDictionary = new System.Collections.Specialized.ListDictionary(StringComparer.Create(CultureInfo.InvariantCulture, false))
+ {
+ { "key1", "value1" },
+ { "keyx", "valuex" }
+ };
+ yield return new object[] { listDictionary, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAGFTeXN0ZW0uQ29sbGVjdGlvbnMuU3BlY2lhbGl6ZWQsIFZlcnNpb249NC4xLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAAAtU3lzdGVtLkNvbGxlY3Rpb25zLlNwZWNpYWxpemVkLkxpc3REaWN0aW9uYXJ5BAAAAARoZWFkB3ZlcnNpb24FY291bnQIY29tcGFyZXIEAAADPFN5c3RlbS5Db2xsZWN0aW9ucy5TcGVjaWFsaXplZC5MaXN0RGljdGlvbmFyeStEaWN0aW9uYXJ5Tm9kZQIAAAAICBtTeXN0ZW0uQ3VsdHVyZUF3YXJlQ29tcGFyZXICAAAACQMAAAACAAAAAgAAAAkEAAAABQMAAAA8U3lzdGVtLkNvbGxlY3Rpb25zLlNwZWNpYWxpemVkLkxpc3REaWN0aW9uYXJ5K0RpY3Rpb25hcnlOb2RlAwAAAANrZXkFdmFsdWUEbmV4dAICBDxTeXN0ZW0uQ29sbGVjdGlvbnMuU3BlY2lhbGl6ZWQuTGlzdERpY3Rpb25hcnkrRGljdGlvbmFyeU5vZGUCAAAAAgAAAAYFAAAABGtleTEGBgAAAAZ2YWx1ZTEJBwAAAAQEAAAAG1N5c3RlbS5DdWx0dXJlQXdhcmVDb21wYXJlcgIAAAAMX2NvbXBhcmVJbmZvCF9vcHRpb25zAwMgU3lzdGVtLkdsb2JhbGl6YXRpb24uQ29tcGFyZUluZm8jU3lzdGVtLkdsb2JhbGl6YXRpb24uQ29tcGFyZU9wdGlvbnMJCAAAAAT3////I1N5c3RlbS5HbG9iYWxpemF0aW9uLkNvbXBhcmVPcHRpb25zAQAAAAd2YWx1ZV9fAAgAAAAAAQcAAAADAAAABgoAAAAEa2V5eAYLAAAABnZhbHVleAoECAAAACBTeXN0ZW0uR2xvYmFsaXphdGlvbi5Db21wYXJlSW5mbwIAAAAGbV9uYW1lDW1fc29ydFZlcnNpb24BAyBTeXN0ZW0uR2xvYmFsaXphdGlvbi5Tb3J0VmVyc2lvbgYMAAAAAAoL", "AAEAAAD/////AQAAAAAAAAAMAgAAAElTeXN0ZW0sIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAtU3lzdGVtLkNvbGxlY3Rpb25zLlNwZWNpYWxpemVkLkxpc3REaWN0aW9uYXJ5BAAAAARoZWFkB3ZlcnNpb24FY291bnQIY29tcGFyZXIEAAADPFN5c3RlbS5Db2xsZWN0aW9ucy5TcGVjaWFsaXplZC5MaXN0RGljdGlvbmFyeStEaWN0aW9uYXJ5Tm9kZQIAAAAICBtTeXN0ZW0uQ3VsdHVyZUF3YXJlQ29tcGFyZXICAAAACQMAAAACAAAAAgAAAAkEAAAABQMAAAA8U3lzdGVtLkNvbGxlY3Rpb25zLlNwZWNpYWxpemVkLkxpc3REaWN0aW9uYXJ5K0RpY3Rpb25hcnlOb2RlAwAAAANrZXkFdmFsdWUEbmV4dAICBDxTeXN0ZW0uQ29sbGVjdGlvbnMuU3BlY2lhbGl6ZWQuTGlzdERpY3Rpb25hcnkrRGljdGlvbmFyeU5vZGUCAAAAAgAAAAYFAAAABGtleTEGBgAAAAZ2YWx1ZTEJBwAAAAQEAAAAG1N5c3RlbS5DdWx0dXJlQXdhcmVDb21wYXJlcgIAAAAMX2NvbXBhcmVJbmZvC19pZ25vcmVDYXNlAwAgU3lzdGVtLkdsb2JhbGl6YXRpb24uQ29tcGFyZUluZm8BCQgAAAAAAQcAAAADAAAABgkAAAAEa2V5eAYKAAAABnZhbHVleAoECAAAACBTeXN0ZW0uR2xvYmFsaXphdGlvbi5Db21wYXJlSW5mbwQAAAAGbV9uYW1lCXdpbjMyTENJRAdjdWx0dXJlDW1fU29ydFZlcnNpb24BAAADCAggU3lzdGVtLkdsb2JhbGl6YXRpb24uU29ydFZlcnNpb24GCwAAAAVlbi1VUwAAAAAJBAAACQwAAAAEDAAAACBTeXN0ZW0uR2xvYmFsaXphdGlvbi5Tb3J0VmVyc2lvbgIAAAAMbV9ObHNWZXJzaW9uCG1fU29ydElkAAMIC1N5c3RlbS5HdWlkDgIGAATz////C1N5c3RlbS5HdWlkCwAAAAJfYQJfYgJfYwJfZAJfZQJfZgJfZwJfaAJfaQJfagJfawAAAAAAAAAAAAAACAcHAgICAgICAgIBAAAA7ldcHgC00AALseEeCw==" } };
+ yield return new object[] { new System.Collections.Specialized.ListDictionary(StringComparer.Ordinal), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAGFTeXN0ZW0uQ29sbGVjdGlvbnMuU3BlY2lhbGl6ZWQsIFZlcnNpb249NC4xLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAAAtU3lzdGVtLkNvbGxlY3Rpb25zLlNwZWNpYWxpemVkLkxpc3REaWN0aW9uYXJ5BAAAAARoZWFkB3ZlcnNpb24FY291bnQIY29tcGFyZXIEAAADPFN5c3RlbS5Db2xsZWN0aW9ucy5TcGVjaWFsaXplZC5MaXN0RGljdGlvbmFyeStEaWN0aW9uYXJ5Tm9kZQIAAAAICBZTeXN0ZW0uT3JkaW5hbENvbXBhcmVyAgAAAAoAAAAAAAAAAAkDAAAABAMAAAAWU3lzdGVtLk9yZGluYWxDb21wYXJlcgAAAAAL", "AAEAAAD/////AQAAAAAAAAAMAgAAAElTeXN0ZW0sIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAtU3lzdGVtLkNvbGxlY3Rpb25zLlNwZWNpYWxpemVkLkxpc3REaWN0aW9uYXJ5BAAAAARoZWFkB3ZlcnNpb24FY291bnQIY29tcGFyZXIEAAADPFN5c3RlbS5Db2xsZWN0aW9ucy5TcGVjaWFsaXplZC5MaXN0RGljdGlvbmFyeStEaWN0aW9uYXJ5Tm9kZQIAAAAICBZTeXN0ZW0uT3JkaW5hbENvbXBhcmVyAgAAAAoAAAAAAAAAAAkDAAAABAMAAAAWU3lzdGVtLk9yZGluYWxDb21wYXJlcgEAAAALX2lnbm9yZUNhc2UAAQAL" } };
+ yield return new object[] { new System.Collections.Specialized.ListDictionary(StringComparer.OrdinalIgnoreCase), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAGFTeXN0ZW0uQ29sbGVjdGlvbnMuU3BlY2lhbGl6ZWQsIFZlcnNpb249NC4xLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAAAtU3lzdGVtLkNvbGxlY3Rpb25zLlNwZWNpYWxpemVkLkxpc3REaWN0aW9uYXJ5BAAAAARoZWFkB3ZlcnNpb24FY291bnQIY29tcGFyZXIEAAADPFN5c3RlbS5Db2xsZWN0aW9ucy5TcGVjaWFsaXplZC5MaXN0RGljdGlvbmFyeStEaWN0aW9uYXJ5Tm9kZQIAAAAICCBTeXN0ZW0uT3JkaW5hbElnbm9yZUNhc2VDb21wYXJlcgIAAAAKAAAAAAAAAAAJAwAAAAQDAAAAIFN5c3RlbS5PcmRpbmFsSWdub3JlQ2FzZUNvbXBhcmVyAAAAAAs=", "AAEAAAD/////AQAAAAAAAAAMAgAAAElTeXN0ZW0sIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAtU3lzdGVtLkNvbGxlY3Rpb25zLlNwZWNpYWxpemVkLkxpc3REaWN0aW9uYXJ5BAAAAARoZWFkB3ZlcnNpb24FY291bnQIY29tcGFyZXIEAAADPFN5c3RlbS5Db2xsZWN0aW9ucy5TcGVjaWFsaXplZC5MaXN0RGljdGlvbmFyeStEaWN0aW9uYXJ5Tm9kZQIAAAAICBZTeXN0ZW0uT3JkaW5hbENvbXBhcmVyAgAAAAoAAAAAAAAAAAkDAAAABAMAAAAWU3lzdGVtLk9yZGluYWxDb21wYXJlcgEAAAALX2lnbm9yZUNhc2UAAQEL" } };
+
+ var hybridDictionary = new System.Collections.Specialized.HybridDictionary(10, true)
+ {
+ { 32, "5d" },
+ { "5d", 32 }
+ };
+ yield return new object[] { hybridDictionary, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAGFTeXN0ZW0uQ29sbGVjdGlvbnMuU3BlY2lhbGl6ZWQsIFZlcnNpb249NC4xLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhDAMAAABcU3lzdGVtLlJ1bnRpbWUuRXh0ZW5zaW9ucywgVmVyc2lvbj00LjIuMS4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAAC9TeXN0ZW0uQ29sbGVjdGlvbnMuU3BlY2lhbGl6ZWQuSHlicmlkRGljdGlvbmFyeQMAAAAFX2xpc3QKX2hhc2h0YWJsZRBfY2FzZUluc2Vuc2l0aXZlBAQALVN5c3RlbS5Db2xsZWN0aW9ucy5TcGVjaWFsaXplZC5MaXN0RGljdGlvbmFyeQIAAAAcU3lzdGVtLkNvbGxlY3Rpb25zLkhhc2h0YWJsZQMAAAABAgAAAAoJBAAAAAEFBAAAABxTeXN0ZW0uQ29sbGVjdGlvbnMuSGFzaHRhYmxlBgAAAApMb2FkRmFjdG9yB1ZlcnNpb24LS2V5Q29tcGFyZXIISGFzaFNpemUES2V5cwZWYWx1ZXMAAAMABQULCCBTeXN0ZW0uT3JkaW5hbElnbm9yZUNhc2VDb21wYXJlcggDAAAA7FE4PwIAAAAJBQAAABEAAAAJBgAAAAkHAAAABAUAAAAgU3lzdGVtLk9yZGluYWxJZ25vcmVDYXNlQ29tcGFyZXIAAAAAEAYAAAACAAAACAggAAAABggAAAACNWQQBwAAAAIAAAAJCAAAAAgIIAAAAAs=", "AAEAAAD/////AQAAAAAAAAAMAgAAAElTeXN0ZW0sIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAvU3lzdGVtLkNvbGxlY3Rpb25zLlNwZWNpYWxpemVkLkh5YnJpZERpY3Rpb25hcnkDAAAABGxpc3QJaGFzaHRhYmxlD2Nhc2VJbnNlbnNpdGl2ZQQDAC1TeXN0ZW0uQ29sbGVjdGlvbnMuU3BlY2lhbGl6ZWQuTGlzdERpY3Rpb25hcnkCAAAAHFN5c3RlbS5Db2xsZWN0aW9ucy5IYXNodGFibGUBAgAAAAoJAwAAAAEEAwAAABxTeXN0ZW0uQ29sbGVjdGlvbnMuSGFzaHRhYmxlBgAAAApMb2FkRmFjdG9yB1ZlcnNpb24LS2V5Q29tcGFyZXIISGFzaFNpemUES2V5cwZWYWx1ZXMAAAMABQULCBZTeXN0ZW0uT3JkaW5hbENvbXBhcmVyCOxROD8CAAAACQQAAAARAAAACQUAAAAJBgAAAAQEAAAAFlN5c3RlbS5PcmRpbmFsQ29tcGFyZXIBAAAAC19pZ25vcmVDYXNlAAEBEAUAAAACAAAACAggAAAABgcAAAACNWQQBgAAAAIAAAAJBwAAAAgIIAAAAAs=" } };
+ yield return new object[] { new SortedList<int, string>(dictionary, Comparer<int>.Default), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uQ29sbGVjdGlvbnMsIFZlcnNpb249NC4xLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAAD9AVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLlNvcnRlZExpc3RgMltbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5TdHJpbmcsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0HAAAABGtleXMGdmFsdWVzBV9zaXplB3ZlcnNpb24IY29tcGFyZXIHa2V5TGlzdAl2YWx1ZUxpc3QHBgAAAwQECAgIlwFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5HZW5lcmljQ29tcGFyZXJgMVtbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dhQJTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5Tb3J0ZWRMaXN0YDIrS2V5TGlzdFtbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5TdHJpbmcsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0CAAAAhwJTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5Tb3J0ZWRMaXN0YDIrVmFsdWVMaXN0W1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLlN0cmluZywgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQIAAAACAAAACQMAAAAJBAAAAAIAAAAAAAAACQUAAAAKCg8DAAAAAgAAAAgBAAAAAgAAABEEAAAAAgAAAAYGAAAABHRlc3QGBwAAAAxhbm90aGVyIHRlc3QEBQAAAJcBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuR2VuZXJpY0NvbXBhcmVyYDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQAAAAAL", "AAEAAAD/////AQAAAAAAAAAMAgAAAElTeXN0ZW0sIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAADhAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLlNvcnRlZExpc3RgMltbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldLFtTeXN0ZW0uU3RyaW5nLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQcAAAAEa2V5cwZ2YWx1ZXMFX3NpemUHdmVyc2lvbghjb21wYXJlcgdrZXlMaXN0CXZhbHVlTGlzdAcGAAADBAQICAiJAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkdlbmVyaWNDb21wYXJlcmAxW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1d6QFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5Tb3J0ZWRMaXN0YDIrS2V5TGlzdFtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldLFtTeXN0ZW0uU3RyaW5nLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQIAAADrAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLlNvcnRlZExpc3RgMitWYWx1ZUxpc3RbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlN0cmluZywgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0CAAAAAgAAAAkDAAAACQQAAAACAAAAAAAAAAkFAAAACgoPAwAAAAIAAAAIAQAAAAIAAAARBAAAAAIAAAAGBgAAAAR0ZXN0BgcAAAAMYW5vdGhlciB0ZXN0BAUAAACJAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkdlbmVyaWNDb21wYXJlcmAxW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dAAAAAAs=" } };
+ yield return new object[] { new Queue<int>(Enumerable.Range(1, 10)), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uQ29sbGVjdGlvbnMsIFZlcnNpb249NC4xLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAACNAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLlF1ZXVlYDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQUAAAAGX2FycmF5BV9oZWFkBV90YWlsBV9zaXplCF92ZXJzaW9uBwAAAAAICAgICAIAAAAJAwAAAAAAAAAKAAAACgAAAAAAAAAPAwAAABAAAAAIAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAs=", "AAEAAAD/////AQAAAAAAAAAMAgAAAElTeXN0ZW0sIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAB/U3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuUXVldWVgMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQUAAAAGX2FycmF5BV9oZWFkBV90YWlsBV9zaXplCF92ZXJzaW9uBwAAAAAICAgICAIAAAAJAwAAAAAAAAAKAAAACgAAAAwAAAAPAwAAABAAAAAIAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAs=" } };
+ var observableCollection = new System.Collections.ObjectModel.ObservableCollection<int>(Enumerable.Range(1, 5));
+ yield return new object[] { observableCollection, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uT2JqZWN0TW9kZWwsIFZlcnNpb249NC4xLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAACgAVN5c3RlbS5Db2xsZWN0aW9ucy5PYmplY3RNb2RlbC5PYnNlcnZhYmxlQ29sbGVjdGlvbmAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0CAAAACF9tb25pdG9yBWl0ZW1zBAOuAVN5c3RlbS5Db2xsZWN0aW9ucy5PYmplY3RNb2RlbC5PYnNlcnZhYmxlQ29sbGVjdGlvbmAxK1NpbXBsZU1vbml0b3JbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQIAAACMAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dAgAAAAkDAAAACQQAAAAFAwAAAK4BU3lzdGVtLkNvbGxlY3Rpb25zLk9iamVjdE1vZGVsLk9ic2VydmFibGVDb2xsZWN0aW9uYDErU2ltcGxlTW9uaXRvcltbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dAQAAAApfYnVzeUNvdW50AAgCAAAAAAAAAAQEAAAAjAFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5MaXN0YDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQMAAAAGX2l0ZW1zBV9zaXplCF92ZXJzaW9uBwAACAgICQUAAAAFAAAAAQAAAA8FAAAACAAAAAgBAAAAAgAAAAMAAAAEAAAABQAAAAAAAAAAAAAAAAAAAAs=", "AAEAAAD/////AQAAAAAAAAAMAgAAAE5XaW5kb3dzQmFzZSwgVmVyc2lvbj0zLjAuMC4wLCBDdWx0dXJlPU5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTMxYmYzODU2YWQzNjRlMzUFAQAAAJIBU3lzdGVtLkNvbGxlY3Rpb25zLk9iamVjdE1vZGVsLk9ic2VydmFibGVDb2xsZWN0aW9uYDFbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0CAAAACF9tb25pdG9yEkNvbGxlY3Rpb25gMStpdGVtcwQDoAFTeXN0ZW0uQ29sbGVjdGlvbnMuT2JqZWN0TW9kZWwuT2JzZXJ2YWJsZUNvbGxlY3Rpb25gMStTaW1wbGVNb25pdG9yW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dAgAAAH5TeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5MaXN0YDFbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0CAAAACQMAAAAJBAAAAAUDAAAAoAFTeXN0ZW0uQ29sbGVjdGlvbnMuT2JqZWN0TW9kZWwuT2JzZXJ2YWJsZUNvbGxlY3Rpb25gMStTaW1wbGVNb25pdG9yW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dAQAAAApfYnVzeUNvdW50AAgCAAAAAAAAAAQEAAAAflN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQMAAAAGX2l0ZW1zBV9zaXplCF92ZXJzaW9uBwAACAgICQUAAAAFAAAABQAAAA8FAAAACAAAAAgBAAAAAgAAAAMAAAAEAAAABQAAAAAAAAAAAAAAAAAAAAs=" } };
+ yield return new object[] { new System.Collections.ObjectModel.ReadOnlyObservableCollection<int>(observableCollection), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uT2JqZWN0TW9kZWwsIFZlcnNpb249NC4xLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAACoAVN5c3RlbS5Db2xsZWN0aW9ucy5PYmplY3RNb2RlbC5SZWFkT25seU9ic2VydmFibGVDb2xsZWN0aW9uYDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQEAAAAEbGlzdASgAVN5c3RlbS5Db2xsZWN0aW9ucy5PYmplY3RNb2RlbC5PYnNlcnZhYmxlQ29sbGVjdGlvbmAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0CAAAAAgAAAAkDAAAABQMAAACgAVN5c3RlbS5Db2xsZWN0aW9ucy5PYmplY3RNb2RlbC5PYnNlcnZhYmxlQ29sbGVjdGlvbmAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0CAAAACF9tb25pdG9yBWl0ZW1zBAOuAVN5c3RlbS5Db2xsZWN0aW9ucy5PYmplY3RNb2RlbC5PYnNlcnZhYmxlQ29sbGVjdGlvbmAxK1NpbXBsZU1vbml0b3JbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQIAAACMAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dAgAAAAkEAAAACQUAAAAFBAAAAK4BU3lzdGVtLkNvbGxlY3Rpb25zLk9iamVjdE1vZGVsLk9ic2VydmFibGVDb2xsZWN0aW9uYDErU2ltcGxlTW9uaXRvcltbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dAQAAAApfYnVzeUNvdW50AAgCAAAAAAAAAAQFAAAAjAFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5MaXN0YDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQMAAAAGX2l0ZW1zBV9zaXplCF92ZXJzaW9uBwAACAgICQYAAAAFAAAAAQAAAA8GAAAACAAAAAgBAAAAAgAAAAMAAAAEAAAABQAAAAAAAAAAAAAAAAAAAAs=", "AAEAAAD/////AQAAAAAAAAAMAgAAAE5XaW5kb3dzQmFzZSwgVmVyc2lvbj0zLjAuMC4wLCBDdWx0dXJlPU5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTMxYmYzODU2YWQzNjRlMzUFAQAAAJoBU3lzdGVtLkNvbGxlY3Rpb25zLk9iamVjdE1vZGVsLlJlYWRPbmx5T2JzZXJ2YWJsZUNvbGxlY3Rpb25gMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQEAAAAZUmVhZE9ubHlDb2xsZWN0aW9uYDErbGlzdASSAVN5c3RlbS5Db2xsZWN0aW9ucy5PYmplY3RNb2RlbC5PYnNlcnZhYmxlQ29sbGVjdGlvbmAxW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dAgAAAAIAAAAJAwAAAAUDAAAAkgFTeXN0ZW0uQ29sbGVjdGlvbnMuT2JqZWN0TW9kZWwuT2JzZXJ2YWJsZUNvbGxlY3Rpb25gMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQIAAAAIX21vbml0b3ISQ29sbGVjdGlvbmAxK2l0ZW1zBAOgAVN5c3RlbS5Db2xsZWN0aW9ucy5PYmplY3RNb2RlbC5PYnNlcnZhYmxlQ29sbGVjdGlvbmAxK1NpbXBsZU1vbml0b3JbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0CAAAAflN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQIAAAAJBAAAAAkFAAAABQQAAACgAVN5c3RlbS5Db2xsZWN0aW9ucy5PYmplY3RNb2RlbC5PYnNlcnZhYmxlQ29sbGVjdGlvbmAxK1NpbXBsZU1vbml0b3JbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0BAAAACl9idXN5Q291bnQACAIAAAAAAAAABAUAAAB+U3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24HAAAICAgJBgAAAAUAAAAFAAAADwYAAAAIAAAACAEAAAACAAAAAwAAAAQAAAAFAAAAAAAAAAAAAAAAAAAACw==" } };
+ yield return new object[] { new System.Collections.ObjectModel.ReadOnlyCollection<int>(Enumerable.Range(1, 15).ToList()), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAJ4BU3lzdGVtLkNvbGxlY3Rpb25zLk9iamVjdE1vZGVsLlJlYWRPbmx5Q29sbGVjdGlvbmAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0BAAAABGxpc3QDjAFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5MaXN0YDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQkCAAAABAIAAACMAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24HAAAICAgJAwAAAA8AAAAPAAAADwMAAAAPAAAACAEAAAACAAAAAwAAAAQAAAAFAAAABgAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAAAs=", "AAEAAAD/////AQAAAAAAAAAEAQAAAJABU3lzdGVtLkNvbGxlY3Rpb25zLk9iamVjdE1vZGVsLlJlYWRPbmx5Q29sbGVjdGlvbmAxW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dAQAAAARsaXN0A35TeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5MaXN0YDFbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0JAgAAAAQCAAAAflN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQMAAAAGX2l0ZW1zBV9zaXplCF92ZXJzaW9uBwAACAgICQMAAAAPAAAADwAAAA8DAAAAEAAAAAgBAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAAAAAACw==" } };
+ yield return new object[] { new System.Collections.ObjectModel.ReadOnlyDictionary<int, string>(dictionary), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAFVTeXN0ZW0uT2JqZWN0TW9kZWwsIFZlcnNpb249NC4xLjEuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iMDNmNWY3ZjExZDUwYTNhBQEAAACJAlN5c3RlbS5Db2xsZWN0aW9ucy5PYmplY3RNb2RlbC5SZWFkT25seURpY3Rpb25hcnlgMltbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5TdHJpbmcsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0BAAAADG1fZGljdGlvbmFyeQP9AVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkRpY3Rpb25hcnlgMltbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5TdHJpbmcsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0CAAAACQMAAAAEAwAAAP0BU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuRGljdGlvbmFyeWAyW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLlN0cmluZywgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQQAAAAHVmVyc2lvbghDb21wYXJlcghIYXNoU2l6ZQ1LZXlWYWx1ZVBhaXJzAAMAAwifAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkdlbmVyaWNFcXVhbGl0eUNvbXBhcmVyYDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQiBAlN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLktleVZhbHVlUGFpcmAyW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLlN0cmluZywgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXVtdAgAAAAkEAAAAAwAAAAkFAAAABAQAAACfAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkdlbmVyaWNFcXVhbGl0eUNvbXBhcmVyYDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQAAAAAHBQAAAAABAAAAAgAAAAP/AVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLktleVZhbHVlUGFpcmAyW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLlN0cmluZywgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQT6/////wFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5LZXlWYWx1ZVBhaXJgMltbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5TdHJpbmcsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0CAAAAA2tleQV2YWx1ZQABCAEAAAAGBwAAAAR0ZXN0Afj////6////AgAAAAYJAAAADGFub3RoZXIgdGVzdAs=", "AAEAAAD/////AQAAAAAAAAAEAQAAAO0BU3lzdGVtLkNvbGxlY3Rpb25zLk9iamVjdE1vZGVsLlJlYWRPbmx5RGljdGlvbmFyeWAyW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV0sW1N5c3RlbS5TdHJpbmcsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dAQAAAAxtX2RpY3Rpb25hcnkD4QFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5EaWN0aW9uYXJ5YDJbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlN0cmluZywgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0JAgAAAAQCAAAA4QFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5EaWN0aW9uYXJ5YDJbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlN0cmluZywgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0EAAAAB1ZlcnNpb24IQ29tcGFyZXIISGFzaFNpemUNS2V5VmFsdWVQYWlycwADAAMIkQFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5HZW5lcmljRXF1YWxpdHlDb21wYXJlcmAxW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dCOUBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuS2V5VmFsdWVQYWlyYDJbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlN0cmluZywgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV1bXQIAAAAJAwAAAAMAAAAJBAAAAAQDAAAAkQFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5HZW5lcmljRXF1YWxpdHlDb21wYXJlcmAxW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dAAAAAAcEAAAAAAEAAAACAAAAA+MBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuS2V5VmFsdWVQYWlyYDJbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlN0cmluZywgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0E+////+MBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuS2V5VmFsdWVQYWlyYDJbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlN0cmluZywgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0CAAAAA2tleQV2YWx1ZQABCAEAAAAGBgAAAAR0ZXN0Afn////7////AgAAAAYIAAAADGFub3RoZXIgdGVzdAs=" } };
+
+ var simpleKeyedCollection = new SimpleKeyedCollection
+ {
+ point
+ };
+ yield return new object[] { simpleKeyedCollection, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAABDU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlNpbXBsZUtleWVkQ29sbGVjdGlvbgUAAAAIY29tcGFyZXIEZGljdAhrZXlDb3VudAl0aHJlc2hvbGQFaXRlbXMDAwAAA58BU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuR2VuZXJpY0VxdWFsaXR5Q29tcGFyZXJgMVtbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dugJTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5EaWN0aW9uYXJ5YDJbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdLFtTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQsIFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cywgVmVyc2lvbj00LjAuMy4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTlkNzdjYzdhZDM5YjY4ZWJdXQgIygFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5MaXN0YDFbW1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludCwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dAgAAAAkDAAAACQQAAAAAAAAAAAAAAAkFAAAABAMAAACfAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkdlbmVyaWNFcXVhbGl0eUNvbXBhcmVyYDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQAAAAAEBAAAALoCU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuRGljdGlvbmFyeWAyW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50LCBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViXV0EAAAAB1ZlcnNpb24IQ29tcGFyZXIISGFzaFNpemUNS2V5VmFsdWVQYWlycwADAAMInwFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5HZW5lcmljRXF1YWxpdHlDb21wYXJlcmAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0IvgJTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5LZXlWYWx1ZVBhaXJgMltbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludCwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dW10BAAAACQMAAAADAAAACQcAAAAEBQAAAMoBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQsIFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cywgVmVyc2lvbj00LjAuMy4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTlkNzdjYzdhZDM5YjY4ZWJdXQMAAAAGX2l0ZW1zBV9zaXplCF92ZXJzaW9uBAAANVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludFtdAgAAAAgICQgAAAABAAAAAQAAAAcHAAAAAAEAAAABAAAAA7wCU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuS2V5VmFsdWVQYWlyYDJbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdLFtTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQsIFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cywgVmVyc2lvbj00LjAuMy4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTlkNzdjYzdhZDM5YjY4ZWJdXQT3////vAJTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5LZXlWYWx1ZVBhaXJgMltbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludCwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dAgAAAANrZXkFdmFsdWUABAgzU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50AgAAAAIAAAAJCgAAAAcIAAAAAAEAAAAEAAAABDNTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQCAAAACQoAAAANAwUKAAAAM1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludAIAAAABWAFZAAAICAIAAAABAAAAAgAAAAs=", "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjIuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAABDU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlNpbXBsZUtleWVkQ29sbGVjdGlvbgUAAAAaS2V5ZWRDb2xsZWN0aW9uYDIrY29tcGFyZXIWS2V5ZWRDb2xsZWN0aW9uYDIrZGljdBpLZXllZENvbGxlY3Rpb25gMitrZXlDb3VudBtLZXllZENvbGxlY3Rpb25gMit0aHJlc2hvbGQSQ29sbGVjdGlvbmAxK2l0ZW1zAwMAAAORAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkdlbmVyaWNFcXVhbGl0eUNvbXBhcmVyYDFbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV2sAlN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkRpY3Rpb25hcnlgMltbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldLFtTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQsIFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cywgVmVyc2lvbj00LjAuMi4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTlkNzdjYzdhZDM5YjY4ZWJdXQgIygFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5MaXN0YDFbW1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludCwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4yLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dAgAAAAkDAAAACQQAAAAAAAAAAAAAAAkFAAAABAMAAACRAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkdlbmVyaWNFcXVhbGl0eUNvbXBhcmVyYDFbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0AAAAABAQAAACsAlN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkRpY3Rpb25hcnlgMltbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldLFtTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQsIFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cywgVmVyc2lvbj00LjAuMi4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTlkNzdjYzdhZDM5YjY4ZWJdXQQAAAAHVmVyc2lvbghDb21wYXJlcghIYXNoU2l6ZQ1LZXlWYWx1ZVBhaXJzAAMAAwiRAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkdlbmVyaWNFcXVhbGl0eUNvbXBhcmVyYDFbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0IsAJTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5LZXlWYWx1ZVBhaXJgMltbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldLFtTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQsIFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cywgVmVyc2lvbj00LjAuMi4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTlkNzdjYzdhZDM5YjY4ZWJdXVtdAQAAAAkDAAAAAwAAAAkHAAAABAUAAADKAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50LCBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjIuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViXV0DAAAABl9pdGVtcwVfc2l6ZQhfdmVyc2lvbgQAADVTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnRbXQIAAAAICAkIAAAAAQAAAAEAAAAHBwAAAAABAAAAAQAAAAOuAlN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLktleVZhbHVlUGFpcmAyW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV0sW1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludCwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4yLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dBPf///+uAlN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLktleVZhbHVlUGFpcmAyW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV0sW1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludCwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4yLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dAgAAAANrZXkFdmFsdWUABAgzU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlBvaW50AgAAAAIAAAAJCgAAAAcIAAAAAAEAAAAEAAAABDNTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuUG9pbnQCAAAACQoAAAANAwUKAAAAM1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Qb2ludAIAAAABWAFZAAAICAIAAAABAAAAAgAAAAs=" } };
+ yield return new object[] { new System.Collections.ObjectModel.Collection<int>(Enumerable.Range(1, 20).ToList()), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAJYBU3lzdGVtLkNvbGxlY3Rpb25zLk9iamVjdE1vZGVsLkNvbGxlY3Rpb25gMVtbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dAQAAAAVpdGVtcwOMAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dCQIAAAAEAgAAAIwBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0DAAAABl9pdGVtcwVfc2l6ZQhfdmVyc2lvbgcAAAgICAkDAAAAFAAAABQAAAAPAwAAABQAAAAIAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAL", "AAEAAAD/////AQAAAAAAAAAEAQAAAIgBU3lzdGVtLkNvbGxlY3Rpb25zLk9iamVjdE1vZGVsLkNvbGxlY3Rpb25gMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQEAAAAFaXRlbXMDflN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQkCAAAABAIAAAB+U3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24HAAAICAgJAwAAABQAAAAUAAAADwMAAAAgAAAACAEAAAACAAAAAwAAAAQAAAAFAAAABgAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAAAARAAAAEgAAABMAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACw==" } };
+
+ // Graph without cycles
+ yield return new object[] { new Tree<int>(42, null, null), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAACfAVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5UcmVlYDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQMAAAAWPFZhbHVlPmtfX0JhY2tpbmdGaWVsZBU8TGVmdD5rX19CYWNraW5nRmllbGQWPFJpZ2h0PmtfX0JhY2tpbmdGaWVsZAAEBAifAVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5UcmVlYDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQIAAACfAVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5UcmVlYDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQIAAAACAAAAKgAAAAoKCw==", "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAACRAVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5UcmVlYDFbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0DAAAAFjxWYWx1ZT5rX19CYWNraW5nRmllbGQVPExlZnQ+a19fQmFja2luZ0ZpZWxkFjxSaWdodD5rX19CYWNraW5nRmllbGQABAQIkQFTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuVHJlZWAxW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dAgAAAJEBU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlRyZWVgMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQIAAAACAAAAKgAAAAoKCw==" } };
+ yield return new object[] { new Tree<int>(1, new Tree<int>(2, new Tree<int>(3, null, null), null), null), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAACfAVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5UcmVlYDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQMAAAAWPFZhbHVlPmtfX0JhY2tpbmdGaWVsZBU8TGVmdD5rX19CYWNraW5nRmllbGQWPFJpZ2h0PmtfX0JhY2tpbmdGaWVsZAAEBAifAVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5UcmVlYDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQIAAACfAVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5UcmVlYDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQIAAAACAAAAAQAAAAkDAAAACgEDAAAAAQAAAAIAAAAJBAAAAAoBBAAAAAEAAAADAAAACgoL", "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAACRAVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5UcmVlYDFbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0DAAAAFjxWYWx1ZT5rX19CYWNraW5nRmllbGQVPExlZnQ+a19fQmFja2luZ0ZpZWxkFjxSaWdodD5rX19CYWNraW5nRmllbGQABAQIkQFTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuVHJlZWAxW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dAgAAAJEBU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlRyZWVgMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQIAAAACAAAAAQAAAAkDAAAACgEDAAAAAQAAAAIAAAAJBAAAAAoBBAAAAAEAAAADAAAACgoL" } };
+ yield return new object[] { new Tree<Colors>(Colors.Red, null, new Tree<Colors>(Colors.Blue, null, new Tree<Colors>(Colors.Green, null, null))), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAADeAVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5UcmVlYDFbW1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Db2xvcnMsIFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cywgVmVyc2lvbj00LjAuMy4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTlkNzdjYzdhZDM5YjY4ZWJdXQMAAAAWPFZhbHVlPmtfX0JhY2tpbmdGaWVsZBU8TGVmdD5rX19CYWNraW5nRmllbGQWPFJpZ2h0PmtfX0JhY2tpbmdGaWVsZAQEBDRTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuQ29sb3JzAgAAAN4BU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlRyZWVgMVtbU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLkNvbG9ycywgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dAgAAAN4BU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlRyZWVgMVtbU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLkNvbG9ycywgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dAgAAAAIAAAAF/f///zRTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuQ29sb3JzAQAAAAd2YWx1ZV9fAAgCAAAAAAAAAAoJBAAAAAEEAAAAAQAAAAH7/////f///wQAAAAKCQYAAAABBgAAAAEAAAAB+f////3///8DAAAACgoL", "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAADeAVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5UcmVlYDFbW1N5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Db2xvcnMsIFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cywgVmVyc2lvbj00LjAuMy4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTlkNzdjYzdhZDM5YjY4ZWJdXQMAAAAWPFZhbHVlPmtfX0JhY2tpbmdGaWVsZBU8TGVmdD5rX19CYWNraW5nRmllbGQWPFJpZ2h0PmtfX0JhY2tpbmdGaWVsZAQEBDRTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuQ29sb3JzAgAAAN4BU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlRyZWVgMVtbU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLkNvbG9ycywgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dAgAAAN4BU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlRyZWVgMVtbU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLkNvbG9ycywgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dAgAAAAIAAAAF/f///zRTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuQ29sb3JzAQAAAAd2YWx1ZV9fAAgCAAAAAAAAAAoJBAAAAAEEAAAAAQAAAAH7/////f///wQAAAAKCQYAAAABBgAAAAEAAAAB+f////3///8DAAAACgoL" } };
+ yield return new object[] { new Tree<int>(1, new Tree<int>(2, new Tree<int>(3, null, null), new Tree<int>(4, null, null)), new Tree<int>(5, null, null)), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAACfAVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5UcmVlYDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQMAAAAWPFZhbHVlPmtfX0JhY2tpbmdGaWVsZBU8TGVmdD5rX19CYWNraW5nRmllbGQWPFJpZ2h0PmtfX0JhY2tpbmdGaWVsZAAEBAifAVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5UcmVlYDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQIAAACfAVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5UcmVlYDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQIAAAACAAAAAQAAAAkDAAAACQQAAAABAwAAAAEAAAACAAAACQUAAAAJBgAAAAEEAAAAAQAAAAUAAAAKCgEFAAAAAQAAAAMAAAAKCgEGAAAAAQAAAAQAAAAKCgs=", "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAACRAVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5UcmVlYDFbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0DAAAAFjxWYWx1ZT5rX19CYWNraW5nRmllbGQVPExlZnQ+a19fQmFja2luZ0ZpZWxkFjxSaWdodD5rX19CYWNraW5nRmllbGQABAQIkQFTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuVHJlZWAxW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dAgAAAJEBU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlRyZWVgMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQIAAAACAAAAAQAAAAkDAAAACQQAAAABAwAAAAEAAAACAAAACQUAAAAJBgAAAAEEAAAAAQAAAAUAAAAKCgEFAAAAAQAAAAMAAAAKCgEGAAAAAQAAAAQAAAAKCgs=" } };
+
+ // Graph with cycles
+ {
+ var a = new Graph<int> { Value = 1 };
+ var b = new Graph<int> { Value = 2, Links = new[] { a } };
+ var c = new Graph<int> { Value = 3, Links = new[] { a, b } };
+ var d = new Graph<int> { Value = 3, Links = new[] { a, b, c } };
+ a.Links = new[] { b, c, d }; // complete the cycle
+ yield return new object[] { a, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAACgAVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5HcmFwaGAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0CAAAABVZhbHVlBUxpbmtzAAQIogFTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuR3JhcGhgMVtbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dW10CAAAAAgAAAAEAAAAJAwAAAAcDAAAAAAEAAAADAAAABKABU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLkdyYXBoYDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQIAAAAJBAAAAAkFAAAACQYAAAABBAAAAAEAAAACAAAACQcAAAABBQAAAAEAAAADAAAACQgAAAABBgAAAAEAAAADAAAACQkAAAAHBwAAAAABAAAAAQAAAASgAVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5HcmFwaGAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0CAAAACQEAAAAHCAAAAAABAAAAAgAAAASgAVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5HcmFwaGAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0CAAAACQEAAAAJBAAAAAcJAAAAAAEAAAADAAAABKABU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLkdyYXBoYDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQIAAAAJAQAAAAkEAAAACQUAAAAL", "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAACSAVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5HcmFwaGAxW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dAgAAAAVWYWx1ZQVMaW5rcwAECJQBU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLkdyYXBoYDFbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV1bXQIAAAACAAAAAQAAAAkDAAAABwMAAAAAAQAAAAMAAAAEkgFTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuR3JhcGhgMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQIAAAAJBAAAAAkFAAAACQYAAAABBAAAAAEAAAACAAAACQcAAAABBQAAAAEAAAADAAAACQgAAAABBgAAAAEAAAADAAAACQkAAAAHBwAAAAABAAAAAQAAAASSAVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5HcmFwaGAxW1tTeXN0ZW0uSW50MzIsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dAgAAAAkBAAAABwgAAAAAAQAAAAIAAAAEkgFTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuR3JhcGhgMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQIAAAAJAQAAAAkEAAAABwkAAAAAAQAAAAMAAAAEkgFTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuR3JhcGhgMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldXQIAAAAJAQAAAAkEAAAACQUAAAAL" } };
+ }
+
+
+ // Structs
+ yield return new object[] { new EmptyStruct(), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAAA5U3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLkVtcHR5U3RydWN0AAAAAAIAAAAL", "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAAA5U3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLkVtcHR5U3RydWN0AAAAAAIAAAAL" } };
+ yield return new object[] { new StructWithIntField { X = 42 }, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAABAU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlN0cnVjdFdpdGhJbnRGaWVsZAEAAAABWAAIAgAAACoAAAAL", "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAABAU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlN0cnVjdFdpdGhJbnRGaWVsZAEAAAABWAAIAgAAACoAAAAL" } };
+ yield return new object[] { new StructWithStringFields { String1 = "hello", String2 = "world" }, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAABEU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlN0cnVjdFdpdGhTdHJpbmdGaWVsZHMCAAAAB1N0cmluZzEHU3RyaW5nMgEBAgAAAAYDAAAABWhlbGxvBgQAAAAFd29ybGQL", "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAABEU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlN0cnVjdFdpdGhTdHJpbmdGaWVsZHMCAAAAB1N0cmluZzEHU3RyaW5nMgEBAgAAAAYDAAAABWhlbGxvBgQAAAAFd29ybGQL" } };
+ yield return new object[] { new StructContainingOtherStructs { Nested1 = new StructWithStringFields { String1 = "a", String2 = "b" }, Nested2 = new StructWithStringFields { String1 = "3", String2 = "4" } }, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAABKU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlN0cnVjdENvbnRhaW5pbmdPdGhlclN0cnVjdHMCAAAAB05lc3RlZDEHTmVzdGVkMgQERFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5TdHJ1Y3RXaXRoU3RyaW5nRmllbGRzAgAAAERTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU3RydWN0V2l0aFN0cmluZ0ZpZWxkcwIAAAACAAAABf3///9EU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlN0cnVjdFdpdGhTdHJpbmdGaWVsZHMCAAAAB1N0cmluZzEHU3RyaW5nMgEBAgAAAAYEAAAAAWEGBQAAAAFiAfr////9////BgcAAAABMwYIAAAAATQL", "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAABKU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlN0cnVjdENvbnRhaW5pbmdPdGhlclN0cnVjdHMCAAAAB05lc3RlZDEHTmVzdGVkMgQERFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5TdHJ1Y3RXaXRoU3RyaW5nRmllbGRzAgAAAERTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU3RydWN0V2l0aFN0cmluZ0ZpZWxkcwIAAAACAAAABf3///9EU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlN0cnVjdFdpdGhTdHJpbmdGaWVsZHMCAAAAB1N0cmluZzEHU3RyaW5nMgEBAgAAAAYEAAAAAWEGBQAAAAFiAfr////9////BgcAAAABMwYIAAAAATQL" } };
+ yield return new object[] { new StructContainingArraysOfOtherStructs(), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAABSU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlN0cnVjdENvbnRhaW5pbmdBcnJheXNPZk90aGVyU3RydWN0cwEAAAAGTmVzdGVkBExTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU3RydWN0Q29udGFpbmluZ090aGVyU3RydWN0c1tdAgAAAAIAAAAKCw==", "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAABSU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlN0cnVjdENvbnRhaW5pbmdBcnJheXNPZk90aGVyU3RydWN0cwEAAAAGTmVzdGVkBExTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU3RydWN0Q29udGFpbmluZ090aGVyU3RydWN0c1tdAgAAAAIAAAAKCw==" } };
+ yield return new object[] { new StructContainingArraysOfOtherStructs { Nested = new StructContainingOtherStructs[0] }, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAABSU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlN0cnVjdENvbnRhaW5pbmdBcnJheXNPZk90aGVyU3RydWN0cwEAAAAGTmVzdGVkBExTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU3RydWN0Q29udGFpbmluZ090aGVyU3RydWN0c1tdAgAAAAIAAAAJAwAAAAcDAAAAAAEAAAAAAAAABEpTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU3RydWN0Q29udGFpbmluZ090aGVyU3RydWN0cwIAAAAL", "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAABSU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlN0cnVjdENvbnRhaW5pbmdBcnJheXNPZk90aGVyU3RydWN0cwEAAAAGTmVzdGVkBExTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU3RydWN0Q29udGFpbmluZ090aGVyU3RydWN0c1tdAgAAAAIAAAAJAwAAAAcDAAAAAAEAAAAAAAAABEpTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU3RydWN0Q29udGFpbmluZ090aGVyU3RydWN0cwIAAAAL" } };
+ var s = new StructContainingArraysOfOtherStructs
+ {
+ Nested = new[]
+ {
+ new StructContainingOtherStructs { Nested1 = new StructWithStringFields { String1 = "a", String2 = "b" }, Nested2 = new StructWithStringFields { String1 = "3", String2 = "4" } },
+ new StructContainingOtherStructs { Nested1 = new StructWithStringFields { String1 = "e", String2 = "f" }, Nested2 = new StructWithStringFields { String1 = "7", String2 = "8" } },
+ }
+ };
+ yield return new object[] { s, new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAABSU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlN0cnVjdENvbnRhaW5pbmdBcnJheXNPZk90aGVyU3RydWN0cwEAAAAGTmVzdGVkBExTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU3RydWN0Q29udGFpbmluZ090aGVyU3RydWN0c1tdAgAAAAIAAAAJAwAAAAcDAAAAAAEAAAACAAAABEpTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU3RydWN0Q29udGFpbmluZ090aGVyU3RydWN0cwIAAAAF/P///0pTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU3RydWN0Q29udGFpbmluZ090aGVyU3RydWN0cwIAAAAHTmVzdGVkMQdOZXN0ZWQyBAREU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlN0cnVjdFdpdGhTdHJpbmdGaWVsZHMCAAAARFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5TdHJ1Y3RXaXRoU3RyaW5nRmllbGRzAgAAAAIAAAAF+////0RTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU3RydWN0V2l0aFN0cmluZ0ZpZWxkcwIAAAAHU3RyaW5nMQdTdHJpbmcyAQECAAAABgYAAAABYQYHAAAAAWIB+P////v///8GCQAAAAEzBgoAAAABNAH1/////P///wH0////+////wYNAAAAAWUGDgAAAAFmAfH////7////BhAAAAABNwYRAAAAATgL", "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAABSU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlN0cnVjdENvbnRhaW5pbmdBcnJheXNPZk90aGVyU3RydWN0cwEAAAAGTmVzdGVkBExTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU3RydWN0Q29udGFpbmluZ090aGVyU3RydWN0c1tdAgAAAAIAAAAJAwAAAAcDAAAAAAEAAAACAAAABEpTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU3RydWN0Q29udGFpbmluZ090aGVyU3RydWN0cwIAAAAF/P///0pTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU3RydWN0Q29udGFpbmluZ090aGVyU3RydWN0cwIAAAAHTmVzdGVkMQdOZXN0ZWQyBAREU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlN0cnVjdFdpdGhTdHJpbmdGaWVsZHMCAAAARFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5TdHJ1Y3RXaXRoU3RyaW5nRmllbGRzAgAAAAIAAAAF+////0RTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU3RydWN0V2l0aFN0cmluZ0ZpZWxkcwIAAAAHU3RyaW5nMQdTdHJpbmcyAQECAAAABgYAAAABYQYHAAAAAWIB+P////v///8GCQAAAAEzBgoAAAABNAH1/////P///wH0////+////wYNAAAAAWUGDgAAAAFmAfH////7////BhAAAAABNwYRAAAAATgL" } };
+ yield return new object[] { new object[] { s, new StructContainingArraysOfOtherStructs?(s) }, new string[] { "AAEAAAD/////AQAAAAAAAAAQAQAAAAIAAAAJAgAAAAkDAAAADAQAAABwU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYgUCAAAAUlN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5TdHJ1Y3RDb250YWluaW5nQXJyYXlzT2ZPdGhlclN0cnVjdHMBAAAABk5lc3RlZARMU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlN0cnVjdENvbnRhaW5pbmdPdGhlclN0cnVjdHNbXQQAAAAEAAAACQUAAAABAwAAAAIAAAAJBQAAAAcFAAAAAAEAAAACAAAABEpTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU3RydWN0Q29udGFpbmluZ090aGVyU3RydWN0cwQAAAAF+v///0pTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU3RydWN0Q29udGFpbmluZ090aGVyU3RydWN0cwIAAAAHTmVzdGVkMQdOZXN0ZWQyBAREU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlN0cnVjdFdpdGhTdHJpbmdGaWVsZHMEAAAARFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5TdHJ1Y3RXaXRoU3RyaW5nRmllbGRzBAAAAAQAAAAF+f///0RTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU3RydWN0V2l0aFN0cmluZ0ZpZWxkcwIAAAAHU3RyaW5nMQdTdHJpbmcyAQEEAAAABggAAAABYQYJAAAAAWIB9v////n///8GCwAAAAEzBgwAAAABNAHz////+v///wHy////+f///wYPAAAAAWUGEAAAAAFmAe/////5////BhIAAAABNwYTAAAAATgL", "AAEAAAD/////AQAAAAAAAAAQAQAAAAIAAAAJAgAAAAkDAAAADAQAAABwU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYgUCAAAAUlN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5TdHJ1Y3RDb250YWluaW5nQXJyYXlzT2ZPdGhlclN0cnVjdHMBAAAABk5lc3RlZARMU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlN0cnVjdENvbnRhaW5pbmdPdGhlclN0cnVjdHNbXQQAAAAEAAAACQUAAAABAwAAAAIAAAAJBQAAAAcFAAAAAAEAAAACAAAABEpTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU3RydWN0Q29udGFpbmluZ090aGVyU3RydWN0cwQAAAAF+v///0pTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU3RydWN0Q29udGFpbmluZ090aGVyU3RydWN0cwIAAAAHTmVzdGVkMQdOZXN0ZWQyBAREU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlN0cnVjdFdpdGhTdHJpbmdGaWVsZHMEAAAARFN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5TdHJ1Y3RXaXRoU3RyaW5nRmllbGRzBAAAAAQAAAAF+f///0RTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU3RydWN0V2l0aFN0cmluZ0ZpZWxkcwIAAAAHU3RyaW5nMQdTdHJpbmcyAQEEAAAABggAAAABYQYJAAAAAWIB9v////n///8GCwAAAAEzBgwAAAABNAHz////+v///wHy////+f///wYPAAAAAWUGEAAAAAFmAe/////5////BhIAAAABNwYTAAAAATgL" } };
+
+ // ISerializable
+ yield return new object[] { new BasicISerializableObject(1, "2"), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAABGU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLkJhc2ljSVNlcmlhbGl6YWJsZU9iamVjdAIAAAAGVmFsdWUxBlZhbHVlMgABCAIAAAABAAAABgMAAAABMgs=", "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAABGU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLkJhc2ljSVNlcmlhbGl6YWJsZU9iamVjdAIAAAAGVmFsdWUxBlZhbHVlMgABCAIAAAABAAAABgMAAAABMgs=" } };
+ yield return new object[] { new DerivedISerializableWithNonPublicDeserializationCtor(1, "2"), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAABiU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLkRlcml2ZWRJU2VyaWFsaXphYmxlV2l0aE5vblB1YmxpY0Rlc2VyaWFsaXphdGlvbkN0b3ICAAAABlZhbHVlMQZWYWx1ZTIAAQgCAAAAAQAAAAYDAAAAATIL", "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAABiU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLkRlcml2ZWRJU2VyaWFsaXphYmxlV2l0aE5vblB1YmxpY0Rlc2VyaWFsaXphdGlvbkN0b3ICAAAABlZhbHVlMQZWYWx1ZTIAAQgCAAAAAQAAAAYDAAAAATIL" } };
+
+ // Various other special cases
+ yield return new object[] { new TypeWithoutNamespace(), new string[] { "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAAAUVHlwZVdpdGhvdXROYW1lc3BhY2UAAAAAAgAAAAs=", "AAEAAAD/////AQAAAAAAAAAMAgAAAHBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAAAUVHlwZVdpdGhvdXROYW1lc3BhY2UAAAAAAgAAAAs=" } };
+
+ // Extension of core serializable types
+ if (/*!PlatformDetection.IsNetfxBelow471()*/ !PlatformDetection.IsFullFramework)
+ {
+ // ValueType isn't serializable before ntfx471.
+ yield return new object[] { new ValueTuple(), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAABFTeXN0ZW0uVmFsdWVUdXBsZQAAAAAL", "" } };
+ yield return new object[] { ValueTuple.Create(1), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAH5TeXN0ZW0uVmFsdWVUdXBsZWAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0BAAAABUl0ZW0xAAgBAAAACw==", "" } };
+ yield return new object[] { ValueTuple.Create(1, "2"), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAOkBU3lzdGVtLlZhbHVlVHVwbGVgMltbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5TdHJpbmcsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0CAAAABUl0ZW0xBUl0ZW0yAAEIAQAAAAYCAAAAATIL", "" } };
+ yield return new object[] { ValueTuple.Create(1, "2", 3u), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAANQCU3lzdGVtLlZhbHVlVHVwbGVgM1tbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5TdHJpbmcsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLlVJbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQMAAAAFSXRlbTEFSXRlbTIFSXRlbTMAAQAIDwEAAAAGAgAAAAEyAwAAAAs=", "" } };
+ yield return new object[] { ValueTuple.Create(1, "2", 3u, 4L), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAL4DU3lzdGVtLlZhbHVlVHVwbGVgNFtbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5TdHJpbmcsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLlVJbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdLFtTeXN0ZW0uSW50NjQsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0EAAAABUl0ZW0xBUl0ZW0yBUl0ZW0zBUl0ZW00AAEAAAgPCQEAAAAGAgAAAAEyAwAAAAQAAAAAAAAACw==", "" } };
+ yield return new object[] { ValueTuple.Create(1, "2", 3u, 4L, 5.6), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAKkEU3lzdGVtLlZhbHVlVHVwbGVgNVtbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5TdHJpbmcsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLlVJbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdLFtTeXN0ZW0uSW50NjQsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLkRvdWJsZSwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQUAAAAFSXRlbTEFSXRlbTIFSXRlbTMFSXRlbTQFSXRlbTUAAQAAAAgPCQYBAAAABgIAAAABMgMAAAAEAAAAAAAAAGZmZmZmZhZACw==", "" } };
+ yield return new object[] { ValueTuple.Create(1, "2", 3u, 4L, 5.6, 7.8f), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAJQFU3lzdGVtLlZhbHVlVHVwbGVgNltbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5TdHJpbmcsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLlVJbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdLFtTeXN0ZW0uSW50NjQsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLkRvdWJsZSwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdLFtTeXN0ZW0uU2luZ2xlLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dBgAAAAVJdGVtMQVJdGVtMgVJdGVtMwVJdGVtNAVJdGVtNQVJdGVtNgABAAAAAAgPCQYLAQAAAAYCAAAAATIDAAAABAAAAAAAAABmZmZmZmYWQJqZ+UAL", "" } };
+ yield return new object[] { ValueTuple.Create(1, "2", 3u, 4L, 5.6, 7.8f, 9m), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAIAGU3lzdGVtLlZhbHVlVHVwbGVgN1tbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5TdHJpbmcsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLlVJbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdLFtTeXN0ZW0uSW50NjQsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLkRvdWJsZSwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdLFtTeXN0ZW0uU2luZ2xlLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5EZWNpbWFsLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV1dBwAAAAVJdGVtMQVJdGVtMgVJdGVtMwVJdGVtNAVJdGVtNQVJdGVtNgVJdGVtNwABAAAAAAAIDwkGCwUBAAAABgIAAAABMgMAAAAEAAAAAAAAAGZmZmZmZhZAmpn5QAE5Cw==", "" } };
+ yield return new object[] { ValueTuple.Create(1, "2", 3u, 4L, 5.6, 7.8f, 9m, Tuple.Create(10)), new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAMkIU3lzdGVtLlZhbHVlVHVwbGVgOFtbU3lzdGVtLkludDMyLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5TdHJpbmcsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLlVJbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdLFtTeXN0ZW0uSW50NjQsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXSxbU3lzdGVtLkRvdWJsZSwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdLFtTeXN0ZW0uU2luZ2xlLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5EZWNpbWFsLCBTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49N2NlYzg1ZDdiZWE3Nzk4ZV0sW1N5c3RlbS5WYWx1ZVR1cGxlYDFbW1N5c3RlbS5UdXBsZWAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0sIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0sIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0IAAAABUl0ZW0xBUl0ZW0yBUl0ZW0zBUl0ZW00BUl0ZW01BUl0ZW02BUl0ZW03BFJlc3QAAQAAAAAAAwgPCQYLBesBU3lzdGVtLlZhbHVlVHVwbGVgMVtbU3lzdGVtLlR1cGxlYDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXSwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQEAAAAGAgAAAAEyAwAAAAQAAAAAAAAAZmZmZmZmFkCamflAATkE/f///+sBU3lzdGVtLlZhbHVlVHVwbGVgMVtbU3lzdGVtLlR1cGxlYDFbW1N5c3RlbS5JbnQzMiwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXSwgU3lzdGVtLlByaXZhdGUuQ29yZUxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGVdXQEAAAAFSXRlbTEDeVN5c3RlbS5UdXBsZWAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0JBAAAAAQEAAAAeVN5c3RlbS5UdXBsZWAxW1tTeXN0ZW0uSW50MzIsIFN5c3RlbS5Qcml2YXRlLkNvcmVMaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03Y2VjODVkN2JlYTc3OThlXV0BAAAAB21fSXRlbTEACAoAAAAL", "" } };
+ }
+ }
+
+ public static IEnumerable<object[]> EqualityComparers()
+ {
+ // Internal specialized equality comparers
+ yield return new object[] { EqualityComparer<UInt32Enum>.Default, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAOEBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuT2JqZWN0RXF1YWxpdHlDb21wYXJlcmAxW1tTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuVUludDMyRW51bSwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dAAAAAAs=", "AAEAAAD/////AQAAAAAAAAAEAQAAANUBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuT2JqZWN0RXF1YWxpdHlDb21wYXJlcmAxW1tTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuVUludDMyRW51bSwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAAAAAAs=" } };
+ yield return new object[] { EqualityComparer<Int64Enum>.Default, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAOABU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuT2JqZWN0RXF1YWxpdHlDb21wYXJlcmAxW1tTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuSW50NjRFbnVtLCBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViXV0AAAAACw==", "AAEAAAD/////AQAAAAAAAAAEAQAAANQBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuT2JqZWN0RXF1YWxpdHlDb21wYXJlcmAxW1tTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuSW50NjRFbnVtLCBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249MS4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsXV0AAAAACw==" } };
+ yield return new object[] { EqualityComparer<UInt64Enum>.Default, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAOEBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuT2JqZWN0RXF1YWxpdHlDb21wYXJlcmAxW1tTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuVUludDY0RW51bSwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTQuMC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49OWQ3N2NjN2FkMzliNjhlYl1dAAAAAAs=", "AAEAAAD/////AQAAAAAAAAAEAQAAANUBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuT2JqZWN0RXF1YWxpdHlDb21wYXJlcmAxW1tTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuVUludDY0RW51bSwgU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAAAAAAs=" } };
+ yield return new object[] { EqualityComparer<SByteEnum>.Default, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAOABU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuT2JqZWN0RXF1YWxpdHlDb21wYXJlcmAxW1tTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU0J5dGVFbnVtLCBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViXV0AAAAACw==", "AAEAAAD/////AQAAAAAAAAAEAQAAANQBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuT2JqZWN0RXF1YWxpdHlDb21wYXJlcmAxW1tTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU0J5dGVFbnVtLCBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249MS4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsXV0AAAAACw==" } };
+ yield return new object[] { EqualityComparer<Int16Enum>.Default, new string[] { "AAEAAAD/////AQAAAAAAAAAEAQAAAOABU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuT2JqZWN0RXF1YWxpdHlDb21wYXJlcmAxW1tTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuSW50MTZFbnVtLCBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249NC4wLjMuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViXV0AAAAACw==", "AAEAAAD/////AQAAAAAAAAAEAQAAANQBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuT2JqZWN0RXF1YWxpdHlDb21wYXJlcmAxW1tTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuSW50MTZFbnVtLCBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249MS4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsXV0AAAAACw==" } };
+ }
+
+ public static IEnumerable<object> NonSerializableObjects()
+ {
+ yield return new NonSerializableStruct();
+ yield return new NonSerializableClass();
+ yield return new SerializableClassWithBadField();
+ yield return new object[] { 1, 2, 3, new NonSerializableClass() };
+ }
+ }
+}
diff --git a/src/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.cs b/src/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.cs
index 51f0d95d0b..c975753176 100644
--- a/src/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.cs
+++ b/src/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.cs
@@ -2,272 +2,266 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using System;
using System.Collections.Generic;
using System.Diagnostics;
-using System.Diagnostics.Tracing;
-using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Serialization.Formatters.Binary;
-using System.Security;
using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
+using System.Text.RegularExpressions;
using Xunit;
namespace System.Runtime.Serialization.Formatters.Tests
{
- public class BinaryFormatterTests : RemoteExecutorTestBase
+ public partial class BinaryFormatterTests : RemoteExecutorTestBase
{
- public static IEnumerable<object> SerializableObjects()
- {
- // Primitive types
- yield return byte.MinValue;
- yield return byte.MaxValue;
- yield return sbyte.MinValue;
- yield return sbyte.MaxValue;
- yield return short.MinValue;
- yield return short.MaxValue;
- yield return int.MinValue;
- yield return int.MaxValue;
- yield return uint.MinValue;
- yield return uint.MaxValue;
- yield return long.MinValue;
- yield return long.MaxValue;
- yield return ulong.MinValue;
- yield return ulong.MaxValue;
- yield return char.MinValue;
- yield return char.MaxValue;
- yield return float.MinValue;
- yield return float.MaxValue;
- yield return double.MinValue;
- yield return double.MaxValue;
- yield return decimal.MinValue;
- yield return decimal.MaxValue;
- yield return decimal.MinusOne;
- yield return true;
- yield return false;
- yield return "";
- yield return "c";
- yield return "\u4F60\u597D";
- yield return "some\0data\0with\0null\0chars";
- yield return "<>&\"\'";
- yield return " < ";
- yield return "minchar" + char.MinValue + "minchar";
-
- // Enum values
- yield return DayOfWeek.Monday;
- yield return DateTimeKind.Local;
-
- // Nullables
- yield return (int?)1;
- yield return (StructWithIntField?)new StructWithIntField() { X = 42 };
-
- // Other core serializable types
- yield return IntPtr.Zero;
- yield return UIntPtr.Zero;
- yield return DateTime.Now;
- yield return DateTimeOffset.Now;
- yield return DateTimeKind.Local;
- yield return TimeSpan.FromDays(7);
- yield return new Version(1, 2, 3, 4);
- yield return new Guid("0CACAA4D-C6BD-420A-B660-2F557337CA89");
- yield return new List<int>();
- yield return new List<int>() { 1, 2, 3, 4, 5 };
- yield return new Dictionary<int, string>() { { 1, "test" }, { 2, "another test" } };
- yield return Tuple.Create(1);
- yield return Tuple.Create(1, "2");
- yield return Tuple.Create(1, "2", 3u);
- yield return Tuple.Create(1, "2", 3u, 4L);
- yield return Tuple.Create(1, "2", 3u, 4L, 5.6);
- yield return Tuple.Create(1, "2", 3u, 4L, 5.6, 7.8f);
- yield return Tuple.Create(1, "2", 3u, 4L, 5.6, 7.8f, 9m);
- yield return Tuple.Create(1, "2", 3u, 4L, 5.6, 7.8f, 9m, Tuple.Create(10));
- yield return new KeyValuePair<int, byte>(42, 84);
-
- // Arrays of primitive types
- yield return Enumerable.Range(0, 256).Select(i => (byte)i).ToArray();
- yield return new int[] { };
- yield return new int[] { 1 };
- yield return new int[] { 1, 2, 3, 4, 5 };
- yield return new char[] { 'a', 'b', 'c', 'd', 'e' };
- yield return new string[] { };
- yield return new string[] { "hello", "world" };
- yield return new short[] { short.MaxValue };
- yield return new long[] { long.MaxValue };
- yield return new ushort[] { ushort.MaxValue };
- yield return new uint[] { uint.MaxValue };
- yield return new ulong[] { ulong.MaxValue };
- yield return new bool[] { true, false };
- yield return new double[] { 1.2 };
- yield return new float[] { 1.2f, 3.4f };
-
- // Arrays of other types
- yield return new object[] { };
- yield return new Guid[] { Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid() };
- yield return new DayOfWeek[] { DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday };
- yield return new Point[] { new Point(1, 2), new Point(3, 4) };
- yield return new ObjectWithArrays
- {
- IntArray = new int[0],
- StringArray = new string[] { "hello", "world" },
- ByteArray = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 },
- JaggedArray = new int[][] { new int[] { 1, 2, 3 }, new int[] { 4, 5, 6, 7 } },
- MultiDimensionalArray = new int[,] { { 1, 2 }, { 3, 4 }, { 5, 6 } },
- TreeArray = new Tree<int>[] { new Tree<int>(1, new Tree<int>(2, null, null), new Tree<int>(3, null, null)) }
- };
- yield return new object[] { new int[,] { { 1, 2, 3, 4, 5 }, { 6, 7, 8, 9, 10 }, { 11, 12, 13, 14, 15 } } };
- yield return new object[] { new int[,,] { { { 1, 2, 3, 4, 5 }, { 6, 7, 8, 9, 10 }, { 11, 12, 13, 14, 15 } } } };
- yield return new object[] { new int[,,,] { { { { 1 } } } } };
- yield return new ArraySegment<int>(new int[] { 1, 2, 3, 4, 5 }, 1, 2);
- yield return Enumerable.Range(0, 10000).Select(i => (object)i).ToArray();
- yield return new object[200]; // fewer than 256 nulls
- yield return new object[300]; // more than 256 nulls
-
- // Non-vector arrays
- yield return Array.CreateInstance(typeof(uint), new[] { 5 }, new[] { 1 });
- yield return Array.CreateInstance(typeof(int), new[] { 0, 0, 0 }, new[] { 0, 0, 0 });
- var arr = Array.CreateInstance(typeof(string), new[] { 1, 2 }, new[] { 3, 4 });
- arr.SetValue("hello", new[] { 3, 5 });
- yield return arr;
-
- // Internal specialized equality comparers
- yield return EqualityComparer<byte>.Default;
- yield return EqualityComparer<int>.Default;
- yield return EqualityComparer<string>.Default;
- yield return EqualityComparer<int?>.Default;
- yield return EqualityComparer<double?>.Default;
- yield return EqualityComparer<object>.Default;
- yield return EqualityComparer<Int32Enum>.Default;
-
- // Custom object
- var sealedObjectWithIntStringFields = new SealedObjectWithIntStringFields();
- yield return sealedObjectWithIntStringFields;
- yield return new SealedObjectWithIntStringFields() { Member1 = 42, Member2 = null, Member3 = "84" };
-
- // Custom object with fields pointing to the same object
- yield return new ObjectWithIntStringUShortUIntULongAndCustomObjectFields
- {
- Member1 = 10,
- Member2 = "hello",
- _member3 = "hello",
- Member4 = sealedObjectWithIntStringFields,
- Member4shared = sealedObjectWithIntStringFields,
- Member5 = new SealedObjectWithIntStringFields(),
- Member6 = "Hello World",
- str1 = "hello < world",
- str2 = "<",
- str3 = "< world",
- str4 = "hello < world",
- u16 = ushort.MaxValue,
- u32 = uint.MaxValue,
- u64 = ulong.MaxValue,
- };
+ public static IEnumerable<object[]> ValidateBasicObjectsRoundtrip_MemberData()
+ {
+ foreach (object[] obj in SerializableObjects())
+ {
+ foreach (FormatterAssemblyStyle assemblyFormat in new[] { FormatterAssemblyStyle.Full, FormatterAssemblyStyle.Simple })
+ {
+ foreach (TypeFilterLevel filterLevel in new[] { TypeFilterLevel.Full, TypeFilterLevel.Low })
+ {
+ foreach (FormatterTypeStyle typeFormat in new[] { FormatterTypeStyle.TypesAlways, FormatterTypeStyle.TypesWhenNeeded, FormatterTypeStyle.XsdString })
+ {
+ yield return new object[] { obj[0], assemblyFormat, filterLevel, typeFormat };
+ }
+ }
+ }
+ }
+ }
+
+ [Theory]
+ [MemberData(nameof(ValidateBasicObjectsRoundtrip_MemberData))]
+ [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)]
+ public void ValidateBasicObjectsRoundtrip(object obj, FormatterAssemblyStyle assemblyFormat, TypeFilterLevel filterLevel, FormatterTypeStyle typeFormat)
+ {
+ object clone = FormatterClone(obj, null, assemblyFormat, filterLevel, typeFormat);
+ if (!ReferenceEquals(obj, string.Empty)) // "" is interned and will roundtrip as the same object
+ {
+ Assert.NotSame(obj, clone);
+ }
+
+ CheckForAnyEquals(obj, clone);
+ }
+
+ // Used for generating BinaryFormatterTestData.cs
+ //[Fact]
+ public void Serialize()
+ {
+ IEnumerable<object[]> objs = SerializableObjects().Concat(EqualityComparers());
+ List<string> serializedHashes = new List<string>();
+ foreach (var obj in objs)
+ {
+ BinaryFormatter bf = new BinaryFormatter();
+ using (MemoryStream ms = new MemoryStream())
+ {
+ bf.Serialize(ms, obj[0]);
+ string serializedHash = Convert.ToBase64String(ms.ToArray());
+ serializedHashes.Add(serializedHash);
+ }
+ }
+
+ string path = @"D:\corefx\src\System.Runtime.Serialization.Formatters\tests\BinaryFormatterTestData.cs";
+ string[] lines = File.ReadAllLines(path);
+
+ List<string> newLines = new List<string>();
+ int numOfHashes = 0;
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (!line.Trim().StartsWith("yield") || numOfHashes >= serializedHashes.Count)
+ {
+ newLines.Add(line);
+ continue;
+ }
- // Simple type without a default ctor
- var point = new Point(1, 2);
- yield return point;
-
- // Graph without cycles
- yield return new Tree<int>(42, null, null);
- yield return new Tree<int>(1, new Tree<int>(2, new Tree<int>(3, null, null), null), null);
- yield return new Tree<Colors>(Colors.Red, null, new Tree<Colors>(Colors.Blue, null, new Tree<Colors>(Colors.Green, null, null)));
- yield return new Tree<int>(1, new Tree<int>(2, new Tree<int>(3, null, null), new Tree<int>(4, null, null)), new Tree<int>(5, null, null));
-
- // Graph with cycles
- Graph<int> a = new Graph<int> { Value = 1 };
- yield return a;
- Graph<int> b = new Graph<int> { Value = 2, Links = new[] { a } };
- yield return b;
- Graph<int> c = new Graph<int> { Value = 3, Links = new[] { a, b } };
- yield return c;
- Graph<int> d = new Graph<int> { Value = 3, Links = new[] { a, b, c } };
- yield return d;
- a.Links = new[] { b, c, d }; // complete the cycle
- yield return a;
-
- // Structs
- yield return new EmptyStruct();
- yield return new StructWithIntField { X = 42 };
- yield return new StructWithStringFields { String1 = "hello", String2 = "world" };
- yield return new StructContainingOtherStructs { Nested1 = new StructWithStringFields { String1 = "a", String2 = "b" }, Nested2 = new StructWithStringFields { String1 = "3", String2 = "4" } };
- yield return new StructContainingArraysOfOtherStructs();
- yield return new StructContainingArraysOfOtherStructs { Nested = new StructContainingOtherStructs[0] };
- var s = new StructContainingArraysOfOtherStructs
- {
- Nested = new[]
+ if (PlatformDetection.IsFullFramework)
{
- new StructContainingOtherStructs { Nested1 = new StructWithStringFields { String1 = "a", String2 = "b" }, Nested2 = new StructWithStringFields { String1 = "3", String2 = "4" } },
- new StructContainingOtherStructs { Nested1 = new StructWithStringFields { String1 = "e", String2 = "f" }, Nested2 = new StructWithStringFields { String1 = "7", String2 = "8" } },
+ line = Regex.Replace(line, ", \"AAEAAAD.+\"(?!,)", ", \"" + serializedHashes[numOfHashes] + "\""); // netfx
+ }
+ else
+ {
+ line = Regex.Replace(line, "\"AAEAAAD.+\",", "\"" + serializedHashes[numOfHashes] + "\","); // netcoreapp
}
- };
- yield return s;
- yield return new object[] { s, new StructContainingArraysOfOtherStructs?(s) };
- // ISerializable
- yield return new BasicISerializableObject(1, "2");
- yield return new DerivedISerializableWithNonPublicDeserializationCtor(1, "2");
+ newLines.Add(line);
+ numOfHashes++;
+ }
- // Various other special cases
- yield return new TypeWithoutNamespace();
+ Assert.Equal(numOfHashes, serializedHashes.Count);
+
+ File.WriteAllLines(path, newLines);
}
- public static IEnumerable<object> NonSerializableObjects()
+
+ private static string SerializeObjectToHash(object original)
{
- yield return new NonSerializableStruct();
- yield return new NonSerializableClass();
- yield return new SerializableClassWithBadField();
- yield return new object[] { 1, 2, 3, new NonSerializableClass() };
+ BinaryFormatter bf = new BinaryFormatter();
+ using (MemoryStream ms = new MemoryStream())
+ {
+ bf.Serialize(ms, original);
+ return Convert.ToBase64String(ms.ToArray());
+ }
}
- public static IEnumerable<object[]> ValidateBasicObjectsRoundtrip_MemberData()
+ private static object DeserializeObjectHash(string base64Str)
{
- foreach (object obj in SerializableObjects())
+ var binaryFormatter = new BinaryFormatter();
+ byte[] serializedObj = Convert.FromBase64String(base64Str);
+ using (var serializedStream = new MemoryStream(serializedObj))
{
- foreach (FormatterAssemblyStyle assemblyFormat in new[] { FormatterAssemblyStyle.Full, FormatterAssemblyStyle.Simple })
+ return binaryFormatter.Deserialize(serializedStream);
+ }
+ }
+
+ [Theory]
+ [MemberData(nameof(SerializableObjects))]
+ [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)]
+ public void ValidateTfmHashes(object original, string[] tfmBase64Hashes)
+ {
+ if (tfmBase64Hashes == null || tfmBase64Hashes.Length < 2)
+ {
+ throw new InvalidOperationException($"Type {original} has no base64 hashes to deserialize and test equality against. " +
+ $"Hash for object is: " + SerializeObjectToHash(original));
+ }
+
+ // Take(1) - serialized netfx objects are not supported
+ foreach (string tfmBase64Hash in tfmBase64Hashes.Take(1))
+ {
+ // Currently for valuetuples
+ if (!string.IsNullOrWhiteSpace(tfmBase64Hash))
{
- foreach (TypeFilterLevel filterLevel in new[] { TypeFilterLevel.Full, TypeFilterLevel.Low })
+ CheckForAnyEquals(original, DeserializeObjectHash(tfmBase64Hash));
+ }
+ }
+ }
+
+ [Fact]
+ public void ValidateDeserializationOfObjectWithDifferentAssemblyVersion()
+ {
+ // To generate this properly, change AssemblyVersion to a value which is unlikely to happen in production and generate base64(serialized-data)
+ // For this test 9.98.7.987 is being used
+ var obj = new SomeType() { SomeField = 7 };
+ string serializedObj = @"AAEAAAD/////AQAAAAAAAAAMAgAAAHNTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249OS45OC43Ljk4NywgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAAA2U3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlNvbWVUeXBlAQAAAAlTb21lRmllbGQACAIAAAAHAAAACw==";
+
+ var deserialized = (SomeType)DeserializeObjectHash(serializedObj);
+ Assert.Equal(obj, deserialized);
+ }
+
+ [Fact]
+ public void ValidateDeserializationOfObjectWithGenericTypeWhichGenericArgumentHasDifferentAssemblyVersion()
+ {
+ // To generate this properly, change AssemblyVersion to a value which is unlikely to happen in production and generate base64(serialized-data)
+ // For this test 9.98.7.987 is being used
+ var obj = new GenericTypeWithArg<SomeType>() { Test = new SomeType() { SomeField = 9 } };
+ string serializedObj = @"AAEAAAD/////AQAAAAAAAAAMAgAAAHNTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249OS45OC43Ljk4NywgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAADxAVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5HZW5lcmljVHlwZVdpdGhBcmdgMVtbU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlNvbWVUeXBlLCBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249OS45OC43Ljk4NywgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViXV0BAAAABFRlc3QENlN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Tb21lVHlwZQIAAAACAAAACQMAAAAFAwAAADZTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU29tZVR5cGUBAAAACVNvbWVGaWVsZAAIAgAAAAkAAAAL";
+
+ var deserialized = (GenericTypeWithArg<SomeType>)DeserializeObjectHash(serializedObj);
+ Assert.Equal(obj, deserialized);
+ }
+
+ [Theory]
+ [MemberData(nameof(EqualityComparers))]
+ public void ValidateDeserializationOfEqualityComparers(object original, string[] base64SerializedObj)
+ {
+ if (base64SerializedObj == null || base64SerializedObj.Length < 2)
+ {
+ throw new InvalidOperationException($"Type {original} has no base64 hashes to deserialize and test equality against. " +
+ $"Hash for object is: " + SerializeObjectToHash(original));
+ }
+
+ foreach (string base64Serialized in base64SerializedObj)
+ {
+ var obj = DeserializeObjectHash(base64Serialized);
+ var objType = obj.GetType();
+ Assert.True(objType.IsGenericType, $"Type `{objType.FullName}` must be generic.");
+ Assert.Equal("System.Collections.Generic.ObjectEqualityComparer`1", objType.GetGenericTypeDefinition().FullName);
+ Assert.Equal(original.GetType().GetGenericArguments()[0], objType.GetGenericArguments()[0]);
+ }
+ }
+
+ private void CheckForAnyEquals(object original, object clone)
+ {
+ if (original != null && clone != null)
+ {
+ object result = null;
+ Type originalType = original.GetType();
+
+ // Check if custom equality extension method is available
+ MethodInfo customEqualityCheck = GetExtensionMethod(typeof(EqualityExtensions).Assembly, originalType);
+ if (customEqualityCheck != null)
+ {
+ result = customEqualityCheck.Invoke(original, new object[] { original, clone });
+ }
+ else
+ {
+ // Check if object.Equals(object) is overridden and if not check if there is a more concrete equality check implementation
+ bool equalsNotOverridden = originalType.GetMethod("Equals", new Type[] { typeof(object) }).DeclaringType == typeof(object);
+ if (equalsNotOverridden)
{
- foreach (FormatterTypeStyle typeFormat in new[] { FormatterTypeStyle.TypesAlways, FormatterTypeStyle.TypesWhenNeeded, FormatterTypeStyle.XsdString })
- {
- yield return new object[] { obj, assemblyFormat, filterLevel, typeFormat};
+ // If type doesn't override Equals(object) method then check if there is a more concrete implementation
+ // e.g. if type implements IEquatable<T>.
+ MethodInfo equalsMethod = originalType.GetMethod("Equals", new Type[] { originalType });
+ if (equalsMethod.DeclaringType != typeof(object))
+ {
+ result = equalsMethod.Invoke(original, new object[] { clone });
}
}
}
+
+ if (result != null)
+ {
+ Assert.True((bool)result, "Error during equality check of type " + originalType.FullName);
+ return;
+ }
+ }
+
+ try
+ {
+ Assert.Equal(original, clone);
+ }
+ catch (Exception)
+ {
+ Console.WriteLine("Error during equality check of type " + original?.GetType()?.FullName);
+ throw;
}
}
- [Theory]
- [MemberData(nameof(ValidateBasicObjectsRoundtrip_MemberData))]
- public void ValidateBasicObjectsRoundtrip(object obj, FormatterAssemblyStyle assemblyFormat, TypeFilterLevel filterLevel, FormatterTypeStyle typeFormat)
+ private static MethodInfo GetExtensionMethod(Assembly assembly, Type extendedType)
{
- object result = FormatterClone(obj, null, assemblyFormat, filterLevel, typeFormat);
- if (!ReferenceEquals(obj, string.Empty)) // "" is interned and will roundtrip as the same object
+ if (extendedType.IsGenericType)
+ {
+ return typeof(EqualityExtensions).GetMethods()
+ ?.SingleOrDefault(m => m.Name == "IsEqual" && m.GetParameters().Length == 2 && m.GetParameters()[0].ParameterType.Name == extendedType.Name)
+ ?.MakeGenericMethod(extendedType.GenericTypeArguments[0]);
+ }
+ else
{
- Assert.NotSame(obj, result);
+ return typeof(EqualityExtensions).GetMethod("IsEqual", new[] { extendedType, extendedType });
}
- Assert.Equal(obj, result);
}
[Fact]
+ [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)]
public void RoundtripManyObjectsInOneStream()
{
- object[] objects = SerializableObjects().ToArray();
+ object[][] objects = SerializableObjects().ToArray();
var s = new MemoryStream();
var f = new BinaryFormatter();
- foreach (object obj in objects)
+ foreach (object[] obj in objects)
{
- f.Serialize(s, obj);
+ f.Serialize(s, obj[0]);
}
s.Position = 0;
- foreach (object obj in objects)
+ foreach (object[] obj in objects)
{
- object result = f.Deserialize(s);
- Assert.Equal(obj, result);
+ object clone = f.Deserialize(s);
+ CheckForAnyEquals(obj[0], clone);
}
}
@@ -287,10 +281,11 @@ namespace System.Runtime.Serialization.Formatters.Tests
}
}
- public static IEnumerable<object[]> SerializableExceptions()
+ public static IEnumerable<object> SerializableExceptions()
{
- yield return new object[] { new AggregateException(new Exception(), new Exception("message")) };
- yield return new object[] { new Exception("message") };
+ var exception = new Exception("Exception message", new Exception("Inner exception message"));
+ yield return new object[] { new AggregateException("Aggregate exception message", exception) };
+ yield return new object[] { exception };
}
[Theory]
@@ -300,8 +295,6 @@ namespace System.Runtime.Serialization.Formatters.Tests
BinaryFormatterHelpers.AssertRoundtrips(expected);
}
- private static int Identity(int i) => i;
-
public static IEnumerable<object[]> ValidateNonSerializableTypes_MemberData()
{
foreach (object obj in NonSerializableObjects())
@@ -576,6 +569,8 @@ namespace System.Runtime.Serialization.Formatters.Tests
catch (NullReferenceException) { }
catch (SerializationException) { }
catch (TargetInvocationException) { }
+ catch (ArgumentException) { }
+ catch (FileLoadException) { }
}
[Fact]
@@ -650,7 +645,7 @@ namespace System.Runtime.Serialization.Formatters.Tests
}
private static T FormatterClone<T>(
- T obj,
+ T obj,
ISerializationSurrogate surrogate = null,
FormatterAssemblyStyle assemblyFormat = FormatterAssemblyStyle.Full,
TypeFilterLevel filterLevel = TypeFilterLevel.Full,
diff --git a/src/System.Runtime.Serialization.Formatters/tests/EqualityExtensions.cs b/src/System.Runtime.Serialization.Formatters/tests/EqualityExtensions.cs
new file mode 100644
index 0000000000..8c1a1d1619
--- /dev/null
+++ b/src/System.Runtime.Serialization.Formatters/tests/EqualityExtensions.cs
@@ -0,0 +1,124 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Collections;
+using System.Collections.Specialized;
+using System.Data;
+using System.Globalization;
+using System.Linq;
+using System.Net;
+
+namespace System.Runtime.Serialization.Formatters.Tests
+{
+ public static class EqualityExtensions
+ {
+ public static bool IsEqual(this WeakReference @this, WeakReference other)
+ {
+ if (@this == null || other == null)
+ return false;
+
+ if (@this.TrackResurrection != other.TrackResurrection)
+ return false;
+
+ // When WeakReference is deserialized, the object it wraps may blip into and out of
+ // existence before we get a chance to compare it, since there are no strong references
+ // to it such that it can then be immediately collected. Therefore, if we can get both
+ // values, great, compare them. Otherwise, consider them equal.
+ object a = @this.Target;
+ object b = other.Target;
+ return a != null && b != null ? Equals(a, b) : true;
+ }
+
+ public static bool IsEqual<T>(this WeakReference<T> @this, WeakReference<T> other)
+ where T : class
+ {
+ if (@this == null || other == null)
+ return false;
+
+ // When WeakReference is deserialized, the object it wraps may blip into and out of
+ // existence before we get a chance to compare it, since there are no strong references
+ // to it such that it can then be immediately collected. Therefore, if we can get both
+ // values, great, compare them. Otherwise, consider them equal.
+ return @this.TryGetTarget(out T thisTarget) && other.TryGetTarget(out T otherTarget) ?
+ Equals(thisTarget, otherTarget) :
+ true;
+ }
+
+ public static bool IsEqual<T>(this Lazy<T> @this, Lazy<T> other)
+ {
+ // Force value creation for lazy original object
+ T thisVal = @this.Value;
+ T otherVal = other.Value;
+
+ return @this != null &&
+ other != null &&
+ @this.IsValueCreated == other.IsValueCreated &&
+ Object.Equals(thisVal, otherVal);
+ }
+
+ public static bool IsEqual(this StreamingContext @this, StreamingContext other)
+ {
+ return @this.State == @other.State &&
+ Object.Equals(@this.Context, other.Context);
+ }
+
+ public static bool IsEqual(this CookieContainer @this, CookieContainer other)
+ {
+ return @this != null &&
+ other != null &&
+ @this.Capacity == other.Capacity &&
+ @this.Count == other.Count &&
+ @this.MaxCookieSize == other.MaxCookieSize &&
+ @this.PerDomainCapacity == other.PerDomainCapacity;
+ }
+
+ public static bool IsEqual(this DataSet @this, DataSet other)
+ {
+ return @this != null &&
+ @other != null &&
+ @this.DataSetName == other.DataSetName &&
+ @this.Namespace == other.Namespace &&
+ @this.Prefix == other.Prefix &&
+ @this.CaseSensitive == other.CaseSensitive &&
+ @this.Locale.LCID == other.Locale.LCID &&
+ @this.EnforceConstraints == other.EnforceConstraints &&
+ @this.ExtendedProperties?.Count == other.ExtendedProperties?.Count;
+ }
+
+ public static bool IsEqual(this DataTable @this, DataTable other)
+ {
+ return @this != null &&
+ other != null &&
+ @this.TableName == other.TableName &&
+ @this.Namespace == other.Namespace &&
+ @this.Prefix == other.Prefix &&
+ @this.CaseSensitive == other.CaseSensitive &&
+ @this.Locale.LCID == other.Locale.LCID &&
+ @this.MinimumCapacity == other.MinimumCapacity;
+ }
+
+ public static bool IsEqual(this Comparer @this, Comparer other)
+ {
+ CompareInfo GetCompareInfoName(Comparer comparer) =>
+ comparer.GetType().GetField("_compareInfo", Reflection.BindingFlags.Instance | Reflection.BindingFlags.NonPublic).GetValue(comparer) as CompareInfo;
+
+ return @this != null &&
+ other != null &&
+ Object.Equals(GetCompareInfoName(@this), GetCompareInfoName(other));
+ }
+
+
+ public static bool IsEqual(this DictionaryEntry @this, DictionaryEntry other)
+ {
+ return Object.Equals(@this.Key, other.Key) && Object.Equals(@this.Value, other.Value);
+ }
+
+ public static bool IsEqual(this StringDictionary @this, StringDictionary other)
+ {
+ return @this != null &&
+ other != null &&
+ @this.Count == other.Count;
+ }
+ }
+}
diff --git a/src/System.Runtime.Serialization.Formatters/tests/SerializationTypes.cs b/src/System.Runtime.Serialization.Formatters/tests/SerializationTypes.cs
index ca3911ced1..9218f7161a 100644
--- a/src/System.Runtime.Serialization.Formatters/tests/SerializationTypes.cs
+++ b/src/System.Runtime.Serialization.Formatters/tests/SerializationTypes.cs
@@ -5,6 +5,7 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
+using System.Runtime.Serialization;
[Serializable]
public struct TypeWithoutNamespace { }
@@ -21,7 +22,8 @@ namespace System.Runtime.Serialization.Formatters.Tests
public override bool Equals(object obj)
{
var o = obj as SealedObjectWithIntStringFields;
- if (o == null) return false;
+ if (o == null)
+ return false;
return
EqualityComparer<int>.Default.Equals(Member1, o.Member1) &&
EqualityComparer<string>.Default.Equals(Member2, o.Member2) &&
@@ -52,7 +54,8 @@ namespace System.Runtime.Serialization.Formatters.Tests
public override bool Equals(object obj)
{
var o = obj as ObjectWithIntStringUShortUIntULongAndCustomObjectFields;
- if (o == null) return false;
+ if (o == null)
+ return false;
return
EqualityComparer<int>.Default.Equals(Member1, o.Member1) &&
@@ -78,7 +81,7 @@ namespace System.Runtime.Serialization.Formatters.Tests
}
[Serializable]
- public class Point
+ public class Point : IComparable<Point>, IEquatable<Point>
{
public int X;
public int Y;
@@ -89,12 +92,25 @@ namespace System.Runtime.Serialization.Formatters.Tests
Y = y;
}
- public override bool Equals(object obj)
+ public int CompareTo(object obj)
+ {
+ return CompareTo(obj as Point);
+ }
+
+ public int CompareTo(Point other)
{
- var o = obj as Point;
- if (o == null) return false;
- return X == o.X && Y == o.Y;
+ return other == null ? 1 : 0;
}
+
+ public override bool Equals(object obj) => Equals(obj as Point);
+
+ public bool Equals(Point other)
+ {
+ return other != null &&
+ X == other.X &&
+ Y == other.Y;
+ }
+
public override int GetHashCode() => 1;
}
@@ -115,7 +131,8 @@ namespace System.Runtime.Serialization.Formatters.Tests
public override bool Equals(object obj)
{
Tree<T> o = obj as Tree<T>;
- if (o == null) return false;
+ if (o == null)
+ return false;
return
EqualityComparer<T>.Default.Equals(Value, o.Value) &&
@@ -138,7 +155,8 @@ namespace System.Runtime.Serialization.Formatters.Tests
public override bool Equals(object obj)
{
Graph<T> o = obj as Graph<T>;
- if (o == null) return false;
+ if (o == null)
+ return false;
var toExplore = new Stack<KeyValuePair<Graph<T>, Graph<T>>>();
toExplore.Push(new KeyValuePair<Graph<T>, Graph<T>>(this, o));
@@ -158,7 +176,8 @@ namespace System.Runtime.Serialization.Formatters.Tests
if (Links == null || o.Links == null)
{
- if (Links != o.Links) return false;
+ if (Links != o.Links)
+ return false;
continue;
}
@@ -192,7 +211,8 @@ namespace System.Runtime.Serialization.Formatters.Tests
public override bool Equals(object obj)
{
ObjectWithArrays o = obj as ObjectWithArrays;
- if (o == null) return false;
+ if (o == null)
+ return false;
return
EqualityHelpers.ArraysAreEqual(IntArray, o.IntArray) &&
@@ -272,7 +292,8 @@ namespace System.Runtime.Serialization.Formatters.Tests
public override bool Equals(object obj)
{
- if (!(obj is StructContainingArraysOfOtherStructs)) return false;
+ if (!(obj is StructContainingArraysOfOtherStructs))
+ return false;
return EqualityHelpers.ArraysAreEqual(Nested, ((StructContainingArraysOfOtherStructs)obj).Nested);
}
@@ -303,8 +324,10 @@ namespace System.Runtime.Serialization.Formatters.Tests
public override bool Equals(object obj)
{
var o = obj as BasicISerializableObject;
- if (o == null) return false;
- if (_data == null || o._data == null) return _data == o._data;
+ if (o == null)
+ return false;
+ if (_data == null || o._data == null)
+ return _data == o._data;
return _data.Value1 == o._data.Value1 && _data.Value2 == o._data.Value2;
}
@@ -381,7 +404,7 @@ namespace System.Runtime.Serialization.Formatters.Tests
{
public void GetObjectData(object obj, SerializationInfo info, StreamingContext context)
{
- var pair = (NonSerializablePair<int,string>)obj;
+ var pair = (NonSerializablePair<int, string>)obj;
info.AddValue("Value1", pair.Value1);
info.AddValue("Value2", pair.Value2);
}
@@ -426,12 +449,71 @@ namespace System.Runtime.Serialization.Formatters.Tests
public int GetHashCode(object obj) => RuntimeHelpers.GetHashCode(obj);
}
+ [Serializable]
+ internal sealed class PointEqualityComparer : IEqualityComparer<Point>
+ {
+ public bool Equals(Point x, Point y) => (x.X == y.X) && (x.Y == y.Y);
+
+ public int GetHashCode(Point obj) => RuntimeHelpers.GetHashCode(obj);
+ }
+
+ [Serializable]
+ internal class SimpleKeyedCollection : System.Collections.ObjectModel.KeyedCollection<int, Point>
+ {
+ protected override int GetKeyForItem(Point item)
+ {
+ return item.Y;
+ }
+ }
+
+ [Serializable]
+ internal class GenericTypeWithArg<T>
+ {
+ public T Test;
+
+ public override bool Equals(object obj)
+ {
+ if (obj == null || GetType() != obj.GetType())
+ return false;
+
+ var p = (GenericTypeWithArg<T>)obj;
+ return Test.Equals(p.Test);
+ }
+
+ public override int GetHashCode()
+ {
+ return Test == null ? 0 : Test.GetHashCode();
+ }
+ }
+
+ [Serializable]
+ internal class SomeType
+ {
+ public int SomeField;
+
+ public override bool Equals(object obj)
+ {
+ if (obj == null || GetType() != obj.GetType())
+ return false;
+
+ var p = (SomeType)obj;
+ return SomeField.Equals(p.SomeField);
+ }
+
+ public override int GetHashCode()
+ {
+ return SomeField;
+ }
+ }
+
internal static class EqualityHelpers
{
public static bool ArraysAreEqual<T>(T[] array1, T[] array2)
{
- if (array1 == null || array2 == null) return array1 == array2;
- if (array1.Length != array2.Length) return false;
+ if (array1 == null || array2 == null)
+ return array1 == array2;
+ if (array1.Length != array2.Length)
+ return false;
for (int i = 0; i < array1.Length; i++)
{
if (!EqualityComparer<T>.Default.Equals(array1[i], array2[i]))
@@ -444,13 +526,17 @@ namespace System.Runtime.Serialization.Formatters.Tests
public static bool ArraysAreEqual(Array array1, Array array2)
{
- if (array1 == null || array2 == null) return array1 == array2;
- if (array1.Length != array2.Length) return false;
- if (array1.Rank != array2.Rank) return false;
+ if (array1 == null || array2 == null)
+ return array1 == array2;
+ if (array1.Length != array2.Length)
+ return false;
+ if (array1.Rank != array2.Rank)
+ return false;
for (int i = 0; i < array1.Rank; i++)
{
- if (array1.GetLength(i) != array2.GetLength(i)) return false;
+ if (array1.GetLength(i) != array2.GetLength(i))
+ return false;
}
var e1 = array1.GetEnumerator();
@@ -468,13 +554,17 @@ namespace System.Runtime.Serialization.Formatters.Tests
public static bool ArraysAreEqual<T>(T[][] array1, T[][] array2)
{
- if (array1 == null || array2 == null) return array1 == array2;
- if (array1.Length != array2.Length) return false;
+ if (array1 == null || array2 == null)
+ return array1 == array2;
+ if (array1.Length != array2.Length)
+ return false;
for (int i = 0; i < array1.Length; i++)
{
T[] sub1 = array1[i], sub2 = array2[i];
- if (sub1 == null || sub2 == null && (sub1 != sub2)) return false;
- if (sub1.Length != sub2.Length) return false;
+ if (sub1 == null || (sub2 == null && (sub1 != sub2)))
+ return false;
+ if (sub1.Length != sub2.Length)
+ return false;
for (int j = 0; j < sub1.Length; j++)
{
if (!EqualityComparer<T>.Default.Equals(sub1[j], sub2[j]))
diff --git a/src/System.Runtime.Serialization.Formatters/tests/System.Runtime.Serialization.Formatters.Tests.csproj b/src/System.Runtime.Serialization.Formatters/tests/System.Runtime.Serialization.Formatters.Tests.csproj
index 1294161b4e..61713a5bcd 100644
--- a/src/System.Runtime.Serialization.Formatters/tests/System.Runtime.Serialization.Formatters.Tests.csproj
+++ b/src/System.Runtime.Serialization.Formatters/tests/System.Runtime.Serialization.Formatters.Tests.csproj
@@ -10,7 +10,9 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
<ItemGroup>
+ <Compile Include="BinaryFormatterTestData.cs" />
<Compile Include="BinaryFormatterTests.cs" />
+ <Compile Include="EqualityExtensions.cs" />
<Compile Include="OptionalFieldAttributeTests.cs" />
<Compile Include="FormatterConverterTests.cs" />
<Compile Include="FormatterServicesTests.cs" />
diff --git a/src/System.Runtime.Serialization.Json/tests/DataContractJsonSerializer.cs b/src/System.Runtime.Serialization.Json/tests/DataContractJsonSerializer.cs
index 92945c738e..d288879556 100644
--- a/src/System.Runtime.Serialization.Json/tests/DataContractJsonSerializer.cs
+++ b/src/System.Runtime.Serialization.Json/tests/DataContractJsonSerializer.cs
@@ -5,6 +5,7 @@
using SerializationTypes;
using System;
using System.Collections;
+using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
@@ -443,6 +444,7 @@ public static partial class DataContractJsonSerializerTests
}
[Fact]
+ [ActiveIssue("dotnet/corefx #20478", TargetFrameworkMonikers.UapAot)]
public static void DCJS_GetOonlyDictionary_UseSimpleDictionaryFormat()
{
var x = new TypeWithDictionaryGenericMembers();
@@ -1502,6 +1504,7 @@ public static partial class DataContractJsonSerializerTests
}
[Fact]
+ [ActiveIssue("dotnet/corefx #20478", TargetFrameworkMonikers.UapAot)]
public static void DCJS_GenericQueue()
{
Queue<int> value = new Queue<int>();
@@ -1515,6 +1518,7 @@ public static partial class DataContractJsonSerializerTests
}
[Fact]
+ [ActiveIssue("dotnet/corefx #20478", TargetFrameworkMonikers.UapAot)]
public static void DCJS_GenericStack()
{
var value = new Stack<int>();
@@ -1530,6 +1534,7 @@ public static partial class DataContractJsonSerializerTests
}
[Fact]
+ [ActiveIssue("dotnet/corefx #20478", TargetFrameworkMonikers.UapAot)]
public static void DCJS_Queue()
{
var value = new Queue();
@@ -1544,6 +1549,7 @@ public static partial class DataContractJsonSerializerTests
}
[Fact]
+ [ActiveIssue("dotnet/corefx #20478", TargetFrameworkMonikers.UapAot)]
public static void DCJS_Stack()
{
var value = new Stack();
@@ -1559,6 +1565,7 @@ public static partial class DataContractJsonSerializerTests
}
[Fact]
+ [ActiveIssue("dotnet/corefx #20478", TargetFrameworkMonikers.UapAot)]
public static void DCJS_SortedList()
{
var value = new SortedList();
@@ -1571,6 +1578,7 @@ public static partial class DataContractJsonSerializerTests
}
[Fact]
+ [ActiveIssue("dotnet/corefx #20478", TargetFrameworkMonikers.UapAot)]
public static void DCJS_SystemVersion()
{
Version value = new Version(1, 2, 3, 4);
@@ -1681,6 +1689,7 @@ public static partial class DataContractJsonSerializerTests
}
[Fact]
+ [ActiveIssue("dotnet/corefx #20478", TargetFrameworkMonikers.UapAot)]
public static void DCJS_ReadOnlyCollection()
{
List<string> list = new List<string>() { "Foo", "Bar" };
@@ -1692,14 +1701,14 @@ public static partial class DataContractJsonSerializerTests
}
[Fact]
- [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "dotnet/corefx #18312")]
+ [ActiveIssue("dotnet/corefx #20478", TargetFrameworkMonikers.UapAot)]
public static void DCJS_ReadOnlyDictionary()
{
var dict = new Dictionary<string, int>();
dict["Foo"] = 1;
dict["Bar"] = 2;
ReadOnlyDictionary<string, int> value = new ReadOnlyDictionary<string, int>(dict);
- var deserializedValue = SerializeAndDeserialize(value, @"{""_dictionary"":[{""Key"":""Foo"",""Value"":1},{""Key"":""Bar"",""Value"":2}]}");
+ var deserializedValue = SerializeAndDeserialize(value, @"{""m_dictionary"":[{""Key"":""Foo"",""Value"":1},{""Key"":""Bar"",""Value"":2}]}");
Assert.StrictEqual(value.Count, deserializedValue.Count);
Assert.StrictEqual(value["Foo"], deserializedValue["Foo"]);
@@ -2695,6 +2704,8 @@ public static partial class DataContractJsonSerializerTests
#if ReflectionOnly
[ActiveIssue(18373)]
+#else
+ [ActiveIssue("dotnet/corefx #20481", TargetFrameworkMonikers.UapAot)]
#endif
[Fact]
public static void DCJS_VerifyDictionaryFormat()
@@ -2753,6 +2764,7 @@ public static partial class DataContractJsonSerializerTests
}
[Fact]
+ [ActiveIssue("dotnet/corefx #20483", TargetFrameworkMonikers.UapAot)]
public static void DCJS_VerifyIndentation()
{
var testClass = new TestClass()
@@ -2834,6 +2846,35 @@ public static partial class DataContractJsonSerializerTests
Assert.Equal(value.StrDerived, actual.StrDerived);
}
+ [Fact]
+ public static void DCJS_ConcurrentDictionary()
+ {
+ var value = new ConcurrentDictionary<string, int>();
+ value["one"] = 1;
+ value["two"] = 2;
+ var deserializedValue = SerializeAndDeserialize<ConcurrentDictionary<string, int>>(value, @"[{""Key"":""one"",""Value"":1},{""Key"":""two"",""Value"":2}]",
+ null, null, true);
+
+ Assert.NotNull(deserializedValue);
+ Assert.True(deserializedValue.Count == 2);
+ Assert.True(deserializedValue["one"] == 1);
+ Assert.True(deserializedValue["two"] == 2);
+ }
+
+ [Fact]
+ [ActiveIssue("dotnet/corefx #20478", TargetFrameworkMonikers.UapAot)]
+ public static void DCJS_ReadOnlyDictionaryCausingDuplicateInvalidDataContract()
+ {
+ var dict = new Dictionary<string, int>();
+ dict["Foo"] = 1;
+ dict["Bar"] = 2;
+ var value = new ReadOnlyDictionary<string, int>(dict);
+ var deserializedValue = SerializeAndDeserialize(value, "{\"m_dictionary\":[{\"Key\":\"Foo\",\"Value\":1},{\"Key\":\"Bar\",\"Value\":2}]}", null, () => new DataContractJsonSerializer(typeof(ReadOnlyDictionary<string, int>)));
+ Assert.StrictEqual(value.Count, deserializedValue.Count);
+ Assert.StrictEqual(value["Foo"], deserializedValue["Foo"]);
+ Assert.StrictEqual(value["Bar"], deserializedValue["Bar"]);
+ }
+
private static T SerializeAndDeserialize<T>(T value, string baseline, DataContractJsonSerializerSettings settings = null, Func<DataContractJsonSerializer> serializerFactory = null, bool skipStringCompare = false)
{
DataContractJsonSerializer dcjs;
diff --git a/src/System.Runtime.Serialization.Json/tests/System.Runtime.Serialization.Json.Tests.settings.targets b/src/System.Runtime.Serialization.Json/tests/System.Runtime.Serialization.Json.Tests.settings.targets
deleted file mode 100644
index e16ed06fe2..0000000000
--- a/src/System.Runtime.Serialization.Json/tests/System.Runtime.Serialization.Json.Tests.settings.targets
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <NugetTargetMoniker>.NETStandard,Version=v1.7</NugetTargetMoniker>
- <TestSourceFolder>$(MSBuildThisFileDirectory)\</TestSourceFolder>
- </PropertyGroup>
- <ItemGroup>
- <ProjectReference Include="$(TestSourceFolder)..\..\System.Private.DataContractSerialization\pkg\System.Private.DataContractSerialization.pkgproj">
- <Project>{6B4C1660-D158-4820-BE1C-D7A29CEBEC9B}</Project>
- <Name>System.Private.DataContractSerialization</Name>
- <KeepProjectReference>true</KeepProjectReference>
- </ProjectReference>
- <ProjectReference Include="$(TestSourceFolder)..\..\System.Runtime.Serialization.Primitives\pkg\System.Runtime.Serialization.Primitives.pkgproj">
- <Project>{CDF0ACB5-1361-4E48-8ECB-22E8022F5F01}</Project>
- <Name>System.Runtime.Serialization.Primitives</Name>
- </ProjectReference>
- <ProjectReference Include="$(TestSourceFolder)..\..\System.Xml.XmlSerializer\pkg\System.Xml.XmlSerializer.pkgproj">
- <Project>{D62A6082-5229-4845-8BE9-75753E08C65A}</Project>
- <Name>System.Xml.XmlSerializer</Name>
- </ProjectReference>
- <ProjectReference Include="$(TestSourceFolder)..\..\System.Runtime.Serialization.Xml\pkg\System.Runtime.Serialization.Xml.pkgproj" />
- <ProjectReference Include="$(TestSourceFolder)..\..\System.Runtime.Serialization.Json\pkg\System.Runtime.Serialization.Json.pkgproj" />
- </ItemGroup>
- <ItemGroup>
- <None Include="$(TestSourceFolder)project.json" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
diff --git a/src/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs b/src/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs
index cb4cf37e6f..f5f13f0b9c 100644
--- a/src/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs
+++ b/src/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs
@@ -628,6 +628,7 @@ public static partial class DataContractSerializerTests
}
[Fact]
+ [ActiveIssue("dotnet/corefx #20478", TargetFrameworkMonikers.UapAot)]
public static void DCS_ListMembers()
{
TypeWithListMembers x = new TypeWithListMembers
@@ -812,6 +813,7 @@ public static partial class DataContractSerializerTests
[Fact]
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "dotnet/corefx #19516")]
+ [ActiveIssue("dotnet/corefx #20476", TargetFrameworkMonikers.UapAot)]
public static void DCS_TypeWithPrivateFieldAndPrivateGetPublicSetProperty()
{
TypeWithPrivateFieldAndPrivateGetPublicSetProperty x = new TypeWithPrivateFieldAndPrivateGetPublicSetProperty
@@ -1436,27 +1438,26 @@ public static partial class DataContractSerializerTests
Assert.StrictEqual(((SimpleKnownTypeValue)actual.SimpleTypeValue).StrProperty, "PropertyValue");
}
- [ActiveIssue(20361)]
[Fact]
+ [ActiveIssue("dotnet/corefx #19585", TargetFrameworkMonikers.UapAot)]
public static void DCS_ExceptionObject()
{
- var value = new ArgumentException("Test Exception");
- var actual = SerializeAndDeserialize<ArgumentException>(value, @"<ArgumentException xmlns=""http://schemas.datacontract.org/2004/07/System"" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:x=""http://www.w3.org/2001/XMLSchema""><ClassName i:type=""x:string"" xmlns="""">System.ArgumentException</ClassName><Message i:type=""x:string"" xmlns="""">Test Exception</Message><Data i:nil=""true"" xmlns=""""/><InnerException i:nil=""true"" xmlns=""""/><HelpURL i:nil=""true"" xmlns=""""/><StackTraceString i:nil=""true"" xmlns=""""/><RemoteStackTraceString i:nil=""true"" xmlns=""""/><RemoteStackIndex i:type=""x:int"" xmlns="""">0</RemoteStackIndex><ExceptionMethod i:nil=""true"" xmlns=""""/><HResult i:type=""x:int"" xmlns="""">-2147024809</HResult><Source i:nil=""true"" xmlns=""""/><WatsonBuckets i:nil=""true"" xmlns=""""/><ParamName i:nil=""true"" xmlns=""""/></ArgumentException>");
+ var value = new Exception("Test Exception");
+ var actual = SerializeAndDeserialize<Exception>(value, @"<Exception xmlns=""http://schemas.datacontract.org/2004/07/System"" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:x=""http://www.w3.org/2001/XMLSchema""><ClassName i:type=""x:string"" xmlns="""">System.Exception</ClassName><Message i:type=""x:string"" xmlns="""">Test Exception</Message><Data i:nil=""true"" xmlns=""""/><InnerException i:nil=""true"" xmlns=""""/><HelpURL i:nil=""true"" xmlns=""""/><StackTraceString i:nil=""true"" xmlns=""""/><RemoteStackTraceString i:nil=""true"" xmlns=""""/><RemoteStackIndex i:type=""x:int"" xmlns="""">0</RemoteStackIndex><ExceptionMethod i:nil=""true"" xmlns=""""/><HResult i:type=""x:int"" xmlns="""">-2146233088</HResult><Source i:nil=""true"" xmlns=""""/><WatsonBuckets i:nil=""true"" xmlns=""""/></Exception>");
Assert.StrictEqual(value.Message, actual.Message);
- Assert.StrictEqual(value.ParamName, actual.ParamName);
Assert.StrictEqual(value.Source, actual.Source);
Assert.StrictEqual(value.StackTrace, actual.StackTrace);
Assert.StrictEqual(value.HResult, actual.HResult);
Assert.StrictEqual(value.HelpLink, actual.HelpLink);
}
- [ActiveIssue(20361)]
[Fact]
- public static void DCS_ArgumentExceptionObject()
+ [ActiveIssue("dotnet/corefx #19585", TargetFrameworkMonikers.UapAot)]
+ public static void DCS_MyArgumentExceptionObject()
{
- var value = new ArgumentException("Test Exception", "paramName");
- var actual = SerializeAndDeserialize<ArgumentException>(value, @"<ArgumentException xmlns=""http://schemas.datacontract.org/2004/07/System"" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:x=""http://www.w3.org/2001/XMLSchema""><ClassName i:type=""x:string"" xmlns="""">System.ArgumentException</ClassName><Message i:type=""x:string"" xmlns="""">Test Exception</Message><Data i:nil=""true"" xmlns=""""/><InnerException i:nil=""true"" xmlns=""""/><HelpURL i:nil=""true"" xmlns=""""/><StackTraceString i:nil=""true"" xmlns=""""/><RemoteStackTraceString i:nil=""true"" xmlns=""""/><RemoteStackIndex i:type=""x:int"" xmlns="""">0</RemoteStackIndex><ExceptionMethod i:nil=""true"" xmlns=""""/><HResult i:type=""x:int"" xmlns="""">-2147024809</HResult><Source i:nil=""true"" xmlns=""""/><WatsonBuckets i:nil=""true"" xmlns=""""/><ParamName i:type=""x:string"" xmlns="""">paramName</ParamName></ArgumentException>");
+ var value = new MyArgumentException("Test Exception", "paramName");
+ var actual = SerializeAndDeserialize<MyArgumentException>(value, @"<MyArgumentException xmlns=""http://schemas.datacontract.org/2004/07/"" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:x=""http://www.w3.org/2001/XMLSchema""><ClassName i:type=""x:string"" xmlns="""">MyArgumentException</ClassName><Message i:type=""x:string"" xmlns="""">Test Exception</Message><Data i:nil=""true"" xmlns=""""/><InnerException i:nil=""true"" xmlns=""""/><HelpURL i:nil=""true"" xmlns=""""/><StackTraceString i:nil=""true"" xmlns=""""/><RemoteStackTraceString i:nil=""true"" xmlns=""""/><RemoteStackIndex i:type=""x:int"" xmlns="""">0</RemoteStackIndex><ExceptionMethod i:nil=""true"" xmlns=""""/><HResult i:type=""x:int"" xmlns="""">-2146233088</HResult><Source i:nil=""true"" xmlns=""""/><WatsonBuckets i:nil=""true"" xmlns=""""/><ParamName i:type=""x:string"" xmlns="""">paramName</ParamName></MyArgumentException>");
Assert.StrictEqual(value.Message, actual.Message);
Assert.StrictEqual(value.ParamName, actual.ParamName);
@@ -1466,15 +1467,14 @@ public static partial class DataContractSerializerTests
Assert.StrictEqual(value.HelpLink, actual.HelpLink);
}
- [ActiveIssue(20361)]
[Fact]
+ [ActiveIssue("dotnet/corefx #19585", TargetFrameworkMonikers.UapAot)]
public static void DCS_ExceptionMessageWithSpecialChars()
{
- var value = new ArgumentException("Test Exception<>&'\"");
- var actual = SerializeAndDeserialize<ArgumentException>(value, @"<ArgumentException xmlns=""http://schemas.datacontract.org/2004/07/System"" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:x=""http://www.w3.org/2001/XMLSchema""><ClassName i:type=""x:string"" xmlns="""">System.ArgumentException</ClassName><Message i:type=""x:string"" xmlns="""">Test Exception&lt;&gt;&amp;'""</Message><Data i:nil=""true"" xmlns=""""/><InnerException i:nil=""true"" xmlns=""""/><HelpURL i:nil=""true"" xmlns=""""/><StackTraceString i:nil=""true"" xmlns=""""/><RemoteStackTraceString i:nil=""true"" xmlns=""""/><RemoteStackIndex i:type=""x:int"" xmlns="""">0</RemoteStackIndex><ExceptionMethod i:nil=""true"" xmlns=""""/><HResult i:type=""x:int"" xmlns="""">-2147024809</HResult><Source i:nil=""true"" xmlns=""""/><WatsonBuckets i:nil=""true"" xmlns=""""/><ParamName i:nil=""true"" xmlns=""""/></ArgumentException>");
+ var value = new Exception("Test Exception<>&'\"");
+ var actual = SerializeAndDeserialize<Exception>(value, @"<Exception xmlns=""http://schemas.datacontract.org/2004/07/System"" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:x=""http://www.w3.org/2001/XMLSchema""><ClassName i:type=""x:string"" xmlns="""">System.Exception</ClassName><Message i:type=""x:string"" xmlns="""">Test Exception&lt;&gt;&amp;'""</Message><Data i:nil=""true"" xmlns=""""/><InnerException i:nil=""true"" xmlns=""""/><HelpURL i:nil=""true"" xmlns=""""/><StackTraceString i:nil=""true"" xmlns=""""/><RemoteStackTraceString i:nil=""true"" xmlns=""""/><RemoteStackIndex i:type=""x:int"" xmlns="""">0</RemoteStackIndex><ExceptionMethod i:nil=""true"" xmlns=""""/><HResult i:type=""x:int"" xmlns="""">-2146233088</HResult><Source i:nil=""true"" xmlns=""""/><WatsonBuckets i:nil=""true"" xmlns=""""/></Exception>");
Assert.StrictEqual(value.Message, actual.Message);
- Assert.StrictEqual(value.ParamName, actual.ParamName);
Assert.StrictEqual(value.Source, actual.Source);
Assert.StrictEqual(value.StackTrace, actual.StackTrace);
Assert.StrictEqual(value.HResult, actual.HResult);
@@ -1482,6 +1482,7 @@ public static partial class DataContractSerializerTests
}
[Fact]
+ [ActiveIssue("dotnet/corefx #19585", TargetFrameworkMonikers.UapAot)]
public static void DCS_InnerExceptionMessageWithSpecialChars()
{
var value = new Exception("", new Exception("Test Exception<>&'\""));
@@ -1600,6 +1601,7 @@ public static partial class DataContractSerializerTests
}
[Fact]
+ [ActiveIssue("dotnet/corefx #20478", TargetFrameworkMonikers.UapAot)]
public static void DCS_GenericQueue()
{
Queue<int> value = new Queue<int>();
@@ -1613,6 +1615,7 @@ public static partial class DataContractSerializerTests
}
[Fact]
+ [ActiveIssue("dotnet/corefx #20478", TargetFrameworkMonikers.UapAot)]
public static void DCS_GenericStack()
{
var value = new Stack<int>();
@@ -1628,6 +1631,7 @@ public static partial class DataContractSerializerTests
}
[Fact]
+ [ActiveIssue("dotnet/corefx #20478", TargetFrameworkMonikers.UapAot)]
public static void DCS_Queue()
{
var value = new Queue();
@@ -1642,6 +1646,7 @@ public static partial class DataContractSerializerTests
}
[Fact]
+ [ActiveIssue("dotnet/corefx #20478", TargetFrameworkMonikers.UapAot)]
public static void DCS_Stack()
{
var value = new Stack();
@@ -1657,6 +1662,7 @@ public static partial class DataContractSerializerTests
}
[Fact]
+ [ActiveIssue("dotnet/corefx #20478", TargetFrameworkMonikers.UapAot)]
public static void DCS_SortedList()
{
var value = new SortedList();
@@ -1669,6 +1675,7 @@ public static partial class DataContractSerializerTests
}
[Fact]
+ [ActiveIssue("dotnet/corefx #20478", TargetFrameworkMonikers.UapAot)]
public static void DCS_SystemVersion()
{
Version value = new Version(1, 2, 3, 4);
@@ -1688,7 +1695,6 @@ public static partial class DataContractSerializerTests
Assert.StrictEqual<TypeWithCommonTypeProperties>(value, deserializedValue);
}
-#if !uapaot
[Fact]
public static void DCS_TypeWithTypeProperty()
{
@@ -1698,7 +1704,6 @@ public static partial class DataContractSerializerTests
Assert.StrictEqual(value.Name, deserializedValue.Name);
Assert.StrictEqual(value.Type, deserializedValue.Type);
}
-#endif
[Fact]
public static void DCS_TypeWithExplicitIEnumerableImplementation()
@@ -1876,6 +1881,7 @@ public static partial class DataContractSerializerTests
}
[Fact]
+ [ActiveIssue("dotnet/corefx #20478", TargetFrameworkMonikers.UapAot)]
public static void DCS_ReadOnlyCollection()
{
List<string> list = new List<string>() { "Foo", "Bar" };
@@ -1887,14 +1893,14 @@ public static partial class DataContractSerializerTests
}
[Fact]
- [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "dotnet/corefx #18312")]
+ [ActiveIssue("dotnet/corefx #20478", TargetFrameworkMonikers.UapAot)]
public static void DCS_ReadOnlyDictionary()
{
var dict = new Dictionary<string, int>();
dict["Foo"] = 1;
dict["Bar"] = 2;
ReadOnlyDictionary<string, int> value = new ReadOnlyDictionary<string, int>(dict);
- var deserializedValue = SerializeAndDeserialize(value, @"<ReadOnlyDictionaryOfstringint xmlns=""http://schemas.datacontract.org/2004/07/System.Collections.ObjectModel"" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance""><_dictionary xmlns:a=""http://schemas.microsoft.com/2003/10/Serialization/Arrays""><a:KeyValueOfstringint><a:Key>Foo</a:Key><a:Value>1</a:Value></a:KeyValueOfstringint><a:KeyValueOfstringint><a:Key>Bar</a:Key><a:Value>2</a:Value></a:KeyValueOfstringint></_dictionary></ReadOnlyDictionaryOfstringint>");
+ var deserializedValue = SerializeAndDeserialize(value, @"<ReadOnlyDictionaryOfstringint xmlns=""http://schemas.datacontract.org/2004/07/System.Collections.ObjectModel"" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance""><m_dictionary xmlns:a=""http://schemas.microsoft.com/2003/10/Serialization/Arrays""><a:KeyValueOfstringint><a:Key>Foo</a:Key><a:Value>1</a:Value></a:KeyValueOfstringint><a:KeyValueOfstringint><a:Key>Bar</a:Key><a:Value>2</a:Value></a:KeyValueOfstringint></m_dictionary></ReadOnlyDictionaryOfstringint>");
Assert.StrictEqual(value.Count, deserializedValue.Count);
Assert.StrictEqual(value["Foo"], deserializedValue["Foo"]);
@@ -3046,6 +3052,7 @@ public static partial class DataContractSerializerTests
}
[Fact]
+ [ActiveIssue("dotnet/corefx #20478", TargetFrameworkMonikers.UapAot)]
public static void DCS_BasicRoundtripDCRDefaultCollections()
{
var defaultCollections = new SerializationTestTypes.DefaultCollections();
diff --git a/src/System.Runtime.Serialization.Xml/tests/ReflectionOnly/System.Runtime.Serialization.Xml.ReflectionOnly.Tests.csproj b/src/System.Runtime.Serialization.Xml/tests/ReflectionOnly/System.Runtime.Serialization.Xml.ReflectionOnly.Tests.csproj
index 7140347ae5..da0bc6bc7a 100644
--- a/src/System.Runtime.Serialization.Xml/tests/ReflectionOnly/System.Runtime.Serialization.Xml.ReflectionOnly.Tests.csproj
+++ b/src/System.Runtime.Serialization.Xml/tests/ReflectionOnly/System.Runtime.Serialization.Xml.ReflectionOnly.Tests.csproj
@@ -4,6 +4,7 @@
<PropertyGroup>
<DefineConstants>$(DefineConstants);ReflectionOnly</DefineConstants>
<ProjectGuid>{38889701-0af4-48b3-999c-e99d639c61b6}</ProjectGuid>
+ <DefineConstants Condition="'$(TargetGroup)' == 'uapaot'">$(DefineConstants);uapaot</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
diff --git a/src/System.Runtime.Serialization.Xml/tests/SerializationTypes.cs b/src/System.Runtime.Serialization.Xml/tests/SerializationTypes.cs
index 98d45cb0c7..19c7c3befd 100644
--- a/src/System.Runtime.Serialization.Xml/tests/SerializationTypes.cs
+++ b/src/System.Runtime.Serialization.Xml/tests/SerializationTypes.cs
@@ -16,6 +16,7 @@ using System.Xml.Serialization;
using System.IO;
using System.Text;
using System.Reflection;
+using System.Threading.Tasks;
namespace SerializationTypes
{
@@ -3074,6 +3075,50 @@ public class TestableDerivedException : System.Exception
public string TestProperty { get; set; }
}
+namespace DirectRef
+{
+ public class TypeWithIndirectRef
+ {
+ public static implicit operator Task<object>(TypeWithIndirectRef v)
+ {
+ throw new NotImplementedException();
+ }
+
+ public string Name { get; set; }
+ }
+}
+
+public class NookAppLocalState
+{
+ public int ArticleViewCount { get; set; }
+ public string CurrentlyReadingProductEAN { get; set; }
+ public PaymentType CurrentPaymentType { get; set; }
+ public bool IsFirstRun { get; set; }
+ public List<LocalReadingPosition> LocalReadingPositionState { get; set; }
+ public List<string> PreviousSearchQueries { get; set; }
+ public System.Drawing.Color TextColor;
+
+ [XmlIgnore]
+ public int IgnoreProperty;
+
+ public bool IsFirstRunDuplicate { get; set; }
+ // Nested Types
+ public enum PaymentType
+ {
+ Unconfigured,
+ Nook,
+ Microsoft
+ }
+}
+
+public class LocalReadingPosition
+{
+ public string Ean { get; set; }
+ public DateTime LastReadTime { get; set; }
+ public int PageCount { get; set; }
+ public string PageNumber { get; set; }
+ public string PlatformOffset { get; set; }
+}
public class TypeWithXmlElementProperty
{
@@ -5184,4 +5229,48 @@ public class Manager : EmployeeC
[DataMember]
public EmployeeC[] emps;
+}
+
+[Serializable]
+public class MyArgumentException : Exception, ISerializable
+{
+ private string _paramName;
+
+ public MyArgumentException() : base() { }
+
+ public MyArgumentException(string message) : base(message)
+ {
+ }
+
+ public MyArgumentException(string message, string paramName) : base(message)
+ {
+ _paramName = paramName;
+ }
+
+ protected MyArgumentException(SerializationInfo info, StreamingContext context) : base(info, context) {
+ _paramName = info.GetString("ParamName");
+ }
+
+ public string ParamName
+ {
+ get
+ {
+ return _paramName;
+ }
+ internal set
+ {
+ _paramName = value;
+ }
+ }
+
+ public override void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ if (info == null)
+ {
+ throw new ArgumentNullException("info");
+ }
+
+ base.GetObjectData(info, context);
+ info.AddValue("ParamName", _paramName, typeof(string));
+ }
} \ No newline at end of file
diff --git a/src/System.Runtime.Serialization.Xml/tests/System.Runtime.Serialization.Xml.Tests.csproj b/src/System.Runtime.Serialization.Xml/tests/System.Runtime.Serialization.Xml.Tests.csproj
index a201ee80b7..b49d33ee33 100644
--- a/src/System.Runtime.Serialization.Xml/tests/System.Runtime.Serialization.Xml.Tests.csproj
+++ b/src/System.Runtime.Serialization.Xml/tests/System.Runtime.Serialization.Xml.Tests.csproj
@@ -3,6 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<ProjectGuid>{30CAB353-089E-4294-B23B-F2DD1D945654}</ProjectGuid>
+ <DefineConstants Condition="'$(TargetGroup)' == 'uapaot'">$(DefineConstants);uapaot</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
diff --git a/src/System.Runtime.Serialization.Xml/tests/System.Runtime.Serialization.Xml.Tests.settings.targets b/src/System.Runtime.Serialization.Xml/tests/System.Runtime.Serialization.Xml.Tests.settings.targets
deleted file mode 100644
index 5f81a491c8..0000000000
--- a/src/System.Runtime.Serialization.Xml/tests/System.Runtime.Serialization.Xml.Tests.settings.targets
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <NugetTargetMoniker>.NETStandard,Version=v1.7</NugetTargetMoniker>
- <TestSourceFolder>$(MSBuildThisFileDirectory)\</TestSourceFolder>
- <DefineConstants Condition="'$(TargetGroup)' == 'uapaot'">$(DefineConstants);uapaot</DefineConstants>
- </PropertyGroup>
- <ItemGroup>
- <ProjectReference Include="$(TestSourceFolder)..\..\System.Private.DataContractSerialization\pkg\System.Private.DataContractSerialization.pkgproj">
- <Project>{6B4C1660-D158-4820-BE1C-D7A29CEBEC9B}</Project>
- <Name>System.Private.DataContractSerialization</Name>
- <KeepProjectReference>true</KeepProjectReference>
- </ProjectReference>
- <ProjectReference Include="$(TestSourceFolder)..\..\System.Runtime.Serialization.Primitives\pkg\System.Runtime.Serialization.Primitives.pkgproj">
- <Project>{CDF0ACB5-1361-4E48-8ECB-22E8022F5F01}</Project>
- <Name>System.Runtime.Serialization.Primitives</Name>
- </ProjectReference>
- <ProjectReference Include="$(TestSourceFolder)..\..\System.Xml.XmlSerializer\pkg\System.Xml.XmlSerializer.pkgproj">
- <Project>{D62A6082-5229-4845-8BE9-75753E08C65A}</Project>
- <Name>System.Xml.XmlSerializer</Name>
- </ProjectReference>
- <ProjectReference Include="$(TestSourceFolder)..\..\System.Runtime.Serialization.Xml\pkg\System.Runtime.Serialization.Xml.pkgproj" />
- <ProjectReference Include="$(TestSourceFolder)..\..\System.Runtime.Serialization.Json\pkg\System.Runtime.Serialization.Json.pkgproj" />
- </ItemGroup>
- <ItemGroup>
- <None Include="$(TestSourceFolder)project.json" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
diff --git a/src/System.Runtime.WindowsRuntime/src/System/Resources/WindowsRuntimeResourceManager.cs b/src/System.Runtime.WindowsRuntime/src/System/Resources/WindowsRuntimeResourceManager.cs
index 3f8fe67897..45c8b426cd 100644
--- a/src/System.Runtime.WindowsRuntime/src/System/Resources/WindowsRuntimeResourceManager.cs
+++ b/src/System.Runtime.WindowsRuntime/src/System/Resources/WindowsRuntimeResourceManager.cs
@@ -436,6 +436,13 @@ namespace System.Resources
if (s_globalResourceContextBestFitCultureInfo != null && s_globalResourceContextBestFitCultureInfo.Name.Equals(ci.Name, StringComparison.OrdinalIgnoreCase))
{
+ if (!ReferenceEquals(s_globalResourceContextBestFitCultureInfo, ci))
+ {
+ // We have same culture name but different reference, we'll need to update s_globalResourceContextBestFitCultureInfo only as ci can
+ // be a customized subclassed culture which setting different values for NFI, DTFI...etc.
+ s_globalResourceContextBestFitCultureInfo = ci;
+ }
+
// the default culture is already set. nothing more need to be done
return true;
}
diff --git a/src/System.Runtime/tests/System.Runtime.Tests.csproj b/src/System.Runtime/tests/System.Runtime.Tests.csproj
index 45e4bb41d6..faba8325ca 100644
--- a/src/System.Runtime/tests/System.Runtime.Tests.csproj
+++ b/src/System.Runtime/tests/System.Runtime.Tests.csproj
@@ -48,6 +48,9 @@
<Compile Include="$(CommonTestPath)\System\IO\TempFile.cs">
<Link>Common\System\IO\TempFile.cs</Link>
</Compile>
+ <Compile Include="$(CommonTestPath)\System\Reflection\MockParameterInfo.cs">
+ <Link>Common\System\Reflection\MockParameterInfo.cs</Link>
+ </Compile>
<Compile Include="Helpers.cs" />
<Compile Include="System\ActivatorTests.cs" />
<Compile Include="System\ArrayTests.cs" />
@@ -248,4 +251,4 @@
</Reference>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project> \ No newline at end of file
+</Project>
diff --git a/src/System.Runtime/tests/System/ArrayTests.netcoreapp.cs b/src/System.Runtime/tests/System/ArrayTests.netcoreapp.cs
index f03b5fad41..d1492e7967 100644
--- a/src/System.Runtime/tests/System/ArrayTests.netcoreapp.cs
+++ b/src/System.Runtime/tests/System/ArrayTests.netcoreapp.cs
@@ -53,7 +53,6 @@ namespace System.Tests
[Theory]
[MemberData(nameof(Fill_Generic_TestData))]
- [ActiveIssue("TFS 437849 - Universal Shared Generics issue", TargetFrameworkMonikers.UapAot)]
public static void Fill_Generic<T>(IEnumerable<T> source, T value, int startIndex, int count)
{
if (startIndex == 0 && count == source.Count())
diff --git a/src/System.Runtime/tests/System/LazyTests.cs b/src/System.Runtime/tests/System/LazyTests.cs
index 294d53ae4d..707f7c7b82 100644
--- a/src/System.Runtime/tests/System/LazyTests.cs
+++ b/src/System.Runtime/tests/System/LazyTests.cs
@@ -365,6 +365,7 @@ namespace System.Tests
}
[Fact]
+ [ActiveIssue(19119, TargetFrameworkMonikers.Netcoreapp)]
public static void Serialization_ValueType()
{
Lazy<int> fortytwo = BinaryFormatterHelpers.Clone(new Lazy<int>(() => 42));
@@ -373,6 +374,7 @@ namespace System.Tests
}
[Fact]
+ [ActiveIssue(19119, TargetFrameworkMonikers.Netcoreapp)]
public static void Serialization_RefType()
{
Lazy<string> fortytwo = BinaryFormatterHelpers.Clone(new Lazy<string>(() => "42"));
diff --git a/src/System.Runtime/tests/System/Reflection/ParameterInfoTests.cs b/src/System.Runtime/tests/System/Reflection/ParameterInfoTests.cs
index 944e7806cf..6b51c65deb 100644
--- a/src/System.Runtime/tests/System/Reflection/ParameterInfoTests.cs
+++ b/src/System.Runtime/tests/System/Reflection/ParameterInfoTests.cs
@@ -6,6 +6,7 @@ using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.CompilerServices;
+using System.Runtime.Serialization;
using Xunit;
namespace System.Reflection.Tests
@@ -69,6 +70,65 @@ namespace System.Reflection.Tests
Assert.True(false, "Expected to find MyAttribute");
}
+ [Theory]
+ [MemberData(nameof(VerifyParameterInfoGetRealObjectWorks_TestData))]
+ public static void VerifyParameterInfoGetRealObjectWorks(MemberInfo pretendMember, int pretendPosition, string expectedParameterName)
+ {
+ // Regression test for https://github.com/dotnet/corefx/issues/20574
+ //
+ // It's easy to forget that ParameterInfo's and runtime-implemented ParameterInfo's are different objects and just because the
+ // latter doesn't support serialization doesn't mean other providers won't either.
+ //
+ // For historical reasons, ParameterInfo contains some serialization support that subtypes can optionally hang off. This
+ // test ensures that support doesn't get vaporized.
+
+ // Just pretend that we're BinaryFormatter and are deserializing a Parameter...
+ IObjectReference podParameter = new PodPersonParameterInfo(pretendMember, pretendPosition);
+ StreamingContext sc = new StreamingContext(StreamingContextStates.Clone);
+ ParameterInfo result = (ParameterInfo)(podParameter.GetRealObject(sc));
+
+ Assert.Equal(pretendPosition, result.Position);
+ Assert.Equal(expectedParameterName, result.Name);
+ Assert.Equal(pretendMember.Name, result.Member.Name);
+ }
+
+ public static IEnumerable<object[]> VerifyParameterInfoGetRealObjectWorks_TestData
+ {
+ get
+ {
+ Type t = typeof(PretendParent);
+ ConstructorInfo ctor = t.GetConstructor(new Type[] { typeof(int), typeof(int) });
+ MethodInfo method = t.GetMethod(nameof(PretendParent.PretendMethod));
+ PropertyInfo property = t.GetProperty("Item");
+
+ yield return new object[] { ctor, 0, "a" };
+ yield return new object[] { ctor, 1, "b" };
+ yield return new object[] { method, -1, null };
+ yield return new object[] { method, 0, "x" };
+ yield return new object[] { method, 1, "y" };
+ yield return new object[] { property, 0, "index1" };
+ yield return new object[] { property, 1, "index2" };
+ }
+ }
+
+ private sealed class PretendParent
+ {
+ public PretendParent(int a, int b) { }
+ public void PretendMethod(int x, int y) { }
+ public int this[int index1, int index2] { get { throw null; } }
+ }
+
+ private sealed class PodPersonParameterInfo : MockParameterInfo
+ {
+ public PodPersonParameterInfo(MemberInfo pretendMember, int pretendPosition)
+ {
+ // Serialization can recreate a ParameterInfo from just these two pieces of data. Of course, this is just a test and no one
+ // ever told this Member that it was adopting a counterfeit Parameter, but this is just a test...
+ MemberImpl = pretendMember;
+ PositionImpl = pretendPosition;
+ }
+ }
+
private static void Foo1(BindingFlags bf = BindingFlags.DeclaredOnly) { }
private static void Foo2([CustomBindingFlags(Value = BindingFlags.IgnoreCase)] BindingFlags bf) { }
diff --git a/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RijndaelImplementation.cs b/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RijndaelImplementation.cs
index 56bf7f4a02..5598633632 100644
--- a/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RijndaelImplementation.cs
+++ b/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RijndaelImplementation.cs
@@ -34,7 +34,7 @@ namespace Internal.Cryptography
if (value == 192 || value == 256)
throw new PlatformNotSupportedException(SR.Cryptography_Rijndael_BlockSize);
- // Any other invalid block size will get the normal “invalid block size” exception.
+ // Any other invalid block size will get the normal "invalid block size" exception.
_impl.BlockSize = value;
}
}
diff --git a/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RijndaelManaged.cs b/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RijndaelManaged.cs
index 6027356039..b3dc2d78ae 100644
--- a/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RijndaelManaged.cs
+++ b/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RijndaelManaged.cs
@@ -28,7 +28,7 @@ namespace System.Security.Cryptography
if (value == 192 || value == 256)
throw new PlatformNotSupportedException(SR.Cryptography_Rijndael_BlockSize);
- // Any other invalid block size will get the normal “invalid block size” exception.
+ // Any other invalid block size will get the normal "invalid block size" exception.
_impl.BlockSize = value;
}
}
diff --git a/src/System.Security.Cryptography.X509Certificates/tests/CertificateCreation/EccTestData.cs b/src/System.Security.Cryptography.X509Certificates/tests/CertificateCreation/EccTestData.cs
index de9e08c96c..608588e5c3 100644
--- a/src/System.Security.Cryptography.X509Certificates/tests/CertificateCreation/EccTestData.cs
+++ b/src/System.Security.Cryptography.X509Certificates/tests/CertificateCreation/EccTestData.cs
@@ -45,7 +45,7 @@ namespace System.Security.Cryptography.X509Certificates.Tests.CertificateCreatio
CurveOid = Secp256r1OidValue,
CurveEncodedOidHex = Secp256r1OidHexValue,
- // Suite B Implementer’s Guide to FIPS 186-3,
+ // Suite B ImplementerÂ’s Guide to FIPS 186-3,
// D.1 Example ECDSA Signature for P-256
KeyParameters = new ECParameters
{
@@ -67,7 +67,7 @@ namespace System.Security.Cryptography.X509Certificates.Tests.CertificateCreatio
CurveOid = Secp384r1OidValue,
CurveEncodedOidHex = Secp384r1OidHexValue,
- // Suite B Implementer’s Guide to FIPS 186-3,
+ // Suite B ImplementerÂ’s Guide to FIPS 186-3,
// D.2 Example ECDSA Signature for P-384
KeyParameters = new ECParameters
{
diff --git a/src/System.Security.Cryptography.X509Certificates/tests/ChainTests.cs b/src/System.Security.Cryptography.X509Certificates/tests/ChainTests.cs
index d90e32c275..f68770ec97 100644
--- a/src/System.Security.Cryptography.X509Certificates/tests/ChainTests.cs
+++ b/src/System.Security.Cryptography.X509Certificates/tests/ChainTests.cs
@@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
+using System.Threading;
using Xunit;
namespace System.Security.Cryptography.X509Certificates.Tests
@@ -569,6 +570,8 @@ namespace System.Security.Cryptography.X509Certificates.Tests
chainElement.Certificate.Dispose();
}
+
+ Thread.Sleep(1000); // For network flakiness
}
Assert.True(valid, $"Online Chain Built Validly within {RetryLimit} tries");
diff --git a/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.Tests/ServiceControllerTests.cs b/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.Tests/ServiceControllerTests.cs
index d2c5de554f..bbdcf074d5 100644
--- a/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.Tests/ServiceControllerTests.cs
+++ b/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.Tests/ServiceControllerTests.cs
@@ -89,7 +89,8 @@ namespace System.ServiceProcess.Tests
private void AssertExpectedProperties(ServiceController testServiceController)
{
- Assert.Equal(_testService.TestServiceName, testServiceController.ServiceName);
+ var comparer = PlatformDetection.IsFullFramework ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal; // Full framework upper cases the name
+ Assert.Equal(_testService.TestServiceName, testServiceController.ServiceName, comparer);
Assert.Equal(_testService.TestServiceDisplayName, testServiceController.DisplayName);
Assert.Equal(_testService.TestMachineName, testServiceController.MachineName);
Assert.Equal(ServiceType.Win32OwnProcess, testServiceController.ServiceType);
@@ -162,7 +163,7 @@ namespace System.ServiceProcess.Tests
public void Start_NullArg_ThrowsArgumentNullException()
{
var controller = new ServiceController(_testService.TestServiceName);
- AssertExtensions.Throws<ArgumentNullException>("args[0]", () => controller.Start(new string[] { null } ));
+ Assert.Throws<ArgumentNullException>(() => controller.Start(new string[] { null } ));
}
[ConditionalFact(nameof(RunningWithElevatedPrivileges))]
diff --git a/src/System.Text.Encoding/tests/Encoding/Encoding.cs b/src/System.Text.Encoding/tests/Encoding/Encoding.cs
index f34e48e65d..dfb5af4b6f 100644
--- a/src/System.Text.Encoding/tests/Encoding/Encoding.cs
+++ b/src/System.Text.Encoding/tests/Encoding/Encoding.cs
@@ -46,6 +46,7 @@ namespace System.Text.Encodings.Tests
[Fact]
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Full framework uses system ACP and not UTF8")]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20715 - Sync up Encoding code between CoreRT and CoreCLR", TargetFrameworkMonikers.UapAot)]
public static void DefaultEncodingBOMTest()
{
UTF8Encoding defaultEncoding = Encoding.Default as UTF8Encoding;
@@ -68,6 +69,7 @@ namespace System.Text.Encodings.Tests
[Theory]
[MemberData(nameof(Encoding_TestData))]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20715 - Sync up Encoding code between CoreRT and CoreCLR", TargetFrameworkMonikers.UapAot)]
public static void NormalizationTest(int codepage, string name, string bodyName, string headerName, bool isBrowserDisplay,
bool isBrowserSave, bool isMailNewsDisplay, bool isMailNewsSave, int windowsCodePage)
{
@@ -84,6 +86,7 @@ namespace System.Text.Encodings.Tests
[Theory]
[MemberData(nameof(Normalization_TestData))]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20715 - Sync up Encoding code between CoreRT and CoreCLR", TargetFrameworkMonikers.UapAot)]
public static void NormalizationTest(int codepage, bool normalized, bool normalizedC, bool normalizedD, bool normalizedKC, bool normalizedKD)
{
Encoding encoding = Encoding.GetEncoding(codepage);
diff --git a/src/System.Text.Encoding/tests/UTF32Encoding/UTF32EncodingTests.cs b/src/System.Text.Encoding/tests/UTF32Encoding/UTF32EncodingTests.cs
index 573b97fa1f..2c91772148 100644
--- a/src/System.Text.Encoding/tests/UTF32Encoding/UTF32EncodingTests.cs
+++ b/src/System.Text.Encoding/tests/UTF32Encoding/UTF32EncodingTests.cs
@@ -85,6 +85,7 @@ namespace System.Text.Tests
[Theory]
[MemberData(nameof(Encodings_TestData))]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20715 - Sync up Encoding code between CoreRT and CoreCLR", TargetFrameworkMonikers.UapAot)]
public void WebName(UTF32Encoding encoding, string webName)
{
Assert.Equal(webName, encoding.WebName);
diff --git a/src/System.Text.Encoding/tests/UTF8Encoding/UTF8EncodingDecode.cs b/src/System.Text.Encoding/tests/UTF8Encoding/UTF8EncodingDecode.cs
index 618858cbc5..78a5f4da6f 100644
--- a/src/System.Text.Encoding/tests/UTF8Encoding/UTF8EncodingDecode.cs
+++ b/src/System.Text.Encoding/tests/UTF8Encoding/UTF8EncodingDecode.cs
@@ -103,6 +103,7 @@ namespace System.Text.Tests
[Theory]
[MemberData(nameof(Decode_TestData))]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20525", TargetFrameworkMonikers.UapAot)]
public void Decode(byte[] bytes, int index, int count, string expected)
{
EncodingHelpers.Decode(new UTF8Encoding(true, false), bytes, index, count, expected);
diff --git a/src/System.Text.Encoding/tests/UnicodeEncoding/UnicodeEncodingDecode.cs b/src/System.Text.Encoding/tests/UnicodeEncoding/UnicodeEncodingDecode.cs
index 3909d68511..cca503a071 100644
--- a/src/System.Text.Encoding/tests/UnicodeEncoding/UnicodeEncodingDecode.cs
+++ b/src/System.Text.Encoding/tests/UnicodeEncoding/UnicodeEncodingDecode.cs
@@ -73,6 +73,7 @@ namespace System.Text.Tests
[Theory]
[MemberData(nameof(Decode_TestData))]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20525", TargetFrameworkMonikers.UapAot)]
public void Decode(byte[] littleEndianBytes, int index, int count, string expected)
{
byte[] bigEndianBytes = GetBigEndianBytes(littleEndianBytes, index, count);
diff --git a/src/System.Text.Encoding/tests/UnicodeEncoding/UnicodeEncodingTests.cs b/src/System.Text.Encoding/tests/UnicodeEncoding/UnicodeEncodingTests.cs
index b3d5672ea4..a6a13da532 100644
--- a/src/System.Text.Encoding/tests/UnicodeEncoding/UnicodeEncodingTests.cs
+++ b/src/System.Text.Encoding/tests/UnicodeEncoding/UnicodeEncodingTests.cs
@@ -85,6 +85,7 @@ namespace System.Text.Tests
[Theory]
[MemberData(nameof(Encodings_TestData))]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20715 - Sync up Encoding code between CoreRT and CoreCLR", TargetFrameworkMonikers.UapAot)]
public void WebName(UnicodeEncoding encoding, string expected)
{
Assert.Equal(expected, encoding.WebName);
diff --git a/src/System.Threading.Thread/src/System.Threading.Thread.csproj b/src/System.Threading.Thread/src/System.Threading.Thread.csproj
index 072afcc184..d2e3db5937 100644
--- a/src/System.Threading.Thread/src/System.Threading.Thread.csproj
+++ b/src/System.Threading.Thread/src/System.Threading.Thread.csproj
@@ -21,7 +21,6 @@
<Compile Include="System\Threading\Thread.cs" />
<Compile Include="System\Threading\Thread.Unix.cs" Condition="'$(TargetsUnix)' == 'true'" />
<Compile Include="System\Threading\Thread.Windows.cs" Condition="'$(TargetsWindows)' == 'true'" />
- <Compile Include="System\Threading\ThreadAbortException.cs" />
<Compile Include="System\Threading\ThreadExceptionEventArgs.cs" />
</ItemGroup>
<ItemGroup>
diff --git a/src/System.Threading.Thread/src/System/Threading/ThreadAbortException.cs b/src/System.Threading.Thread/src/System/Threading/ThreadAbortException.cs
deleted file mode 100644
index 20c7373bb2..0000000000
--- a/src/System.Threading.Thread/src/System/Threading/ThreadAbortException.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Runtime.Serialization;
-
-namespace System.Threading
-{
- // Thread.Abort() is not supported in .NET Core, so this is currently just a stub to make the type available at compile time
- [Serializable]
- public sealed class ThreadAbortException : SystemException
- {
- private ThreadAbortException()
- {
- }
-
- public object ExceptionState => null;
- }
-}
diff --git a/src/System.Threading.Thread/tests/ThreadTests.cs b/src/System.Threading.Thread/tests/ThreadTests.cs
index 117392c1d7..5558bc021a 100644
--- a/src/System.Threading.Thread/tests/ThreadTests.cs
+++ b/src/System.Threading.Thread/tests/ThreadTests.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
+using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.InteropServices;
@@ -767,9 +768,11 @@ namespace System.Threading.Threads.Tests
Assert.Throws<ArgumentOutOfRangeException>(() => Thread.Sleep(TimeSpan.FromMilliseconds((double)int.MaxValue + 1)));
Thread.Sleep(0);
- var startTime = DateTime.UtcNow;
+
+ var stopwatch = Stopwatch.StartNew();
Thread.Sleep(500);
- Assert.InRange((DateTime.UtcNow - startTime).TotalMilliseconds, 100, int.MaxValue);
+ stopwatch.Stop();
+ Assert.InRange((int)stopwatch.ElapsedMilliseconds, 100, int.MaxValue);
}
[Fact]
diff --git a/src/System.Threading/tests/EtwTests.cs b/src/System.Threading/tests/EtwTests.cs
index 65337021e8..552931aee1 100644
--- a/src/System.Threading/tests/EtwTests.cs
+++ b/src/System.Threading/tests/EtwTests.cs
@@ -10,6 +10,7 @@ namespace System.Threading.Tests
public class EtwTests
{
[Fact]
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/20592", TargetFrameworkMonikers.UapAot)]
public void TestEtw()
{
using (var listener = new TestEventListener("System.Threading.SynchronizationEventSource", EventLevel.Verbose))